|
reference, declaration → definition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
|
References
tools/clang/include/clang/ASTMatchers/ASTMatchers.h 4014 unsigned ArgIndex = cxxOperatorCallExpr(callee(cxxMethodDecl()))
tools/clang/lib/Analysis/ExprMutationAnalyzer.cpp 163 hasAncestor(unaryExprOrTypeTraitExpr())))),
168 hasArgumentOfType(variableArrayType())))),
178 cxxNoexceptExpr())))))
242 unless(hasParent(arraySubscriptExpr())),
266 callExpr(callee(expr(anyOf(unresolvedLookupExpr(), unresolvedMemberExpr(),
266 callExpr(callee(expr(anyOf(unresolvedLookupExpr(), unresolvedMemberExpr(),
267 cxxDependentScopeMemberExpr(),
268 hasType(templateTypeParmType())))),
374 hasParent(declStmt().bind("stmt")),
389 const auto FuncDecl = hasDeclaration(functionDecl().bind("func"));
tools/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp 56 -> decltype(callee(functionDecl())) {
61 -> decltype(hasArgument(0, expr())) {
66 auto bindAssignmentToDecl(const char *DeclName) -> decltype(hasLHS(expr())) {
68 declRefExpr(to(varDecl().bind(DeclName)))));
92 static auto findGCDAntiPatternWithSemaphore() -> decltype(compoundStmt()) {
106 hasCanonicalType(blockPointerType())
136 static auto findGCDAntiPatternWithGroup() -> decltype(compoundStmt()) {
152 hasCanonicalType(blockPointerType())
tools/clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp 275 unless(hasConditionVariableStatement(declStmt())
tools/clang/lib/StaticAnalyzer/Checkers/OSObjectCStyleCast.cpp 59 -> decltype(hasType(pointerType())) {
tools/clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp 104 -> decltype(callee(functionDecl())) {
155 pointee(hasCanonicalType(objcObjectPointerType()))))))
179 hasType(hasCanonicalType(blockPointerType())),
tools/clang/lib/StaticAnalyzer/Checkers/PointerIterationChecker.cpp 66 auto matchUnorderedIterWithPointers() -> decltype(decl()) {
72 auto PointerTypeM = varDecl(hasType(hasCanonicalType(pointerType())));
tools/clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp 57 auto callsName(const char *FunctionName) -> decltype(callee(functionDecl())) {
69 auto matchSortWithPointers() -> decltype(decl()) {
85 pointsTo(hasCanonicalType(pointerType()))
tools/clang/lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp 159 hasAncestor(autoreleasePoolStmt().bind(OtherStmtAutoreleasePoolBind)));
177 auto NoPoolM = unless(hasAncestor(autoreleasePoolStmt()));
tools/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp 556 stmt(anyOf(ifStmt(), switchStmt(), conditionalOperator(), AssertLikeM,
556 stmt(anyOf(ifStmt(), switchStmt(), conditionalOperator(), AssertLikeM,
556 stmt(anyOf(ifStmt(), switchStmt(), conditionalOperator(), AssertLikeM,
tools/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp 89 integerLiteral().bind("boundNum"))))
114 allOf(hasType(referenceType()),
129 anyOf(gotoStmt(), switchStmt(), returnStmt(),
129 anyOf(gotoStmt(), switchStmt(), returnStmt(),
129 anyOf(gotoStmt(), switchStmt(), returnStmt(),
146 integerLiteral().bind("initNum"))),
151 integerLiteral().bind("initNum")))))),
tools/clang/lib/StaticAnalyzer/Core/LoopWidening.cpp 70 auto Matches = match(findAll(stmt(hasDescendant(varDecl(hasType(referenceType())).bind(MatchRef)))),
tools/clang/tools/extra/clang-change-namespace/ChangeNamespace.cpp 417 IsInMovedNs, hasParent(namespaceDecl()))
424 IsInMovedNs, hasParent(namespaceDecl()))
432 hasAncestor(namespaceDecl()),
435 hasAncestor(cxxRecordDecl()),
442 usingDecl(hasAnyUsingShadowDecl(decl()), hasParent(cxxRecordDecl()));
442 usingDecl(hasAnyUsingShadowDecl(decl()), hasParent(cxxRecordDecl()));
453 unless(templateSpecializationType()))))),
454 hasParent(nestedNameSpecifierLoc()),
458 hasAncestor(decl().bind("dc")))
466 Finder->addMatcher(usingDecl(IsInMovedNs, hasAnyUsingShadowDecl(decl()),
503 functionDecl(unless(anyOf(cxxMethodDecl(), IsInMovedNs,
505 hasAncestor(cxxRecordDecl()))),
506 hasParent(namespaceDecl()));
507 Finder->addMatcher(expr(hasAncestor(decl().bind("dc")), IsInMovedNs,
515 hasGlobalStorage(), hasParent(namespaceDecl()),
517 Finder->addMatcher(declRefExpr(IsInMovedNs, hasAncestor(decl().bind("dc")),
524 hasParent(namespaceDecl()),
525 unless(anyOf(isScoped(), IsInMovedNs, hasAncestor(cxxRecordDecl()),
528 declRefExpr(IsInMovedNs, hasAncestor(decl().bind("dc")),
tools/clang/tools/extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp 129 hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl()));
129 hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl()));
142 auto ExternCMatcher = hasDeclContext(linkageSpecDecl());
156 unless(parmVarDecl()));
167 auto Functions = functionDecl(CommonFilter, unless(hasParent(friendDecl())),
183 hasDeclContext(linkageSpecDecl())));
tools/clang/tools/extra/clang-move/Move.cpp 510 hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl()));
510 hasDeclContext(anyOf(namespaceDecl(), translationUnitDecl()));
521 unless(ForwardClassDecls), unless(namespaceDecl()),
522 unless(usingDirectiveDecl()), // using namespace decl.
525 hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))),
525 hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))),
526 hasDeclContext(decl(anyOf(namespaceDecl(), translationUnitDecl()))));
526 hasDeclContext(decl(anyOf(namespaceDecl(), translationUnitDecl()))));
541 hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))), InOldCC);
541 hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))), InOldCC);
600 declRefExpr(to(HelperFuncOrVar), hasAncestor(decl().bind("dc")))
606 hasAncestor(decl().bind("dc"))),
654 Finder->addMatcher(namedDecl(anyOf(typedefDecl().bind("typedef"),
655 typeAliasDecl().bind("type_alias")),
tools/clang/tools/extra/clang-reorder-fields/ReorderFieldsAction.cpp 108 match(findAll(memberExpr(hasObjectExpression(cxxThisExpr())).bind("ME")),
tools/clang/tools/extra/clang-tidy/abseil/DurationConversionCastCheck.cpp 24 hasArgument(0, expr().bind("arg"))));
tools/clang/tools/extra/clang-tidy/abseil/DurationDivisionCheck.cpp 33 unless(hasParent(cxxStaticCastExpr())),
34 unless(hasParent(cStyleCastExpr())),
tools/clang/tools/extra/clang-tidy/abseil/DurationFactoryFloatCheck.cpp 39 floatLiteral())))
tools/clang/tools/extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp 128 hasSourceExpression(initListExpr())),
132 anyOf(integerLiteral(), floatLiteral()))))
132 anyOf(integerLiteral(), floatLiteral()))))
134 binaryOperator(hasOperatorName("/"), hasRHS(floatLiteral()))
tools/clang/tools/extra/clang-tidy/abseil/DurationRewriter.cpp 79 hasArgument(0, expr().bind("e"))),
95 hasArgument(0, expr().bind("e"))),
192 hasSourceExpression(expr().bind("cast_arg"))),
195 hasSourceExpression(expr().bind("cast_arg"))),
198 hasSourceExpression(expr().bind("cast_arg"))))),
tools/clang/tools/extra/clang-tidy/abseil/DurationSubtractionCheck.cpp 27 hasArgument(0, expr().bind("lhs_arg")))))
tools/clang/tools/extra/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp 41 hasArgument(0, expr().bind("arg")));
46 hasOverloadedOperatorName("/"), hasArgument(0, expr().bind("arg")),
53 hasArgument(0, expr().bind("arg")), hasArgument(1, factory_matcher));
tools/clang/tools/extra/clang-tidy/abseil/StrCatAppendCheck.cpp 53 expr().bind("Arg0"))))));
65 hasArgument(0, declRefExpr(to(decl().bind("LHS")))),
tools/clang/tools/extra/clang-tidy/abseil/StringFindStartswithCheck.cpp 46 hasArgument(0, expr().bind("needle")),
48 anyOf(hasArgument(1, ZeroLiteral), hasArgument(1, cxxDefaultArgExpr())));
tools/clang/tools/extra/clang-tidy/abseil/TimeSubtractionCheck.cpp 41 hasParent(varDecl()))))))))
43 callExpr(hasParent(varDecl())).bind("e"))),
57 hasParent(callExpr()),
58 unless(hasParent(cxxOperatorCallExpr())))))))
60 expr(hasParent(callExpr()),
61 unless(hasParent(cxxOperatorCallExpr())))
74 hasParent(returnStmt()))))))))
76 expr(hasParent(returnStmt())).bind("e"))),
tools/clang/tools/extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp 39 hasArgument(1, expr().bind("arg")),
41 hasParent(functionTemplateDecl()),
42 unless(hasTemplateArgument(0, refersToType(builtinType()))),
53 hasParent(functionTemplateDecl()),
54 unless(hasTemplateArgument(0, refersToType(builtinType()))),
56 argumentCountIs(1), hasArgument(0, expr().bind("arg")))
65 hasParent(functionTemplateDecl()),
66 unless(hasTemplateArgument(0, refersToType(builtinType()))),
71 hasArgument(1, expr().bind("arg")))
79 hasParent(functionTemplateDecl()),
80 unless(hasTemplateArgument(0, refersToType(builtinType()))),
82 argumentCountIs(2), hasArgument(0, expr().bind("arg")),
110 unless(hasParent(functionTemplateDecl())))),
111 hasArgument(0, expr().bind("arg")))))
143 hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
143 hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
tools/clang/tools/extra/clang-tidy/boost/UseToStringCheck.cpp 34 templateArgument().bind("char_type"))))),
tools/clang/tools/extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp 52 callExpr(unless(cxxOperatorCallExpr()),
60 Finder->addMatcher(cxxConstructExpr().bind("expr"), this);
tools/clang/tools/extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp 25 ignoringParenImpCasts(declRefExpr().bind("expr")))),
tools/clang/tools/extra/clang-tidy/bugprone/BranchCloneCheck.cpp 62 ifStmt(stmt().bind("if"),
64 hasElse(stmt().bind("else"))),
66 Finder->addMatcher(switchStmt().bind("switch"), this);
67 Finder->addMatcher(conditionalOperator().bind("condOp"), this);
tools/clang/tools/extra/clang-tidy/bugprone/DanglingHandleCheck.cpp 31 callee(memberExpr(member(cxxConversionDecl()))),
41 conditionalOperator(hasTrueExpression(cxxBindTemporaryExpr()),
42 hasFalseExpression(cxxBindTemporaryExpr()));
44 return handleFrom(IsAHandle, anyOf(cxxBindTemporaryExpr(), TemporaryTernary));
123 unless(parmVarDecl()),
155 anyOf(hasType(arrayType()),
160 unless(hasAncestor(lambdaExpr())))
tools/clang/tools/extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp 59 functionDecl(anyOf(isNoThrow(), cxxDestructorDecl(),
tools/clang/tools/extra/clang-tidy/bugprone/FoldInitTypeCheck.cpp 23 return hasCanonicalType(builtinType().bind(ID));
tools/clang/tools/extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp 35 hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))),
35 hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))),
36 unless(isImplicit()), unless(hasAncestor(cxxRecordDecl())),
38 unless(classTemplateSpecializationDecl()))
45 Finder->addMatcher(friendDecl().bind("friend_decl"), this);
tools/clang/tools/extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp 69 hasType(qualType(rValueReferenceType(),
71 templateTypeParmDecl().bind("type-parm-decl")))),
tools/clang/tools/extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp 158 expr(forFunction(functionDecl().bind("func"))).bind("condition")),
tools/clang/tools/extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp 33 anyOf(BinaryOperators, conditionalOperator(), binaryConditionalOperator(),
33 anyOf(BinaryOperators, conditionalOperator(), binaryConditionalOperator(),
tools/clang/tools/extra/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp 63 Finder->addMatcher(predefinedExpr(hasAncestor(lambdaExpr())).bind("E"),
tools/clang/tools/extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp 77 hasType(qualType(rValueReferenceType(),
79 templateTypeParmDecl().bind("type-parm-decl")))),
tools/clang/tools/extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp 59 const auto Inner = expr(isInMacro(), unless(compoundStmt())).bind("inner");
tools/clang/tools/extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp 531 allOf(to(varDecl().bind(VarDeclName)),
546 hasEitherOperand(ignoringParenImpCasts(integerLiteral())));
550 hasEitherOperand(ignoringParenImpCasts(integerLiteral())));
625 hasAnyArgument(allOf(unless(SizeExpr), expr().bind(DestMallocExprName))));
633 cxxNewExpr(hasArraySize(expr().bind(DestMallocExprName))));
645 expr().bind(UnknownDestName)))
651 expr().bind(DestExprName)),
662 allOf(to(decl().bind(SrcVarDeclName)),
663 anyOf(hasAncestor(cxxMemberCallExpr().bind(SrcExprName)),
664 expr().bind(SrcExprName))));
667 ignoringImpCasts(anyOf(stringLiteral().bind(SrcExprName),
668 hasDescendant(stringLiteral().bind(SrcExprName)),
706 ignoringImpCasts(integerLiteral().bind(WrongLengthExprName)),
712 anyOf(hasDefinition(binaryOperator().bind(
716 expr().bind(LengthExprName)));
780 unless(hasAncestor(castExpr(unless(implicitCastExpr())))))
784 castExpr(allOf(unless(implicitCastExpr()),
tools/clang/tools/extra/clang-tidy/bugprone/PosixReturnCheck.cpp 57 hasUnaryOperand(integerLiteral()))))
tools/clang/tools/extra/clang-tidy/bugprone/SizeofContainerCheck.cpp 32 hasLHS(ignoringParenCasts(sizeOfExpr(expr()))),
tools/clang/tools/extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp 80 const auto IntegerExpr = ignoringParenImpCasts(integerLiteral());
82 anyOf(integerLiteral(), unaryOperator(hasUnaryOperand(IntegerExpr)),
85 callExpr(anyOf(hasType(isInteger()), hasType(enumType())),
89 has(hasUnqualifiedDesugaredType(type().bind("sizeof-arg-type")))),
91 hasUnqualifiedDesugaredType(type().bind("sizeof-arg-type"))))))));
117 expr(sizeOfExpr(has(ignoringParenImpCasts(expr(cxxThisExpr())))))
126 hasInitializer(ignoringParenImpCasts(stringLiteral())));
136 expr(hasType(qualType(hasCanonicalType(arrayType()))))));
142 hasType(qualType(hasCanonicalType(pointerType(pointee(arrayType()))))))));
147 hasType(qualType(hasCanonicalType(recordType())))))));
149 pointerType(pointee(recordType()))));
152 unless(cxxThisExpr()))));
182 arrayType(hasElementType(recordType().bind("elem-type")));
183 const auto ElemPtrType = pointerType(pointee(type().bind("elem-ptr-type")));
185 type(anyOf(ElemType, ElemPtrType, type())).bind("num-type")));
186 const auto DenomType = qualType(hasCanonicalType(type().bind("denom-type")));
228 hasUnqualifiedDesugaredType(type().bind("left-ptr-type")))))))),
230 hasUnqualifiedDesugaredType(type().bind("right-ptr-type")))))))));
tools/clang/tools/extra/clang-tidy/bugprone/StringConstructorCheck.cpp 42 const auto CharExpr = expr(ignoringParenImpCasts(characterLiteral()));
48 const auto CharPtrType = type(anyOf(pointerType(), arrayType()));
48 const auto CharPtrType = type(anyOf(pointerType(), arrayType()));
51 const auto BoundStringLiteral = stringLiteral().bind("str");
53 isDefinition(), hasType(constantArrayType()), hasType(isConstQualified()),
99 integerLiteral().bind("int"))))))
107 hasArgument(0, expr().bind("from-ptr")),
tools/clang/tools/extra/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp 30 qualType().bind("type")))))))),
tools/clang/tools/extra/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp 48 hasArgument(1, cxxDefaultArgExpr()))));
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp 121 return expr(ignoringImpCasts(expr().bind(RefName)),
122 ignoringImpCasts(hasType(enumDecl().bind(DeclName))));
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp 40 hasArgument(1, integerLiteral().bind("num-fill")),
49 integerLiteral()))),
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp 89 initListExpr(hasType(constantArrayType()),
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp 22 stmt(anyOf(ifStmt(hasThen(nullStmt().bind("semi")),
23 unless(hasElse(stmt()))),
24 forStmt(hasBody(nullStmt().bind("semi"))),
25 cxxForRangeStmt(hasBody(nullStmt().bind("semi"))),
26 whileStmt(hasBody(nullStmt().bind("semi")))))
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousStringCompareCheck.cpp 159 characterLiteral(), cxxBoolLiteral()));
159 characterLiteral(), cxxBoolLiteral()));
tools/clang/tools/extra/clang-tidy/bugprone/SwappedArgumentsCheck.cpp 22 Finder->addMatcher(callExpr().bind("call"), this);
tools/clang/tools/extra/clang-tidy/bugprone/TerminatingContinueCheck.cpp 25 cxxNullPtrLiteralExpr(), gnuNullExpr()))),
25 cxxNullPtrLiteralExpr(), gnuNullExpr()))),
29 continueStmt(hasAncestor(stmt(anyOf(forStmt(), whileStmt(),
29 continueStmt(hasAncestor(stmt(anyOf(forStmt(), whileStmt(),
30 cxxForRangeStmt(), doStmt()))
30 cxxForRangeStmt(), doStmt()))
tools/clang/tools/extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp 27 expr(anyOf(cxxFunctionalCastExpr(), cxxBindTemporaryExpr(),
27 expr(anyOf(cxxFunctionalCastExpr(), cxxBindTemporaryExpr(),
28 cxxTemporaryObjectExpr()),
32 anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
32 anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
32 anyOf(cxxThrowExpr(), callExpr(), returnStmt()))),
33 hasAncestor(varDecl()),
35 unless(hasAncestor(cxxCatchStmt()))))))
tools/clang/tools/extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp 70 unless(integerLiteral()),
72 unless(hasType(enumType())))))
tools/clang/tools/extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp 65 cxxConstructorDecl(ofClass(cxxRecordDecl().bind("parent")))),
tools/clang/tools/extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp 42 cxxMethodDecl(hasParameter(0, parmVarDecl(hasType(referenceType()))));
48 has(ignoringParenCasts(cxxThisExpr()))))));
54 ofClass(cxxRecordDecl(unless(hasAncestor(classTemplateDecl())))),
62 ofClass(cxxRecordDecl(hasAncestor(classTemplateDecl()))),
65 hasDescendant(parenListExpr()))),
76 DeclarationMatcher AdditionalMatcher = cxxMethodDecl();
90 has(fieldDecl(anyOf(hasType(pointerType()), hasType(SmartPointerType),
91 hasType(arrayType())))))));
94 Finder->addMatcher(cxxMethodDecl(ofClass(cxxRecordDecl().bind("class")),
tools/clang/tools/extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp 36 cxxBindTemporaryExpr(unless(has(ignoringParenImpCasts(callExpr()))))
40 hasParent(compoundStmt().bind("compound")),
83 match(expr(hasDescendant(typeLoc().bind("t"))), *E, *Result.Context);
tools/clang/tools/extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp 68 unless(hasParent(stmtExpr())));
tools/clang/tools/extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp 78 return anyOf(hasAncestor(typeLoc()),
382 hasArgument(0, declRefExpr().bind("arg")),
383 anyOf(hasAncestor(lambdaExpr().bind("containing-lambda")),
384 hasAncestor(functionDecl().bind("containing-func"))),
399 unless(initListExpr()),
tools/clang/tools/extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp 223 unless(anyOf(isOverride(), isImplicit(), cxxConstructorDecl(),
224 cxxDestructorDecl(), cxxConversionDecl(), isStatic(),
224 cxxDestructorDecl(), cxxConversionDecl(), isStatic(),
tools/clang/tools/extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp 53 unless(hasDescendant(cxxThisExpr())))))
tools/clang/tools/extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp 29 hasAncestor(functionDecl()))),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp 35 auto Loop = stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()));
35 auto Loop = stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()));
35 auto Loop = stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()));
35 auto Loop = stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()));
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.cpp 22 hasDeclContext(anyOf(translationUnitDecl(), // Global scope.
23 namespaceDecl(), // Namespace scope.
24 recordDecl())), // Class scope.
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp 42 implicitCastExpr(hasImplicitDestinationType(builtinType()),
43 hasSourceExpression(hasType(builtinType())),
45 unless(hasParent(castExpr())),
53 hasLHS(expr(hasType(builtinType()))),
54 hasRHS(expr(hasType(builtinType()))),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp 66 anyOf(cxxNewExpr(),
91 hasType(pointerType()))))
116 allOf(unless(ConsideredOwner), unless(parenListExpr()))))
137 hasType(autoType().bind("deduced_type")))))
171 anyOf(unless(has(cxxDestructorDecl())),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp 61 unless(hasParent(arraySubscriptExpr())),
62 unless(hasParentIgnoringImpCasts(explicitCastExpr())),
64 unless(hasSourceExpression(ignoringParens(stringLiteral()))))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp 51 hasBase(ignoringImpCasts(hasType(constantArrayType().bind("type")))),
52 hasIndex(expr().bind("index")), unless(hasAncestor(isImplicit())))
61 hasArgument(1, expr().bind("index")))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProBoundsPointerArithmeticCheck.cpp 24 hasType(pointerType()), hasType(autoType(hasDeducedType(pointerType()))),
24 hasType(pointerType()), hasType(autoType(hasDeducedType(pointerType()))),
25 hasType(decltypeType(hasUnderlyingType(pointerType()))));
39 hasType(pointerType()))
48 hasType(decayedType(hasDecayedType(pointerType())))))))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeConstCastCheck.cpp 23 Finder->addMatcher(cxxConstCastExpr().bind("cast"), this);
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp 53 hasLHS(memberExpr(member(fieldDecl().bind("fieldDecl")))))),
280 unless(has(cxxConstructorDecl()))),
292 hasType(recordDecl(has(fieldDecl()),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeReinterpretCastCheck.cpp 23 Finder->addMatcher(cxxReinterpretCastExpr().bind("cast"), this);
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp 25 Finder->addMatcher(vAArgExpr().bind("va_use"), this);
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp 38 const auto OfBaseClass = ofClass(cxxRecordDecl().bind("BaseDecl"));
tools/clang/tools/extra/clang-tidy/fuchsia/DefaultArgumentsCallsCheck.cpp 19 Finder->addMatcher(cxxDefaultArgExpr().bind("stmt"), this);
tools/clang/tools/extra/clang-tidy/fuchsia/TrailingReturnCheck.cpp 37 unless(anyOf(returns(decltypeType()),
tools/clang/tools/extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp 29 unless(hasParent(substNonTypeTemplateParmExpr())),
110 if (!match(expr(hasAncestor(linkageSpecDecl())), *CastExpr, *Result.Context)
tools/clang/tools/extra/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp 25 Finder->addMatcher(objcThrowStmt().bind("throwStmt"), this);
tools/clang/tools/extra/clang-tidy/google/DefaultArgumentsCheck.cpp 22 hasAnyParameter(parmVarDecl(hasInitializer(expr()))))
tools/clang/tools/extra/clang-tidy/google/FunctionNamingCheck.cpp 104 unless(anyOf(isExpansionInSystemHeader(), cxxMethodDecl(),
105 hasAncestor(namespaceDecl()), isMain(), isImplicit(),
tools/clang/tools/extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp 41 Finder->addMatcher(decl(anyOf(usingDecl(), usingDirectiveDecl()),
41 Finder->addMatcher(decl(anyOf(usingDecl(), usingDirectiveDecl()),
42 hasDeclContext(translationUnitDecl()))
tools/clang/tools/extra/clang-tidy/google/NonConstReferences.cpp 42 unless(hasType(rValueReferenceType())))
tools/clang/tools/extra/clang-tidy/google/OverloadedUnaryAndCheck.cpp 35 Finder->addMatcher(functionDecl(unless(cxxMethodDecl()), parameterCountIs(1),
tools/clang/tools/extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp 237 hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
237 hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
tools/clang/tools/extra/clang-tidy/google/UsingNamespaceDirectiveCheck.cpp 26 Finder->addMatcher(usingDirectiveDecl().bind("usingNamespace"), this);
tools/clang/tools/extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp 33 hasType(substTemplateTypeParmType().bind("templ_type")))),
39 eachOf(has(expr(hasType(namedDecl().bind("decl")))), anything()))
tools/clang/tools/extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp 34 ignoringImpCasts(declRefExpr().bind("non-enum-condition"))),
39 declRefExpr(hasType(enumType())).bind("enum-condition"))))))
45 Finder->addMatcher(ifStmt(hasParent(ifStmt()), unless(hasElse(anything())))
tools/clang/tools/extra/clang-tidy/hicpp/NoAssemblerCheck.cpp 27 Finder->addMatcher(asmStmt().bind("asm-stmt"), this);
28 Finder->addMatcher(fileScopeAsmDecl().bind("asm-file-scope"), this);
tools/clang/tools/extra/clang-tidy/linuxkernel/MustCheckErrsCheck.cpp 23 auto NonCheckingStmts = stmt(anyOf(compoundStmt(), labelStmt()));
23 auto NonCheckingStmts = stmt(anyOf(compoundStmt(), labelStmt()));
tools/clang/tools/extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp 31 allOf(unless(isMacroID()), unless(cxxMemberCallExpr()),
40 callExpr(allOf(unless(isMacroID()), unless(cxxMemberCallExpr()),
47 allOf(unless(isMacroID()), unless(cxxMemberCallExpr()),
53 hasArgument(0, anyOf(declRefExpr().bind("arg"),
54 cxxMemberCallExpr().bind("arg"))))))
63 hasLHS(implicitCastExpr().bind("lhs")),
tools/clang/tools/extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp 29 cxxConversionDecl())))))))))))
tools/clang/tools/extra/clang-tidy/misc/MisplacedConstCheck.cpp 25 ignoringParens(functionType())))))))
tools/clang/tools/extra/clang-tidy/misc/RedundantExpressionCheck.cpp 420 isComparisonOperator(), expr().bind(Id),
424 hasRHS(matchSymbolicExpr(Id)), expr().bind(SwapId)))));
640 anyOf(cxxBoolLiteral(), characterLiteral(), integerLiteral()));
640 anyOf(cxxBoolLiteral(), characterLiteral(), integerLiteral()));
640 anyOf(cxxBoolLiteral(), characterLiteral(), integerLiteral()));
700 integerLiteral())),
701 hasRHS(integerLiteral())))))
711 integerLiteral().bind("shift-const")))))),
713 integerLiteral().bind("and-const"))))
tools/clang/tools/extra/clang-tidy/misc/StaticAssertCheck.cpp 36 hasOperatorName("!"), hasUnaryOperand(ignoringImpCasts(stringLiteral())));
39 cxxNullPtrLiteralExpr(), gnuNullExpr(), NegatedString))
39 cxxNullPtrLiteralExpr(), gnuNullExpr(), NegatedString))
47 hasEitherOperand(ignoringImpCasts(stringLiteral().bind("assertMSG"))),
tools/clang/tools/extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp 33 Finder->addMatcher(cxxThrowExpr().bind("throw"), this);
34 Finder->addMatcher(cxxCatchStmt().bind("catch"), this);
tools/clang/tools/extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp 28 anyOf(autoType(), hasDeclaration(equalsBoundNode("class")))))));
35 hasName("operator="), ofClass(recordDecl().bind("class")))
60 anyOf(unaryOperator(hasOperatorName("*"), hasUnaryOperand(cxxThisExpr())),
62 callee(unresolvedLookupExpr()),
63 hasArgument(0, cxxThisExpr())))))));
tools/clang/tools/extra/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp 27 on(expr().bind("left")), callee(memberExpr().bind("reset_member")),
27 on(expr().bind("left")), callee(memberExpr().bind("reset_member")),
31 decl().bind("left_class"))))),
33 on(expr().bind("right")),
34 callee(memberExpr().bind("release_member")),
38 decl().bind("right_class")))))))))
tools/clang/tools/extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp 30 Finder->addMatcher(nestedNameSpecifier().bind("nns"), this);
tools/clang/tools/extra/clang-tidy/misc/UnusedParametersCheck.cpp 33 functionDecl(isDefinition(), hasBody(stmt()), hasAnyParameter(decl()))
33 functionDecl(isDefinition(), hasBody(stmt()), hasAnyParameter(decl()))
tools/clang/tools/extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp 55 auto DeclMatcher = hasDeclaration(namedDecl().bind("used"));
59 Finder->addMatcher(declRefExpr().bind("used"), this);
60 Finder->addMatcher(callExpr(callee(unresolvedLookupExpr().bind("used"))),
64 forEachTemplateArgument(templateArgument().bind("used"))))),
67 templateArgument().bind("used")))),
tools/clang/tools/extra/clang-tidy/modernize/AvoidBindCheck.cpp 126 hasArgument(0, declRefExpr(to(functionDecl().bind("f"))).bind("ref")))
tools/clang/tools/extra/clang-tidy/modernize/AvoidCArraysCheck.cpp 51 typeLoc(hasValidBeginLoc(), hasType(arrayType()),
tools/clang/tools/extra/clang-tidy/modernize/ConcatNestedNamespacesCheck.cpp 69 Finder->addMatcher(ast_matchers::namespaceDecl().bind("namespace"), this);
tools/clang/tools/extra/clang-tidy/modernize/DeprecatedIosBaseAliasesCheck.cpp 39 qualType(hasDeclaration(IoStateDecl), unless(elaboratedType()));
tools/clang/tools/extra/clang-tidy/modernize/LoopConvertCheck.cpp 150 declRefExpr(to(varDecl().bind(ConditionEndVarName)))),
156 ignoringParenImpCasts(declRefExpr(to(varDecl().bind(ConditionVarName)))));
172 returns(qualType(unless(hasCanonicalType(referenceType())))
177 qualType(unless(hasCanonicalType(rValueReferenceType())))
tools/clang/tools/extra/clang-tidy/modernize/MakeSharedCheck.cpp 26 qualType().bind(PointerType)))))))));
tools/clang/tools/extra/clang-tidy/modernize/MakeUniqueCheck.cpp 28 0, templateArgument(refersToType(qualType().bind(PointerType)))),
tools/clang/tools/extra/clang-tidy/modernize/PassByValueCheck.cpp 54 return qualType(unless(anyOf(referenceType(), isConstQualified())));
tools/clang/tools/extra/clang-tidy/modernize/RawStringLiteralCheck.cpp 126 stringLiteral(unless(hasParent(predefinedExpr()))).bind("lit"), this);
tools/clang/tools/extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp 54 Finder->addMatcher(typedefNameDecl().bind(TypedefId), this);
55 auto ParenFunctionType = parenType(innerType(functionType()));
73 Finder->addMatcher(lambdaExpr().bind(LambdaId), this);
tools/clang/tools/extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp 105 unless(elaboratedType()))))
tools/clang/tools/extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp 33 const auto Begin = hasArgument(0, expr());
34 const auto End = hasArgument(1, expr());
35 const auto RandomFunc = hasArgument(2, expr().bind("randomFunc"));
40 has(implicitCastExpr(has(declRefExpr().bind("name")))))
tools/clang/tools/extra/clang-tidy/modernize/ReturnBracedInitListCheck.cpp 30 isListInitialization(), hasDescendant(initListExpr()),
39 returns(unless(anyOf(builtinType(), autoType()))),
39 returns(unless(anyOf(builtinType(), autoType()))),
tools/clang/tools/extra/clang-tidy/modernize/ShrinkToFitCheck.cpp 28 memberExpr(member(valueDecl().bind("ContainerDecl")));
30 declRefExpr(hasDeclaration(valueDecl().bind("ContainerDecl")));
tools/clang/tools/extra/clang-tidy/modernize/UnaryStaticAssertCheck.cpp 23 Finder->addMatcher(staticAssertDecl().bind("static_assert"), this);
tools/clang/tools/extra/clang-tidy/modernize/UseAutoCheck.cpp 260 unless(hasInitializer(ignoringParenImpCasts(cxxNewExpr()))),
271 pointsTo(parenType(innerType(functionType()))))))))))
277 unless(has(varDecl(unless(hasInitializer(explicitCastExpr()))))))
290 hasTemplateArgument(0, refersToType(qualType().bind("arg")));
309 unless(has(varDecl(anyOf(hasType(autoType()),
310 hasType(qualType(hasDescendant(autoType()))))))),
tools/clang/tools/extra/clang-tidy/modernize/UseBoolLiteralsCheck.cpp 31 has(ignoringParenImpCasts(integerLiteral().bind("literal"))),
34 anyOf(hasParent(explicitCastExpr().bind("cast")), anything())),
43 ignoringParenImpCasts(integerLiteral().bind("literal"))),
45 ignoringParenImpCasts(integerLiteral().bind("literal"))))),
tools/clang/tools/extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp 197 anyOf(stringLiteral(), characterLiteral(), integerLiteral(),
197 anyOf(stringLiteral(), characterLiteral(), integerLiteral(),
197 anyOf(stringLiteral(), characterLiteral(), integerLiteral(),
199 hasUnaryOperand(integerLiteral())),
200 floatLiteral(),
202 hasUnaryOperand(floatLiteral())),
203 cxxBoolLiteral(), cxxNullPtrLiteralExpr(), implicitValueInitExpr(),
203 cxxBoolLiteral(), cxxNullPtrLiteralExpr(), implicitValueInitExpr(),
203 cxxBoolLiteral(), cxxNullPtrLiteralExpr(), implicitValueInitExpr(),
204 declRefExpr(to(enumConstantDecl())));
tools/clang/tools/extra/clang-tidy/modernize/UseEmplaceCheck.cpp 75 auto NewExprAsArgument = hasAnyArgument(ignoringImplicit(cxxNewExpr()));
83 auto HasInitList = anyOf(has(ignoringImplicit(initListExpr())),
84 has(cxxStdInitializerListExpr()));
tools/clang/tools/extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp 133 hasOperatorName("*"), hasUnaryOperand(cxxThisExpr()))))),
154 hasSourceExpression(cxxThisExpr()))),
172 auto LHS = memberExpr(hasObjectExpression(cxxThisExpr()),
237 hasParameter(0, hasType(lValueReferenceType())))
tools/clang/tools/extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp 37 cxxDestructorDecl()));
42 unless(anyOf(hasBody(stmt()), isDefaulted(), isDeleted(),
47 anyOf(PrivateSpecialFn, hasBody(stmt()), isPure(),
tools/clang/tools/extra/clang-tidy/modernize/UseNoexceptCheck.cpp 38 hasOverloadedOperatorName("delete"), cxxDestructorDecl()))
48 cxxDestructorDecl())))
tools/clang/tools/extra/clang-tidy/modernize/UseNullptrCheck.cpp 41 unless(hasImplicitDestinationType(qualType(substTemplateTypeParmType()))),
46 unless(hasAncestor(explicitCastExpr())))
tools/clang/tools/extra/clang-tidy/modernize/UseOverrideCheck.cpp 39 cxxMethodDecl(isOverride(), unless(cxxDestructorDecl())).bind("method"),
tools/clang/tools/extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp 376 returns(autoType()), cxxConversionDecl(),
376 returns(autoType()), cxxConversionDecl(),
tools/clang/tools/extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp 47 unless(elaboratedType()),
tools/clang/tools/extra/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp 33 declRefExpr(to(functionDecl(hasName(MatchText))), unless(callExpr()))
39 unless(hasAncestor(initListExpr())))
44 Finder->addMatcher(callExpr(hasAncestor(initListExpr()),
tools/clang/tools/extra/clang-tidy/mpi/BufferDerefCheck.cpp 22 Finder->addMatcher(callExpr().bind("CE"), this);
tools/clang/tools/extra/clang-tidy/mpi/TypeMismatchCheck.cpp 240 Finder->addMatcher(callExpr().bind("CE"), this);
tools/clang/tools/extra/clang-tidy/openmp/ExceptionEscapeCheck.cpp 56 hasStructuredBlock(stmt().bind("structured-block")))
tools/clang/tools/extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp 33 anyOf(unless(hasAnyClause(ompDefaultClause())),
tools/clang/tools/extra/clang-tidy/performance/FasterStringFindCheck.cpp 44 return hasType(qualType(anyOf(substTemplateTypeParmType(),
45 hasDescendant(substTemplateTypeParmType()))));
tools/clang/tools/extra/clang-tidy/performance/ForRangeCopyCheck.cpp 41 unless(anyOf(hasCanonicalType(anyOf(referenceType(), pointerType())),
41 unless(anyOf(hasCanonicalType(anyOf(referenceType(), pointerType())),
44 unless(hasInitializer(expr(hasDescendant(materializeTemporaryExpr())))));
tools/clang/tools/extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp 55 cxxOperatorCallExpr().bind("operator-call")),
tools/clang/tools/extra/clang-tidy/performance/InefficientAlgorithmCheck.cpp 50 hasDeclaration(decl().bind("IneffContObj")),
60 hasArgument(2, expr().bind("AlgParam")),
tools/clang/tools/extra/clang-tidy/performance/InefficientStringConcatenationCheck.cpp 52 hasDeclaration(decl().bind("lhsStrT")))
64 hasAncestor(stmt(anyOf(cxxForRangeStmt(),
65 whileStmt(), forStmt())))),
65 whileStmt(), forStmt())))),
tools/clang/tools/extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp 27 cxxMethodDecl(anyOf(cxxConstructorDecl(), hasOverloadedOperatorName("=")),
tools/clang/tools/extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp 50 on(declRefExpr(to(varDecl().bind("objectArg")))));
53 unless(callee(cxxMethodDecl())));
tools/clang/tools/extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp 37 unless(hasAncestor(callExpr()))),
47 unless(hasAncestor(stmt(anyOf(forStmt(), cxxForRangeStmt(),
47 unless(hasAncestor(stmt(anyOf(forStmt(), cxxForRangeStmt(),
48 whileStmt(), doStmt()))))))),
48 whileStmt(), doStmt()))))))),
83 unless(anyOf(hasCanonicalType(referenceType()),
86 decl().bind("param"));
88 functionDecl(hasBody(stmt()), isDefinition(), unless(isImplicit()),
91 unless(isInstantiated()), decl().bind("functionDecl")),
tools/clang/tools/extra/clang-tidy/readability/BracesAroundStatementsCheck.cpp 126 Finder->addMatcher(ifStmt().bind("if"), this);
127 Finder->addMatcher(whileStmt().bind("while"), this);
128 Finder->addMatcher(doStmt().bind("do"), this);
129 Finder->addMatcher(forStmt().bind("for"), this);
130 Finder->addMatcher(cxxForRangeStmt().bind("for-range"), this);
tools/clang/tools/extra/clang-tidy/readability/ConvertMemberFunctionsToStatic.cpp 80 hasTrivialBody(), isOverloadedOperator(), cxxConstructorDecl(),
81 cxxDestructorDecl(), cxxConversionDecl(), isTemplate(),
81 cxxDestructorDecl(), cxxConversionDecl(), isTemplate(),
tools/clang/tools/extra/clang-tidy/readability/DeleteNullPointerCheck.cpp 33 declRefExpr(to(decl().bind("deletedPointer"))),
34 memberExpr(hasDeclaration(fieldDecl().bind("deletedMemberPointer")))));
tools/clang/tools/extra/clang-tidy/readability/DeletedDefaultCheck.cpp 28 cxxMethodDecl(anyOf(cxxConstructorDecl().bind("constructor"),
tools/clang/tools/extra/clang-tidy/readability/ElseAfterReturnCheck.cpp 22 stmt(anyOf(returnStmt().bind("return"), continueStmt().bind("continue"),
22 stmt(anyOf(returnStmt().bind("return"), continueStmt().bind("continue"),
23 breakStmt().bind("break"),
24 expr(ignoringImplicit(cxxThrowExpr().bind("throw")))));
37 hasElse(stmt().bind("else")))
tools/clang/tools/extra/clang-tidy/readability/IdentifierNamingCheck.cpp 237 Finder->addMatcher(namedDecl().bind("decl"), this);
238 Finder->addMatcher(usingDecl().bind("using"), this);
239 Finder->addMatcher(declRefExpr().bind("declRef"), this);
240 Finder->addMatcher(cxxConstructorDecl().bind("classRef"), this);
241 Finder->addMatcher(cxxDestructorDecl().bind("classRef"), this);
242 Finder->addMatcher(typeLoc().bind("typeLoc"), this);
243 Finder->addMatcher(nestedNameSpecifierLoc().bind("nestedNameLoc"), this);
tools/clang/tools/extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp 269 hasParent(explicitCastExpr())));
275 hasSourceExpression(cxxBoolLiteral()))),
291 hasParent(stmt(anyOf(ifStmt(), whileStmt()), has(declStmt())))),
291 hasParent(stmt(anyOf(ifStmt(), whileStmt()), has(declStmt())))),
291 hasParent(stmt(anyOf(ifStmt(), whileStmt()), has(declStmt())))),
296 anyOf(hasParent(stmt().bind("parentStmt")), anything()),
298 unless(hasAncestor(functionTemplateDecl())))
322 implicitCastExpr().bind("implicitCastFromBool"),
325 anyOf(hasParent(implicitCastExpr().bind("furtherImplicitCast")),
328 unless(hasAncestor(functionTemplateDecl()))),
tools/clang/tools/extra/clang-tidy/readability/IsolateDeclarationCheck.cpp 29 hasParent(compoundStmt()))
tools/clang/tools/extra/clang-tidy/readability/MagicNumbersCheck.cpp 100 Finder->addMatcher(integerLiteral().bind("integer"), this);
102 Finder->addMatcher(floatLiteral().bind("float"), this);
tools/clang/tools/extra/clang-tidy/readability/MisleadingIndentationCheck.cpp 109 Finder->addMatcher(ifStmt(hasElse(stmt())).bind("if"), this);
111 compoundStmt(has(stmt(anyOf(ifStmt(), forStmt(), whileStmt()))))
111 compoundStmt(has(stmt(anyOf(ifStmt(), forStmt(), whileStmt()))))
111 compoundStmt(has(stmt(anyOf(ifStmt(), forStmt(), whileStmt()))))
tools/clang/tools/extra/clang-tidy/readability/NamespaceCommentCheck.cpp 40 Finder->addMatcher(namespaceDecl().bind("namespace"), this);
tools/clang/tools/extra/clang-tidy/readability/NonConstParameterCheck.cpp 24 Finder->addMatcher(cxxConstructorDecl().bind("Ctor"), this);
28 Finder->addMatcher(declRefExpr().bind("Ref"), this);
33 binaryOperator(), callExpr(), returnStmt(),
33 binaryOperator(), callExpr(), returnStmt(),
33 binaryOperator(), callExpr(), returnStmt(),
34 cxxConstructExpr()))
tools/clang/tools/extra/clang-tidy/readability/RedundantControlFlowCheck.cpp 37 has(compoundStmt(hasAnySubstatement(returnStmt(unless(has(expr())))))
41 has(compoundStmt(hasAnySubstatement(continueStmt())).bind("continue"));
43 stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()),
43 stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()),
43 stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()),
43 stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()),
tools/clang/tools/extra/clang-tidy/readability/RedundantDeclarationCheck.cpp 35 hasParent(friendDecl()))))))
tools/clang/tools/extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp 26 unless(callee(memberExpr(hasObjectExpression(cxxThisExpr())))),
29 returns(qualType(pointsTo(type().bind("getType")))))))
40 recordDecl().bind("duck_typing"),
42 returns(qualType(pointsTo(type().bind("op->Type")))))),
44 type().bind("op*Type")))))));
51 memberExpr(expr().bind("memberExpr"), isArrow(),
86 anyOf(cxxNullPtrLiteralExpr(), gnuNullExpr(),
86 anyOf(cxxNullPtrLiteralExpr(), gnuNullExpr(),
tools/clang/tools/extra/clang-tidy/readability/RedundantStringCStrCheck.cpp 88 hasArgument(1, cxxDefaultArgExpr()))));
93 callee(memberExpr().bind("member")),
tools/clang/tools/extra/clang-tidy/readability/RedundantStringInitCheck.cpp 32 hasArgument(1, cxxDefaultArgExpr()))));
55 unless(parmVarDecl()))
tools/clang/tools/extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp 453 unless(hasParent(ifStmt())),
462 auto VarAssign = declRefExpr(hasDeclaration(decl().bind(IfAssignVarId)));
464 auto MemAssign = memberExpr(hasDeclaration(decl().bind(IfAssignVarId)));
468 hasLHS(expr().bind(IfAssignVariableId)),
481 ifStmt(unless(hasParent(ifStmt())), hasThen(Then), hasElse(Else))
492 ifStmt(hasThen(returnsBool(Value)), unless(hasElse(stmt())))),
507 Finder->addMatcher(translationUnitDecl().bind("top"), this);
tools/clang/tools/extra/clang-tidy/readability/SimplifySubscriptExprCheck.cpp 40 has(memberExpr().bind("member")),
42 unless(anyOf(substTemplateTypeParmType(),
43 hasDescendant(substTemplateTypeParmType()))),
tools/clang/tools/extra/clang-tidy/readability/StringCompareCheck.cpp 33 hasArgument(0, expr().bind("str2")), argumentCountIs(1),
34 callee(memberExpr().bind("str1")));
tools/clang/tools/extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp 22 substTemplateTypeParmType(), hasDescendant(substTemplateTypeParmType())));
22 substTemplateTypeParmType(), hasDescendant(substTemplateTypeParmType())));
tools/clang/tools/extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp 200 stmt(eachOf(integerLiteral().bind(IntegerLiteralCheck::Name),
201 floatLiteral().bind(FloatingLiteralCheck::Name)),
202 unless(anyOf(hasParent(userDefinedLiteral()),
204 hasAncestor(substNonTypeTemplateParmExpr())))),
tools/clang/tools/extra/clang-tidy/utils/ASTUtils.cpp 23 "function", match(stmt(hasAncestor(functionDecl().bind("function"))),
tools/clang/tools/extra/clang-tidy/utils/DeclRefExprUtils.cpp 62 unless(anyOf(referenceType(), pointerType()))));
62 unless(anyOf(referenceType(), pointerType()))));
94 unless(anyOf(referenceType(), pointerType()))));
94 unless(anyOf(referenceType(), pointerType()))));
tools/clang/tools/extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp 39 cxxConstructExpr(hasParent(cxxFunctionalCastExpr()),
tools/clang/tools/extra/tool-template/ToolTemplate.cpp 110 namedDecl(cxxRecordDecl(), isExpansionInMainFile()).bind("decl"),
tools/clang/tools/extra/unittests/clang-query/QueryEngineTest.cpp 51 DynTypedMatcher FnMatcher = functionDecl();
tools/clang/tools/extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp 14 Finder->addMatcher(ast_matchers::varDecl().bind("var"), this);
tools/clang/tools/extra/unittests/clang-tidy/IncludeInserterTest.cpp 42 Finder->addMatcher(ast_matchers::declStmt().bind("stmt"), this);
tools/clang/tools/extra/unittests/clang-tidy/NamespaceAliaserTest.cpp 27 Finder->addMatcher(ast_matchers::callExpr().bind("foo"), this);
tools/clang/tools/extra/unittests/clang-tidy/OverlappingReplacementsTest.cpp 47 Finder->addMatcher(ifStmt().bind(BoundIf), this);
tools/clang/tools/extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp 35 ifStmt(hasCondition(expr().bind(C)), hasThen(stmt().bind(T)),
35 ifStmt(hasCondition(expr().bind(C)), hasThen(stmt().bind(T)),
36 hasElse(stmt().bind(E))),
73 : TransformerClangTidyCheck(tooling::makeRule(integerLiteral(),
99 binaryOperator(hasOperatorName("+"), hasRHS(expr().bind("r"))),
125 return tooling::makeRule(clang::ast_matchers::functionDecl(),
150 return tooling::makeRule(clang::ast_matchers::functionDecl(),
tools/clang/tools/extra/unittests/clang-tidy/UsingInserterTest.cpp 28 Finder->addMatcher(clang::ast_matchers::callExpr().bind("foo"), this);
tools/clang/unittests/AST/ASTContextParentMapTest.cpp 36 ifStmt(hasParent(compoundStmt()))));
43 typeLoc(hasParent(typeLoc(hasParent(functionDecl()))))));
49 nestedNameSpecifierLoc(hasParent(typeLoc()))));
115 isImplicit(), hasParent(lambdaExpr())))))),
tools/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp 146 ToTU, functionTemplateDecl());
tools/clang/unittests/AST/ASTImporterTest.cpp 489 functionDecl(hasDescendant(chooseExpr())));
505 functionDecl(hasDescendant(cxxNullPtrLiteralExpr())));
528 functionDecl(hasDescendant(imaginaryLiteral())));
609 hasUnaryOperand(cxxThisExpr())))))))))))))))))))))));
618 switchStmt(has(compoundStmt(has(caseStmt())))))));
639 implicitCastExpr())))))));
751 cStyleCastExpr(hasSourceExpression(vaArgExpr())))));
763 has(cxxTemporaryObjectExpr())))))))))));
771 functionDecl(hasDescendant(typedefDecl(has(atomicType())))));
779 functionTemplateDecl());
793 cStyleCastExpr(has(cxxDependentScopeMemberExpr())))));
803 cStyleCastExpr(has(cxxDependentScopeMemberExpr())))));
815 hasDescendant(implicitCastExpr(has(declRefExpr()))),
816 unless(hasAncestor(translationUnitDecl(has(typeAliasDecl()))))));
830 hasDescendant(declRefExpr(to(varTemplateSpecializationDecl()))),
832 hasName("pi"), unless(varTemplateSpecializationDecl()))))))));
846 returnStmt(has(implicitCastExpr(has(declRefExpr())))))));
864 fieldDecl(hasType(dependentTemplateSpecializationType())))))));
879 functionTemplateDecl(hasDescendant(sizeOfPackExpr())));
925 hasName("a"), hasInitializer(hasDescendant(cxxTypeidExpr())))),
927 hasName("b"), hasInitializer(hasDescendant(cxxTypeidExpr()))))));
994 hasDescendant(unaryExprOrTypeTraitExpr()))));
1024 callExpr(has(cxxPseudoDestructorExpr())))));
1033 functionDecl(hasDescendant(usingDecl())));
1055 namespaceDecl(has(usingShadowDecl())));
1068 functionTemplateDecl(hasDescendant(unresolvedLookupExpr())));
1082 binaryOperator(has(cxxUnresolvedConstructExpr())))));
1092 binaryOperator(has(cxxUnresolvedConstructExpr())))));
1124 recordDecl(has(classTemplateDecl()),
1125 has(classTemplateSpecializationDecl())));
1136 cxxOperatorCallExpr())))));
1147 has(fieldDecl(hasType(dependentSizedArrayType())))))));
1174 FirstDeclMatcher<ClassTemplateDecl>().match(FromTU, classTemplateDecl());
1188 FromTU, functionTemplateDecl());
1202 FirstDeclMatcher<ClassTemplateDecl>().match(FromTU, classTemplateDecl());
1210 FirstDeclMatcher<ClassTemplateDecl>().match(ToTU, classTemplateDecl());
1218 FromTU, functionTemplateDecl());
1226 ToTU, functionTemplateDecl());
1241 FirstDeclMatcher<NamespaceDecl>().match(FromTU, namespaceDecl());
1269 auto ToResults = match(chooseExpr().bind("choose"), To->getASTContext());
1270 auto FromResults = match(chooseExpr().bind("choose"), From->getASTContext());
1406 translationUnitDecl(unless(has(classTemplateSpecializationDecl())));
1415 hasName("Base"), has(classTemplateSpecializationDecl()))));
1453 hasName("X"), unless(has(classTemplateSpecializationDecl())))));
1535 auto Matcher = cxxRecordDecl(has(cxxRecordDecl()));
1553 auto Matcher = classTemplateDecl(has(cxxRecordDecl(has(cxxRecordDecl()))));
1569 auto hasImplicitClass = has(cxxRecordDecl());
1585 auto Matcher = functionDecl();
1598 Decl *From = LastDeclMatcher<Decl>{}.match(FromTU, functionDecl());
1674 .match(ToTU, classTemplateDecl()));
1694 .match(ToTU, classTemplateDecl()));
1751 auto FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, functionDecl());
1754 auto ToLHS = LastDeclMatcher<DeclRefExpr>().match(ToD, declRefExpr());
1755 auto FromLHS = LastDeclMatcher<DeclRefExpr>().match(FromTU, declRefExpr());
1756 auto ToRHS = LastDeclMatcher<IntegerLiteral>().match(ToD, integerLiteral());
1758 LastDeclMatcher<IntegerLiteral>().match(FromTU, integerLiteral());
1778 auto FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, functionDecl());
1807 .match(ToTU, classTemplateSpecializationDecl()));
1828 .match(ToTU, classTemplateSpecializationDecl()));
2092 }).match(ToTU, functionDecl()));
2095 auto *FromD = FirstDeclMatcher<FunctionDecl>().match(FromTU, functionDecl());
2102 }).match(ToTU, functionDecl()));
2389 ToD, functionDecl(hasName("f"), hasDescendant(declRefExpr()))));
2417 functionDecl(hasName("f"), hasDescendant(declRefExpr()))))));
2492 LastDeclMatcher<CXXConstructorDecl>().match(FromTU, cxxConstructorDecl());
2612 .match(ToTU, friendDecl())
2641 ToTU, functionDecl(unless(hasParent(friendDecl()))));
2856 auto *FromFriend = FirstDeclMatcher<FriendDecl>().match(FromTU, friendDecl());
2869 auto *ToFriend = FirstDeclMatcher<FriendDecl>().match(ToTU, friendDecl());
2916 "main.c", enumDecl(), VerificationMatcher);
2922 "main.c", enumDecl(), VerificationMatcher);
2948 has(cStyleCastExpr(has(dependentScopeDeclRefExpr())))))))));
2959 has(callExpr(has(dependentScopeDeclRefExpr())))))))));
2972 cxxRecordDecl(has(typedefDecl(has(dependentNameType())))))));
2985 compoundStmt(has(callExpr(has(unresolvedMemberExpr())))))))));
3061 testImportOf(cxxDestructorDecl());
3367 hasParent(classTemplateSpecializationDecl()));
3454 hasParent(classTemplateSpecializationDecl()));
3485 FromTU, classTemplatePartialSpecializationDecl());
3488 ToTU, classTemplatePartialSpecializationDecl());
3493 ToTU, classTemplatePartialSpecializationDecl()));
3511 FromTU, classTemplateSpecializationDecl());
3513 ToTU, classTemplateSpecializationDecl());
3518 ToTU, classTemplateSpecializationDecl()));
3541 FromTU, classTemplateSpecializationDecl());
3547 ToTU, classTemplatePartialSpecializationDecl()));
3551 unless(classTemplatePartialSpecializationDecl()))));
3774 auto Pattern = cxxRecordDecl(has(friendDecl()));
3789 FirstDeclMatcher<ClassTemplateDecl>().match(FromTu, classTemplateDecl());
3793 has(cxxRecordDecl(has(friendDecl(has(classTemplateDecl()))))));
3798 FirstDeclMatcher<ClassTemplateDecl>().match(ToD, classTemplateDecl());
3799 auto *Friend = FirstDeclMatcher<FriendDecl>().match(ToD, friendDecl());
3946 auto *Friend = FirstDeclMatcher<FriendDecl>().match(FromTU0, friendDecl());
4001 TU, namespaceDecl());
4003 TU, classTemplateSpecializationDecl());
4130 hasParent(translationUnitDecl()));
4136 TU, functionTemplateDecl());
4150 TU, functionTemplateDecl());
4396 hasParent(translationUnitDecl()))));
4409 auto *F0 = FirstDeclMatcher<FunctionDecl>().match(ToTU, functionDecl());
4410 auto *F2 = LastDeclMatcher<FunctionDecl>().match(ToTU, functionDecl());
4494 auto *FriendD = FirstDeclMatcher<FriendDecl>().match(ToTU, friendDecl());
4520 auto *FriendD = FirstDeclMatcher<FriendDecl>().match(ToTU, friendDecl());
4653 fieldDecl(hasParent(cxxRecordDecl(hasParent(classTemplateDecl())))));
4715 auto *FriendD0 = FirstDeclMatcher<FriendDecl>().match(ToTU, friendDecl());
4716 auto *FriendD1 = LastDeclMatcher<FriendDecl>().match(ToTU, friendDecl());
5084 FromTU, friendDecl()));
5263 auto Pattern = lambdaExpr();
5282 auto Pattern = lambdaExpr();
5500 auto Pattern = lambdaExpr();
tools/clang/unittests/AST/ASTTypeTraitsTest.cpp 129 EXPECT_TRUE(Verifier.match("void f() {}", decl()));
135 EXPECT_TRUE(Verifier.match("void f() {}", stmt()));
141 EXPECT_TRUE(Verifier.match("void f() {}", typeLoc(loc(functionType()))));
148 nestedNameSpecifierLoc()));
154 EXPECT_TRUE(Verifier.match("void f() {}", functionDecl()));
160 EXPECT_TRUE(Verifier.match("void f() {}", stmt()));
166 EXPECT_TRUE(Verifier.match("void f() {}", functionDecl()));
172 EXPECT_TRUE(Verifier.match("void f() {}", stmt()));
tools/clang/unittests/AST/DataCollectionTest.cpp 107 ASSERT_TRUE(isStmtHashEqual(declRefExpr().bind("id"), "int x, r = x;",
109 ASSERT_FALSE(isStmtHashEqual(declRefExpr().bind("id"), "int x, r = x;",
111 ASSERT_FALSE(isStmtHashEqual(declRefExpr().bind("id"), "int x, r = x;",
116 ASSERT_TRUE(isStmtHashEqual(memberExpr().bind("id"),
119 ASSERT_TRUE(isStmtHashEqual(memberExpr().bind("id"),
122 ASSERT_TRUE(isStmtHashEqual(memberExpr().bind("id"),
125 ASSERT_FALSE(isStmtHashEqual(memberExpr().bind("id"),
132 isStmtHashEqual(integerLiteral().bind("id"), "int x = 0;", "int x = 0;"));
134 isStmtHashEqual(integerLiteral().bind("id"), "int x = 0;", "int x =00;"));
136 isStmtHashEqual(integerLiteral().bind("id"), "int x = 0;", "int x = 1;"));
140 ASSERT_TRUE(isStmtHashEqual(floatLiteral().bind("id"), "double x = .0;",
142 ASSERT_TRUE(isStmtHashEqual(floatLiteral().bind("id"), "double x = .10;",
144 ASSERT_TRUE(isStmtHashEqual(floatLiteral().bind("id"), "double x = .1;",
146 ASSERT_FALSE(isStmtHashEqual(floatLiteral().bind("id"), "double x = .0;",
151 ASSERT_TRUE(isStmtHashEqual(stringLiteral().bind("id"), R"(char x[] = "0";)",
153 ASSERT_FALSE(isStmtHashEqual(stringLiteral().bind("id"), R"(char x[] = "0";)",
158 ASSERT_TRUE(isStmtHashEqual(cxxBoolLiteral().bind("id"), "bool x = false;",
160 ASSERT_FALSE(isStmtHashEqual(cxxBoolLiteral().bind("id"), "bool x = false;",
165 ASSERT_TRUE(isStmtHashEqual(characterLiteral().bind("id"), "char x = '0';",
167 ASSERT_TRUE(isStmtHashEqual(characterLiteral().bind("id"),
170 ASSERT_FALSE(isStmtHashEqual(characterLiteral().bind("id"), "char x = '0';",
tools/clang/unittests/AST/DeclPrinterTest.cpp 1059 classTemplateSpecializationDecl().bind("id"),
1069 classTemplateSpecializationDecl().bind("id"),
1080 classTemplateSpecializationDecl().bind("id"),
1287 staticAssertDecl().bind("id"),
tools/clang/unittests/AST/OMPStructuredBlockTest.cpp 361 hasAncestor(ompExecutableDirective(ompSectionsDirective())),
362 unless(hasAncestor(ompExecutableDirective(ompSectionDirective()))))
tools/clang/unittests/AST/SourceLocationTest.cpp 33 EXPECT_FALSE(Verifier.match("int i", varDecl()));
39 EXPECT_FALSE(Verifier.match("int i;", recordDecl()));
45 EXPECT_FALSE(Verifier.match("int i;", varDecl()));
51 EXPECT_FALSE(Verifier.match("int i;", varDecl()));
57 EXPECT_FALSE(Verifier.match("int i;", varDecl()));
70 EXPECT_TRUE(Verifier.match("void f() { l: return; }", labelStmt()));
76 EXPECT_TRUE(Verifier.match("void f() { l: return; }", labelStmt()));
82 EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C));
88 EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C));
94 EXPECT_TRUE(Verifier.match("void f() { new int[10]; }", cxxNewExpr()));
100 EXPECT_TRUE(Verifier.match("void f() { new int(); }", cxxNewExpr()));
108 memberExpr()));
123 memberExpr()));
132 memberExpr()));
140 memberExpr()));
147 varDecl(), Lang_C89));
153 EXPECT_TRUE(Verifier.match("int a;", typeLoc()));
159 EXPECT_TRUE(Verifier.match("long a;", typeLoc()));
165 EXPECT_TRUE(Verifier.match("long double a;", typeLoc()));
171 EXPECT_TRUE(Verifier.match("double long a;", typeLoc()));
177 EXPECT_TRUE(Verifier.match("long int a;", typeLoc()));
183 EXPECT_TRUE(Verifier.match("int long a;", typeLoc()));
189 EXPECT_TRUE(Verifier.match("unsigned int a;", typeLoc()));
195 EXPECT_TRUE(Verifier.match("int unsigned a;", typeLoc()));
201 EXPECT_TRUE(Verifier.match("long long a;", typeLoc()));
207 EXPECT_TRUE(Verifier.match("unsigned long long a;", typeLoc()));
213 EXPECT_TRUE(Verifier.match("long unsigned long a;", typeLoc()));
219 EXPECT_TRUE(Verifier.match("long long unsigned a;", typeLoc()));
225 EXPECT_TRUE(Verifier.match("const long long a = 0;", typeLoc()));
231 EXPECT_TRUE(Verifier.match("long const long a = 0;", typeLoc()));
237 EXPECT_TRUE(Verifier.match("long long const a = 0;", typeLoc()));
243 EXPECT_TRUE(Verifier.match("class C { C(); };", functionDecl()));
249 EXPECT_TRUE(Verifier.match("class C { C() = default; };", functionDecl()));
255 EXPECT_TRUE(Verifier.match("class C { C() = delete; };", functionDecl()));
263 "int2 i2 = (int2){1, 2};", compoundLiteralExpr()));
272 compoundLiteralExpr(), Lang_OpenCL));
280 "int2 i2 = (int2){1, 2};", initListExpr()));
288 "constant int2 i2 = (int2)(1, 2);", initListExpr(), Lang_OpenCL));
307 loc(templateSpecializationType())));
313 EXPECT_TRUE(Verifier.match("int* a = new (int);", cxxNewExpr()));
334 loc(unaryTransformType())));
344 cxxFunctionalCastExpr(), Lang_CXX11));
354 cxxConstructExpr(), Lang_CXX11));
363 cxxTemporaryObjectExpr(), Lang_CXX11));
376 cxxUnresolvedConstructExpr(), Args, Lang_CXX11));
385 usingDecl()));
396 unresolvedUsingValueDecl()));
405 friendDecl()));
414 friendDecl()));
423 friendDecl()));
432 friendDecl()));
441 friendDecl()));
450 friendDecl()));
460 friendDecl(), Lang_CXX11));
470 friendDecl(), Lang_CXX11));
480 friendDecl(), Lang_CXX11));
490 friendDecl(), Lang_CXX11));
501 friendDecl(), Lang_CXX11));
512 friendDecl(), Lang_CXX11));
558 friendDecl()));
568 friendDecl()));
578 friendDecl()));
588 friendDecl()));
597 friendDecl()));
606 friendDecl(), Lang_CXX11));
631 cxxConstructExpr(), Lang_OBJCXX));
639 functionDecl()));
647 functionDecl(),
658 functionDecl()));
668 functionDecl(),
702 EXPECT_TRUE(Verifier.match("void f() throw();\n", loc(functionType())));
706 loc(functionType())));
711 EXPECT_TRUE(Verifier.match("void f() throw(...);\n", loc(functionType()),
715 EXPECT_TRUE(Verifier.match("void f() noexcept;\n", loc(functionType()),
719 EXPECT_TRUE(Verifier.match("void f() noexcept(false);\n", loc(functionType()),
724 loc(functionType()), Language::Lang_CXX11));
730 parenType(innerType(functionType()))))))));
735 parenType(innerType(functionType())))))),
tools/clang/unittests/AST/StmtPrinterTest.cpp 38 has(compoundStmt(has(stmt().bind("id")))));
225 ASSERT_TRUE(PrintedStmtObjCMatches(ObjCSource, returnStmt().bind("id"),
231 ASSERT_TRUE(PrintedStmtObjCMatches(ObjCSource, returnStmt().bind("id"),
tools/clang/unittests/AST/StructuralEquivalenceTest.cpp 144 classTemplateSpecializationDecl());
155 classTemplateSpecializationDecl());
174 classTemplateSpecializationDecl());
195 LastDeclMatcher<NamespaceDecl>().match(get<1>(Decls), namespaceDecl());
255 cxxConstructorDecl(),
256 cxxDestructorDecl());
527 cxxConversionDecl());
809 lambdaExpr(),
810 lambdaExpr());
821 lambdaExpr(),
822 lambdaExpr());
833 lambdaExpr(),
834 lambdaExpr());
845 lambdaExpr(),
846 lambdaExpr());
tools/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp 43 {isConstQualified(), arrayType()})
105 Finder.addMatcher(decl(), &Callback);
127 Finder.addMatcher(decl(), &VerifyCallback);
153 Finder.addMatcher(decl(), &VerifyCallback);
171 "x", match(pointerType().bind("x"), AST->getASTContext()));
tools/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp 29 hasArgument(0, declRefExpr(to(varDecl())))))));
32 hasArgument(0, declRefExpr(to(varDecl()))),
37 hasArgument(0, declRefExpr(to(varDecl()))),
43 hasArgument(0, declRefExpr(to(varDecl()))),
176 namedDecl(hasName("Foo"), unless(recordDecl()));
252 decl(hasDescendant(typeLoc().bind("x")), has(decl()));
252 decl(hasDescendant(typeLoc().bind("x")), has(decl()));
275 hasAnyTemplateArgument(templateArgument().bind("targ")),
276 forEach(fieldDecl(hasAncestor(forStmt()))));
315 StatementMatcher MixedTypes = stmt(anyOf(ifStmt(), binaryOperator()));
315 StatementMatcher MixedTypes = stmt(anyOf(ifStmt(), binaryOperator()));
322 cxxCatchStmt(anyOf(hasDescendant(varDecl()), isCatchAll()))));
714 hasLHS(expr().bind("x")),
718 hasRHS(expr().bind("x"))));
791 cxxOperatorCallExpr(hasParent(cxxOperatorCallExpr()))));
796 cxxOperatorCallExpr(hasDescendant(cxxOperatorCallExpr()))));
1114 EXPECT_TRUE(matches("class C { public: int i; };", accessSpecDecl()));
1122 EXPECT_TRUE(notMatches("class C { int i; };", accessSpecDecl()));
1564 EXPECT_TRUE(matchesObjC(ObjCString, objcIvarRefExpr()));
1572 EXPECT_TRUE(matchesObjC("void f() { ^{}(); }", blockExpr()));
2164 EXPECT_TRUE(matches("int a[] = {2,3};", arrayType()));
2165 EXPECT_TRUE(matches("int a[42];", arrayType()));
2166 EXPECT_TRUE(matches("void f(int b) { int a[b]; }", arrayType()));
2169 arrayType(hasElementType(builtinType()))));
2173 qualType(arrayType(hasElementType(builtinType())))));
2176 qualType(isConstQualified(), arrayType(hasElementType(builtinType())))));
2179 qualType(isConstQualified(), arrayType())));
2183 qualType(isConstQualified(), arrayType(hasElementType(builtinType())))));
2186 qualType(arrayType(hasElementType(isConstQualified(), builtinType())))));
2189 qualType(arrayType(hasElementType(builtinType())),
2193 constantArrayType(hasElementType(builtinType()))));
2198 EXPECT_TRUE(matches("void f(int i[]);", valueDecl(hasType(decayedType(hasDecayedType(pointerType()))))));
2199 EXPECT_TRUE(notMatches("int i[7];", decayedType()));
2203 EXPECT_TRUE(matches("_Complex float f;", complexType()));
2206 complexType(hasElementType(builtinType()))));
2270 "int i = 1;", varDecl(hasType(qualType().bind("type")),
2274 varDecl(hasType(qualType().bind("type")),
2289 stmt(allOf(ifStmt().bind("if"),
2294 stmt(allOf(ifStmt().bind("if"), has(stmt(equalsBoundNode("if")))))));
2312 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2318 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
2336 functionDecl(returns(qualType().bind("type")),
2351 hasName("f"), forEachDescendant(varDecl().bind("d")),
2494 initListExpr(hasInit(0, expr()))));
2497 initListExpr(hasInit(1, expr()))));
2500 initListExpr(hasInit(0, expr()))));
2535 matchesWithOpenMP(Source0, stmt(nullStmt(), isOMPStructuredBlock())));
2543 notMatchesWithOpenMP(Source1, stmt(nullStmt(), isOMPStructuredBlock())));
2545 matchesWithOpenMP(Source1, stmt(compoundStmt(), isOMPStructuredBlock())));
2555 Source0, ompExecutableDirective(hasStructuredBlock(nullStmt()))));
2563 Source1, ompExecutableDirective(hasStructuredBlock(nullStmt()))));
2565 Source1, ompExecutableDirective(hasStructuredBlock(compoundStmt()))));
tools/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp 23 EXPECT_TRUE(Finder.addDynamicMatcher(decl(), nullptr));
24 EXPECT_TRUE(Finder.addDynamicMatcher(callExpr(), nullptr));
34 EXPECT_TRUE(notMatches("", decl(usingDecl())));
36 decl(usingDecl())));
83 DeclarationMatcher ClassMatcher(recordDecl());
103 Code, varDecl(hasName("MyVar1"), hasDeclContext(translationUnitDecl()))));
105 Code, varDecl(hasName("MyVar2"), hasDeclContext(translationUnitDecl()))));
109 hasDeclContext(decl(hasDeclContext(translationUnitDecl()))))));
113 EXPECT_TRUE(matches("extern \"C\" { void foo() {}; }", linkageSpecDecl()));
114 EXPECT_TRUE(notMatches("void foo() {};", linkageSpecDecl()));
146 cudaKernelCallExpr()));
150 cudaKernelCallExpr()));
169 functionDecl(hasName("f"), hasParent(friendDecl()))));
196 unresolvedLookupExpr(),
284 lambdaExpr()));
290 cxxForRangeStmt()));
292 cxxForRangeStmt()));
299 substNonTypeTemplateParmExpr()));
303 substNonTypeTemplateParmExpr()));
310 notMatches("template <typename T> void f();", nonTypeTemplateParmDecl()));
317 notMatches("template <int N> void f();", templateTypeParmDecl()));
325 userDefinedLiteral()));
329 EXPECT_TRUE(matches("void f() { while(true) { break; } }", breakStmt()));
331 continueStmt()));
332 EXPECT_TRUE(matches("void f() { goto FOO; FOO: ;}", gotoStmt()));
338 addrLabelExpr()));
339 EXPECT_TRUE(matches("void f() { return; }", returnStmt()));
343 StatementMatcher OpCall = cxxOperatorCallExpr();
446 unaryExprOrTypeTraitExpr()));
457 EXPECT_TRUE(notMatches("class Y { void x() {} };", memberExpr()));
458 EXPECT_TRUE(notMatches("class Y { void x() {} };", unresolvedMemberExpr()));
460 notMatches("class Y { void x() {} };", cxxDependentScopeMemberExpr()));
464 EXPECT_TRUE(matches("class Y { void x() { x(); } };", memberExpr()));
466 unresolvedMemberExpr()));
468 cxxDependentScopeMemberExpr()));
473 matches("class Y { void x() { this->y; } int y; };", memberExpr()));
475 matches("class Y { void x() { y; } int y; };", memberExpr()));
477 matches("class Y { void x() { Y y; y.y; } int y; };", memberExpr()));
480 cxxDependentScopeMemberExpr()));
482 cxxDependentScopeMemberExpr()));
484 cxxDependentScopeMemberExpr()));
489 memberExpr()));
491 memberExpr()));
493 memberExpr()));
557 classTemplateSpecializationDecl()));
559 classTemplateSpecializationDecl()));
561 classTemplateSpecializationDecl()));
565 EXPECT_TRUE(matches("int x;", declaratorDecl()));
566 EXPECT_TRUE(notMatches("class A {};", declaratorDecl()));
570 EXPECT_TRUE(matches("void f(int x);", parmVarDecl()));
571 EXPECT_TRUE(notMatches("void f();", parmVarDecl()));
575 StatementMatcher Constructor = cxxConstructExpr();
595 matches("struct X { int a; int f () { return a; } };", cxxThisExpr()));
597 notMatches("struct X { int f () { int a; return a; } };", cxxThisExpr()));
601 StatementMatcher TempExpression = cxxBindTemporaryExpr();
640 materializeTemporaryExpr()));
651 materializeTemporaryExpr()));
657 materializeTemporaryExpr()));
663 materializeTemporaryExpr()));
667 StatementMatcher New = cxxNewExpr();
679 cxxDeleteExpr()));
683 StatementMatcher Arg = cxxDefaultArgExpr();
692 StatementMatcher Literal = stringLiteral();
703 StatementMatcher CharLiteral = characterLiteral();
713 StatementMatcher HasIntLiteral = integerLiteral();
735 StatementMatcher HasFloatLiteral = floatLiteral();
754 EXPECT_TRUE(matches("int* i = nullptr;", cxxNullPtrLiteralExpr()));
759 chooseExpr()));
763 EXPECT_TRUE(matches("int* i = __null;", gnuNullExpr()));
768 atomicExpr()));
826 varDecl(hasInitializer(parenListExpr(has(unaryOperator()))))));
831 varDecl(hasInitializer(stmtExpr()))));
839 has(stringLiteral()))));
843 EXPECT_TRUE(matches("void foo() { __asm(\"mov al, 2\"); }", asmStmt()));
898 arraySubscriptExpr()));
900 arraySubscriptExpr()));
904 EXPECT_TRUE(matches("void f() { for(;;); }", forStmt()));
905 EXPECT_TRUE(matches("void f() { if(true) for(;;); }", forStmt()));
908 forStmt()));
912 EXPECT_TRUE(notMatches("void f() { ; }", forStmt()));
913 EXPECT_TRUE(notMatches("void f() { if(true); }", forStmt()));
917 EXPECT_TRUE(notMatches("void f();", compoundStmt()));
918 EXPECT_TRUE(matches("void f() {}", compoundStmt()));
919 EXPECT_TRUE(matches("void f() {{}}", compoundStmt()));
926 compoundStmt()));
928 compoundStmt()));
932 EXPECT_TRUE(matches("char *p = reinterpret_cast<char *>(&p);",castExpr()));
933 EXPECT_TRUE(matches("void *p = (void *)(&p);", castExpr()));
934 EXPECT_TRUE(matches("char q, *p = const_cast<char *>(&q);", castExpr()));
935 EXPECT_TRUE(matches("char c = char(0);", castExpr()));
939 EXPECT_TRUE(matches("char c = 0;", castExpr()));
941 EXPECT_TRUE(matches("char c = 0, d = c;", castExpr()));
945 EXPECT_TRUE(notMatches("char c = '0';", castExpr()));
946 EXPECT_TRUE(notMatches("char c, &q = c;", castExpr()));
947 EXPECT_TRUE(notMatches("int i = (0);", castExpr()));
948 EXPECT_TRUE(notMatches("int i = 0;", castExpr()));
953 cxxReinterpretCastExpr()));
957 EXPECT_TRUE(notMatches("char* p = (char*)(&p);", cxxReinterpretCastExpr()));
959 cxxReinterpretCastExpr()));
961 cxxReinterpretCastExpr()));
965 cxxReinterpretCastExpr()));
971 cxxFunctionalCastExpr()));
978 cxxFunctionalCastExpr()));
981 cxxFunctionalCastExpr()));
988 cxxDynamicCastExpr()));
993 cxxStaticCastExpr()));
997 EXPECT_TRUE(notMatches("char* p = (char*)(&p);", cxxStaticCastExpr()));
999 cxxStaticCastExpr()));
1001 cxxStaticCastExpr()));
1005 cxxStaticCastExpr()));
1009 EXPECT_TRUE(matches("int i = (int) 2.2f;", cStyleCastExpr()));
1019 cStyleCastExpr()));
1025 varDecl(hasInitializer(implicitCastExpr()))));
1028 varDecl(hasInitializer(implicitCastExpr()))));
1031 varDecl(hasInitializer(implicitCastExpr()))));
1040 varDecl(hasInitializer(implicitCastExpr()))));
1042 varDecl(hasInitializer(implicitCastExpr()))));
1045 varDecl(hasInitializer(implicitCastExpr()))));
1047 varDecl(hasInitializer(implicitCastExpr()))));
1050 varDecl(hasInitializer(implicitCastExpr()))));
1054 EXPECT_TRUE(notMatches("class X {};", stmt()));
1058 EXPECT_TRUE(matches("void x() {}", stmt()));
1062 EXPECT_TRUE(notMatches("void x() {}", declStmt()));
1066 EXPECT_TRUE(matches("void x() { int a; }", declStmt()));
1072 varDecl(hasInitializer(exprWithCleanups()))));
1075 varDecl(hasInitializer(exprWithCleanups()))));
1101 cxxConstructExpr(has(cxxStdInitializerListExpr()),
1105 cxxConstructExpr(has(cxxStdInitializerListExpr()),
1109 EXPECT_TRUE(notMatches("int a[] = { 1, 2 };", cxxStdInitializerListExpr()));
1111 cxxStdInitializerListExpr()));
1116 usingDecl()));
1126 usingDirectiveDecl()));
1128 matches("namespace X { int x; } using X::x;", usingDirectiveDecl()));
1133 EXPECT_TRUE(notMatches("void x() {}", whileStmt()));
1134 EXPECT_TRUE(matches("void x() { while(true); }", whileStmt()));
1135 EXPECT_TRUE(notMatches("void x() { do {} while(true); }", whileStmt()));
1139 EXPECT_TRUE(matches("void x() { do {} while(true); }", doStmt()));
1140 EXPECT_TRUE(matches("void x() { do ; while(false); }", doStmt()));
1144 EXPECT_TRUE(notMatches("void x() { while(true) {} }", doStmt()));
1148 EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }", switchCase()));
1149 EXPECT_TRUE(matches("void x() { switch(42) { default:; } }", switchCase()));
1150 EXPECT_TRUE(matches("void x() { switch(42) default:; }", switchCase()));
1151 EXPECT_TRUE(notMatches("void x() { switch(42) {} }", switchCase()));
1155 EXPECT_TRUE(matches("void x() { switch(42) { case 42:; } }", switchStmt()));
1156 EXPECT_TRUE(matches("void x() { switch(42) { default:; } }", switchStmt()));
1157 EXPECT_TRUE(matches("void x() { switch(42) default:; }", switchStmt()));
1158 EXPECT_TRUE(notMatches("void x() {}", switchStmt()));
1162 EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxCatchStmt()));
1163 EXPECT_TRUE(matches("void foo() try { } catch(int X) { }", cxxTryStmt()));
1165 notMatches("void foo() try { } catch(int X) { }", cxxThrowExpr()));
1167 cxxThrowExpr()));
1169 cxxThrowExpr()));
1181 EXPECT_TRUE(matches("int i = (3);", parenExpr()));
1182 EXPECT_TRUE(matches("int i = (3 + 7);", parenExpr()));
1183 EXPECT_TRUE(notMatches("int i = 3;", parenExpr()));
1185 parenExpr()));
1190 implicitCastExpr(hasSourceExpression(stringLiteral()))));
1193 implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))));
1197 EXPECT_TRUE(matches("struct S {};", qualType().bind("loc")));
1201 EXPECT_TRUE(matches("int a[2];", constantArrayType()));
1204 constantArrayType(hasElementType(builtinType()))));
1214 dependentSizedArrayType()));
1217 dependentSizedArrayType()));
1221 EXPECT_TRUE(matches("int a[] = { 2, 3 };", incompleteArrayType()));
1222 EXPECT_TRUE(matches("void f(int a[]) {}", incompleteArrayType()));
1225 incompleteArrayType()));
1229 EXPECT_TRUE(matches("void f(int b) { int a[b]; }", variableArrayType()));
1230 EXPECT_TRUE(notMatches("int a[] = {2, 3}; int b[42];", variableArrayType()));
1243 EXPECT_TRUE(matches("_Atomic(int) i;", atomicType()));
1253 EXPECT_TRUE(matches("auto i = 2;", autoType()));
1255 autoType()));
1270 EXPECT_TRUE(matches("decltype(1 + 1) sum = 1 + 1;", decltypeType()));
1276 EXPECT_TRUE(matches("int (*f)(int);", functionType()));
1277 EXPECT_TRUE(matches("void f(int i) {}", functionType()));
1282 notMatches("void (*fp)(void);", pointerType(pointee(functionType()))));
1284 pointerType(pointee(ignoringParens(functionType())))));
1288 EXPECT_TRUE(matches("int (*f)(int);", functionProtoType()));
1289 EXPECT_TRUE(matches("void f(int i);", functionProtoType()));
1291 EXPECT_TRUE(notMatchesC("void f();", functionProtoType()));
1298 matches("int (*array)[4];", varDecl(hasType(pointsTo(parenType())))));
1299 EXPECT_TRUE(notMatches("int *array[4];", varDecl(hasType(parenType()))));
1303 varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
1306 varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
1323 loc(pointerType(pointee(qualType())))));
1326 loc(pointerType(pointee(pointerType())))));
1329 loc(qualType(isConstQualified(), pointerType()))));
1333 hasType(blockPointerType()))));
1335 hasType(memberPointerType()))));
1337 hasType(pointerType()))));
1339 hasType(referenceType()))));
1341 hasType(lValueReferenceType()))));
1343 hasType(rValueReferenceType()))));
1347 hasType(blockPointerType()))));
1349 hasType(memberPointerType()))));
1351 hasType(pointerType()))));
1353 hasType(referenceType()))));
1357 hasType(blockPointerType()))));
1359 hasType(memberPointerType()))));
1361 hasType(pointerType()))));
1363 hasType(referenceType()))));
1365 hasType(lValueReferenceType()))));
1367 hasType(rValueReferenceType()))));
1371 hasType(blockPointerType()))));
1373 hasType(memberPointerType()))));
1375 hasType(pointerType()))));
1377 hasType(referenceType()))));
1379 hasType(lValueReferenceType()))));
1381 hasType(rValueReferenceType()))));
1391 hasType(referenceType()))));
1393 hasType(referenceType()))));
1395 hasType(referenceType()))));
1397 hasType(lValueReferenceType()))));
1399 hasType(rValueReferenceType()))));
1401 hasType(referenceType()))));
1403 hasType(lValueReferenceType()))));
1405 hasType(rValueReferenceType()))));
1407 hasType(referenceType()))));
1409 hasType(lValueReferenceType()))));
1411 hasType(rValueReferenceType()))));
1416 loc(enumType())));
1418 loc(enumType())));
1423 loc(pointerType())));
1425 loc(pointerType())));
1428 loc(pointerType(pointee(builtinType())))));
1431 pointerType(pointee(builtinType()))));
1436 hasType(typedefType()))));
1441 templateSpecializationType()));
1445 EXPECT_TRUE(matches("class C{}; C c;", recordType()));
1459 "N::M::D d;", elaboratedType()));
1460 EXPECT_TRUE(matches("class C {} c;", elaboratedType()));
1461 EXPECT_TRUE(notMatches("class C {}; C c;", elaboratedType()));
1471 expr(hasType(substTemplateTypeParmType()))))));
1473 expr(hasType(substTemplateTypeParmType()))))));
1478 nestedNameSpecifier()));
1480 nestedNameSpecifier()));
1482 nestedNameSpecifier()));
1484 nestedNameSpecifier()));
1488 nestedNameSpecifier()));
1491 nestedNameSpecifier()));
1495 EXPECT_TRUE(matches("void f() {int i;;}", nullStmt()));
1496 EXPECT_TRUE(notMatches("void f() {int i;}", nullStmt()));
1581 "void f() { if (true) if(true) {} }", ifStmt().bind(""),
1585 fieldDecl(hasName("y"), hasType(type().bind(""))).bind("decl"),
1744 objcTryStmt()));
1747 objcThrowStmt()));
1750 objcCatchStmt()));
1753 objcFinallyStmt()));
1763 EXPECT_TRUE(matchesObjC(ObjCString, autoreleasePoolStmt()));
1765 EXPECT_FALSE(matchesObjC(ObjCStringNoPool, autoreleasePoolStmt()));
1769 auto Matcher = stmt(ompExecutableDirective());
1793 auto Matcher = ompExecutableDirective(hasAnyClause(ompDefaultClause()));
tools/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp 35 cxxRecordDecl(hasName("B"), isDerivedFrom(recordDecl()))));
60 hasName("M"), hasDeclContext(namespaceDecl()))))));
62 EXPECT_TRUE(matches("class D{};", decl(hasDeclContext(decl()))));
67 decl(hasDescendant(loc(builtinType())))));
69 stmt(hasDescendant(builtinType()))));
72 stmt(hasDescendant(loc(builtinType())))));
74 stmt(hasDescendant(qualType(builtinType())))));
88 qualType(hasDescendant(builtinType()))));
91 pointerType(pointee(builtinType()))))));
93 typeLoc(hasDescendant(loc(builtinType())))));
97 qualType(asString("int ***"), forEachDescendant(pointerType().bind("x"))),
109 qualType(functionType(), forEach(qualType(isInteger()).bind("x"))),
116 varDecl(hasName("i"), hasType(qualType(has(builtinType()))))));
119 varDecl(hasName("i"), hasType(qualType(has(pointerType()))))));
175 parmVarDecl(hasType(objcObjectPointerType()))));
182 parmVarDecl(hasType(templateTypeParmType()))));
190 parmVarDecl(hasType(injectedClassNameType()))));
194 parmVarDecl(hasType(injectedClassNameType()))));
236 parmVarDecl(hasType(qualType(hasDeclaration(cxxRecordDecl()))))));
240 parmVarDecl(hasType(elaboratedType(hasDeclaration(cxxRecordDecl()))))));
246 hasType(typedefType(hasDeclaration(decl()))))));
261 hasDeclaration(cxxRecordDecl()))))));
273 hasDeclaration(typeAliasTemplateDecl()))))));
279 varDecl(hasType(hasUnqualifiedDesugaredType(recordType())))));
282 varDecl(hasType(hasUnqualifiedDesugaredType(recordType())))));
376 CallMethodX = callExpr(callee(cxxConversionDecl()));
385 callExpr(callee(memberExpr()))));
387 notMatches("class Y { void x() { this->x(); } };", callExpr(callee(callExpr()))));
439 hasAnyArgument(implicitCastExpr()));
555 auto MatchesCall = cxxMemberCallExpr(on(callExpr()));
590 auto MatchesCall = cxxMemberCallExpr(onImplicitObjectArgument(callExpr()));
712 forEachDescendant(varDecl().bind("v")),
714 declRefExpr(to(decl(equalsBoundNode("v")))), parmVarDecl())))),
722 varDecl(hasType(qualType(referenceType())))));
727 varDecl(hasType(qualType(hasCanonicalType(referenceType()))))));
732 cxxMethodDecl(hasParameter(0, varDecl()))));
743 cxxMethodDecl(hasParameter(42, varDecl()))));
816 refersToTemplate(templateName())))));
831 refersToDeclaration(decl())))));
844 refersToDeclaration(decl())))));
883 hasAnyTemplateArgument(templateArgument()))));
886 templateSpecializationType(hasAnyTemplateArgument(templateArgument()))));
891 functionDecl(hasAnyTemplateArgument(templateArgument()))));
1116 hasLHS(hasType(isInteger())), hasRHS(hasType(pointsTo(qualType()))));
1222 EXPECT_TRUE(notMatches("int a[42]; void x() { a[23]; }", unaryOperator()));
1228 binaryOperator()));
1269 EXPECT_TRUE(notMatches("int i; double d = (double)i;", unaryOperator()));
1272 EXPECT_TRUE(notMatches("void f(); void x() { f(); }", unaryOperator()));
1297 hasSourceExpression(declRefExpr()))))));
1373 forStmt(hasCondition(expr()))));
1380 forStmt(hasBody(compoundStmt()))));
1382 forStmt(hasBody(compoundStmt()))));
1384 whileStmt(hasBody(compoundStmt()))));
1386 doStmt(hasBody(compoundStmt()))));
1388 cxxForRangeStmt(hasBody(compoundStmt()))));
1389 EXPECT_TRUE(matches("void f() {}", functionDecl(hasBody(compoundStmt()))));
1390 EXPECT_TRUE(notMatches("void f();", functionDecl(hasBody(compoundStmt()))));
1392 functionDecl(hasBody(compoundStmt()))));
1400 compoundStmt(hasAnySubstatement(forStmt()))));
1406 compoundStmt(hasAnySubstatement(forStmt()))));
1411 compoundStmt(hasAnySubstatement(forStmt()))));
1416 compoundStmt(hasAnySubstatement(forStmt()))));
1474 0, ignoringElidableConstructorCall(callExpr()))))),
1485 integerLiteral()))))),
1494 ignoringElidableConstructorCall(callExpr()),
1495 exprWithCleanups(has(ignoringElidableConstructorCall(callExpr())))))),
1500 auto matcher = expr(ignoringElidableConstructorCall(declRefExpr()));
1520 ignoringElidableConstructorCall(cxxConstructExpr()))),
1528 expr(ignoringElidableConstructorCall(integerLiteral())),
1534 varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())));
1551 varDecl(has(ignoringImplicit(cxxConstructExpr())))));
1586 has(expr(ignoringImplicit(callExpr())))
1595 notMatches("class C {}; C a = C();", varDecl(has(cxxConstructExpr()))));
1626 integerLiteral())))));
1629 integerLiteral())))));
1632 integerLiteral())))));
1635 integerLiteral())))));
1731 integerLiteral())))));
1734 integerLiteral())))));
1737 integerLiteral())))));
1744 hasSourceExpression(cxxConstructExpr()))));
1751 expr(integerLiteral()))))));
1757 hasTargetDecl(functionDecl())))));
1760 hasTargetDecl(functionDecl())))));
1797 switchStmt(forEachSwitchCase(caseStmt()))));
1799 switchStmt(forEachSwitchCase(caseStmt()))));
1801 switchStmt(forEachSwitchCase(caseStmt()))));
1804 ifStmt(has(switchStmt(forEachSwitchCase(defaultStmt()))))));
1808 constantExpr(has(integerLiteral()))))))));
1812 constantExpr(has(integerLiteral()))))))));
1816 constantExpr(has(integerLiteral()))))))));
1819 switchStmt(forEachSwitchCase(caseStmt().bind("x"))),
1825 "void f();", functionDecl(hasExplicitSpecifier(constantExpr())), false,
1829 cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
1833 cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
1837 cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
1841 cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
1845 cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
1849 cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
1853 cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
1859 hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
1864 constantExpr(has(cxxBoolLiteral())))),
1869 constantExpr(has(cxxBoolLiteral())))),
1876 cxxConstructorDecl(forEachConstructorInitializer(cxxCtorInitializer()))));
1882 ifStmt(hasConditionVariableStatement(declStmt()))));
1885 ifStmt(hasConditionVariableStatement(declStmt()))));
1891 ifStmt(hasConditionVariableStatement(declStmt()))));
1902 recordDecl(hasName("C"), forEach(fieldDecl().bind("f"))),
1910 forEach(recordDecl(forEach(fieldDecl().bind("f"))))),
1923 isDefinition(), decl().bind("x"), hasName("C"));
1942 recordDecl(hasName("C"), forEachDescendant(fieldDecl().bind("f"))),
1951 forEachDescendant(fieldDecl().bind("f"))))),
1959 compoundStmt(forEachDescendant(ifStmt().bind("if")),
1960 forEachDescendant(whileStmt().bind("while"))),
1966 "class X { int a; };", recordDecl(decl().bind("x"), has(fieldDecl())),
1966 "class X { int a; };", recordDecl(decl().bind("x"), has(fieldDecl())),
1993 recordDecl().bind("x"), hasName("::X"),
1997 "class X {};", recordDecl(recordDecl().bind("x"), hasName("::X"),
2003 decl().bind("x"),
2008 cxxRecordDecl(decl().bind("x"), hasMethod(hasName("g"))),
2012 recordDecl(decl().bind("x"),
2018 callExpr(expr().bind("x"), hasAnyArgument(integerLiteral(equals(42)))),
2022 functionDecl(decl().bind("x"), hasAnyParameter(hasName("y"))),
2026 functionDecl(decl().bind("x"),
2027 has(compoundStmt(hasAnySubstatement(ifStmt())))),
2032 usingDecl(decl().bind("x"), hasAnyUsingShadowDecl(hasTargetDecl(
2037 cxxRecordDecl(decl().bind("x"), isDerivedFrom("::A")),
2042 cxxRecordDecl(decl().bind("x"), isDerivedFrom("C")),
2046 functionDecl(decl().bind("x"), hasAncestor(recordDecl(hasName("::A")))),
2053 ifStmt(stmt().bind("x"), hasAncestor(recordDecl(hasName("::A")))),
2057 recordDecl(hasName("::A"), decl().bind("x"), unless(hasName("fooble"))),
2061 cxxConstructorDecl(hasName("::A::A"), decl().bind("x"),
2069 recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))),
2073 recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))),
2087 recordDecl(hasName("::A"), findAll(fieldDecl().bind("v"))),
2096 fieldDecl().bind("v"))))),
2127 integerLiteral(equals(42), hasAncestor(ifStmt()))));
2139 fieldDecl(hasAncestor(recordDecl(hasAncestor(recordDecl().bind("r"))))),
2149 hasAncestor(recordDecl())))
2188 compoundStmt(hasParent(ifStmt()))));
2191 compoundStmt(hasParent(ifStmt()))));
2194 compoundStmt(hasParent(ifStmt()))));
2213 declRefExpr(to(decl(hasAncestor(decl()))))));
2221 memberExpr(member(hasAncestor(decl())))));
2228 memberExpr(member(hasAncestor(decl())))));
2235 declRefExpr(to(decl(hasAncestor(decl()))))));
2245 declRefExpr(to(decl(hasAncestor(decl()))))));
2252 declRefExpr(to(decl(hasAncestor(decl()))))));
2282 compoundStmt(hasParent(recordDecl()))));
2303 stmt().bind("node"), std::make_unique<HasDuplicateParents>()));
2308 referenceType(pointee(builtinType()))));
2309 EXPECT_TRUE(matches("int *a;", pointerType(pointee(builtinType()))));
2312 loc(pointerType(pointee(builtinType())))));
2316 pointerType(pointee(isConstQualified(), builtinType()))));
2319 pointerType(pointee(isConstQualified(), builtinType()))));
2340 elaboratedType(hasQualifier(nestedNameSpecifier()))));
2358 elaboratedType(elaboratedType(namesType(typedefType())))));
2372 loc(nestedNameSpecifier()).bind("loc"),
2401 forEach(nestedNameSpecifier().bind("x"))),
2416 forEachDescendant(nestedNameSpecifier().bind("x"))),
2444 forEach(nestedNameSpecifierLoc().bind("x"))),
2459 forEachDescendant(nestedNameSpecifierLoc().bind("x"))),
2498 "void f() { if (1) { for (;;) { } } }", ifStmt().bind("if"),
2500 "if", stmt(hasDescendant(forStmt().bind("for"))), "for")));
2502 "void f() { if (1) { for (;;) { } } }", ifStmt().bind("if"),
2504 "if", stmt(hasDescendant(declStmt().bind("decl"))), "decl")));
2519 StatementMatcher RetVal = returnStmt(hasReturnValue(binaryOperator()));
2550 has(integerLiteral()))));
2555 has(integerLiteral()))));
2563 forEachOverridden(cxxMethodDecl().bind("overridden")))
2636 substTemplateTypeParmType(hasReplacementType(qualType()))));
2641 hasSpecializedTemplate(classTemplateDecl()));
tools/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp 30 ast_matchers::internal::Matcher<Stmt> M = stmt(stmt(), stmt());
30 ast_matchers::internal::Matcher<Stmt> M = stmt(stmt(), stmt());
tools/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp 44 VariantValue Value = VariantMatcher::SingleMatcher(stmt());
56 Value = VariantMatcher::SingleMatcher(recordDecl());
62 Value = VariantMatcher::SingleMatcher(ignoringImpCasts(expr()));
83 Value = VariantMatcher::SingleMatcher(recordDecl());
154 matches("int x;", VariantValue(VariantMatcher::SingleMatcher(varDecl()))
159 VariantValue(VariantMatcher::SingleMatcher(functionDecl()))
163 EXPECT_FALSE(VariantValue(VariantMatcher::SingleMatcher(varDecl()))
170 EXPECT_DEATH(VariantValue(VariantMatcher::SingleMatcher(varDecl()))
177 "int x;", VariantValue(VariantMatcher::SingleMatcher(functionDecl()))
182 VariantValue(VariantMatcher::SingleMatcher(declRefExpr()))
tools/clang/unittests/Analysis/CFGBuildResult.h 58 Finder.addMatcher(ast_matchers::functionDecl().bind("func"), &Callback);
tools/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp 51 return expr(Matcher, hasAncestor(compoundStmt().bind("stmt"))).bind("expr");
tools/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp 59 const CallExpr *CE = findNode<CallExpr>(D, callExpr());
tools/clang/unittests/Tooling/RangeSelectorTest.cpp 71 matchCode("static int x = 0;", varDecl().bind("bound_node_id"));
135 TestMatch Match = matchCode(Code, callExpr().bind(Call));
151 TestMatch Match = matchCode(Code, callExpr().bind(Call));
179 auto Matcher = callExpr(hasArgument(0, expr().bind(Arg0)),
180 hasArgument(1, expr().bind(Arg1)))
194 TestMatch Match = matchCode(Code, returnStmt().bind(ID));
201 TestMatch Match = matchCode(Code, expr().bind(ID));
208 TestMatch Match = matchCode(Code, expr().bind(ID));
223 TestMatch Match = matchCode(Code, memberExpr().bind(ID));
242 TestMatch Match = matchCode(Code, memberExpr().bind(ID));
258 TestMatch Match = matchCode(Code, memberExpr().bind(ID));
274 TestMatch Match = matchCode(Code, memberExpr().bind(ID));
285 TestMatch Match = matchCode(Code, functionDecl().bind(ID));
297 TestMatch Match = matchCode(Code, declRefExpr(to(functionDecl())).bind(Ref));
310 TestMatch Match = matchCode(Code, cxxCtorInitializer().bind(Init));
332 TestMatch Match = matchCode(Code, declRefExpr(to(functionDecl())).bind(Ref));
351 TestMatch Match = matchCode(Code, callExpr().bind(ID));
366 TestMatch Match = matchCode(Code, callExpr().bind(ID));
381 TestMatch Match = matchCode(Code, callExpr().bind(ID));
414 TestMatch Match = matchCode(Code, callExpr().bind(ID));
430 TestMatch Match = matchCode(Code, callExpr().bind(ID));
449 TestMatch Match = matchCode(Code, callExpr().bind(ID));
470 TestMatch Match = matchCode(Code, compoundStmt().bind(ID));
479 TestMatch Match = matchCode(Code, compoundStmt().bind(ID));
498 TestMatch Match = matchCode(Code, initListExpr().bind(ID));
512 TestMatch Match = matchCode(Code, initListExpr().bind(ID));
533 TestMatch Match = matchCode(Code, ifStmt().bind(ID));
547 TestMatch Match = matchCode(Code, ifStmt().bind(ID));
573 TestMatch Match = matchCode(Code, returnStmt().bind(Ret));
586 matchCode(Code, binaryOperator(hasLHS(expr().bind(ID))).bind(Op));
598 TestMatch Match = matchCode(Code, binaryOperator().bind(Op));
tools/clang/unittests/Tooling/RefactoringCallbacksTest.cpp 41 expectRewritten(Code, Expected, declStmt().bind("id"), Callback);
48 expectRewritten(Code, Expected, declStmt().bind("id"), Callback);
55 expectRewritten(Code, Expected, declStmt().bind("id"), Callback);
62 expectRewritten(Code, Expected, expr(integerLiteral()).bind("id"), Callback);
72 hasFalseExpression(expr().bind("should-be")))
102 expectRewritten(Code, Expected, declStmt().bind("id"), **Callback);
111 varDecl(hasInitializer(expr().bind("init"))).bind("decl"),
122 varDecl(hasInitializer(expr().bind("init"))).bind("decl"),
tools/clang/unittests/Tooling/SourceCodeBuildersTest.cpp 71 auto StmtMatch = matchStmt(Snippet, expr().bind("expr"));
83 0, ignoringElidableConstructorCall(expr().bind("arg")))))));
132 auto StmtMatch = matchStmt(Snippet, expr().bind("expr"));
tools/clang/unittests/Tooling/StencilTest.cpp 128 Snippet, ifStmt(hasCondition(expr().bind(Condition)),
129 hasThen(stmt().bind(Then)), hasElse(stmt().bind(Else))));
129 hasThen(stmt().bind(Then)), hasElse(stmt().bind(Else))));
147 Snippet, ifStmt(hasCondition(expr().bind(Condition)),
148 hasThen(stmt().bind(Then)), hasElse(stmt().bind(Else))));
148 hasThen(stmt().bind(Then)), hasElse(stmt().bind(Else))));
164 auto StmtMatch = matchStmt(Snippet, ifStmt(hasCondition(stmt().bind("a1")),
165 hasThen(stmt().bind("a2"))));
177 auto StmtMatch = matchStmt(Snippet, expr().bind(Id));
184 auto StmtMatch = matchStmt(Snippet, expr().bind(Id));
315 hasObjectExpression(expr().bind("obj")))))));
336 hasObjectExpression(expr().bind("obj")))))));
tools/clang/unittests/Tooling/TransformerTest.cpp 278 Transformer T(makeRule(declRefExpr(to(functionDecl())).bind(Ref),
341 testRule(makeRule(memberExpr().bind(E), change(member(E), text("good"))),
372 testRule(makeRule(memberExpr().bind(MemExpr),
391 testRule(makeRule(returnStmt().bind(Ret),
412 testRule(makeRule(declStmt().bind(Decl),
431 testRule(makeRule(declStmt().bind(Decl), remove(statement(Decl))), Input,
452 testRule(makeRule(ifStmt(hasCondition(expr().bind(C)),
453 hasThen(stmt().bind(T)), hasElse(stmt().bind(E))),
453 hasThen(stmt().bind(T)), hasElse(stmt().bind(E))),
579 Transformer T(makeRule(binaryOperator().bind(O), change(node(O), AlwaysFail)),
592 Transformer T(makeRule(binaryOperator(hasLHS(expr().bind(L))).bind(O),
607 Transformer T(makeRule(expr().bind(E), change(node(E), text("DELETE_EXPR"))),
725 testRule(makeRule(integerLiteral(), change(text("LIT"))), Input, Expected);
741 testRule(makeRule(binaryOperator(hasLHS(expr().bind(E))),
759 testRule(makeRule(binaryOperator(hasRHS(expr().bind(E))),
797 RewriteRule QualTypeRule = makeRule(qualType(), change(text("Q")));
801 RewriteRule TypeRule = makeRule(arrayType(), change(text("T")));