Re: [cfe-users] Removing or obfuscating RTTI type name strings

2021-09-03 Thread Richard Smith via cfe-users
On Fri, 27 Aug 2021 at 11:03, Andy Gibbs via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi there, > > I'm hitting a rather difficult problem. I have to compile with RTTI data > structures generated because, even though I am not using dynamic_cast or > typeid in my application code, I am linki

Re: [cfe-users] How to find the physical end of an expression?

2021-05-05 Thread Richard Smith via cfe-users
On Wed, 28 Apr 2021 at 13:53, Taylor, Max via cfe-users < cfe-users@lists.llvm.org> wrote: > Greetings. > > > > I’m building a source-to-source tool with clang. What I want to do is > instrument stores made with the binary = operator. Currently, I’m running > into problems with rewriting expressio

Re: [cfe-users] Missing AST Node for parsing code with std::vector::data()

2020-12-14 Thread Richard Smith via cfe-users
On Thu, 3 Dec 2020 at 04:02, Владимир Фролов via cfe-users < cfe-users@lists.llvm.org> wrote: > Greetings! I'm using clang for source-to-source translation. > > Recently I got a problem with parsing code which use templates. > First, here is the working example: > > struct MyTestVector2 > { > uns

Re: [cfe-users] Code which compiles with g++ but not with clang++

