Re: [cfe-users] Why doesn't clang use colors for diagnostics by default?

2015-09-09 Thread Richard Trieu via cfe-users
Are you invoking Clang with "clang foo.cc" or "clang -cc1 foo.cc"? The first should detect if you have a color capable terminal and automatically turn on color diagnostics while the second needs the flag explicitly. The other possibility is that the Clang you are using was compiled with the libra

Re: [cfe-users] 3.8 indentation with -fdiagnostics-show-template-tree doesn't show tree

2016-05-24 Thread Richard Trieu via cfe-users
Hi Larry, Right now, the template type diffing only works when there are two templated types in the diagnostics message, and the templated types share the same base. It your first example, the two types are vector and vector. In the second error message, only one type is printed with the diagnos

Re: [cfe-users] finding in which function/method/scope a Decl is in, the parent so to say

2016-11-11 Thread Richard Trieu via cfe-users
It sounds like you want the DeclContext. Use the function Decl::getDeclContext() to get a DeclContext pointer. See http://clang.llvm.org/doxygen/classclang_1_1DeclContext.html for details about DeclContext. DeclContext::isTranslationUnit() for globals and DeclContext::isFunctionOrMethod() for fu

Re: [cfe-users] Format of AST entries?

2018-02-21 Thread Richard Trieu via cfe-users
Hi Ray, First off, understand that the AST dumper provides a human readable view of the AST that may be missing information and can change over time. It's good for a quick look into Clang's AST, but there are better options for tooling to work on the AST. (https://clang.llvm.org/docs/Tooling.htm

Re: [cfe-users] AST Recursive Visitor- Statements (Stmt *)

2019-07-30 Thread Richard Trieu via cfe-users
Hi Ayush, First, you need to know the classes associated with each of your target AST nodes. These are IfStmt, WhileStmt, ForStmt, BinaryOperator, and UnaryOperator. Each of these are sub-classes of Stmt. IfStmt, WhileStmt, ForStmt and direct sub-classes while BinaryOperator and UnaryOperator a

Re: [cfe-users] AST Recursive Visitor- Statements (Stmt *)

2019-08-01 Thread Richard Trieu via cfe-users
Adding back the mailing list. Please reply all to keep the discussion on the mailing list. On Thu, Aug 1, 2019 at 2:47 PM Ayush Mittal wrote: > Thanks Richard for the explanation. Really appreciate it. > One quick question, Within VisitStmt (BinaryOperator) how could I get an > access to DeclRe

Re: [cfe-users] AST Recursive Visitor- Statements (Stmt *)

2019-08-06 Thread Richard Trieu via cfe-users
RecursiveASTVisitor should have an ASTContext available. ASTContext has a getParents function, which may be of some use. Unfortunately, I haven't used this part of the ASTContext before, so I can't give any more concrete advice. As you've seen, it's easier to traverse down the AST than up it. O

Re: [cfe-users] AST Recursive Visitor- Statements (Stmt *)

2019-08-07 Thread Richard Trieu via cfe-users
The declarations are "ptr" and "bar". "*ptr" and "&bar" are expressions since * and & are C++ operators. If you want the type of "*ptr" or "&bar", then you need to get the associated UnaryOperator (a sub-class of Expr) and call getType() on it. On Wed, Aug 7, 2019 at 2:28 PM Ayush Mittal wrote: