Matches range-based for statements.
@@ -591,11 +708,10 @@ initList()
Matcher<Stmt> | integerLiteral | Matcher<IntegerLiteral>... |
-Matches integer literals of all sizes encodings.
+Matches integer literals of all sizes encodings, e.g.
+1, 1L, 0x1 and 1U.
-Not matching character-encoded integers such as L'a'.
-
-Example matches 1, 1L, 0x1, 1U
+Does not match character-encoded integers such as L'a'.
|
@@ -771,6 +887,14 @@ switchStmt()
|
+Matcher<Stmt> | temporaryObjectExpr | Matcher<CXXTemporaryObjectExpr>... |
+Matches functional cast expressions having N != 1 arguments
+
+Example: Matches Foo(bar, bar)
+ Foo h = Foo(bar, bar);
+ |
+
+
Matcher<Stmt> | thisExpr | Matcher<CXXThisExpr>... |
Matches implicit and explicit this expressions.
@@ -820,6 +944,16 @@ Example matches !a
|
+Matcher<Stmt> | unresolvedConstructExpr | Matcher<CXXUnresolvedConstructExpr>... |
+Matches unresolved constructor call expressions.
+
+Example matches T(t) in return statement of f
+ (matcher = unresolvedConstructExpr())
+ template <typename T>
+ void f(const T& t) { return T(t); }
+ |
+
+
Matcher<Stmt> | userDefinedLiteral | Matcher<UserDefinedLiteral>... |
Matches user defined literal operator call.
@@ -837,285 +971,11 @@ whileStmt()
|
-Matcher<TypeLoc> | arrayTypeLoc | Matcher<ArrayTypeLoc>... |
-Matches all kinds of arrays.
-
-Given
- int a[] = { 2, 3 };
- int b[4];
- void f() { int c[a[0]]; }
-arrayType()
- matches "int a[]", "int b[4]" and "int c[a[0]]";
- |
-
-
-Matcher<TypeLoc> | atomicTypeLoc | Matcher<AtomicTypeLoc>... |
-Matches atomic types.
-
-Given
- _Atomic(int) i;
-atomicType()
- matches "_Atomic(int) i"
- |
-
-
-Matcher<TypeLoc> | autoTypeLoc | Matcher<AutoTypeLoc>... |
-Matches types nodes representing C++11 auto types.
-
-Given:
- auto n = 4;
- int v[] = { 2, 3 }
- for (auto i : v) { }
-autoType()
- matches "auto n" and "auto i"
- |
-
-
-Matcher<TypeLoc> | blockPointerTypeLoc | Matcher<BlockPointerTypeLoc>... |
-Matches block pointer types, i.e. types syntactically represented as
-"void (^)(int)".
-
-The pointee is always required to be a FunctionType.
- |
-
-
-Matcher<TypeLoc> | builtinTypeLoc | Matcher<BuiltinTypeLoc>... |
-Matches builtin Types.
-
-Given
- struct A {};
- A a;
- int b;
- float c;
- bool d;
-builtinType()
- matches "int b", "float c" and "bool d"
- |
-
-
-Matcher<TypeLoc> | complexTypeLoc | Matcher<ComplexTypeLoc>... |
-Matches C99 complex types.
-
-Given
- _Complex float f;
-complexType()
- matches "_Complex float f"
- |
-
-
-Matcher<TypeLoc> | constantArrayTypeLoc | Matcher<ConstantArrayTypeLoc>... |
-Matches C arrays with a specified constant size.
-
-Given
- void() {
- int a[2];
- int b[] = { 2, 3 };
- int c[b[0]];
- }
-constantArrayType()
- matches "int a[2]"
- |
-
-
-Matcher<TypeLoc> | dependentSizedArrayTypeLoc | Matcher<DependentSizedArrayTypeLoc>... |
-Matches C++ arrays whose size is a value-dependent expression.
-
-Given
- template<typename T, int Size>
- class array {
- T data[Size];
- };
-dependentSizedArrayType
- matches "T data[Size]"
- |
-
-
-Matcher<TypeLoc> | elaboratedTypeLoc | Matcher<ElaboratedTypeLoc>... |
-Matches types specified with an elaborated type keyword or with a
-qualified name.
-
-Given
- namespace N {
- namespace M {
- class D {};
- }
- }
- class C {};
-
- class C c;
- N::M::D d;
-
-elaboratedType() matches the type of the variable declarations of both
-c and d.
- |
-
-
-Matcher<TypeLoc> | functionTypeLoc | Matcher<FunctionTypeLoc>... |
-Matches FunctionType nodes.
-
-Given
- int (*f)(int);
- void g();
-functionType()
- matches "int (*f)(int)" and the type of "g".
- |
-
-
-Matcher<TypeLoc> | incompleteArrayTypeLoc | Matcher<IncompleteArrayTypeLoc>... |
-Matches C arrays with unspecified size.
-
-Given
- int a[] = { 2, 3 };
- int b[42];
- void f(int c[]) { int d[a[0]]; };
-incompleteArrayType()
- matches "int a[]" and "int c[]"
- |
-
-
-Matcher<TypeLoc> | lValueReferenceTypeLoc | Matcher<LValueReferenceTypeLoc>... |
-Matches lvalue reference types.
-
-Given:
- int *a;
- int &b = *a;
- int &&c = 1;
- auto &d = b;
- auto &&e = c;
- auto &&f = 2;
- int g = 5;
-
-lValueReferenceType() matches the types of b, d, and e. e is
-matched since the type is deduced as int& by reference collapsing rules.
- |
-
-
-Matcher<TypeLoc> | memberPointerTypeLoc | Matcher<MemberPointerTypeLoc>... |
-Matches member pointer types.
-Given
- struct A { int i; }
- A::* ptr = A::i;
-memberPointerType()
- matches "A::* ptr"
- |
-
-
-Matcher<TypeLoc> | parenTypeLoc | Matcher<ParenTypeLoc>... |
-Matches ParenType nodes.
-
-Given
- int (*ptr_to_array)[4];
- int *array_of_ptrs[4];
-
-varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not
-array_of_ptrs.
- |
-
-
-Matcher<TypeLoc> | pointerTypeLoc | Matcher<PointerTypeLoc>... |
-Matches pointer types.
-
-Given
- int *a;
- int &b = *a;
- int c = 5;
-pointerType()
- matches "int *a"
- |
-
-
-Matcher<TypeLoc> | rValueReferenceTypeLoc | Matcher<RValueReferenceTypeLoc>... |
-Matches rvalue reference types.
-
-Given:
- int *a;
- int &b = *a;
- int &&c = 1;
- auto &d = b;
- auto &&e = c;
- auto &&f = 2;
- int g = 5;
-
-rValueReferenceType() matches the types of c and f. e is not
-matched as it is deduced to int& by reference collapsing rules.
- |
-
-
-Matcher<TypeLoc> | recordTypeLoc | Matcher<RecordTypeLoc>... |
-Matches record types (e.g. structs, classes).
-
-Given
- class C {};
- struct S {};
-
- C c;
- S s;
-
-recordType() matches the type of the variable declarations of both c
-and s.
- |
-
-
-Matcher<TypeLoc> | referenceTypeLoc | Matcher<ReferenceTypeLoc>... |
-Matches both lvalue and rvalue reference types.
-
-Given
- int *a;
- int &b = *a;
- int &&c = 1;
- auto &d = b;
- auto &&e = c;
- auto &&f = 2;
- int g = 5;
-
-referenceType() matches the types of b, c, d, e, and f.
- |
-
-
-Matcher<TypeLoc> | templateSpecializationTypeLoc | Matcher<TemplateSpecializationTypeLoc>... |
-Matches template specialization types.
-
-Given
- template <typename T>
- class C { };
-
- template class C<int>; A
- C<char> var; B
-
-templateSpecializationType() matches the type of the explicit
-instantiation in A and the type of the variable declaration in B.
- |
-
-
Matcher<TypeLoc> | typeLoc | Matcher<TypeLoc>... |
Matches TypeLocs in the clang AST.
|
-Matcher<TypeLoc> | typedefTypeLoc | Matcher<TypedefTypeLoc>... |
-Matches typedef types.
-
-Given
- typedef int X;
-typedefType()
- matches "typedef int X"
- |
-
-
-Matcher<TypeLoc> | variableArrayTypeLoc | Matcher<VariableArrayTypeLoc>... |
-Matches C arrays with a specified size that is not an
-integer-constant-expression.
-
-Given
- void f() {
- int a[] = { 2, 3 }
- int b[42];
- int c[a[0]];
-variableArrayType()
- matches "int c[a[0]]"
- |
-
-
Matcher<Type> | arrayType | Matcher<ArrayType>... |
Matches all kinds of arrays.
@@ -1381,6 +1241,16 @@ typedefType()
|
+Matcher<Type> | unaryTransformType | Matcher<UnaryTransformType>... |
+Matches types nodes representing unary type transformations.
+
+Given:
+ typedef __underlying_type(T) type;
+unaryTransformType()
+ matches "__underlying_type(T)"
+ |
+
+
Matcher<Type> | variableArrayType | Matcher<VariableArrayType>... |
Matches C arrays with a specified size that is not an
integer-constant-expression.
@@ -1411,14 +1281,14 @@ which allow users to create more powerful match expressions.
Return type | Name | Parameters |
-Matcher<*> | allOf | Matcher<*> P1, Matcher<*> P2 |
+Matcher<*> | allOf | Matcher<*>, ..., Matcher<*> |
Matches if all given matchers match.
Usable as: Any Matcher
|
-Matcher<*> | anyOf | Matcher<*> P1, Matcher<*> P2 |
+Matcher<*> | anyOf | Matcher<*>, ..., Matcher<*> |
Matches if any of the given matchers matches.
Usable as: Any Matcher
@@ -1472,6 +1342,16 @@ Usable as: Matcher<CXXConstructExpr> | argumentCountIs | unsigned N |
+Checks that a call expression or a constructor call expression has
+a specific number of arguments (including absent default arguments).
+
+Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
+ void f(int x, int y);
+ f(0, 0);
+ |
+
+
Matcher<CXXConstructorDecl> | isImplicit | |
Matches a constructor declaration that has been implicitly added
by the compiler (eg. implicit defaultcopy constructors).
@@ -1479,7 +1359,7 @@ by the compiler (eg. implicit defaultcopy constructors).
Matcher<CXXCtorInitializer> | isWritten | |
-Matches a contructor initializer if it is explicitly written in
+Matches a constructor initializer if it is explicitly written in
code (as opposed to implicitly added by the compiler).
Given
@@ -1513,6 +1393,19 @@ Usable as: Matcher<CXXMethodDecl> | isConst | |
+Matches if the given method declaration is const.
+
+Given
+struct A {
+ void foo() const;
+ void bar();
+};
+
+methodDecl(isConst()) matches A::foo() but not A::bar()
+ |
+
+
Matcher<CXXMethodDecl> | isOverride | |
Matches if the given method declaration overrides another method.
@@ -1665,6 +1558,29 @@ declCountIs(2)
|
+Matcher<Decl> | equalsBoundNode | std::string ID |
+Matches if a node equals a previously bound node.
+
+Matches a node if it equals the node previously bound to ID.
+
+Given
+ class X { int a; int b; };
+recordDecl(
+ has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
+ has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
+ matches the class X, as a and b have the same type.
+
+Note that when multiple matches are involved via forEach* matchers,
+equalsBoundNodes acts as a filter.
+For example:
+compoundStmt(
+ forEachDescendant(varDecl().bind("d")),
+ forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
+will trigger a match for each combination of variable declaration
+and reference to that variable declaration within a compound statement.
+ |
+
+
Matcher<Decl> | equalsNode | Decl* Other |
Matches if a node equals another node.
@@ -1868,6 +1784,29 @@ callExpr(on(hasType(asString("class Y *"))))
|
+Matcher<QualType> | equalsBoundNode | std::string ID |
+Matches if a node equals a previously bound node.
+
+Matches a node if it equals the node previously bound to ID.
+
+Given
+ class X { int a; int b; };
+recordDecl(
+ has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
+ has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
+ matches the class X, as a and b have the same type.
+
+Note that when multiple matches are involved via forEach* matchers,
+equalsBoundNodes acts as a filter.
+For example:
+compoundStmt(
+ forEachDescendant(varDecl().bind("d")),
+ forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
+will trigger a match for each combination of variable declaration
+and reference to that variable declaration within a compound statement.
+ |
+
+
Matcher<QualType> | hasLocalQualifiers | |
Matches QualType nodes that have local CV-qualifiers attached to
the node, not hidden within a typedef.
@@ -1912,6 +1851,29 @@ matches "a(int)", "b(long)", but not "c(double)".
|
+Matcher<Stmt> | equalsBoundNode | std::string ID |
+Matches if a node equals a previously bound node.
+
+Matches a node if it equals the node previously bound to ID.
+
+Given
+ class X { int a; int b; };
+recordDecl(
+ has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
+ has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
+ matches the class X, as a and b have the same type.
+
+Note that when multiple matches are involved via forEach* matchers,
+equalsBoundNodes acts as a filter.
+For example:
+compoundStmt(
+ forEachDescendant(varDecl().bind("d")),
+ forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
+will trigger a match for each combination of variable declaration
+and reference to that variable declaration within a compound statement.
+ |
+
+
Matcher<Stmt> | equalsNode | Stmt* Other |
Matches if a node equals another node.
@@ -1935,6 +1897,29 @@ Usable as: Matcher<Type> | equalsBoundNode | std::string ID |
+Matches if a node equals a previously bound node.
+
+Matches a node if it equals the node previously bound to ID.
+
+Given
+ class X { int a; int b; };
+recordDecl(
+ has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
+ has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))
+ matches the class X, as a and b have the same type.
+
+Note that when multiple matches are involved via forEach* matchers,
+equalsBoundNodes acts as a filter.
+For example:
+compoundStmt(
+ forEachDescendant(varDecl().bind("d")),
+ forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d"))))))
+will trigger a match for each combination of variable declaration
+and reference to that variable declaration within a compound statement.
+ |
+
+
Matcher<UnaryExprOrTypeTraitExpr> | ofKind | UnaryExprOrTypeTrait Kind |
Matches unary expressions of a certain kind.
@@ -2022,7 +2007,7 @@ match expressions.
Return type | Name | Parameters |
-Matcher<*> | eachOf | Matcher<*> P1, Matcher<*> P2 |
+Matcher<*> | eachOf | Matcher<*>, ..., Matcher<*> |
Matches if any of the given matchers matches.
Unlike anyOf, eachOf will generate a match result for each
@@ -2041,22 +2026,7 @@ Usable as: Any Matcher
|
-Matcher<*> | findAll | Matcher<T> Matcher |
-Matches if the node or any descendant matches.
-
-Generates results for each match.
-
-For example, in:
- class A { class B {}; class C {}; };
-The matcher:
- recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("m")))
-will generate results for A, B and C.
-
-Usable as: Any Matcher
- |
-
-
-Matcher<*> | forEach | Matcher<ChildT> ChildMatcher |
+Matcher<*> | forEach | Matcher<*> |
Matches AST nodes that have child AST nodes that match the
provided matcher.
@@ -2074,7 +2044,7 @@ Usable as: Any Matcher
|
-Matcher<*> | forEachDescendant | Matcher<DescendantT> DescendantMatcher |
+Matcher<*> | forEachDescendant | Matcher<*> |
Matches AST nodes that have descendant AST nodes that match the
provided matcher.
@@ -2098,7 +2068,7 @@ Usable as: Any Matcher
|
-Matcher<*> | has | Matcher<ChildT> ChildMatcher |
+Matcher<*> | has | Matcher<*> |
Matches AST nodes that have child AST nodes that match the
provided matcher.
@@ -2113,7 +2083,7 @@ Usable as: Any Matcher
|
-Matcher<*> | hasAncestor | Matcher<AncestorT> AncestorMatcher |
+Matcher<*> | hasAncestor | Matcher<*> |
Matches AST nodes that have an ancestor that matches the provided
matcher.
@@ -2126,7 +2096,7 @@ Usable as: Any Matcher
|
-Matcher<*> | hasDescendant | Matcher<DescendantT> DescendantMatcher |
+Matcher<*> | hasDescendant | Matcher<*> |
Matches AST nodes that have descendant AST nodes that match the
provided matcher.
@@ -2142,7 +2112,7 @@ Usable as: Any Matcher
|
-Matcher<*> | hasParent | Matcher<ParentT> ParentMatcher |
+Matcher<*> | hasParent | Matcher<*> |
Matches AST nodes that have a parent that matches the provided
matcher.
@@ -2177,8 +2147,8 @@ arraySubscriptExpression(hasIndex(integerLiteral()))
|
-Matcher<ArrayTypeLoc> | hasElementTypeLoc | Matcher<TypeLoc> |
-Matches arrays and C99 complex types that have a specific element
+Matcher<ArrayTypeLoc> | hasElementTypeLoc | Matcher<TypeLoc> |
+Matches arrays and C99 complex types that have a specific element
type.
Given
@@ -2192,8 +2162,8 @@ Usable as: Matcher<ArrayType> | hasElementType | Matcher<Type> |
-Matches arrays and C99 complex types that have a specific element
+Matcher<ArrayType> | hasElementType | Matcher<Type> |
+Matches arrays and C99 complex types that have a specific element
type.
Given
@@ -2271,8 +2241,8 @@ Example matches b (matcher = binaryOperator(hasRHS()))
|
-Matcher<BlockPointerTypeLoc> | pointeeLoc | Matcher<TypeLoc> |
-Narrows PointerType (and similar) matchers to those where the
+Matcher<BlockPointerTypeLoc> | pointeeLoc | Matcher<TypeLoc> |
+Narrows PointerType (and similar) matchers to those where the
pointee matches a given matcher.
Given
@@ -2287,8 +2257,8 @@ Usable as: Matcher<BlockPointerType> | pointee | Matcher<Type> |
-Narrows PointerType (and similar) matchers to those where the
+Matcher<BlockPointerType> | pointee | Matcher<Type> |
+Narrows PointerType (and similar) matchers to those where the
pointee matches a given matcher.
Given
@@ -2303,17 +2273,65 @@ Usable as: Matcher<CXXConstructExpr> | hasDeclaration | Matcher<Decl> InnerMatcher |
-Matches a type if the declaration of the type matches the given
-matcher.
+Matcher<CXXConstructExpr> | hasAnyArgument | Matcher<Expr> InnerMatcher |
+Matches any argument of a call expression or a constructor call
+expression.
+
+Given
+ void x(int, int, int) { int y; x(1, y, 42); }
+callExpr(hasAnyArgument(declRefExpr()))
+ matches x(1, y, 42)
+with hasAnyArgument(...)
+ matching y
+
+FIXME: Currently this will ignore parentheses and implicit casts on
+the argument before applying the inner matcher. We'll want to remove
+this to allow for greater control by the user once ignoreImplicit()
+has been implemented.
+ |
-In addition to being usable as Matcher<TypedefType>, also usable as
-Matcher<T> for any T supporting the getDecl() member function. e.g. various
-subtypes of clang::Type.
-Usable as: Matcher<QualType>, Matcher<CallExpr>, Matcher<CXXConstructExpr>,
- Matcher<MemberExpr>, Matcher<TypedefType>,
- Matcher<TemplateSpecializationType>
+Matcher<CXXConstructExpr> | hasArgument | unsigned N, Matcher<Expr> InnerMatcher |
+Matches the n'th argument of a call expression or a constructor
+call expression.
+
+Example matches y in x(y)
+ (matcher = callExpr(hasArgument(0, declRefExpr())))
+ void x(int) { int y; x(y); }
+ |
+
+
+Matcher<CXXConstructExpr> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
+Matcher<CXXConstructorDecl> | forEachConstructorInitializer | Matcher<CXXCtorInitializer> InnerMatcher |
+Matches each constructor initializer in a constructor definition.
+
+Given
+ class A { A() : i(42), j(42) {} int i; int j; };
+constructorDecl(forEachConstructorInitializer(forField(decl().bind("x"))))
+ will trigger two matches, binding for 'i' and 'j' respectively.
|
@@ -2375,7 +2393,7 @@ FIXME: Overload to allow directly matching types?
|
-Matcher<CXXMemberCallExpr> | thisPointerType | Matcher<Decl> InnerMatcher |
+Matcher<CXXMemberCallExpr> | thisPointerType | Matcher<Decl> InnerMatcher |
Overloaded to match the type's declaration.
|
@@ -2438,7 +2456,7 @@ match Base.
|
-Matcher<CallExpr> | callee | Matcher<Decl> InnerMatcher |
+Matcher<CallExpr> | callee | Matcher<Decl> InnerMatcher |
Matches if the call expression's callee's declaration matches the
given matcher.
@@ -2458,6 +2476,11 @@ callExpr(hasAnyArgument(declRefExpr()))
matches x(1, y, 42)
with hasAnyArgument(...)
matching y
+
+FIXME: Currently this will ignore parentheses and implicit casts on
+the argument before applying the inner matcher. We'll want to remove
+this to allow for greater control by the user once ignoreImplicit()
+has been implemented.
|
@@ -2471,17 +2494,38 @@ Example matches y in x(y)
|
-Matcher<CallExpr> | hasDeclaration | Matcher<Decl> InnerMatcher |
-Matches a type if the declaration of the type matches the given
-matcher.
+Matcher<CallExpr> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
-In addition to being usable as Matcher<TypedefType>, also usable as
-Matcher<T> for any T supporting the getDecl() member function. e.g. various
-subtypes of clang::Type.
-Usable as: Matcher<QualType>, Matcher<CallExpr>, Matcher<CXXConstructExpr>,
- Matcher<MemberExpr>, Matcher<TypedefType>,
- Matcher<TemplateSpecializationType>
+Matcher<CaseStmt> | hasCaseConstant | Matcher<Expr> InnerMatcher |
+If the given case statement does not use the GNU case range
+extension, matches the constant given in the statement.
+
+Given
+ switch (1) { case 1: case 1+1: case 3 ... 4: ; }
+caseStmt(hasCaseConstant(integerLiteral()))
+ matches "case 1:"
|
@@ -2523,8 +2567,8 @@ classTemplateSpecializationDecl(hasTemplateArgument(
|
-Matcher<ComplexTypeLoc> | hasElementTypeLoc | Matcher<TypeLoc> |
-Matches arrays and C99 complex types that have a specific element
+Matcher<ComplexTypeLoc> | hasElementTypeLoc | Matcher<TypeLoc> |
+Matches arrays and C99 complex types that have a specific element
type.
Given
@@ -2538,8 +2582,8 @@ Usable as: Matcher<ComplexType> | hasElementType | Matcher<Type> |
-Matches arrays and C99 complex types that have a specific element
+Matcher<ComplexType> | hasElementType | Matcher<Type> |
+Matches arrays and C99 complex types that have a specific element
type.
Given
@@ -2591,6 +2635,30 @@ Example matches a
|
+Matcher<DeclRefExpr> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
Matcher<DeclRefExpr> | throughUsingDecl | Matcher<UsingShadowDecl> InnerMatcher |
Matches a DeclRefExpr that refers to a declaration through a
specific using shadow declaration.
@@ -2650,6 +2718,17 @@ declStmt(hasSingleDecl(anything()))
|
+Matcher<DeclaratorDecl> | hasTypeLoc | Matcher<TypeLoc> Inner |
+Matches if the type location of the declarator decl's type matches
+the inner matcher.
+
+Given
+ int x;
+declaratorDecl(hasTypeLoc(loc(asString("int"))))
+ matches int x
+ |
+
+
Matcher<Decl> | hasDeclContext | Matcher<Decl> InnerMatcher |
Matches declarations whose declaration context, interpreted as a
Decl, matches InnerMatcher.
@@ -2722,6 +2801,30 @@ declaration of d.
|
+Matcher<EnumType> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
Matcher<ExplicitCastExpr> | hasDestinationType | Matcher<QualType> InnerMatcher |
Matches casts whose destination type matches a given matcher.
@@ -2730,8 +2833,8 @@ actual casts "explicit" casts.)
|
-Matcher<Expr> | hasType | Matcher<Decl> InnerMatcher |
-Overloaded to match the declaration of the expression's or value
+Matcher<Expr> | hasType | Matcher<Decl> InnerMatcher |
+Overloaded to match the declaration of the expression's or value
declaration's type.
In case of a value declaration (for example a variable declaration),
@@ -2906,7 +3009,7 @@ Example matches true (matcher = hasCondition(boolLiteral(equals(true))))
Given
if (A* a = GetAPointer()) {}
-hasConditionVariableStatment(...)
+hasConditionVariableStatement(...)
matches 'A* a = GetAPointer()'.
|
@@ -2919,17 +3022,75 @@ FIXME: Unit test this matcher
|
-Matcher<MemberExpr> | hasDeclaration | Matcher<Decl> InnerMatcher |
-Matches a type if the declaration of the type matches the given
-matcher.
+Matcher<InjectedClassNameType> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
+Matcher<LabelStmt> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
-In addition to being usable as Matcher<TypedefType>, also usable as
-Matcher<T> for any T supporting the getDecl() member function. e.g. various
-subtypes of clang::Type.
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
-Usable as: Matcher<QualType>, Matcher<CallExpr>, Matcher<CXXConstructExpr>,
- Matcher<MemberExpr>, Matcher<TypedefType>,
- Matcher<TemplateSpecializationType>
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
+Matcher<MemberExpr> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
|
@@ -2961,8 +3122,8 @@ memberExpr(member(hasName("first")))
|
-Matcher<MemberPointerTypeLoc> | pointeeLoc | Matcher<TypeLoc> |
-Narrows PointerType (and similar) matchers to those where the
+Matcher<MemberPointerTypeLoc> | pointeeLoc | Matcher<TypeLoc> |
+Narrows PointerType (and similar) matchers to those where the
pointee matches a given matcher.
Given
@@ -2977,8 +3138,8 @@ Usable as: Matcher<MemberPointerType> | pointee | Matcher<Type> |
-Narrows PointerType (and similar) matchers to those where the
+Matcher<MemberPointerType> | pointee | Matcher<Type> |
+Narrows PointerType (and similar) matchers to those where the
pointee matches a given matcher.
Given
@@ -3072,8 +3233,8 @@ Usable as: Matcher<PointerTypeLoc> | pointeeLoc | Matcher<TypeLoc> |
-Narrows PointerType (and similar) matchers to those where the
+Matcher<PointerTypeLoc> | pointeeLoc | Matcher<TypeLoc> |
+Narrows PointerType (and similar) matchers to those where the
pointee matches a given matcher.
Given
@@ -3088,8 +3249,8 @@ Usable as: Matcher<PointerType> | pointee | Matcher<Type> |
-Narrows PointerType (and similar) matchers to those where the
+Matcher<PointerType> | pointee | Matcher<Type> |
+Narrows PointerType (and similar) matchers to those where the
pointee matches a given matcher.
Given
@@ -3117,32 +3278,66 @@ declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType()))
|
-Matcher<QualType> | hasDeclaration | Matcher<Decl> InnerMatcher |
-Matches a type if the declaration of the type matches the given
-matcher.
+Matcher<QualType> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
-In addition to being usable as Matcher<TypedefType>, also usable as
-Matcher<T> for any T supporting the getDecl() member function. e.g. various
-subtypes of clang::Type.
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
-Usable as: Matcher<QualType>, Matcher<CallExpr>, Matcher<CXXConstructExpr>,
- Matcher<MemberExpr>, Matcher<TypedefType>,
- Matcher<TemplateSpecializationType>
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
|
-Matcher<QualType> | pointsTo | Matcher<Decl> InnerMatcher |
+Matcher<QualType> | pointsTo | Matcher<Decl> InnerMatcher |
Overloaded to match the pointee type's declaration.
|
-Matcher<QualType> | references | Matcher<Decl> InnerMatcher |
+Matcher<QualType> | references | Matcher<Decl> InnerMatcher |
Overloaded to match the referenced type's declaration.
|
-Matcher<ReferenceTypeLoc> | pointeeLoc | Matcher<TypeLoc> |
-Narrows PointerType (and similar) matchers to those where the
+Matcher<RecordType> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
+Matcher<ReferenceTypeLoc> | pointeeLoc | Matcher<TypeLoc> |
+Narrows PointerType (and similar) matchers to those where the
pointee matches a given matcher.
Given
@@ -3157,8 +3352,8 @@ Usable as: Matcher<ReferenceType> | pointee | Matcher<Type> |
-Narrows PointerType (and similar) matchers to those where the
+Matcher<ReferenceType> | pointee | Matcher<Type> |
+Narrows PointerType (and similar) matchers to those where the
pointee matches a given matcher.
Given
@@ -3185,6 +3380,43 @@ sizeof.
|
+Matcher<SwitchStmt> | forEachSwitchCase | Matcher<SwitchCase> InnerMatcher |
+Matches each case or default statement belonging to the given switch
+statement. This matcher may produce multiple matches.
+
+Given
+ switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } }
+switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s")
+ matches four times, with "c" binding each of "case 1:", "case 2:",
+"case 3:" and "case 4:", and "s" respectively binding "switch (1)",
+"switch (1)", "switch (2)" and "switch (2)".
+ |
+
+
+Matcher<TagType> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
Matcher<TemplateArgument> | refersToDeclaration | Matcher<Decl> InnerMatcher |
Matches a TemplateArgument that refers to a certain declaration.
@@ -3212,17 +3444,66 @@ classTemplateSpecializationDecl(hasAnyTemplateArgument(
|
-Matcher<TemplateSpecializationType> | hasDeclaration | Matcher<Decl> InnerMatcher |
-Matches a type if the declaration of the type matches the given
-matcher.
+Matcher<TemplateSpecializationType> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
-In addition to being usable as Matcher<TypedefType>, also usable as
-Matcher<T> for any T supporting the getDecl() member function. e.g. various
-subtypes of clang::Type.
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
-Usable as: Matcher<QualType>, Matcher<CallExpr>, Matcher<CXXConstructExpr>,
- Matcher<MemberExpr>, Matcher<TypedefType>,
- Matcher<TemplateSpecializationType>
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
+Matcher<TemplateTypeParmType> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
+Matcher<T> | findAll | Matcher<T> Matcher |
+Matches if the node or any descendant matches.
+
+Generates results for each match.
+
+For example, in:
+ class A { class B {}; class C {}; };
+The matcher:
+ recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("m")))
+will generate results for A, B and C.
+
+Usable as: Any Matcher
|
@@ -3233,16 +3514,26 @@ QualType-matcher matches.
Matcher<TypedefType> | hasDeclaration | Matcher<Decl> InnerMatcher |
-Matches a type if the declaration of the type matches the given
-matcher.
+Matches a node if the declaration associated with that node
+matches the given matcher.
-In addition to being usable as Matcher<TypedefType>, also usable as
-Matcher<T> for any T supporting the getDecl() member function. e.g. various
-subtypes of clang::Type.
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
-Usable as: Matcher<QualType>, Matcher<CallExpr>, Matcher<CXXConstructExpr>,
- Matcher<MemberExpr>, Matcher<TypedefType>,
- Matcher<TemplateSpecializationType>
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
|
@@ -3264,6 +3555,30 @@ Example matches true (matcher = hasUnaryOperand(boolLiteral(equals(true))))
|
+Matcher<UnresolvedUsingType> | hasDeclaration | Matcher<Decl> InnerMatcher |
+Matches a node if the declaration associated with that node
+matches the given matcher.
+
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+
+Also usable as Matcher<T> for any T supporting the getDecl() member
+function. e.g. various subtypes of clang::Type and various expressions.
+FIXME: Add all node types for which this is matcher is usable due to
+getDecl().
+
+Usable as: Matcher<CallExpr>, Matcher<CXXConstructExpr>,
+ Matcher<DeclRefExpr>, Matcher<EnumType>, Matcher<InjectedClassNameType>,
+ Matcher<LabelStmt>, Matcher<MemberExpr>, Matcher<QualType>,
+ Matcher<RecordType>, Matcher<TagType>,
+ Matcher<TemplateSpecializationType>, Matcher<TemplateTypeParmType>,
+ Matcher<TypedefType>, Matcher<UnresolvedUsingType>
+ |
+
+
Matcher<UsingDecl> | hasAnyUsingShadowDecl | Matcher<UsingShadowDecl> InnerMatcher |
Matches any using shadow declaration.
@@ -3286,8 +3601,8 @@ usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
matches using X::b but not using X::a |
-Matcher<ValueDecl> | hasType | Matcher<Decl> InnerMatcher |
-Overloaded to match the declaration of the expression's or value
+Matcher<ValueDecl> | hasType | Matcher<Decl> InnerMatcher |
+Overloaded to match the declaration of the expression's or value
declaration's type.
In case of a value declaration (for example a variable declaration),
--
cgit v1.1
| | | | | | | | | | | | | | | | | | | |