2020-11-09 Thread Richard Smith via cfe-users
On Thu, 5 Nov 2020 at 09:29, Marshall Clow via cfe-users < cfe-users@lists.llvm.org> wrote: > On Nov 5, 2020, at 6:34 AM, Pavel Černohorský via cfe-users < > cfe-users@lists.llvm.org> wrote: > > > > Hello, > > > > I would like to ask what is wrong with the following code: > > ``` > > > > #include

Re: [cfe-users] inconsistent compilation error inside constexpr if

2020-08-23 Thread Richard Smith via cfe-users
On Fri, 21 Aug 2020 at 13:29, Manu agarwal via cfe-users < cfe-users@lists.llvm.org> wrote: > Hello, > > In the below code the compiler throws "undeclared identifier" when the > commented line is uncommented. Whereas the line just before compiles fine. > > Regards, > Manu > > typedef bool (* Dummy

Re: [cfe-users] Template parameter matcher?

2020-06-29 Thread Richard Smith via cfe-users
On Fri, 26 Jun 2020 at 11:30, Robert Ankeney wrote: > Thanks Richard! This works great! One more question - assuming I have a > templated class CClass, how would I match tVal for: > void myFunc(CClass* tVal) ? > It depends exactly what you're looking for. If you don't care what CClass is, and wa

Re: [cfe-users] Template parameter matcher?

2020-06-24 Thread Richard Smith via cfe-users
The declarations of tVal and tParam can be matched by varDecl(hasType(templateTypeParmType())) The use of tVal can be matched by declRefExpr(hasDeclaration(varDecl(hasType(templateTypeParmType() https://godbolt.org/z/B3SuC3 On Tue, 23 Jun 2020 at 15:47, Robert Ankeney via cfe-users < cfe

Re: [cfe-users] Location of function name?

2020-05-26 Thread Richard Smith via cfe-users
On Fri, 22 May 2020 at 19:06, Sterling B via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi Clang Experts, could you kindly advice how to get location of a > function *name* when visiting FunctionDecl in RecursiveASTVisitor > (getBeginLoc and getEndLoc return the whole range for the definition,

Re: [cfe-users] _Decimal128 on PowerPC

2020-05-26 Thread Richard Smith via cfe-users
On Fri, 8 May 2020 at 00:09, Jeffrey Walton via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi Everyone, > > I'm testing Steven Munroe's pveclib library > (https://github.com/munroesj52/pveclib). It is testing OK with GCC, > but I am having trouble with Clang. > > I've been able to test up to C

Re: [cfe-users] Compiling C++ 20 Example from 24.6.4.1 [range.istream.overview] produces errors with libstdc++ 10

2020-05-26 Thread Richard Smith via cfe-users
On Tue, 26 May 2020 at 07:39, Ray Lischner via cfe-users < cfe-users@lists.llvm.org> wrote: > On 5/15/20 6:53 PM, Richard Smith wrote: > > Can you try calling begin() on an istream_view& directly, and see > > if you get the same error? > > $ cat istream_begin.cpp > #include > #include > #include

Re: [cfe-users] Compiling C++ 20 Example from 24.6.4.1 [range.istream.overview] produces errors with libstdc++ 10

2020-05-15 Thread Richard Smith via cfe-users
On Thu, 14 May 2020 at 03:50, Ray Lischner wrote: > On 5/13/20 10:09 PM, Richard Smith wrote: > > On Wed, 6 May 2020 at 09:24, Ray Lischner via cfe-users > > mailto:cfe-users@lists.llvm.org>> wrote: > > > > I am using clang++ 10 with GCC libstdc++ 10 prerelease. I tried > > compiling the

Re: [cfe-users] Compiling C++ 20 Example from 24.6.4.1 [range.istream.overview] produces errors with libstdc++ 10

2020-05-13 Thread Richard Smith via cfe-users
On Wed, 6 May 2020 at 09:24, Ray Lischner via cfe-users < cfe-users@lists.llvm.org> wrote: > I am using clang++ 10 with GCC libstdc++ 10 prerelease. I tried > compiling the example from section 24.6.4.1 [range.istream.overview]. It > works with g++ 10 but with clang++ 10 -std=c++20, I get > constr

Re: [cfe-users] Get AST of uncomplete C++ code

2020-04-24 Thread Richard Smith via cfe-users
On Tue, 21 Apr 2020 at 05:41, Dr S3curity via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > Imagine the very basic code below, it has some missing elements, we dont > have the foo() function and MyClass class, > > ```test.cpp > int main(int argc, char *argv[]) > { > MyClass* mc = new

Re: [cfe-users] Linking problem with implicit instantiation of constructor/destructor

2020-04-20 Thread Richard Smith via cfe-users
In the latest draft, this is [temp.pre]/10: """ A definition of a function template, member function of a class template, variable template, or static data member of a class template shall be reachable from the end of every definition domain (6.3) in which it is implicitly instantiated (13.9.1) un

Re: [cfe-users] order of object files at link affects exception catching

2020-04-14 Thread Richard Smith via cfe-users
On Wed, 8 Apr 2020 at 10:14, krokus via cfe-users wrote: > Richard, > > Thanks for the quick response; it gave me some directions to > investigate further, otherwise it seemed I got stuck trying to make > sense of many moving pieces in this puzzle. So, my understanding is > that generally the run

Re: [cfe-users] order of object files at link affects exception catching

2020-04-05 Thread Richard Smith via cfe-users
On Sun, 5 Apr 2020 at 15:31, krokus via cfe-users wrote: > First of all a preface - This problem was spotted while trying to > build a large C++ project which links a close to 100 of object file > together, plus libraries. I can't replicate this behavior in a simple > isolated test. Just want to

Re: [cfe-users] clang and C++: exporting member function template from library using attribute visibility("default")

2020-04-05 Thread Richard Smith via cfe-users
On Mon, 30 Mar 2020 at 14:19, Alexis Murzeau via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > When using clang, I discovered that it errors out where other compilers > doesn't (GCC and MSVC). > > I'm trying to do this: > - Have a library compiled with -fvisibility=hidden and adding > __

Re: [cfe-users] [EXT] Final C++20 rules and -Wambiguous-reversed-operator

2020-03-19 Thread Richard Smith via cfe-users
On Thu, 19 Mar 2020 at 05:28, Romain GEISSLER wrote: > > Le 15 mars 2020 à 20:14, Richard Smith a écrit : > > > > No, we still don't have a resolution from the C++ committee, but it's > being discussed by various implementers, and we hope to present to the > committee a suggested set of changes

Re: [cfe-users] Final C++20 rules and -Wambiguous-reversed-operator

2020-03-15 Thread Richard Smith via cfe-users
On Thu, 12 Mar 2020 at 15:14, Romain GEISSLER via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > It looks like the working of C++20 introduced some breaking > compatibilities with some C++17 accepted patterns. From what I read in > https://reviews.llvm.org/rL375306 these incompatibilities

Re: [cfe-users] How to check whether a type is_copy_assignable?

2020-02-20 Thread Richard Smith via cfe-users
On Thu, 20 Feb 2020 at 09:33, Weston Carvalho wrote: > Richard, > > Thanks for your response! > > I'm currently getting all the CXXRecordDecls using the ASTMatchFinfer. > AFAICT, I can't access Sema since the MatchFinder is an ASTConsumer instead > of a SemaConsumer. I guess I can make my own Mat

Re: [cfe-users] How to check whether a type is_copy_assignable?

2020-02-19 Thread Richard Smith via cfe-users
On Thu, 6 Feb 2020 at 12:13, Weston Carvalho via cfe-users < cfe-users@lists.llvm.org> wrote: > HI, > > I'm trying to write a tool that uses the AST to look at all the class > declarations in our codebase and get some metrics on our use of special > member functions. (How many classes are copyable

Re: [cfe-users] Need a GCC-free LLVM/Clang on Linux.

2020-02-19 Thread Richard Smith via cfe-users
On Thu, 23 Jan 2020 at 07:24, Christopher H Green via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > I've spent the last several days trying to build a fast, full-featured > relocatable distribution of LLVM/Clang 9.0.1 on Linux RHEL7, which has an > older native GCC (4.8.5)—I can't require

Re: [cfe-users] is this compiller error

2020-02-12 Thread Richard Smith via cfe-users
On Fri, 7 Feb 2020 at 19:51, FRANČEK PRIJATELJ via cfe-users < cfe-users@lists.llvm.org> wrote: > /* > > Following code compiled with clang-cl on win10 generates 2 errors > (while the same code compiled with MS cl compiles): > > t1.cpp(12,35): error: in-class initializer for static data member is

Re: [cfe-users] got wrong parameter type using clang

2019-12-11 Thread Richard Smith via cfe-users
On Tue, 10 Dec 2019, 22:45 henry ding via cfe-users, < cfe-users@lists.llvm.org> wrote: > simple test.cpp: > void test(std::string xx,string bb,int aa){} > > clang usage: > int getFuncInfo(Rewriter* TheRewrite,clang::ASTContext *Context, const > FunctionDecl *func,FuncNode &node){ > clang::Lan

Re: [cfe-users] Clang compilation options to solve the comaptible issue?

2019-11-03 Thread Richard Smith via cfe-users
On Thu, 31 Oct 2019 at 01:45, Guofeng Zhang via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > I just stat using clang 8 not long ago. I need to compile our old c++ > source without changing it. It is compiled with Visual Studio before. Now I > want to migrate to clang as the compiler. >

Re: [cfe-users] constexpr pointer-to-member-function broken in Clang 9?

2019-10-02 Thread Richard Smith via cfe-users
On Tue, 1 Oct 2019 at 10:42, Michael Price - Dev via cfe-users < cfe-users@lists.llvm.org> wrote: > Should this be ill-formed? > > struct C { > constexpr C() {} > constexpr bool f() const { return true; } > }; > constexpr C c{}; > > constexpr bool fails_9_0_0(const C* pc, bool (C::*pm)() const

Re: [cfe-users] clang-tblgen not installed

2019-09-06 Thread Richard Smith via cfe-users
On Thu, 5 Sep 2019 at 20:19, Alex Biddulph via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi, > > Is there a reason why clang-tblgen is not installed with all of the > other clang binaries? > > According to > http://releases.llvm.org/8.0.0/docs/HowToCrossCompileLLVM.html > clang-tblgen (along

Re: [cfe-users] __builtin_constant_p(), __builtin_expect() and __builtin_types_compatible_p() and __has_builtin()

2019-08-12 Thread Richard Smith via cfe-users
On Fri, 9 Aug 2019 at 19:48, Matthew Fernandez wrote: > On Aug 9, 2019, at 14:58, Richard Smith via cfe-users < > cfe-users@lists.llvm.org> wrote: > > On Fri, 9 Aug 2019 at 10:32, Chris Hall via cfe-users < > cfe-users@lists.llvm.org> wrote: > >> On 09/08

Re: [cfe-users] __builtin_constant_p(), __builtin_expect() and __builtin_types_compatible_p() and __has_builtin()

2019-08-09 Thread Richard Smith via cfe-users
On Fri, 9 Aug 2019 at 10:32, Chris Hall via cfe-users < cfe-users@lists.llvm.org> wrote: > On 09/08/2019 15:00, Matthew Fernandez wrote: > >> On Aug 9, 2019, at 05:23, Chris Hall via cfe-users wrote: > >> > >> I find that __builtin_constant_p() works as expected, but > >> __has_builtin(constant_p)

Re: [cfe-users] How to get code for a function template specialization

2019-08-04 Thread Richard Smith via cfe-users
On Fri, 2 Aug 2019 at 15:05, Romulo via cfe-users wrote: > Hello there, thanks for your time reading this :) > > I am trying to extract the code for a specialized template function, but I > have no idea on how to proceed. I know I can use SourceManager to get the > original 'pure template' code b

Re: [cfe-users] Getting underlying type for `using typename` declaration

2019-07-22 Thread Richard Smith via cfe-users
On Wed, 17 Jul 2019 at 23:20, Victor “LOST” Milovanov via cfe-users < cfe-users@lists.llvm.org> wrote: > Hi CFE users! > > > > I am trying to get a `QualType` instance from > `UnresolvedUsingTypenameDecl`. Unlike `TypeAliasDecl` > `UnresolvedUsingTypenameDecl` does not have a `getUnderlyingType` m

Re: [cfe-users] Fwd: Re: [llvm-dev] Overriding macro values defined in source code

2019-05-10 Thread Richard Smith via cfe-users
On Thu, 9 May 2019 at 22:47, Sudhindra kulkarni wrote: > > Thanks Richard for the answer. > > I have another question regarding the include(-I) option. > > If we have a c file called cfile.c and a header file called header.h both in > the same directory say (dir x). cfile.c includes header.h as

Re: [cfe-users] Fwd: Re: [llvm-dev] Overriding macro values defined in source code

2019-05-08 Thread Richard Smith via cfe-users
On Mon, 6 May 2019 at 23:09, Sudhindra kulkarni via cfe-users wrote: > > > -- Forwarded message -- > From: "Tim Northover" > Date: May 1, 2019 3:48 PM > Subject: Re: [llvm-dev] Overriding macro values defined in source code > To: "Sudhindra kulkarni" > Cc: "LLVM Developers Mailin

Re: [cfe-users] How to have clang ignore gch directories?

2019-04-25 Thread Richard Smith via cfe-users
On Tue, 23 Apr 2019 at 12:06, Paul Smith via cfe-users wrote: > > How can I get clang to stop caring about gch directories for > precompiled headers that were created by GCC? > > Currently my main build uses GCC and it generates .gch directories: > > $ ls -1d foo_pch* > foo_pch.h > foo_pch.h

Re: [cfe-users] problem with `candidate template ignored: invalid explicitly-specified argument'

2018-11-07 Thread Richard Smith via cfe-users
On Wed, 7 Nov 2018 at 11:44, Jan Korous wrote: > > > On Nov 7, 2018, at 7:03 PM, Werner LEMBERG via cfe-users < > cfe-users@lists.llvm.org> wrote: > > > > > >> The rule for determining when a base class function declaration > >> introduced by a using-declaration is hidden by a derived class > >>

Re: [cfe-users] problem with `candidate template ignored: invalid explicitly-specified argument'

2018-11-07 Thread Richard Smith via cfe-users
The rule for determining when a base class function declaration introduced by a using-declaartion is hidden by a derived class function declaration does not take the template parameter list into account: http://eel.is/c++draft/namespace.udecl#15.sentence-1 So clang's behaviour is conforming and gc

Re: [cfe-users] [cfe-dev] Warnings for implicit constructors and wrong usage of auto

2018-05-15 Thread Richard Smith via cfe-users
On 15 May 2018 at 16:01, John McCall via cfe-dev wrote: > On May 15, 2018, at 6:05 PM, George Karpenkov via cfe-dev < > cfe-...@lists.llvm.org> wrote: > > +cfe-dev > > Hi Andrea, > > I think you might get more luck asking on the cfe-dev mailing list. > > > George > > On May 15, 2018, at 1:15 PM,