Home | History | Annotate | Download | only in ASTMatchers

Lines Matching refs:HasName

23     DeclarationMatcher HasEmptyName = recordDecl(hasName(""));
50 DeclarationMatcher NamedX = namedDecl(hasName("X"));
101 DeclarationMatcher ClassX = recordDecl(recordDecl(hasName("X")));
126 recordDecl(hasName("Z"), isDerivedFrom("X"));
245 recordDecl(isDerivedFrom(recordDecl(hasName("Some"))))));
252 recordDecl(hasName("B"), isDerivedFrom(recordDecl(hasName("A"))))));
268 varDecl(hasName("z_float"),
272 varDecl(hasName("z_float"),
276 varDecl(hasName("z_char"),
293 varDecl(hasName("z_float"),
297 varDecl(hasName("z_float"),
301 varDecl(hasName("z_char"),
313 recordDecl(isDerivedFrom(recordDecl(hasName("X")).bind("test")))));
319 recordDecl(isDerivedFrom(namedDecl(hasName("X"))))));
324 recordDecl(hasMethod(hasName("func")))));
336 recordDecl(hasName("B"), isDerivedFrom(recordDecl()))));
346 recordDecl(hasDeclContext(namespaceDecl(hasName("M"))))));
353 recordDecl(hasDeclContext(namespaceDecl(hasName("N"))))));
361 hasName("M"), hasDeclContext(namespaceDecl()))))));
365 DeclarationMatcher ClassX = classTemplateDecl(hasName("X"));
371 DeclarationMatcher ClassX = classTemplateDecl(hasName("X"));
379 classTemplateDecl(hasName("X"),
380 hasDescendant(fieldDecl(hasName("a"))))));
386 classTemplateDecl(hasName("X"),
387 hasDescendant(fieldDecl(hasName("a"))))));
396 callExpr(allOf(callee(functionDecl(hasName("f"))),
399 callExpr(allOf(callee(functionDecl(hasName("f"))),
402 recordDecl(hasName("T")))))))));
404 callExpr(allOf(callee(functionDecl(hasName("f"))),
407 recordDecl(hasName("T"))))),
410 callExpr(allOf(callee(functionDecl(hasName("f"))),
413 recordDecl(hasName("T"))))),
420 recordDecl(anyOf(hasName("Y"), allOf(isDerivedFrom("X"), hasName("Z"))));
429 recordDecl(anyOf(hasName("X"), hasName("Y"), hasName("Z"), hasName("U")));
434 recordDecl(anyOf(hasName("X"), hasName("Y"), hasName("Z"), hasName("U"),
435 hasName("V")));
445 DeclarationMatcher HasClassX = recordDecl(has(recordDecl(hasName("X"))));
450 recordDecl(hasName("Y"), has(recordDecl(hasName("X"))));
461 has(recordDecl(hasName("X"))),
462 has(recordDecl(hasName("Y"))),
463 hasName("Z"))),
465 has(recordDecl(hasName("A"))),
466 has(recordDecl(hasName("B"))),
467 hasName("C"))),
468 hasName("F"));
522 hasName("X"))),
524 hasName("Y"))),
525 hasName("Z")))),
528 hasName("C"),
530 hasName("A"))),
532 hasName("B")))))),
533 hasName("F")));
550 unless(hasName("X")));
561 hasName("X"),
562 has(recordDecl(hasName("Z"))),
564 has(recordDecl(hasName("Y")))));
573 hasDescendant(recordDecl(hasName("X"))),
574 hasName("Z"));
588 hasDescendant(recordDecl(has(recordDecl(hasName("Y"))),
589 hasName("X"))),
590 hasName("Z"));
611 hasDescendant(recordDecl(hasDescendant(recordDecl(hasName("Y"))),
612 hasName("X"))),
613 hasName("Z"));
726 varDecl(hasName("i"), has(isInteger()))));
728 varDecl(hasName("i"), has(isInteger()))));
738 varDecl(hasName("i"), hasType(qualType(has(builtinType()))))));
741 varDecl(hasName("i"), hasType(qualType(has(pointerType()))))));
745 EXPECT_TRUE(notMatches("class X {};", enumDecl(hasName("X"))));
749 EXPECT_TRUE(matches("enum X {};", enumDecl(hasName("X"))));
753 DeclarationMatcher Matcher = enumConstantDecl(hasName("A"));
761 expr(hasType(pointsTo(recordDecl(hasName("X")))),
762 has(declRefExpr(to(varDecl(hasName("i"))))));
772 expr(hasType(pointsTo(recordDecl(hasName("X")))),
773 hasDescendant(declRefExpr(to(varDecl(hasName("i"))))));
784 TypeMatcher TypeA = hasDeclaration(recordDecl(hasName("A")));
796 recordDecl(hasName("A"), has(recordDecl(hasName("B")))));
803 DeclarationMatcher ClassX = has(recordDecl(hasName("::X")).bind("x"));
812 recordDecl(hasName("A"), has(recordDecl(hasName("B")).bind("b"))));
819 callExpr(callee(methodDecl(hasName("x")))).bind("x");
846 DeclarationMatcher ClassX = recordDecl(hasName("X")).bind("x");
850 recordDecl(hasName("A"), hasDescendant(ClassX)),
851 recordDecl(hasName("B"), hasDescendant(ClassX)))),
858 qualType(hasDeclaration(enumDecl(hasName("X")))))))));
869 varDecl(hasName("a"),
878 hasDeclaration(namedDecl(hasName("A"))))))));
882 TypeMatcher ClassX = hasDeclaration(recordDecl(hasName("X")));
894 TypeMatcher ClassX = hasDeclaration(recordDecl(hasName("X")));
905 DeclarationMatcher ClassX = recordDecl(hasName("X"));
914 DeclarationMatcher ClassX = recordDecl(hasName("X"));
923 varDecl(hasName("x"), hasTypeLoc(loc(asString("int"))))));
933 StatementMatcher MethodX = callExpr(hasDeclaration(methodDecl(hasName("x"))));
939 memberCallExpr(on(hasType(recordDecl(hasName("Y")))));
958 memberCallExpr(on(hasType(pointsTo(recordDecl(hasName("Y"))))));
1086 memberCallExpr(thisPointerType(recordDecl(hasName("Y"))));
1118 memberCallExpr(thisPointerType(recordDecl(hasName("Y"))))))));
1143 varDecl(hasName("i"))));
1148 memberCallExpr(on(declRefExpr(to(varDecl(hasName("y"))))));
1185 sizeOfExpr(hasArgumentOfType(hasDeclaration(recordDecl(hasName("A")))))));
1187 hasArgumentOfType(hasDeclaration(recordDecl(hasName("string")))))));
1259 StatementMatcher CallMethodX = callExpr(callee(methodDecl(hasName("x"))));
1273 StatementMatcher CallFunctionF = callExpr(callee(functionDecl(hasName("f"))));
1301 functionTemplateDecl(hasName("f"))));
1307 functionTemplateDecl(hasName("f"))));
1314 functionTemplateDecl(hasName("f"),
1316 functionDecl(hasName("g"))))))));
1321 hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
1329 hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
1335 hasAnyArgument(declRefExpr(to(varDecl(hasName("y"))))));
1359 hasType(references(recordDecl(hasName("X")))));
1397 methodDecl(hasParameter(0, hasName("x")))));
1407 methodDecl(hasParameter(0, hasType(recordDecl(hasName("X")))))));
1409 methodDecl(hasParameter(0, hasType(recordDecl(hasName("X")))))));
1412 hasType(pointsTo(recordDecl(hasName("X"))))))));
1415 hasType(references(recordDecl(hasName("X"))))))));
1420 methodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
1422 methodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
1432 recordDecl(hasName("Y")))))));
1444 methodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
1450 recordDecl(hasName("X"))))))));
1453 TEST(HasName, MatchesParameterVariableDeclartions) {
1455 methodDecl(hasAnyParameter(hasName("x")))));
1457 methodDecl(hasAnyParameter(hasName("x")))));
1494 refersToDeclaration(fieldDecl(hasName("next")))))));
1530 methodDecl(isVirtual(), hasName("::X::f"))));
1545 methodDecl(isOverride(), hasName("::Y::f"))));
1548 methodDecl(isOverride(), hasName("::X::f"))));
1572 hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
1588 hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
1686 constructorDecl(ofClass(hasName("Foo")))));
1688 constructorDecl(ofClass(hasName("Bar")))));
1705 destructorDecl(ofClass(hasName("Foo")))));
1710 destructorDecl(ofClass(hasName("Foo")))));
1734 forField(hasType(recordDecl(hasName("Baz"))))))));
1736 forField(hasName("foo_"))))));
1738 forField(hasType(recordDecl(hasName("Bar"))))))));
1762 allOf(forField(hasName("foo_")), isWritten())))));
1764 allOf(forField(hasName("bar_")), isWritten())))));
1766 allOf(forField(hasName("bar_")), unless(isWritten()))))));
1782 hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
1795 hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
2113 recordDecl(hasName("a::b::C"))));
2115 recordDecl(hasName("::a::b::C"))));
2117 recordDecl(hasName("b::C"))));
2119 recordDecl(hasName("C"))));
2121 recordDecl(hasName("c::b::C"))));
2123 recordDecl(hasName("a::c::C"))));
2125 recordDecl(hasName("a::b::A"))));
2127 recordDecl(hasName("::C"))));
2129 recordDecl(hasName("::b::C"))));
2131 recordDecl(hasName("z::a::b::C"))));
2133 recordDecl(hasName("a+b::C"))));
2135 recordDecl(hasName("C"))));
2141 recordDecl(hasName("A::B::C"))));
2144 recordDecl(hasName("::A::B::C"))));
2147 recordDecl(hasName("B::C"))));
2150 recordDecl(hasName("C"))));
2153 recordDecl(hasName("c::B::C"))));
2156 recordDecl(hasName("A::c::C"))));
2159 recordDecl(hasName("A::B::A"))));
2162 recordDecl(hasName("::C"))));
2165 recordDecl(hasName("::B::C"))));
2167 recordDecl(hasName("z::A::B::C"))));
2170 recordDecl(hasName("A+B::C"))));
2175 recordDecl(hasName("A"), isDefinition());
2180 varDecl(hasName("a"), isDefinition());
2185 methodDecl(hasName("a"), isDefinition());
2192 ofClass(hasName("X")))));
2209 callExpr(callee(methodDecl(hasName("x"))))));
2220 recordDecl(hasName("C"),
2221 hasDescendant(callExpr(callee(methodDecl(hasName("x"))))))));
2257 DeclarationMatcher HasClassB = just(has(recordDecl(hasName("B")).bind("b")));
2281 polymorphicHas(recordDecl(hasName("B")).bind("b"));
2293 polymorphicHas(recordDecl(hasName("B")));
2409 memberExpr(member(hasName("first")))));
2416 memberExpr(member(hasName("first")))));
2424 memberExpr(member(hasName("first")))));
2438 "struct A { int i; };", fieldDecl(isPublic(), hasName("i"))));
2440 "struct A { int i; };", fieldDecl(isProtected(), hasName("i"))));
2442 "struct A { int i; };", fieldDecl(isPrivate(), hasName("i"))));
2445 "class A { int i; };", fieldDecl(isPublic(), hasName("i"))));
2447 "class A { int i; };", fieldDecl(isProtected(), hasName("i"))));
2449 "class A { int i; };", fieldDecl(isPrivate(), hasName("i"))));
2452 "class A { protected: int i; };", fieldDecl(isPublic(), hasName("i"))));
2454 fieldDecl(isProtected(), hasName("i"))));
2456 "class A { protected: int i; };", fieldDecl(isPrivate(), hasName("i"))));
2459 EXPECT_TRUE(notMatches("int i;", varDecl(isPublic(), hasName("i"))));
2460 EXPECT_TRUE(notMatches("int i;", varDecl(isProtected(), hasName("i"))));
2461 EXPECT_TRUE(notMatches("int i;", varDecl(isPrivate(), hasName("i"))));
2469 methodDecl(ofClass(hasName("X"))), true, "-std=gnu++98"));
2472 methodDecl(ofClass(hasName("X")))));
2478 methodDecl(ofClass(hasName("X"))), true, "-std=gnu++98"));
2484 memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
2490 memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
2494 hasType(pointsTo(recordDecl(hasName("X"))))))));
2502 hasType(pointsTo(recordDecl(hasName("S"))))))));
2506 hasType(pointsTo(recordDecl(hasName("S"))))))));
2510 EXPECT_TRUE(notMatches("class X { void m(); };", fieldDecl(hasName("m"))));
2511 EXPECT_TRUE(notMatches("class X { class m {}; };", fieldDecl(hasName("m"))));
2512 EXPECT_TRUE(notMatches("class X { enum { m }; };", fieldDecl(hasName("m"))));
2513 EXPECT_TRUE(notMatches("class X { enum m {}; };", fieldDecl(hasName("m"))));
2517 EXPECT_TRUE(matches("class X { int m; };", fieldDecl(hasName("m"))));
2700 declRefExpr(to(varDecl(hasName("x")))))))));
2739 declRefExpr(to(varDecl(hasName("x")))))))));
2798 declRefExpr(to(varDecl(hasName("x")))))))));
2810 declRefExpr(to(varDecl(hasName("x")))))))));
2870 initListExpr(hasType(recordDecl(hasName("B"))))));
2880 usingDecl(hasAnyUsingShadowDecl(hasName("a")))));
3020 recordDecl(hasName("C"), forEach(fieldDecl(hasName("x")).bind("x"))),
3026 recordDecl(hasName("C"), forEach(fieldDecl().bind("f"))),
3033 recordDecl(hasName("C"),
3040 recordDecl(hasName("C"),
3041 forEachDescendant(fieldDecl(hasName("x")).bind("x"))),
3047 isDefinition(), decl().bind("x"), hasName("C"));
3050 recordDecl(hasName("A"), anyOf(m, forEachDescendant(m))),
3058 recordDecl(hasName("A"), allOf(hasDescendant(m), anyOf(m, anything()))),
3066 recordDecl(hasName("C"), forEachDescendant(fieldDecl().bind("f"))),
3074 recordDecl(hasName("C"), forEachDescendant(recordDecl(
3108 // recordDecl(decl().bind("x"), hasName("X")))
3117 recordDecl().bind("x"), hasName("::X"),
3118 anyOf(forEachDescendant(recordDecl(hasName("Y"))), anything())),
3121 "class X {};", recordDecl(recordDecl().bind("x"), hasName("::X"),
3132 recordDecl(decl().bind("x"), hasMethod(hasName("g"))),
3138 hasAnyConstructorInitializer(forField(hasName("b")))))),
3146 functionDecl(decl().bind("x"), hasAnyParameter(hasName("y"))),
3170 functionDecl(decl().bind("x"), hasAncestor(recordDecl(hasName("::A")))),
3177 ifStmt(stmt().bind("x"), hasAncestor(recordDecl(hasName("::A")))),
3181 recordDecl(hasName("::A"), decl().bind("x"), unless(hasName("fooble"))),
3185 constructorDecl(hasName("::A::A"), decl().bind("x"),
3186 forEachConstructorInitializer(forField(hasName("i")))),
3193 recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))),
3197 recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))),
3204 recordDecl(hasName("::A"), findAll(recordDecl(hasName("::A")).bind("v"))),
3211 recordDecl(hasName("::A"), findAll(fieldDecl().bind("v"))),
3218 recordDecl(hasName("::A"),
3219 findAll(decl(anyOf(recordDecl(hasName("::A")).bind("v"),
3225 recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("v"))),
3232 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3233 has(fieldDecl(hasName("b")).bind("v")))),
3240 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3241 has(fieldDecl(hasName("b")).bind("v")))),
3245 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3246 has(fieldDecl(hasName("b")).bind("v")))),
3250 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3251 has(fieldDecl(hasName("b")).bind("v"))))));
3260 recordDecl(hasName("::X"), isTemplateInstantiation())));
3265 fieldDecl(hasType(recordDecl(hasName("A"))))))));
3271 functionDecl(hasParameter(0, hasType(recordDecl(hasName("A")))),
3280 fieldDecl(hasType(recordDecl(hasName("A"))))))));
3288 recordDecl(hasName("::X"), isTemplateInstantiation())));
3299 recordDecl(hasName("::X::Y"), isTemplateInstantiation())));
3312 recordDecl(hasName("::X<A>::Y"), unless(isTemplateInstantiation()))));
3319 recordDecl(hasName("::X"), isTemplateInstantiation())));
3375 recordDecl(hasName("C"), hasAncestor(recordDecl(hasName("A"))))));
3381 recordDecl(hasName("C"), hasAncestor(recordDecl(hasName("X"))))));
3387 varDecl(hasName("c"), hasType(recordDecl(hasName("C"),
3388 hasAncestor(recordDecl(hasName("A"))))))));
3400 integerLiteral(equals(42), hasAncestor(functionDecl(hasName("f"))))));
3430 varDecl(hasName("x"),
3441 hasAncestor(recordDecl(hasName("A"))))));
3449 hasAncestor(recordDecl(hasName("A")))))))));
3587 varDecl(hasName("b")))))))));
3653 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3655 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
3657 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3659 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3661 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3663 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3667 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3669 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3671 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
3673 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3677 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3679 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3681 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3683 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
3685 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
3687 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3691 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3693 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3695 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3697 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
3699 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3701 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
3711 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("a"),
3713 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("b"),
3715 EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
3717 EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
3719 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("c"),
3721 EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
3723 EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
3725 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("d"),
3727 EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
3729 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("e"),
3731 EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
3765 EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"),
3777 recordType(hasDeclaration(recordDecl(hasName("S"))))));
3779 recordType(hasDeclaration(recordDecl(hasName("S"))))));
3802 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))))));
3808 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))))));
3824 hasDeclaration(namedDecl(hasName("D")))))))));
3856 specifiesType(hasDeclaration(recordDecl(hasName("A")))));
3865 specifiesNamespace(hasName("ns")));
3903 specifiesNamespace(hasName("a")))))));
3908 specifiesNamespace(hasName("a")))))));
3913 specifiesNamespace(hasName("a")))))));
3934 functionDecl(hasName("f"),
3948 specifiesNamespace(hasName("a"))))))));
3953 specifiesNamespace(hasName("a"))))))));
3958 specifiesNamespace(hasName("a"))))))));
3977 functionDecl(hasName("f"),
4005 "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
4007 "X", decl(hasDescendant(recordDecl(hasName("X::Y")).bind("Y"))),
4010 "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
4012 "X", decl(hasDescendant(recordDecl(hasName("X::Z")).bind("Z"))),
4029 "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
4031 "X", recordDecl(has(recordDecl(hasName("X::Y")).bind("Y"))), "Y")));
4033 "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
4035 "X", recordDecl(has(recordDecl(hasName("X::Z")).bind("Z"))), "Z")));
4062 "class X { class Y {}; };", recordDecl(hasName("::X::Y")).bind(""),
4124 "int i = 1;", varDecl(namedDecl(hasName("i")).bind("name"),
4143 decl(allOf(recordDecl(hasName("::X::Y")).bind("record"),
4147 decl(allOf(recordDecl(hasName("::X")).bind("record"),
4155 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
4156 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))));
4161 has(fieldDecl(hasName("a"), hasType(type().bind("t")))),
4162 has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t"))))))));
4195 hasName("f"), forEachDescendant(varDecl().bind("d")),