reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/include/clang/ASTMatchers/ASTMatchers.h
 2508   return stmt(unaryExprOrTypeTraitExpr(
 2508   return stmt(unaryExprOrTypeTraitExpr(
 2517   return stmt(unaryExprOrTypeTraitExpr(
 2517   return stmt(unaryExprOrTypeTraitExpr(
 3251   return callExpr(hasDeclaration(InnerMatcher)).matches(Node, Finder, Builder);
 3302     return qualType(hasDeclaration(InnerMatcher)).matches(QT, Finder, Builder);
 3355   return pointsTo(qualType(hasDeclaration(InnerMatcher)))
 3416   return references(qualType(hasDeclaration(InnerMatcher)))
 4014   unsigned ArgIndex = cxxOperatorCallExpr(callee(cxxMethodDecl()))
 4025       if (expr(anyOf(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
 4025       if (expr(anyOf(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
 4025       if (expr(anyOf(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
 4027                      callExpr(callee(functionDecl(
 4027                      callExpr(callee(functionDecl(
 5275   auto IsInstantiation = decl(anyOf(cxxRecordDecl(isTemplateInstantiation()),
 5275   auto IsInstantiation = decl(anyOf(cxxRecordDecl(isTemplateInstantiation()),
 5276                                     functionDecl(isTemplateInstantiation())));
 5277   return decl(anyOf(IsInstantiation, hasAncestor(IsInstantiation)));
 5295   return stmt(
 5296       hasAncestor(decl(anyOf(cxxRecordDecl(isTemplateInstantiation()),
 5296       hasAncestor(decl(anyOf(cxxRecordDecl(isTemplateInstantiation()),
 5297                              functionDecl(isTemplateInstantiation())))));
tools/clang/lib/Analysis/ExprMutationAnalyzer.cpp
   60       referenceType(pointee(unless(isConstQualified()))));
   60       referenceType(pointee(unless(isConstQualified()))));
   65       pointerType(pointee(unless(isConstQualified()))));
   65       pointerType(pointee(unless(isConstQualified()))));
   69   return cxxRecordDecl(
   70       hasMethod(cxxConstructorDecl(isMoveConstructor(), unless(isDeleted()))),
   71       hasMethod(cxxMethodDecl(isMoveAssignmentOperator(), unless(isDeleted()))),
   72       unless(anyOf(hasMethod(cxxConstructorDecl(isCopyConstructor(),
   74                    hasMethod(cxxMethodDecl(isCopyAssignmentOperator(),
  142       match(findAll(declRefExpr(to(equalsNode(Dec))).bind(NodeID<Expr>::value)),
  157                      expr(equalsNode(Exp),
  162                               hasAncestor(typeLoc(unless(
  164                               hasAncestor(expr(anyOf(
  167                                   unaryExprOrTypeTraitExpr(unless(sizeOfExpr(
  172                                   cxxTypeidExpr(
  176                                   genericSelectionExpr(hasControllingExpr(
  208       binaryOperator(isAssignmentOperator(),
  213       unaryOperator(anyOf(hasOperatorName("++"), hasOperatorName("--")),
  218   const auto NonConstMethod = cxxMethodDecl(unless(isConst()));
  220       expr(anyOf(cxxMemberCallExpr(callee(NonConstMethod),
  220       expr(anyOf(cxxMemberCallExpr(callee(NonConstMethod),
  222                  cxxOperatorCallExpr(callee(NonConstMethod),
  225                  callExpr(callee(expr(anyOf(
  225                  callExpr(callee(expr(anyOf(
  226                      unresolvedMemberExpr(
  228                      cxxDependentScopeMemberExpr(
  236       unaryOperator(hasOperatorName("&"),
  238                     unless(hasParent(implicitCastExpr(hasCastKind(CK_NoOp)))),
  241       castExpr(hasCastKind(CK_ArrayToPointerDecay),
  248       cxxOperatorCallExpr(hasOverloadedOperatorName("->"),
  249                           callee(cxxMethodDecl(ofClass(isMoveOnly()),
  261       parmVarDecl(hasType(nonConstReferenceType())));
  264       callExpr(NonConstRefParam, NotInstantiated),
  265       cxxConstructExpr(NonConstRefParam, NotInstantiated),
  266       callExpr(callee(expr(anyOf(unresolvedLookupExpr(), unresolvedMemberExpr(),
  266       callExpr(callee(expr(anyOf(unresolvedLookupExpr(), unresolvedMemberExpr(),
  270       cxxUnresolvedConstructExpr(hasAnyArgument(maybeEvalCommaExpr(equalsNode(Exp)))));
  276   const auto AsLambdaRefCaptureInit = lambdaExpr(hasCaptureInit(Exp));
  283   const auto AsNonConstRefReturn = returnStmt(hasReturnValue(
  287       match(findAll(stmt(anyOf(AsAssignmentLhs, AsIncDecOperand, AsNonConstThis,
  299       match(findAll(expr(anyOf(memberExpr(hasObjectExpression(equalsNode(Exp))),
  299       match(findAll(expr(anyOf(memberExpr(hasObjectExpression(equalsNode(Exp))),
  300                                cxxDependentScopeMemberExpr(
  310       findAll(arraySubscriptExpr(hasBase(ignoringImpCasts(equalsNode(Exp))))
  319       match(findAll(castExpr(hasSourceExpression(equalsNode(Exp)),
  320                              anyOf(explicitCastExpr(hasDestinationType(
  322                                    implicitCastExpr(hasImplicitDestinationType(
  330       match(findAll(callExpr(callee(namedDecl(
  330       match(findAll(callExpr(callee(namedDecl(
  331                                  hasAnyName("::std::move", "::std::forward"))),
  342       match(findAll(cxxForRangeStmt(
  343                 hasLoopVariable(varDecl(hasType(nonConstReferenceType()))
  355       match(findAll(cxxOperatorCallExpr(
  357                         callee(cxxMethodDecl(ofClass(isMoveOnly()),
  367       stmt(forEachDescendant(
  368           varDecl(
  371                                    conditionalOperator(anyOf(
  377               unless(hasParent(declStmt(hasParent(
  378                   cxxForRangeStmt(hasRangeStmt(equalsBoundNode("stmt"))))))))
  387       parmVarDecl(hasType(nonConstReferenceType())).bind("parm"));
  391       findAll(expr(anyOf(callExpr(NonConstRefParam, IsInstantiated, FuncDecl,
  391       findAll(expr(anyOf(callExpr(NonConstRefParam, IsInstantiated, FuncDecl,
  392                                   unless(callee(namedDecl(hasAnyName(
  392                                   unless(callee(namedDecl(hasAnyName(
  394                          cxxConstructExpr(NonConstRefParam, IsInstantiated,
tools/clang/lib/Analysis/RetainSummaryManager.cpp
  143   DeclarationMatcher SubclassM = cxxRecordDecl(isSameOrDerivedFrom(ClassName));
tools/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp
   57   return callee(functionDecl(hasName(FunctionName)));
   62   return hasArgument(ArgIdx, ignoringParenCasts(declRefExpr(
   63                                  to(varDecl(equalsBoundNode(DeclName))))));
   68                          declRefExpr(to(varDecl().bind(DeclName)))));
   95   auto SemaphoreCreateM = callExpr(allOf(
   97       hasArgument(0, ignoringParenCasts(integerLiteral(equals(0))))));
  101           varDecl(hasDescendant(SemaphoreCreateM)).bind(SemaphoreBinding)),
  102       forEachDescendant(binaryOperator(bindAssignmentToDecl(SemaphoreBinding),
  109   auto ArgCallsSignalM = hasAnyArgument(stmt(hasDescendant(callExpr(
  109   auto ArgCallsSignalM = hasAnyArgument(stmt(hasDescendant(callExpr(
  119       stmt(anyOf(
  120         callExpr(HasBlockAndCallsSignalM),
  121         objcMessageExpr(HasBlockAndCallsSignalM)
  125     callExpr(
  132   return compoundStmt(
  139   auto DispatchGroupCreateM = callExpr(callsName("dispatch_group_create"));
  143           varDecl(hasDescendant(DispatchGroupCreateM)).bind(GroupBinding)),
  144       forEachDescendant(binaryOperator(bindAssignmentToDecl(GroupBinding),
  148       stmt(callExpr(allOf(callsName("dispatch_group_enter"),
  148       stmt(callExpr(allOf(callsName("dispatch_group_enter"),
  155   auto ArgCallsSignalM = hasAnyArgument(stmt(hasDescendant(callExpr(
  155   auto ArgCallsSignalM = hasAnyArgument(stmt(hasDescendant(callExpr(
  165       stmt(anyOf(
  166         callExpr(HasBlockAndCallsLeaveM),
  167         objcMessageExpr(HasBlockAndCallsLeaveM)
  171     callExpr(
  178   return compoundStmt(GroupBindingM, GroupEnterM, AcceptsBlockM, GroupWaitM);
tools/clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
  200       expr(ignoringParenImpCasts(
  201           expr(hasType(
  202               typedefType(hasDeclaration(anyOf(
  203                   typedefDecl(hasName("CFNumberRef")),
  204                   typedefDecl(hasName("CFBooleanRef")))))))
  209       expr(ignoringParenImpCasts(
  210           expr(hasType(hasCanonicalType(
  211               pointerType(pointee(hasCanonicalType(
  211               pointerType(pointee(hasCanonicalType(
  212                   recordType(hasDeclaration(
  214                         cxxRecordDecl(hasName("OSBoolean")),
  215                         cxxRecordDecl(hasName("OSNumber"))
  221       expr(ignoringParenImpCasts(
  222           expr(hasType(hasCanonicalType(
  223               objcObjectPointerType(pointee(
  223               objcObjectPointerType(pointee(
  224                   qualType(hasCanonicalType(
  225                       qualType(hasDeclaration(
  226                           objcInterfaceDecl(hasName("NSNumber")))))))))))
  236       expr(anyOf(
  243       qualType(typedefType(hasDeclaration(
  243       qualType(typedefType(hasDeclaration(
  244                    typedefDecl(hasName("BOOL"))))).bind("objc_bool_type");
  248       qualType(anyOf(qualType(booleanType()).bind("cpp_bool_type"),
  248       qualType(anyOf(qualType(booleanType()).bind("cpp_bool_type"),
  255       qualType(hasCanonicalType(isInteger()),
  256                unless(typedefType(hasDeclaration(
  257                    typedefDecl(matchesName("^::u?intptr_t$"))))))
  261       qualType(anyOf(SuspiciousScalarBooleanTypeM,
  265       expr(ignoringParenImpCasts(expr(hasType(SuspiciousScalarTypeM))));
  265       expr(ignoringParenImpCasts(expr(hasType(SuspiciousScalarTypeM))));
  268       binaryOperator(allOf(hasOperatorName("="),
  273       ifStmt(allOf(
  279       callExpr(hasAnyArgument(allOf(hasType(SuspiciousScalarTypeM),
  287       binaryOperator(allOf(anyOf(hasOperatorName("=="), hasOperatorName("!=")),
  294       binaryOperator(allOf(anyOf(hasOperatorName(">="), hasOperatorName(">"),
  301       conditionalOperator(allOf(
  310       unaryOperator(allOf(hasOperatorName("!"),
  311                           has(expr(SuspiciousNumberObjectExprM))))
  315       explicitCastExpr(allOf(hasType(SuspiciousScalarBooleanTypeM),
  316                              has(expr(SuspiciousNumberObjectExprM))));
  319       explicitCastExpr(allOf(hasType(SuspiciousScalarNumberTypeM),
  320                              has(expr(SuspiciousNumberObjectExprM))));
  323       declStmt(hasSingleDecl(
  324           varDecl(hasType(SuspiciousScalarTypeM),
  327   auto FinalM = stmt(anyOf(ConversionThroughAssignmentM,
  341   F.addMatcher(stmt(forEachDescendant(FinalM)), &CB);
tools/clang/lib/StaticAnalyzer/Checkers/OSObjectCStyleCast.cpp
   60   return hasType(pointerType(pointee(hasDeclaration(DeclM))));
   60   return hasType(pointerType(pointee(hasDeclaration(DeclM))));
   68   auto DynamicCastM = callExpr(callee(functionDecl(hasName("safeMetaCast"))));
   68   auto DynamicCastM = callExpr(callee(functionDecl(hasName("safeMetaCast"))));
   70   auto OSObjTypeM = hasTypePointingTo(cxxRecordDecl(isDerivedFrom("OSMetaClassBase")));
   72     cxxRecordDecl(isDerivedFrom("OSObject")));
   74   auto CastM = cStyleCastExpr(
   78   auto Matches = match(stmt(forEachDescendant(CastM)), *D->getBody(), AM.getASTContext());
tools/clang/lib/StaticAnalyzer/Checkers/ObjCAutoreleaseWriteChecker.cpp
  105   return callee(functionDecl(hasAnyName(toRefs(FunctionNames))));
  154       parmVarDecl(hasType(hasCanonicalType(pointerType(
  154       parmVarDecl(hasType(hasCanonicalType(pointerType(
  155                       pointee(hasCanonicalType(objcObjectPointerType()))))))
  159       declRefExpr(to(parmVarDecl(DoublePointerParamM))).bind(CapturedBind);
  159       declRefExpr(to(parmVarDecl(DoublePointerParamM))).bind(CapturedBind);
  162   auto WritesIntoM = binaryOperator(
  163     hasLHS(unaryOperator(
  173   auto CapturedInParamM = stmt(anyOf(
  174       callExpr(ArgumentCaptureM),
  175       objcMessageExpr(ArgumentCaptureM)));
  181         stmt(anyOf(WritesIntoM, CapturedInParamM))
  184   auto BlockPassedToMarkedFuncM = stmt(anyOf(
  185     callExpr(allOf(
  187     objcMessageExpr(allOf(
  196   auto MatcherM = decl(anyOf(
  197       objcMethodDecl(HasParamAndWritesInMarkedFuncM).bind(IsMethodBind),
  198       functionDecl(HasParamAndWritesInMarkedFuncM),
  199       blockDecl(HasParamAndWritesInMarkedFuncM)));
tools/clang/lib/StaticAnalyzer/Checkers/PointerIterationChecker.cpp
   68   auto UnorderedContainerM = declRefExpr(to(varDecl(hasType(
   68   auto UnorderedContainerM = declRefExpr(to(varDecl(hasType(
   69                                recordDecl(hasName("std::unordered_set")
   72   auto PointerTypeM = varDecl(hasType(hasCanonicalType(pointerType())));
   74   auto PointerIterM = stmt(cxxForRangeStmt(
   74   auto PointerIterM = stmt(cxxForRangeStmt(
   79   return decl(forEachDescendant(PointerIterM));
tools/clang/lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp
   58   return callee(functionDecl(hasName(FunctionName)));
   83                                 hasType(cxxRecordDecl(has(
   84                                   fieldDecl(hasType(hasCanonicalType(
   89   auto PointerSortM = stmt(callExpr(allOf(SortFuncM, IteratesPointerEltsM))
   89   auto PointerSortM = stmt(callExpr(allOf(SortFuncM, IteratesPointerEltsM))
   92   return decl(forEachDescendant(PointerSortM));
tools/clang/lib/StaticAnalyzer/Checkers/RunLoopAutoreleaseLeakChecker.cpp
  133       objcMessageExpr(hasSelector("mainRunLoop"),
  138   StatementMatcher MainRunLoopRunM = objcMessageExpr(hasSelector("run"),
  143       callExpr(callee(functionDecl(hasName("xpc_main")))).bind(RunLoopRunBind);
  143       callExpr(callee(functionDecl(hasName("xpc_main")))).bind(RunLoopRunBind);
  148   return objcMessageExpr(unless(anyOf(equalsBoundNode(RunLoopBind),
  162       autoreleasePoolStmt(
  166   DeclarationMatcher GroupM = decl(hasDescendant(RunLoopInAutorelease));
  182   DeclarationMatcher GroupM = functionDecl(
tools/clang/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
  541   auto FieldAccessM = memberExpr(hasDeclaration(equalsNode(FD))).bind("access");
  543   auto AssertLikeM = callExpr(callee(functionDecl(
  543   auto AssertLikeM = callExpr(callee(functionDecl(
  553   auto NoReturnFuncM = callExpr(callee(functionDecl(isNoReturn())));
  553   auto NoReturnFuncM = callExpr(callee(functionDecl(isNoReturn())));
  556       stmt(anyOf(ifStmt(), switchStmt(), conditionalOperator(), AssertLikeM,
  565     auto Accesses = match(stmt(hasDescendant(FieldAccessM)), *MethodBody, AC);
  571     auto Guards = match(stmt(hasDescendant(GuardM)), *MethodBody, AC);
tools/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
  442   StatementMatcher WriteIntoIvarM = binaryOperator(
  445           objcIvarRefExpr(hasDeclaration(equalsNode(Ivar))).bind(IvarBind))));
  446   StatementMatcher ParentM = stmt(hasDescendant(WriteIntoIvarM));
tools/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
   83   return binaryOperator(anyOf(hasOperatorName("<"), hasOperatorName(">"),
   86                         hasEitherOperand(ignoringParenImpCasts(declRefExpr(
   87                             to(varDecl(hasType(isInteger())).bind(BindName))))),
   96       unaryOperator(anyOf(hasOperatorName("--"), hasOperatorName("++")),
   98                         declRefExpr(to(varDecl(VarNodeMatcher)))))),
   98                         declRefExpr(to(varDecl(VarNodeMatcher)))))),
   99       binaryOperator(isAssignmentOperator(),
  101                          declRefExpr(to(varDecl(VarNodeMatcher)))))));
  101                          declRefExpr(to(varDecl(VarNodeMatcher)))))));
  106   return callExpr(forEachArgumentWithParam(
  107       declRefExpr(to(varDecl(VarNodeMatcher))),
  107       declRefExpr(to(varDecl(VarNodeMatcher))),
  108       parmVarDecl(hasType(references(qualType(unless(isConstQualified())))))));
  108       parmVarDecl(hasType(references(qualType(unless(isConstQualified())))))));
  113   return declStmt(hasDescendant(varDecl(
  113   return declStmt(hasDescendant(varDecl(
  116                 initListExpr(has(declRefExpr(to(varDecl(VarNodeMatcher))))),
  116                 initListExpr(has(declRefExpr(to(varDecl(VarNodeMatcher))))),
  116                 initListExpr(has(declRefExpr(to(varDecl(VarNodeMatcher))))),
  117                 declRefExpr(to(varDecl(VarNodeMatcher)))))))));
  117                 declRefExpr(to(varDecl(VarNodeMatcher)))))))));
  122   return unaryOperator(
  124       hasUnaryOperand(declRefExpr(hasDeclaration(VarNodeMatcher))));
  128   return hasDescendant(stmt(
  140   return forStmt(
  144                  anyOf(declStmt(hasSingleDecl(
  145                            varDecl(allOf(hasInitializer(ignoringParenImpCasts(
  148                        binaryOperator(hasLHS(declRefExpr(to(varDecl(
  148                        binaryOperator(hasLHS(declRefExpr(to(varDecl(
  148                        binaryOperator(hasLHS(declRefExpr(to(varDecl(
  154              hasIncrement(unaryOperator(
  156                  hasUnaryOperand(declRefExpr(
  157                      to(varDecl(allOf(equalsBoundNode("initVarName"),
  188         match(stmt(anyOf(callByRef(equalsNode(VD)), getAddrTo(equalsNode(VD)),
tools/clang/lib/StaticAnalyzer/Core/LoopWidening.cpp
   70   auto Matches = match(findAll(stmt(hasDescendant(varDecl(hasType(referenceType())).bind(MatchRef)))),
   70   auto Matches = match(findAll(stmt(hasDescendant(varDecl(hasType(referenceType())).bind(MatchRef)))),
tools/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
 1092         StatementMatcher RefToStatic = stmt(hasDescendant(declRefExpr(
 1092         StatementMatcher RefToStatic = stmt(hasDescendant(declRefExpr(
 1093               to(varDecl(hasStaticStorageDuration()).bind(DeclBind)))));
tools/clang/tools/extra/clang-change-namespace/ChangeNamespace.cpp
  388       allOf(hasAncestor(namespaceDecl(hasName(FullOldNs)).bind("ns_decl")),
  391       IsInMovedNs, unless(hasAncestor(namespaceDecl(hasName(Prefix)))));
  394       usingDecl(isExpansionInFileMatching(FilePattern), IsVisibleInNewNs)
  398   Finder->addMatcher(usingDirectiveDecl(isExpansionInFileMatching(FilePattern),
  403   Finder->addMatcher(namespaceAliasDecl(isExpansionInFileMatching(FilePattern),
  410       namespaceDecl(hasName(FullOldNs), isExpansionInFileMatching(FilePattern))
  416   Finder->addMatcher(cxxRecordDecl(unless(anyOf(isImplicit(), isDefinition())),
  423       classTemplateDecl(unless(hasDescendant(cxxRecordDecl(isDefinition()))),
  423       classTemplateDecl(unless(hasDescendant(cxxRecordDecl(isDefinition()))),
  431   auto DeclMatcher = namedDecl(
  434           isImplicit(), hasAncestor(namespaceDecl(isAnonymous())),
  436           allOf(IsInMovedNs, unless(cxxRecordDecl(unless(isDefinition())))))));
  442       usingDecl(hasAnyUsingShadowDecl(decl()), hasParent(cxxRecordDecl()));
  449       typeLoc(IsInMovedNs,
  450               loc(qualType(hasDeclaration(DeclMatcher.bind("from_decl")))),
  451               unless(anyOf(hasParent(typeLoc(loc(qualType(
  451               unless(anyOf(hasParent(typeLoc(loc(qualType(
  457                            hasAncestor(functionDecl(isDefaulted())))),
  466   Finder->addMatcher(usingDecl(IsInMovedNs, hasAnyUsingShadowDecl(decl()),
  475       nestedNameSpecifierLoc(
  476           hasAncestor(decl(IsInMovedNs).bind("dc")),
  477           loc(nestedNameSpecifier(
  481                        hasAncestor(functionDecl(isDefaulted())),
  482                        hasAncestor(typeLoc(loc(qualType(hasDeclaration(
  482                        hasAncestor(typeLoc(loc(qualType(hasDeclaration(
  483                            decl(equalsBoundNode("from_decl"))))))))))
  494       cxxCtorInitializer(isBaseInitializer()).bind("base_initializer"), this);
  503       functionDecl(unless(anyOf(cxxMethodDecl(), IsInMovedNs,
  504                                 hasAncestor(namespaceDecl(isAnonymous())),
  507   Finder->addMatcher(expr(hasAncestor(decl().bind("dc")), IsInMovedNs,
  509                           anyOf(callExpr(callee(FuncMatcher)).bind("call"),
  510                                 declRefExpr(to(FuncMatcher.bind("func_decl")))
  514   auto GlobalVarMatcher = varDecl(
  516       unless(anyOf(IsInMovedNs, hasAncestor(namespaceDecl(isAnonymous())))));
  517   Finder->addMatcher(declRefExpr(IsInMovedNs, hasAncestor(decl().bind("dc")),
  523   auto UnscopedEnumMatcher = enumConstantDecl(hasParent(enumDecl(
  523   auto UnscopedEnumMatcher = enumConstantDecl(hasParent(enumDecl(
  526                    hasAncestor(namespaceDecl(isAnonymous())))))));
  528       declRefExpr(IsInMovedNs, hasAncestor(decl().bind("dc")),
tools/clang/tools/extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp
  119       decl(anyOf(cxxRecordDecl(isExplicitTemplateSpecialization()),
  119       decl(anyOf(cxxRecordDecl(isExplicitTemplateSpecialization()),
  120                  functionDecl(isExplicitTemplateSpecialization()))));
  155   auto Vars = varDecl(CommonFilter, anyOf(ExternCMatcher, CCMatcher),
  159   auto CRecords = recordDecl(CommonFilter, ExternCMatcher, isDefinition());
  161   auto CXXRecords = cxxRecordDecl(CommonFilter, CCMatcher, isDefinition());
  167   auto Functions = functionDecl(CommonFilter, unless(hasParent(friendDecl())),
  182       typedefNameDecl(CommonFilter, anyOf(HasNSOrTUCtxMatcher,
  186   auto Enums = enumDecl(CommonFilter, isDefinition(),
  192   auto EnumConstants = enumConstantDecl(
  194       anyOf(hasDeclContext(enumDecl(HasNSOrTUCtxMatcher)), ExternCMatcher));
  197   auto Types = namedDecl(anyOf(CRecords, CXXRecords, Enums));
  198   auto Decls = namedDecl(anyOf(CRecords, CXXRecords, Enums, Typedefs, Vars,
  207       declRefExpr(isExpansionInMainFile(), to(Decls.bind("use"))), this);
  210       declRefExpr(isExpansionInMainFile(),
  211                   to(functionDecl(hasParent(
  212                       functionTemplateDecl(has(Functions.bind("use"))))))),
  217       typeLoc(isExpansionInMainFile(),
  218               loc(qualType(hasDeclaration(Types.bind("use"))))),
  223       typeLoc(isExpansionInMainFile(),
  224               loc(typedefType(hasDeclaration(Typedefs.bind("use"))))),
  230       typeLoc(isExpansionInMainFile(),
  231               loc(templateSpecializationType(hasDeclaration(
  232                   classTemplateSpecializationDecl(hasSpecializedTemplate(
  233                       classTemplateDecl(has(CXXRecords.bind("use"))))))))),
tools/clang/tools/extra/clang-move/Move.cpp
  505       classTemplateDecl(unless(has(cxxRecordDecl(isDefinition()))));
  505       classTemplateDecl(unless(has(cxxRecordDecl(isDefinition()))));
  506   auto ForwardClassDecls = namedDecl(
  507       anyOf(cxxRecordDecl(unless(anyOf(isImplicit(), isDefinition()))),
  520   auto AllDeclsInHeader = namedDecl(
  525       hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))),
  526       hasDeclContext(decl(anyOf(namespaceDecl(), translationUnitDecl()))));
  534   Finder->addMatcher(namedDecl(ForwardClassDecls, InOldHeader).bind("fwd_decl"),
  541       hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))), InOldCC);
  545   Finder->addMatcher(namedDecl(anyOf(usingDecl(IsOldCCTopLevelDecl),
  545   Finder->addMatcher(namedDecl(anyOf(usingDecl(IsOldCCTopLevelDecl),
  546                                      usingDirectiveDecl(unless(isImplicit()),
  548                                      typeAliasDecl(IsOldCCTopLevelDecl)),
  568       hasOutermostEnclosingClass(cxxRecordDecl(*HasAnySymbolNames));
  571   auto InAnonymousNS = hasParent(namespaceDecl(isAnonymous()));
  584       namedDecl(notInMacro(), anyOf(functionDecl(IsOldCCHelper),
  584       namedDecl(notInMacro(), anyOf(functionDecl(IsOldCCHelper),
  585                                     varDecl(isDefinition(), IsOldCCHelper)));
  587       cxxRecordDecl(notInMacro(), NotInMovedClass, InAnonymousNS);
  590       namedDecl(anyOf(HelperFuncOrVar, HelperClasses)).bind("helper_decls"),
  600       declRefExpr(to(HelperFuncOrVar), hasAncestor(decl().bind("dc")))
  605       typeLoc(loc(recordType(hasDeclaration(HelperClasses.bind("used_class")))),
  605       typeLoc(loc(recordType(hasDeclaration(HelperClasses.bind("used_class")))),
  615   auto MovedClass = cxxRecordDecl(InOldFiles, *HasAnySymbolNames,
  622       cxxMethodDecl(InOldFiles, ofOutermostEnclosingClass(*HasAnySymbolNames),
  628       varDecl(InMovedClass, InOldFiles, isDefinition(), isStaticDataMember())
  633   Finder->addMatcher(functionDecl(InOldFiles, *HasAnySymbolNames, TopLevelDecl)
  639       varDecl(InOldFiles, *HasAnySymbolNames, TopLevelDecl).bind("var"),
  646       enumDecl(InOldHeader, *HasAnySymbolNames, isDefinition(), TopLevelDecl)
  654   Finder->addMatcher(namedDecl(anyOf(typedefDecl().bind("typedef"),
tools/clang/tools/extra/clang-reorder-fields/ReorderFieldsAction.cpp
   39       match(recordDecl(hasName(RecordName), isDefinition()).bind("recordDecl"),
  108       match(findAll(memberExpr(hasObjectExpression(cxxThisExpr())).bind("ME")),
  292            match(initListExpr(hasType(equalsNode(RD))).bind("initListExpr"),
tools/clang/tools/extra/clang-tidy/abseil/DurationAdditionCheck.cpp
   23       binaryOperator(hasOperatorName("+"),
   24                      hasEitherOperand(expr(ignoringParenImpCasts(
   25                          callExpr(callee(functionDecl(TimeConversionFunction())
   25                          callExpr(callee(functionDecl(TimeConversionFunction())
tools/clang/tools/extra/clang-tidy/abseil/DurationComparisonCheck.cpp
   22   auto Matcher = expr(comparisonOperatorWithCallee(functionDecl(
   22   auto Matcher = expr(comparisonOperatorWithCallee(functionDecl(
   23                           functionDecl(DurationConversionFunction())
tools/clang/tools/extra/clang-tidy/abseil/DurationConversionCastCheck.cpp
   22   auto CallMatcher = ignoringImpCasts(callExpr(
   23       callee(functionDecl(DurationConversionFunction()).bind("func_decl")),
   27       expr(anyOf(
   28           cxxStaticCastExpr(hasSourceExpression(CallMatcher)).bind("cast_expr"),
   29           cStyleCastExpr(hasSourceExpression(CallMatcher)).bind("cast_expr"),
   30           cxxFunctionalCastExpr(hasSourceExpression(CallMatcher))
tools/clang/tools/extra/clang-tidy/abseil/DurationDivisionCheck.cpp
   24       expr(hasType(cxxRecordDecl(hasName("::absl::Duration"))));
   24       expr(hasType(cxxRecordDecl(hasName("::absl::Duration"))));
   26       implicitCastExpr(
   28               cxxOperatorCallExpr(hasOverloadedOperatorName("/"),
   32           hasImplicitDestinationType(qualType(unless(isInteger()))),
tools/clang/tools/extra/clang-tidy/abseil/DurationFactoryFloatCheck.cpp
   32       callExpr(callee(functionDecl(DurationFactoryFunction())),
   32       callExpr(callee(functionDecl(DurationFactoryFunction())),
   33                hasArgument(0, anyOf(cxxStaticCastExpr(hasDestinationType(
   35                                     cStyleCastExpr(hasDestinationType(
   37                                     cxxFunctionalCastExpr(hasDestinationType(
tools/clang/tools/extra/clang-tidy/abseil/DurationFactoryScaleCheck.cpp
  120       callExpr(
  121           callee(functionDecl(DurationFactoryFunction()).bind("call_decl")),
  125                   cxxFunctionalCastExpr(
  129                   integerLiteral(equals(0)), floatLiteral(equals(0.0)),
  129                   integerLiteral(equals(0)), floatLiteral(equals(0.0)),
  130                   binaryOperator(hasOperatorName("*"),
  134                   binaryOperator(hasOperatorName("/"), hasRHS(floatLiteral()))
tools/clang/tools/extra/clang-tidy/abseil/DurationRewriter.cpp
   77           match(callExpr(callee(functionDecl(hasAnyName(
   77           match(callExpr(callee(functionDecl(hasAnyName(
   77           match(callExpr(callee(functionDecl(hasAnyName(
   94           "e", match(callExpr(callee(functionDecl(hasName(InverseFunction))),
   94           "e", match(callExpr(callee(functionDecl(hasName(InverseFunction))),
  162       anyOf(integerLiteral(equals(0)), floatLiteral(equals(0.0)));
  162       anyOf(integerLiteral(equals(0)), floatLiteral(equals(0.0)));
  166           "val", match(expr(ignoringImpCasts(ZeroMatcher)).bind("val"), Node,
  173           "val", match(cxxFunctionalCastExpr(
  176                            hasSourceExpression(initListExpr(
  190           match(expr(anyOf(cxxStaticCastExpr(
  190           match(expr(anyOf(cxxStaticCastExpr(
  193                            cStyleCastExpr(
  196                            cxxFunctionalCastExpr(
tools/clang/tools/extra/clang-tidy/abseil/DurationRewriter.h
  102   return functionDecl(
  103       hasAnyName("::absl::ToDoubleHours", "::absl::ToDoubleMinutes",
  114   return functionDecl(hasAnyName("::absl::Nanoseconds", "::absl::Microseconds",
  114   return functionDecl(hasAnyName("::absl::Nanoseconds", "::absl::Microseconds",
  122   return functionDecl(hasAnyName(
  122   return functionDecl(hasAnyName(
  131   return binaryOperator(
  134       hasEitherOperand(ignoringImpCasts(callExpr(callee(funcDecl)))));
tools/clang/tools/extra/clang-tidy/abseil/DurationSubtractionCheck.cpp
   23       binaryOperator(
   25           hasLHS(callExpr(callee(functionDecl(DurationConversionFunction())
   25           hasLHS(callExpr(callee(functionDecl(DurationConversionFunction())
tools/clang/tools/extra/clang-tidy/abseil/DurationUnnecessaryConversionCheck.cpp
   34         callExpr(callee(functionDecl(hasName(DurationFactory))),
   34         callExpr(callee(functionDecl(hasName(DurationFactory))),
   35                  hasArgument(0, ignoringImpCasts(integerLiteral(equals(1))))));
   39     auto inverse_function_matcher = callExpr(
   40         callee(functionDecl(hasAnyName(FloatConversion, IntegerConversion))),
   40         callee(functionDecl(hasAnyName(FloatConversion, IntegerConversion))),
   45     auto division_operator_matcher = cxxOperatorCallExpr(
   51     auto fdiv_matcher = callExpr(
   52         callee(functionDecl(hasName("::absl::FDivDuration"))),
   56         callExpr(callee(functionDecl(hasName(DurationFactory))),
   56         callExpr(callee(functionDecl(hasName(DurationFactory))),
tools/clang/tools/extra/clang-tidy/abseil/FasterStrsplitDelimiterCheck.cpp
   65       expr(ignoringParenCasts(stringLiteral(lengthIsOne()).bind("Literal")));
   65       expr(ignoringParenCasts(stringLiteral(lengthIsOne()).bind("Literal")));
   70       cxxConstructExpr(hasType(recordDecl(hasName("::absl::string_view"))),
   70       cxxConstructExpr(hasType(recordDecl(hasName("::absl::string_view"))),
   76       expr(has(ignoringElidableConstructorCall(
   77                ignoringParenCasts(cxxBindTemporaryExpr(has(cxxConstructExpr(
   77                ignoringParenCasts(cxxBindTemporaryExpr(has(cxxConstructExpr(
   78                    hasType(recordDecl(hasName("::absl::ByAnyChar"))),
   84   Finder->addMatcher(callExpr(callee(functionDecl(hasName("::absl::StrSplit"))),
   84   Finder->addMatcher(callExpr(callee(functionDecl(hasName("::absl::StrSplit"))),
   94       callExpr(
   95           callee(functionDecl(hasName("::absl::MaxSplits"))),
tools/clang/tools/extra/clang-tidy/abseil/NoInternalDependenciesCheck.cpp
   28       nestedNameSpecifierLoc(loc(specifiesNamespace(namespaceDecl(
   28       nestedNameSpecifierLoc(loc(specifiesNamespace(namespaceDecl(
   30                                  hasParent(namespaceDecl(hasName("absl")))))),
tools/clang/tools/extra/clang-tidy/abseil/NoNamespaceCheck.cpp
   25       namespaceDecl(hasName("::absl"), unless(isInAbseilFile()))
tools/clang/tools/extra/clang-tidy/abseil/RedundantStrcatCallsCheck.cpp
   31       callExpr(callee(functionDecl(hasName("::absl::StrCat"))));
   31       callExpr(callee(functionDecl(hasName("::absl::StrCat"))));
   33       callExpr(callee(functionDecl(hasName("::absl::StrAppend"))));
   33       callExpr(callee(functionDecl(hasName("::absl::StrAppend"))));
   36   const auto CallToEither = callExpr(
   37       callee(functionDecl(hasAnyName("::absl::StrCat", "::absl::StrAppend"))));
   37       callee(functionDecl(hasAnyName("::absl::StrCat", "::absl::StrAppend"))));
   39       callExpr(CallToStrcat, unless(hasAncestor(CallToEither))).bind("StrCat"),
   65   const auto IsAlphanum = hasDeclaration(cxxMethodDecl(hasName("AlphaNum")));
   67   const auto IsStrcat = cxxBindTemporaryExpr(
   68       has(callExpr(callee(functionDecl(*Strcat))).bind("StrCat")));
   68       has(callExpr(callee(functionDecl(*Strcat))).bind("StrCat")));
   71           match(stmt(anyOf(
   72                     cxxConstructExpr(IsAlphanum, hasArgument(0, IsStrcat)),
tools/clang/tools/extra/clang-tidy/abseil/StrCatAppendCheck.cpp
   47   const auto StrCat = functionDecl(hasName("::absl::StrCat"));
   50   const auto AlphaNum = IgnoringTemporaries(cxxConstructExpr(
   51       argumentCountIs(1), hasType(cxxRecordDecl(hasName("::absl::AlphaNum"))),
   52       hasArgument(0, ignoringImpCasts(declRefExpr(to(equalsBoundNode("LHS")),
   56       callExpr(hasAnyArgument(expr(hasDescendant(declRefExpr(
   56       callExpr(hasAnyArgument(expr(hasDescendant(declRefExpr(
   56       callExpr(hasAnyArgument(expr(hasDescendant(declRefExpr(
   63       cxxOperatorCallExpr(
   65           hasArgument(0, declRefExpr(to(decl().bind("LHS")))),
   67                              callExpr(callee(StrCat), hasArgument(0, AlphaNum),
tools/clang/tools/extra/clang-tidy/abseil/StringFindStartswithCheck.cpp
   35   auto ZeroLiteral = integerLiteral(equals(0));
   36   auto StringClassMatcher = cxxRecordDecl(hasAnyName(SmallVector<StringRef, 4>(
   39       recordType(hasDeclaration(StringClassMatcher)));
   41   auto StringFind = cxxMemberCallExpr(
   43       callee(cxxMethodDecl(hasName("find"))),
   52       binaryOperator(
tools/clang/tools/extra/clang-tidy/abseil/TimeComparisonCheck.cpp
   24       expr(comparisonOperatorWithCallee(functionDecl(
   24       expr(comparisonOperatorWithCallee(functionDecl(
   25                functionDecl(TimeConversionFunction()).bind("function_decl"))))
tools/clang/tools/extra/clang-tidy/abseil/TimeSubtractionCheck.cpp
   38              match(expr(anyOf(
   39                        callExpr(hasParent(materializeTemporaryExpr(hasParent(
   39                        callExpr(hasParent(materializeTemporaryExpr(hasParent(
   40                                     cxxConstructExpr(hasParent(exprWithCleanups(
   40                                     cxxConstructExpr(hasParent(exprWithCleanups(
   43                        callExpr(hasParent(varDecl())).bind("e"))),
   54                  expr(anyOf(
   55                      expr(hasParent(materializeTemporaryExpr(
   55                      expr(hasParent(materializeTemporaryExpr(
   56                               hasParent(cxxConstructExpr(
   60                      expr(hasParent(callExpr()),
   71              match(expr(anyOf(
   72                        expr(hasParent(materializeTemporaryExpr(hasParent(
   72                        expr(hasParent(materializeTemporaryExpr(hasParent(
   73                                 cxxConstructExpr(hasParent(exprWithCleanups(
   73                                 cxxConstructExpr(hasParent(exprWithCleanups(
   76                        expr(hasParent(returnStmt())).bind("e"))),
  101     auto TimeInverseMatcher = callExpr(callee(
  102         functionDecl(hasName((llvm::Twine("::absl::") + TimeInverse).str()))
  111         callExpr(
  112             callee(functionDecl(hasName(getDurationFactoryForScale(*Scale)))),
  113             hasArgument(0, binaryOperator(hasOperatorName("-"),
  123         binaryOperator(hasOperatorName("-"), hasRHS(TimeInverseMatcher))
  162         "arg", match(expr(hasAncestor(
  163                          callExpr(callee(functionDecl(hasName(
  163                          callExpr(callee(functionDecl(hasName(
tools/clang/tools/extra/clang-tidy/abseil/UpgradeDurationConversionsCheck.cpp
   35       cxxOperatorCallExpr(
   38               0, expr(hasType(cxxRecordDecl(hasName("::absl::Duration"))))),
   38               0, expr(hasType(cxxRecordDecl(hasName("::absl::Duration"))))),
   40           callee(functionDecl(
   43               hasAnyName("operator*=", "operator/="))))
   50       cxxMemberCallExpr(
   51           callee(cxxMethodDecl(
   52               ofClass(cxxRecordDecl(hasName("::absl::Duration"))),
   55               hasAnyName("operator*=", "operator/="))),
   64       callExpr(callee(functionDecl(
   64       callExpr(callee(functionDecl(
   67                    hasAnyName("::absl::operator*", "::absl::operator/"))),
   69                hasArgument(0, expr(hasType(
   70                                   cxxRecordDecl(hasName("::absl::Duration"))))),
   78       callExpr(callee(functionDecl(
   78       callExpr(callee(functionDecl(
   83                hasArgument(1, expr(hasType(
   84                                   cxxRecordDecl(hasName("::absl::Duration"))))))
  105       implicitCastExpr(
  107                 has(implicitCastExpr(hasCastKind(CK_UserDefinedConversion)))),
  108           hasParent(callExpr(
  109               callee(functionDecl(DurationFactoryFunction(),
  143       hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
tools/clang/tools/extra/clang-tidy/android/CloexecAccept4Check.cpp
   22       hasType(pointsTo(recordDecl(isStruct(), hasName("sockaddr"))));
   23   auto SockLenPointerType = hasType(pointsTo(namedDecl(hasName("socklen_t"))));
   26                        functionDecl(returns(isInteger()), hasName("accept4"),
tools/clang/tools/extra/clang-tidy/android/CloexecAcceptCheck.cpp
   21       hasType(pointsTo(recordDecl(isStruct(), hasName("sockaddr"))));
   22   auto SockLenPointerType = hasType(pointsTo(namedDecl(hasName("socklen_t"))));
   25                        functionDecl(returns(isInteger()), hasName("accept"),
tools/clang/tools/extra/clang-tidy/android/CloexecCheck.cpp
   47       callExpr(
   48           callee(functionDecl(isExternC(), Function).bind(FuncDeclBindingStr)))
tools/clang/tools/extra/clang-tidy/android/CloexecCreatCheck.cpp
   20   auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
   20   auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
   21   auto MODETType = hasType(namedDecl(hasName("mode_t")));
   23                        functionDecl(isExternC(), returns(isInteger()),
tools/clang/tools/extra/clang-tidy/android/CloexecDupCheck.cpp
   21                        functionDecl(returns(isInteger()), hasName("dup"),
tools/clang/tools/extra/clang-tidy/android/CloexecEpollCreate1Check.cpp
   22       Finder, functionDecl(returns(isInteger()), hasName("epoll_create1"),
tools/clang/tools/extra/clang-tidy/android/CloexecEpollCreateCheck.cpp
   21       Finder, functionDecl(returns(isInteger()), hasName("epoll_create"),
tools/clang/tools/extra/clang-tidy/android/CloexecFopenCheck.cpp
   22   auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
   22   auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
   24                        functionDecl(isExternC(), returns(asString("FILE *")),
tools/clang/tools/extra/clang-tidy/android/CloexecInotifyInit1Check.cpp
   22       Finder, functionDecl(returns(isInteger()), hasName("inotify_init1"),
tools/clang/tools/extra/clang-tidy/android/CloexecInotifyInitCheck.cpp
   21       Finder, functionDecl(returns(isInteger()), hasName("inotify_init")));
tools/clang/tools/extra/clang-tidy/android/CloexecMemfdCreateCheck.cpp
   18   auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
   18   auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
   20       Finder, functionDecl(returns(isInteger()), hasName("memfd_create"),
tools/clang/tools/extra/clang-tidy/android/CloexecOpenCheck.cpp
   20   auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
   20   auto CharPointerType = hasType(pointerType(pointee(isAnyCharacter())));
   22                        functionDecl(isExternC(), returns(isInteger()),
   23                                     hasAnyName("open", "open64"),
   27                        functionDecl(isExternC(), returns(isInteger()),
tools/clang/tools/extra/clang-tidy/android/CloexecPipe2Check.cpp
   22                        functionDecl(returns(isInteger()), hasName("pipe2"),
tools/clang/tools/extra/clang-tidy/android/CloexecPipeCheck.cpp
   21                        functionDecl(returns(isInteger()), hasName("pipe"),
tools/clang/tools/extra/clang-tidy/android/CloexecSocketCheck.cpp
   21                        functionDecl(isExternC(), returns(isInteger()),
tools/clang/tools/extra/clang-tidy/android/ComparisonInTempFailureRetryCheck.cpp
   64       binaryOperator(
   67               binaryOperator(matchers::isComparisonOperator()).bind("binop"))),
tools/clang/tools/extra/clang-tidy/boost/UseToStringCheck.cpp
   29       callExpr(
   30           hasDeclaration(functionDecl(
   31               returns(hasDeclaration(classTemplateSpecializationDecl(
   36               hasParameter(0, hasType(qualType(has(substTemplateTypeParmType(
   36               hasParameter(0, hasType(qualType(has(substTemplateTypeParmType(
tools/clang/tools/extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
   52       callExpr(unless(cxxOperatorCallExpr()),
   56                unless(hasDeclaration(functionDecl(
   57                    hasAnyName("NewCallback", "NewPermanentCallback")))))
tools/clang/tools/extra/clang-tidy/bugprone/AssertSideEffectCheck.cpp
   87       hasDescendant(expr(hasSideEffect(CheckFunctionCalls)));
   90       stmt(
   91           anyOf(conditionalOperator(ConditionWithSideEffect),
   92                 ifStmt(ConditionWithSideEffect),
   93                 unaryOperator(hasOperatorName("!"),
   94                               hasUnaryOperand(unaryOperator(
tools/clang/tools/extra/clang-tidy/bugprone/BoolPointerImplicitConversionCheck.cpp
   21       ifStmt(hasCondition(findAll(implicitCastExpr(
   21       ifStmt(hasCondition(findAll(implicitCastExpr(
   22                  unless(hasParent(unaryOperator(hasOperatorName("!")))),
   24                      expr(hasType(pointerType(pointee(booleanType()))),
   24                      expr(hasType(pointerType(pointee(booleanType()))),
   24                      expr(hasType(pointerType(pointee(booleanType()))),
   47   auto DeclRef = ignoringParenImpCasts(declRefExpr(to(equalsNode(D))));
   49                  unaryOperator(hasOperatorName("*"), hasUnaryOperand(DeclRef))),
   52       !match(findAll(arraySubscriptExpr(hasBase(DeclRef))), *If,
   57       !match(findAll(callExpr(hasAnyArgument(ignoringParenImpCasts(DeclRef)))),
   60       !match(findAll(cxxDeleteExpr(has(ignoringParenImpCasts(expr(DeclRef))))),
   60       !match(findAll(cxxDeleteExpr(has(ignoringParenImpCasts(expr(DeclRef))))),
tools/clang/tools/extra/clang-tidy/bugprone/BranchCloneCheck.cpp
   62       ifStmt(stmt().bind("if"),
   63              hasParent(stmt(unless(ifStmt(hasElse(equalsBoundNode("if")))))),
   63              hasParent(stmt(unless(ifStmt(hasElse(equalsBoundNode("if")))))),
tools/clang/tools/extra/clang-tidy/bugprone/CopyConstructorInitCheck.cpp
   26       cxxConstructorDecl(
   28           hasAnyConstructorInitializer(cxxCtorInitializer(
   30               withInitializer(cxxConstructExpr(hasDeclaration(
   31                   cxxConstructorDecl(isDefaultConstructor())))))),
tools/clang/tools/extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
   27   return expr(
   28       anyOf(cxxConstructExpr(hasDeclaration(cxxMethodDecl(ofClass(IsAHandle))),
   28       anyOf(cxxConstructExpr(hasDeclaration(cxxMethodDecl(ofClass(IsAHandle))),
   30             cxxMemberCallExpr(hasType(cxxRecordDecl(IsAHandle)),
   30             cxxMemberCallExpr(hasType(cxxRecordDecl(IsAHandle)),
   31                               callee(memberExpr(member(cxxConversionDecl()))),
   41       conditionalOperator(hasTrueExpression(cxxBindTemporaryExpr()),
   48   return hasAnyName("::std::deque", "::std::forward_list", "::std::list",
   53   return hasAnyName("::std::set", "::std::multiset", "::std::unordered_set",
   58   return hasAnyName("::std::map", "::std::multimap", "::std::unordered_map",
   70   return callExpr(
   75           cxxMemberCallExpr(
   76               callee(functionDecl(hasAnyName("assign", "push_back", "resize"))),
   76               callee(functionDecl(hasAnyName("assign", "push_back", "resize"))),
   77               on(expr(hasType(hasUnqualifiedDesugaredType(
   78                   recordType(hasDeclaration(recordDecl(isASequence())))))))),
   78                   recordType(hasDeclaration(recordDecl(isASequence())))))))),
   80           cxxMemberCallExpr(callee(functionDecl(hasName("insert"))),
   80           cxxMemberCallExpr(callee(functionDecl(hasName("insert"))),
   81                             on(expr(hasType(hasUnqualifiedDesugaredType(
   82                                 recordType(hasDeclaration(recordDecl(
   82                                 recordType(hasDeclaration(recordDecl(
   85           cxxOperatorCallExpr(callee(cxxMethodDecl(ofClass(isAMap()))),
   85           cxxOperatorCallExpr(callee(cxxMethodDecl(ofClass(isAMap()))),
   97       IsAHandle(cxxRecordDecl(hasAnyName(std::vector<StringRef>(
  111       varDecl(hasType(hasUnqualifiedDesugaredType(
  112                   recordType(hasDeclaration(cxxRecordDecl(IsAHandle))))),
  112                   recordType(hasDeclaration(cxxRecordDecl(IsAHandle))))),
  114                   exprWithCleanups(has(ignoringParenImpCasts(ConvertedHandle)))
  120       varDecl(
  122               recordType(hasDeclaration(cxxRecordDecl(IsAHandle))))),
  122               recordType(hasDeclaration(cxxRecordDecl(IsAHandle))))),
  124           hasInitializer(exprWithCleanups(has(ignoringParenImpCasts(handleFrom(
  130       cxxOperatorCallExpr(callee(cxxMethodDecl(ofClass(IsAHandle))),
  130       cxxOperatorCallExpr(callee(cxxMethodDecl(ofClass(IsAHandle))),
  143       returnStmt(
  151                          declRefExpr(to(varDecl(
  151                          declRefExpr(to(varDecl(
  157                                        recordType(hasDeclaration(recordDecl(
  157                                        recordType(hasDeclaration(recordDecl(
  166       returnStmt(has(exprWithCleanups(has(ignoringParenImpCasts(handleFrom(
  166       returnStmt(has(exprWithCleanups(has(ignoringParenImpCasts(handleFrom(
tools/clang/tools/extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
   50       varDecl(hasGlobalStorage(), unless(hasConstantDeclaration())).bind("var"),
tools/clang/tools/extra/clang-tidy/bugprone/ExceptionEscapeCheck.cpp
   59       functionDecl(anyOf(isNoThrow(), cxxDestructorDecl(),
   60                          cxxConstructorDecl(isMoveConstructor()),
   61                          cxxMethodDecl(isMoveAssignmentOperator()),
tools/clang/tools/extra/clang-tidy/bugprone/FoldInitTypeCheck.cpp
   30         recordType(hasDeclaration(has(typedefNameDecl(
   30         recordType(hasDeclaration(has(typedefNameDecl(
   34   const auto IteratorParam = parmVarDecl(
   36   const auto Iterator2Param = parmVarDecl(
   38   const auto InitParam = parmVarDecl(hasType(BuiltinTypeWithId("InitType")));
   42       callExpr(callee(functionDecl(
   42       callExpr(callee(functionDecl(
   43                    hasAnyName("::std::accumulate", "::std::reduce"),
   50       callExpr(callee(functionDecl(hasName("::std::inner_product"),
   50       callExpr(callee(functionDecl(hasName("::std::inner_product"),
   59       callExpr(callee(functionDecl(hasName("::std::reduce"),
   59       callExpr(callee(functionDecl(hasName("::std::reduce"),
   67       callExpr(callee(functionDecl(hasName("::std::inner_product"),
   67       callExpr(callee(functionDecl(hasName("::std::inner_product"),
tools/clang/tools/extra/clang-tidy/bugprone/ForwardDeclarationNamespaceCheck.cpp
   31       decl(anyOf(cxxRecordDecl(isExplicitTemplateSpecialization()),
   31       decl(anyOf(cxxRecordDecl(isExplicitTemplateSpecialization()),
   32                  functionDecl(isExplicitTemplateSpecialization()))));
   34       cxxRecordDecl(
   35           hasParent(decl(anyOf(namespaceDecl(), translationUnitDecl()))),
tools/clang/tools/extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp
   68       parmVarDecl(
   69           hasType(qualType(rValueReferenceType(),
   70                            references(templateTypeParmType(hasDeclaration(
   76       cxxConstructorDecl(
   80               parmVarDecl(hasType(isEnableIf())))),
   81           unless(hasParent(functionTemplateDecl(has(templateTypeParmDecl(
   81           unless(hasParent(functionTemplateDecl(has(templateTypeParmDecl(
tools/clang/tools/extra/clang-tidy/bugprone/InaccurateEraseCheck.cpp
   27       callExpr(
   28           callee(functionDecl(hasAnyName("remove", "remove_if", "unique"))),
   28           callee(functionDecl(hasAnyName("remove", "remove_if", "unique"))),
   31               anyOf(cxxConstructExpr(has(ignoringImplicit(
   32                         cxxMemberCallExpr(callee(cxxMethodDecl(hasName("end"))))
   32                         cxxMemberCallExpr(callee(cxxMethodDecl(hasName("end"))))
   37   const auto DeclInStd = type(hasUnqualifiedDesugaredType(
   38       tagType(hasDeclaration(decl(isInStdNamespace())))));
   38       tagType(hasDeclaration(decl(isInStdNamespace())))));
   40       cxxMemberCallExpr(
   42           callee(cxxMethodDecl(hasName("erase"))), argumentCountIs(1),
tools/clang/tools/extra/clang-tidy/bugprone/IncorrectRoundingsCheck.cpp
   35   auto FloatHalf = floatLiteral(floatHalf());
   38   auto FloatType = expr(hasType(realFloatingPointType()));
   44             implicitCastExpr(FloatType, has(ignoringParenImpCasts(FloatHalf))));
   54       implicitCastExpr(
   56           ignoringParenCasts(binaryOperator(hasOperatorName("+"), OneSideHalf)))
tools/clang/tools/extra/clang-tidy/bugprone/InfiniteLoopCheck.cpp
   22   return stmt(anyOf(breakStmt(Internal), returnStmt(Internal),
   22   return stmt(anyOf(breakStmt(Internal), returnStmt(Internal),
   22   return stmt(anyOf(breakStmt(Internal), returnStmt(Internal),
   23                     gotoStmt(Internal), cxxThrowExpr(Internal),
   23                     gotoStmt(Internal), cxxThrowExpr(Internal),
   24                     callExpr(Internal, callee(functionDecl(isNoReturn())))));
   24                     callExpr(Internal, callee(functionDecl(isNoReturn())))));
  158           expr(forFunction(functionDecl().bind("func"))).bind("condition")),
  162   Finder->addMatcher(stmt(anyOf(whileStmt(LoopCondition), doStmt(LoopCondition),
  162   Finder->addMatcher(stmt(anyOf(whileStmt(LoopCondition), doStmt(LoopCondition),
  162   Finder->addMatcher(stmt(anyOf(whileStmt(LoopCondition), doStmt(LoopCondition),
  163                                 forStmt(LoopCondition)))
tools/clang/tools/extra/clang-tidy/bugprone/IntegerDivisionCheck.cpp
   22   const auto BinaryOperators = binaryOperator(anyOf(
   30       unaryOperator(anyOf(hasOperatorName("~"), hasOperatorName("!")));
   34             callExpr(IntType), explicitCastExpr(IntType), UnaryOperators);
   34             callExpr(IntType), explicitCastExpr(IntType), UnaryOperators);
   37       binaryOperator(
   38           hasOperatorName("/"), hasLHS(expr(IntType)), hasRHS(expr(IntType)),
   38           hasOperatorName("/"), hasLHS(expr(IntType)), hasRHS(expr(IntType)),
   40               castExpr(hasCastKind(CK_IntegralToFloating)).bind("FloatCast")),
   42               expr(Exceptions,
   43                    hasAncestor(castExpr(equalsBoundNode("FloatCast")))))))
tools/clang/tools/extra/clang-tidy/bugprone/LambdaFunctionNameCheck.cpp
   63   Finder->addMatcher(predefinedExpr(hasAncestor(lambdaExpr())).bind("E"),
tools/clang/tools/extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
   21   const auto StrLenFunc = functionDecl(anyOf(
   29       callExpr(callee(StrLenFunc),
   31                    binaryOperator(
   33                        hasRHS(ignoringParenImpCasts(integerLiteral(equals(1)))))
   38       allOf(unless(binaryOperator(
   40                 hasRHS(ignoringParenImpCasts(integerLiteral(equals(1)))))),
   45       functionDecl(anyOf(hasName("::malloc"), hasName("std::malloc"),
   48       functionDecl(anyOf(hasName("::calloc"), hasName("std::calloc"),
   52       varDecl(hasType(isConstQualified()),
   54                   declRefExpr(hasDeclaration(Alloc0Func)))));
   56       varDecl(hasType(isConstQualified()),
   58                   declRefExpr(hasDeclaration(Alloc1Func)))));
   60   Finder->addMatcher(callExpr(callee(decl(anyOf(Alloc0Func, Alloc0FuncPtr))),
   60   Finder->addMatcher(callExpr(callee(decl(anyOf(Alloc0Func, Alloc0FuncPtr))),
   64   Finder->addMatcher(callExpr(callee(decl(anyOf(Alloc1Func, Alloc1FuncPtr))),
   64   Finder->addMatcher(callExpr(callee(decl(anyOf(Alloc1Func, Alloc1FuncPtr))),
   69       cxxNewExpr(isArray(), hasArraySize(BadArg)).bind("Alloc"), this);
tools/clang/tools/extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
   32       expr(anyOf(binaryOperator(
   32       expr(anyOf(binaryOperator(
   35                  unaryOperator(hasOperatorName("~"))),
   39   const auto ExplicitCast = explicitCastExpr(hasDestinationType(isInteger()),
   42       implicitCastExpr(hasImplicitDestinationType(isInteger()),
   44   const auto Cast = expr(anyOf(ExplicitCast, ImplicitCast)).bind("Cast");
   46   Finder->addMatcher(varDecl(hasInitializer(Cast)), this);
   47   Finder->addMatcher(returnStmt(hasReturnValue(Cast)), this);
   48   Finder->addMatcher(callExpr(hasAnyArgument(Cast)), this);
   49   Finder->addMatcher(binaryOperator(hasOperatorName("="), hasRHS(Cast)), this);
   51       binaryOperator(matchers::isComparisonOperator(), hasEitherOperand(Cast)),
tools/clang/tools/extra/clang-tidy/bugprone/MoveForwardingReferenceCheck.cpp
   76       parmVarDecl(
   77           hasType(qualType(rValueReferenceType(),
   78                            references(templateTypeParmType(hasDeclaration(
   80                            unless(references(qualType(isConstQualified()))))))
   84       callExpr(callee(unresolvedLookupExpr(
   84       callExpr(callee(unresolvedLookupExpr(
   85                           hasAnyDeclaration(namedDecl(
   89                hasArgument(0, ignoringParenImpCasts(declRefExpr(
tools/clang/tools/extra/clang-tidy/bugprone/MultipleStatementMacroCheck.cpp
   59   const auto Inner = expr(isInMacro(), unless(compoundStmt())).bind("inner");
   61       stmt(anyOf(ifStmt(hasThen(Inner)), ifStmt(hasElse(Inner)).bind("else"),
   61       stmt(anyOf(ifStmt(hasThen(Inner)), ifStmt(hasElse(Inner)).bind("else"),
   61       stmt(anyOf(ifStmt(hasThen(Inner)), ifStmt(hasElse(Inner)).bind("else"),
   62                  whileStmt(hasBody(Inner)), forStmt(hasBody(Inner))))
   62                  whileStmt(hasBody(Inner)), forStmt(hasBody(Inner))))
tools/clang/tools/extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
  524       declRefExpr(to(varDecl(hasInitializer(ignoringImpCasts(InnerMatcher))))));
  524       declRefExpr(to(varDecl(hasInitializer(ignoringImpCasts(InnerMatcher))))));
  530   auto DREHasDefinition = ignoringImpCasts(declRefExpr(
  532             hasAncestor(compoundStmt(hasDescendant(binaryOperator(
  532             hasAncestor(compoundStmt(hasDescendant(binaryOperator(
  533                 hasLHS(declRefExpr(to(varDecl(equalsBoundNode(VarDeclName))))),
  533                 hasLHS(declRefExpr(to(varDecl(equalsBoundNode(VarDeclName))))),
  545       binaryOperator(hasOperatorName("+"),
  549       binaryOperator(hasOperatorName("-"),
  555   auto Container = ignoringImpCasts(cxxMemberCallExpr(hasDescendant(declRefExpr(
  555   auto Container = ignoringImpCasts(cxxMemberCallExpr(hasDescendant(declRefExpr(
  556       hasType(hasUnqualifiedDesugaredType(recordType(hasDeclaration(recordDecl(
  556       hasType(hasUnqualifiedDesugaredType(recordType(hasDeclaration(recordDecl(
  557           hasAnyName("::std::vector", "::std::list", "::std::deque"))))))))));
  559   auto StringTy = type(hasUnqualifiedDesugaredType(recordType(
  559   auto StringTy = type(hasUnqualifiedDesugaredType(recordType(
  560       hasDeclaration(cxxRecordDecl(hasName("::std::basic_string"))))));
  563       anyOf(hasType(StringTy), hasType(qualType(pointsTo(StringTy))));
  565   auto CharTyArray = hasType(qualType(hasCanonicalType(
  566       arrayType(hasElementType(isAnyCharacter())).bind(DestArrayTyName))));
  566       arrayType(hasElementType(isAnyCharacter())).bind(DestArrayTyName))));
  569       qualType(hasCanonicalType(pointerType(pointee(isAnyCharacter())))));
  569       qualType(hasCanonicalType(pointerType(pointee(isAnyCharacter())))));
  569       qualType(hasCanonicalType(pointerType(pointee(isAnyCharacter())))));
  579       callExpr(callee(functionDecl(hasAnyName("::strlen", "::wcslen"))))
  579       callExpr(callee(functionDecl(hasAnyName("::strlen", "::wcslen"))))
  579       callExpr(callee(functionDecl(hasAnyName("::strlen", "::wcslen"))))
  584       cxxMemberCallExpr(
  585           allOf(on(expr(AnyOfStringTy).bind("Foo")),
  586                 has(memberExpr(member(hasAnyName("size", "length"))))))
  586                 has(memberExpr(member(hasAnyName("size", "length"))))))
  590   auto SizeOfCharExpr = unaryExprOrTypeTraitExpr(has(expr(AnyOfCharTy)));
  590   auto SizeOfCharExpr = unaryExprOrTypeTraitExpr(has(expr(AnyOfCharTy)));
  598       ignoringImpCasts(declRefExpr(to(varDecl(hasInitializer(WrongLength)))));
  598       ignoringImpCasts(declRefExpr(to(varDecl(hasInitializer(WrongLength)))));
  603   auto CallExprReturnWithoutInc = ignoringImpCasts(callExpr(callee(functionDecl(
  603   auto CallExprReturnWithoutInc = ignoringImpCasts(callExpr(callee(functionDecl(
  604       hasBody(has(returnStmt(hasReturnValue(AnyOfCallOrDREWithoutInc))))))));
  608       declRefExpr(to(varDecl(hasInitializer(CallExprReturnWithoutInc)))));
  608       declRefExpr(to(varDecl(hasInitializer(CallExprReturnWithoutInc)))));
  620   auto SizeExpr = anyOf(SizeOfCharExpr, integerLiteral(equals(1)));
  623       callee(functionDecl(
  624           hasAnyName("::alloca", "::calloc", "malloc", "realloc"))),
  628   auto DestMalloc = anyOf(callExpr(MallocLengthExpr),
  629                           hasDescendant(callExpr(MallocLengthExpr)));
  633       cxxNewExpr(hasArraySize(expr().bind(DestMallocExprName))));
  638   auto DestArrayTyDecl = declRefExpr(
  639       to(anyOf(varDecl(CharTyArray).bind(DestVarDeclName),
  640                varDecl(hasInitializer(AnyOfDestInit)).bind(DestVarDeclName))));
  644       declRefExpr(allOf(to(varDecl(AnyOfCharTy).bind(DestVarDeclName)),
  644       declRefExpr(allOf(to(varDecl(AnyOfCharTy).bind(DestVarDeclName)),
  654   auto NullTerminatorExpr = binaryOperator(
  655       hasLHS(anyOf(hasDescendant(declRefExpr(
  656                        to(varDecl(equalsBoundNode(DestVarDeclName))))),
  657                    hasDescendant(declRefExpr(equalsBoundNode(DestExprName))))),
  659           anyOf(characterLiteral(equals(0U)), integerLiteral(equals(0))))));
  659           anyOf(characterLiteral(equals(0U)), integerLiteral(equals(0))))));
  661   auto SrcDecl = declRefExpr(
  692                              unless(hasAncestor(compoundStmt(
  727     return allOf(callee(functionDecl(
  728                      hasAnyName(CharHandlerFuncName, WcharHandlerFuncName))),
  775   Finder->addMatcher(callExpr(AnyOfMatchers).bind(FunctionExprName), this);
  779       callExpr(Memchr,
  780                unless(hasAncestor(castExpr(unless(implicitCastExpr())))))
  784       castExpr(allOf(unless(implicitCastExpr()),
  785                      has(callExpr(Memchr).bind(FunctionExprName))))
tools/clang/tools/extra/clang-tidy/bugprone/ParentVirtualCallCheck.cpp
   86       cxxMemberCallExpr(
   87           callee(memberExpr(hasDescendant(implicitCastExpr(
   87           callee(memberExpr(hasDescendant(implicitCastExpr(
   89                                     type(anything()).bind("castToType"))),
   90                                 hasSourceExpression(cxxThisExpr(hasType(
   91                                     type(anything()).bind("thisType")))))))
   93           callee(cxxMethodDecl(isVirtual()))),
tools/clang/tools/extra/clang-tidy/bugprone/PosixReturnCheck.cpp
   32       binaryOperator(
   34           hasLHS(callExpr(callee(functionDecl(
   34           hasLHS(callExpr(callee(functionDecl(
   37           hasRHS(integerLiteral(equals(0))))
   41       binaryOperator(
   43           hasLHS(callExpr(callee(functionDecl(
   43           hasLHS(callExpr(callee(functionDecl(
   46           hasRHS(integerLiteral(equals(0))))
   50       binaryOperator(
   53           hasLHS(callExpr(callee(functionDecl(
   53           hasLHS(callExpr(callee(functionDecl(
   56           hasRHS(unaryOperator(hasOperatorName("-"),
tools/clang/tools/extra/clang-tidy/bugprone/SizeofContainerCheck.cpp
   21       expr(unless(isInTemplateInstantiation()),
   22            expr(sizeOfExpr(has(ignoringParenImpCasts(
   23                     expr(hasType(hasCanonicalType(hasDeclaration(cxxRecordDecl(
   23                     expr(hasType(hasCanonicalType(hasDeclaration(cxxRecordDecl(
   26                         hasMethod(cxxMethodDecl(hasName("size"), isPublic(),
   30            unless(hasAncestor(binaryOperator(
tools/clang/tools/extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
   81   const auto ConstantExpr = expr(ignoringParenImpCasts(
   82       anyOf(integerLiteral(), unaryOperator(hasUnaryOperand(IntegerExpr)),
   83             binaryOperator(hasLHS(IntegerExpr), hasRHS(IntegerExpr)))));
   84   const auto IntegerCallExpr = expr(ignoringParenImpCasts(
   85       callExpr(anyOf(hasType(isInteger()), hasType(enumType())),
   87   const auto SizeOfExpr = expr(anyOf(
   90       sizeOfExpr(has(expr(hasType(
   92   const auto SizeOfZero = expr(
   93       sizeOfExpr(has(ignoringParenImpCasts(expr(integerLiteral(equals(0)))))));
   93       sizeOfExpr(has(ignoringParenImpCasts(expr(integerLiteral(equals(0)))))));
  100         expr(sizeOfExpr(has(ignoringParenImpCasts(ConstantExpr))),
  109         expr(sizeOfExpr(ignoringParenImpCasts(has(IntegerCallExpr))))
  117         expr(sizeOfExpr(has(ignoringParenImpCasts(expr(cxxThisExpr())))))
  117         expr(sizeOfExpr(has(ignoringParenImpCasts(expr(cxxThisExpr())))))
  123   const auto CharPtrType = pointerType(pointee(isAnyCharacter()));
  123   const auto CharPtrType = pointerType(pointee(isAnyCharacter()));
  125       varDecl(isDefinition(), hasType(qualType(hasCanonicalType(CharPtrType))),
  125       varDecl(isDefinition(), hasType(qualType(hasCanonicalType(CharPtrType))),
  127   Finder->addMatcher(expr(sizeOfExpr(has(ignoringParenImpCasts(expr(
  127   Finder->addMatcher(expr(sizeOfExpr(has(ignoringParenImpCasts(expr(
  128                               hasType(qualType(hasCanonicalType(CharPtrType))),
  129                               ignoringParenImpCasts(declRefExpr(
  135   const auto ArrayExpr = expr(ignoringParenImpCasts(
  136       expr(hasType(qualType(hasCanonicalType(arrayType()))))));
  136       expr(hasType(qualType(hasCanonicalType(arrayType()))))));
  137   const auto ArrayCastExpr = expr(anyOf(
  138       unaryOperator(hasUnaryOperand(ArrayExpr), unless(hasOperatorName("*"))),
  139       binaryOperator(hasEitherOperand(ArrayExpr)),
  140       castExpr(hasSourceExpression(ArrayExpr))));
  141   const auto PointerToArrayExpr = expr(ignoringParenImpCasts(expr(
  141   const auto PointerToArrayExpr = expr(ignoringParenImpCasts(expr(
  142       hasType(qualType(hasCanonicalType(pointerType(pointee(arrayType()))))))));
  142       hasType(qualType(hasCanonicalType(pointerType(pointee(arrayType()))))))));
  142       hasType(qualType(hasCanonicalType(pointerType(pointee(arrayType()))))))));
  145       unaryOperator(hasOperatorName("&"),
  146                     hasUnaryOperand(ignoringParenImpCasts(expr(
  147                         hasType(qualType(hasCanonicalType(recordType())))))));
  148   const auto PointerToStructType = type(hasUnqualifiedDesugaredType(
  149       pointerType(pointee(recordType()))));
  149       pointerType(pointee(recordType()))));
  150   const auto PointerToStructExpr = expr(ignoringParenImpCasts(expr(
  150   const auto PointerToStructExpr = expr(ignoringParenImpCasts(expr(
  151       hasType(qualType(hasCanonicalType(PointerToStructType))),
  155       expr(anyOf(sizeOfExpr(has(expr(ignoringParenImpCasts(
  155       expr(anyOf(sizeOfExpr(has(expr(ignoringParenImpCasts(
  165         binaryOperator(matchers::isRelationalOperator(),
  168                            anyOf(integerLiteral(equals(0)),
  169                                  integerLiteral(isBiggerThan(0x80000))))))
  175   Finder->addMatcher(expr(sizeOfExpr(has(expr(ignoringParenImpCasts(
  175   Finder->addMatcher(expr(sizeOfExpr(has(expr(ignoringParenImpCasts(
  176                               binaryOperator(hasOperatorName(",")))))))
  182       arrayType(hasElementType(recordType().bind("elem-type")));
  182       arrayType(hasElementType(recordType().bind("elem-type")));
  183   const auto ElemPtrType = pointerType(pointee(type().bind("elem-ptr-type")));
  183   const auto ElemPtrType = pointerType(pointee(type().bind("elem-ptr-type")));
  184   const auto NumType = qualType(hasCanonicalType(
  185       type(anyOf(ElemType, ElemPtrType, type())).bind("num-type")));
  186   const auto DenomType = qualType(hasCanonicalType(type().bind("denom-type")));
  189       binaryOperator(hasOperatorName("/"),
  190                      hasLHS(expr(ignoringParenImpCasts(
  192                                sizeOfExpr(has(expr(hasType(NumType)))))))),
  193                      hasRHS(expr(ignoringParenImpCasts(
  195                                sizeOfExpr(has(expr(hasType(DenomType)))))))))
  200   Finder->addMatcher(binaryOperator(hasOperatorName("*"),
  207       binaryOperator(hasOperatorName("*"),
  209                      hasEitherOperand(ignoringParenImpCasts(binaryOperator(
  218       expr(sizeOfExpr(has(ignoringParenImpCasts(expr(
  218       expr(sizeOfExpr(has(ignoringParenImpCasts(expr(
  219                hasSizeOfDescendant(8, expr(SizeOfExpr, unless(SizeOfZero))))))))
  225   const auto PtrDiffExpr = binaryOperator(
  227       hasLHS(expr(hasType(hasUnqualifiedDesugaredType(pointerType(pointee(
  227       hasLHS(expr(hasType(hasUnqualifiedDesugaredType(pointerType(pointee(
  227       hasLHS(expr(hasType(hasUnqualifiedDesugaredType(pointerType(pointee(
  229       hasRHS(expr(hasType(hasUnqualifiedDesugaredType(pointerType(pointee(
  229       hasRHS(expr(hasType(hasUnqualifiedDesugaredType(pointerType(pointee(
  229       hasRHS(expr(hasType(hasUnqualifiedDesugaredType(pointerType(pointee(
  233       binaryOperator(
  238           hasEitherOperand(expr(anyOf(
  240               ignoringParenImpCasts(binaryOperator(
  247   Finder->addMatcher(binaryOperator(hasOperatorName("/"),
tools/clang/tools/extra/clang-tidy/bugprone/StringConstructorCheck.cpp
   41   const auto ZeroExpr = expr(ignoringParenImpCasts(integerLiteral(equals(0))));
   41   const auto ZeroExpr = expr(ignoringParenImpCasts(integerLiteral(equals(0))));
   42   const auto CharExpr = expr(ignoringParenImpCasts(characterLiteral()));
   43   const auto NegativeExpr = expr(ignoringParenImpCasts(
   44       unaryOperator(hasOperatorName("-"),
   45                     hasUnaryOperand(integerLiteral(unless(equals(0)))))));
   46   const auto LargeLengthExpr = expr(ignoringParenImpCasts(
   47       integerLiteral(isBiggerThan(LargeLengthThreshold))));
   48   const auto CharPtrType = type(anyOf(pointerType(), arrayType()));
   52   const auto ConstStrLiteralDecl = varDecl(
   55   const auto ConstPtrStrLiteralDecl = varDecl(
   57       hasType(pointerType(pointee(isAnyCharacter(), isConstQualified()))),
   57       hasType(pointerType(pointee(isAnyCharacter(), isConstQualified()))),
   59   const auto ConstStrLiteral = expr(ignoringParenImpCasts(anyOf(
   60       BoundStringLiteral, declRefExpr(hasDeclaration(anyOf(
   66       cxxConstructExpr(
   67           hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
   68           hasArgument(0, hasType(qualType(isInteger()))),
   69           hasArgument(1, hasType(qualType(isInteger()))),
   85       cxxConstructExpr(
   86           hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
  106       cxxConstructExpr(hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
  106       cxxConstructExpr(hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
tools/clang/tools/extra/clang-tidy/bugprone/StringIntegerAssignmentCheck.cpp
   24       cxxOperatorCallExpr(
   27           callee(cxxMethodDecl(ofClass(classTemplateSpecializationDecl(
   27           callee(cxxMethodDecl(ofClass(classTemplateSpecializationDecl(
   34                   expr(hasType(isInteger()), unless(hasType(isAnyCharacter())),
   36                        unless(callExpr(callee(functionDecl(
   36                        unless(callExpr(callee(functionDecl(
   37                            hasAnyName("tolower", "std::tolower", "toupper",
   41                        unless(hasType(qualType(
tools/clang/tools/extra/clang-tidy/bugprone/StringLiteralWithEmbeddedNulCheck.cpp
   31   Finder->addMatcher(stringLiteral(containsNul()).bind("strlit"), this);
   38       ignoringParenImpCasts(stringLiteral(containsNul()).bind("truncated"));
   41   const auto StringConstructorExpr = expr(anyOf(
   42       cxxConstructExpr(argumentCountIs(1),
   43                        hasDeclaration(cxxMethodDecl(hasName("basic_string")))),
   46       cxxConstructExpr(argumentCountIs(2),
   47                        hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
   53       cxxConstructExpr(StringConstructorExpr, hasArgument(0, StrLitWithNul)),
   57   Finder->addMatcher(cxxOperatorCallExpr(hasAnyArgument(StrLitWithNul)), this);
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousEnumUsageCheck.cpp
  121     return expr(ignoringImpCasts(expr().bind(RefName)),
  126       binaryOperator(hasOperatorName("|"), hasLHS(enumExpr("", "enumDecl")),
  127                      hasRHS(expr(enumExpr("", "otherEnumDecl"),
  128                                  ignoringImpCasts(hasType(enumDecl(
  134       binaryOperator(anyOf(hasOperatorName("+"), hasOperatorName("|")),
  136                      hasRHS(expr(enumExpr("rhsExpr", ""),
  138                                      enumDecl(equalsBoundNode("enumDecl"))))))),
  142       binaryOperator(anyOf(hasOperatorName("+"), hasOperatorName("|")),
  144                          expr(hasType(isInteger()), unless(enumExpr("", "")))),
  149       binaryOperator(anyOf(hasOperatorName("|="), hasOperatorName("+=")),
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousMemsetUsageCheck.cpp
   26       callExpr(
   27           callee(functionDecl(hasName("::memset"))),
   28           hasArgument(1, characterLiteral(equals(static_cast<unsigned>('0')))
   32                                           hasType(arrayType(hasElementType(
   32                                           hasType(arrayType(hasElementType(
   39   Finder->addMatcher(callExpr(callee(functionDecl(hasName("::memset"))),
   39   Finder->addMatcher(callExpr(callee(functionDecl(hasName("::memset"))),
   46       callExpr(callee(functionDecl(hasName("::memset"))),
   46       callExpr(callee(functionDecl(hasName("::memset"))),
   47                unless(hasArgument(1, anyOf(characterLiteral(equals(
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousMissingCommaCheck.cpp
   86       stringLiteral(isConcatenatedLiteral(MaxConcatenatedTokens)).bind("str");
   89       initListExpr(hasType(constantArrayType()),
   90                    has(ignoringParenImpCasts(expr(ConcatenatedStringLiteral))));
tools/clang/tools/extra/clang-tidy/bugprone/SuspiciousSemicolonCheck.cpp
   22       stmt(anyOf(ifStmt(hasThen(nullStmt().bind("semi")),
   22       stmt(anyOf(ifStmt(hasThen(nullStmt().bind("semi")),
   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
   86   const auto ComparisonUnaryOperator = unaryOperator(hasOperatorName("!"));
   88       binaryOperator(matchers::isComparisonOperator());
   90       expr(anyOf(ComparisonUnaryOperator, ComparisonBinaryOperator));
  100       functionDecl(hasAnyName(std::vector<StringRef>(FunctionNames.begin(),
  104       callExpr(hasDeclaration(FunctionCompareDecl)).bind("call");
  105   const auto MacroStringCompareCallExpr = conditionalOperator(anyOf(
  116         stmt(anyOf(ifStmt(hasCondition(StringCompareCallExpr)),
  116         stmt(anyOf(ifStmt(hasCondition(StringCompareCallExpr)),
  117                    whileStmt(hasCondition(StringCompareCallExpr)),
  118                    doStmt(hasCondition(StringCompareCallExpr)),
  119                    forStmt(hasCondition(StringCompareCallExpr)),
  120                    binaryOperator(
  130     Finder->addMatcher(unaryOperator(hasOperatorName("!"),
  139       implicitCastExpr(unless(hasType(isInteger())),
  146       binaryOperator(
  155       anyOf(integerLiteral(unless(equals(0))),
  156             unaryOperator(
  158                 has(ignoringParenImpCasts(integerLiteral(unless(equals(0)))))),
  161   Finder->addMatcher(binaryOperator(matchers::isComparisonOperator(),
tools/clang/tools/extra/clang-tidy/bugprone/TerminatingContinueCheck.cpp
   23       doStmt(hasCondition(ignoringImpCasts(
   24                  anyOf(cxxBoolLiteral(equals(false)), integerLiteral(equals(0)),
   24                  anyOf(cxxBoolLiteral(equals(false)), integerLiteral(equals(0)),
   29       continueStmt(hasAncestor(stmt(anyOf(forStmt(), whileStmt(),
   29       continueStmt(hasAncestor(stmt(anyOf(forStmt(), whileStmt(),
tools/clang/tools/extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp
   24       cxxConstructorDecl(hasAnyConstructorInitializer(anything()));
   27       expr(anyOf(cxxFunctionalCastExpr(), cxxBindTemporaryExpr(),
   29            hasType(cxxRecordDecl(
   31            unless(anyOf(hasAncestor(stmt(
tools/clang/tools/extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
   56       expr(
   57           ignoringParenImpCasts(declRefExpr(to(varDecl(hasType(isInteger()))))))
   57           ignoringParenImpCasts(declRefExpr(to(varDecl(hasType(isInteger()))))))
   62       implicitCastExpr(hasImplicitDestinationType(isInteger()),
   69       expr(ignoringParenImpCasts(allOf(hasType(isInteger()),
   78       expr(ignoringParenImpCasts(hasType(isInteger()))).bind(LoopIncrementName);
   81       forStmt(
   83               binaryOperator(hasOperatorName("<"),
   86               binaryOperator(hasOperatorName("<="),
   89               binaryOperator(hasOperatorName(">"), hasLHS(LoopBoundMatcher),
   91               binaryOperator(hasOperatorName(">="), hasLHS(LoopBoundMatcher),
tools/clang/tools/extra/clang-tidy/bugprone/UndefinedMemoryManipulationCheck.cpp
   29           pointsTo(cxxRecordDecl(isNotTriviallyCopyable()))));
   33   Finder->addMatcher(callExpr(callee(functionDecl(hasAnyName(
   33   Finder->addMatcher(callExpr(callee(functionDecl(hasAnyName(
   33   Finder->addMatcher(callExpr(callee(functionDecl(hasAnyName(
   42       callExpr(callee(functionDecl(hasAnyName("::memcpy", "::memmove"))),
   42       callExpr(callee(functionDecl(hasAnyName("::memcpy", "::memmove"))),
   42       callExpr(callee(functionDecl(hasAnyName("::memcpy", "::memmove"))),
tools/clang/tools/extra/clang-tidy/bugprone/UndelegatedConstructorCheck.cpp
   63       compoundStmt(
   65               cxxConstructorDecl(ofClass(cxxRecordDecl().bind("parent")))),
   67               cxxConstructExpr(hasDeclaration(cxxConstructorDecl(ofClass(
   67               cxxConstructExpr(hasDeclaration(cxxConstructorDecl(ofClass(
   68                                    cxxRecordDecl(baseOfBoundNode("parent"))))))
tools/clang/tools/extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
   36   const auto IsUserDefined = cxxMethodDecl(
   42       cxxMethodDecl(hasParameter(0, parmVarDecl(hasType(referenceType()))));
   42       cxxMethodDecl(hasParameter(0, parmVarDecl(hasType(referenceType()))));
   46   const auto HasNoSelfCheck = cxxMethodDecl(unless(hasDescendant(
   47       binaryOperator(anyOf(hasOperatorName("=="), hasOperatorName("!=")),
   53   const auto HasNonTemplateSelfCopy = cxxMethodDecl(
   54       ofClass(cxxRecordDecl(unless(hasAncestor(classTemplateDecl())))),
   55       hasDescendant(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
   55       hasDescendant(cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
   61   const auto HasTemplateSelfCopy = cxxMethodDecl(
   62       ofClass(cxxRecordDecl(hasAncestor(classTemplateDecl()))),
   64                 varDecl(hasType(cxxRecordDecl(equalsBoundNode("class"))),
   64                 varDecl(hasType(cxxRecordDecl(equalsBoundNode("class"))),
   66             hasDescendant(cxxUnresolvedConstructExpr(hasDescendant(declRefExpr(
   66             hasDescendant(cxxUnresolvedConstructExpr(hasDescendant(declRefExpr(
   67                 hasType(cxxRecordDecl(equalsBoundNode("class")))))))));
   73       cxxMethodDecl(unless(hasDescendant(cxxMemberCallExpr(callee(cxxMethodDecl(
   73       cxxMethodDecl(unless(hasDescendant(cxxMemberCallExpr(callee(cxxMethodDecl(
   73       cxxMethodDecl(unless(hasDescendant(cxxMemberCallExpr(callee(cxxMethodDecl(
   79     const auto SmartPointerType = qualType(hasUnqualifiedDesugaredType(
   80         recordType(hasDeclaration(classTemplateSpecializationDecl(
   80         recordType(hasDeclaration(classTemplateSpecializationDecl(
   81             hasAnyName("::std::shared_ptr", "::std::unique_ptr",
   89     AdditionalMatcher = cxxMethodDecl(ofClass(cxxRecordDecl(
   89     AdditionalMatcher = cxxMethodDecl(ofClass(cxxRecordDecl(
   90         has(fieldDecl(anyOf(hasType(pointerType()), hasType(SmartPointerType),
   94   Finder->addMatcher(cxxMethodDecl(ofClass(cxxRecordDecl().bind("class")),
tools/clang/tools/extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
   36       cxxBindTemporaryExpr(unless(has(ignoringParenImpCasts(callExpr()))))
   39       exprWithCleanups(unless(isInTemplateInstantiation()),
   41                        hasType(cxxRecordDecl(hasNonTrivialDestructor())),
   43                              has(ignoringParenImpCasts(cxxFunctionalCastExpr(
   83       match(expr(hasDescendant(typeLoc().bind("t"))), *E, *Result.Context);
tools/clang/tools/extra/clang-tidy/bugprone/UnusedReturnValueCheck.cpp
   54   auto MatchedCallExpr = expr(ignoringImplicit(ignoringParenImpCasts(
   55       callExpr(callee(functionDecl(
   55       callExpr(callee(functionDecl(
   63       compoundStmt(forEach(MatchedCallExpr),
   70       ifStmt(eachOf(hasThen(MatchedCallExpr), hasElse(MatchedCallExpr)));
   71   auto UnusedInWhileStmt = whileStmt(hasBody(MatchedCallExpr));
   72   auto UnusedInDoStmt = doStmt(hasBody(MatchedCallExpr));
   74       forStmt(eachOf(hasLoopInit(MatchedCallExpr),
   76   auto UnusedInRangeForStmt = cxxForRangeStmt(hasBody(MatchedCallExpr));
   77   auto UnusedInCaseStmt = switchCase(forEach(MatchedCallExpr));
   80       stmt(anyOf(UnusedInCompoundStmt, UnusedInIfStmt, UnusedInWhileStmt,
tools/clang/tools/extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp
   79                hasAncestor(declRefExpr(
   80                    to(functionDecl(ast_matchers::isTemplateInstantiation())))));
  252     auto DeclRefMatcher = declRefExpr(hasDeclaration(equalsNode(MovedVariable)),
  258         findAll(cxxOperatorCallExpr(anyOf(hasOverloadedOperatorName("*"),
  272       declRefExpr(hasDeclaration(equalsNode(MovedVariable))).bind("declref");
  275       recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
  275       recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
  275       recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
  283       recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
  283       recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
  283       recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
  288       stmt(anyOf(
  292                binaryOperator(hasOperatorName("="), hasLHS(DeclRefMatcher)),
  293                cxxOperatorCallExpr(hasOverloadedOperatorName("="),
  297                declStmt(hasDescendant(equalsNode(MovedVariable))),
  299                cxxMemberCallExpr(
  300                    on(expr(DeclRefMatcher, StandardContainerTypeMatcher)),
  306                    callee(cxxMethodDecl(hasAnyName("clear", "assign")))),
  306                    callee(cxxMethodDecl(hasAnyName("clear", "assign")))),
  308                cxxMemberCallExpr(
  309                    on(expr(DeclRefMatcher, StandardSmartPointerTypeMatcher)),
  310                    callee(cxxMethodDecl(hasName("reset")))),
  312                cxxMemberCallExpr(
  314                    callee(cxxMethodDecl(hasAttr(clang::attr::Reinitializes)))),
  316                callExpr(forEachArgumentWithParam(
  317                    unaryOperator(hasOperatorName("&"),
  319                    unless(parmVarDecl(hasType(pointsTo(isConstQualified())))))),
  322                callExpr(forEachArgumentWithParam(
  324                             unless(parmVarDecl(hasType(
  325                                 references(qualType(isConstQualified())))))),
  326                         unless(callee(functionDecl(hasName("::std::move")))))))
  381       callExpr(callee(functionDecl(hasName("::std::move"))), argumentCountIs(1),
  381       callExpr(callee(functionDecl(hasName("::std::move"))), argumentCountIs(1),
  392       stmt(forEach(expr(ignoringParenImpCasts(CallMoveMatcher))),
  392       stmt(forEach(expr(ignoringParenImpCasts(CallMoveMatcher))),
  400            unless(expr(ignoringParenImpCasts(equalsBoundNode("call-move")))))
tools/clang/tools/extra/clang-tidy/bugprone/VirtualNearMissCheck.cpp
  222       cxxMethodDecl(
tools/clang/tools/extra/clang-tidy/cert/CommandProcessorCheck.cpp
   21       callExpr(
   22           callee(functionDecl(anyOf(hasName("::system"), hasName("::popen"),
   28           unless(callExpr(callee(functionDecl(hasName("::system"))),
   28           unless(callExpr(callee(functionDecl(hasName("::system"))),
tools/clang/tools/extra/clang-tidy/cert/DontModifyStdNamespaceCheck.cpp
   24       namespaceDecl(unless(isExpansionInSystemHeader()),
   26                     has(decl(unless(anyOf(
   27                         functionDecl(isExplicitTemplateSpecialization()),
   28                         cxxRecordDecl(isExplicitTemplateSpecialization()))))))
tools/clang/tools/extra/clang-tidy/cert/FloatLoopCounter.cpp
   21       forStmt(hasIncrement(expr(hasType(realFloatingPointType())))).bind("for"),
   21       forStmt(hasIncrement(expr(hasType(realFloatingPointType())))).bind("for"),
tools/clang/tools/extra/clang-tidy/cert/LimitedRandomnessCheck.cpp
   20   Finder->addMatcher(callExpr(callee(functionDecl(namedDecl(hasName("::rand")),
   20   Finder->addMatcher(callExpr(callee(functionDecl(namedDecl(hasName("::rand")),
   20   Finder->addMatcher(callExpr(callee(functionDecl(namedDecl(hasName("::rand")),
tools/clang/tools/extra/clang-tidy/cert/PostfixOperatorCheck.cpp
   24   Finder->addMatcher(functionDecl(anyOf(hasOverloadedOperatorName("++"),
tools/clang/tools/extra/clang-tidy/cert/ProperlySeededRandomGeneratorCheck.cpp
   34   auto RandomGeneratorEngineDecl = cxxRecordDecl(hasAnyName(
   34   auto RandomGeneratorEngineDecl = cxxRecordDecl(hasAnyName(
   39       recordType(hasDeclaration(RandomGeneratorEngineDecl))));
   50       cxxMemberCallExpr(
   51           has(memberExpr(has(declRefExpr(RandomGeneratorEngineTypeMatcher)),
   51           has(memberExpr(has(declRefExpr(RandomGeneratorEngineTypeMatcher)),
   65       cxxConstructExpr(RandomGeneratorEngineTypeMatcher).bind("ctor"), this);
   73       callExpr(callee(functionDecl(hasAnyName("::srand", "::std::srand"))))
   73       callExpr(callee(functionDecl(hasAnyName("::srand", "::std::srand"))))
   73       callExpr(callee(functionDecl(hasAnyName("::srand", "::std::srand"))))
tools/clang/tools/extra/clang-tidy/cert/SetLongJmpCheck.cpp
   67       callExpr(callee(functionDecl(hasAnyName("setjmp", "longjmp"))))
   67       callExpr(callee(functionDecl(hasAnyName("setjmp", "longjmp"))))
   67       callExpr(callee(functionDecl(hasAnyName("setjmp", "longjmp"))))
tools/clang/tools/extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp
   27       varDecl(anyOf(hasThreadStorageDuration(), hasStaticStorageDuration()),
   28               unless(anyOf(isConstexpr(), hasType(cxxRecordDecl(isLambda())),
   30               anyOf(hasDescendant(cxxConstructExpr(hasDeclaration(
   31                         cxxConstructorDecl(unless(isNoThrow())).bind("func")))),
   32                     hasDescendant(cxxNewExpr(hasDeclaration(
   33                         functionDecl(unless(isNoThrow())).bind("func")))),
   34                     hasDescendant(callExpr(hasDeclaration(
   35                         functionDecl(unless(isNoThrow())).bind("func"))))))
tools/clang/tools/extra/clang-tidy/cert/StrToNumCheck.cpp
   26       callExpr(
   27           callee(functionDecl(anyOf(
   28               functionDecl(hasAnyName("::atoi", "::atof", "::atol", "::atoll"))
   28               functionDecl(hasAnyName("::atoi", "::atof", "::atol", "::atoll"))
   30               functionDecl(hasAnyName("::scanf", "::sscanf", "::fscanf",
   30               functionDecl(hasAnyName("::scanf", "::sscanf", "::fscanf",
tools/clang/tools/extra/clang-tidy/cert/ThrownExceptionTypeCheck.cpp
   25       cxxThrowExpr(has(ignoringParenImpCasts(
   26           cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
   26           cxxConstructExpr(hasDeclaration(cxxConstructorDecl(
tools/clang/tools/extra/clang-tidy/cert/VariadicFunctionDefCheck.cpp
   26       functionDecl(isDefinition(), isVariadic(), unless(isExternC()))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/AvoidGotoCheck.cpp
   35   auto Loop = stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()));
   37       stmt(anyOf(forStmt(hasAncestor(Loop)), cxxForRangeStmt(hasAncestor(Loop)),
   37       stmt(anyOf(forStmt(hasAncestor(Loop)), cxxForRangeStmt(hasAncestor(Loop)),
   37       stmt(anyOf(forStmt(hasAncestor(Loop)), cxxForRangeStmt(hasAncestor(Loop)),
   38                  whileStmt(hasAncestor(Loop)), doStmt(hasAncestor(Loop))));
   38                  whileStmt(hasAncestor(Loop)), doStmt(hasAncestor(Loop))));
   40   Finder->addMatcher(gotoStmt(anyOf(unless(hasAncestor(NestedLoop)),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/InitVariablesCheck.cpp
   32   Finder->addMatcher(varDecl(unless(hasInitializer(anything())),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/InterfacesGlobalInitCheck.cpp
   21       varDecl(hasGlobalStorage(),
   27   const auto ReferencesUndefinedGlobalVar = declRefExpr(hasDeclaration(
   28       varDecl(GlobalVarDecl, unless(isDefinition())).bind("referencee")));
   31       varDecl(GlobalVarDecl, isDefinition(),
   32               hasInitializer(expr(hasDescendant(ReferencesUndefinedGlobalVar))))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/NarrowingConversionsCheck.cpp
   35   const auto IsCeilFloorCallExpr = expr(callExpr(callee(functionDecl(
   35   const auto IsCeilFloorCallExpr = expr(callExpr(callee(functionDecl(
   35   const auto IsCeilFloorCallExpr = expr(callExpr(callee(functionDecl(
   36       hasAnyName("::ceil", "::std::ceil", "::floor", "::std::floor")))));
   42       implicitCastExpr(hasImplicitDestinationType(builtinType()),
   52   Finder->addMatcher(binaryOperator(isAssignmentOperator(),
   53                                     hasLHS(expr(hasType(builtinType()))),
   54                                     hasRHS(expr(hasType(builtinType()))),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/NoMallocCheck.cpp
   45   Finder->addMatcher(callExpr(callee(functionDecl(hasAnyListedName(AllocList))))
   45   Finder->addMatcher(callExpr(callee(functionDecl(hasAnyListedName(AllocList))))
   51       callExpr(callee(functionDecl(hasAnyListedName(ReallocList))))
   51       callExpr(callee(functionDecl(hasAnyListedName(ReallocList))))
   57       callExpr(callee(functionDecl(hasAnyListedName(DeallocList))))
   57       callExpr(callee(functionDecl(hasAnyListedName(DeallocList))))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
   45   const auto OwnerDecl = typeAliasTemplateDecl(hasName("::gsl::owner"));
   55       callExpr(callee(functionDecl(LegacyCreatorFunctions)));
   55       callExpr(callee(functionDecl(LegacyCreatorFunctions)));
   60       castExpr(hasSourceExpression(CreatesLegacyOwner));
   63   const auto LegacyOwnerConsumers = functionDecl(LegacyConsumerFunctions);
   67             callExpr(callee(
   68                 functionDecl(returns(qualType(hasDeclaration(OwnerDecl)))))),
   68                 functionDecl(returns(qualType(hasDeclaration(OwnerDecl)))))),
   75       cxxDeleteExpr(
   77               declRefExpr(unless(ConsideredOwner)).bind("deleted_variable")))
   89       callExpr(callee(LegacyOwnerConsumers),
   90                hasAnyArgument(expr(unless(ignoringImpCasts(ConsideredOwner)),
   97   Finder->addMatcher(binaryOperator(matchers::isAssignmentOperator(),
  105       namedDecl(varDecl(hasInitializer(unless(ConsideredOwner)), IsOwnerType)
  105       namedDecl(varDecl(hasInitializer(unless(ConsideredOwner)), IsOwnerType)
  110       has(cxxConstructorDecl(forEachConstructorInitializer(
  111           cxxCtorInitializer(
  121   Finder->addMatcher(cxxRecordDecl(HasConstructorInitializerForOwner), this);
  125   Finder->addMatcher(binaryOperator(matchers::isAssignmentOperator(),
  134       namedDecl(varDecl(eachOf(allOf(hasInitializer(CreatesOwner),
  134       namedDecl(varDecl(eachOf(allOf(hasInitializer(CreatesOwner),
  144       callExpr(forEachArgumentWithParam(
  145           expr(unless(ConsideredOwner)).bind("expected_owner_argument"),
  146           parmVarDecl(IsOwnerType))),
  151   Finder->addMatcher(callExpr(forEachArgumentWithParam(
  152                          expr(CreatesOwner).bind("bad_owner_creation_argument"),
  153                          parmVarDecl(unless(IsOwnerType))
  160       functionDecl(hasDescendant(returnStmt(hasReturnValue(ConsideredOwner))
  160       functionDecl(hasDescendant(returnStmt(hasReturnValue(ConsideredOwner))
  162                    unless(returns(qualType(hasDeclaration(OwnerDecl)))))
  169       cxxRecordDecl(
  170           has(fieldDecl(IsOwnerType).bind("undestructed_owner_member")),
  172                 has(cxxDestructorDecl(anyOf(isDefaulted(), isDeleted())))))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProBoundsArrayToPointerDecayCheck.cpp
   29   return stmt(hasAncestor(cxxForRangeStmt(
   29   return stmt(hasAncestor(cxxForRangeStmt(
   60       implicitCastExpr(
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
   50       arraySubscriptExpr(
   57       cxxOperatorCallExpr(
   60               0, hasType(cxxRecordDecl(hasName("::std::array")).bind("type"))),
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()))));
   25       hasType(decltypeType(hasUnderlyingType(pointerType()))));
   29       binaryOperator(
   33           unless(hasLHS(ignoringImpCasts(declRefExpr(to(isImplicit()))))))
   38       unaryOperator(anyOf(hasOperatorName("++"), hasOperatorName("--")),
   45       arraySubscriptExpr(
   48                     hasType(decayedType(hasDecayedType(pointerType())))))))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
   37       cStyleCastExpr(unless(isInTemplateInstantiation())).bind("cast"), this);
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
   51       match(findAll(binaryOperator(
   53                 hasLHS(memberExpr(member(fieldDecl().bind("fieldDecl")))))),
  265       hasParent(cxxRecordDecl(unless(isTriviallyDefaultConstructible()))));
  267       cxxConstructorDecl(isDefinition(),
  276       cxxRecordDecl(
  278           anyOf(has(cxxConstructorDecl(isDefaultConstructor(), isDefaulted(),
  286       cxxConstructExpr(unless(requiresZeroInitialization()),
  287                        hasDeclaration(cxxConstructorDecl(
  290       varDecl(isDefinition(), HasDefaultConstructor,
  292               hasType(recordDecl(has(fieldDecl()),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeStaticCastDowncastCheck.cpp
   24       cxxStaticCastExpr(unless(isInTemplateInstantiation())).bind("cast"),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeUnionAccessCheck.cpp
   24       memberExpr(hasObjectExpression(hasType(recordDecl(isUnion()))))
   24       memberExpr(hasObjectExpression(hasType(recordDecl(isUnion()))))
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeVarargCheck.cpp
   28       callExpr(callee(functionDecl(isVariadic()))).bind("callvararg"), this);
   28       callExpr(callee(functionDecl(isVariadic()))).bind("callvararg"), this);
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp
   40       cxxRecordDecl(isDerivedFrom(equalsBoundNode("BaseDecl")))
   46       hasParent(cxxConstructorDecl(ofClass(equalsBoundNode("DerivedDecl"))));
   50       callExpr(callee(cxxMethodDecl(anyOf(isCopyAssignmentOperator(),
   50       callExpr(callee(cxxMethodDecl(anyOf(isCopyAssignmentOperator(),
   57   const auto SlicesObjectInCtor = cxxConstructExpr(
   58       hasDeclaration(cxxConstructorDecl(
   66       expr(anyOf(SlicesObjectInAssignment, SlicesObjectInCtor)).bind("Call"),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/SpecialMemberFunctionsCheck.cpp
   40       cxxRecordDecl(
   42               has(cxxDestructorDecl(unless(isImplicit())).bind("dtor")),
   43               has(cxxConstructorDecl(isCopyConstructor(), unless(isImplicit()))
   45               has(cxxMethodDecl(isCopyAssignmentOperator(),
   48               has(cxxConstructorDecl(isMoveConstructor(), unless(isImplicit()))
   50               has(cxxMethodDecl(isMoveAssignmentOperator(),
tools/clang/tools/extra/clang-tidy/darwin/AvoidSpinlockCheck.cpp
   21       callExpr(callee((functionDecl(hasAnyName(
   21       callExpr(callee((functionDecl(hasAnyName(
   21       callExpr(callee((functionDecl(hasAnyName(
tools/clang/tools/extra/clang-tidy/darwin/DispatchOnceNonstaticCheck.cpp
   27       varDecl(hasLocalStorage(), hasType(asString("dispatch_once_t")))
   35       objcIvarDecl(hasType(asString("dispatch_once_t"))).bind("ivar"), this);
tools/clang/tools/extra/clang-tidy/fuchsia/DefaultArgumentsDeclarationsCheck.cpp
   19   Finder->addMatcher(parmVarDecl(hasDefaultArgument()).bind("decl"), this);
tools/clang/tools/extra/clang-tidy/fuchsia/MultipleInheritanceCheck.cpp
   97       cxxRecordDecl(allOf(hasBases(), isDefinition())).bind("decl"), this);
tools/clang/tools/extra/clang-tidy/fuchsia/OverloadedOperatorCheck.cpp
   31   Finder->addMatcher(functionDecl(isFuchsiaOverloadedOperator()).bind("decl"),
tools/clang/tools/extra/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp
   36   Finder->addMatcher(varDecl(
   40                          hasDescendant(cxxConstructExpr(unless(allOf(
   42                              hasDeclaration(cxxConstructorDecl(isConstexpr())),
tools/clang/tools/extra/clang-tidy/fuchsia/TrailingReturnCheck.cpp
   36       functionDecl(hasTrailingReturn(),
   38                                 hasParent(cxxRecordDecl(isLambda())))))
tools/clang/tools/extra/clang-tidy/fuchsia/VirtualInheritanceCheck.cpp
   31   Finder->addMatcher(cxxRecordDecl(hasDirectVirtualBaseClass()).bind("decl"),
tools/clang/tools/extra/clang-tidy/google/AvoidCStyleCastsCheck.cpp
   25       cStyleCastExpr(
  110   if (!match(expr(hasAncestor(linkageSpecDecl())), *CastExpr, *Result.Context)
tools/clang/tools/extra/clang-tidy/google/AvoidNSObjectNewCheck.cpp
  101       objcMessageExpr(isClassMessage(), hasSelector("new")).bind("new_call"),
  104       objcMethodDecl(isClassMethod(), isDefinition(), hasName("new"))
tools/clang/tools/extra/clang-tidy/google/AvoidThrowingObjCExceptionCheck.cpp
   27       objcMessageExpr(anyOf(hasSelector("raise:format:"),
tools/clang/tools/extra/clang-tidy/google/DefaultArgumentsCheck.cpp
   21       cxxMethodDecl(anyOf(isOverride(), isVirtual()),
   22                     hasAnyParameter(parmVarDecl(hasInitializer(expr()))))
tools/clang/tools/extra/clang-tidy/google/ExplicitConstructorCheck.cpp
   27       cxxConstructorDecl(unless(anyOf(isImplicit(), // Compiler-generated.
   32       cxxConversionDecl(unless(anyOf(isExplicit(), // Already marked explicit.
tools/clang/tools/extra/clang-tidy/google/ExplicitMakePairCheck.cpp
   37       callExpr(unless(isInTemplateInstantiation()),
   38                callee(expr(ignoringParenImpCasts(
   39                    declRefExpr(hasExplicitTemplateArgs(),
   40                                to(functionDecl(hasName("::std::make_pair"))))
tools/clang/tools/extra/clang-tidy/google/FunctionNamingCheck.cpp
  103       functionDecl(
tools/clang/tools/extra/clang-tidy/google/GlobalNamesInHeadersCheck.cpp
   41   Finder->addMatcher(decl(anyOf(usingDecl(), usingDirectiveDecl()),
tools/clang/tools/extra/clang-tidy/google/GlobalVariableDeclarationCheck.cpp
   74       varDecl(hasGlobalStorage(), unless(hasType(isConstQualified())),
   78   Finder->addMatcher(varDecl(hasGlobalStorage(), hasType(isConstQualified()),
tools/clang/tools/extra/clang-tidy/google/IntegerTypesCheck.cpp
   66   Finder->addMatcher(typeLoc(loc(isInteger()),
   67                              unless(hasAncestor(callExpr(
   68                                  callee(functionDecl(hasAttr(attr::Format)))))))
tools/clang/tools/extra/clang-tidy/google/NonConstReferences.cpp
   38       parmVarDecl(
   41               qualType(unless(isConstQualified())).bind("referenced_type"))),
tools/clang/tools/extra/clang-tidy/google/OverloadedUnaryAndCheck.cpp
   30       cxxMethodDecl(parameterCountIs(0), hasOverloadedOperatorName("&"))
   35   Finder->addMatcher(functionDecl(unless(cxxMethodDecl()), parameterCountIs(1),
tools/clang/tools/extra/clang-tidy/google/UnnamedNamespaceInHeaderCheck.cpp
   43     Finder->addMatcher(namespaceDecl(isAnonymous()).bind("anonymousNamespace"),
tools/clang/tools/extra/clang-tidy/google/UpgradeGoogletestCaseCheck.cpp
  143       cxxMethodDecl(
  145               cxxMethodDecl(
  146                   hasAnyName("SetUpTestCase", "TearDownTestCase"),
  148                       cxxRecordDecl(isSameOrDerivedFrom(cxxRecordDecl(
  148                       cxxRecordDecl(isSameOrDerivedFrom(cxxRecordDecl(
  152               cxxMethodDecl(
  155                       cxxRecordDecl(isSameOrDerivedFrom(cxxRecordDecl(
  155                       cxxRecordDecl(isSameOrDerivedFrom(cxxRecordDecl(
  159               cxxMethodDecl(
  160                   hasAnyName("OnTestCaseStart", "OnTestCaseEnd"),
  161                   ofClass(cxxRecordDecl(
  162                               isSameOrDerivedFrom(cxxRecordDecl(
  166               cxxMethodDecl(
  167                   hasAnyName("current_test_case", "successful_test_case_count",
  170                   ofClass(cxxRecordDecl(
  171                               isSameOrDerivedFrom(cxxRecordDecl(
  177   Finder->addMatcher(expr(anyOf(callExpr(callee(Methods)).bind("call"),
  177   Finder->addMatcher(expr(anyOf(callExpr(callee(Methods)).bind("call"),
  178                                 declRefExpr(to(Methods)).bind("ref")),
  183       usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(Methods)), LocationFilter)
  187   Finder->addMatcher(cxxMethodDecl(Methods, LocationFilter), this);
  193       typeAliasDecl(hasName("::testing::TestCase")).bind("test-case");
  195       typeLoc(loc(qualType(typedefType(hasDeclaration(TestCaseTypeAlias)))),
  195       typeLoc(loc(qualType(typedefType(hasDeclaration(TestCaseTypeAlias)))),
  195       typeLoc(loc(qualType(typedefType(hasDeclaration(TestCaseTypeAlias)))),
  196               unless(hasAncestor(decl(isImplicit()))), LocationFilter)
  200       usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(TestCaseTypeAlias)))
  237       hasAncestor(decl(anyOf(classTemplateDecl(), functionTemplateDecl())));
  245   return !match(cxxRecordDecl(
  248                     hasMethod(cxxMethodDecl(hasName(ReplacementMethod)))),
tools/clang/tools/extra/clang-tidy/hicpp/ExceptionBaseclassCheck.cpp
   24       cxxThrowExpr(
   25           unless(has(expr(anyOf(isTypeDependent(), isValueDependent())))),
   27           has(expr(unless(
   28               hasType(qualType(hasCanonicalType(hasDeclaration(cxxRecordDecl(
   28               hasType(qualType(hasCanonicalType(hasDeclaration(cxxRecordDecl(
   32           anyOf(has(expr(
   39           eachOf(has(expr(hasType(namedDecl().bind("decl")))), anything()))
tools/clang/tools/extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
   27       switchStmt(
   28           hasCondition(expr(
   32               anyOf(ignoringImpCasts(memberExpr(hasDeclaration(
   33                         fieldDecl(isBitField()).bind("bitfield")))),
   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
   29   Finder->addMatcher(varDecl(isAsm()).bind("asm-var"), this);
tools/clang/tools/extra/clang-tidy/hicpp/SignedBitwiseCheck.cpp
   22       expr(ignoringImpCasts(hasType(isSignedInteger()))).bind("signed-operand");
   28   const auto BitmaskType = namedDecl(
   29       hasAnyName("::std::locale::category", "::std::ctype_base::mask",
   32   const auto IsStdBitmask = ignoringImpCasts(declRefExpr(hasType(BitmaskType)));
   36       binaryOperator(anyOf(hasOperatorName("^"), hasOperatorName("|"),
   50       binaryOperator(anyOf(hasOperatorName("<<"), hasOperatorName(">>"),
   59       unaryOperator(hasOperatorName("~"), hasUnaryOperand(SignedIntegerOperand))
tools/clang/tools/extra/clang-tidy/linuxkernel/MustCheckErrsCheck.cpp
   21       functionDecl(hasAnyName("ERR_PTR", "PTR_ERR", "IS_ERR", "IS_ERR_OR_NULL",
   21       functionDecl(hasAnyName("ERR_PTR", "PTR_ERR", "IS_ERR", "IS_ERR_OR_NULL",
   23   auto NonCheckingStmts = stmt(anyOf(compoundStmt(), labelStmt()));
   25       callExpr(callee(ErrFn), hasParent(NonCheckingStmts)).bind("call"),
   28   auto ReturnToCheck = returnStmt(hasReturnValue(callExpr(callee(ErrFn))));
   28   auto ReturnToCheck = returnStmt(hasReturnValue(callExpr(callee(ErrFn))));
   29   auto ReturnsErrFn = functionDecl(hasDescendant(ReturnToCheck));
   30   Finder->addMatcher(callExpr(callee(ReturnsErrFn), hasParent(NonCheckingStmts))
tools/clang/tools/extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
   29   auto Condition = hasCondition(implicitCastExpr(has(
   30       callExpr(
   32                 anyOf(callee(namedDecl(hasName("cast"))),
   33                       callee(namedDecl(hasName("dyn_cast")).bind("dyn_cast")))))
   37       has(declStmt(containsDeclaration(
   39           varDecl(hasInitializer(
   40               callExpr(allOf(unless(isMacroID()), unless(cxxMemberCallExpr()),
   41                              callee(namedDecl(hasName("cast")))))
   46       callExpr(
   48                 allOf(callee(namedDecl(anyOf(hasName("isa"), hasName("cast"),
   58       stmt(anyOf(ifStmt(Any), whileStmt(Any), doStmt(Condition),
   58       stmt(anyOf(ifStmt(Any), whileStmt(Any), doStmt(Condition),
   58       stmt(anyOf(ifStmt(Any), whileStmt(Any), doStmt(Condition),
   58       stmt(anyOf(ifStmt(Any), whileStmt(Any), doStmt(Condition),
   59                  binaryOperator(
   64                            hasRHS(anyOf(implicitCastExpr(has(CallExpression)),
tools/clang/tools/extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
   21       cxxRecordDecl(hasName("::llvm::Register")).bind("registerClassDecl"));
   24       valueDecl(allOf(
   25           hasType(qualType(isUnsignedInteger()).bind("varType")),
   26           varDecl(hasInitializer(exprWithCleanups(has(implicitCastExpr(has(
   26           varDecl(hasInitializer(exprWithCleanups(has(implicitCastExpr(has(
   26           varDecl(hasInitializer(exprWithCleanups(has(implicitCastExpr(has(
   27                       cxxMemberCallExpr(allOf(on(RegisterClassMatch),
   28                                               has(memberExpr(hasDeclaration(
tools/clang/tools/extra/clang-tidy/llvm/TwineLocalCheck.cpp
   22       qualType(hasDeclaration(recordDecl(hasName("::llvm::Twine"))));
   22       qualType(hasDeclaration(recordDecl(hasName("::llvm::Twine"))));
   23   Finder->addMatcher(varDecl(hasType(TwineType)).bind("variable"), this);
tools/clang/tools/extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
   55       anyOf(functionDecl(isDefinition(), unless(isDeleted())),
   56             varDecl(isDefinition()));
   58     Finder->addMatcher(namedDecl(DefinitionMatcher,
   64         namedDecl(DefinitionMatcher,
tools/clang/tools/extra/clang-tidy/misc/MisplacedConstCheck.cpp
   21       valueDecl(hasType(isConstQualified()),
   22                 hasType(typedefType(hasDeclaration(
   23                     typedefDecl(hasType(pointerType(unless(pointee(
   23                     typedefDecl(hasType(pointerType(unless(pointee(
   23                     typedefDecl(hasType(pointerType(unless(pointee(
tools/clang/tools/extra/clang-tidy/misc/NewDeleteOverloadsCheck.cpp
  144       functionDecl(unless(anyOf(isImplicit(), isPlacementOverload(),
  145                                 isDeleted(), cxxMethodDecl(isPrivate()))),
tools/clang/tools/extra/clang-tidy/misc/NonCopyableObjects.cpp
   37       namedDecl(hasAnyName("::FILE", "FILE", "std::FILE")).bind("type_decl"));
   37       namedDecl(hasAnyName("::FILE", "FILE", "std::FILE")).bind("type_decl"));
   39       hasType(namedDecl(hasAnyName("::pthread_cond_t", "::pthread_mutex_t",
   39       hasType(namedDecl(hasAnyName("::pthread_cond_t", "::pthread_mutex_t",
   45       namedDecl(anyOf(varDecl(BadFILEType), fieldDecl(BadFILEType)))
   45       namedDecl(anyOf(varDecl(BadFILEType), fieldDecl(BadFILEType)))
   45       namedDecl(anyOf(varDecl(BadFILEType), fieldDecl(BadFILEType)))
   48   Finder->addMatcher(parmVarDecl(BadPOSIXType).bind("decl"), this);
   50       expr(unaryOperator(hasOperatorName("*"), BadEitherType)).bind("expr"),
   50       expr(unaryOperator(hasOperatorName("*"), BadEitherType)).bind("expr"),
tools/clang/tools/extra/clang-tidy/misc/NonPrivateMemberVariablesInClassesCheck.cpp
   31   return cxxRecordDecl(has(fieldDecl(unless(isPublic()))))
   31   return cxxRecordDecl(has(fieldDecl(unless(isPublic()))))
   65   auto InterestingField = fieldDecl(
   72   Finder->addMatcher(cxxRecordDecl(anyOf(isStruct(), isClass()), hasMethods(),
tools/clang/tools/extra/clang-tidy/misc/RedundantExpressionCheck.cpp
  339   return expr(isIntegerConstantExpr()).bind(CstId);
  365       expr(unless(isIntegerConstantExpr())).bind(SymId));
  385       expr(
  386           anyOf(binaryOperator(anyOf(hasOperatorName("+"), hasOperatorName("|"),
  390                 binaryOperator(hasOperatorName("-"),
  419   const auto RelationalExpr = ignoringParenImpCasts(binaryOperator(
  429       implicitCastExpr(hasCastKind(CK_IntegralToBoolean),
  434       unaryOperator(hasOperatorName("!"),
  440       unaryOperator(hasOperatorName("!"),
  441                     hasUnaryOperand(unaryOperator(
  446       cxxOperatorCallExpr(
  643       integerLiteral(expandedByMacro(KnownBannedMacroNames));
  647       binaryOperator(anyOf(hasOperatorName("-"), hasOperatorName("/"),
  665   Finder->addMatcher(conditionalOperator(expressionsAreEquivalent(),
  674       cxxOperatorCallExpr(
  692       implicitCastExpr(
  694           has(unaryOperator(
  696                   hasUnaryOperand(ignoringParenImpCasts(binaryOperator(
  698                       hasLHS(anyOf(binaryOperator(anyOf(hasOperatorName("|"),
  707       binaryOperator(hasOperatorName("&"),
  708                      hasEitherOperand(ignoringParenImpCasts(binaryOperator(
  729   Finder->addMatcher(binaryOperator(isComparisonOperator(),
  737       binaryOperator(isComparisonOperator(),
  744   Finder->addMatcher(binaryOperator(isComparisonOperator(),
  759       binaryOperator(anyOf(hasOperatorName("||"), hasOperatorName("&&")),
tools/clang/tools/extra/clang-tidy/misc/StaticAssertCheck.cpp
   35   auto NegatedString = unaryOperator(
   38       expr(anyOf(cxxBoolLiteral(equals(false)), integerLiteral(equals(0)),
   38       expr(anyOf(cxxBoolLiteral(equals(false)), integerLiteral(equals(0)),
   38       expr(anyOf(cxxBoolLiteral(equals(false)), integerLiteral(equals(0)),
   42       IsAlwaysFalse, cStyleCastExpr(has(ignoringParenImpCasts(IsAlwaysFalse)))
   45       binaryOperator(
   48           anyOf(binaryOperator(hasEitherOperand(IsAlwaysFalseWithCast)),
   53       callExpr(hasDeclaration(functionDecl(unless(isConstexpr()))));
   53       callExpr(hasDeclaration(functionDecl(unless(isConstexpr()))));
   55       expr(
   56           anyOf(expr(ignoringParenCasts(anyOf(
   57                     AssertExprRoot, unaryOperator(hasUnaryOperand(
   63       anyOf(ignoringParenImpCasts(callExpr(
   64                 hasDeclaration(functionDecl(hasName("__builtin_expect"))),
   68   Finder->addMatcher(conditionalOperator(hasCondition(Condition),
   74       ifStmt(hasCondition(Condition), unless(isInTemplateInstantiation()))
tools/clang/tools/extra/clang-tidy/misc/UnconventionalAssignOperatorCheck.cpp
   26   const auto HasGoodReturnType = cxxMethodDecl(returns(lValueReferenceType(
   26   const auto HasGoodReturnType = cxxMethodDecl(returns(lValueReferenceType(
   27       pointee(unless(isConstQualified()),
   30   const auto IsSelf = qualType(
   32             referenceType(pointee(hasDeclaration(equalsBoundNode("class"))))));
   32             referenceType(pointee(hasDeclaration(equalsBoundNode("class"))))));
   34       cxxMethodDecl(unless(anyOf(isDeleted(), isPrivate(), isImplicit())),
   38       cxxMethodDecl(IsAssign, hasParameter(0, parmVarDecl(hasType(IsSelf))))
   38       cxxMethodDecl(IsAssign, hasParameter(0, parmVarDecl(hasType(IsSelf))))
   42       cxxMethodDecl(IsAssign, unless(HasGoodReturnType)).bind("ReturnType"),
   45   const auto BadSelf = referenceType(
   46       anyOf(lValueReferenceType(pointee(unless(isConstQualified()))),
   46       anyOf(lValueReferenceType(pointee(unless(isConstQualified()))),
   47             rValueReferenceType(pointee(isConstQualified()))));
   47             rValueReferenceType(pointee(isConstQualified()))));
   50       cxxMethodDecl(IsSelfAssign,
   51                     hasParameter(0, parmVarDecl(hasType(BadSelf))))
   56       cxxMethodDecl(IsSelfAssign, anyOf(isConst(), isVirtual())).bind("cv"),
   59   const auto IsBadReturnStatement = returnStmt(unless(has(ignoringParenImpCasts(
   60       anyOf(unaryOperator(hasOperatorName("*"), hasUnaryOperand(cxxThisExpr())),
   61             cxxOperatorCallExpr(argumentCountIs(1),
   64   const auto IsGoodAssign = cxxMethodDecl(IsAssign, HasGoodReturnType);
   66   Finder->addMatcher(returnStmt(IsBadReturnStatement, forFunction(IsGoodAssign))
tools/clang/tools/extra/clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
   26       cxxMemberCallExpr(
   29               cxxMethodDecl(hasName("reset"),
   30                             ofClass(cxxRecordDecl(hasName("::std::unique_ptr"),
   32           has(ignoringParenImpCasts(cxxMemberCallExpr(
   35               callee(cxxMethodDecl(
   37                   ofClass(cxxRecordDecl(hasName("::std::unique_ptr"),
tools/clang/tools/extra/clang-tidy/misc/UnusedAliasDeclsCheck.cpp
   28   Finder->addMatcher(namespaceAliasDecl(isExpansionInMainFile()).bind("alias"),
tools/clang/tools/extra/clang-tidy/misc/UnusedParametersCheck.cpp
   33       functionDecl(isDefinition(), hasBody(stmt()), hasAnyParameter(decl()))
tools/clang/tools/extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
   54   Finder->addMatcher(usingDecl(isExpansionInMainFile()).bind("using"), this);
   56   Finder->addMatcher(loc(enumType(DeclMatcher)), this);
   57   Finder->addMatcher(loc(recordType(DeclMatcher)), this);
   58   Finder->addMatcher(loc(templateSpecializationType(DeclMatcher)), this);
   60   Finder->addMatcher(callExpr(callee(unresolvedLookupExpr().bind("used"))),
   63       callExpr(hasDeclaration(functionDecl(
   63       callExpr(hasDeclaration(functionDecl(
   66   Finder->addMatcher(loc(templateSpecializationType(forEachTemplateArgument(
tools/clang/tools/extra/clang-tidy/modernize/AvoidBindCheck.cpp
  124       callExpr(
  125           callee(namedDecl(hasName("::std::bind"))),
  126           hasArgument(0, declRefExpr(to(functionDecl().bind("f"))).bind("ref")))
tools/clang/tools/extra/clang-tidy/modernize/AvoidCArraysCheck.cpp
   51       typeLoc(hasValidBeginLoc(), hasType(arrayType()),
   52               unless(anyOf(hasParent(parmVarDecl(isArgvOfMain())),
   53                            hasParent(varDecl(isExternC())),
   54                            hasParent(fieldDecl(
   55                                hasParent(recordDecl(isExternCContext())))),
   56                            hasAncestor(functionDecl(isExternC())))))
tools/clang/tools/extra/clang-tidy/modernize/DeprecatedIosBaseAliasesCheck.cpp
   37   auto IoStateDecl = typedefDecl(hasAnyName(DeprecatedTypes)).bind("TypeDecl");
   39       qualType(hasDeclaration(IoStateDecl), unless(elaboratedType()));
   41   Finder->addMatcher(typeLoc(loc(IoStateType)).bind("TypeLoc"), this);
tools/clang/tools/extra/clang-tidy/modernize/LoopConvertCheck.cpp
   50   return expr(ignoringParenImpCasts(
   51       declRefExpr(to(varDecl(hasType(isInteger())).bind(ConditionVarName)))));
   51       declRefExpr(to(varDecl(hasType(isInteger())).bind(ConditionVarName)))));
   55   return varDecl(
   56              hasInitializer(ignoringParenImpCasts(integerLiteral(equals(0)))))
   61   return declRefExpr(to(varDecl(hasType(isInteger())).bind(IncrementVarName)));
   61   return declRefExpr(to(varDecl(hasType(isInteger())).bind(IncrementVarName)));
   84       expr(hasType(isInteger())).bind(ConditionBoundName);
   86   return forStmt(
   88              hasLoopInit(declStmt(hasSingleDecl(InitToZeroMatcher()))),
   90                  binaryOperator(hasOperatorName("<"),
   93                  binaryOperator(hasOperatorName(">"), hasLHS(ArrayBoundMatcher),
   95              hasIncrement(unaryOperator(hasOperatorName("++"),
  129       cxxMemberCallExpr(
  131           callee(cxxMethodDecl(anyOf(hasName("begin"), hasName("cbegin")))))
  135       varDecl(hasInitializer(anyOf(ignoringParenImpCasts(BeginCallMatcher),
  136                                    materializeTemporaryExpr(
  142       varDecl(hasInitializer(anything())).bind(EndVarName);
  144   StatementMatcher EndCallMatcher = cxxMemberCallExpr(
  146       callee(cxxMethodDecl(anyOf(hasName("end"), hasName("cend")))));
  149       expr(anyOf(ignoringParenImpCasts(
  150                      declRefExpr(to(varDecl().bind(ConditionEndVarName)))),
  151                  ignoringParenImpCasts(expr(EndCallMatcher).bind(EndCallName)),
  152                  materializeTemporaryExpr(ignoringParenImpCasts(
  153                      expr(EndCallMatcher).bind(EndCallName)))));
  155   StatementMatcher IteratorComparisonMatcher = expr(
  156       ignoringParenImpCasts(declRefExpr(to(varDecl().bind(ConditionVarName)))));
  159       cxxOperatorCallExpr(hasOverloadedOperatorName("!="), argumentCountIs(2),
  168           recordType(hasDeclaration(cxxRecordDecl(hasMethod(cxxMethodDecl(
  168           recordType(hasDeclaration(cxxRecordDecl(hasMethod(cxxMethodDecl(
  168           recordType(hasDeclaration(cxxRecordDecl(hasMethod(cxxMethodDecl(
  172                   returns(qualType(unless(hasCanonicalType(referenceType())))
  177                       qualType(unless(hasCanonicalType(rValueReferenceType())))
  180   return forStmt(
  182              hasLoopInit(anyOf(declStmt(declCountIs(2),
  185                                declStmt(hasSingleDecl(InitDeclMatcher)))),
  187                  anyOf(binaryOperator(hasOperatorName("!="),
  190                        binaryOperator(hasOperatorName("!="),
  195                  unaryOperator(hasOperatorName("++"),
  196                                hasUnaryOperand(declRefExpr(
  197                                    to(varDecl(hasType(pointsTo(AnyType())))
  199                  cxxOperatorCallExpr(
  202                          0, declRefExpr(to(varDecl(TestDerefReturnsByValue)
  202                          0, declRefExpr(to(varDecl(TestDerefReturnsByValue)
  248   TypeMatcher RecordWithBeginEnd = qualType(anyOf(
  249       qualType(
  251           hasUnqualifiedDesugaredType(recordType(hasDeclaration(cxxRecordDecl(
  251           hasUnqualifiedDesugaredType(recordType(hasDeclaration(cxxRecordDecl(
  252               hasMethod(cxxMethodDecl(hasName("begin"), isConst())),
  253               hasMethod(cxxMethodDecl(hasName("end"),
  256       qualType(unless(isConstQualified()),
  257                hasUnqualifiedDesugaredType(recordType(hasDeclaration(
  258                    cxxRecordDecl(hasMethod(hasName("begin")),
  262   StatementMatcher SizeCallMatcher = cxxMemberCallExpr(
  264       callee(cxxMethodDecl(anyOf(hasName("size"), hasName("length")))),
  269       expr(anyOf(ignoringParenImpCasts(expr(SizeCallMatcher).bind(EndCallName)),
  269       expr(anyOf(ignoringParenImpCasts(expr(SizeCallMatcher).bind(EndCallName)),
  270                  explicitCastExpr(hasSourceExpression(ignoringParenImpCasts(
  271                      expr(SizeCallMatcher).bind(EndCallName))))));
  274       varDecl(hasInitializer(EndInitMatcher)).bind(EndVarName);
  277       expr(anyOf(ignoringParenImpCasts(declRefExpr(to(
  277       expr(anyOf(ignoringParenImpCasts(declRefExpr(to(
  278                      varDecl(hasType(isInteger())).bind(ConditionEndVarName)))),
  281   return forStmt(
  284                  anyOf(declStmt(declCountIs(2),
  287                        declStmt(hasSingleDecl(InitToZeroMatcher())))),
  289                  binaryOperator(hasOperatorName("<"),
  292                  binaryOperator(hasOperatorName(">"), hasLHS(IndexBoundMatcher),
  294              hasIncrement(unaryOperator(hasOperatorName("++"),
tools/clang/tools/extra/clang-tidy/modernize/MakeSharedCheck.cpp
   22   return qualType(hasUnqualifiedDesugaredType(
   23       recordType(hasDeclaration(classTemplateSpecializationDecl(
   23       recordType(hasDeclaration(classTemplateSpecializationDecl(
   25           hasTemplateArgument(0, templateArgument(refersToType(
tools/clang/tools/extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
   85       cxxConstructExpr(hasDeclaration(decl(unless(isPublic())))))));
   85       cxxConstructExpr(hasDeclaration(decl(unless(isPublic())))))));
   88       cxxBindTemporaryExpr(has(ignoringParenImpCasts(
   89           cxxConstructExpr(
   92                           cxxNewExpr(hasType(pointsTo(qualType(hasCanonicalType(
   92                           cxxNewExpr(hasType(pointsTo(qualType(hasCanonicalType(
  101       cxxMemberCallExpr(
  103           callee(cxxMethodDecl(hasName("reset"))),
  104           hasArgument(0, cxxNewExpr(CanCallCtor).bind(NewExpression)),
tools/clang/tools/extra/clang-tidy/modernize/MakeUniqueCheck.cpp
   24   return qualType(hasUnqualifiedDesugaredType(
   25       recordType(hasDeclaration(classTemplateSpecializationDecl(
   25       recordType(hasDeclaration(classTemplateSpecializationDecl(
   28               0, templateArgument(refersToType(qualType().bind(PointerType)))),
   30               1, templateArgument(refersToType(
   31                      qualType(hasDeclaration(classTemplateSpecializationDecl(
   31                      qualType(hasDeclaration(classTemplateSpecializationDecl(
   35                              0, templateArgument(refersToType(qualType(
   35                              0, templateArgument(refersToType(qualType(
tools/clang/tools/extra/clang-tidy/modernize/PassByValueCheck.cpp
   50   return lValueReferenceType(pointee(isConstQualified()));
   50   return lValueReferenceType(pointee(isConstQualified()));
   54   return qualType(unless(anyOf(referenceType(), isConstQualified())));
  139       cxxConstructorDecl(
  141               cxxCtorInitializer(
  147                   withInitializer(cxxConstructExpr(
  148                       has(ignoringParenImpCasts(declRefExpr(to(
  149                           parmVarDecl(
  150                               hasType(qualType(
  158                       hasDeclaration(cxxConstructorDecl(
  161                               cxxRecordDecl(isMoveConstructible())))))))
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
   50   Finder->addMatcher(functionDecl(parameterCountIs(0), unless(isImplicit()),
   55   auto ParenFunctionType = parenType(innerType(functionType()));
   55   auto ParenFunctionType = parenType(innerType(functionType()));
   56   auto PointerToFunctionType = pointee(ParenFunctionType);
   58       anyOf(hasType(pointerType(PointerToFunctionType)),
   59             hasType(memberPointerType(PointerToFunctionType)));
   60   Finder->addMatcher(fieldDecl(FunctionOrMemberPointer).bind(FieldId), this);
   61   Finder->addMatcher(varDecl(FunctionOrMemberPointer).bind(VarId), this);
   65       cStyleCastExpr(CastDestinationIsFunction).bind(CStyleCastId), this);
   67       cxxStaticCastExpr(CastDestinationIsFunction).bind(NamedCastId), this);
   69       cxxReinterpretCastExpr(CastDestinationIsFunction).bind(NamedCastId),
   72       cxxConstCastExpr(CastDestinationIsFunction).bind(NamedCastId), this);
tools/clang/tools/extra/clang-tidy/modernize/ReplaceAutoPtrCheck.cpp
   91   auto AutoPtrDecl = recordDecl(hasName("auto_ptr"), isFromStdNamespace());
   92   auto AutoPtrType = qualType(hasDeclaration(AutoPtrDecl));
  102   Finder->addMatcher(typeLoc(loc(qualType(AutoPtrType,
  102   Finder->addMatcher(typeLoc(loc(qualType(AutoPtrType,
  111   Finder->addMatcher(usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(namedDecl(
  111   Finder->addMatcher(usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(namedDecl(
  123       expr(isLValue(), hasType(AutoPtrType)).bind(AutoPtrOwnershipTransferId);
  126       cxxOperatorCallExpr(hasOverloadedOperatorName("="),
  127                           callee(cxxMethodDecl(ofClass(AutoPtrDecl))),
  130   Finder->addMatcher(cxxConstructExpr(hasType(AutoPtrType), argumentCountIs(1),
tools/clang/tools/extra/clang-tidy/modernize/ReplaceRandomShuffleCheck.cpp
   37       callExpr(anyOf(allOf(Begin, End, argumentCountIs(2)),
   39                hasDeclaration(functionDecl(hasName("::std::random_shuffle"))),
   40                has(implicitCastExpr(has(declRefExpr().bind("name")))))
tools/clang/tools/extra/clang-tidy/modernize/ReturnBracedInitListCheck.cpp
   28       cxxConstructExpr(
   29           unless(anyOf(hasDeclaration(cxxConstructorDecl(isExplicit())),
   34   auto CtorAsArgument = materializeTemporaryExpr(anyOf(
   35       has(ConstructExpr), has(cxxFunctionalCastExpr(has(ConstructExpr)))));
   38       functionDecl(isDefinition(), // Declarations don't have return statements.
   40                    hasDescendant(returnStmt(hasReturnValue(
   41                        has(cxxConstructExpr(has(CtorAsArgument)))))))
tools/clang/tools/extra/clang-tidy/modernize/ShrinkToFitCheck.cpp
   28       memberExpr(member(valueDecl().bind("ContainerDecl")));
   30       declRefExpr(hasDeclaration(valueDecl().bind("ContainerDecl")));
   31   const auto CopyCtorCall = cxxConstructExpr(hasArgument(
   33                unaryOperator(has(ignoringParenImpCasts(ShrinkableAsMember))),
   34                unaryOperator(has(ignoringParenImpCasts(ShrinkableAsDecl))))));
   36       expr(anyOf(memberExpr(member(equalsBoundNode("ContainerDecl"))),
   36       expr(anyOf(memberExpr(member(equalsBoundNode("ContainerDecl"))),
   37                  declRefExpr(hasDeclaration(equalsBoundNode("ContainerDecl"))),
   38                  unaryOperator(has(ignoringParenImpCasts(
   39                      memberExpr(member(equalsBoundNode("ContainerDecl")))))),
   40                  unaryOperator(has(ignoringParenImpCasts(declRefExpr(
   40                  unaryOperator(has(ignoringParenImpCasts(declRefExpr(
   44       cxxMemberCallExpr(
   45           on(hasType(hasCanonicalType(hasDeclaration(namedDecl(
   46               hasAnyName("std::basic_string", "std::deque", "std::vector")))))),
   47           callee(cxxMethodDecl(hasName("swap"))),
   48           has(ignoringParenImpCasts(memberExpr(hasDescendant(CopyCtorCall)))),
tools/clang/tools/extra/clang-tidy/modernize/UseAutoCheck.cpp
  213   return decl(
  214       namedDecl(hasStdIteratorName()),
  215       hasDeclContext(recordDecl(hasStdContainerName(), isFromStdNamespace())));
  221   return typedefType(hasDeclaration(standardIterator()));
  227   return recordType(hasDeclaration(standardIterator()));
  233   auto HasIteratorDecl = hasDeclaration(namedDecl(hasStdIteratorName()));
  235   return elaboratedType(
  238       hasQualifier(specifiesType(templateSpecializationType(hasDeclaration(
  239           namedDecl(hasStdContainerName(), isFromStdNamespace()))))),
  243           anyOf(typedefType(HasIteratorDecl), recordType(HasIteratorDecl))));
  243           anyOf(typedefType(HasIteratorDecl), recordType(HasIteratorDecl))));
  249   return declStmt(unless(has(
  250                       varDecl(anyOf(unless(hasWrittenNonListInitializer()),
  258   return declStmt(
  259              unless(has(varDecl(anyOf(
  264                  hasType(pointerType(
  265                      pointee(hasCanonicalType(hasLocalQualifiers())))),
  271                      pointsTo(parenType(innerType(functionType()))))))))))
  271                      pointsTo(parenType(innerType(functionType()))))))))))
  276   return declStmt(
  277              unless(has(varDecl(unless(hasInitializer(explicitCastExpr()))))))
  283       substTemplateTypeParmType(hasReplacementType(equalsBoundNode("arg")));
  283       substTemplateTypeParmType(hasReplacementType(equalsBoundNode("arg")));
  286       anyOf(has(memberExpr(hasExplicitTemplateArgs())),
  287             has(ignoringImpCasts(declRefExpr(hasExplicitTemplateArgs()))));
  292   auto TemplateCall = callExpr(
  294       callee(functionDecl(TemplateArg,
  297   return declStmt(unless(has(varDecl(
  297   return declStmt(unless(has(varDecl(
  303   return declStmt(
  307       has(varDecl(unless(isImplicit()))),
  309       unless(has(varDecl(anyOf(hasType(autoType()),
  310                                hasType(qualType(hasDescendant(autoType()))))))),
tools/clang/tools/extra/clang-tidy/modernize/UseBoolLiteralsCheck.cpp
   30       implicitCastExpr(
   32           hasImplicitDestinationType(qualType(booleanType())),
   38       conditionalOperator(
   39           hasParent(implicitCastExpr(
   40               hasImplicitDestinationType(qualType(booleanType())),
tools/clang/tools/extra/clang-tidy/modernize/UseDefaultMemberInitCheck.cpp
  198             unaryOperator(anyOf(hasOperatorName("+"), hasOperatorName("-")),
  201             unaryOperator(anyOf(hasOperatorName("+"), hasOperatorName("-")),
  204             declRefExpr(to(enumConstantDecl())));
  207       cxxConstructorDecl(
  210               cxxCtorInitializer(
  215                                         hasParent(recordDecl(isUnion()))))),
  221       cxxConstructorDecl(
  224               cxxCtorInitializer(forField(hasInClassInitializer(anything())),
tools/clang/tools/extra/clang-tidy/modernize/UseEmplaceCheck.cpp
   54   auto CallPushBack = cxxMemberCallExpr(
   55       hasDeclaration(functionDecl(hasName("push_back"))),
   56       on(hasType(cxxRecordDecl(hasAnyName(SmallVector<StringRef, 5>(
   63   auto IsCtorOfSmartPtr = hasDeclaration(cxxConstructorDecl(ofClass(hasAnyName(
   68       ignoringImplicit(memberExpr(hasDeclaration(fieldDecl(isBitField())))));
   68       ignoringImplicit(memberExpr(hasDeclaration(fieldDecl(isBitField())))));
   72       ignoringImplicit(cxxConstructExpr(isListInitialization())));
   78       hasParent(implicitCastExpr(hasCastKind(CastKind::CK_DerivedToBase)));
   81   auto IsPrivateCtor = hasDeclaration(cxxConstructorDecl(isPrivate()));
   89       cxxConstructExpr(
   97       callExpr(
   98           callee(expr(ignoringImplicit(declRefExpr(
   98           callee(expr(ignoringImplicit(declRefExpr(
  100               to(functionDecl(hasAnyName(SmallVector<StringRef, 2>(
  106   auto MakeTupleCtor = ignoringImplicit(cxxConstructExpr(
  107       has(materializeTemporaryExpr(MakeTuple)),
  108       hasDeclaration(cxxConstructorDecl(ofClass(hasAnyName(
  111   auto SoughtParam = materializeTemporaryExpr(
  113             HasConstructExpr, has(cxxFunctionalCastExpr(HasConstructExpr))));
  115   Finder->addMatcher(cxxMemberCallExpr(CallPushBack, has(SoughtParam),
tools/clang/tools/extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
   53       memberExpr(hasObjectExpression(declRefExpr(to(varDecl(equalsNode(Var))))),
   53       memberExpr(hasObjectExpression(declRefExpr(to(varDecl(equalsNode(Var))))),
   53       memberExpr(hasObjectExpression(declRefExpr(to(varDecl(equalsNode(Var))))),
   54                  member(fieldDecl(equalsNode(Field)))));
   77             cxxConstructorDecl(forEachConstructorInitializer(cxxCtorInitializer(
   77             cxxConstructorDecl(forEachConstructorInitializer(cxxCtorInitializer(
   79                 withInitializer(cxxConstructExpr(
   81                     hasDeclaration(cxxConstructorDecl(isCopyConstructor())),
   84                         0, declRefExpr(to(varDecl(equalsNode(Param)))))))))),
   84                         0, declRefExpr(to(varDecl(equalsNode(Param)))))))))),
   95             cxxConstructorDecl(forEachConstructorInitializer(cxxCtorInitializer(
   95             cxxConstructorDecl(forEachConstructorInitializer(cxxCtorInitializer(
   99                     initListExpr(has(AccessToFieldInParam)),
  100                     cxxConstructExpr(
  101                         hasDeclaration(cxxConstructorDecl(isCopyConstructor())),
  132       match(returnStmt(has(ignoringParenImpCasts(unaryOperator(
  132       match(returnStmt(has(ignoringParenImpCasts(unaryOperator(
  148             compoundStmt(has(ignoringParenImpCasts(cxxMemberCallExpr(
  148             compoundStmt(has(ignoringParenImpCasts(cxxMemberCallExpr(
  152                     implicitCastExpr(hasImplicitDestinationType(
  153                                          pointsTo(type(equalsNode(Base)))),
  156                 callee(cxxMethodDecl(isCopyAssignmentOperator())),
  160                 hasArgument(0, declRefExpr(to(varDecl(equalsNode(Param))))))))),
  160                 hasArgument(0, declRefExpr(to(varDecl(equalsNode(Param))))))))),
  172     auto LHS = memberExpr(hasObjectExpression(cxxThisExpr()),
  173                           member(fieldDecl(equalsNode(Field))));
  176             compoundStmt(has(ignoringParenImpCasts(stmt(anyOf(
  176             compoundStmt(has(ignoringParenImpCasts(stmt(anyOf(
  177                 binaryOperator(hasOperatorName("="), hasLHS(LHS), hasRHS(RHS)),
  178                 cxxOperatorCallExpr(hasOverloadedOperatorName("="),
  214   Finder->addMatcher(cxxDestructorDecl(isDefinition()).bind(SpecialFunction),
  217       cxxConstructorDecl(
  233       cxxMethodDecl(isDefinition(), isCopyAssignmentOperator(),
tools/clang/tools/extra/clang-tidy/modernize/UseEqualsDeleteCheck.cpp
   31   auto PrivateSpecialFn = cxxMethodDecl(
   33       anyOf(cxxConstructorDecl(anyOf(isDefaultConstructor(),
   35             cxxMethodDecl(
   40       cxxMethodDecl(
   46                        hasParent(cxxRecordDecl(hasMethod(unless(
   53       cxxMethodDecl(isDeleted(), unless(isPublic())).bind(DeletedNotPublic),
tools/clang/tools/extra/clang-tidy/modernize/UseNodiscardCheck.cpp
   95       cxxRecordDecl(hasAnyName("::std::function", "::boost::function"));
   95       cxxRecordDecl(hasAnyName("::std::function", "::boost::function"));
  100       cxxMethodDecl(
  109                         parmVarDecl(anyOf(hasType(FunctionObj),
tools/clang/tools/extra/clang-tidy/modernize/UseNoexceptCheck.cpp
   34       functionDecl(
   35           cxxMethodDecl(
   36               hasTypeLoc(loc(functionProtoType(hasDynamicExceptionSpec()))),
   44       functionDecl(
   45           hasTypeLoc(loc(functionProtoType(hasDynamicExceptionSpec()))),
   53       parmVarDecl(anyOf(hasType(pointerType(pointee(parenType(innerType(
   53       parmVarDecl(anyOf(hasType(pointerType(pointee(parenType(innerType(
   53       parmVarDecl(anyOf(hasType(pointerType(pointee(parenType(innerType(
   53       parmVarDecl(anyOf(hasType(pointerType(pointee(parenType(innerType(
   53       parmVarDecl(anyOf(hasType(pointerType(pointee(parenType(innerType(
   54                             functionProtoType(hasDynamicExceptionSpec())))))),
   55                         hasType(memberPointerType(pointee(parenType(innerType(
   55                         hasType(memberPointerType(pointee(parenType(innerType(
   55                         hasType(memberPointerType(pointee(parenType(innerType(
   55                         hasType(memberPointerType(pointee(parenType(innerType(
   56                             functionProtoType(hasDynamicExceptionSpec()))))))))
tools/clang/tools/extra/clang-tidy/modernize/UseNullptrCheck.cpp
   39   StatementMatcher ImplicitCastToNull = implicitCastExpr(
   41       unless(hasImplicitDestinationType(qualType(substTemplateTypeParmType()))),
   44   return castExpr(anyOf(ImplicitCastToNull,
   45                         explicitCastExpr(hasDescendant(ImplicitCastToNull))),
tools/clang/tools/extra/clang-tidy/modernize/UseOverrideCheck.cpp
   39         cxxMethodDecl(isOverride(), unless(cxxDestructorDecl())).bind("method"),
   42     Finder->addMatcher(cxxMethodDecl(isOverride()).bind("method"), this);
tools/clang/tools/extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp
  375   auto F = functionDecl(unless(anyOf(hasTrailingReturn(), returns(voidType()),
  377                                      cxxMethodDecl(isImplicit()))))
  381   Finder->addMatcher(friendDecl(hasDescendant(F)).bind("Friend"), this);
tools/clang/tools/extra/clang-tidy/modernize/UseTransparentFunctorsCheck.cpp
   33       classTemplateSpecializationDecl(
   35           hasAnyName("::std::plus", "::std::minus", "::std::multiplies",
   46       loc(qualType(
   48               hasDeclaration(classTemplateSpecializationDecl(
   49                   unless(hasAnyTemplateArgument(templateArgument(refersToType(
   50                       qualType(pointsTo(qualType(isAnyCharacter()))))))),
   50                       qualType(pointsTo(qualType(isAnyCharacter()))))))),
   52                       templateArgument(refersToType(qualType(hasDeclaration(
   52                       templateArgument(refersToType(qualType(hasDeclaration(
   63   Finder->addMatcher(cxxConstructExpr(hasDeclaration(cxxMethodDecl(
   63   Finder->addMatcher(cxxConstructExpr(hasDeclaration(cxxMethodDecl(
tools/clang/tools/extra/clang-tidy/modernize/UseUncaughtExceptionsCheck.cpp
   27       usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(hasName(MatchText))))
   33       declRefExpr(to(functionDecl(hasName(MatchText))), unless(callExpr()))
   33       declRefExpr(to(functionDecl(hasName(MatchText))), unless(callExpr()))
   38   Finder->addMatcher(callExpr(hasDeclaration(functionDecl(hasName(MatchText))),
   38   Finder->addMatcher(callExpr(hasDeclaration(functionDecl(hasName(MatchText))),
   44   Finder->addMatcher(callExpr(hasAncestor(initListExpr()),
   45                               hasDeclaration(functionDecl(hasName(MatchText))))
tools/clang/tools/extra/clang-tidy/modernize/UseUsingCheck.cpp
   26   Finder->addMatcher(typedefDecl(unless(isInstantiated())).bind("typedef"),
tools/clang/tools/extra/clang-tidy/objc/AvoidNSErrorInitCheck.cpp
   24   Finder->addMatcher(objcMessageExpr(hasSelector("init"),
tools/clang/tools/extra/clang-tidy/objc/ForbiddenSubclassingCheck.cpp
   57       objcInterfaceDecl(
   59               objcInterfaceDecl(
tools/clang/tools/extra/clang-tidy/objc/MissingHashCheck.cpp
   45       objcMethodDecl(
   47           hasDeclContext(objcImplementationDecl(
tools/clang/tools/extra/clang-tidy/objc/PropertyDeclarationCheck.cpp
  104   Finder->addMatcher(objcPropertyDecl(
tools/clang/tools/extra/clang-tidy/objc/SuperSelfCheck.cpp
   83       objcMessageExpr(hasSelector("self"), isMessagingSuperInstance(),
   84                       hasAncestor(objcMethodDecl(
   86                           hasDeclContext(objcImplementationDecl(hasInterface(
tools/clang/tools/extra/clang-tidy/openmp/ExceptionEscapeCheck.cpp
   54   Finder->addMatcher(ompExecutableDirective(
tools/clang/tools/extra/clang-tidy/openmp/UseDefaultNoneCheck.cpp
   31       ompExecutableDirective(
   34                       hasAnyClause(ompDefaultClause(unless(isNoneKind()))
tools/clang/tools/extra/clang-tidy/performance/FasterStringFindCheck.cpp
   44   return hasType(qualType(anyOf(substTemplateTypeParmType(),
   66       expr(ignoringParenCasts(stringLiteral(hasSize(1)).bind("literal")));
   66       expr(ignoringParenCasts(stringLiteral(hasSize(1)).bind("literal")));
   68       hasAnyName("find", "rfind", "find_first_of", "find_first_not_of",
   72       cxxMemberCallExpr(
   73           callee(functionDecl(StringFindFunctions).bind("func")),
   76           on(expr(
   77               hasType(hasUnqualifiedDesugaredType(recordType(hasDeclaration(
   78                   recordDecl(hasAnyName(SmallVector<StringRef, 4>(
tools/clang/tools/extra/clang-tidy/performance/ForRangeCopyCheck.cpp
   39   auto LoopVar = varDecl(
   40       hasType(qualType(
   42                        hasDeclaration(namedDecl(
   44       unless(hasInitializer(expr(hasDescendant(materializeTemporaryExpr())))));
   45   Finder->addMatcher(cxxForRangeStmt(hasLoopVariable(LoopVar.bind("loopVar")))
tools/clang/tools/extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
   50       cxxForRangeStmt(hasLoopVariable(
   51           varDecl(
   52               hasType(qualType(references(qualType(isConstQualified())))),
   52               hasType(qualType(references(qualType(isConstQualified())))),
   54                   expr(anyOf(hasDescendant(
   56                              hasDescendant(unaryOperator(hasOperatorName("*"))
tools/clang/tools/extra/clang-tidy/performance/InefficientAlgorithmCheck.cpp
   36       hasAnyName("::std::find", "::std::count", "::std::equal_range",
   38   const auto ContainerMatcher = classTemplateSpecializationDecl(hasAnyName(
   38   const auto ContainerMatcher = classTemplateSpecializationDecl(hasAnyName(
   44       callExpr(
   45           callee(functionDecl(Algorithms)),
   47               0, cxxConstructExpr(has(ignoringParenImpCasts(cxxMemberCallExpr(
   47               0, cxxConstructExpr(has(ignoringParenImpCasts(cxxMemberCallExpr(
   48                      callee(cxxMethodDecl(hasName("begin"))),
   49                      on(declRefExpr(
   56               1, cxxConstructExpr(has(ignoringParenImpCasts(cxxMemberCallExpr(
   56               1, cxxConstructExpr(has(ignoringParenImpCasts(cxxMemberCallExpr(
   57                      callee(cxxMethodDecl(hasName("end"))),
   58                      on(declRefExpr(
tools/clang/tools/extra/clang-tidy/performance/InefficientStringConcatenationCheck.cpp
   35       hasType(qualType(hasUnqualifiedDesugaredType(recordType(
   35       hasType(qualType(hasUnqualifiedDesugaredType(recordType(
   36           hasDeclaration(cxxRecordDecl(hasName("::std::basic_string")))))));
   38   const auto BasicStringPlusOperator = cxxOperatorCallExpr(
   40       hasAnyArgument(ignoringImpCasts(declRefExpr(BasicStringType))));
   43       cxxOperatorCallExpr(
   45           hasAnyArgument(ignoringImpCasts(declRefExpr(BasicStringType))),
   49   const auto AssignOperator = cxxOperatorCallExpr(
   51       hasArgument(0, declRefExpr(BasicStringType,
   54       hasArgument(1, stmt(hasDescendant(declRefExpr(
   54       hasArgument(1, stmt(hasDescendant(declRefExpr(
   55                          hasDeclaration(decl(equalsBoundNode("lhsStrT"))))))),
   59     Finder->addMatcher(cxxOperatorCallExpr(anyOf(AssignOperator, PlusOperator)),
   63         cxxOperatorCallExpr(anyOf(AssignOperator, PlusOperator),
   64                             hasAncestor(stmt(anyOf(cxxForRangeStmt(),
tools/clang/tools/extra/clang-tidy/performance/InefficientVectorOperationCheck.cpp
   66   return hasType(cxxRecordDecl(hasAnyName(
   66   return hasType(cxxRecordDecl(hasAnyName(
   91   const auto DefaultConstructorCall = cxxConstructExpr(
   93       hasDeclaration(cxxConstructorDecl(isDefaultConstructor())));
   95       varDecl(hasInitializer(DefaultConstructorCall)).bind(VarDeclName);
   97       declStmt(hasSingleDecl(equalsBoundNode(VarDeclName)))
  101       cxxMemberCallExpr(
  103           onImplicitObjectArgument(declRefExpr(to(TargetVarDecl))))
  105   const auto AppendCall = expr(ignoringImplicit(AppendCallExpr));
  107       declStmt(hasSingleDecl(varDecl(hasInitializer(integerLiteral(equals(0))))
  107       declStmt(hasSingleDecl(varDecl(hasInitializer(integerLiteral(equals(0))))
  107       declStmt(hasSingleDecl(varDecl(hasInitializer(integerLiteral(equals(0))))
  110       declRefExpr(to(varDecl(equalsBoundNode(LoopInitVarName)))));
  110       declRefExpr(to(varDecl(equalsBoundNode(LoopInitVarName)))));
  115       anyOf(compoundStmt(statementCountIs(1), has(AppendCall)), AppendCall));
  117       hasParent(compoundStmt(has(TargetVarDefStmt)).bind(LoopParentName));
  127       forStmt(
  129           hasCondition(binaryOperator(
  131               hasRHS(expr(unless(hasDescendant(expr(RefersToLoopVar))))
  131               hasRHS(expr(unless(hasDescendant(expr(RefersToLoopVar))))
  133           hasIncrement(unaryOperator(hasOperatorName("++"),
  147       cxxForRangeStmt(
  148           hasRangeInit(declRefExpr(supportedContainerTypesMatcher())),
  155   const auto VectorDecl = cxxRecordDecl(hasAnyName(SmallVector<StringRef, 5>(
  158       cxxMethodDecl(hasAnyName("push_back", "emplace_back"));
  158       cxxMethodDecl(hasAnyName("push_back", "emplace_back"));
  164         cxxRecordDecl(isDerivedFrom("::proto2::MessageLite"));
  170         cxxMethodDecl(matchesName("::add_"), unless(isConst()));
tools/clang/tools/extra/clang-tidy/performance/MoveConstArgCheck.cpp
   47       callExpr(callee(functionDecl(hasName("::std::move"))), argumentCountIs(1),
   47       callExpr(callee(functionDecl(hasName("::std::move"))), argumentCountIs(1),
   54       MoveCallMatcher, parmVarDecl(hasType(references(isConstQualified()))));
   56   Finder->addMatcher(callExpr(ConstParamMatcher).bind("receiving-expr"), this);
   57   Finder->addMatcher(cxxConstructExpr(ConstParamMatcher).bind("receiving-expr"),
tools/clang/tools/extra/clang-tidy/performance/MoveConstructorInitCheck.cpp
   36       cxxConstructorDecl(
   39               cxxCtorInitializer(
   40                   withInitializer(cxxConstructExpr(hasDeclaration(
   41                       cxxConstructorDecl(isCopyConstructor()).bind("ctor")))))
tools/clang/tools/extra/clang-tidy/performance/NoexceptMoveConstructorCheck.cpp
   27       cxxMethodDecl(anyOf(cxxConstructorDecl(), hasOverloadedOperatorName("=")),
tools/clang/tools/extra/clang-tidy/performance/TypePromotionInMathFnCheck.cpp
   65   auto OneDoubleArgFns = hasAnyName(
   73       callExpr(callee(functionDecl(OneDoubleArgFns, parameterCountIs(1),
   73       callExpr(callee(functionDecl(OneDoubleArgFns, parameterCountIs(1),
   80   auto TwoDoubleArgFns = hasAnyName("::atan2", "::copysign", "::fdim", "::fmax",
   84       callExpr(callee(functionDecl(TwoDoubleArgFns, parameterCountIs(2),
   84       callExpr(callee(functionDecl(TwoDoubleArgFns, parameterCountIs(2),
   93       callExpr(callee(functionDecl(hasName("::fma"), parameterCountIs(3),
   93       callExpr(callee(functionDecl(hasName("::fma"), parameterCountIs(3),
  104       callExpr(callee(functionDecl(
  104       callExpr(callee(functionDecl(
  107                    hasParameter(1, parmVarDecl(hasType(pointerType(
  107                    hasParameter(1, parmVarDecl(hasType(pointerType(
  108                                        pointee(isBuiltinType(IntTy)))))))),
  116       callExpr(callee(functionDecl(hasName("::nexttoward"), parameterCountIs(2),
  116       callExpr(callee(functionDecl(hasName("::nexttoward"), parameterCountIs(2),
  126       callExpr(
  127           callee(functionDecl(
  130               hasParameter(2, parmVarDecl(hasType(pointerType(
  130               hasParameter(2, parmVarDecl(hasType(pointerType(
  131                                   pointee(isBuiltinType(IntTy)))))))),
  138       callExpr(callee(functionDecl(hasName("::scalbln"), parameterCountIs(2),
  138       callExpr(callee(functionDecl(hasName("::scalbln"), parameterCountIs(2),
  147       callExpr(callee(functionDecl(hasName("::scalbn"), parameterCountIs(2),
  147       callExpr(callee(functionDecl(hasName("::scalbn"), parameterCountIs(2),
tools/clang/tools/extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
   40   auto ConstReference = referenceType(pointee(qualType(isConstQualified())));
   40   auto ConstReference = referenceType(pointee(qualType(isConstQualified())));
   40   auto ConstReference = referenceType(pointee(qualType(isConstQualified())));
   49       cxxMemberCallExpr(callee(cxxMethodDecl(returns(ConstReference))),
   49       cxxMemberCallExpr(callee(cxxMethodDecl(returns(ConstReference))),
   50                         on(declRefExpr(to(varDecl().bind("objectArg")))));
   52       callExpr(callee(functionDecl(returns(ConstReference))),
   52       callExpr(callee(functionDecl(returns(ConstReference))),
   56     return compoundStmt(
   58                    declStmt(
   59                        has(varDecl(hasLocalStorage(),
   60                                    hasType(qualType(
   63                                        unless(hasDeclaration(namedDecl(
   68                                        cxxConstructExpr(
   69                                            hasDeclaration(cxxConstructorDecl(
   82   Finder->addMatcher(localVarCopiedFrom(declRefExpr(
   83                          to(varDecl(hasLocalStorage()).bind("oldVarDecl")))),
tools/clang/tools/extra/clang-tidy/performance/UnnecessaryValueParamCheck.cpp
   36   auto Matches = match(declRefExpr(to(functionDecl(equalsNode(&Function))),
   36   auto Matches = match(declRefExpr(to(functionDecl(equalsNode(&Function))),
   45       match(decl(forEachDescendant(declRefExpr(
   45       match(decl(forEachDescendant(declRefExpr(
   47                 unless(hasAncestor(stmt(anyOf(forStmt(), cxxForRangeStmt(),
   80   const auto ExpensiveValueParamDecl = parmVarDecl(
   81       hasType(qualType(
   84                        hasDeclaration(namedDecl(
   88       functionDecl(hasBody(stmt()), isDefinition(), unless(isImplicit()),
   89                    unless(cxxMethodDecl(anyOf(isOverride(), isFinal()))),
   90                    has(typeLoc(forEach(ExpensiveValueParamDecl))),
tools/clang/tools/extra/clang-tidy/portability/SIMDIntrinsicsCheck.cpp
  102   Finder->addMatcher(callExpr(callee(functionDecl(
  102   Finder->addMatcher(callExpr(callee(functionDecl(
tools/clang/tools/extra/clang-tidy/readability/AvoidConstParamsInDecls.cpp
   33       parmVarDecl(hasType(qualType(isConstQualified()))).bind("param");
   33       parmVarDecl(hasType(qualType(isConstQualified()))).bind("param");
   35       functionDecl(unless(isDefinition()),
   42                    unless(cxxMethodDecl(ofClass(cxxRecordDecl(anyOf(
   42                    unless(cxxMethodDecl(ofClass(cxxRecordDecl(anyOf(
   44                    has(typeLoc(forEach(ConstParamDecl))))
tools/clang/tools/extra/clang-tidy/readability/ConstReturnTypeCheck.cpp
  100       functionDecl(returns(isConstQualified()), isDefinition()).bind("func"),
tools/clang/tools/extra/clang-tidy/readability/ContainerSizeEmptyCheck.cpp
   34   const auto ValidContainer = qualType(hasUnqualifiedDesugaredType(
   35       recordType(hasDeclaration(cxxRecordDecl(isSameOrDerivedFrom(
   35       recordType(hasDeclaration(cxxRecordDecl(isSameOrDerivedFrom(
   36           namedDecl(
   37               has(cxxMethodDecl(
   40                       returns(qualType(isInteger(), unless(booleanType()))))
   42               has(cxxMethodDecl(isConst(), parameterCountIs(0), isPublic(),
   48       hasParent(binaryOperator(
   51                         integerLiteral(equals(1)), integerLiteral(equals(0))))))
   51                         integerLiteral(equals(1)), integerLiteral(equals(0))))))
   53       hasParent(implicitCastExpr(
   56               hasParent(unaryOperator(hasOperatorName("!")).bind("NegOnSize")),
   58       hasParent(explicitCastExpr(hasDestinationType(booleanType()))));
   61       cxxMemberCallExpr(on(expr(anyOf(hasType(ValidContainer),
   61       cxxMemberCallExpr(on(expr(anyOf(hasType(ValidContainer),
   64                         callee(cxxMethodDecl(hasName("size"))), WrongUse,
   65                         unless(hasAncestor(cxxMethodDecl(
   71   const auto DefaultConstructor = cxxConstructExpr(
   72           hasDeclaration(cxxConstructorDecl(isDefaultConstructor())));
   75       ignoringImpCasts(stringLiteral(hasSize(0))),
   76       ignoringImpCasts(cxxBindTemporaryExpr(has(DefaultConstructor))),
   78       cxxConstructExpr(
   79           hasDeclaration(cxxConstructorDecl(isCopyConstructor())),
   80           has(expr(ignoringImpCasts(DefaultConstructor)))),
   81       cxxConstructExpr(
   82           hasDeclaration(cxxConstructorDecl(isMoveConstructor())),
   83           has(expr(ignoringImpCasts(DefaultConstructor)))));
   86       anyOf(unaryOperator(
   89                     expr(hasType(pointsTo(ValidContainer))).bind("Pointee"))),
   90             expr(hasType(ValidContainer)).bind("STLObject"));
   92       cxxOperatorCallExpr(
   98               cxxMethodDecl(ofClass(equalsBoundNode("container"))))))
tools/clang/tools/extra/clang-tidy/readability/ConvertMemberFunctionsToStatic.cpp
   76       cxxMethodDecl(
tools/clang/tools/extra/clang-tidy/readability/DeleteNullPointerCheck.cpp
   23       cxxDeleteExpr(has(castExpr(has(declRefExpr(
   23       cxxDeleteExpr(has(castExpr(has(declRefExpr(
   23       cxxDeleteExpr(has(castExpr(has(declRefExpr(
   24                         to(decl(equalsBoundNode("deletedPointer"))))))))
   28       cxxDeleteExpr(has(castExpr(has(memberExpr(hasDeclaration(
   28       cxxDeleteExpr(has(castExpr(has(memberExpr(hasDeclaration(
   28       cxxDeleteExpr(has(castExpr(has(memberExpr(hasDeclaration(
   29                         fieldDecl(equalsBoundNode("deletedMemberPointer"))))))))
   33       declRefExpr(to(decl().bind("deletedPointer"))),
   34       memberExpr(hasDeclaration(fieldDecl().bind("deletedMemberPointer")))));
   36   const auto PointerCondition = castExpr(hasCastKind(CK_PointerToBoolean),
   39       binaryOperator(hasEitherOperand(castExpr(hasCastKind(CK_NullToPointer))),
   39       binaryOperator(hasEitherOperand(castExpr(hasCastKind(CK_NullToPointer))),
   43       ifStmt(hasCondition(anyOf(PointerCondition, BinaryPointerCheckCondition)),
   46                  compoundStmt(anyOf(has(DeleteExpr), has(DeleteMemberExpr)),
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"),
   24                  expr(ignoringImplicit(cxxThrowExpr().bind("throw")))));
   26       compoundStmt(forEach(
   27           ifStmt(unless(isConstexpr()),
   35                  hasThen(stmt(anyOf(InterruptsControlFlow,
   36                                     compoundStmt(has(InterruptsControlFlow))))),
tools/clang/tools/extra/clang-tidy/readability/FunctionSizeCheck.cpp
  149   Finder->addMatcher(functionDecl(unless(isInstantiated()),
  150                                   unless(cxxMethodDecl(ofClass(isLambda()))))
tools/clang/tools/extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp
  267       expr(anyOf(allOf(isMacroExpansion(), unless(isNULLMacroExpansion())),
  268                  has(ignoringImplicit(memberExpr(hasDeclaration(fieldDecl(hasBitWidth(1)))))),
  268                  has(ignoringImplicit(memberExpr(hasDeclaration(fieldDecl(hasBitWidth(1)))))),
  270   auto implicitCastFromBool = implicitCastExpr(
  276       hasSourceExpression(expr(hasType(booleanType()))),
  279       binaryOperator(hasOperatorName("^"), hasLHS(implicitCastFromBool),
  282       implicitCastExpr(
  291               hasParent(stmt(anyOf(ifStmt(), whileStmt()), has(declStmt())))),
  302   auto boolComparison = binaryOperator(
  306       binaryOperator(anyOf(hasOperatorName("|="), hasOperatorName("&=")),
  307                      hasLHS(expr(hasType(booleanType()))));
  308   auto bitfieldAssignment = binaryOperator(
  309       hasLHS(memberExpr(hasDeclaration(fieldDecl(hasBitWidth(1))))));
  309       hasLHS(memberExpr(hasDeclaration(fieldDecl(hasBitWidth(1))))));
  310   auto bitfieldConstruct = cxxConstructorDecl(hasDescendant(cxxCtorInitializer(
  310   auto bitfieldConstruct = cxxConstructorDecl(hasDescendant(cxxCtorInitializer(
  314       implicitCastExpr(
  320           unless(hasParent(binaryOperator(anyOf(
tools/clang/tools/extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
  300   Finder->addMatcher(functionDecl(unless(isImplicit()), hasOtherDeclarations())
tools/clang/tools/extra/clang-tidy/readability/IsolateDeclarationCheck.cpp
   28   Finder->addMatcher(declStmt(onlyDeclaresVariables(), unless(isSingleDecl()),
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()))))
tools/clang/tools/extra/clang-tidy/readability/MisplacedArrayIndexCheck.cpp
   22   Finder->addMatcher(arraySubscriptExpr(hasLHS(hasType(isInteger())),
tools/clang/tools/extra/clang-tidy/readability/NamedParameterCheck.cpp
   21   Finder->addMatcher(functionDecl(unless(isInstantiated())).bind("decl"), this);
tools/clang/tools/extra/clang-tidy/readability/NonConstParameterCheck.cpp
   21   Finder->addMatcher(parmVarDecl(unless(isInstantiated())).bind("Parm"), this);
   31   Finder->addMatcher(stmt(anyOf(unaryOperator(anyOf(hasOperatorName("++"),
   31   Finder->addMatcher(stmt(anyOf(unaryOperator(anyOf(hasOperatorName("++"),
   37   Finder->addMatcher(varDecl(hasInitializer(anything())).bind("Mark"), this);
tools/clang/tools/extra/clang-tidy/readability/RedundantControlFlowCheck.cpp
   35       functionDecl(
   37           has(compoundStmt(hasAnySubstatement(returnStmt(unless(has(expr())))))
   37           has(compoundStmt(hasAnySubstatement(returnStmt(unless(has(expr())))))
   41       has(compoundStmt(hasAnySubstatement(continueStmt())).bind("continue"));
   43       stmt(anyOf(forStmt(), cxxForRangeStmt(), whileStmt(), doStmt()),
tools/clang/tools/extra/clang-tidy/readability/RedundantDeclarationCheck.cpp
   31       namedDecl(anyOf(varDecl(unless(isDefinition())),
   31       namedDecl(anyOf(varDecl(unless(isDefinition())),
   32                       functionDecl(unless(anyOf(
tools/clang/tools/extra/clang-tidy/readability/RedundantFunctionPtrDereferenceCheck.cpp
   20   Finder->addMatcher(unaryOperator(hasOperatorName("*"),
   21                                    has(implicitCastExpr(
tools/clang/tools/extra/clang-tidy/readability/RedundantMemberInitCheck.cpp
   28       cxxConstructExpr(
   29           hasDeclaration(cxxConstructorDecl(hasParent(
   30               cxxRecordDecl(unless(isTriviallyDefaultConstructible()))))))
   34       cxxConstructorDecl(
   39               cxxCtorInitializer(isWritten(),
   42                                  unless(forField(hasParent(recordDecl(isUnion())))))
tools/clang/tools/extra/clang-tidy/readability/RedundantSmartptrGetCheck.cpp
   21   return cxxMemberCallExpr(
   22              on(expr(anyOf(hasType(OnClass),
   23                            hasType(qualType(
   24                                pointsTo(decl(OnClass).bind("ptr_to_ptr"))))))
   26              unless(callee(memberExpr(hasObjectExpression(cxxThisExpr())))),
   27              callee(cxxMethodDecl(
   29                  returns(qualType(pointsTo(type().bind("getType")))))))
   34   return recordDecl(hasAnyName("::std::unique_ptr", "::std::shared_ptr"));
   34   return recordDecl(hasAnyName("::std::unique_ptr", "::std::shared_ptr"));
   39   const auto QuacksLikeASmartptr = recordDecl(
   41       has(cxxMethodDecl(hasName("operator->"),
   42                         returns(qualType(pointsTo(type().bind("op->Type")))))),
   43       has(cxxMethodDecl(hasName("operator*"), returns(qualType(references(
   43       has(cxxMethodDecl(hasName("operator*"), returns(qualType(references(
   51       memberExpr(expr().bind("memberExpr"), isArrow(),
   57       unaryOperator(hasOperatorName("*"), hasUnaryOperand(callToGet(Smartptr))),
   62       recordDecl(Smartptr, has(cxxConversionDecl(returns(booleanType()))))));
   62       recordDecl(Smartptr, has(cxxConversionDecl(returns(booleanType()))))));
   64       unaryOperator(hasOperatorName("!"), hasUnaryOperand(CallToGetAsBool)),
   68   Finder->addMatcher(ifStmt(hasCondition(CallToGetAsBool)), Callback);
   71   Finder->addMatcher(conditionalOperator(hasCondition(CallToGetAsBool)),
   84       binaryOperator(anyOf(hasOperatorName("=="), hasOperatorName("!=")),
   87                                integerLiteral(equals(0))))),
tools/clang/tools/extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
   74   const auto StringDecl = type(hasUnqualifiedDesugaredType(recordType(
   74   const auto StringDecl = type(hasUnqualifiedDesugaredType(recordType(
   75       hasDeclaration(cxxRecordDecl(hasName("::std::basic_string"))))));
   77       expr(anyOf(hasType(StringDecl), hasType(qualType(pointsTo(StringDecl)))));
   77       expr(anyOf(hasType(StringDecl), hasType(qualType(pointsTo(StringDecl)))));
   80   const auto StringConstructorExpr = expr(anyOf(
   81       cxxConstructExpr(argumentCountIs(1),
   82                        hasDeclaration(cxxMethodDecl(hasName("basic_string")))),
   83       cxxConstructExpr(
   85           hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
   92       cxxMemberCallExpr(on(StringExpr.bind("arg")),
   94                         callee(cxxMethodDecl(hasAnyName("c_str", "data"))))
   94                         callee(cxxMethodDecl(hasAnyName("c_str", "data"))))
   98   Finder->addMatcher(cxxConstructExpr(StringConstructorExpr,
  104       cxxOperatorCallExpr(
  118   Finder->addMatcher(cxxOperatorCallExpr(anyOf(hasOverloadedOperatorName("="),
  126       cxxMemberCallExpr(on(StringExpr), callee(decl(cxxMethodDecl(hasAnyName(
  126       cxxMemberCallExpr(on(StringExpr), callee(decl(cxxMethodDecl(hasAnyName(
  126       cxxMemberCallExpr(on(StringExpr), callee(decl(cxxMethodDecl(hasAnyName(
  126       cxxMemberCallExpr(on(StringExpr), callee(decl(cxxMethodDecl(hasAnyName(
  133       cxxMemberCallExpr(on(StringExpr),
  134                         callee(decl(cxxMethodDecl(hasName("compare")))),
  134                         callee(decl(cxxMethodDecl(hasName("compare")))),
  140       cxxMemberCallExpr(on(StringExpr),
  141                         callee(decl(cxxMethodDecl(hasAnyName(
  141                         callee(decl(cxxMethodDecl(hasAnyName(
  141                         callee(decl(cxxMethodDecl(hasAnyName(
  150       cxxMemberCallExpr(on(StringExpr),
  151                         callee(decl(cxxMethodDecl(hasName("insert")))),
  151                         callee(decl(cxxMethodDecl(hasName("insert")))),
  157       cxxConstructExpr(
  162           hasDeclaration(cxxMethodDecl(hasAnyName(
  162           hasDeclaration(cxxMethodDecl(hasAnyName(
tools/clang/tools/extra/clang-tidy/readability/RedundantStringInitCheck.cpp
   25   const auto StringConstructorExpr = expr(anyOf(
   26       cxxConstructExpr(argumentCountIs(1),
   27                        hasDeclaration(cxxMethodDecl(hasName("basic_string")))),
   30       cxxConstructExpr(argumentCountIs(2),
   31                        hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
   35   const auto EmptyStringCtorExpr = cxxConstructExpr(
   37       hasArgument(0, ignoringParenImpCasts(stringLiteral(hasSize(0)))));
   40       cxxConstructExpr(StringConstructorExpr,
   48       namedDecl(
   49           varDecl(hasType(hasUnqualifiedDesugaredType(recordType(
   49           varDecl(hasType(hasUnqualifiedDesugaredType(recordType(
   50                       hasDeclaration(cxxRecordDecl(hasName("basic_string")))))),
   51                   hasInitializer(expr(ignoringImplicit(anyOf(
tools/clang/tools/extra/clang-tidy/readability/SimplifyBooleanExprCheck.cpp
   69       returnStmt(has(cxxBoolLiteral(equals(Value)).bind(Id)))
   69       returnStmt(has(cxxBoolLiteral(equals(Value)).bind(Id)))
   72                compoundStmt(statementCountIs(1), has(SimpleReturnsBool)));
  426       ifStmt(isExpansionInMainFile(),
  427              hasCondition(cxxBoolLiteral(equals(Value)).bind(BooleanId)))
  436       conditionalOperator(isExpansionInMainFile(),
  437                           hasTrueExpression(cxxBoolLiteral(equals(Value))),
  438                           hasFalseExpression(cxxBoolLiteral(equals(!Value))))
  446     Finder->addMatcher(ifStmt(isExpansionInMainFile(),
  452     Finder->addMatcher(ifStmt(isExpansionInMainFile(),
  462   auto VarAssign = declRefExpr(hasDeclaration(decl().bind(IfAssignVarId)));
  463   auto VarRef = declRefExpr(hasDeclaration(equalsBoundNode(IfAssignVarId)));
  464   auto MemAssign = memberExpr(hasDeclaration(decl().bind(IfAssignVarId)));
  465   auto MemRef = memberExpr(hasDeclaration(equalsBoundNode(IfAssignVarId)));
  467       binaryOperator(hasOperatorName("="), hasLHS(anyOf(VarAssign, MemAssign)),
  469                      hasRHS(cxxBoolLiteral(equals(Value)).bind(IfAssignLocId)));
  470   auto Then = anyOf(SimpleThen, compoundStmt(statementCountIs(1),
  473       binaryOperator(hasOperatorName("="), hasLHS(anyOf(VarRef, MemRef)),
  474                      hasRHS(cxxBoolLiteral(equals(!Value))));
  475   auto Else = anyOf(SimpleElse, compoundStmt(statementCountIs(1),
  478     Finder->addMatcher(ifStmt(hasThen(Then), hasElse(Else)).bind(Id), this);
  481         ifStmt(unless(hasParent(ifStmt())), hasThen(Then), hasElse(Else))
  490       compoundStmt(
  492               ifStmt(hasThen(returnsBool(Value)), unless(hasElse(stmt())))),
  493           hasAnySubstatement(returnStmt(has(ignoringParenImpCasts(
  494                                             cxxBoolLiteral(equals(!Value)))))
tools/clang/tools/extra/clang-tidy/readability/SimplifySubscriptExprCheck.cpp
   34       recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
   34       recordType(hasDeclaration(cxxRecordDecl(hasAnyName(
   38       arraySubscriptExpr(hasBase(ignoringParenImpCasts(
   39           cxxMemberCallExpr(
   41               on(hasType(qualType(
   44                   anyOf(TypesMatcher, pointerType(pointee(TypesMatcher)))))),
   44                   anyOf(TypesMatcher, pointerType(pointee(TypesMatcher)))))),
   45               callee(namedDecl(hasName("data"))))
tools/clang/tools/extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
   41       memberExpr(hasDeclaration(anyOf(cxxMethodDecl(isStaticStorageClass()),
   41       memberExpr(hasDeclaration(anyOf(cxxMethodDecl(isStaticStorageClass()),
   42                                       varDecl(hasStaticStorageDuration()))),
tools/clang/tools/extra/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
   23       namedDecl(anyOf(functionDecl(isDefinition(), isStaticStorageClass()),
   23       namedDecl(anyOf(functionDecl(isDefinition(), isStaticStorageClass()),
   24                       varDecl(isDefinition(), isStaticStorageClass())),
   25                 hasParent(namespaceDecl(isAnonymous())))
tools/clang/tools/extra/clang-tidy/readability/StringCompareCheck.cpp
   29   const auto StrCompare = cxxMemberCallExpr(
   30       callee(cxxMethodDecl(hasName("compare"),
   31                            ofClass(classTemplateSpecializationDecl(
   37   Finder->addMatcher(implicitCastExpr(hasImplicitDestinationType(booleanType()),
   44       binaryOperator(anyOf(hasOperatorName("=="), hasOperatorName("!=")),
   46                      hasEitherOperand(integerLiteral(equals(0)).bind("zero")))
tools/clang/tools/extra/clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
   21   auto IsSusbstituted = qualType(anyOf(
   24   auto UniquePtrWithDefaultDelete = classTemplateSpecializationDecl(
   26       hasTemplateArgument(1, refersToType(qualType(hasDeclaration(cxxRecordDecl(
   26       hasTemplateArgument(1, refersToType(qualType(hasDeclaration(cxxRecordDecl(
   30       cxxDeleteExpr(has(ignoringParenImpCasts(cxxMemberCallExpr(
   30       cxxDeleteExpr(has(ignoringParenImpCasts(cxxMemberCallExpr(
   31                         on(expr(hasType(UniquePtrWithDefaultDelete),
   34                         callee(cxxMethodDecl(hasName("release")))))))
tools/clang/tools/extra/clang-tidy/readability/UppercaseLiteralSuffixCheck.cpp
  200       stmt(eachOf(integerLiteral().bind(IntegerLiteralCheck::Name),
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
   48       declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef");
   48       declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef");
   49   auto ConstMethodCallee = callee(cxxMethodDecl(isConst()));
   54       findAll(expr(anyOf(cxxMemberCallExpr(ConstMethodCallee, on(DeclRefToVar)),
   54       findAll(expr(anyOf(cxxMemberCallExpr(ConstMethodCallee, on(DeclRefToVar)),
   55                          cxxOperatorCallExpr(ConstMethodCallee,
   61       qualType(anyOf(referenceType(pointee(qualType(isConstQualified()))),
   61       qualType(anyOf(referenceType(pointee(qualType(isConstQualified()))),
   61       qualType(anyOf(referenceType(pointee(qualType(isConstQualified()))),
   61       qualType(anyOf(referenceType(pointee(qualType(isConstQualified()))),
   64       DeclRefToVar, parmVarDecl(hasType(ConstReferenceOrValue)));
   65   Matches = match(findAll(callExpr(UsedAsConstRefOrValueArg)), Stmt, Context);
   68       match(findAll(cxxConstructExpr(UsedAsConstRefOrValueArg)), Stmt, Context);
   79       declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef");
   79       declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef");
   80   auto ConstMethodCallee = callee(cxxMethodDecl(isConst()));
   85       match(decl(forEachDescendant(expr(
   85       match(decl(forEachDescendant(expr(
   86                 anyOf(cxxMemberCallExpr(ConstMethodCallee, on(DeclRefToVar)),
   87                       cxxOperatorCallExpr(ConstMethodCallee,
   93       qualType(anyOf(referenceType(pointee(qualType(isConstQualified()))),
   93       qualType(anyOf(referenceType(pointee(qualType(isConstQualified()))),
   93       qualType(anyOf(referenceType(pointee(qualType(isConstQualified()))),
   93       qualType(anyOf(referenceType(pointee(qualType(isConstQualified()))),
   96       DeclRefToVar, parmVarDecl(hasType(ConstReferenceOrValue)));
   97   Matches = match(decl(forEachDescendant(callExpr(UsedAsConstRefOrValueArg))),
   97   Matches = match(decl(forEachDescendant(callExpr(UsedAsConstRefOrValueArg))),
  101       match(decl(forEachDescendant(cxxConstructExpr(UsedAsConstRefOrValueArg))),
  101       match(decl(forEachDescendant(cxxConstructExpr(UsedAsConstRefOrValueArg))),
  122       findAll(declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef")),
  122       findAll(declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef")),
  132       decl(forEachDescendant(
  133           declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef"))),
  133           declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef"))),
  143       declRefExpr(equalsNode(&DeclRef)),
  144       parmVarDecl(hasType(matchers::isReferenceToConst())));
  146       decl(hasDescendant(
  147           cxxConstructExpr(UsedAsConstRefArg, hasDeclaration(cxxConstructorDecl(
  147           cxxConstructExpr(UsedAsConstRefArg, hasDeclaration(cxxConstructorDecl(
  157       declRefExpr(equalsNode(&DeclRef)),
  158       parmVarDecl(hasType(matchers::isReferenceToConst())));
  160       decl(hasDescendant(
  161           cxxOperatorCallExpr(UsedAsConstRefArg, hasOverloadedOperatorName("="),
  162                               callee(cxxMethodDecl(isCopyAssignmentOperator())))
tools/clang/tools/extra/clang-tidy/utils/Matchers.h
   47   return referenceType(pointee(qualType(isConstQualified())));
   47   return referenceType(pointee(qualType(isConstQualified())));
   47   return referenceType(pointee(qualType(isConstQualified())));
tools/clang/tools/extra/clang-tidy/utils/NamespaceAliaser.cpp
   47       match(functionDecl(hasBody(compoundStmt(has(declStmt(
   47       match(functionDecl(hasBody(compoundStmt(has(declStmt(
   47       match(functionDecl(hasBody(compoundStmt(has(declStmt(
   48                 has(namespaceAliasDecl(hasTargetNamespace(hasName(Namespace)))
   58     DeclarationMatcher ConflictMatcher = namedDecl(hasName(Abbreviation));
   62         !match(functionDecl(hasAncestor(decl(has(ConflictMatcher)))), *Function,
   62         !match(functionDecl(hasAncestor(decl(has(ConflictMatcher)))), *Function,
tools/clang/tools/extra/clang-tidy/utils/UsingInserter.cpp
   52       !match(stmt(hasAncestor(decl(has(usingDecl(hasAnyUsingShadowDecl(
   52       !match(stmt(hasAncestor(decl(has(usingDecl(hasAnyUsingShadowDecl(
   52       !match(stmt(hasAncestor(decl(has(usingDecl(hasAnyUsingShadowDecl(
   61   auto ConflictingDecl = namedDecl(hasName(UnqualifiedName));
   65       !match(findAll(declRefExpr(to(ConflictingDecl))), *Function, Context)
tools/clang/tools/extra/clang-tidy/zircon/TemporaryObjectsCheck.cpp
   32       cxxTemporaryObjectExpr(hasDeclaration(cxxConstructorDecl(hasParent(
   32       cxxTemporaryObjectExpr(hasDeclaration(cxxConstructorDecl(hasParent(
   33                                  cxxRecordDecl(matchesAnyName(Names))))))
   39       cxxConstructExpr(hasParent(cxxFunctionalCastExpr()),
   40                        hasDeclaration(cxxConstructorDecl(
   41                            hasParent(cxxRecordDecl(matchesAnyName(Names))))))
tools/clang/tools/extra/tool-template/ToolTemplate.cpp
  110       namedDecl(cxxRecordDecl(), isExpansionInMainFile()).bind("decl"),
tools/clang/tools/extra/unittests/clang-query/QueryEngineTest.cpp
   52   DynTypedMatcher FooMatcher = functionDecl(hasName("foo1"));
tools/clang/tools/extra/unittests/clang-tidy/OverlappingReplacementsTest.cpp
   31     Finder->addMatcher(varDecl(hasType(isInteger())).bind(BoundDecl), this);
   72     Finder->addMatcher(varDecl(matchesName(NamePattern)).bind(BoundDecl), this);
tools/clang/tools/extra/unittests/clang-tidy/TransformerClangTidyCheckTest.cpp
   35       ifStmt(hasCondition(expr().bind(C)), hasThen(stmt().bind(T)),
   99                 binaryOperator(hasOperatorName("+"), hasRHS(expr().bind("r"))),
  178       tooling::makeRule(callExpr(callee(functionDecl(hasName("f")))),
  178       tooling::makeRule(callExpr(callee(functionDecl(hasName("f")))),
tools/clang/unittests/AST/ASTContextParentMapTest.cpp
   30                      cxxMethodDecl(hasParent(recordDecl(hasName("C"))))));
   30                      cxxMethodDecl(hasParent(recordDecl(hasName("C"))))));
   36                              ifStmt(hasParent(compoundStmt()))));
   43                      typeLoc(hasParent(typeLoc(hasParent(functionDecl()))))));
   43                      typeLoc(hasParent(typeLoc(hasParent(functionDecl()))))));
   49                              nestedNameSpecifierLoc(hasParent(typeLoc()))));
   57       cxxMethodDecl(hasName("f"),
   58                  hasParent(cxxRecordDecl(isTemplateInstantiation())))));
   62       cxxMethodDecl(hasName("f"),
   63                  hasParent(cxxRecordDecl(unless(isTemplateInstantiation()))))));
   67       cxxMethodDecl(
   69           allOf(hasParent(cxxRecordDecl(unless(isTemplateInstantiation()))),
   70                 hasParent(cxxRecordDecl(isTemplateInstantiation()))))));
   78       compoundStmt(allOf(
   79           hasAncestor(cxxRecordDecl(isTemplateInstantiation())),
   80           hasAncestor(cxxRecordDecl(unless(isTemplateInstantiation())))))));
  112       varDecl(hasName("y"), hasAncestor(functionDecl(
  112       varDecl(hasName("y"), hasAncestor(functionDecl(
  114                                 hasParent(cxxRecordDecl(
tools/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
   25     return functionDecl(hasName("X"), unless(isImplicit()));
   34     return cxxRecordDecl(hasName("X"), unless(isImplicit()));
   42   BindableMatcher<Decl> getPattern() { return varDecl(hasName("X")); }
   55     return functionTemplateDecl(hasName("X"), unless(isImplicit()));
   64     return classTemplateDecl(hasName("X"), unless(isImplicit()));
   89     return functionDecl(hasName("X"), isExplicitTemplateSpecialization());
  106     return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));
tools/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp
   38     return functionDecl(hasName("X"), unless(isImplicit()));
   47   BindableMatcher<Decl> getPattern() { return typedefNameDecl(hasName("X")); }
   55   BindableMatcher<Decl> getPattern() { return typedefNameDecl(hasName("X")); }
   63   BindableMatcher<Decl> getPattern() { return enumDecl(hasName("X")); }
   71   BindableMatcher<Decl> getPattern() { return enumConstantDecl(hasName("X")); }
   81     return cxxRecordDecl(hasName("X"), unless(isImplicit()));
   92   BindableMatcher<Decl> getPattern() { return varDecl(hasName("X")); }
  105     return classTemplateDecl(hasName("X"), unless(isImplicit()));
  124     return functionTemplateDecl(hasName("X"), unless(isImplicit()));
  146   BindableMatcher<Decl> getPattern() { return varTemplateDecl(hasName("X")); }
  168     return classTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));
  198     return functionDecl(hasName("X"), isExplicitTemplateSpecialization(),
  223     return varTemplateSpecializationDecl(hasName("X"), unless(isImplicit()));
tools/clang/unittests/AST/ASTImporterTest.cpp
  116         translationUnitDecl(
  117             has(namedDecl(hasName(DeclToImportID)).bind(DeclToImportID))),
  154           ImportPredicate(namedDecl(hasName(DeclName))) {}
  256   auto Pattern = functionDecl(hasName("f"));
  266   auto Pattern = functionDecl(hasName("f"));
  280   auto Pattern = functionDecl(hasName("f"));
  339   auto Pattern = functionDecl(hasName("shouldNotBeImported"));
  356   auto Pattern = functionDecl(hasName("shouldNotBeImported"));
  367     auto Pattern = functionDecl(hasName("f"));
  467       functionDecl(hasDescendant(
  468           stringLiteral(hasType(asString("const char [4]"))))));
  472       functionDecl(hasDescendant(
  473           stringLiteral(hasType(asString("const wchar_t [4]"))))));
  477       functionDecl(hasDescendant(
  478           stringLiteral(hasType(asString("const char [7]"))))));
  489     functionDecl(hasDescendant(chooseExpr())));
  497       functionDecl(hasDescendant(gnuNullExpr(hasType(isInteger())))));
  497       functionDecl(hasDescendant(gnuNullExpr(hasType(isInteger())))));
  505       functionDecl(hasDescendant(cxxNullPtrLiteralExpr())));
  514       functionDecl(hasDescendant(
  515           floatLiteral(equals(1.0), hasType(asString("double"))))));
  519       functionDecl(hasDescendant(
  520           floatLiteral(equals(1.0e-5f), hasType(asString("float"))))));
  528       functionDecl(hasDescendant(imaginaryLiteral())));
  538       functionDecl(hasDescendant(
  539           compoundLiteralExpr(
  541               has(initListExpr(
  543                   has(integerLiteral(
  545                   has(integerLiteral(
  547                   has(integerLiteral(
  556       cxxRecordDecl(
  559                   cxxThisExpr(
  569       functionDecl(hasDescendant(
  570           atomicExpr(
  572                   declRefExpr(hasDeclaration(varDecl(hasName("ptr"))),
  572                   declRefExpr(hasDeclaration(varDecl(hasName("ptr"))),
  574               has(integerLiteral(equals(1), hasType(asString("int"))))))));
  582       functionDecl(
  584               labelStmt(hasDeclaration(labelDecl(hasName("loop"))))),
  584               labelStmt(hasDeclaration(labelDecl(hasName("loop"))))),
  586               addrLabelExpr(hasDeclaration(labelDecl(hasName("loop")))))));
  586               addrLabelExpr(hasDeclaration(labelDecl(hasName("loop")))))));
  602       typedefDecl(hasType(templateSpecializationType(
  602       typedefDecl(hasType(templateSpecializationType(
  603           hasDeclaration(classTemplateSpecializationDecl(hasSpecializedTemplate(
  604               classTemplateDecl(hasTemplateDecl(cxxRecordDecl(hasMethod(allOf(
  604               classTemplateDecl(hasTemplateDecl(cxxRecordDecl(hasMethod(allOf(
  606                   hasBody(compoundStmt(has(declStmt(hasSingleDecl(
  606                   hasBody(compoundStmt(has(declStmt(hasSingleDecl(
  607                       varDecl(hasInitializer(parenListExpr(has(unaryOperator(
  607                       varDecl(hasInitializer(parenListExpr(has(unaryOperator(
  607                       varDecl(hasInitializer(parenListExpr(has(unaryOperator(
  617       functionDecl(hasDescendant(
  618           switchStmt(has(compoundStmt(has(caseStmt())))))));
  618           switchStmt(has(compoundStmt(has(caseStmt())))))));
  626     functionDecl(hasDescendant(
  627         varDecl(
  631                 stmtExpr(
  632                     hasAnySubstatement(declStmt(hasSingleDecl(
  633                         varDecl(
  637                                 integerLiteral(equals(4))))))),
  647       functionDecl(hasDescendant(
  648           conditionalOperator(
  649               hasCondition(cxxBoolLiteral(equals(true))),
  650               hasTrueExpression(integerLiteral(equals(1))),
  652                   unaryOperator(hasUnaryOperand(integerLiteral(equals(5))))))
  652                   unaryOperator(hasUnaryOperand(integerLiteral(equals(5))))))
  661       functionDecl(hasDescendant(
  662           binaryConditionalOperator(
  664                   implicitCastExpr(
  665                       hasSourceExpression(opaqueValueExpr(
  666                           hasSourceExpression(integerLiteral(equals(1))))),
  669                   opaqueValueExpr(
  670                       hasSourceExpression(integerLiteral(equals(1))))),
  672                   unaryOperator(
  674                       hasUnaryOperand(integerLiteral(equals(5)))))))));
  685       functionDecl(hasDescendant(
  686           initListExpr(
  687               has(designatedInitExpr(
  689                   hasDescendant(floatLiteral(equals(1.0))),
  690                   hasDescendant(integerLiteral(equals(2))))),
  691               has(designatedInitExpr(
  693                   hasDescendant(floatLiteral(equals(2.0))),
  694                   hasDescendant(integerLiteral(equals(2))))),
  695               has(designatedInitExpr(
  697                   hasDescendant(floatLiteral(equals(1.0))),
  698                   hasDescendant(integerLiteral(equals(0)))))))));
  707       functionDecl(hasDescendant(
  708           predefinedExpr(
  711               has(stringLiteral(hasType(
  723       functionDecl(hasDescendant(
  724           initListExpr(
  726                   cxxConstructExpr(
  729                   initListExpr(
  731                       has(floatLiteral(equals(1.0))),
  732                       has(implicitValueInitExpr(
  735                   initListExpr(
  737                       has(floatLiteral(equals(2.0))),
  738                       has(floatLiteral(equals(1.0)))))))));
  750       functionDecl(hasDescendant(
  751           cStyleCastExpr(hasSourceExpression(vaArgExpr())))));
  760       functionDecl(hasDescendant(
  761           exprWithCleanups(has(cxxConstructExpr(
  761           exprWithCleanups(has(cxxConstructExpr(
  762               has(materializeTemporaryExpr(has(implicitCastExpr(
  762               has(materializeTemporaryExpr(has(implicitCastExpr(
  771       functionDecl(hasDescendant(typedefDecl(has(atomicType())))));
  771       functionDecl(hasDescendant(typedefDecl(has(atomicType())))));
  792       functionTemplateDecl(hasDescendant(
  793           cStyleCastExpr(has(cxxDependentScopeMemberExpr())))));
  802       functionTemplateDecl(hasDescendant(
  803           cStyleCastExpr(has(cxxDependentScopeMemberExpr())))));
  814       functionDecl(
  815           hasDescendant(implicitCastExpr(has(declRefExpr()))),
  816           unless(hasAncestor(translationUnitDecl(has(typeAliasDecl()))))));
  829       functionDecl(
  830           hasDescendant(declRefExpr(to(varTemplateSpecializationDecl()))),
  831           unless(hasAncestor(translationUnitDecl(has(varDecl(
  831           unless(hasAncestor(translationUnitDecl(has(varDecl(
  845       functionDecl(hasDescendant(
  846           returnStmt(has(implicitCastExpr(has(declRefExpr())))))));
  846           returnStmt(has(implicitCastExpr(has(declRefExpr())))))));
  863       classTemplateDecl(has(cxxRecordDecl(has(
  863       classTemplateDecl(has(cxxRecordDecl(has(
  864           fieldDecl(hasType(dependentTemplateSpecializationType())))))));
  879           functionTemplateDecl(hasDescendant(sizeOfPackExpr())));
  889       varDecl(hasType(classTemplateSpecializationDecl(has(fieldDecl(hasType(
  889       varDecl(hasType(classTemplateSpecializationDecl(has(fieldDecl(hasType(
  889       varDecl(hasType(classTemplateSpecializationDecl(has(fieldDecl(hasType(
  890           hasUnqualifiedDesugaredType(constantArrayType(hasSize(7))))))))));
  909       functionDecl(hasDescendant(typeTraitExpr(hasType(asString("int"))))));
  909       functionDecl(hasDescendant(typeTraitExpr(hasType(asString("int"))))));
  923       functionDecl(
  924           hasDescendant(varDecl(
  926           hasDescendant(varDecl(
  938       classTemplateDecl(has(cxxRecordDecl(has(
  938       classTemplateDecl(has(cxxRecordDecl(has(
  939           functionDecl(hasDescendant(
  940               typeTraitExpr(hasType(booleanType())))))))));
  951              functionDecl(hasBody(compoundStmt(
  951              functionDecl(hasBody(compoundStmt(
  952                  has(declStmt(hasSingleDecl(varDecl(hasName("d")))))))));
  952                  has(declStmt(hasSingleDecl(varDecl(hasName("d")))))))));
  963       FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("d")));
  976       FromTU, functionDecl(hasName("declToImport")));
  988       FromTU, functionDecl(hasName("declToImport")));
  993       To, functionDecl(hasName("declToImport"),
 1005       FromTU, functionDecl(hasName("declToImport")));
 1023       functionDecl(hasDescendant(
 1024           callExpr(has(cxxPseudoDestructorExpr())))));
 1033       functionDecl(hasDescendant(usingDecl())));
 1055       namespaceDecl(has(usingShadowDecl())));
 1068       functionTemplateDecl(hasDescendant(unresolvedLookupExpr())));
 1081       functionTemplateDecl(hasDescendant(
 1082           binaryOperator(has(cxxUnresolvedConstructExpr())))));
 1091           functionTemplateDecl(hasDescendant(
 1092               binaryOperator(has(cxxUnresolvedConstructExpr())))));
 1104       functionTemplateDecl(hasAncestor(translationUnitDecl(
 1104       functionTemplateDecl(hasAncestor(translationUnitDecl(
 1105           unless(has(functionDecl(hasName("declToImport"))))))));
 1110       classTemplateDecl(hasAncestor(translationUnitDecl(
 1110       classTemplateDecl(hasAncestor(translationUnitDecl(
 1111           unless(has(cxxRecordDecl(hasName("declToImport"))))))));
 1124              recordDecl(has(classTemplateDecl()),
 1135       cxxRecordDecl(has(cxxMethodDecl(hasDescendant(
 1135       cxxRecordDecl(has(cxxMethodDecl(hasDescendant(
 1146       classTemplateDecl(has(cxxRecordDecl(
 1146       classTemplateDecl(has(cxxRecordDecl(
 1147           has(fieldDecl(hasType(dependentSizedArrayType())))))));
 1154       FromTU, functionDecl(hasName("f")));
 1246                                                   classTemplateDecl(
 1250                                                   classTemplateDecl(
 1303   auto Matcher = functionDecl(hasName("declToImport"),
 1406       translationUnitDecl(unless(has(classTemplateSpecializationDecl())));
 1414   Pattern = translationUnitDecl(has(classTemplateDecl(
 1414   Pattern = translationUnitDecl(has(classTemplateDecl(
 1452   auto Pattern = namespaceDecl(has(classTemplateDecl(
 1452   auto Pattern = namespaceDecl(has(classTemplateDecl(
 1459   Pattern = namespaceDecl(has(classTemplateSpecializationDecl(hasName("X"))));
 1459   Pattern = namespaceDecl(has(classTemplateSpecializationDecl(hasName("X"))));
 1473   ASSERT_TRUE(Verifier.match(From, cxxRecordDecl(hasFieldOrder({"a", "b"}))));
 1474   EXPECT_TRUE(Verifier.match(To, cxxRecordDecl(hasFieldOrder({"a", "b"}))));
 1494       Verifier.match(From, cxxRecordDecl(hasFieldOrder({"a", "b", "c"}))));
 1496       Verifier.match(To, cxxRecordDecl(hasFieldOrder({"a", "b", "c"}))));
 1519       From, cxxRecordDecl(hasFieldOrder({"a", "", "b", "c", "d"}))));
 1521       To, cxxRecordDecl(hasFieldOrder({"a", "", "b", "c", "d"}))));
 1535   auto Matcher = cxxRecordDecl(has(cxxRecordDecl()));
 1553   auto Matcher = classTemplateDecl(has(cxxRecordDecl(has(cxxRecordDecl()))));
 1553   auto Matcher = classTemplateDecl(has(cxxRecordDecl(has(cxxRecordDecl()))));
 1570   auto Pattern = translationUnitDecl(has(classTemplateDecl(
 1570   auto Pattern = translationUnitDecl(has(classTemplateDecl(
 1572       has(classTemplateSpecializationDecl(hasImplicitClass)))));
 1614   auto Pattern = translationUnitDecl(has(classTemplateDecl(
 1614   auto Pattern = translationUnitDecl(has(classTemplateDecl(
 1616       has(classTemplateSpecializationDecl(has(fieldDecl(hasName("a"))))))));
 1616       has(classTemplateSpecializationDecl(has(fieldDecl(hasName("a"))))))));
 1633         FromTU, classTemplateDecl(hasName("B")));
 1648         FromTU, functionDecl(hasName("f")));
 1651         FromTU, classTemplateDecl(hasName("B")));
 1685       FromTU, classTemplateDecl(hasName("B")));
 1709                     ToTU, cxxRecordDecl(unless(isImplicit()))));
 1719       FromTU, cxxRecordDecl(hasName("B")));
 1724                     ToTU, cxxRecordDecl(unless(isImplicit()))));
 1819       FromTU, classTemplateSpecializationDecl(hasName("B")));
 1840       FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("object0")));
 1843       FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("object1")));
 1868       FirstDeclMatcher<RecordDecl>().match(FromTU0, recordDecl(hasName("X")));
 1870       FirstDeclMatcher<RecordDecl>().match(FromTU1, recordDecl(hasName("X")));
 1878             DeclCounter<RecordDecl>().match(ToTU, recordDecl(hasName("X"))));
 1901       FirstDeclMatcher<RecordDecl>().match(FromTU0, recordDecl(hasName("X")));
 1903       FirstDeclMatcher<RecordDecl>().match(FromTU1, recordDecl(hasName("X")));
 1911             DeclCounter<RecordDecl>().match(ToTU, recordDecl(hasName("X"))));
 1915   auto Pattern = varDecl(hasName("x"));
 1934         FromTU, functionDecl(hasName("f")));
 1941   auto Pattern = varDecl(hasName("x"));
 1952         FromTU, functionDecl(hasName("f")));
 1959   auto Pattern = varDecl(hasName("a"));
 1981         FromTU, functionDecl(hasName("f")));
 1990   auto Pattern = varDecl(hasName("x"));
 2010   auto Pattern = functionDecl(hasName("f"));
 2028   auto Pattern = functionDecl(hasName("f"));
 2052       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
 2052       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
 2069       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2069       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2112       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2112       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2114       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
 2114       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
 2142       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2142       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2144       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
 2144       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
 2145   auto BFDefP = cxxMethodDecl(
 2146       hasName("f"), hasParent(cxxRecordDecl(hasName("B"))), isDefinition());
 2147   auto DFDefP = cxxMethodDecl(
 2148       hasName("f"), hasParent(cxxRecordDecl(hasName("D"))), isDefinition());
 2149   auto FDefAllP = cxxMethodDecl(hasName("f"), isDefinition());
 2180       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2180       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2181   auto BFDefP = cxxMethodDecl(
 2182       hasName("f"), hasParent(cxxRecordDecl(hasName("B"))), isDefinition());
 2183   auto DFP = cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))),
 2183   auto DFP = cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))),
 2200       ToTU, cxxRecordDecl(hasName("B")));
 2203       ToTU, cxxMethodDecl(hasName("f"), isDefinition()));
 2233       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2233       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("B"))));
 2234   auto BFDefP = cxxMethodDecl(
 2235       hasName("f"), hasParent(cxxRecordDecl(hasName("B"))), isDefinition());
 2237       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
 2237       cxxMethodDecl(hasName("f"), hasParent(cxxRecordDecl(hasName("D"))));
 2238   auto DFDefP = cxxMethodDecl(
 2239       hasName("f"), hasParent(cxxRecordDecl(hasName("D"))), isDefinition());
 2240   auto FooDef = functionDecl(hasName("foo"));
 2262       ToTU, cxxRecordDecl(hasName("B")));
 2264       ToTU, cxxRecordDecl(hasName("D")));
 2267       ToTU, cxxMethodDecl(hasName("f"), isDefinition()));
 2270       ToTU, cxxMethodDecl(hasName("f"), isDefinition()));
 2292     auto Pattern = varDecl(hasName("v"));
 2313   auto Pattern = functionDecl(hasName("f"));
 2332         FromTU, functionDecl(hasName("g0")));
 2341         FromTU, functionDecl(hasName("g1")));
 2346   ASSERT_EQ(DeclCounter<FunctionDecl>().match(ToTU, functionDecl(hasName("f"))),
 2359       FromTU, functionDecl(hasName("foo")));
 2385       FromTU, functionDecl(hasName("f")));
 2389       ToD, functionDecl(hasName("f"), hasDescendant(declRefExpr()))));
 2411       FromTU, functionDecl(hasName("g")));
 2416       ToTU, translationUnitDecl(hasDescendant(
 2417                 functionDecl(hasName("f"), hasDescendant(declRefExpr()))))));
 2432       FromTU1, functionTemplateDecl(hasName("f")));
 2436       FromTU2, functionTemplateDecl(hasName("f")));
 2454       FromTU1, functionTemplateDecl(hasName("f")));
 2458       FromTU2, functionTemplateDecl(hasName("f")));
 2474       FromTU, functionDecl(hasName("foo")));
 2514       FromTU, functionDecl(hasOverloadedOperatorName("<")));
 2522   auto Pattern = functionDecl(hasName("f"));
 2541   auto Pattern = functionDecl(hasName("f"));
 2558   auto Pattern = functionDecl(hasName("f"));
 2577   auto Pattern = functionDecl(hasName("f"));
 2594   auto Pattern = functionDecl(hasName("f"));
 2623   auto Pattern = functionDecl(hasName("f"));
 2641       ToTU, functionDecl(unless(hasParent(friendDecl()))));
 2651   auto Pattern = functionDecl(hasName("f"));
 2675   auto FunctionPattern = functionDecl(hasName("f"));
 2676   auto ClassPattern = cxxRecordDecl(hasName("X"));
 2709   auto FunctionPattern = functionDecl(hasName("f"));
 2710   auto ClassPattern = cxxRecordDecl(hasName("X"));
 2759   auto FunctionPattern = functionDecl(hasName("f"));
 2760   auto ClassPattern = cxxRecordDecl(hasName("X"));
 2803   auto Pattern = functionDecl(hasName("f"));
 2852       FromTU, functionDecl(hasName("f")));
 2855       FromTU, cxxRecordDecl(hasName("X")));
 2868       ToTU, cxxRecordDecl(hasName("X")));
 2907       enumDecl(has(enumConstantDecl(hasName("THING_VALUE"))),
 2907       enumDecl(has(enumConstantDecl(hasName("THING_VALUE"))),
 2910   ImportAction ImportFoo{"foo.c", "main.c", functionDecl(hasName("foo"))},
 2911       ImportMoo{"moo.c", "main.c", functionDecl(hasName("moo"))};
 2932              recordDecl(hasFieldOrder({"b", "a"})));
 2947              functionTemplateDecl(has(functionDecl(has(compoundStmt(
 2947              functionTemplateDecl(has(functionDecl(has(compoundStmt(
 2947              functionTemplateDecl(has(functionDecl(has(compoundStmt(
 2948                  has(cStyleCastExpr(has(dependentScopeDeclRefExpr())))))))));
 2958              functionTemplateDecl(has(functionDecl(has(compoundStmt(
 2958              functionTemplateDecl(has(functionDecl(has(compoundStmt(
 2958              functionTemplateDecl(has(functionDecl(has(compoundStmt(
 2959                  has(callExpr(has(dependentScopeDeclRefExpr())))))))));
 2971              classTemplateDecl(has(
 2972                  cxxRecordDecl(has(typedefDecl(has(dependentNameType())))))));
 2972                  cxxRecordDecl(has(typedefDecl(has(dependentNameType())))))));
 2984              functionTemplateDecl(has(functionDecl(has(
 2984              functionTemplateDecl(has(functionDecl(has(
 2985                  compoundStmt(has(callExpr(has(unresolvedMemberExpr())))))))));
 2985                  compoundStmt(has(callExpr(has(unresolvedMemberExpr())))))))));
 3017     auto ClassMatcher = cxxRecordDecl(unless(isImplicit()));
 3049   testImportOf(cxxConstructorDecl(isDefaultConstructor()));
 3053   testImportOf(cxxConstructorDecl(isCopyConstructor()));
 3057   testImportOf(cxxConstructorDecl(isMoveConstructor()));
 3065   testImportOf(cxxMethodDecl(isCopyAssignmentOperator()));
 3069   testImportOf(cxxMethodDecl(isMoveAssignmentOperator()));
 3076   testNoImportOf(cxxConstructorDecl(isDefaultConstructor()), Code);
 3083   testNoImportOf(cxxConstructorDecl(isDefaultConstructor()), Code);
 3090   testNoImportOf(cxxConstructorDecl(isDefaultConstructor()), Code);
 3097   testNoImportOf(cxxMethodDecl(hasName("f")), Code);
 3106         FromTU, cxxRecordDecl(hasName("A")));
 3116         FromTU, cxxRecordDecl(hasName("A")));
 3130         FromTU, cxxRecordDecl(hasName("A")));
 3138         FromTU, cxxRecordDecl(hasName("A")));
 3150         FromTU, fieldDecl(hasName("x")));
 3158         FromTU, fieldDecl(hasName("x")));
 3170         FromTU, fieldDecl(hasName("x")));
 3178         FromTU, fieldDecl(hasName("x")));
 3190         FromTU, functionDecl(hasName("x"), isDefinition()));
 3198         FromTU, functionDecl(hasName("x"), isDefinition()));
 3211         FromTU, functionDecl(hasName("x"), isDefinition()));
 3220         FromTU, functionDecl(hasName("x"), isDefinition()));
 3241       FirstDeclMatcher<RecordDecl>().match(FromTU, recordDecl(hasName("A")));
 3247       FirstDeclMatcher<FieldDecl>().match(ToTU, fieldDecl(hasName("entry0")));
 3249       FirstDeclMatcher<FieldDecl>().match(ToTU, fieldDecl(hasName("entry1")));
 3254       R0, recordDecl(has(fieldDecl(hasName("next"))))));
 3254       R0, recordDecl(has(fieldDecl(hasName("next"))))));
 3256       R1, recordDecl(has(fieldDecl(hasName("next"))))));
 3256       R1, recordDecl(has(fieldDecl(hasName("next"))))));
 3268       FromTU, functionDecl(hasName("f")));
 3313       ToTU, classTemplateSpecializationDecl(hasName("X")));
 3326       FromTU, classTemplateSpecializationDecl(hasName("X")));
 3365       FromTU, classTemplateSpecializationDecl(hasName("X")));
 3366   auto FunPattern = functionDecl(hasName("g"),
 3377       ToTU, classTemplateSpecializationDecl(hasName("X")));
 3412       FromTU, classTemplateSpecializationDecl(hasName("X")));
 3424                 ToTU, classTemplateSpecializationDecl(hasName("X"))));
 3450       FromTU, classTemplateSpecializationDecl(hasName("X")));
 3453       cxxConstructorDecl(hasParameter(0, varDecl(hasType(asString("int")))),
 3453       cxxConstructorDecl(hasParameter(0, varDecl(hasType(asString("int")))),
 3464       ToTU, classTemplateSpecializationDecl(hasName("X")));
 3550                     ToTU, classTemplateSpecializationDecl(
 3561   auto *FromD = FirstDeclMatcher<VarDecl>().match(TU, varDecl(hasName("a")));
 3586       FromTU, varDecl(hasName("a"))); // Decl with init
 3588       FromTU, varDecl(hasName("a"))); // Decl with definition
 3612       FromTU, varDecl(hasName("a"))); // Decl with init
 3614       FromTU, varDecl(hasName("a"))); // Decl with definition
 3622       ToTU, varDecl(hasName("a"))); // Decl with init
 3643       FromTU, varDecl(hasName("a")));
 3645       FromTU, varDecl(hasName("a"))); // Decl with definition and with init.
 3653       ToTU, varDecl(hasName("a")));
 3667   auto Pattern = recordDecl(hasName("X"), unless(isImplicit()));
 3685   auto Pattern = recordDecl(hasName("X"), unless(isImplicit()));
 3703   auto Pattern = recordDecl(hasName("X"), unless(isImplicit()));
 3738       FromTU, cxxRecordDecl(hasName("F"), isDefinition()));
 3740       FromTU, cxxRecordDecl(hasName("F")));
 3772       FromTu, cxxRecordDecl(hasName("declToImport")));
 3774   auto Pattern = cxxRecordDecl(has(friendDecl()));
 3792   auto Pattern = classTemplateDecl(
 3793       has(cxxRecordDecl(has(friendDecl(has(classTemplateDecl()))))));
 3793       has(cxxRecordDecl(has(friendDecl(has(classTemplateDecl()))))));
 3805   auto Pattern = classTemplateSpecializationDecl(hasName("X"));
 3849       FromTU0, classTemplateDecl(hasName("F")));
 3858       FromTU1, classTemplateDecl(hasName("F")));
 3888       ToTU, classTemplateDecl(hasName("F")));
 3896       FromTU, classTemplateDecl(hasName("F")));
 3918       FromTU0, classTemplateDecl(hasName("F")));
 3927       FromTU1, classTemplateDecl(hasName("F")));
 3957       FromTU1, cxxRecordDecl(hasName("F")));
 3972       ToTU, functionDecl(hasName("foo")));
 3976       FromTU, functionDecl(hasName("foo")));
 4013   auto *A0 = FirstDeclMatcher<VarDecl>().match(TU, varDecl(hasName("A")));
 4014   auto *A1 = LastDeclMatcher<VarDecl>().match(TU, varDecl(hasName("A")));
 4059   auto Pattern = translationUnitDecl(
 4060       unless(has(functionDecl(hasName("f"), isTemplateInstantiation()))));
 4064       FromTU, functionDecl(hasName("foo")));
 4083   auto Instantiation = functionDecl(hasName("f"), isTemplateInstantiation());
 4084   auto Pattern = translationUnitDecl(unless(has(Instantiation)));
 4107       functionDecl(hasName("f"), isExplicitTemplateSpecialization());
 4108   auto Pattern = translationUnitDecl(has(Specialization));
 4129   auto Spec = functionDecl(hasName("f"), isExplicitTemplateSpecialization(),
 4173       FromTU, functionDecl(hasName("foo")));
 4178       DeclCounter<FunctionDecl>().match(FromTU, functionDecl(hasName("f"))),
 4179       DeclCounter<FunctionDecl>().match(ToTU, functionDecl(hasName("f"))));
 4192         FromTU, classTemplateDecl(hasName("B")));
 4208         FromTU, functionDecl(hasName("f")));
 4211         FromTU, classTemplateDecl(hasName("B")));
 4234       typedefNameDecl(hasName("U")));
 4246       typedefNameDecl(hasName("U")));
 4264       functionDecl(hasName("f"), isExplicitTemplateSpecialization()));
 4276   auto *D = FirstDeclMatcher<VarDecl>().match(ToTU, varDecl(hasName("a")));
 4302       ToTU, classTemplateDecl(hasName("X")));
 4304       ToTU, functionDecl(hasName("foo")));
 4338       FirstDeclMatcher<RecordDecl>().match(ToTU, recordDecl(hasName("Foo")));
 4340       FirstDeclMatcher<RecordDecl>().match(ToTU, recordDecl(hasName("A")));
 4373                               .match(ToTU, varDecl(hasName("V")))
 4376       FirstDeclMatcher<RecordDecl>().match(ToTU, recordDecl(hasName("A")));
 4378       FirstDeclMatcher<RecordDecl>().match(ToTU, recordDecl(hasName("B")));
 4385                         ToTU, fieldDecl(hasName("V"),
 4386                                         hasParent(recordDecl(hasName("A"))))));
 4390                         ToTU, fieldDecl(hasName("V"),
 4391                                         hasParent(recordDecl(hasName("B"))))));
 4395                         ToTU, varDecl(hasName("V"),
 4430       ToTU, functionDecl(hasOverloadedOperatorName("+")));
 4432       ToTU, functionDecl(hasOverloadedOperatorName("-")));
 4454       ToTU, functionDecl(hasOverloadedOperatorName("+")));
 4463       FromTU, functionDecl(hasOverloadedOperatorName("+")));
 4497       ToTU, cxxRecordDecl(hasName("Y")));
 4522   auto *Y = FirstDeclMatcher<CXXRecordDecl>().match(ToTU, cxxRecordDecl(hasName("Y")));
 4548       ToTU, typeAliasDecl(hasName("alias_of_f")));
 4563       ToTU, classTemplateDecl(hasName("F")));
 4586       ToTU, classTemplateDecl(hasName("F")));
 4608       ToTU, classTemplateDecl(hasName("F")));
 4626       FirstDeclMatcher<FunctionDecl>().match(ToTU, functionDecl(hasName("F")));
 4650       ToTU, classTemplateDecl(hasName("X")));
 4653       fieldDecl(hasParent(cxxRecordDecl(hasParent(classTemplateDecl())))));
 4653       fieldDecl(hasParent(cxxRecordDecl(hasParent(classTemplateDecl())))));
 4656       ToTU, classTemplateSpecializationDecl(hasName("X")));
 4691       ToTU, functionTemplateDecl(hasName("F")));
 4714       ToTU, cxxRecordDecl(hasName("X")));
 4739   auto *E = FirstDeclMatcher<EnumDecl>().match(ToTU, enumDecl(hasName("E")));
 4741       ToTU, enumConstantDecl(hasName("A")));
 4778       LastDeclMatcher<NamespaceDecl>().match(ToTU, namespaceDecl(hasName("N")));
 4779   auto *A = FirstDeclMatcher<VarDecl>().match(ToTU, varDecl(hasName("A")));
 4807       FromTU, cxxRecordDecl(hasName("X"), unless(isImplicit())));
 4810       cxxRecordDecl(hasName("X"), isDefinition(), unless(isImplicit())));
 4838       ToTU, functionTemplateDecl(hasName("foo")));
 4846       FromTU, functionTemplateDecl(hasName("foo")));
 4893       FromTU, classTemplateSpecializationDecl(hasName("X")));
 4899                 ToTU, classTemplateSpecializationDecl(hasName("X"))),
 4917       FromTU, functionDecl(hasName("foo")));
 4925       DeclCounter<FunctionDecl>().match(ToTU, functionDecl(hasName("foo"))),
 4945       FromTU, functionDecl(hasName("f")));
 4947       LastDeclMatcher<FunctionDecl>().match(FromTU, functionDecl(hasName("f")));
 4954   EXPECT_EQ(DeclCounter<FunctionDecl>().match(ToTU, functionDecl(hasName("f"))),
 4958       FirstDeclMatcher<FunctionDecl>().match(ToTU, functionDecl(hasName("f")));
 4983       FromTU, cxxRecordDecl(hasName("X")));
 4995       FromTU, cxxMethodDecl(hasName("f")));
 5005       FromTU, cxxMethodDecl(hasName("ok")));
 5036       FromTU, cxxRecordDecl(hasName("F"), isDefinition()));
 5038       FromTU, cxxRecordDecl(hasName("A"), isDefinition()));
 5040       FromTU, cxxRecordDecl(hasName("B"), isDefinition()));
 5042       FromTU, namespaceDecl(hasName("NS")));
 5078           FromTU, classTemplateDecl(hasName("F"))));
 5089           FromTU, cxxRecordDecl(hasName("A"), isImplicit())));
 5094           FromTU, cxxRecordDecl(hasName("X"), isImplicit())));
 5109       FromTU, namespaceDecl(hasName("X")));
 5120       FromTU, functionDecl(hasName("f")));
 5130       FromTU, functionDecl(hasName("ok")));
 5155         FromTU, cxxRecordDecl(hasName("X")));
 5167       ToTU, cxxRecordDecl(hasName("X"), isDefinition()));
 5175       ToTU, cxxRecordDecl(hasName("X"), unless(isDefinition())));
 5191         FromTU, cxxRecordDecl(hasName("X")));
 5213       functionDecl(hasName("foo"), hasAncestor(cxxRecordDecl(hasName("A"))));
 5213       functionDecl(hasName("foo"), hasAncestor(cxxRecordDecl(hasName("A"))));
 5215       functionDecl(hasName("foo"), hasAncestor(cxxRecordDecl(hasName("B"))));
 5215       functionDecl(hasName("foo"), hasAncestor(cxxRecordDecl(hasName("B"))));
 5217       functionDecl(hasName("foo"), hasAncestor(cxxRecordDecl(hasName("C"))));
 5217       functionDecl(hasName("foo"), hasAncestor(cxxRecordDecl(hasName("C"))));
 5305       FromTU, functionDecl(hasName("f")));
 5327       ToTU, classTemplateDecl(hasName("Class")));
 5329       ToTU, classTemplateDecl(hasName("Class")));
 5338       FromTU, classTemplateDecl(hasName("Class")));
 5340       FromTU, classTemplateDecl(hasName("Class")));
 5377       ToTU, cxxRecordDecl(hasName("X")));
 5392       FromTU, cxxRecordDecl(hasName("X")));
 5421       ToTU, typedefDecl(hasName(TypeName)));
 5425       FromTU, typedefDecl(hasName(TypeName)));
 5445         FromTU, cxxRecordDecl(hasName("X"), unless(isImplicit())));
 5467       FromTU, cxxRecordDecl(hasName("X")));
 5470       ImportedX, cxxConstructorDecl(hasName("X"), unless(isImplicit())));
 5472       ImportedX, cxxConstructorDecl(hasName("X"), unless(isImplicit())));
 5520   auto Pattern = cxxRecordDecl(isLambda());
 5541   auto Pattern = cxxRecordDecl(isLambda());
 5564       FromTU, functionDecl(hasName("f")));
 5567       DeclCounter<CXXRecordDecl>().match(FromTU, cxxRecordDecl(isLambda())),
 5574   EXPECT_EQ(DeclCounter<CXXRecordDecl>().match(ToTU, cxxRecordDecl(isLambda())),
 5588       FromTU, functionDecl(hasName("f")));
 5591       DeclCounter<CXXRecordDecl>().match(FromTU, cxxRecordDecl(isLambda())),
 5598   EXPECT_EQ(DeclCounter<CXXRecordDecl>().match(ToTU, cxxRecordDecl(isLambda())),
tools/clang/unittests/AST/ASTImporterVisibilityTest.cpp
   28   BindableMatcher<Decl> operator()() { return functionDecl(hasName("f")); }
   32   BindableMatcher<Decl> operator()() { return varDecl(hasName("v")); }
   36   BindableMatcher<Decl> operator()() { return cxxRecordDecl(hasName("X")); }
   40   BindableMatcher<Decl> operator()() { return enumDecl(hasName("E")); }
   44   BindableMatcher<Decl> operator()() { return typedefNameDecl(hasName("T")); }
   49     return functionTemplateDecl(hasName("f"));
tools/clang/unittests/AST/ASTTraverserTest.cpp
   90   auto Result = ast_matchers::match(functionDecl(hasName(Name)).bind("fn"),
  214       classTemplateSpecializationDecl(hasName("templ")).bind("fn"),
tools/clang/unittests/AST/ASTTypeTraitsTest.cpp
  141   EXPECT_TRUE(Verifier.match("void f() {}", typeLoc(loc(functionType()))));
tools/clang/unittests/AST/DeclPrinterTest.cpp
  113                             namedDecl(hasName(DeclName)).bind("id"),
  138                             namedDecl(hasName(DeclName)).bind("id"),
  390       functionDecl(hasName("A"), isDefinition()).bind("id"),
  489     functionDecl(hasName("A"), isExplicitTemplateSpecialization()).bind("id"),
  499     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  508     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  517     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  526     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  536     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  546     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  556     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  565     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  574     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  583     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  592     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  602     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  612     cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
  621     cxxDestructorDecl(ofClass(hasName("A"))).bind("id"),
  630     cxxDestructorDecl(ofClass(hasName("A"))).bind("id"),
  639     cxxMethodDecl(ofClass(hasName("A"))).bind("id"),
  648     cxxMethodDecl(ofClass(hasName("A"))).bind("id"),
  658     cxxMethodDecl(ofClass(hasName("A"))).bind("id"),
  668     cxxMethodDecl(ofClass(hasName("Z"))).bind("id"),
  678     cxxMethodDecl(ofClass(hasName("Z"))).bind("id"),
  687     cxxMethodDecl(ofClass(hasName("Z"))).bind("id"),
  697     cxxMethodDecl(ofClass(hasName("Z"))).bind("id"),
  706     cxxMethodDecl(ofClass(hasName("Z"))).bind("id"),
  733       cxxMethodDecl(ofClass(hasName("Z"))).bind("id"),
  756       cxxMethodDecl(ofClass(hasName("Z"))).bind("id"),
  969     classTemplateDecl(hasName("A")).bind("id"),
  977     classTemplateDecl(hasName("A")).bind("id"),
  985     classTemplateDecl(hasName("A")).bind("id"),
  993     classTemplateDecl(hasName("A")).bind("id"),
 1001     classTemplateDecl(hasName("A")).bind("id"),
 1009     classTemplateDecl(hasName("A")).bind("id"),
 1018     classTemplateDecl(hasName("A")).bind("id"),
 1025     classTemplateDecl(hasName("A")).bind("id"),
 1033     classTemplateDecl(hasName("A")).bind("id"),
 1041     classTemplateDecl(hasName("A")).bind("id"),
 1049     classTemplateDecl(hasName("A")).bind("id"),
 1088     functionTemplateDecl(hasName("A")).bind("id"),
 1096     functionTemplateDecl(hasName("A")).bind("id"),
 1104     functionTemplateDecl(hasName("A")).bind("id"),
 1111     functionTemplateDecl(hasName("A")).bind("id"),
 1118     functionTemplateDecl(hasName("A")).bind("id"),
 1127     functionTemplateDecl(hasName("A")).bind("id"),
 1299     namedDecl(hasName("A:inRange:"),
 1300               hasDescendant(namedDecl(hasName("printThis")))).bind("id"),
 1307     namedDecl(hasName("P1")).bind("id"),
 1311     namedDecl(hasName("P2")).bind("id"),
 1319     namedDecl(hasName("P1")).bind("id"),
tools/clang/unittests/AST/NamedDeclPrinterTest.cpp
  118                                  namedDecl(hasName(DeclName)).bind("id"),
  130                                  namedDecl(hasName(DeclName)).bind("id"),
  142                                  objcPropertyDecl(hasName(DeclName)).bind("id"),
  151   return PrintedDeclMatches(Code, Args, namedDecl(hasName(DeclName)).bind("id"),
tools/clang/unittests/AST/OMPStructuredBlockTest.cpp
   34   return stmt(isOMPStructuredBlock(),
   35               unless(hasDescendant(stmt(isOMPStructuredBlock()))))
   40   return stmt(ompExecutableDirective(isStandaloneDirective())).bind("id");
   40   return stmt(ompExecutableDirective(isStandaloneDirective())).bind("id");
  359   return stmt(
  361              hasAncestor(ompExecutableDirective(ompSectionsDirective())),
  362              unless(hasAncestor(ompExecutableDirective(ompSectionDirective()))))
tools/clang/unittests/AST/SourceLocationTest.cpp
  526       Code, friendDecl(has(cxxConstructorDecl(ofClass(hasName("B")))))));
  526       Code, friendDecl(has(cxxConstructorDecl(ofClass(hasName("B")))))));
  530       Code, friendDecl(has(cxxDestructorDecl(ofClass(hasName("B")))))));
  530       Code, friendDecl(has(cxxDestructorDecl(ofClass(hasName("B")))))));
  544       Code, friendDecl(has(cxxConstructorDecl(ofClass(hasName("B")))))));
  544       Code, friendDecl(has(cxxConstructorDecl(ofClass(hasName("B")))))));
  548       Code, friendDecl(has(cxxDestructorDecl(ofClass(hasName("B")))))));
  548       Code, friendDecl(has(cxxDestructorDecl(ofClass(hasName("B")))))));
  619       friendDecl(hasParent(cxxRecordDecl(isTemplateInstantiation())))));
  619       friendDecl(hasParent(cxxRecordDecl(isTemplateInstantiation())))));
  729                               parmVarDecl(hasType(pointerType(pointee(
  729                               parmVarDecl(hasType(pointerType(pointee(
  729                               parmVarDecl(hasType(pointerType(pointee(
  730                                   parenType(innerType(functionType()))))))));
  730                                   parenType(innerType(functionType()))))))));
  734                               parmVarDecl(hasType(pointerType(pointee(
  734                               parmVarDecl(hasType(pointerType(pointee(
  734                               parmVarDecl(hasType(pointerType(pointee(
  735                                   parenType(innerType(functionType())))))),
  735                                   parenType(innerType(functionType())))))),
tools/clang/unittests/AST/StmtPrinterTest.cpp
   37   return functionDecl(hasName(ContainingFunction),
   38                       has(compoundStmt(has(stmt().bind("id")))));
  141     cxxMemberCallExpr(anything()).bind("id"),
  155     cxxMemberCallExpr(anything()).bind("id"),
  165     lambdaExpr(anything()).bind("id"),
  174     lambdaExpr(anything()).bind("id"),
  182     lambdaExpr(anything()).bind("id"),
  192     lambdaExpr(anything()).bind("id"),
  206       CPPSource, memberExpr(anything()).bind("id"), "field",
  211       CPPSource, memberExpr(anything()).bind("id"), "this->field"));
  240                                     lambdaExpr(anything()).bind("id"),
  245       StdVer::CXX11, CPPSource, lambdaExpr(anything()).bind("id"), "[] {}",
tools/clang/unittests/AST/StructuralEquivalenceTest.cpp
   76     auto Matcher = namedDecl(hasName(Identifier));
  197       get<1>(Decls), classTemplateDecl(hasName("Base")));
  211       get<1>(Decls), cxxRecordDecl(hasName("X")));
  213       FirstDeclMatcher<FieldDecl>().match(get<1>(Decls), fieldDecl(hasName("a")));
  237       functionDecl(hasOverloadedOperatorName("<")),
  238       functionDecl(hasOverloadedOperatorName("==")));
  246       functionDecl(hasOverloadedOperatorName("<")),
  247       functionDecl(hasOverloadedOperatorName("<")));
  438       cxxMethodDecl(hasName("foo")));
  483       cxxMethodDecl(hasName("foo")));
  496       functionDecl(hasName("foo")), cxxConstructorDecl(hasName("foo")));
  496       functionDecl(hasName("foo")), cxxConstructorDecl(hasName("foo")));
  503                                          cxxConstructorDecl(hasName("X")));
  511                                          cxxConstructorDecl(hasName("X")));
  519                                          cxxConstructorDecl(hasName("X")));
  535       functionDecl(hasOverloadedOperatorName("+")),
  536       functionDecl(hasOverloadedOperatorName("-")));
  545       functionDecl(allOf(hasName("f"), isDefinition())));
  554       functionDecl(allOf(hasName("f"), isDefinition())));
  571       cxxRecordDecl(hasName("A")),
  572       cxxRecordDecl(hasName("B")));
  646       FirstDeclMatcher<FieldDecl>().match(TU, fieldDecl(hasName("entry0")));
  648       FirstDeclMatcher<FieldDecl>().match(TU, fieldDecl(hasName("entry1")));
  673       TU, indirectFieldDecl(hasName("a")));
  677       TU, indirectFieldDecl(hasName("b")));
  706       TU, indirectFieldDecl(hasName("a")));
  712       TU1, indirectFieldDecl(hasName("a")));
  717       FirstDeclMatcher<RecordDecl>().match(TU, recordDecl(hasName("X")));
  719       FirstDeclMatcher<RecordDecl>().match(TU1, recordDecl(hasName("X")));
  746       FirstDeclMatcher<FieldDecl>().match(FromTU, fieldDecl(hasName("entry1")));
  750       FirstDeclMatcher<FieldDecl>().match(ToTU, fieldDecl(hasName("entry0")));
  752       FirstDeclMatcher<RecordDecl>().match(ToTU, recordDecl(hasName("A")));
  770       cxxRecordDecl(hasName("A")));
  864       get<0>(Decls), cxxConstructorDecl(hasName("foo")));
  866       get<1>(Decls), cxxConstructorDecl(hasName("foo")));
  874       get<0>(Decls), cxxConstructorDecl(hasName("foo")));
  876       get<1>(Decls), cxxConstructorDecl(hasName("foo")));
  931       get<0>(Decls), cxxConstructorDecl(hasName("foo<b>")));
  933       get<1>(Decls), cxxConstructorDecl(hasName("foo<b>")));
  941       get<0>(Decls), cxxConstructorDecl(hasName("foo<b>")));
  943       get<1>(Decls), cxxConstructorDecl(hasName("foo<b>")));
  973       Lang_CXX, classTemplateSpecializationDecl(hasName("Primary")));
 1004       Lang_CXX, classTemplateSpecializationDecl(hasName("Primary")));
 1028                                            functionTemplateDecl(hasName("f")));
 1060                                            functionTemplateDecl(hasName("f")));
 1081                                            functionTemplateDecl(hasName("f")));
 1113                                            functionTemplateDecl(hasName("f")));
 1142                                            functionTemplateDecl(hasName("f")));
 1168       classTemplateSpecializationDecl(hasName("Primary")));
 1195       classTemplateSpecializationDecl(hasName("Primary")));
 1221       classTemplateSpecializationDecl(hasName("Primary")));
 1248       classTemplateSpecializationDecl(hasName("Primary")));
 1273       classTemplateSpecializationDecl(hasName("Primary")));
 1312   auto X = findDeclPair<FunctionDecl>(TU, functionDecl(hasName("x")));
 1316       TU, cxxRecordDecl(hasName("A"), unless(isImplicit())))));
 1318       TU, cxxRecordDecl(hasName("B"), unless(isImplicit())))));
 1350       TU, cxxRecordDecl(hasName("C"), unless(isImplicit())));
 1355       TU, cxxRecordDecl(hasName("A"), unless(isImplicit())))));
 1357       TU, cxxRecordDecl(hasName("B"), unless(isImplicit())))));
 1359       findDeclPair<FunctionDecl>(TU, functionDecl(hasName("x")))));
 1361       findDeclPair<FunctionDecl>(TU, functionDecl(hasName("y")))));
 1389       TU, cxxRecordDecl(hasName("C"), unless(isImplicit())));
 1394       TU, cxxRecordDecl(hasName("A"), unless(isImplicit())))));
 1396       findDeclPair<FunctionDecl>(TU, functionDecl(hasName("x")))));
tools/clang/unittests/ASTMatchers/ASTMatchersInternalTest.cpp
   24     DeclarationMatcher HasEmptyName = recordDecl(hasName(""));
   31       DeclarationMatcher HasEmptyName = recordDecl(matchesName(""));
   55   DeclarationMatcher HasClassB = just(has(recordDecl(hasName("B")).bind("b")));
   78       polymorphicHas(recordDecl(hasName("B")).bind("b"));
   90       polymorphicHas(recordDecl(hasName("B")));
  177                       functionDecl(isInline(), hasName("f"))));
  179                       namespaceDecl(isInline(), hasName("m"))));
  188                       recordDecl(hasName("X"), isExpansionInMainFile())));
  189   EXPECT_TRUE(notMatches("", recordDecl(isExpansionInMainFile())));
  193                                    recordDecl(isExpansionInMainFile()), false,
  201       "#include \"other\"\n", recordDecl(isExpansionInSystemHeader()), true,
  204                                    recordDecl(isExpansionInSystemHeader()),
  207                          recordDecl(isExpansionInSystemHeader())));
  208   EXPECT_TRUE(notMatches("", recordDecl(isExpansionInSystemHeader())));
  219       recordDecl(isExpansionInFileMatching("b.*"), hasName("B")), true,
  225       recordDecl(isExpansionInFileMatching("f.*"), hasName("X")), false,
tools/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
   28       callExpr(allOf(callee(functionDecl(hasName("f"))),
   28       callExpr(allOf(callee(functionDecl(hasName("f"))),
   29                      hasArgument(0, declRefExpr(to(varDecl())))))));
   31       callExpr(allOf(callee(functionDecl(hasName("f"))),
   31       callExpr(allOf(callee(functionDecl(hasName("f"))),
   32                      hasArgument(0, declRefExpr(to(varDecl()))),
   34                                         recordDecl(hasName("T")))))))));
   36       callExpr(allOf(callee(functionDecl(hasName("f"))),
   36       callExpr(allOf(callee(functionDecl(hasName("f"))),
   37                      hasArgument(0, declRefExpr(to(varDecl()))),
   39                                         recordDecl(hasName("T"))))),
   40                      hasArgument(2, integerLiteral(equals(3)))))));
   42       callExpr(allOf(callee(functionDecl(hasName("f"))),
   42       callExpr(allOf(callee(functionDecl(hasName("f"))),
   43                      hasArgument(0, declRefExpr(to(varDecl()))),
   45                                         recordDecl(hasName("T"))))),
   46                      hasArgument(2, integerLiteral(equals(3))),
   47                      hasArgument(3, integerLiteral(equals(4)))))));
   51   DeclarationMatcher HasClassX = recordDecl(has(recordDecl(hasName("X"))));
   51   DeclarationMatcher HasClassX = recordDecl(has(recordDecl(hasName("X"))));
   56     recordDecl(hasName("Y"), has(recordDecl(hasName("X"))));
   56     recordDecl(hasName("Y"), has(recordDecl(hasName("X"))));
   65     recordDecl(
   66       has(recordDecl(
   67         has(recordDecl(hasName("X"))),
   68         has(recordDecl(hasName("Y"))),
   70       has(recordDecl(
   71         has(recordDecl(hasName("A"))),
   72         has(recordDecl(hasName("B"))),
  123     recordDecl(
  125         has(recordDecl(
  127             has(recordDecl(
  129             has(recordDecl(
  132         has(recordDecl(
  135             has(recordDecl(
  137             has(recordDecl(
  154     cxxRecordDecl(
  166     recordDecl(
  168       has(recordDecl(hasName("Z"))),
  170         has(recordDecl(hasName("Y")))));
  176     namedDecl(hasName("Foo"), unless(recordDecl()));
  183               castExpr(hasCastKind(CK_NullToPointer))));
  185               castExpr(hasCastKind(CK_DerivedToBase))));
  187               implicitCastExpr(hasCastKind(CK_NullToPointer))));
  192     recordDecl(
  193       hasDescendant(recordDecl(hasName("X"))),
  207     recordDecl(
  208       hasDescendant(recordDecl(has(recordDecl(hasName("Y"))),
  208       hasDescendant(recordDecl(has(recordDecl(hasName("Y"))),
  230     recordDecl(
  231       hasDescendant(recordDecl(hasDescendant(recordDecl(hasName("Y"))),
  231       hasDescendant(recordDecl(hasDescendant(recordDecl(hasName("Y"))),
  252     decl(hasDescendant(typeLoc().bind("x")), has(decl()));
  262                          decl(hasDescendant(VD), hasDescendant(RD))));
  264                          decl(hasDescendant(RD), hasDescendant(VD))));
  267                       decl(anyOf(hasDescendant(RD), hasDescendant(VD)))));
  274   DeclarationMatcher CannotMemoize = classTemplateSpecializationDecl(
  276     forEach(fieldDecl(hasAncestor(forStmt()))));
  285                       decl(hasAttr(clang::attr::WarnUnused))));
  287                        decl(hasAttr(clang::attr::WarnUnused))));
  292   DeclarationMatcher YOrZDerivedFromX = cxxRecordDecl(
  301     recordDecl(anyOf(hasName("X"), hasName("Y"), hasName("Z"), hasName("U")));
  306     recordDecl(anyOf(hasName("X"), hasName("Y"), hasName("Z"), hasName("U"),
  315   StatementMatcher MixedTypes = stmt(anyOf(ifStmt(), binaryOperator()));
  322             cxxCatchStmt(anyOf(hasDescendant(varDecl()), isCatchAll()))));
  326   DeclarationMatcher IsDerivedFromX = cxxRecordDecl(isDerivedFrom("X"));
  335       cxxRecordDecl(isDirectlyDerivedFrom("X"));
  344   DeclarationMatcher IsAX = cxxRecordDecl(isSameOrDerivedFrom("X"));
  353     cxxRecordDecl(hasName("Z"), isDerivedFrom("X"));
  355       cxxRecordDecl(hasName("Z"), isDirectlyDerivedFrom("X"));
  484                cxxRecordDecl(isDerivedFrom(recordDecl(hasName("Some"))))));
  484                cxxRecordDecl(isDerivedFrom(recordDecl(hasName("Some"))))));
  491     cxxRecordDecl(hasName("B"), isDerivedFrom(recordDecl(hasName("A"))))));
  491     cxxRecordDecl(hasName("B"), isDerivedFrom(recordDecl(hasName("A"))))));
  498       cxxRecordDecl(hasName("B"),
  499                     isDirectlyDerivedFrom(recordDecl(hasName("A"))))));
  515     varDecl(hasName("z_float"),
  516             hasInitializer(hasType(cxxRecordDecl(isDerivedFrom("Base1")))))));
  519     varDecl(hasName("z_float"),
  520             hasInitializer(hasType(cxxRecordDecl(isDerivedFrom("Base2")))))));
  523     varDecl(hasName("z_char"),
  524             hasInitializer(hasType(cxxRecordDecl(isDerivedFrom("Base1"),
  540     varDecl(hasName("z_float"),
  541             hasInitializer(hasType(cxxRecordDecl(isDerivedFrom("Base1")))))));
  544     varDecl(hasName("z_float"),
  545             hasInitializer(hasType(cxxRecordDecl(isDerivedFrom("Base2")))))));
  548     varDecl(hasName("z_char"),
  549             hasInitializer(hasType(cxxRecordDecl(isDerivedFrom("Base1"),
  553     cxxRecordDecl(isDerivedFrom("::ns::X"))));
  556     cxxRecordDecl(isDerivedFrom("::ns::X"))));
  560     cxxRecordDecl(isDerivedFrom(recordDecl(hasName("X")).bind("test")))));
  560     cxxRecordDecl(isDerivedFrom(recordDecl(hasName("X")).bind("test")))));
  566     cxxRecordDecl(isDerivedFrom(namedDecl(hasName("X"))))));
  566     cxxRecordDecl(isDerivedFrom(namedDecl(hasName("X"))))));
  571   EXPECT_TRUE(notMatches(Code, cxxRecordDecl(isDerivedFrom(""))));
  572   EXPECT_TRUE(notMatches(Code, cxxRecordDecl(isDirectlyDerivedFrom(""))));
  573   EXPECT_TRUE(notMatches(Code, cxxRecordDecl(isSameOrDerivedFrom(""))));
  577   DeclarationMatcher IsDerivedFromX = objcInterfaceDecl(isDerivedFrom("X"));
  596       objcInterfaceDecl(isDirectlyDerivedFrom("X"));
  616   DeclarationMatcher IsAX = objcInterfaceDecl(isSameOrDerivedFrom("X"));
  624       objcInterfaceDecl(hasName("Z"), isDerivedFrom("X"));
  626       objcInterfaceDecl(hasName("Z"), isDirectlyDerivedFrom("X"));
  682   const auto IsLambda = cxxMethodDecl(ofClass(cxxRecordDecl(isLambda())));
  682   const auto IsLambda = cxxMethodDecl(ofClass(cxxRecordDecl(isLambda())));
  688   DeclarationMatcher ClassX = has(recordDecl(hasName("::X")).bind("x"));
  697     recordDecl(hasName("A"), has(recordDecl(hasName("B")).bind("b"))));
  697     recordDecl(hasName("A"), has(recordDecl(hasName("B")).bind("b"))));
  704     callExpr(callee(cxxMethodDecl(hasName("x")))).bind("x");
  704     callExpr(callee(cxxMethodDecl(hasName("x")))).bind("x");
  713     binaryOperator(hasOperatorName("+"),
  715                    hasRHS(integerLiteral(equals(0)))),
  716     binaryOperator(hasOperatorName("+"),
  717                    hasLHS(integerLiteral(equals(0))),
  731   DeclarationMatcher ClassX = recordDecl(hasName("X")).bind("x");
  735       recordDecl(hasName("A"), hasDescendant(ClassX)),
  736       recordDecl(hasName("B"), hasDescendant(ClassX)))),
  743             cxxMemberCallExpr(on(hasType(asString("class Y *"))))));
  746             cxxMethodDecl(hasParameter(0, hasType(asString("int"))))));
  748                       fieldDecl(hasType(asString("ns::A")))));
  750                       fieldDecl(hasType(asString("struct (anonymous namespace)::A")))));
  755     cxxOperatorCallExpr(hasOverloadedOperatorName("&&"));
  760     cxxOperatorCallExpr(hasOverloadedOperatorName("<<"));
  766     cxxOperatorCallExpr(hasOverloadedOperatorName("*"));
  770     cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*")));
  775   DeclarationMatcher AnyOpStar = functionDecl(hasOverloadedOperatorName("*"));
  786     cxxOperatorCallExpr(hasOverloadedOperatorName("&&")).bind("x"),
  791                       cxxOperatorCallExpr(hasParent(cxxOperatorCallExpr()))));
  796             cxxOperatorCallExpr(hasDescendant(cxxOperatorCallExpr()))));
  800   auto M = varDecl(hasName("X"), hasLocalStorage());
  805   M = varDecl(hasName("X"), hasGlobalStorage());
  812   auto M = varDecl(isStaticLocal());
  823   EXPECT_TRUE(matches(T, varDecl(hasName("x"), hasAutomaticStorageDuration())));
  825     notMatches(T, varDecl(hasName("y"), hasAutomaticStorageDuration())));
  827     notMatches(T, varDecl(hasName("a"), hasAutomaticStorageDuration())));
  829   EXPECT_TRUE(matches(T, varDecl(hasName("y"), hasStaticStorageDuration())));
  830   EXPECT_TRUE(matches(T, varDecl(hasName("a"), hasStaticStorageDuration())));
  831   EXPECT_TRUE(matches(T, varDecl(hasName("b"), hasStaticStorageDuration())));
  832   EXPECT_TRUE(matches(T, varDecl(hasName("c"), hasStaticStorageDuration())));
  833   EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), hasStaticStorageDuration())));
  839   EXPECT_TRUE(notMatches(T, varDecl(hasName("x"), hasThreadStorageDuration())));
  840   EXPECT_TRUE(notMatches(T, varDecl(hasName("y"), hasThreadStorageDuration())));
  841   EXPECT_TRUE(notMatches(T, varDecl(hasName("a"), hasThreadStorageDuration())));
  847     varDecl(hasName("i"))));
  857     sizeOfExpr(hasArgumentOfType(hasDeclaration(recordDecl(hasName("A")))))));
  859     hasArgumentOfType(hasDeclaration(recordDecl(hasName("string")))))));
  863   EXPECT_TRUE(matches("int i = 0;", varDecl(hasType(isInteger()))));
  866     callExpr(hasArgument(0, declRefExpr(
  866     callExpr(hasArgument(0, declRefExpr(
  867       to(varDecl(hasType(isInteger()))))))));
  871   EXPECT_TRUE(notMatches("int *i;", varDecl(hasType(isInteger()))));
  873                          callExpr(hasArgument(0, declRefExpr(
  873                          callExpr(hasArgument(0, declRefExpr(
  874                            to(varDecl(hasType(isInteger()))))))));
  878   EXPECT_TRUE(matches("int i = 0;", varDecl(hasType(isSignedInteger()))));
  880                          varDecl(hasType(isSignedInteger()))));
  884   EXPECT_TRUE(notMatches("int i = 0;", varDecl(hasType(isUnsignedInteger()))));
  886                       varDecl(hasType(isUnsignedInteger()))));
  890   EXPECT_TRUE(matches("int* i = nullptr;", varDecl(hasType(isAnyPointer()))));
  895                           varDecl(hasType(isAnyPointer()))));
  899   EXPECT_TRUE(notMatches("int i = 0;", varDecl(hasType(isAnyPointer()))));
  903   EXPECT_TRUE(matches("char i = 0;", varDecl(hasType(isAnyCharacter()))));
  907   EXPECT_TRUE(notMatches("int i;", varDecl(hasType(isAnyCharacter()))));
  912                       memberExpr(isArrow())));
  914                       memberExpr(isArrow())));
  916                          memberExpr(isArrow())));
  918                       cxxDependentScopeMemberExpr(isArrow())));
  921                  cxxDependentScopeMemberExpr(isArrow())));
  926                       memberExpr(isArrow())));
  928                          memberExpr(isArrow())));
  930                          memberExpr(isArrow())));
  935                       memberExpr(isArrow())));
  937                       memberExpr(isArrow())));
  939                          memberExpr(isArrow())));
  942               unresolvedMemberExpr(isArrow())));
  944                       unresolvedMemberExpr(isArrow())));
  947                  unresolvedMemberExpr(isArrow())));
  952                       cxxConversionDecl(isExplicit())));
  954                          cxxConversionDecl(isExplicit())));
  957       cxxConversionDecl(isExplicit()), false, "-std=c++2a"));
  960       cxxConversionDecl(isExplicit()), true, "-std=c++2a"));
  963       cxxConversionDecl(isExplicit()), false, "-std=c++2a"));
  967   StatementMatcher Call1Arg = callExpr(argumentCountIs(1));
  975   DeclarationMatcher Function1Arg = functionDecl(parameterCountIs(1));
  984   DeclarationMatcher ReferenceClassX = varDecl(
  985     hasType(references(recordDecl(hasName("X")))));
 1002                          varDecl(hasType(hasLocalQualifiers()))));
 1004                       varDecl(hasType(hasLocalQualifiers()))));
 1006                       varDecl(hasType(hasLocalQualifiers()))));
 1008                          varDecl(hasType(hasLocalQualifiers()))));
 1012   EXPECT_TRUE(matches("extern \"C\" void f() {}", functionDecl(isExternC())));
 1014                       functionDecl(isExternC())));
 1015   EXPECT_TRUE(notMatches("void f() {}", functionDecl(isExternC())));
 1019   EXPECT_TRUE(matches("extern \"C\" int i;", varDecl(isExternC())));
 1020   EXPECT_TRUE(matches("extern \"C\" { int i; }", varDecl(isExternC())));
 1021   EXPECT_TRUE(notMatches("int i;", varDecl(isExternC())));
 1026       matches("static void f() {}", functionDecl(isStaticStorageClass())));
 1027   EXPECT_TRUE(matches("static int i = 1;", varDecl(isStaticStorageClass())));
 1028   EXPECT_TRUE(notMatches("int i = 1;", varDecl(isStaticStorageClass())));
 1029   EXPECT_TRUE(notMatches("extern int i;", varDecl(isStaticStorageClass())));
 1030   EXPECT_TRUE(notMatches("void f() {}", functionDecl(isStaticStorageClass())));
 1035                          functionDecl(hasName("~A"), isDefaulted())));
 1037                       functionDecl(hasName("~B"), isDefaulted())));
 1042     notMatches("void Func();", functionDecl(hasName("Func"), isDeleted())));
 1044                       functionDecl(hasName("Func"), isDeleted())));
 1048   EXPECT_TRUE(notMatches("void f();", functionDecl(isNoThrow())));
 1049   EXPECT_TRUE(notMatches("void f() throw(int);", functionDecl(isNoThrow())));
 1051     notMatches("void f() noexcept(false);", functionDecl(isNoThrow())));
 1052   EXPECT_TRUE(matches("void f() throw();", functionDecl(isNoThrow())));
 1053   EXPECT_TRUE(matches("void f() noexcept;", functionDecl(isNoThrow())));
 1055   EXPECT_TRUE(notMatches("void f();", functionProtoType(isNoThrow())));
 1056   EXPECT_TRUE(notMatches("void f() throw(int);", functionProtoType(isNoThrow())));
 1058     notMatches("void f() noexcept(false);", functionProtoType(isNoThrow())));
 1059   EXPECT_TRUE(matches("void f() throw();", functionProtoType(isNoThrow())));
 1060   EXPECT_TRUE(matches("void f() noexcept;", functionProtoType(isNoThrow())));
 1065                       varDecl(hasName("foo"), isConstexpr())));
 1067                       functionDecl(hasName("bar"), isConstexpr())));
 1069                       ifStmt(isConstexpr()), LanguageMode::Cxx17OrLater));
 1070   EXPECT_TRUE(notMatches("void baz() { if (1 > 0) {} }", ifStmt(isConstexpr()),
 1077             classTemplateSpecializationDecl(templateArgumentCountIs(1))));
 1080                classTemplateSpecializationDecl(templateArgumentCountIs(2))));
 1083                       templateSpecializationType(templateArgumentCountIs(1))));
 1086                templateSpecializationType(templateArgumentCountIs(2))));
 1091                       classTemplateSpecializationDecl(
 1094                          classTemplateSpecializationDecl(hasAnyTemplateArgument(
 1095                            templateArgument(isIntegral())))));
 1100                       classTemplateSpecializationDecl(
 1103                       classTemplateSpecializationDecl(
 1106                       classTemplateSpecializationDecl(
 1109                          classTemplateSpecializationDecl(hasAnyTemplateArgument(
 1116       matches("class C { public: int i; };", accessSpecDecl(isPublic())));
 1118       notMatches("class C { public: int i; };", accessSpecDecl(isProtected())));
 1120       notMatches("class C { public: int i; };", accessSpecDecl(isPrivate())));
 1126   EXPECT_TRUE(matches("class X final {};", cxxRecordDecl(isFinal())));
 1128                       cxxMethodDecl(isFinal())));
 1129   EXPECT_TRUE(notMatches("class X {};", cxxRecordDecl(isFinal())));
 1131     notMatches("class X { virtual void f(); };", cxxMethodDecl(isFinal())));
 1136                       cxxMethodDecl(isVirtual(), hasName("::X::f"))));
 1137   EXPECT_TRUE(notMatches("class X { int f(); };", cxxMethodDecl(isVirtual())));
 1143                       cxxMethodDecl(isVirtualAsWritten(), hasName("::A::f"))));
 1147                cxxMethodDecl(isVirtualAsWritten(), hasName("::B::f"))));
 1152                       cxxMethodDecl(isPure(), hasName("::X::f"))));
 1153   EXPECT_TRUE(notMatches("class X { int f(); };", cxxMethodDecl(isPure())));
 1158                       cxxMethodDecl(isCopyAssignmentOperator())));
 1160                       cxxMethodDecl(isCopyAssignmentOperator())));
 1162                       cxxMethodDecl(isCopyAssignmentOperator())));
 1164                       cxxMethodDecl(isCopyAssignmentOperator())));
 1166                       cxxMethodDecl(isCopyAssignmentOperator())));
 1168                          cxxMethodDecl(isCopyAssignmentOperator())));
 1173                          cxxMethodDecl(isMoveAssignmentOperator())));
 1175                       cxxMethodDecl(isMoveAssignmentOperator())));
 1177                       cxxMethodDecl(isMoveAssignmentOperator())));
 1179                       cxxMethodDecl(isMoveAssignmentOperator())));
 1181                       cxxMethodDecl(isMoveAssignmentOperator())));
 1183                          cxxMethodDecl(isMoveAssignmentOperator())));
 1188     matches("struct A { void foo() const; };", cxxMethodDecl(isConst())));
 1190     notMatches("struct A { void foo(); };", cxxMethodDecl(isConst())));
 1196                       cxxMethodDecl(isOverride(), hasName("::Y::f"))));
 1199                          cxxMethodDecl(isOverride(), hasName("::X::f"))));
 1202                          cxxMethodDecl(isOverride())));
 1204                          cxxMethodDecl(isOverride())));
 1207             cxxMethodDecl(isOverride(), hasName("::Y::f"))));
 1211   StatementMatcher Constructor = cxxConstructExpr(
 1212     hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
 1212     hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
 1227   StatementMatcher WrongIndex = cxxConstructExpr(
 1228     hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
 1228     hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
 1235   StatementMatcher Constructor1Arg = cxxConstructExpr(argumentCountIs(1));
 1253     cxxConstructExpr(isListInitialization());
 1267                          cxxConstructorDecl(isImplicit())));
 1270                       cxxConstructorDecl(isImplicit())));
 1272                       cxxConstructorDecl(unless(isImplicit()))));
 1275                       cxxMethodDecl(isImplicit(), hasName("operator="))));
 1280                       cxxConstructorDecl(isExplicit())));
 1282                          cxxConstructorDecl(isExplicit())));
 1285       cxxConstructorDecl(isExplicit()), false, "-std=c++2a"));
 1287                                    cxxConstructorDecl(isExplicit()), true,
 1290                                    cxxConstructorDecl(isExplicit()), false,
 1297                                    cxxDeductionGuideDecl(isExplicit()), false,
 1301                                    cxxDeductionGuideDecl(isExplicit()), true,
 1305                                    cxxDeductionGuideDecl(isExplicit()), true,
 1309                                    cxxDeductionGuideDecl(isExplicit()), false,
 1314       cxxDeductionGuideDecl(isExplicit()), false, "-std=c++2a"));
 1320       cxxConstructorDecl(isDefaultConstructor(), unless(isImplicit()))));
 1323       cxxConstructorDecl(isCopyConstructor(), unless(isImplicit()))));
 1326       cxxConstructorDecl(isMoveConstructor(), unless(isImplicit()))));
 1330       cxxConstructorDecl(isDefaultConstructor(), unless(isImplicit()))));
 1333       cxxConstructorDecl(isCopyConstructor(), unless(isImplicit()))));
 1336       cxxConstructorDecl(isMoveConstructor(), unless(isImplicit()))));
 1340       cxxConstructorDecl(isDefaultConstructor(), unless(isImplicit()))));
 1343       cxxConstructorDecl(isCopyConstructor(), unless(isImplicit()))));
 1346       cxxConstructorDecl(isMoveConstructor(), unless(isImplicit()))));
 1351                          cxxConstructorDecl(isUserProvided())));
 1353                          cxxConstructorDecl(isUserProvided())));
 1355                          cxxConstructorDecl(isUserProvided())));
 1357     matches("struct S { S(); };", cxxConstructorDecl(isUserProvided())));
 1359                       cxxConstructorDecl(isUserProvided())));
 1364                          cxxConstructorDecl(isDelegatingConstructor())));
 1366                          cxxConstructorDecl(isDelegatingConstructor())));
 1369     cxxConstructorDecl(isDelegatingConstructor(), parameterCountIs(0))));
 1372     cxxConstructorDecl(isDelegatingConstructor(), parameterCountIs(1))));
 1376   StatementMatcher Literal = stringLiteral(hasSize(4));
 1388                       recordDecl(hasName("a::b::C"))));
 1390                       recordDecl(hasName("::a::b::C"))));
 1392                       recordDecl(hasName("b::C"))));
 1394                       recordDecl(hasName("C"))));
 1396                          recordDecl(hasName("c::b::C"))));
 1398                          recordDecl(hasName("a::c::C"))));
 1400                          recordDecl(hasName("a::b::A"))));
 1402                          recordDecl(hasName("::C"))));
 1404                          recordDecl(hasName("::b::C"))));
 1406                          recordDecl(hasName("z::a::b::C"))));
 1408                          recordDecl(hasName("a+b::C"))));
 1410                          recordDecl(hasName("C"))));
 1416             recordDecl(hasName("A::B::C"))));
 1419             recordDecl(hasName("::A::B::C"))));
 1422             recordDecl(hasName("B::C"))));
 1425             recordDecl(hasName("C"))));
 1428                recordDecl(hasName("c::B::C"))));
 1431                recordDecl(hasName("A::c::C"))));
 1434                recordDecl(hasName("A::B::A"))));
 1437                recordDecl(hasName("::C"))));
 1440                recordDecl(hasName("::B::C"))));
 1442                          recordDecl(hasName("z::A::B::C"))));
 1445                recordDecl(hasName("A+B::C"))));
 1450   EXPECT_TRUE(matches(code, recordDecl(hasName("a::b::C"))));
 1451   EXPECT_TRUE(matches(code, recordDecl(hasName("a::C"))));
 1452   EXPECT_TRUE(matches(code, recordDecl(hasName("::a::b::C"))));
 1453   EXPECT_TRUE(matches(code, recordDecl(hasName("::a::C"))));
 1459     matches(code, recordDecl(hasName("a::(anonymous namespace)::C"))));
 1460   EXPECT_TRUE(matches(code, recordDecl(hasName("a::C"))));
 1462     matches(code, recordDecl(hasName("::a::(anonymous namespace)::C"))));
 1463   EXPECT_TRUE(matches(code, recordDecl(hasName("::a::C"))));
 1468                       recordDecl(hasName("A::(anonymous class)::C"))));
 1470                       recordDecl(hasName("::A::(anonymous class)::C"))));
 1472                        recordDecl(hasName("::A::C"))));
 1474                       recordDecl(hasName("A::(anonymous struct)::C"))));
 1476                       recordDecl(hasName("::A::(anonymous struct)::C"))));
 1478                        recordDecl(hasName("::A::C"))));
 1484   EXPECT_TRUE(matches(code, varDecl(hasName("i"))));
 1485   EXPECT_FALSE(matches(code, varDecl(hasName("F()::i"))));
 1487   EXPECT_TRUE(matches(code, fieldDecl(hasName("m"))));
 1488   EXPECT_TRUE(matches(code, fieldDecl(hasName("S::m"))));
 1489   EXPECT_TRUE(matches(code, fieldDecl(hasName("F(int)::S::m"))));
 1490   EXPECT_TRUE(matches(code, fieldDecl(hasName("a::F(int)::S::m"))));
 1491   EXPECT_TRUE(matches(code, fieldDecl(hasName("::a::F(int)::S::m"))));
 1497   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "a::b::C"))));
 1497   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "a::b::C"))));
 1498   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("a::b::C", "XX"))));
 1498   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("a::b::C", "XX"))));
 1499   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX::C", "a::b::C"))));
 1499   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX::C", "a::b::C"))));
 1500   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "C"))));
 1500   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName("XX", "C"))));
 1502   EXPECT_TRUE(notMatches(Code, recordDecl(hasAnyName("::C", "::b::C"))));
 1502   EXPECT_TRUE(notMatches(Code, recordDecl(hasAnyName("::C", "::b::C"))));
 1504     matches(Code, recordDecl(hasAnyName("::C", "::b::C", "::a::b::C"))));
 1504     matches(Code, recordDecl(hasAnyName("::C", "::b::C", "::a::b::C"))));
 1507   EXPECT_TRUE(matches(Code, recordDecl(hasAnyName(Names))));
 1512     recordDecl(hasName("A"), isDefinition());
 1517     varDecl(hasName("a"), isDefinition());
 1522     cxxMethodDecl(hasName("a"), isDefinition());
 1527     objcMethodDecl(hasName("a"), isDefinition());
 1551     expr(hasType(TypeMatcher(
 1565   EXPECT_TRUE(matchesObjC(ObjCString, objcIvarRefExpr(
 1566         hasDeclaration(namedDecl(hasName("x"))))));
 1567   EXPECT_FALSE(matchesObjC(ObjCString, objcIvarRefExpr(
 1568         hasDeclaration(namedDecl(hasName("y"))))));
 1577                       compoundStmt(statementCountIs(0))));
 1579                          compoundStmt(statementCountIs(1))));
 1584                       compoundStmt(statementCountIs(1))));
 1586                          compoundStmt(statementCountIs(0))));
 1588                          compoundStmt(statementCountIs(2))));
 1593                       compoundStmt(statementCountIs(3))));
 1598                       compoundStmt(statementCountIs(1))));
 1600                       compoundStmt(statementCountIs(2))));
 1602                          compoundStmt(statementCountIs(3))));
 1604                       compoundStmt(statementCountIs(4))));
 1609                       memberExpr(member(hasName("first")))));
 1616                          memberExpr(member(hasName("first")))));
 1624                       memberExpr(member(hasName("first")))));
 1630     memberExpr(hasDeclaration(fieldDecl(hasType(isInteger()))))));
 1630     memberExpr(hasDeclaration(fieldDecl(hasType(isInteger()))))));
 1633     memberExpr(hasDeclaration(fieldDecl(hasType(isInteger()))))));
 1633     memberExpr(hasDeclaration(fieldDecl(hasType(isInteger()))))));
 1638                       fieldDecl(isBitField(), hasName("a"))));
 1640                          fieldDecl(isBitField(), hasName("b"))));
 1642                       fieldDecl(isBitField(), hasBitWidth(2), hasName("a"))));
 1648               fieldDecl(hasInClassInitializer(integerLiteral(equals(2))),
 1648               fieldDecl(hasInClassInitializer(integerLiteral(equals(2))),
 1652                  fieldDecl(hasInClassInitializer(anything()), hasName("b"))));
 1657     "struct A { int i; };", fieldDecl(isPublic(), hasName("i"))));
 1659     "struct A { int i; };", fieldDecl(isProtected(), hasName("i"))));
 1661     "struct A { int i; };", fieldDecl(isPrivate(), hasName("i"))));
 1664     "class A { int i; };", fieldDecl(isPublic(), hasName("i"))));
 1666     "class A { int i; };", fieldDecl(isProtected(), hasName("i"))));
 1668     "class A { int i; };", fieldDecl(isPrivate(), hasName("i"))));
 1671     "class A { protected: int i; };", fieldDecl(isPublic(), hasName("i"))));
 1673                       fieldDecl(isProtected(), hasName("i"))));
 1675     "class A { protected: int i; };", fieldDecl(isPrivate(), hasName("i"))));
 1678   EXPECT_TRUE(notMatches("int i;", varDecl(isPublic(), hasName("i"))));
 1679   EXPECT_TRUE(notMatches("int i;", varDecl(isProtected(), hasName("i"))));
 1680   EXPECT_TRUE(notMatches("int i;", varDecl(isPrivate(), hasName("i"))));
 1684   EXPECT_TRUE(notMatches("void f();", functionDecl(hasDynamicExceptionSpec())));
 1686                          functionDecl(hasDynamicExceptionSpec())));
 1688                          functionDecl(hasDynamicExceptionSpec())));
 1690                          functionDecl(hasDynamicExceptionSpec())));
 1692       matches("void j() throw();", functionDecl(hasDynamicExceptionSpec())));
 1694       matches("void k() throw(int);", functionDecl(hasDynamicExceptionSpec())));
 1696       matches("void l() throw(...);", functionDecl(hasDynamicExceptionSpec())));
 1698   EXPECT_TRUE(notMatches("void f();", functionProtoType(hasDynamicExceptionSpec())));
 1700                          functionProtoType(hasDynamicExceptionSpec())));
 1702                          functionProtoType(hasDynamicExceptionSpec())));
 1704                          functionProtoType(hasDynamicExceptionSpec())));
 1706       matches("void j() throw();", functionProtoType(hasDynamicExceptionSpec())));
 1708       matches("void k() throw(int);", functionProtoType(hasDynamicExceptionSpec())));
 1710       matches("void l() throw(...);", functionProtoType(hasDynamicExceptionSpec())));
 1716     memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
 1716     memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
 1722     memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
 1722     memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
 1725     memberExpr(hasObjectExpression(
 1726       hasType(pointsTo(recordDecl(hasName("X"))))))));
 1728                       cxxDependentScopeMemberExpr(hasObjectExpression(
 1729                           declRefExpr(to(namedDecl(hasName("t"))))))));
 1729                           declRefExpr(to(namedDecl(hasName("t"))))))));
 1732               cxxDependentScopeMemberExpr(hasObjectExpression(
 1733                   declRefExpr(to(namedDecl(hasName("t"))))))));
 1733                   declRefExpr(to(namedDecl(hasName("t"))))))));
 1739       memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
 1739       memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
 1742                       unresolvedMemberExpr(hasObjectExpression(
 1743                           hasType(recordDecl(hasName("X")))))));
 1745                       cxxDependentScopeMemberExpr(hasObjectExpression(
 1746                           declRefExpr(to(namedDecl(hasName("t"))))))));
 1746                           declRefExpr(to(namedDecl(hasName("t"))))))));
 1753     memberExpr(hasObjectExpression(
 1754       hasType(pointsTo(recordDecl(hasName("S"))))))));
 1757     memberExpr(hasObjectExpression(
 1758       hasType(pointsTo(recordDecl(hasName("S"))))))));
 1762   EXPECT_TRUE(notMatches("class X { void m(); };", fieldDecl(hasName("m"))));
 1763   EXPECT_TRUE(notMatches("class X { class m {}; };", fieldDecl(hasName("m"))));
 1764   EXPECT_TRUE(notMatches("class X { enum { m }; };", fieldDecl(hasName("m"))));
 1765   EXPECT_TRUE(notMatches("class X { enum m {}; };", fieldDecl(hasName("m"))));
 1769   EXPECT_TRUE(matches("class X { int m; };", fieldDecl(hasName("m"))));
 1774                       varDecl(hasType(isVolatileQualified()))));
 1776                          varDecl(hasType(isVolatileQualified()))));
 1778                       varDecl(hasType(isVolatileQualified()))));
 1783                       varDecl(hasType(isConstQualified()))));
 1788                       varDecl(hasType(isConstQualified()))));
 1793                       varDecl(hasType(isConstQualified()))));
 1795                       varDecl(hasType(isConstQualified()))));
 1800                          varDecl(hasType(isConstQualified()))));
 1802                          varDecl(hasType(isConstQualified()))));
 1807                       declStmt(declCountIs(2))));
 1809                          declStmt(declCountIs(3))));
 1811                          declStmt(declCountIs(3))));
 1818     recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
 1818     recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
 1819                       has(fieldDecl(hasName("b")).bind("v")))),
 1826     recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
 1826     recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
 1827                       has(fieldDecl(hasName("b")).bind("v")))),
 1831     recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
 1831     recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
 1832                       has(fieldDecl(hasName("b")).bind("v")))),
 1836     recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
 1836     recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
 1837                       has(fieldDecl(hasName("b")).bind("v"))))));
 1846     cxxRecordDecl(hasName("::X"), isTemplateInstantiation())));
 1850     cxxRecordDecl(isTemplateInstantiation(), hasDescendant(
 1851       fieldDecl(hasType(recordDecl(hasName("A"))))))));
 1851       fieldDecl(hasType(recordDecl(hasName("A"))))))));
 1857     functionDecl(hasParameter(0, hasType(recordDecl(hasName("A")))),
 1857     functionDecl(hasParameter(0, hasType(recordDecl(hasName("A")))),
 1865     cxxRecordDecl(isTemplateInstantiation(), hasDescendant(
 1866       fieldDecl(hasType(recordDecl(hasName("A"))))))));
 1866       fieldDecl(hasType(recordDecl(hasName("A"))))))));
 1873               cxxRecordDecl(isTemplateInstantiation(),
 1874                             unless(hasDescendant(varDecl(hasName("t")))))));
 1882     cxxRecordDecl(hasName("::X"), isTemplateInstantiation())));
 1893     cxxRecordDecl(hasName("::X::Y"), isTemplateInstantiation())));
 1906     cxxRecordDecl(hasName("::X<A>::Y"), unless(isTemplateInstantiation()))));
 1913     cxxRecordDecl(hasName("::X"), isTemplateInstantiation())));
 1919     cxxRecordDecl(isTemplateInstantiation())));
 1925             cxxRecordDecl(isInstantiated())));
 1930                          cxxRecordDecl(isInstantiated())));
 1936                       declStmt(isInTemplateInstantiation())));
 1941                          declStmt(isInTemplateInstantiation())));
 1947             functionDecl(isInstantiated())));
 1952                          varDecl(isInstantiated())));
 1958             declStmt(isInTemplateInstantiation())));
 1963                          declStmt(isInTemplateInstantiation())));
 1967   auto Matcher = binaryOperator(unless(isInTemplateInstantiation()));
 1981       expr(isInstantiationDependent())));
 1986                       expr(isInstantiationDependent())));
 1991                       expr(isInstantiationDependent())));
 1996                       expr(isTypeDependent())));
 2001                          expr(isTypeDependent())));
 2006                       expr(isValueDependent())));
 2011                       expr(isValueDependent())));
 2017       expr(isValueDependent())));
 2024     cxxRecordDecl(isExplicitTemplateSpecialization())));
 2027     functionDecl(isExplicitTemplateSpecialization())));
 2035     cxxRecordDecl(isExplicitTemplateSpecialization())));
 2039     functionDecl(isExplicitTemplateSpecialization())));
 2046     cxxRecordDecl(isExplicitTemplateSpecialization())));
 2049     functionDecl(isExplicitTemplateSpecialization())));
 2057     cxxRecordDecl(isExplicitTemplateSpecialization())));
 2061     functionDecl(isExplicitTemplateSpecialization())));
 2065   EXPECT_TRUE(notMatches("void func();", functionDecl(isNoReturn())));
 2066   EXPECT_TRUE(notMatches("void func() {}", functionDecl(isNoReturn())));
 2068   EXPECT_TRUE(notMatchesC("void func();", functionDecl(isNoReturn())));
 2069   EXPECT_TRUE(notMatchesC("void func() {}", functionDecl(isNoReturn())));
 2072       notMatches("struct S { void func(); };", functionDecl(isNoReturn())));
 2074       notMatches("struct S { void func() {} };", functionDecl(isNoReturn())));
 2077                          functionDecl(isNoReturn())));
 2079                          functionDecl(isNoReturn())));
 2081   EXPECT_TRUE(notMatches("struct S { S(); };", functionDecl(isNoReturn())));
 2082   EXPECT_TRUE(notMatches("struct S { S() {} };", functionDecl(isNoReturn())));
 2086   EXPECT_TRUE(matches("[[noreturn]] void func();", functionDecl(isNoReturn())));
 2088       matches("[[noreturn]] void func() {}", functionDecl(isNoReturn())));
 2091                       functionDecl(isNoReturn())));
 2093                       functionDecl(isNoReturn())));
 2096                       functionDecl(isNoReturn())));
 2098                       functionDecl(isNoReturn())));
 2101       matches("struct S { [[noreturn]] S(); };", functionDecl(isNoReturn())));
 2103                       functionDecl(isNoReturn())));
 2108                       functionDecl(isNoReturn())));
 2110                       functionDecl(isNoReturn())));
 2113                       functionDecl(isNoReturn())));
 2115                       functionDecl(isNoReturn())));
 2119               functionDecl(isNoReturn())));
 2122               functionDecl(isNoReturn())));
 2125                       functionDecl(isNoReturn())));
 2127                       functionDecl(isNoReturn())));
 2132                       functionDecl(isNoReturn())));
 2134                       functionDecl(isNoReturn())));
 2137                       functionDecl(isNoReturn())));
 2139                       functionDecl(isNoReturn())));
 2144                       cxxMethodDecl(returns(booleanType()))));
 2146                          cxxMethodDecl(returns(booleanType()))));
 2151                       cxxMethodDecl(returns(voidType()))));
 2156                       cxxMethodDecl(returns(realFloatingPointType()))));
 2158                          cxxMethodDecl(returns(realFloatingPointType()))));
 2160                       cxxMethodDecl(returns(realFloatingPointType()))));
 2169                          arrayType(hasElementType(builtinType()))));
 2169                          arrayType(hasElementType(builtinType()))));
 2173     qualType(arrayType(hasElementType(builtinType())))));
 2173     qualType(arrayType(hasElementType(builtinType())))));
 2173     qualType(arrayType(hasElementType(builtinType())))));
 2176     qualType(isConstQualified(), arrayType(hasElementType(builtinType())))));
 2176     qualType(isConstQualified(), arrayType(hasElementType(builtinType())))));
 2176     qualType(isConstQualified(), arrayType(hasElementType(builtinType())))));
 2179     qualType(isConstQualified(), arrayType())));
 2183     qualType(isConstQualified(), arrayType(hasElementType(builtinType())))));
 2183     qualType(isConstQualified(), arrayType(hasElementType(builtinType())))));
 2183     qualType(isConstQualified(), arrayType(hasElementType(builtinType())))));
 2186     qualType(arrayType(hasElementType(isConstQualified(), builtinType())))));
 2186     qualType(arrayType(hasElementType(isConstQualified(), builtinType())))));
 2186     qualType(arrayType(hasElementType(isConstQualified(), builtinType())))));
 2189     qualType(arrayType(hasElementType(builtinType())),
 2189     qualType(arrayType(hasElementType(builtinType())),
 2189     qualType(arrayType(hasElementType(builtinType())),
 2193                       constantArrayType(hasElementType(builtinType()))));
 2193                       constantArrayType(hasElementType(builtinType()))));
 2194   EXPECT_TRUE(matches("const int a = 0;", qualType(isInteger())));
 2198   EXPECT_TRUE(matches("void f(int i[]);", valueDecl(hasType(decayedType(hasDecayedType(pointerType()))))));
 2198   EXPECT_TRUE(matches("void f(int i[]);", valueDecl(hasType(decayedType(hasDecayedType(pointerType()))))));
 2206     complexType(hasElementType(builtinType()))));
 2206     complexType(hasElementType(builtinType()))));
 2209     complexType(hasElementType(isInteger()))));
 2209     complexType(hasElementType(isInteger()))));
 2213   EXPECT_TRUE(notMatches("namespace N {}", namespaceDecl(isAnonymous())));
 2214   EXPECT_TRUE(matches("namespace {}", namespaceDecl(isAnonymous())));
 2227                          cxxRecordDecl(hasName("vector"), isInStdNamespace())));
 2232                       cxxRecordDecl(hasName("vector"), isInStdNamespace())));
 2238                       cxxRecordDecl(hasName("vector"), isInStdNamespace())));
 2250                          cxxRecordDecl(hasName("path"), isInStdNamespace())));
 2263               cxxRecordDecl(hasName("path"),
 2264                             hasAncestor(namespaceDecl(hasName("filesystem"),
 2270     "int i = 1;", varDecl(hasType(qualType().bind("type")),
 2272                             hasType(qualType(equalsBoundNode("type"))))))));
 2274                          varDecl(hasType(qualType().bind("type")),
 2276                                    qualType(equalsBoundNode("type"))))))));
 2281     "int i = 1;", varDecl(namedDecl(hasName("i")).bind("name"),
 2281     "int i = 1;", varDecl(namedDecl(hasName("i")).bind("name"),
 2283                             hasType(qualType(equalsBoundNode("type"))))))));
 2289             stmt(allOf(ifStmt().bind("if"),
 2290                        hasParent(stmt(has(stmt(equalsBoundNode("if")))))))));
 2290                        hasParent(stmt(has(stmt(equalsBoundNode("if")))))))));
 2294     stmt(allOf(ifStmt().bind("if"), has(stmt(equalsBoundNode("if")))))));
 2294     stmt(allOf(ifStmt().bind("if"), has(stmt(equalsBoundNode("if")))))));
 2300     decl(allOf(recordDecl(hasName("::X::Y")).bind("record"),
 2300     decl(allOf(recordDecl(hasName("::X::Y")).bind("record"),
 2301                hasParent(decl(has(decl(equalsBoundNode("record")))))))));
 2301                hasParent(decl(has(decl(equalsBoundNode("record")))))))));
 2304                          decl(allOf(recordDecl(hasName("::X")).bind("record"),
 2304                          decl(allOf(recordDecl(hasName("::X")).bind("record"),
 2305                                     has(decl(equalsBoundNode("record")))))));
 2311     recordDecl(
 2312       has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
 2313       has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))));
 2313       has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))));
 2317     recordDecl(
 2318       has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
 2319       has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))));
 2319       has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))));
 2336     functionDecl(returns(qualType().bind("type")),
 2337                  forEachDescendant(varDecl(hasType(
 2338                    qualType(equalsBoundNode("type")))).bind("decl"))),
 2350     functionDecl(
 2352       forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))),
 2352       forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))),
 2362     cxxMemberCallExpr(
 2363       callee(cxxMethodDecl(hasName("data"))),
 2364       on(declRefExpr(to(
 2365         varDecl(hasType(recordDecl(hasName("StringRef")))).bind("var")))),
 2365         varDecl(hasType(recordDecl(hasName("StringRef")))).bind("var")))),
 2366       unless(hasAncestor(stmt(hasDescendant(cxxMemberCallExpr(
 2366       unless(hasAncestor(stmt(hasDescendant(cxxMemberCallExpr(
 2367         callee(cxxMethodDecl(anyOf(hasName("size"), hasName("length")))),
 2368         on(declRefExpr(to(varDecl(equalsBoundNode("var")))))))))))
 2368         on(declRefExpr(to(varDecl(equalsBoundNode("var")))))))))))
 2378     cxxMemberCallExpr(
 2379       callee(cxxMethodDecl(hasName("data"))),
 2380       on(declRefExpr(to(
 2381         varDecl(hasType(recordDecl(hasName("StringRef")))).bind("var")))),
 2381         varDecl(hasType(recordDecl(hasName("StringRef")))).bind("var")))),
 2382       unless(hasAncestor(stmt(hasDescendant(cxxMemberCallExpr(
 2382       unless(hasAncestor(stmt(hasDescendant(cxxMemberCallExpr(
 2383         callee(cxxMethodDecl(anyOf(hasName("size"), hasName("length")))),
 2384         on(declRefExpr(to(varDecl(equalsBoundNode("var")))))))))))
 2384         on(declRefExpr(to(varDecl(equalsBoundNode("var")))))))))))
 2390                         "void *v1 = NULL;", expr(nullPointerConstant())));
 2391   EXPECT_TRUE(matches("void *v2 = nullptr;", expr(nullPointerConstant())));
 2392   EXPECT_TRUE(matches("void *v3 = __null;", expr(nullPointerConstant())));
 2393   EXPECT_TRUE(matches("char *cp = (char *)0;", expr(nullPointerConstant())));
 2394   EXPECT_TRUE(matches("int *ip = 0;", expr(nullPointerConstant())));
 2395   EXPECT_TRUE(matches("int i = 0;", expr(nullPointerConstant())));
 2399   EXPECT_TRUE(matches("int a = 0;", namedDecl(hasExternalFormalLinkage())));
 2401       notMatches("static int a = 0;", namedDecl(hasExternalFormalLinkage())));
 2403                          namedDecl(hasExternalFormalLinkage())));
 2405                       namedDecl(hasExternalFormalLinkage())));
 2411                       namedDecl(hasExternalFormalLinkage())));
 2416                       parmVarDecl(hasDefaultArgument())));
 2418                       parmVarDecl(hasDefaultArgument())));
 2423                       cxxNewExpr(isArray())));
 2428                       cxxNewExpr(hasArraySize(integerLiteral(equals(10))))));
 2428                       cxxNewExpr(hasArraySize(integerLiteral(equals(10))))));
 2433                       cxxRecordDecl(hasDefinition())));
 2435                       cxxRecordDecl(hasDefinition())));
 2440                       cxxRecordDecl(hasDefinition())));
 2442                       cxxRecordDecl(hasDefinition())));
 2447                       cxxRecordDecl(hasDefinition())));
 2449                       cxxRecordDecl(hasDefinition())));
 2453   EXPECT_TRUE(matches("enum class X {};", enumDecl(isScoped())));
 2454   EXPECT_TRUE(notMatches("enum X {};", enumDecl(isScoped())));
 2459                       functionDecl(hasTrailingReturn())));
 2460   EXPECT_TRUE(matches("auto X() -> int;", functionDecl(hasTrailingReturn())));
 2462                       functionDecl(hasTrailingReturn())));
 2463   EXPECT_TRUE(notMatches("int X();", functionDecl(hasTrailingReturn())));
 2464   EXPECT_TRUE(notMatchesC("void X();", functionDecl(hasTrailingReturn())));
 2470           functionDecl(hasTrailingReturn())));
 2473           functionDecl(hasTrailingReturn())));
 2477   StatementMatcher BinAsgmtOperator = binaryOperator(isAssignmentOperator());
 2479       cxxOperatorCallExpr(isAssignmentOperator());
 2494             initListExpr(hasInit(0, expr()))));
 2497             initListExpr(hasInit(1, expr()))));
 2500             initListExpr(hasInit(0, expr()))));
 2505     matches("int main() {}", functionDecl(isMain())));
 2508     notMatches("int main2() {}", functionDecl(isMain())));
 2512   auto Matcher = ompExecutableDirective(isStandaloneDirective());
 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()))));
 2573       Source2, ompExecutableDirective(hasStructuredBlock(anything()))));
 2577   auto Matcher = ompExecutableDirective(hasAnyClause(anything()));
 2616       ompExecutableDirective(hasAnyClause(ompDefaultClause(isNoneKind())));
 2616       ompExecutableDirective(hasAnyClause(ompDefaultClause(isNoneKind())));
 2655       ompExecutableDirective(hasAnyClause(ompDefaultClause(isSharedKind())));
 2655       ompExecutableDirective(hasAnyClause(ompDefaultClause(isSharedKind())));
 2694       ompExecutableDirective(isAllowedToContainClauseKind(OMPC_default));
tools/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
   25   EXPECT_TRUE(Finder.addDynamicMatcher(constantArrayType(hasSize(42)),
   34   EXPECT_TRUE(notMatches("", decl(usingDecl())));
   36                       decl(usingDecl())));
   40   DeclarationMatcher NamedX = namedDecl(hasName("X"));
   53   DeclarationMatcher NamedX = namedDecl(matchesName("::X"));
   64   DeclarationMatcher StartsWithNo = namedDecl(matchesName("::no"));
   68   DeclarationMatcher Abc = namedDecl(matchesName("a.*b.*c"));
   74   DeclarationMatcher StartsWithK = namedDecl(matchesName(":k[^:]*$"));
   90   DeclarationMatcher ClassX = recordDecl(recordDecl(hasName("X")));
   90   DeclarationMatcher ClassX = recordDecl(recordDecl(hasName("X")));
  103     Code, varDecl(hasName("MyVar1"), hasDeclContext(translationUnitDecl()))));
  105     Code, varDecl(hasName("MyVar2"), hasDeclContext(translationUnitDecl()))));
  108     varDecl(hasName("MyVar2"),
  109             hasDeclContext(decl(hasDeclContext(translationUnitDecl()))))));
  118   DeclarationMatcher ClassX = classTemplateDecl(hasName("X"));
  124   DeclarationMatcher ClassX = classTemplateDecl(hasName("X"));
  132                          classTemplateDecl(hasName("X"),
  133                                            hasDescendant(fieldDecl(hasName("a"))))));
  139                          classTemplateDecl(hasName("X"),
  140                                            hasDescendant(fieldDecl(hasName("a"))))));
  157                       valueDecl(hasType(asString("enum EnumType")))));
  159                       valueDecl(hasType(asString("void (void)")))));
  164                       friendDecl(hasType(asString("class X")))));
  166                       friendDecl(hasType(recordDecl(hasName("X"))))));
  166                       friendDecl(hasType(recordDecl(hasName("X"))))));
  169                       functionDecl(hasName("f"), hasParent(friendDecl()))));
  173   EXPECT_TRUE(notMatches("class X {};", enumDecl(hasName("X"))));
  177   EXPECT_TRUE(matches("enum X {};", enumDecl(hasName("X"))));
  181   DeclarationMatcher Matcher = enumConstantDecl(hasName("A"));
  202   StatementMatcher ADLMatch = callExpr(usesADL());
  203   StatementMatcher ADLMatchOper = cxxOperatorCallExpr(usesADL());
  239     callExpr(hasDeclaration(cxxMethodDecl(hasName("x"))));
  239     callExpr(hasDeclaration(cxxMethodDecl(hasName("x"))));
  245     cxxMemberCallExpr(on(hasType(recordDecl(hasName("Y")))));
  245     cxxMemberCallExpr(on(hasType(recordDecl(hasName("Y")))));
  264     cxxMemberCallExpr(on(hasType(pointsTo(recordDecl(hasName("Y"))))));
  264     cxxMemberCallExpr(on(hasType(pointsTo(recordDecl(hasName("Y"))))));
  308                       nonTypeTemplateParmDecl(hasName("N"))));
  315                       templateTypeParmDecl(hasName("T"))));
  334                       labelStmt(
  336                           labelDecl(hasName("FOO"))))));
  370     cxxMemberCallExpr(thisPointerType(recordDecl(hasName("Y"))));
  370     cxxMemberCallExpr(thisPointerType(recordDecl(hasName("Y"))));
  400     declRefExpr(to(
  401       varDecl(hasInitializer(
  402         cxxMemberCallExpr(thisPointerType(recordDecl(hasName("Y"))))))));
  402         cxxMemberCallExpr(thisPointerType(recordDecl(hasName("Y"))))))));
  426     cxxMemberCallExpr(on(declRefExpr(to(varDecl(hasName("y"))))));
  426     cxxMemberCallExpr(on(declRefExpr(to(varDecl(hasName("y"))))));
  426     cxxMemberCallExpr(on(declRefExpr(to(varDecl(hasName("y"))))));
  497   StatementMatcher CallFunctionF = callExpr(callee(functionDecl(hasName("f"))));
  497   StatementMatcher CallFunctionF = callExpr(callee(functionDecl(hasName("f"))));
  522   EXPECT_TRUE(matches("void f(...);", functionDecl(isVariadic())));
  523   EXPECT_TRUE(notMatches("void f(int);", functionDecl(isVariadic())));
  525                          functionDecl(isVariadic())));
  526   EXPECT_TRUE(notMatches("void f();", functionDecl(isVariadic())));
  527   EXPECT_TRUE(notMatchesC("void f();", functionDecl(isVariadic())));
  528   EXPECT_TRUE(matches("void f(...);", functionDecl(parameterCountIs(0))));
  529   EXPECT_TRUE(matchesC("void f();", functionDecl(parameterCountIs(0))));
  530   EXPECT_TRUE(matches("void f(int, ...);", functionDecl(parameterCountIs(1))));
  536             functionTemplateDecl(hasName("f"))));
  542                functionTemplateDecl(hasName("f"))));
  549                functionTemplateDecl(hasName("f"),
  550                                     hasDescendant(declRefExpr(to(
  551                                       functionDecl(hasName("g"))))))));
  590                       cxxCtorInitializer(forField(hasName("i")))));
  730               unaryOperator(hasOperatorName("-"),
  731                             hasUnaryOperand(integerLiteral(equals(10))))));
  741   EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0))));
  742   EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0f))));
  744     matches("double i = 5.0;", floatLiteral(equals(llvm::APFloat(5.0)))));
  747   EXPECT_TRUE(notMatches("double i = 5.0;", floatLiteral(equals(6.0))));
  748   EXPECT_TRUE(notMatches("double i = 5.0;", floatLiteral(equals(6.0f))));
  750     notMatches("double i = 5.0;", floatLiteral(equals(llvm::APFloat(6.0)))));
  777     initListExpr(
  779         cxxConstructExpr(
  782         initListExpr(
  784           has(floatLiteral(equals(1.0))),
  785           has(implicitValueInitExpr(
  788         initListExpr(
  790           has(floatLiteral(equals(2.0))),
  791           has(floatLiteral(equals(1.0)))))
  795                          initListExpr(
  797                              initListExpr(
  799                                  designatedInitExpr(
  801                                    hasDescendant(floatLiteral(
  803                                    hasDescendant(integerLiteral(
  806                                  designatedInitExpr(
  808                                    hasDescendant(floatLiteral(
  810                                    hasDescendant(integerLiteral(
  813                                  designatedInitExpr(
  815                                    hasDescendant(floatLiteral(
  817                                    hasDescendant(integerLiteral(
  826             varDecl(hasInitializer(parenListExpr(has(unaryOperator()))))));
  826             varDecl(hasInitializer(parenListExpr(has(unaryOperator()))))));
  831                       varDecl(hasInitializer(stmtExpr()))));
  837                       predefinedExpr(
  848     ifStmt(hasCondition(cxxBoolLiteral(equals(true))));
  848     ifStmt(hasCondition(cxxBoolLiteral(equals(true))));
  858   StatementMatcher Conditional = conditionalOperator(
  859     hasCondition(cxxBoolLiteral(equals(true))),
  860     hasTrueExpression(cxxBoolLiteral(equals(false))));
  866   StatementMatcher ConditionalFalse = conditionalOperator(
  867     hasFalseExpression(cxxBoolLiteral(equals(false))));
  879   StatementMatcher AlwaysOne = binaryConditionalOperator(
  880     hasCondition(implicitCastExpr(
  882         opaqueValueExpr(
  883           hasSourceExpression((integerLiteral(equals(1)))))))),
  884     hasFalseExpression(integerLiteral(equals(0))));
  888   StatementMatcher FourNotFive = binaryConditionalOperator(
  889     hasTrueExpression(opaqueValueExpr(
  890       hasSourceExpression((integerLiteral(equals(4)))))),
  891     hasFalseExpression(integerLiteral(equals(5))));
 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()))));
 1072                       varDecl(hasInitializer(exprWithCleanups()))));
 1075                        varDecl(hasInitializer(exprWithCleanups()))));
 1080                       initListExpr(hasType(asString("int [2]")))));
 1082                       initListExpr(hasType(recordDecl(hasName("B"))))));
 1082                       initListExpr(hasType(recordDecl(hasName("B"))))));
 1086                       declRefExpr(to(functionDecl(hasName("f"))))));
 1086                       declRefExpr(to(functionDecl(hasName("f"))))));
 1088     matches("int i[1] = {42, [0] = 43};", integerLiteral(equals(42))));
 1101                       cxxConstructExpr(has(cxxStdInitializerListExpr()),
 1102                                        hasDeclaration(cxxConstructorDecl(
 1105                       cxxConstructExpr(has(cxxStdInitializerListExpr()),
 1106                                        hasDeclaration(cxxConstructorDecl(
 1121                       usingDecl(hasAnyUsingShadowDecl(hasName("a")))));
 1171                       cxxCatchStmt(isCatchAll())));
 1173                          cxxCatchStmt(isCatchAll())));
 1175                       varDecl(isExceptionVariable())));
 1177                          varDecl(isExceptionVariable())));
 1190                        implicitCastExpr(hasSourceExpression(stringLiteral()))));
 1193       implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral())))));
 1204     constantArrayType(hasElementType(builtinType()))));
 1204     constantArrayType(hasElementType(builtinType()))));
 1206   EXPECT_TRUE(matches("int a[42];", constantArrayType(hasSize(42))));
 1207   EXPECT_TRUE(matches("int b[2*21];", constantArrayType(hasSize(42))));
 1208   EXPECT_TRUE(notMatches("int c[41], d[43];", constantArrayType(hasSize(42))));
 1234     variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
 1234     variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to(
 1235       varDecl(hasName("b")))))))));
 1246                         atomicType(hasValueType(isInteger()))));
 1246                         atomicType(hasValueType(isInteger()))));
 1248                            atomicType(hasValueType(isInteger()))));
 1248                            atomicType(hasValueType(isInteger()))));
 1257   EXPECT_TRUE(matches("auto i = 2;", varDecl(hasType(isInteger()))));
 1259                       varDecl(hasType(recordDecl(hasName("X"))))));
 1259                       varDecl(hasType(recordDecl(hasName("X"))))));
 1272                       decltypeType(hasUnderlyingType(isInteger()))));
 1272                       decltypeType(hasUnderlyingType(isInteger()))));
 1282       notMatches("void (*fp)(void);", pointerType(pointee(functionType()))));
 1282       notMatches("void (*fp)(void);", pointerType(pointee(functionType()))));
 1284                       pointerType(pointee(ignoringParens(functionType())))));
 1284                       pointerType(pointee(ignoringParens(functionType())))));
 1290   EXPECT_TRUE(matches("void f();", functionProtoType(parameterCountIs(0))));
 1293     matchesC("void f(void);", functionProtoType(parameterCountIs(0))));
 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())))))));
 1303     varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
 1303     varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
 1306     varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
 1306     varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
 1306     varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
 1323     loc(pointerType(pointee(qualType())))));
 1323     loc(pointerType(pointee(qualType())))));
 1326     loc(pointerType(pointee(pointerType())))));
 1326     loc(pointerType(pointee(pointerType())))));
 1329     loc(qualType(isConstQualified(), pointerType()))));
 1332   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
 1334   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
 1336   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
 1338   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
 1340   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
 1342   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
 1346   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
 1348   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
 1350   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
 1352   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
 1356   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
 1358   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
 1360   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
 1362   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
 1364   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
 1366   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
 1370   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
 1372   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
 1374   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
 1376   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
 1378   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
 1380   EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
 1390   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("a"),
 1392   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("b"),
 1394   EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
 1396   EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
 1398   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("c"),
 1400   EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
 1402   EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
 1404   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("d"),
 1406   EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
 1408   EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("e"),
 1410   EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
 1428     loc(pointerType(pointee(builtinType())))));
 1428     loc(pointerType(pointee(builtinType())))));
 1431     pointerType(pointee(builtinType()))));
 1431     pointerType(pointee(builtinType()))));
 1435   EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"),
 1447                       recordType(hasDeclaration(recordDecl(hasName("S"))))));
 1447                       recordType(hasDeclaration(recordDecl(hasName("S"))))));
 1449                          recordType(hasDeclaration(recordDecl(hasName("S"))))));
 1449                          recordType(hasDeclaration(recordDecl(hasName("S"))))));
 1470   EXPECT_FALSE(matches(code, binaryOperator(hasLHS(
 1471     expr(hasType(substTemplateTypeParmType()))))));
 1472   EXPECT_TRUE(matches(code, binaryOperator(hasRHS(
 1473     expr(hasType(substTemplateTypeParmType()))))));
 1501                       namespaceAliasDecl(hasName("alias"))));
 1505   NestedNameSpecifierMatcher Matcher = nestedNameSpecifier(
 1506     specifiesType(hasDeclaration(recordDecl(hasName("A")))));
 1514   NestedNameSpecifierMatcher Matcher = nestedNameSpecifier(
 1524     nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A"))))));
 1527     nestedNameSpecifierLoc(hasPrefix(
 1528       specifiesTypeLoc(loc(qualType(asString("struct A"))))))));
 1531     nestedNameSpecifierLoc(hasPrefix(
 1532       specifiesTypeLoc(loc(qualType(asString("struct N::A"))))))));
 1551       "", match(stmt(hasParent(
 1552         stmt(has(stmt(equalsNode(TypedNode)))).bind(""))),
 1552         stmt(has(stmt(equalsNode(TypedNode)))).bind(""))),
 1560       "", match(decl(hasParent(
 1561         decl(has(decl(equalsNode(TypedNode)))).bind(""))),
 1561         decl(has(decl(equalsNode(TypedNode)))).bind(""))),
 1570       "", match(fieldDecl(hasParent(decl(has(fieldDecl(
 1570       "", match(fieldDecl(hasParent(decl(has(fieldDecl(
 1570       "", match(fieldDecl(hasParent(decl(has(fieldDecl(
 1571         hasType(type(equalsNode(TypedNode)).bind(""))))))),
 1578     "class X { class Y {}; };", recordDecl(hasName("::X::Y")).bind(""),
 1585     fieldDecl(hasName("y"), hasType(type().bind(""))).bind("decl"),
 1591                       typedefDecl(hasName("typedefDeclTest"))));
 1593                          typedefDecl(hasName("typedefDeclTest2"))));
 1598                       typeAliasDecl(hasName("typeAliasTest2"))));
 1600                          typeAliasDecl(hasName("typeAliasTest"))));
 1605                       typedefNameDecl(hasName("typedefNameDeclTest1"))));
 1607                       typedefNameDecl(hasName("typedefNameDeclTest2"))));
 1621       matches(Code, typeAliasTemplateDecl(hasName("typeAliasTemplateDecl"))));
 1623       notMatches(Code, typeAliasTemplateDecl(hasName("typeAliasDecl"))));
 1628   EXPECT_TRUE(notMatchesObjC("", objcMessageExpr(anything())));
 1647     objcMessageExpr(anything())));
 1649                           objcMessageExpr(hasAnySelector({
 1655     objcMessageExpr(hasSelector("contents"))));
 1658     objcMessageExpr(hasAnySelector("contents", "contentsA"))));
 1658     objcMessageExpr(hasAnySelector("contents", "contentsA"))));
 1661     objcMessageExpr(hasAnySelector("contentsB", "contentsC"))));
 1661     objcMessageExpr(hasAnySelector("contentsB", "contentsC"))));
 1664     objcMessageExpr(matchesSelector("cont*"))));
 1667     objcMessageExpr(matchesSelector("?cont*"))));
 1670     objcMessageExpr(hasSelector("contents"), hasNullSelector())));
 1673     objcMessageExpr(hasSelector("contents"), hasUnarySelector())));
 1676     objcMessageExpr(hasSelector("contents"), numSelectorArgs(0))));
 1679     objcMessageExpr(matchesSelector("uppercase*"),
 1706     objcProtocolDecl(hasName("Proto"))));
 1709     objcImplementationDecl(hasName("Thing"))));
 1712     objcCategoryDecl(hasName("ABC"))));
 1715     objcCategoryImplDecl(hasName("ABC"))));
 1718     objcMethodDecl(hasName("protoDidThing"))));
 1721     objcMethodDecl(hasName("abc_doThing"))));
 1724     objcMethodDecl(hasName("anything"))));
 1727     objcIvarDecl(hasName("_ivar"))));
 1730     objcPropertyDecl(hasName("enabled"))));
 1769   auto Matcher = stmt(ompExecutableDirective());
 1793   auto Matcher = ompExecutableDirective(hasAnyClause(ompDefaultClause()));
tools/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
   23                       cxxRecordDecl(hasMethod(hasName("func")))));
   25                          cxxRecordDecl(hasMethod(isPublic()))));
   35     cxxRecordDecl(hasName("B"), isDerivedFrom(recordDecl()))));
   45     recordDecl(hasDeclContext(namespaceDecl(hasName("M"))))));
   45     recordDecl(hasDeclContext(namespaceDecl(hasName("M"))))));
   52     recordDecl(hasDeclContext(namespaceDecl(hasName("N"))))));
   52     recordDecl(hasDeclContext(namespaceDecl(hasName("N"))))));
   59                       recordDecl(hasDeclContext(namespaceDecl(
   59                       recordDecl(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())))));
   74                       stmt(hasDescendant(qualType(builtinType())))));
   77                          stmt(hasDescendant(isInteger()))));
   81     functionDecl(forEachDescendant(
   82       varDecl(hasDescendant(isInteger())).bind("x"))),
   88                       qualType(hasDescendant(builtinType()))));
   90                       qualType(hasDescendant(
   91                         pointerType(pointee(builtinType()))))));
   91                         pointerType(pointee(builtinType()))))));
   93                       typeLoc(hasDescendant(loc(builtinType())))));
   97     qualType(asString("int ***"), forEachDescendant(pointerType().bind("x"))),
  104                       varDecl(hasName("i"), has(isInteger()))));
  106                          varDecl(hasName("i"), has(isInteger()))));
  109     qualType(functionType(), forEach(qualType(isInteger()).bind("x"))),
  109     qualType(functionType(), forEach(qualType(isInteger()).bind("x"))),
  116     varDecl(hasName("i"), hasType(qualType(has(builtinType()))))));
  116     varDecl(hasName("i"), hasType(qualType(has(builtinType()))))));
  119     varDecl(hasName("i"), hasType(qualType(has(pointerType()))))));
  119     varDecl(hasName("i"), hasType(qualType(has(pointerType()))))));
  124       expr(hasType(pointsTo(recordDecl(hasName("X")))),
  124       expr(hasType(pointsTo(recordDecl(hasName("X")))),
  125            has(ignoringParenImpCasts(declRefExpr(to(varDecl(hasName("i")))))));
  125            has(ignoringParenImpCasts(declRefExpr(to(varDecl(hasName("i")))))));
  135     expr(hasType(pointsTo(recordDecl(hasName("X")))),
  135     expr(hasType(pointsTo(recordDecl(hasName("X")))),
  136          hasDescendant(declRefExpr(to(varDecl(hasName("i"))))));
  136          hasDescendant(declRefExpr(to(varDecl(hasName("i"))))));
  147   TypeMatcher TypeA = hasDeclaration(recordDecl(hasName("A")));
  153     hasDeclaration(cxxRecordDecl(isDerivedFrom("A")));
  160     recordDecl(hasName("A"), has(recordDecl(hasName("B")))));
  160     recordDecl(hasName("A"), has(recordDecl(hasName("B")))));
  166                        varDecl(hasType(namedDecl(hasName("S"))))));
  166                        varDecl(hasType(namedDecl(hasName("S"))))));
  172                       parmVarDecl(hasType(namedDecl(hasName("I"))))));
  172                       parmVarDecl(hasType(namedDecl(hasName("I"))))));
  175                           parmVarDecl(hasType(objcObjectPointerType()))));
  179     parmVarDecl(hasType(pointsTo(objcInterfaceDecl(hasName("Foo")))))));
  179     parmVarDecl(hasType(pointsTo(objcInterfaceDecl(hasName("Foo")))))));
  182                       parmVarDecl(hasType(templateTypeParmType()))));
  185                       parmVarDecl(hasType(namedDecl(hasName("T"))))));
  185                       parmVarDecl(hasType(namedDecl(hasName("T"))))));
  190                       parmVarDecl(hasType(injectedClassNameType()))));
  194                          parmVarDecl(hasType(injectedClassNameType()))));
  199                       parmVarDecl(hasType(namedDecl(hasName("S"))))));
  199                       parmVarDecl(hasType(namedDecl(hasName("S"))))));
  212   EXPECT_TRUE(matches(Using, unresolvedUsingTypenameDecl(hasName("Foo"))));
  214   EXPECT_TRUE(matches(Using, parmVarDecl(hasType(namedDecl(hasName("Foo"))))));
  214   EXPECT_TRUE(matches(Using, parmVarDecl(hasType(namedDecl(hasName("Foo"))))));
  219                       expr(hasType(pointsTo(
  220                         qualType(hasDeclaration(enumDecl(hasName("X")))))))));
  220                         qualType(hasDeclaration(enumDecl(hasName("X")))))))));
  236       parmVarDecl(hasType(qualType(hasDeclaration(cxxRecordDecl()))))));
  236       parmVarDecl(hasType(qualType(hasDeclaration(cxxRecordDecl()))))));
  240       parmVarDecl(hasType(elaboratedType(hasDeclaration(cxxRecordDecl()))))));
  240       parmVarDecl(hasType(elaboratedType(hasDeclaration(cxxRecordDecl()))))));
  245                       varDecl(hasName("a"),
  246                               hasType(typedefType(hasDeclaration(decl()))))));
  253                       varDecl(hasType(templateSpecializationType(
  253                       varDecl(hasType(templateSpecializationType(
  254                         hasDeclaration(namedDecl(hasName("A"))))))));
  257                       fieldDecl(hasType(templateSpecializationType(
  257                       fieldDecl(hasType(templateSpecializationType(
  258                         hasDeclaration(namedDecl(hasName("A"))))))));
  260                       varDecl(hasType(templateSpecializationType(
  260                       varDecl(hasType(templateSpecializationType(
  267               cxxNewExpr(hasDeclaration(functionDecl(parameterCountIs(1))))));
  267               cxxNewExpr(hasDeclaration(functionDecl(parameterCountIs(1))))));
  272                       varDecl(hasType(templateSpecializationType(
  272                       varDecl(hasType(templateSpecializationType(
  279               varDecl(hasType(hasUnqualifiedDesugaredType(recordType())))));
  282               varDecl(hasType(hasUnqualifiedDesugaredType(recordType())))));
  288                       unresolvedLookupExpr(hasAnyDeclaration(
  289                           namedDecl(hasUnderlyingDecl(hasName("::N::f")))))));
  293       unresolvedLookupExpr(hasAnyDeclaration(namedDecl(hasName("::N::f"))))));
  293       unresolvedLookupExpr(hasAnyDeclaration(namedDecl(hasName("::N::f"))))));
  297       unresolvedLookupExpr(hasAnyDeclaration(namedDecl(hasName("::N::f"))))));
  297       unresolvedLookupExpr(hasAnyDeclaration(namedDecl(hasName("::N::f"))))));
  301   TypeMatcher ClassX = hasDeclaration(recordDecl(hasName("X")));
  303     matches("class X {}; void y(X &x) { x; }", expr(hasType(ClassX))));
  306                expr(hasType(ClassX))));
  309             expr(hasType(pointsTo(ClassX)))));
  313   TypeMatcher ClassX = hasDeclaration(recordDecl(hasName("X")));
  315     matches("class X {}; void y() { X x; }", varDecl(hasType(ClassX))));
  317     notMatches("class X {}; void y() { X *x; }", varDecl(hasType(ClassX))));
  320             varDecl(hasType(pointsTo(ClassX)))));
  324   DeclarationMatcher ClassX = recordDecl(hasName("X"));
  326     matches("class X {}; void y(X &x) { x; }", expr(hasType(ClassX))));
  329                expr(hasType(ClassX))));
  333   DeclarationMatcher ClassX = recordDecl(hasName("X"));
  335     matches("class X {}; void y() { X x; }", varDecl(hasType(ClassX))));
  337     notMatches("class X {}; void y() { X *x; }", varDecl(hasType(ClassX))));
  341   EXPECT_TRUE(matches("typedef int X;", typedefDecl(hasType(asString("int")))));
  343                       typedefDecl(hasType(asString("const int")))));
  345                          typedefDecl(hasType(asString("int")))));
  347                       typedefDecl(hasType(asString("foo")), hasName("bar"))));
  351   EXPECT_TRUE(matches("using X = int;", typedefNameDecl(hasType(asString("int")))));
  353                       typedefNameDecl(hasType(asString("const int")))));
  355                          typedefNameDecl(hasType(asString("int")))));
  357                       typedefNameDecl(hasType(asString("foo")), hasName("bar"))));
  362                       varDecl(hasName("x"), hasTypeLoc(loc(asString("int"))))));
  366                          declaratorDecl(hasTypeLoc(loc(asString("int"))))));
  371   StatementMatcher CallMethodX = callExpr(callee(cxxMethodDecl(hasName("x"))));
  371   StatementMatcher CallMethodX = callExpr(callee(cxxMethodDecl(hasName("x"))));
  376   CallMethodX = callExpr(callee(cxxConversionDecl()));
  385                       callExpr(callee(memberExpr()))));
  387     notMatches("class Y { void x() { this->x(); } };", callExpr(callee(callExpr()))));
  391   StatementMatcher CallArgumentY = callExpr(
  392     hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
  392     hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
  399   StatementMatcher WrongIndex = callExpr(
  400     hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
  400     hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
  406       ignoringParenImpCasts(declRefExpr(to(varDecl(hasName("y"))))));
  406       ignoringParenImpCasts(declRefExpr(to(varDecl(hasName("y"))))));
  407   StatementMatcher CallArgumentY = callExpr(HasArgumentY);
  408   StatementMatcher CtorArgumentY = cxxConstructExpr(HasArgumentY);
  410       cxxUnresolvedConstructExpr(HasArgumentY);
  411   StatementMatcher ObjCCallArgumentY = objcMessageExpr(HasArgumentY);
  438   StatementMatcher ImplicitCastedArgument = callExpr(
  449       objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))));
  449       objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))));
  449       objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))));
  454       objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))));
  454       objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))));
  454       objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))));
  461       objcMessageExpr(isClassMessage())));
  468       objcMessageExpr(isClassMessage())));
  477       objcMessageExpr(isInstanceMessage())));
  482       objcMessageExpr(isInstanceMessage())));
  489     objcMethodDecl(isClassMethod())));
  494     objcMethodDecl(isClassMethod())));
  498     objcMethodDecl(isClassMethod())));
  503     objcMethodDecl(isClassMethod())));
  509     objcMethodDecl(isInstanceMethod())));
  514     objcMethodDecl(isInstanceMethod())));
  518     objcMethodDecl(isInstanceMethod())));
  523     objcMethodDecl(isInstanceMethod())));
  540   auto MatchesY = cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y")))));
  540   auto MatchesY = cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y")))));
  544   auto MatchesX = cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X")))));
  544   auto MatchesX = cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X")))));
  555   auto MatchesCall = cxxMemberCallExpr(on(callExpr()));
  573   auto MatchesY = cxxMemberCallExpr(
  574       onImplicitObjectArgument(hasType(cxxRecordDecl(hasName("Y")))));
  578   auto MatchesX = cxxMemberCallExpr(
  579       onImplicitObjectArgument(hasType(cxxRecordDecl(hasName("X")))));
  590   auto MatchesCall = cxxMemberCallExpr(onImplicitObjectArgument(callExpr()));
  608       memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))));
  608       memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))));
  612   auto MatchesXPointer = memberExpr(
  613       hasObjectExpression(hasType(pointsTo(cxxRecordDecl(hasName("X"))))));
  620     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  620     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  621   DeclarationMatcher IntParam = parmVarDecl(hasType(isInteger())).bind("param");
  623     callExpr(forEachArgumentWithParam(ArgumentY, IntParam));
  633     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  633     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  634   DeclarationMatcher IntParam = parmVarDecl(hasType(isInteger())).bind("param");
  636     callExpr(forEachArgumentWithParam(ArgumentY, IntParam));
  648     callExpr(forEachArgumentWithParam(ArgumentY, IntParam));
  662     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  662     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  663   DeclarationMatcher IntParam = parmVarDecl(hasType(isInteger())).bind("param");
  665     callExpr(forEachArgumentWithParam(ArgumentY, IntParam));
  686     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  686     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  687   DeclarationMatcher IntParam = parmVarDecl(hasType(isInteger())).bind("param");
  689     cxxConstructExpr(forEachArgumentWithParam(ArgumentY, IntParam));
  711     functionDecl(
  713       forEachDescendant(callExpr(forEachArgumentWithParam(
  714         declRefExpr(to(decl(equalsBoundNode("v")))), parmVarDecl())))),
  714         declRefExpr(to(decl(equalsBoundNode("v")))), parmVarDecl())))),
  722                          varDecl(hasType(qualType(referenceType())))));
  722                          varDecl(hasType(qualType(referenceType())))));
  727             varDecl(hasType(qualType(hasCanonicalType(referenceType()))))));
  727             varDecl(hasType(qualType(hasCanonicalType(referenceType()))))));
  732                       cxxMethodDecl(hasParameter(0, varDecl()))));
  734                          cxxMethodDecl(hasParameter(0, hasName("x")))));
  736                           objcMethodDecl(hasParameter(0, hasName("x")))));
  738                           blockDecl(hasParameter(0, hasName("p")))));
  743                          cxxMethodDecl(hasParameter(42, varDecl()))));
  749     cxxMethodDecl(hasParameter(0, hasType(recordDecl(hasName("X")))))));
  749     cxxMethodDecl(hasParameter(0, hasType(recordDecl(hasName("X")))))));
  752     cxxMethodDecl(hasParameter(0, hasType(recordDecl(hasName("X")))))));
  752     cxxMethodDecl(hasParameter(0, hasType(recordDecl(hasName("X")))))));
  754                       cxxMethodDecl(hasParameter(
  755                         0, hasType(pointsTo(recordDecl(hasName("X"))))))));
  757                       cxxMethodDecl(hasParameter(
  758                         0, hasType(references(recordDecl(hasName("X"))))))));
  764     cxxMethodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
  764     cxxMethodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
  767     cxxMethodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
  767     cxxMethodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
  769                           objcMethodDecl(hasAnyParameter(hasName("x")))));
  771                           blockDecl(hasAnyParameter(hasName("p")))));
  776                       functionDecl(returns(asString("int")))));
  778                          functionDecl(returns(asString("float")))));
  780                       functionDecl(returns(hasDeclaration(
  781                         recordDecl(hasName("Y")))))));
  787     cxxMethodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
  787     cxxMethodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
  792                          cxxMethodDecl(hasAnyParameter(
  793                            hasType(pointsTo(recordDecl(hasName("X"))))))));
  798                       cxxMethodDecl(hasAnyParameter(hasName("x")))));
  800                          cxxMethodDecl(hasAnyParameter(hasName("x")))));
  807     classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType(
  815                       classTemplateSpecializationDecl(hasAnyTemplateArgument(
  824     classTemplateSpecializationDecl(hasAnyTemplateArgument(
  825       refersToDeclaration(fieldDecl(hasName("next")))))));
  830     classTemplateSpecializationDecl(hasAnyTemplateArgument(
  837     templateSpecializationType(hasAnyTemplateArgument(isExpr(
  838       hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))));
  838       hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))));
  843     templateSpecializationType(hasAnyTemplateArgument(
  852     classTemplateSpecializationDecl(hasTemplateArgument(
  857     classTemplateSpecializationDecl(hasTemplateArgument(
  863     templateSpecializationType(hasTemplateArgument(
  868     templateSpecializationType(hasTemplateArgument(
  874     functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))));
  877     functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))));
  882                       classTemplateSpecializationDecl(
  886     templateSpecializationType(hasAnyTemplateArgument(templateArgument()))));
  891     functionDecl(hasAnyTemplateArgument(templateArgument()))));
  902   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  903   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  914   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  915   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  927   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  928   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T2"))));
  929   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  930   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U2"))));
  942   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  943   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T2"))));
  944   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  945   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U2"))));
  959   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  960   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  973   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("T"))));
  974   EXPECT_TRUE(matches(input, templateTypeParmDecl(hasName("U"))));
  979                       classTemplateSpecializationDecl(
  983                          classTemplateSpecializationDecl(hasAnyTemplateArgument(
  989                       cxxConstructorDecl(ofClass(hasName("Foo")))));
  991                          cxxConstructorDecl(ofClass(hasName("Bar")))));
  996                       cxxDestructorDecl(ofClass(hasName("Foo")))));
 1001                          cxxDestructorDecl(ofClass(hasName("Foo")))));
 1007                cxxConstructorDecl(hasAnyConstructorInitializer(anything()))));
 1013             cxxConstructorDecl(hasAnyConstructorInitializer(anything()))));
 1026   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1027     forField(hasType(recordDecl(hasName("Baz"))))))));
 1028   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1030   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1032   EXPECT_TRUE(notMatches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1033     forField(hasType(recordDecl(hasName("Bar"))))))));
 1042   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1043     withInitializer(integerLiteral(equals(0)))))));
 1044   EXPECT_TRUE(notMatches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1045     withInitializer(integerLiteral(equals(1)))))));
 1056   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1058   EXPECT_TRUE(notMatches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1060   EXPECT_TRUE(matches(Code, cxxConstructorDecl(hasAnyConstructorInitializer(
 1074   EXPECT_TRUE(matches(Code, cxxConstructorDecl(allOf(
 1077   EXPECT_TRUE(notMatches(Code, cxxConstructorDecl(allOf(
 1080   EXPECT_TRUE(matches(Code, cxxConstructorDecl(allOf(
 1083   EXPECT_TRUE(notMatches(Code, cxxConstructorDecl(allOf(
 1090                       ifStmt(hasThen(cxxBoolLiteral(equals(true))))));
 1090                       ifStmt(hasThen(cxxBoolLiteral(equals(true))))));
 1092                          ifStmt(hasThen(cxxBoolLiteral(equals(true))))));
 1092                          ifStmt(hasThen(cxxBoolLiteral(equals(true))))));
 1094                       ifStmt(hasElse(cxxBoolLiteral(equals(true))))));
 1094                       ifStmt(hasElse(cxxBoolLiteral(equals(true))))));
 1096                          ifStmt(hasElse(cxxBoolLiteral(equals(true))))));
 1096                          ifStmt(hasElse(cxxBoolLiteral(equals(true))))));
 1100   StatementMatcher OperatorOr = binaryOperator(hasOperatorName("||"));
 1108     binaryOperator(hasLHS(cxxBoolLiteral(equals(true))),
 1108     binaryOperator(hasLHS(cxxBoolLiteral(equals(true))),
 1109                    hasRHS(cxxBoolLiteral(equals(false))));
 1115   StatementMatcher OperatorIntPointer = arraySubscriptExpr(
 1123     binaryOperator(hasEitherOperand(cxxBoolLiteral(equals(false))));
 1123     binaryOperator(hasEitherOperand(cxxBoolLiteral(equals(false))));
 1135     matches("void x() { 3, 4; }", binaryOperator(hasOperatorName(","))));
 1138             binaryOperator(hasOperatorName("="))));
 1140     matches("bool b = 1 != 2;", binaryOperator(hasOperatorName("!="))));
 1142     matches("bool b = 1 == 2;", binaryOperator(hasOperatorName("=="))));
 1143   EXPECT_TRUE(matches("bool b = 1 < 2;", binaryOperator(hasOperatorName("<"))));
 1145     matches("bool b = 1 <= 2;", binaryOperator(hasOperatorName("<="))));
 1147     matches("int i = 1 << 2;", binaryOperator(hasOperatorName("<<"))));
 1150             binaryOperator(hasOperatorName("<<="))));
 1151   EXPECT_TRUE(matches("bool b = 1 > 2;", binaryOperator(hasOperatorName(">"))));
 1153     matches("bool b = 1 >= 2;", binaryOperator(hasOperatorName(">="))));
 1155     matches("int i = 1 >> 2;", binaryOperator(hasOperatorName(">>"))));
 1158             binaryOperator(hasOperatorName(">>="))));
 1160     matches("int i = 42 ^ 23;", binaryOperator(hasOperatorName("^"))));
 1163             binaryOperator(hasOperatorName("^="))));
 1165     matches("int i = 42 % 23;", binaryOperator(hasOperatorName("%"))));
 1168             binaryOperator(hasOperatorName("%="))));
 1170     matches("bool b = 42  &23;", binaryOperator(hasOperatorName("&"))));
 1173             binaryOperator(hasOperatorName("&&"))));
 1176             binaryOperator(hasOperatorName("&="))));
 1178     matches("bool b = 42 | 23;", binaryOperator(hasOperatorName("|"))));
 1181             binaryOperator(hasOperatorName("||"))));
 1184             binaryOperator(hasOperatorName("|="))));
 1186     matches("int i = 42  *23;", binaryOperator(hasOperatorName("*"))));
 1189             binaryOperator(hasOperatorName("*="))));
 1191     matches("int i = 42 / 23;", binaryOperator(hasOperatorName("/"))));
 1194             binaryOperator(hasOperatorName("/="))));
 1196     matches("int i = 42 + 23;", binaryOperator(hasOperatorName("+"))));
 1199             binaryOperator(hasOperatorName("+="))));
 1201     matches("int i = 42 - 23;", binaryOperator(hasOperatorName("-"))));
 1204             binaryOperator(hasOperatorName("-="))));
 1207             binaryOperator(hasOperatorName("->*"))));
 1210             binaryOperator(hasOperatorName(".*"))));
 1215                binaryOperator(hasOperatorName("->"))));
 1219     notMatches("bool b = true;", binaryOperator(hasOperatorName("="))));
 1232   StatementMatcher OperatorNot = unaryOperator(hasOperatorName("!"));
 1240     unaryOperator(hasUnaryOperand(cxxBoolLiteral(equals(false))));
 1240     unaryOperator(hasUnaryOperand(cxxBoolLiteral(equals(false))));
 1249   EXPECT_TRUE(matches("bool b = !true;", unaryOperator(hasOperatorName("!"))));
 1251     matches("bool b; bool *p = &b;", unaryOperator(hasOperatorName("&"))));
 1252   EXPECT_TRUE(matches("int i = ~ 1;", unaryOperator(hasOperatorName("~"))));
 1254     matches("bool *p; bool b = *p;", unaryOperator(hasOperatorName("*"))));
 1256     matches("int i; int j = +i;", unaryOperator(hasOperatorName("+"))));
 1258     matches("int i; int j = -i;", unaryOperator(hasOperatorName("-"))));
 1260     matches("int i; int j = ++i;", unaryOperator(hasOperatorName("++"))));
 1262     matches("int i; int j = i++;", unaryOperator(hasOperatorName("++"))));
 1264     matches("int i; int j = --i;", unaryOperator(hasOperatorName("--"))));
 1266     matches("int i; int j = i--;", unaryOperator(hasOperatorName("--"))));
 1278       "void x() { A a; !a; }", unaryOperator(hasOperatorName("!"))));
 1284     arraySubscriptExpr(hasIndex(integerLiteral(equals(1))))));
 1284     arraySubscriptExpr(hasIndex(integerLiteral(equals(1))))));
 1287     arraySubscriptExpr(hasIndex(integerLiteral(equals(1))))));
 1287     arraySubscriptExpr(hasIndex(integerLiteral(equals(1))))));
 1290     arraySubscriptExpr(hasIndex(integerLiteral(equals(0))))));
 1290     arraySubscriptExpr(hasIndex(integerLiteral(equals(0))))));
 1296     arraySubscriptExpr(hasBase(implicitCastExpr(
 1296     arraySubscriptExpr(hasBase(implicitCastExpr(
 1301   StatementMatcher Constructor = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
 1301   StatementMatcher Constructor = cxxConstructExpr(hasDeclaration(cxxMethodDecl(
 1319     callExpr(callee(cxxMethodDecl(hasName("x"))))));
 1319     callExpr(callee(cxxMethodDecl(hasName("x"))))));
 1330     recordDecl(hasName("C"), hasDescendant(callExpr(
 1330     recordDecl(hasName("C"), hasDescendant(callExpr(
 1331       callee(cxxMethodDecl(hasName("x"))))))));
 1336     ifStmt(hasCondition(cxxBoolLiteral(equals(true))));
 1336     ifStmt(hasCondition(cxxBoolLiteral(equals(true))));
 1341     forStmt(hasCondition(cxxBoolLiteral(equals(true))));
 1341     forStmt(hasCondition(cxxBoolLiteral(equals(true))));
 1346     whileStmt(hasCondition(cxxBoolLiteral(equals(true))));
 1346     whileStmt(hasCondition(cxxBoolLiteral(equals(true))));
 1351     switchStmt(hasCondition(integerLiteral(equals(42))));
 1351     switchStmt(hasCondition(integerLiteral(equals(42))));
 1358                       forStmt(hasCondition(anything()))));
 1360                       forStmt(hasLoopInit(anything()))));
 1365                       cxxForRangeStmt(hasLoopVariable(anything()))));
 1368     cxxForRangeStmt(hasRangeInit(declRefExpr(to(varDecl(hasName("a"))))))));
 1368     cxxForRangeStmt(hasRangeInit(declRefExpr(to(varDecl(hasName("a"))))))));
 1368     cxxForRangeStmt(hasRangeInit(declRefExpr(to(varDecl(hasName("a"))))))));
 1373                          forStmt(hasCondition(expr()))));
 1375                          forStmt(hasLoopInit(anything()))));
 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()))));
 1424     cxxMethodDecl(ofClass(hasName("X"))), true, "-std=gnu++98"));
 1427                       cxxMethodDecl(ofClass(hasName("X")))));
 1433     cxxMethodDecl(ofClass(hasName("X"))), true, "-std=gnu++98"));
 1438                       cxxStaticCastExpr(hasDestinationType(
 1445                       implicitCastExpr(
 1449                       implicitCastExpr(hasImplicitDestinationType(
 1456                          implicitCastExpr(hasImplicitDestinationType(
 1460                          implicitCastExpr(hasImplicitDestinationType(
 1472               cxxOperatorCallExpr(hasArgument(
 1473                   1, callExpr(hasArgument(
 1483               cxxOperatorCallExpr(hasArgument(
 1484                   1, callExpr(hasArgument(0, ignoringElidableConstructorCall(
 1493       varDecl(hasInitializer(anyOf(
 1495           exprWithCleanups(has(ignoringElidableConstructorCall(callExpr())))))),
 1500   auto matcher = expr(ignoringElidableConstructorCall(declRefExpr()));
 1519                       varDecl(hasInitializer(
 1528                       expr(ignoringElidableConstructorCall(integerLiteral())),
 1534       varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())));
 1551                       varDecl(has(ignoringImplicit(cxxConstructExpr())))));
 1582   EXPECT_TRUE(matches(Code, varDecl(
 1584       hasInitializer(exprWithCleanups(has(
 1585         cxxConstructExpr(has(expr(ignoringImplicit(cxxConstructExpr(
 1585         cxxConstructExpr(has(expr(ignoringImplicit(cxxConstructExpr(
 1585         cxxConstructExpr(has(expr(ignoringImplicit(cxxConstructExpr(
 1586           has(expr(ignoringImplicit(callExpr())))
 1595       notMatches("class C {}; C a = C();", varDecl(has(cxxConstructExpr()))));
 1603                       varDecl(hasInitializer(ignoringImpCasts(
 1604                         declRefExpr(to(varDecl(hasName("x")))))))));
 1604                         declRefExpr(to(varDecl(hasName("x")))))))));
 1607                       varDecl(hasInitializer(ignoringImpCasts(
 1608                         integerLiteral(equals(0)))))));
 1616                          varDecl(hasInitializer(ignoringImpCasts(
 1619                          varDecl(hasInitializer(ignoringImpCasts(
 1625                          varDecl(hasInitializer(ignoringImpCasts(
 1628                          varDecl(hasInitializer(ignoringImpCasts(
 1631                          varDecl(hasInitializer(ignoringImpCasts(
 1634                          varDecl(hasInitializer(ignoringImpCasts(
 1642                       varDecl(hasInitializer(ignoringImpCasts(
 1643                         declRefExpr(to(varDecl(hasName("x")))))))));
 1643                         declRefExpr(to(varDecl(hasName("x")))))))));
 1650                       varDecl(hasInitializer(ignoringParenCasts(
 1651                         integerLiteral(equals(0)))))));
 1653                       varDecl(hasInitializer(ignoringParenCasts(
 1654                         integerLiteral(equals(0)))))));
 1659                       varDecl(hasInitializer(ignoringParenCasts(
 1660                         integerLiteral(equals(0)))))));
 1663                       varDecl(hasInitializer(ignoringParenCasts(
 1664                         integerLiteral(equals(0)))))));
 1666                       varDecl(hasInitializer(ignoringParenCasts(
 1667                         integerLiteral(equals(0)))))));
 1673                       varDecl(hasInitializer(ignoringParenCasts(
 1674                         integerLiteral(equals(0)))))));
 1681                          varDecl(hasInitializer(ignoringParenCasts(
 1687                          varDecl(hasInitializer(ignoringParenCasts(
 1691                          varDecl(hasInitializer(ignoringParenCasts(
 1701                       varDecl(hasInitializer(ignoringParenImpCasts(
 1702                         declRefExpr(to(varDecl(hasName("x")))))))));
 1702                         declRefExpr(to(varDecl(hasName("x")))))))));
 1705                       varDecl(hasInitializer(ignoringParenImpCasts(
 1706                         integerLiteral(equals(0)))))));
 1713                       varDecl(hasInitializer(ignoringParenImpCasts(
 1714                         declRefExpr(to(varDecl(hasName("x")))))))));
 1714                         declRefExpr(to(varDecl(hasName("x")))))))));
 1716                       varDecl(hasInitializer(ignoringParenImpCasts(
 1717                         integerLiteral(equals(0)))))));
 1725                          varDecl(hasInitializer(ignoringParenImpCasts(
 1730                          varDecl(hasInitializer(ignoringParenImpCasts(
 1733                          varDecl(hasInitializer(ignoringParenImpCasts(
 1736                          varDecl(hasInitializer(ignoringParenImpCasts(
 1743                       implicitCastExpr(
 1749                       explicitCastExpr(
 1751                           expr(integerLiteral()))))));
 1756                       usingDecl(hasAnyUsingShadowDecl(
 1759                          usingDecl(hasAnyUsingShadowDecl(
 1766     declRefExpr(throughUsingDecl(anything()))));
 1769     declRefExpr(throughUsingDecl(anything()))));
 1774     declStmt(hasSingleDecl(varDecl(hasInitializer(anything()))));
 1774     declStmt(hasSingleDecl(varDecl(hasInitializer(anything()))));
 1782   DeclarationMatcher MatchesInit = varDecl(hasInitializer(anything()));
 1785                       declStmt(containsDeclaration(0, MatchesInit))));
 1787                       declStmt(containsDeclaration(0, MatchesInit),
 1791                          declStmt(containsDeclaration(WrongIndex,
 1797                          switchStmt(forEachSwitchCase(caseStmt()))));
 1799                       switchStmt(forEachSwitchCase(caseStmt()))));
 1801                       switchStmt(forEachSwitchCase(caseStmt()))));
 1804     ifStmt(has(switchStmt(forEachSwitchCase(defaultStmt()))))));
 1804     ifStmt(has(switchStmt(forEachSwitchCase(defaultStmt()))))));
 1806                       switchStmt(forEachSwitchCase(
 1807                         caseStmt(hasCaseConstant(
 1808                             constantExpr(has(integerLiteral()))))))));
 1810                          switchStmt(forEachSwitchCase(
 1811                            caseStmt(hasCaseConstant(
 1812                                constantExpr(has(integerLiteral()))))))));
 1814                          switchStmt(forEachSwitchCase(
 1815                            caseStmt(hasCaseConstant(
 1816                                constantExpr(has(integerLiteral()))))))));
 1819     switchStmt(forEachSwitchCase(caseStmt().bind("x"))),
 1825       "void f();", functionDecl(hasExplicitSpecifier(constantExpr())), false,
 1829       cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1829       cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1833       cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1833       cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1837       cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1837       cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1841       cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1841       cxxConversionDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1845       cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1845       cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1849       cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1849       cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1853       cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1853       cxxConstructorDecl(hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1858       cxxDeductionGuideDecl(
 1859           hasExplicitSpecifier(constantExpr(has(cxxBoolLiteral())))),
 1863                                    cxxDeductionGuideDecl(hasExplicitSpecifier(
 1864                                        constantExpr(has(cxxBoolLiteral())))),
 1868                                    cxxDeductionGuideDecl(hasExplicitSpecifier(
 1869                                        constantExpr(has(cxxBoolLiteral())))),
 1876     cxxConstructorDecl(forEachConstructorInitializer(cxxCtorInitializer()))));
 1882     ifStmt(hasConditionVariableStatement(declStmt()))));
 1885     ifStmt(hasConditionVariableStatement(declStmt()))));
 1891     ifStmt(hasConditionVariableStatement(declStmt()))));
 1896                                        recordDecl(hasName("C"), forEach(fieldDecl(hasName("x")).bind("x"))),
 1896                                        recordDecl(hasName("C"), forEach(fieldDecl(hasName("x")).bind("x"))),
 1902                                        recordDecl(hasName("C"), forEach(fieldDecl().bind("f"))),
 1909     recordDecl(hasName("C"),
 1910                forEach(recordDecl(forEach(fieldDecl().bind("f"))))),
 1916                                        recordDecl(hasName("C"),
 1917                                                   forEachDescendant(fieldDecl(hasName("x")).bind("x"))),
 1922   DeclarationMatcher m = recordDecl(
 1926     recordDecl(hasName("A"), anyOf(m, forEachDescendant(m))),
 1934     recordDecl(hasName("A"), allOf(hasDescendant(m), anyOf(m, anything()))),
 1942     recordDecl(hasName("C"), forEachDescendant(fieldDecl().bind("f"))),
 1950     recordDecl(hasName("C"), forEachDescendant(recordDecl(
 1950     recordDecl(hasName("C"), forEachDescendant(recordDecl(
 1959     compoundStmt(forEachDescendant(ifStmt().bind("if")),
 1966     "class X { int a; };", recordDecl(decl().bind("x"), has(fieldDecl())),
 1992     recordDecl(
 1994       anyOf(forEachDescendant(recordDecl(hasName("Y"))), anything())),
 1997     "class X {};", recordDecl(recordDecl().bind("x"), hasName("::X"),
 2002     classTemplateSpecializationDecl(
 2008     cxxRecordDecl(decl().bind("x"), hasMethod(hasName("g"))),
 2012     recordDecl(decl().bind("x"),
 2013                has(cxxConstructorDecl(
 2018     callExpr(expr().bind("x"), hasAnyArgument(integerLiteral(equals(42)))),
 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(
 2033       functionDecl(parameterCountIs(1))))),
 2037     cxxRecordDecl(decl().bind("x"), isDerivedFrom("::A")),
 2042     cxxRecordDecl(decl().bind("x"), isDerivedFrom("C")),
 2046     functionDecl(decl().bind("x"), hasAncestor(recordDecl(hasName("::A")))),
 2046     functionDecl(decl().bind("x"), hasAncestor(recordDecl(hasName("::A")))),
 2053     ifStmt(stmt().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"))),
 2080     recordDecl(hasName("::A"), findAll(recordDecl(hasName("::A")).bind("v"))),
 2080     recordDecl(hasName("::A"), findAll(recordDecl(hasName("::A")).bind("v"))),
 2087     recordDecl(hasName("::A"), findAll(fieldDecl().bind("v"))),
 2094     recordDecl(hasName("::A"),
 2095                findAll(decl(anyOf(recordDecl(hasName("::A")).bind("v"),
 2095                findAll(decl(anyOf(recordDecl(hasName("::A")).bind("v"),
 2101     recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("v"))),
 2101     recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("v"))),
 2108     recordDecl(hasName("C"), hasAncestor(recordDecl(hasName("A"))))));
 2108     recordDecl(hasName("C"), hasAncestor(recordDecl(hasName("A"))))));
 2114     recordDecl(hasName("C"), hasAncestor(recordDecl(hasName("X"))))));
 2114     recordDecl(hasName("C"), hasAncestor(recordDecl(hasName("X"))))));
 2120     varDecl(hasName("c"), hasType(recordDecl(hasName("C"),
 2120     varDecl(hasName("c"), hasType(recordDecl(hasName("C"),
 2121                                              hasAncestor(recordDecl(hasName("A"))))))));
 2127     integerLiteral(equals(42), hasAncestor(ifStmt()))));
 2133     integerLiteral(equals(42), hasAncestor(functionDecl(hasName("f"))))));
 2133     integerLiteral(equals(42), hasAncestor(functionDecl(hasName("f"))))));
 2139     fieldDecl(hasAncestor(recordDecl(hasAncestor(recordDecl().bind("r"))))),
 2139     fieldDecl(hasAncestor(recordDecl(hasAncestor(recordDecl().bind("r"))))),
 2146     fieldDecl(hasAncestor(
 2147       decl(
 2148         hasDescendant(recordDecl(isDefinition(),
 2163     varDecl(hasName("x"),
 2164             hasAncestor(functionDecl(hasParameter(
 2165               0, varDecl(hasType(asString("int"))))).bind("f"))).bind("v"),
 2173     fieldDecl(hasType(asString("int")),
 2174               hasAncestor(recordDecl(hasName("A"))))));
 2180     cxxConstructorDecl(
 2181       hasAnyConstructorInitializer(withInitializer(expr(
 2182         hasAncestor(recordDecl(hasName("A")))))))));
 2188     compoundStmt(hasParent(ifStmt()))));
 2191     compoundStmt(hasParent(ifStmt()))));
 2194     compoundStmt(hasParent(ifStmt()))));
 2201     integerLiteral(
 2204         hasAncestor(cxxRecordDecl(isTemplateInstantiation())),
 2205         hasAncestor(cxxRecordDecl(unless(isTemplateInstantiation())))))));
 2213                       declRefExpr(to(decl(hasAncestor(decl()))))));
 2213                       declRefExpr(to(decl(hasAncestor(decl()))))));
 2221                       memberExpr(member(hasAncestor(decl())))));
 2228                       memberExpr(member(hasAncestor(decl())))));
 2235                       declRefExpr(to(decl(hasAncestor(decl()))))));
 2235                       declRefExpr(to(decl(hasAncestor(decl()))))));
 2245                       declRefExpr(to(decl(hasAncestor(decl()))))));
 2245                       declRefExpr(to(decl(hasAncestor(decl()))))));
 2252                       declRefExpr(to(decl(hasAncestor(decl()))))));
 2252                       declRefExpr(to(decl(hasAncestor(decl()))))));
 2259     integerLiteral(
 2261       hasParent(compoundStmt(hasParent(functionDecl(
 2261       hasParent(compoundStmt(hasParent(functionDecl(
 2262         hasParent(cxxRecordDecl(isTemplateInstantiation())))))))));
 2266             integerLiteral(
 2268               hasParent(compoundStmt(hasParent(functionDecl(hasParent(
 2268               hasParent(compoundStmt(hasParent(functionDecl(hasParent(
 2269                 cxxRecordDecl(unless(isTemplateInstantiation()))))))))));
 2273     integerLiteral(equals(42),
 2274                    hasParent(compoundStmt(
 2275                      allOf(hasParent(functionDecl(hasParent(
 2276                        cxxRecordDecl(isTemplateInstantiation())))),
 2277                            hasParent(functionDecl(hasParent(cxxRecordDecl(
 2277                            hasParent(functionDecl(hasParent(cxxRecordDecl(
 2282                compoundStmt(hasParent(recordDecl()))));
 2308                       referenceType(pointee(builtinType()))));
 2308                       referenceType(pointee(builtinType()))));
 2309   EXPECT_TRUE(matches("int *a;", pointerType(pointee(builtinType()))));
 2309   EXPECT_TRUE(matches("int *a;", pointerType(pointee(builtinType()))));
 2312                       loc(pointerType(pointee(builtinType())))));
 2312                       loc(pointerType(pointee(builtinType())))));
 2316     pointerType(pointee(isConstQualified(), builtinType()))));
 2316     pointerType(pointee(isConstQualified(), builtinType()))));
 2319     pointerType(pointee(isConstQualified(), builtinType()))));
 2319     pointerType(pointee(isConstQualified(), builtinType()))));
 2330     elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))))));
 2336     elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))))));
 2340     elaboratedType(hasQualifier(nestedNameSpecifier()))));
 2351     elaboratedType(elaboratedType(namesType(recordType(
 2351     elaboratedType(elaboratedType(namesType(recordType(
 2351     elaboratedType(elaboratedType(namesType(recordType(
 2352       hasDeclaration(namedDecl(hasName("D")))))))));
 2358     elaboratedType(elaboratedType(namesType(typedefType())))));
 2358     elaboratedType(elaboratedType(namesType(typedefType())))));
 2364     nestedNameSpecifier(specifiesType(asString("struct ns::E"))).bind("nns"),
 2382     nestedNameSpecifier(specifiesType(asString("struct a::A::B")),
 2383                         hasDescendant(nestedNameSpecifier(
 2387     nestedNameSpecifier(specifiesType(asString("struct a::A::B")),
 2388                         has(nestedNameSpecifier(
 2392     nestedNameSpecifier(specifiesType(asString("struct a::A")),
 2393                         has(nestedNameSpecifier(
 2400     nestedNameSpecifier(specifiesType(asString("struct a::A::B")),
 2411     decl(hasDescendant(nestedNameSpecifier(specifiesType(
 2411     decl(hasDescendant(nestedNameSpecifier(specifiesType(
 2415     functionDecl(hasName("f"),
 2427     nestedNameSpecifierLoc(loc(specifiesType(asString("struct a::A::B"))),
 2428                            hasDescendant(loc(nestedNameSpecifier(
 2432     nestedNameSpecifierLoc(loc(specifiesType(asString("struct a::A::B"))),
 2433                            has(loc(nestedNameSpecifier(
 2437     nestedNameSpecifierLoc(loc(specifiesType(asString("struct a::A"))),
 2438                            has(loc(nestedNameSpecifier(
 2443     nestedNameSpecifierLoc(loc(specifiesType(asString("struct a::A::B"))),
 2454     decl(hasDescendant(loc(nestedNameSpecifier(specifiesType(
 2454     decl(hasDescendant(loc(nestedNameSpecifier(specifiesType(
 2458     functionDecl(hasName("f"),
 2485     "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
 2487       "X", decl(hasDescendant(recordDecl(hasName("X::Y")).bind("Y"))),
 2487       "X", decl(hasDescendant(recordDecl(hasName("X::Y")).bind("Y"))),
 2490     "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
 2492       "X", decl(hasDescendant(recordDecl(hasName("X::Z")).bind("Z"))),
 2492       "X", decl(hasDescendant(recordDecl(hasName("X::Z")).bind("Z"))),
 2500       "if", stmt(hasDescendant(forStmt().bind("for"))), "for")));
 2504       "if", stmt(hasDescendant(declStmt().bind("decl"))), "decl")));
 2509     "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
 2511       "X", recordDecl(has(recordDecl(hasName("X::Y")).bind("Y"))), "Y")));
 2511       "X", recordDecl(has(recordDecl(hasName("X::Y")).bind("Y"))), "Y")));
 2513     "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
 2515       "X", recordDecl(has(recordDecl(hasName("X::Z")).bind("Z"))), "Z")));
 2515       "X", recordDecl(has(recordDecl(hasName("X::Z")).bind("Z"))), "Z")));
 2519   StatementMatcher RetVal = returnStmt(hasReturnValue(binaryOperator()));
 2544       returnStmt(forFunction(hasName("operator=")),
 2545                  has(unaryOperator(hasOperatorName("*"))))));
 2549       returnStmt(forFunction(hasName("operator=")),
 2554       returnStmt(forFunction(hasName("operator()")),
 2556   EXPECT_TRUE(matches(CppString2, returnStmt(forFunction(hasName("F2")))));
 2557   EXPECT_TRUE(notMatches(CppString2, returnStmt(forFunction(hasName("F")))));
 2562     return cxxMethodDecl(ofClass(hasName(ClassName)), isVirtual(),
 2611       matches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(functionDecl(
 2611       matches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(functionDecl(
 2612                             hasParameter(0, parmVarDecl(hasName("p1"))))))));
 2614       matches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(functionDecl(
 2614       matches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(functionDecl(
 2615                             hasParameter(0, parmVarDecl(hasName("p2"))))))));
 2617       notMatches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(functionDecl(
 2617       notMatches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(functionDecl(
 2618                                hasParameter(0, parmVarDecl(hasName("p3"))))))));
 2619   EXPECT_TRUE(notMatches(Fragment, unresolvedLookupExpr(hasAnyDeclaration(
 2620                                        functionDecl(hasName("bar"))))));
 2628   EXPECT_TRUE(matches(Fragment, substTemplateTypeParmType(hasReplacementType(
 2628   EXPECT_TRUE(matches(Fragment, substTemplateTypeParmType(hasReplacementType(
 2629                                     qualType(asString("int"))))));
 2630   EXPECT_TRUE(notMatches(Fragment, substTemplateTypeParmType(hasReplacementType(
 2630   EXPECT_TRUE(notMatches(Fragment, substTemplateTypeParmType(hasReplacementType(
 2631                                        qualType(asString("double"))))));
 2636                  substTemplateTypeParmType(hasReplacementType(qualType()))));
 2636                  substTemplateTypeParmType(hasReplacementType(qualType()))));
 2640   auto Matcher = classTemplateSpecializationDecl(
tools/clang/unittests/ASTMatchers/Dynamic/ParserTest.cpp
   30     ast_matchers::internal::Matcher<Stmt> M = stmt(stmt(), stmt());
  204       functionDecl(hasParameter(0, hasName("a"))));
tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
  151   Value = functionDecl(constructMatcher("parameterCountIs", 2)
  179       functionDecl(constructMatcher(
  209   Matcher<Decl> DeclDecl = declaratorDecl(hasTypeLoc(
  216           "loc", VariantMatcher::SingleMatcher(nestedNameSpecifier(
  217                      specifiesType(hasDeclaration(recordDecl(hasName("A")))))))
  372   D = recordDecl(
  373       has(fieldDecl(hasName("Foo"))),
tools/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp
  150                                                       recordDecl(hasName("X"))))
tools/clang/unittests/Analysis/ExprMutationAnalyzerTest.cpp
   47   return declRefExpr(to(namedDecl(hasName(Name))));
   47   return declRefExpr(to(namedDecl(hasName(Name))));
   51   return expr(Matcher, hasAncestor(compoundStmt().bind("stmt"))).bind("expr");
tools/clang/unittests/Sema/GslOwnerPointerInference.cpp
   24                       classTemplateSpecializationDecl(
   36                       classTemplateSpecializationDecl(
   51                       classTemplateSpecializationDecl(
tools/clang/unittests/StaticAnalyzer/Reusables.h
   24   auto Matches = match(decl(hasDescendant(What.bind("root"))),
   37   return findNode<T>(Where, namedDecl(hasName(Name)));
tools/clang/unittests/Tooling/RangeSelectorTest.cpp
   97       compoundStmt(
   99               cxxConstructExpr(
  101                       decl(hasDescendant(cxxCtorInitializer(isBaseInitializer())
  101                       decl(hasDescendant(cxxCtorInitializer(isBaseInitializer())
  179   auto Matcher = callExpr(hasArgument(0, expr().bind(Arg0)),
  297   TestMatch Match = matchCode(Code, declRefExpr(to(functionDecl())).bind(Ref));
  332   TestMatch Match = matchCode(Code, declRefExpr(to(functionDecl())).bind(Ref));
  399       matchCode(Code, callExpr(callee(functionDecl(hasName("bar")))).bind(ID));
  399       matchCode(Code, callExpr(callee(functionDecl(hasName("bar")))).bind(ID));
  560   TestMatch Match = matchCode(Code, functionDecl(hasName("bad")).bind(Fun));
  586       matchCode(Code, binaryOperator(hasLHS(expr().bind(ID))).bind(Op));
tools/clang/unittests/Tooling/RefactoringCallbacksTest.cpp
   62   expectRewritten(Code, Expected, expr(integerLiteral()).bind("id"), Callback);
   71       conditionalOperator(hasCondition(cxxBoolLiteral(equals(false))),
   71       conditionalOperator(hasCondition(cxxBoolLiteral(equals(false))),
   82                   ifStmt(hasCondition(implicitCastExpr(hasSourceExpression(
   82                   ifStmt(hasCondition(implicitCastExpr(hasSourceExpression(
   83                              declRefExpr(to(varDecl(hasName("a"))))))))
   83                              declRefExpr(to(varDecl(hasName("a"))))))))
   94       ifStmt(hasCondition(cxxBoolLiteral(equals(false)))).bind("id"), Callback);
   94       ifStmt(hasCondition(cxxBoolLiteral(equals(false)))).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
   35   return varDecl(hasName("test_snippet"),
   36                  hasDescendant(compoundStmt(hasAnySubstatement(Matcher))));
   82       Snippet, expr(ignoringImplicit(callExpr(hasArgument(
   82       Snippet, expr(ignoringImplicit(callExpr(hasArgument(
tools/clang/unittests/Tooling/StencilTest.cpp
   39   return varDecl(hasName("stencil_test_snippet"),
   40                  hasDescendant(compoundStmt(hasAnySubstatement(Matcher))));
   90         stmt(hasDescendant(
   91                  cxxConstructExpr(
   92                      hasDeclaration(decl(hasDescendant(cxxCtorInitializer(
   92                      hasDeclaration(decl(hasDescendant(cxxCtorInitializer(
  128       Snippet, ifStmt(hasCondition(expr().bind(Condition)),
  147       Snippet, ifStmt(hasCondition(expr().bind(Condition)),
  164   auto StmtMatch = matchStmt(Snippet, ifStmt(hasCondition(stmt().bind("a1")),
  314       matchStmt(Snippet, returnStmt(hasReturnValue(ignoringImplicit(memberExpr(
  314       matchStmt(Snippet, returnStmt(hasReturnValue(ignoringImplicit(memberExpr(
  335       matchStmt(Snippet, returnStmt(hasReturnValue(ignoringImplicit(memberExpr(
  335       matchStmt(Snippet, returnStmt(hasReturnValue(ignoringImplicit(memberExpr(
tools/clang/unittests/Tooling/TransformerTest.cpp
  143   auto StringType = namedDecl(hasAnyName("::basic_string", "::string"));
  143   auto StringType = namedDecl(hasAnyName("::basic_string", "::string"));
  145       callExpr(callee(functionDecl(hasName("strlen"))),
  145       callExpr(callee(functionDecl(hasName("strlen"))),
  146                hasArgument(0, cxxMemberCallExpr(
  147                                   on(expr(hasType(isOrPointsTo(StringType)))
  149                                   callee(cxxMethodDecl(hasName("c_str")))))),
  170       cxxMemberCallExpr(on(expr(hasType(cxxRecordDecl(
  170       cxxMemberCallExpr(on(expr(hasType(cxxRecordDecl(
  170       cxxMemberCallExpr(on(expr(hasType(cxxRecordDecl(
  173                         unless(callee(cxxMethodDecl(hasName("GetProto"))))),
  191   RewriteRule Rule = makeRule(callExpr(callee(functionDecl(hasName("f")))),
  191   RewriteRule Rule = makeRule(callExpr(callee(functionDecl(hasName("f")))),
  209   RewriteRule Rule = makeRule(callExpr(callee(functionDecl(hasName("f")))),
  209   RewriteRule Rule = makeRule(callExpr(callee(functionDecl(hasName("f")))),
  228   RewriteRule Rule = makeRule(functionDecl(hasName("bad")).bind(Fun),
  260   testRule(makeRule(declRefExpr(to(functionDecl(hasName("bad")))).bind(Ref),
  260   testRule(makeRule(declRefExpr(to(functionDecl(hasName("bad")))).bind(Ref),
  278   Transformer T(makeRule(declRefExpr(to(functionDecl())).bind(Ref),
  287   RewriteRule Rule = makeRule(memberExpr(member(hasName("bad"))).bind(E),
  452   testRule(makeRule(ifStmt(hasCondition(expr().bind(C)),
  463       cxxMemberCallExpr(on(expr(hasType(cxxRecordDecl(
  463       cxxMemberCallExpr(on(expr(hasType(cxxRecordDecl(
  463       cxxMemberCallExpr(on(expr(hasType(cxxRecordDecl(
  466                         unless(callee(cxxMethodDecl(hasName("GetProto"))))),
  500       makeRule(callExpr(callee(functionDecl(hasName("f1")))),
  500       makeRule(callExpr(callee(functionDecl(hasName("f1")))),
  503       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  503       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  503       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  525       makeRule(callExpr(callee(functionDecl(hasName("f1")))),
  525       makeRule(callExpr(callee(functionDecl(hasName("f1")))),
  528       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  528       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  528       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  553       makeRule(callExpr(callee(functionDecl(hasName("f1")))),
  553       makeRule(callExpr(callee(functionDecl(hasName("f1")))),
  556       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  556       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  556       makeRule(callExpr(callee(functionDecl(hasAnyName("f1", "f2")))),
  558   RewriteRule DeclRule = makeRule(functionDecl(hasName("f2")).bind("fun"),
  592   Transformer T(makeRule(binaryOperator(hasLHS(expr().bind(L))).bind(O),
  620   Transformer T(makeRule(functionDecl(hasName("errorOccurred")),
  644   RewriteRule R = makeRule(integerLiteral(equals(0)).bind(zero),
  741   testRule(makeRule(binaryOperator(hasLHS(expr().bind(E))),
  759   testRule(makeRule(binaryOperator(hasRHS(expr().bind(E))),
  774   RewriteRule R = makeRule(integerLiteral(equals(0)).bind(zero),