Код: Выделить всё
// references_match.cpp
int main() {
const int a = 5;
int b = 5;
const auto& b_ref1 = b; // set output dump
clang-query> match varDecl( )
Match #1:
Binding for "root":
VarDecl 0x5bd04b2fa390 col:14 a 'const int' cinit
`-IntegerLiteral 0x5bd04b2fa3f8 'int' 5
...
Match #3:
Binding for "root":
VarDecl 0x5bd04b2fa5c0 col:14 b_ref1 'const int &' cinit
`-ImplicitCastExpr 0x5bd04b2fa820 'const int' lvalue
`-DeclRefExpr 0x5bd04b2fa628 'int' lvalue Var 0x5bd04b2fa4a0 'b' 'int'
...
clang-query> match varDecl( hasType(isConstQualified()) )
Match #1:
Binding for "root":
VarDecl 0x5bd04b2fa390 col:14 a 'const int' cinit
`-IntegerLiteral 0x5bd04b2fa3f8 'int' 5
1 match.
Подробнее здесь: https://stackoverflow.com/questions/793 ... -its-objec