Questions tagged [clang-ast-matchers]

67 questions
0
votes
1 answer

Enable only syntactic parsing in clang

I am trying to implement a clang tool that does syntactic analysis using ASTMatcher API. I am trying to find out how to specify extra flags for clang to disable semantic checks. I know clang builds a giant AST which includes system headers. Is there…
gPats
  • 315
  • 2
  • 17
0
votes
2 answers

Clang AST Match call to make_unique with specific class

I'm trying to use clang's AST matchers to target code like the following: #include namespace Demo { class Widget {}; } int main () { auto w = std::make_unique(); } In clang-query, I've tried the…
bgschiller
  • 2,087
  • 1
  • 16
  • 30
0
votes
1 answer

ClangAST Consumer: How to traverse statements, VarDecl, BinaryOperator inside FunctionDecl?

Inside the clang AST consumer, I have a walker for FunctionDecl. How to traverse the DeclStmt, Statements, BinaryOperator inside the function declarations. Please suggest with an example.
0
votes
1 answer

Clang AST Matcher: No CXXMethodDecl for `operator()`?

I have the following struct definition in a file: template struct banana { template void operator()(Args&&... args) const { _f(std::forward(args)...); } private: …
fbrereto
  • 35,429
  • 19
  • 126
  • 178
0
votes
1 answer

clang ASTMatcher without expanded from macro

I am doing a clang ASTMatcher to find the locations where isnan is defined in my source code. I am trying to understand why there are three matches eventhough I have restricted to match only in the main file. Please find a sample source code…
The Voyager
  • 617
  • 8
  • 21
0
votes
1 answer

Error: Matcher not found: equals

I am trying to use clang ASTMatcher to find if statments that has a condition with RHS as integer value 0 or 0.0f. For this purpose, I was able to write a query as follows: clang-query> match…
0
votes
1 answer

Clang - Detect when header files are done

I'm new to clang and I'm trying to add a #include<> after all the other includes are done. #include #include // I want to add my include here. I apologize if this is a silly question. But I'm not able to find which AST Matcher does…
XChikuX
  • 766
  • 1
  • 9
  • 33
1 2 3 4
5