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

Declarations

tools/clang/include/clang/ASTMatchers/ASTMatchers.h
 1152 extern const internal::VariadicDynCastAllOfMatcher<Decl, VarDecl> varDecl;

References

tools/clang/lib/ASTMatchers/Dynamic/Registry.cpp
  521   REGISTER_MATCHER(varDecl);
tools/clang/lib/Analysis/ExprMutationAnalyzer.cpp
  343                 hasLoopVariable(varDecl(hasType(nonConstReferenceType()))
  368           varDecl(
tools/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp
   63                                  to(varDecl(equalsBoundNode(DeclName))))));
   68                          declRefExpr(to(varDecl().bind(DeclName)))));
  101           varDecl(hasDescendant(SemaphoreCreateM)).bind(SemaphoreBinding)),
  143           varDecl(hasDescendant(DispatchGroupCreateM)).bind(GroupBinding)),
tools/clang/lib/StaticAnalyzer/Checkers/NumberObjectConversionChecker.cpp
  324           varDecl(hasType(SuspiciousScalarTypeM),
tools/clang/lib/StaticAnalyzer/Checkers/PointerIterationChecker.cpp
   68   auto UnorderedContainerM = declRefExpr(to(varDecl(hasType(
   72   auto PointerTypeM = varDecl(hasType(hasCanonicalType(pointerType())));
tools/clang/lib/StaticAnalyzer/Core/LoopUnrolling.cpp
   87                             to(varDecl(hasType(isInteger())).bind(BindName))))),
   98                         declRefExpr(to(varDecl(VarNodeMatcher)))))),
  101                          declRefExpr(to(varDecl(VarNodeMatcher)))))));
  107       declRefExpr(to(varDecl(VarNodeMatcher))),
  113   return declStmt(hasDescendant(varDecl(
  116                 initListExpr(has(declRefExpr(to(varDecl(VarNodeMatcher))))),
  117                 declRefExpr(to(varDecl(VarNodeMatcher)))))))));
  145                            varDecl(allOf(hasInitializer(ignoringParenImpCasts(
  148                        binaryOperator(hasLHS(declRefExpr(to(varDecl(
  157                      to(varDecl(allOf(equalsBoundNode("initVarName"),
tools/clang/lib/StaticAnalyzer/Core/LoopWidening.cpp
   70   auto Matches = match(findAll(stmt(hasDescendant(varDecl(hasType(referenceType())).bind(MatchRef)))),
tools/clang/lib/StaticAnalyzer/Core/RegionStore.cpp
 1093               to(varDecl(hasStaticStorageDuration()).bind(DeclBind)))));
tools/clang/tools/extra/clang-change-namespace/ChangeNamespace.cpp
  514   auto GlobalVarMatcher = varDecl(
tools/clang/tools/extra/clang-include-fixer/find-all-symbols/FindAllSymbols.cpp
  155   auto Vars = varDecl(CommonFilter, anyOf(ExternCMatcher, CCMatcher),
tools/clang/tools/extra/clang-move/Move.cpp
  585                                     varDecl(isDefinition(), IsOldCCHelper)));
  628       varDecl(InMovedClass, InOldFiles, isDefinition(), isStaticDataMember())
  639       varDecl(InOldFiles, *HasAnySymbolNames, TopLevelDecl).bind("var"),
tools/clang/tools/extra/clang-tidy/abseil/TimeSubtractionCheck.cpp
   41                                         hasParent(varDecl()))))))))
   43                        callExpr(hasParent(varDecl())).bind("e"))),
tools/clang/tools/extra/clang-tidy/bugprone/DanglingHandleCheck.cpp
  111       varDecl(hasType(hasUnqualifiedDesugaredType(
  120       varDecl(
  151                          declRefExpr(to(varDecl(
tools/clang/tools/extra/clang-tidy/bugprone/DynamicStaticInitializersCheck.cpp
   50       varDecl(hasGlobalStorage(), unless(hasConstantDeclaration())).bind("var"),
tools/clang/tools/extra/clang-tidy/bugprone/MisplacedOperatorInStrlenInAllocCheck.cpp
   52       varDecl(hasType(isConstQualified()),
   56       varDecl(hasType(isConstQualified()),
tools/clang/tools/extra/clang-tidy/bugprone/MisplacedWideningCastCheck.cpp
   46   Finder->addMatcher(varDecl(hasInitializer(Cast)), this);
tools/clang/tools/extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
  524       declRefExpr(to(varDecl(hasInitializer(ignoringImpCasts(InnerMatcher))))));
  531       allOf(to(varDecl().bind(VarDeclName)),
  533                 hasLHS(declRefExpr(to(varDecl(equalsBoundNode(VarDeclName))))),
  598       ignoringImpCasts(declRefExpr(to(varDecl(hasInitializer(WrongLength)))));
  608       declRefExpr(to(varDecl(hasInitializer(CallExprReturnWithoutInc)))));
  639       to(anyOf(varDecl(CharTyArray).bind(DestVarDeclName),
  640                varDecl(hasInitializer(AnyOfDestInit)).bind(DestVarDeclName))));
  644       declRefExpr(allOf(to(varDecl(AnyOfCharTy).bind(DestVarDeclName)),
  656                        to(varDecl(equalsBoundNode(DestVarDeclName))))),
tools/clang/tools/extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
  125       varDecl(isDefinition(), hasType(qualType(hasCanonicalType(CharPtrType))),
tools/clang/tools/extra/clang-tidy/bugprone/StringConstructorCheck.cpp
   52   const auto ConstStrLiteralDecl = varDecl(
   55   const auto ConstPtrStrLiteralDecl = varDecl(
tools/clang/tools/extra/clang-tidy/bugprone/ThrowKeywordMissingCheck.cpp
   33                         hasAncestor(varDecl()),
tools/clang/tools/extra/clang-tidy/bugprone/TooSmallLoopVariableCheck.cpp
   57           ignoringParenImpCasts(declRefExpr(to(varDecl(hasType(isInteger()))))))
tools/clang/tools/extra/clang-tidy/bugprone/UnhandledSelfAssignmentCheck.cpp
   64                 varDecl(hasType(cxxRecordDecl(equalsBoundNode("class"))),
tools/clang/tools/extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp
   27       varDecl(anyOf(hasThreadStorageDuration(), hasStaticStorageDuration()),
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(),
   28       varDecl(GlobalVarDecl, unless(isDefinition())).bind("referencee")));
   31       varDecl(GlobalVarDecl, isDefinition(),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp
  105       namedDecl(varDecl(hasInitializer(unless(ConsideredOwner)), IsOwnerType)
  134       namedDecl(varDecl(eachOf(allOf(hasInitializer(CreatesOwner),
tools/clang/tools/extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
  290       varDecl(isDefinition(), HasDefaultConstructor,
tools/clang/tools/extra/clang-tidy/darwin/DispatchOnceNonstaticCheck.cpp
   27       varDecl(hasLocalStorage(), hasType(asString("dispatch_once_t")))
tools/clang/tools/extra/clang-tidy/fuchsia/StaticallyConstructedObjectsCheck.cpp
   36   Finder->addMatcher(varDecl(
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/hicpp/NoAssemblerCheck.cpp
   29   Finder->addMatcher(varDecl(isAsm()).bind("asm-var"), this);
tools/clang/tools/extra/clang-tidy/llvm/PreferIsaOrDynCastInConditionalsCheck.cpp
   39           varDecl(hasInitializer(
tools/clang/tools/extra/clang-tidy/llvm/PreferRegisterOverUnsignedCheck.cpp
   26           varDecl(hasInitializer(exprWithCleanups(has(implicitCastExpr(has(
tools/clang/tools/extra/clang-tidy/llvm/TwineLocalCheck.cpp
   23   Finder->addMatcher(varDecl(hasType(TwineType)).bind("variable"), this);
tools/clang/tools/extra/clang-tidy/misc/DefinitionsInHeadersCheck.cpp
   56             varDecl(isDefinition()));
tools/clang/tools/extra/clang-tidy/misc/NonCopyableObjects.cpp
   45       namedDecl(anyOf(varDecl(BadFILEType), fieldDecl(BadFILEType)))
tools/clang/tools/extra/clang-tidy/modernize/AvoidCArraysCheck.cpp
   53                            hasParent(varDecl(isExternC())),
tools/clang/tools/extra/clang-tidy/modernize/LoopConvertCheck.cpp
   51       declRefExpr(to(varDecl(hasType(isInteger())).bind(ConditionVarName)))));
   55   return varDecl(
   61   return declRefExpr(to(varDecl(hasType(isInteger())).bind(IncrementVarName)));
  135       varDecl(hasInitializer(anyOf(ignoringParenImpCasts(BeginCallMatcher),
  142       varDecl(hasInitializer(anything())).bind(EndVarName);
  150                      declRefExpr(to(varDecl().bind(ConditionEndVarName)))),
  156       ignoringParenImpCasts(declRefExpr(to(varDecl().bind(ConditionVarName)))));
  197                                    to(varDecl(hasType(pointsTo(AnyType())))
  202                          0, declRefExpr(to(varDecl(TestDerefReturnsByValue)
  274       varDecl(hasInitializer(EndInitMatcher)).bind(EndVarName);
  278                      varDecl(hasType(isInteger())).bind(ConditionEndVarName)))),
tools/clang/tools/extra/clang-tidy/modernize/RedundantVoidArgCheck.cpp
   61   Finder->addMatcher(varDecl(FunctionOrMemberPointer).bind(VarId), this);
tools/clang/tools/extra/clang-tidy/modernize/UseAutoCheck.cpp
  250                       varDecl(anyOf(unless(hasWrittenNonListInitializer()),
  259              unless(has(varDecl(anyOf(
  277              unless(has(varDecl(unless(hasInitializer(explicitCastExpr()))))))
  297   return declStmt(unless(has(varDecl(
  307       has(varDecl(unless(isImplicit()))),
  309       unless(has(varDecl(anyOf(hasType(autoType()),
tools/clang/tools/extra/clang-tidy/modernize/UseEqualsDefaultCheck.cpp
   53       memberExpr(hasObjectExpression(declRefExpr(to(varDecl(equalsNode(Var))))),
   84                         0, declRefExpr(to(varDecl(equalsNode(Param)))))))))),
  160                 hasArgument(0, declRefExpr(to(varDecl(equalsNode(Param))))))))),
tools/clang/tools/extra/clang-tidy/performance/ForRangeCopyCheck.cpp
   39   auto LoopVar = varDecl(
tools/clang/tools/extra/clang-tidy/performance/ImplicitConversionInLoopCheck.cpp
   51           varDecl(
tools/clang/tools/extra/clang-tidy/performance/InefficientVectorOperationCheck.cpp
   95       varDecl(hasInitializer(DefaultConstructorCall)).bind(VarDeclName);
  107       declStmt(hasSingleDecl(varDecl(hasInitializer(integerLiteral(equals(0))))
  110       declRefExpr(to(varDecl(equalsBoundNode(LoopInitVarName)))));
tools/clang/tools/extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp
   50                         on(declRefExpr(to(varDecl().bind("objectArg")))));
   59                        has(varDecl(hasLocalStorage(),
   83                          to(varDecl(hasLocalStorage()).bind("oldVarDecl")))),
tools/clang/tools/extra/clang-tidy/readability/NonConstParameterCheck.cpp
   37   Finder->addMatcher(varDecl(hasInitializer(anything())).bind("Mark"), this);
tools/clang/tools/extra/clang-tidy/readability/RedundantDeclarationCheck.cpp
   31       namedDecl(anyOf(varDecl(unless(isDefinition())),
tools/clang/tools/extra/clang-tidy/readability/RedundantStringInitCheck.cpp
   49           varDecl(hasType(hasUnqualifiedDesugaredType(recordType(
tools/clang/tools/extra/clang-tidy/readability/StaticAccessedThroughInstanceCheck.cpp
   42                                       varDecl(hasStaticStorageDuration()))),
tools/clang/tools/extra/clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
   24                       varDecl(isDefinition(), isStaticStorageClass())),
tools/clang/tools/extra/clang-tidy/utils/DeclRefExprUtils.cpp
   48       declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef");
   79       declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef");
  122       findAll(declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef")),
  133           declRefExpr(to(varDecl(equalsNode(&VarDecl)))).bind("declRef"))),
tools/clang/tools/extra/unittests/clang-tidy/ClangTidyDiagnosticConsumerTest.cpp
   14     Finder->addMatcher(ast_matchers::varDecl().bind("var"), this);
tools/clang/tools/extra/unittests/clang-tidy/OverlappingReplacementsTest.cpp
   31     Finder->addMatcher(varDecl(hasType(isInteger())).bind(BoundDecl), this);
   72     Finder->addMatcher(varDecl(matchesName(NamePattern)).bind(BoundDecl), this);
tools/clang/unittests/AST/ASTContextParentMapTest.cpp
  112       varDecl(hasName("y"), hasAncestor(functionDecl(
tools/clang/unittests/AST/ASTImporterGenericRedeclTest.cpp
   42   BindableMatcher<Decl> getPattern() { return varDecl(hasName("X")); }
tools/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp
   92   BindableMatcher<Decl> getPattern() { return varDecl(hasName("X")); }
tools/clang/unittests/AST/ASTImporterTest.cpp
  572                   declRefExpr(hasDeclaration(varDecl(hasName("ptr"))),
  607                       varDecl(hasInitializer(parenListExpr(has(unaryOperator(
  627         varDecl(
  633                         varDecl(
  831           unless(hasAncestor(translationUnitDecl(has(varDecl(
  889       varDecl(hasType(classTemplateSpecializationDecl(has(fieldDecl(hasType(
  924           hasDescendant(varDecl(
  926           hasDescendant(varDecl(
  952                  has(declStmt(hasSingleDecl(varDecl(hasName("d")))))))));
  963       FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("d")));
 1840       FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("object0")));
 1843       FirstDeclMatcher<VarDecl>().match(FromTU, varDecl(hasName("object1")));
 1915   auto Pattern = varDecl(hasName("x"));
 1941   auto Pattern = varDecl(hasName("x"));
 1959   auto Pattern = varDecl(hasName("a"));
 1990   auto Pattern = varDecl(hasName("x"));
 2292     auto Pattern = varDecl(hasName("v"));
 3453       cxxConstructorDecl(hasParameter(0, varDecl(hasType(asString("int")))),
 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")));
 4013   auto *A0 = FirstDeclMatcher<VarDecl>().match(TU, varDecl(hasName("A")));
 4014   auto *A1 = LastDeclMatcher<VarDecl>().match(TU, varDecl(hasName("A")));
 4276   auto *D = FirstDeclMatcher<VarDecl>().match(ToTU, varDecl(hasName("a")));
 4373                               .match(ToTU, varDecl(hasName("V")))
 4395                         ToTU, varDecl(hasName("V"),
 4779   auto *A = FirstDeclMatcher<VarDecl>().match(ToTU, varDecl(hasName("A")));
tools/clang/unittests/AST/ASTImporterVisibilityTest.cpp
   32   BindableMatcher<Decl> operator()() { return varDecl(hasName("v")); }
tools/clang/unittests/AST/SourceLocationTest.cpp
   33   EXPECT_FALSE(Verifier.match("int i", varDecl()));
   45   EXPECT_FALSE(Verifier.match("int i;", varDecl()));
   51   EXPECT_FALSE(Verifier.match("int i;", varDecl()));
   57   EXPECT_FALSE(Verifier.match("int i;", varDecl()));
   82   EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C));
   88   EXPECT_TRUE(Verifier.match("void f(i) {}", varDecl(), Lang_C));
  147                              varDecl(), Lang_C89));
tools/clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp
   29                      hasArgument(0, declRefExpr(to(varDecl())))))));
   32                      hasArgument(0, declRefExpr(to(varDecl()))),
   37                      hasArgument(0, declRefExpr(to(varDecl()))),
   43                      hasArgument(0, declRefExpr(to(varDecl()))),
  322             cxxCatchStmt(anyOf(hasDescendant(varDecl()), isCatchAll()))));
  515     varDecl(hasName("z_float"),
  519     varDecl(hasName("z_float"),
  523     varDecl(hasName("z_char"),
  540     varDecl(hasName("z_float"),
  544     varDecl(hasName("z_float"),
  548     varDecl(hasName("z_char"),
  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"))));
  863   EXPECT_TRUE(matches("int i = 0;", varDecl(hasType(isInteger()))));
  867       to(varDecl(hasType(isInteger()))))))));
  871   EXPECT_TRUE(notMatches("int *i;", varDecl(hasType(isInteger()))));
  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()))));
  984   DeclarationMatcher ReferenceClassX = varDecl(
 1002                          varDecl(hasType(hasLocalQualifiers()))));
 1004                       varDecl(hasType(hasLocalQualifiers()))));
 1006                       varDecl(hasType(hasLocalQualifiers()))));
 1008                          varDecl(hasType(hasLocalQualifiers()))));
 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())));
 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())));
 1065                       varDecl(hasName("foo"), isConstexpr())));
 1212     hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
 1228     hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
 1484   EXPECT_TRUE(matches(code, varDecl(hasName("i"))));
 1485   EXPECT_FALSE(matches(code, varDecl(hasName("F()::i"))));
 1517     varDecl(hasName("a"), isDefinition());
 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"))));
 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()))));
 1874                             unless(hasDescendant(varDecl(hasName("t")))))));
 1952                          varDecl(isInstantiated())));
 2270     "int i = 1;", varDecl(hasType(qualType().bind("type")),
 2274                          varDecl(hasType(qualType().bind("type")),
 2281     "int i = 1;", varDecl(namedDecl(hasName("i")).bind("name"),
 2337                  forEachDescendant(varDecl(hasType(
 2351       hasName("f"), forEachDescendant(varDecl().bind("d")),
 2365         varDecl(hasType(recordDecl(hasName("StringRef")))).bind("var")))),
 2368         on(declRefExpr(to(varDecl(equalsBoundNode("var")))))))))))
 2381         varDecl(hasType(recordDecl(hasName("StringRef")))).bind("var")))),
 2384         on(declRefExpr(to(varDecl(equalsBoundNode("var")))))))))))
tools/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
  103     Code, varDecl(hasName("MyVar1"), hasDeclContext(translationUnitDecl()))));
  105     Code, varDecl(hasName("MyVar2"), hasDeclContext(translationUnitDecl()))));
  108     varDecl(hasName("MyVar2"),
  401       varDecl(hasInitializer(
  426     cxxMemberCallExpr(on(declRefExpr(to(varDecl(hasName("y"))))));
  826             varDecl(hasInitializer(parenListExpr(has(unaryOperator()))))));
  831                       varDecl(hasInitializer(stmtExpr()))));
 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()))));
 1175                       varDecl(isExceptionVariable())));
 1177                          varDecl(isExceptionVariable())));
 1235       varDecl(hasName("b")))))))));
 1257   EXPECT_TRUE(matches("auto i = 2;", varDecl(hasType(isInteger()))));
 1259                       varDecl(hasType(recordDecl(hasName("X"))))));
 1298     matches("int (*array)[4];", varDecl(hasType(pointsTo(parenType())))));
 1299   EXPECT_TRUE(notMatches("int *array[4];", varDecl(hasType(parenType()))));
 1303     varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
 1306     varDecl(hasType(pointsTo(parenType(innerType(functionType())))))));
 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"),
 1435   EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"),
