clang-query is a tool that allows you to quickly iterate and develop the difficult part of a matcher. Once the design of the matcher is completed, it can be transferred to a C++ clang-tidy plugin.
Questions tagged [clang-query]
20 questions
0
votes
1 answer
AST MATCHER:How to match un init double param in constructor
I 'm having a question to match uninit double field in constructor.
Given the code below
class un_init_double {
public:
un_init_double() {
init_param_ = 0;
}
bool compare(un_init_double& other) {
if (other.un_init_param_ ==…

Doggy
- 1
- 1
- 1
0
votes
1 answer
List Clang-Query Matchers
Is there a way to list all possible matchers in clang-query? The AST matcher reference list is not necessarily the most up-to-date version. Even the list in ASTMatchers.h clang header (clang-6.0.0) does not show what is currently available. For…

TheAhmad
- 810
- 1
- 9
- 21
0
votes
1 answer
Matching Function Pointers in Clang-Query
What is the query to match a function pointer, e.g., in the following code:
int foo(struct A *a, int b)
{
return a->x->y(b);
}
y is the function pointer to match.

TheAhmad
- 810
- 1
- 9
- 21
0
votes
1 answer
How to get the entire expression on the right hand side of clang abstract syntax tree?
Let us take a toy example, say I have the following code in test.cpp file:
int main()
{
int gt = 3;
int g = 10 / gt;
}
I want to find the variable name of the denominator in the division operation, then using clang I get the abstract…

The Voyager
- 617
- 8
- 21
0
votes
1 answer
Get classes with at least two same access specifiers with ASTMatcher
I need to catch cases in C++ code when there are two or more similar access specifiers in the class.
Let's say there are two classes
class A{
public:
int b;
public:
int a;
}
class B{
public:
int a;
}
How to match class A (because it…

igagis
- 1,959
- 1
- 17
- 27