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")))));
318 recordDecl(hasMethod(hasName("func")))));
330 recordDecl(hasName("B"), isDerivedFrom(recordDecl()))));
340 recordDecl(hasDeclContext(namedDecl(hasName("M"))))));
347 recordDecl(hasDeclContext(namedDecl(hasName("N"))))));
351 DeclarationMatcher ClassX = classTemplateDecl(hasName("X"));
357 DeclarationMatcher ClassX = classTemplateDecl(hasName("X"));
365 classTemplateDecl(hasName("X"),
366 hasDescendant(fieldDecl(hasName("a"))))));
372 classTemplateDecl(hasName("X"),
373 hasDescendant(fieldDecl(hasName("a"))))));
382 callExpr(allOf(callee(functionDecl(hasName("f"))),
385 callExpr(allOf(callee(functionDecl(hasName("f"))),
388 recordDecl(hasName("T")))))))));
390 callExpr(allOf(callee(functionDecl(hasName("f"))),
393 recordDecl(hasName("T"))))),
396 callExpr(allOf(callee(functionDecl(hasName("f"))),
399 recordDecl(hasName("T"))))),
406 recordDecl(anyOf(hasName("Y"), allOf(isDerivedFrom("X"), hasName("Z"))));
415 recordDecl(anyOf(hasName("X"), hasName("Y"), hasName("Z"), hasName("U")));
420 recordDecl(anyOf(hasName("X"), hasName("Y"), hasName("Z"), hasName("U"),
421 hasName("V")));
431 DeclarationMatcher HasClassX = recordDecl(has(recordDecl(hasName("X"))));
436 recordDecl(hasName("Y"), has(recordDecl(hasName("X"))));
447 has(recordDecl(hasName("X"))),
448 has(recordDecl(hasName("Y"))),
449 hasName("Z"))),
451 has(recordDecl(hasName("A"))),
452 has(recordDecl(hasName("B"))),
453 hasName("C"))),
454 hasName("F"));
508 hasName("X"))),
510 hasName("Y"))),
511 hasName("Z")))),
514 hasName("C"),
516 hasName("A"))),
518 hasName("B")))))),
519 hasName("F")));
536 unless(hasName("X")));
547 hasName("X"),
548 has(recordDecl(hasName("Z"))),
550 has(recordDecl(hasName("Y")))));
559 hasDescendant(recordDecl(hasName("X"))),
560 hasName("Z"));
574 hasDescendant(recordDecl(has(recordDecl(hasName("Y"))),
575 hasName("X"))),
576 hasName("Z"));
597 hasDescendant(recordDecl(hasDescendant(recordDecl(hasName("Y"))),
598 hasName("X"))),
599 hasName("Z"));
712 varDecl(hasName("i"), has(isInteger()))));
714 varDecl(hasName("i"), has(isInteger()))));
724 varDecl(hasName("i"), hasType(qualType(has(builtinType()))))));
727 varDecl(hasName("i"), hasType(qualType(has(pointerType()))))));
731 EXPECT_TRUE(notMatches("class X {};", enumDecl(hasName("X"))));
735 EXPECT_TRUE(matches("enum X {};", enumDecl(hasName("X"))));
739 DeclarationMatcher Matcher = enumConstantDecl(hasName("A"));
747 expr(hasType(pointsTo(recordDecl(hasName("X")))),
748 has(declRefExpr(to(varDecl(hasName("i"))))));
758 expr(hasType(pointsTo(recordDecl(hasName("X")))),
759 hasDescendant(declRefExpr(to(varDecl(hasName("i"))))));
770 TypeMatcher TypeA = hasDeclaration(recordDecl(hasName("A")));
782 recordDecl(hasName("A"), has(recordDecl(hasName("B")))));
789 DeclarationMatcher ClassX = has(recordDecl(hasName("::X")).bind("x"));
798 recordDecl(hasName("A"), has(recordDecl(hasName("B")).bind("b"))));
805 callExpr(callee(methodDecl(hasName("x")))).bind("x");
832 DeclarationMatcher ClassX = recordDecl(hasName("X")).bind("x");
836 recordDecl(hasName("A"), hasDescendant(ClassX)),
837 recordDecl(hasName("B"), hasDescendant(ClassX)))),
844 qualType(hasDeclaration(enumDecl(hasName("X")))))))));
855 varDecl(hasName("a"),
864 hasDeclaration(namedDecl(hasName("A"))))))));
868 TypeMatcher ClassX = hasDeclaration(recordDecl(hasName("X")));
880 TypeMatcher ClassX = hasDeclaration(recordDecl(hasName("X")));
891 DeclarationMatcher ClassX = recordDecl(hasName("X"));
900 DeclarationMatcher ClassX = recordDecl(hasName("X"));
910 StatementMatcher MethodX = callExpr(hasDeclaration(methodDecl(hasName("x"))));
916 memberCallExpr(on(hasType(recordDecl(hasName("Y")))));
935 memberCallExpr(on(hasType(pointsTo(recordDecl(hasName("Y"))))));
1063 memberCallExpr(thisPointerType(recordDecl(hasName("Y"))));
1095 memberCallExpr(thisPointerType(recordDecl(hasName("Y"))))))));
1120 varDecl(hasName("i"))));
1125 memberCallExpr(on(declRefExpr(to(varDecl(hasName("y"))))));
1162 sizeOfExpr(hasArgumentOfType(hasDeclaration(recordDecl(hasName("A")))))));
1164 hasArgumentOfType(hasDeclaration(recordDecl(hasName("string")))))));
1236 StatementMatcher CallMethodX = callExpr(callee(methodDecl(hasName("x"))));
1250 StatementMatcher CallFunctionF = callExpr(callee(functionDecl(hasName("f"))));
1278 functionTemplateDecl(hasName("f"))));
1284 functionTemplateDecl(hasName("f"))));
1291 functionTemplateDecl(hasName("f"),
1293 functionDecl(hasName("g"))))))));
1298 hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
1306 hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
1312 hasAnyArgument(declRefExpr(to(varDecl(hasName("y"))))));
1336 hasType(references(recordDecl(hasName("X")))));
1363 methodDecl(hasParameter(0, hasName("x")))));
1373 methodDecl(hasParameter(0, hasType(recordDecl(hasName("X")))))));
1375 methodDecl(hasParameter(0, hasType(recordDecl(hasName("X")))))));
1378 hasType(pointsTo(recordDecl(hasName("X"))))))));
1381 hasType(references(recordDecl(hasName("X"))))))));
1386 methodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
1388 methodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
1398 recordDecl(hasName("Y")))))));
1410 methodDecl(hasAnyParameter(hasType(recordDecl(hasName("X")))))));
1416 recordDecl(hasName("X"))))))));
1419 TEST(HasName, MatchesParameterVariableDeclartions) {
1421 methodDecl(hasAnyParameter(hasName("x")))));
1423 methodDecl(hasAnyParameter(hasName("x")))));
1450 refersToDeclaration(fieldDecl(hasName("next")))))));
1500 hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
1516 hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
1614 constructorDecl(ofClass(hasName("Foo")))));
1616 constructorDecl(ofClass(hasName("Bar")))));
1633 destructorDecl(ofClass(hasName("Foo")))));
1638 destructorDecl(ofClass(hasName("Foo")))));
1662 forField(hasType(recordDecl(hasName("Baz"))))))));
1664 forField(hasName("foo_"))))));
1666 forField(hasType(recordDecl(hasName("Bar"))))))));
1690 allOf(forField(hasName("foo_")), isWritten())))));
1692 allOf(forField(hasName("bar_")), isWritten())))));
1694 allOf(forField(hasName("bar_")), unless(isWritten()))))));
1710 hasArgument(0, declRefExpr(to(varDecl(hasName("y"))))));
1723 hasArgument(42, declRefExpr(to(varDecl(hasName("y"))))));
2030 recordDecl(hasName("a::b::C"))));
2032 recordDecl(hasName("::a::b::C"))));
2034 recordDecl(hasName("b::C"))));
2036 recordDecl(hasName("C"))));
2038 recordDecl(hasName("c::b::C"))));
2040 recordDecl(hasName("a::c::C"))));
2042 recordDecl(hasName("a::b::A"))));
2044 recordDecl(hasName("::C"))));
2046 recordDecl(hasName("::b::C"))));
2048 recordDecl(hasName("z::a::b::C"))));
2050 recordDecl(hasName("a+b::C"))));
2052 recordDecl(hasName("C"))));
2058 recordDecl(hasName("A::B::C"))));
2061 recordDecl(hasName("::A::B::C"))));
2064 recordDecl(hasName("B::C"))));
2067 recordDecl(hasName("C"))));
2070 recordDecl(hasName("c::B::C"))));
2073 recordDecl(hasName("A::c::C"))));
2076 recordDecl(hasName("A::B::A"))));
2079 recordDecl(hasName("::C"))));
2082 recordDecl(hasName("::B::C"))));
2084 recordDecl(hasName("z::A::B::C"))));
2087 recordDecl(hasName("A+B::C"))));
2092 recordDecl(hasName("A"), isDefinition());
2097 varDecl(hasName("a"), isDefinition());
2102 methodDecl(hasName("a"), isDefinition());
2109 ofClass(hasName("X")))));
2126 callExpr(callee(methodDecl(hasName("x"))))));
2137 recordDecl(hasName("C"),
2138 hasDescendant(callExpr(callee(methodDecl(hasName("x"))))))));
2174 DeclarationMatcher HasClassB = just(has(recordDecl(hasName("B")).bind("b")));
2199 polymorphicHas(recordDecl(hasName("B")).bind("b"));
2211 polymorphicHas(recordDecl(hasName("B")));
2327 memberExpr(member(hasName("first")))));
2334 memberExpr(member(hasName("first")))));
2342 memberExpr(member(hasName("first")))));
2356 "struct A { int i; };", fieldDecl(isPublic(), hasName("i"))));
2358 "struct A { int i; };", fieldDecl(isProtected(), hasName("i"))));
2360 "struct A { int i; };", fieldDecl(isPrivate(), hasName("i"))));
2363 "class A { int i; };", fieldDecl(isPublic(), hasName("i"))));
2365 "class A { int i; };", fieldDecl(isProtected(), hasName("i"))));
2367 "class A { int i; };", fieldDecl(isPrivate(), hasName("i"))));
2370 "class A { protected: int i; };", fieldDecl(isPublic(), hasName("i"))));
2372 fieldDecl(isProtected(), hasName("i"))));
2374 "class A { protected: int i; };", fieldDecl(isPrivate(), hasName("i"))));
2377 EXPECT_TRUE(notMatches("int i;", varDecl(isPublic(), hasName("i"))));
2378 EXPECT_TRUE(notMatches("int i;", varDecl(isProtected(), hasName("i"))));
2379 EXPECT_TRUE(notMatches("int i;", varDecl(isPrivate(), hasName("i"))));
2387 methodDecl(ofClass(hasName("X"))), true, "-std=gnu++98"));
2390 methodDecl(ofClass(hasName("X")))));
2396 methodDecl(ofClass(hasName("X"))), true, "-std=gnu++98"));
2402 memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
2408 memberExpr(hasObjectExpression(hasType(recordDecl(hasName("X")))))));
2412 hasType(pointsTo(recordDecl(hasName("X"))))))));
2420 hasType(pointsTo(recordDecl(hasName("S"))))))));
2424 hasType(pointsTo(recordDecl(hasName("S"))))))));
2428 EXPECT_TRUE(notMatches("class X { void m(); };", fieldDecl(hasName("m"))));
2429 EXPECT_TRUE(notMatches("class X { class m {}; };", fieldDecl(hasName("m"))));
2430 EXPECT_TRUE(notMatches("class X { enum { m }; };", fieldDecl(hasName("m"))));
2431 EXPECT_TRUE(notMatches("class X { enum m {}; };", fieldDecl(hasName("m"))));
2435 EXPECT_TRUE(matches("class X { int m; };", fieldDecl(hasName("m"))));
2618 declRefExpr(to(varDecl(hasName("x")))))))));
2657 declRefExpr(to(varDecl(hasName("x")))))))));
2716 declRefExpr(to(varDecl(hasName("x")))))))));
2728 declRefExpr(to(varDecl(hasName("x")))))))));
2788 initListExpr(hasType(recordDecl(hasName("B"))))));
2798 usingDecl(hasAnyUsingShadowDecl(hasName("a")))));
2907 recordDecl(hasName("C"), forEach(fieldDecl(hasName("x")).bind("x"))),
2913 recordDecl(hasName("C"), forEach(fieldDecl().bind("f"))),
2920 recordDecl(hasName("C"),
2927 recordDecl(hasName("C"),
2928 forEachDescendant(fieldDecl(hasName("x")).bind("x"))),
2934 isDefinition(), decl().bind("x"), hasName("C"));
2937 recordDecl(hasName("A"), anyOf(m, forEachDescendant(m))),
2944 // recordDecl(hasName
2952 recordDecl(hasName("C"), forEachDescendant(fieldDecl().bind("f"))),
2960 recordDecl(hasName("C"), forEachDescendant(recordDecl(
2968 recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))),
2972 recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))),
2979 recordDecl(hasName("::A"), findAll(recordDecl(hasName("::A")).bind("v"))),
2986 recordDecl(hasName("::A"), findAll(fieldDecl().bind("v"))),
2993 recordDecl(hasName("::A"),
2994 findAll(decl(anyOf(recordDecl(hasName("::A")).bind("v"),
3000 recordDecl(hasName("::A"), findAll(recordDecl(isDefinition()).bind("v"))),
3007 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3008 has(fieldDecl(hasName("b")).bind("v")))),
3015 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3016 has(fieldDecl(hasName("b")).bind("v")))),
3020 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3021 has(fieldDecl(hasName("b")).bind("v")))),
3025 recordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")),
3026 has(fieldDecl(hasName("b")).bind("v"))))));
3035 recordDecl(hasName("::X"), isTemplateInstantiation())));
3040 fieldDecl(hasType(recordDecl(hasName("A"))))))));
3046 functionDecl(hasParameter(0, hasType(recordDecl(hasName("A")))),
3055 fieldDecl(hasType(recordDecl(hasName("A"))))))));
3063 recordDecl(hasName("::X"), isTemplateInstantiation())));
3074 recordDecl(hasName("::X::Y"), isTemplateInstantiation())));
3087 recordDecl(hasName("::X<A>::Y"), unless(isTemplateInstantiation()))));
3094 recordDecl(hasName("::X"), isTemplateInstantiation())));
3150 recordDecl(hasName("C"), hasAncestor(recordDecl(hasName("A"))))));
3156 recordDecl(hasName("C"), hasAncestor(recordDecl(hasName("X"))))));
3162 varDecl(hasName("c"), hasType(recordDecl(hasName("C"),
3163 hasAncestor(recordDecl(hasName("A"))))))));
3175 integerLiteral(equals(42), hasAncestor(functionDecl(hasName("f"))))));
3205 varDecl(hasName("x"),
3216 hasAncestor(recordDecl(hasName("A"))))));
3224 hasAncestor(recordDecl(hasName("A")))))))));
3362 varDecl(hasName("b")))))))));
3413 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3415 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
3417 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3419 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3421 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3423 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3427 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3429 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3431 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ptr"),
3433 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ptr"),
3437 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3439 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3441 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3443 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
3445 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
3447 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3451 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3453 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3455 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3457 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
3459 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("ref"),
3461 EXPECT_TRUE(matches(Fragment, varDecl(hasName("ref"),
3471 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("a"),
3473 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("b"),
3475 EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
3477 EXPECT_TRUE(matches(Fragment, varDecl(hasName("c"),
3479 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("c"),
3481 EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
3483 EXPECT_TRUE(matches(Fragment, varDecl(hasName("d"),
3485 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("d"),
3487 EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
3489 EXPECT_TRUE(notMatches(Fragment, varDecl(hasName("e"),
3491 EXPECT_TRUE(matches(Fragment, varDecl(hasName("e"),
3525 EXPECT_TRUE(matches("typedef int X; X a;", varDecl(hasName("a"),
3537 recordType(hasDeclaration(recordDecl(hasName("S"))))));
3539 recordType(hasDeclaration(recordDecl(hasName("S"))))));
3562 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))))));
3568 elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))))));
3584 hasDeclaration(namedDecl(hasName("D")))))))));
3616 specifiesType(hasDeclaration(recordDecl(hasName("A")))));
3625 specifiesNamespace(hasName("ns")));
3663 specifiesNamespace(hasName("a")))))));
3668 specifiesNamespace(hasName("a")))))));
3673 specifiesNamespace(hasName("a")))))));
3694 functionDecl(hasName("f"),
3708 specifiesNamespace(hasName("a"))))))));
3713 specifiesNamespace(hasName("a"))))))));
3718 specifiesNamespace(hasName("a"))))))));
3737 functionDecl(hasName("f"),
3765 "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
3767 "X", decl(hasDescendant(recordDecl(hasName("X::Y")).bind("Y"))),
3770 "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
3772 "X", decl(hasDescendant(recordDecl(hasName("X::Z")).bind("Z"))),
3789 "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
3791 "X", recordDecl(has(recordDecl(hasName("X::Y")).bind("Y"))), "Y")));
3793 "class X { class Y {}; };", recordDecl(hasName("::X")).bind("X"),
3795 "X", recordDecl(has(recordDecl(hasName("X::Z")).bind("Z"))), "Z")));
3822 "class X { class Y {}; };", recordDecl(hasName("::X::Y")).bind(""),