tools/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
   82       varDecl(hasDescendant(isInteger())).bind("x"))),
  104                       varDecl(hasName("i"), has(isInteger()))));
  106                          varDecl(hasName("i"), has(isInteger()))));
  116     varDecl(hasName("i"), hasType(qualType(has(builtinType()))))));
  119     varDecl(hasName("i"), hasType(qualType(has(pointerType()))))));
  125            has(ignoringParenImpCasts(declRefExpr(to(varDecl(hasName("i")))))));
  136          hasDescendant(declRefExpr(to(varDecl(hasName("i"))))));
  166                        varDecl(hasType(namedDecl(hasName("S"))))));
  245                       varDecl(hasName("a"),
  253                       varDecl(hasType(templateSpecializationType(
  260                       varDecl(hasType(templateSpecializationType(
  272                       varDecl(hasType(templateSpecializationType(
  279               varDecl(hasType(hasUnqualifiedDesugaredType(recordType())))));
  282               varDecl(hasType(hasUnqualifiedDesugaredType(recordType())))));
  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)))));
  335     matches("class X {}; void y() { X x; }", varDecl(hasType(ClassX))));
  337     notMatches("class X {}; void y() { X *x; }", varDecl(hasType(ClassX))));
  362                       varDecl(hasName("x"), hasTypeLoc(loc(asString("int"))))));
  392     hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
  400     hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
  406       ignoringParenImpCasts(declRefExpr(to(varDecl(hasName("y"))))));
  449       objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))));
  454       objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))));
  620     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  633     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  662     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  686     declRefExpr(to(varDecl(hasName("y")))).bind("arg");
  712       forEachDescendant(varDecl().bind("v")),
  722                          varDecl(hasType(qualType(referenceType())))));
  727             varDecl(hasType(qualType(hasCanonicalType(referenceType()))))));
  732                       cxxMethodDecl(hasParameter(0, varDecl()))));
  743                          cxxMethodDecl(hasParameter(42, varDecl()))));
 1368     cxxForRangeStmt(hasRangeInit(declRefExpr(to(varDecl(hasName("a"))))))));
 1493       varDecl(hasInitializer(anyOf(
 1519                       varDecl(hasInitializer(
 1534       varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())));
 1551                       varDecl(has(ignoringImplicit(cxxConstructExpr())))));
 1582   EXPECT_TRUE(matches(Code, varDecl(
 1595       notMatches("class C {}; C a = C();", varDecl(has(cxxConstructExpr()))));
 1603                       varDecl(hasInitializer(ignoringImpCasts(
 1604                         declRefExpr(to(varDecl(hasName("x")))))))));
 1607                       varDecl(hasInitializer(ignoringImpCasts(
 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")))))))));
 1650                       varDecl(hasInitializer(ignoringParenCasts(
 1653                       varDecl(hasInitializer(ignoringParenCasts(
 1659                       varDecl(hasInitializer(ignoringParenCasts(
 1663                       varDecl(hasInitializer(ignoringParenCasts(
 1666                       varDecl(hasInitializer(ignoringParenCasts(
 1673                       varDecl(hasInitializer(ignoringParenCasts(
 1681                          varDecl(hasInitializer(ignoringParenCasts(
 1687                          varDecl(hasInitializer(ignoringParenCasts(
 1691                          varDecl(hasInitializer(ignoringParenCasts(
 1701                       varDecl(hasInitializer(ignoringParenImpCasts(
 1702                         declRefExpr(to(varDecl(hasName("x")))))))));
 1705                       varDecl(hasInitializer(ignoringParenImpCasts(
 1713                       varDecl(hasInitializer(ignoringParenImpCasts(
 1714                         declRefExpr(to(varDecl(hasName("x")))))))));
 1716                       varDecl(hasInitializer(ignoringParenImpCasts(
 1725                          varDecl(hasInitializer(ignoringParenImpCasts(
 1730                          varDecl(hasInitializer(ignoringParenImpCasts(
 1733                          varDecl(hasInitializer(ignoringParenImpCasts(
 1736                          varDecl(hasInitializer(ignoringParenImpCasts(
 1774     declStmt(hasSingleDecl(varDecl(hasInitializer(anything()))));
 1782   DeclarationMatcher MatchesInit = varDecl(hasInitializer(anything()));
 2120     varDecl(hasName("c"), hasType(recordDecl(hasName("C"),
 2163     varDecl(hasName("x"),
 2165               0, varDecl(hasType(asString("int"))))).bind("f"))).bind("v"),
tools/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp
  154       matches("int x;", VariantValue(VariantMatcher::SingleMatcher(varDecl()))
  163   EXPECT_FALSE(VariantValue(VariantMatcher::SingleMatcher(varDecl()))
  170   EXPECT_DEATH(VariantValue(VariantMatcher::SingleMatcher(varDecl()))
tools/clang/unittests/Tooling/RangeSelectorTest.cpp
   71       matchCode("static int x = 0;", varDecl().bind("bound_node_id"));
tools/clang/unittests/Tooling/RefactoringCallbacksTest.cpp
   83                              declRefExpr(to(varDecl(hasName("a"))))))))
  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"),
tools/clang/unittests/Tooling/StencilTest.cpp
   39   return varDecl(hasName("stencil_test_snippet"),