Lines Matching refs:decl
47 EXPECT_TRUE(Finder.addDynamicMatcher(decl(), nullptr));
58 TEST(Decl, MatchesDeclarations) {
59 EXPECT_TRUE(notMatches("", decl(usingDecl())));
61 decl(usingDecl())));
379 EXPECT_TRUE(matches("class D{};", decl(hasDeclContext(decl()))));
394 hasDeclContext(decl(hasDeclContext(translationUnitDecl()))))));
693 decl(hasDescendant(typeLoc().bind("x")), has(decl()));
699 auto VD = internal::Matcher<VarDecl>(Name).dynCastTo<Decl>();
700 auto RD = internal::Matcher<RecordDecl>(Name).dynCastTo<Decl>();
703 decl(hasDescendant(VD), hasDescendant(RD))));
705 decl(hasDescendant(RD), hasDescendant(VD))));
708 decl(anyOf(hasDescendant(RD), hasDescendant(VD)))));
713 decl(hasAttr(clang::attr::WarnUnused))));
715 decl(hasAttr(clang::attr::WarnUnused))));
731 // Decl bound to Id that can be dynamically cast to T.
804 decl(hasDescendant(loc(builtinType())))));
820 new VerifyIdIsBoundTo<Decl>("x", 3)));
989 new VerifyIdIsBoundTo<Decl>("b")));
1025 new VerifyIdIsBoundTo<Decl>("x", 2)));
1043 hasType(typedefType(hasDeclaration(decl()))))));
1105 // Matcher<Decl>, too?
1802 refersToDeclaration(decl())))));
1815 refersToDeclaration(decl())))));
2764 AST_MATCHER_P(Decl, just, internal::Matcher<Decl>, AMatcher) {
2774 HasClassB, new VerifyIdIsBoundTo<Decl>("b")));
2777 HasClassB, new VerifyIdIsBoundTo<Decl>("a")));
2780 HasClassB, new VerifyIdIsBoundTo<Decl>("b")));
2784 AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt),
2785 internal::Matcher<Decl>, AMatcher) {
2797 HasClassB, new VerifyIdIsBoundTo<Decl>("b")));
2800 HasClassB, new VerifyIdIsBoundTo<Decl>("a")));
2803 HasClassB, new VerifyIdIsBoundTo<Decl>("b")));
3610 isDefinition(), decl().bind("x"), hasName("C"));
3614 new VerifyIdIsBoundTo<Decl>("x", "C")));
3622 new VerifyIdIsBoundTo<Decl>("x", "C")));
3653 "class X { int a; };", recordDecl(decl().bind("x"), has(fieldDecl())),
3654 new VerifyIdIsBoundTo<Decl>("x", 1)));
3671 // recordDecl(decl
3690 decl().bind("x"),
3692 new VerifyIdIsBoundTo<Decl>("x", 1)));
3695 cxxRecordDecl(decl().bind("x"), hasMethod(hasName("g"))),
3696 new VerifyIdIsBoundTo<Decl>("x", 1)));
3699 recordDecl(decl().bind("x"),
3702 new VerifyIdIsBoundTo<Decl>("x", 1)));
3709 functionDecl(decl().bind("x"), hasAnyParameter(hasName("y"))),
3710 new VerifyIdIsBoundTo<Decl>("x", 1)));
3713 functionDecl(decl().bind("x"),
3715 new VerifyIdIsBoundTo<Decl>("x", 1)));
3719 usingDecl(decl().bind("x"), hasAnyUsingShadowDecl(hasTargetDecl(
3721 new VerifyIdIsBoundTo<Decl>("x", 1)));
3724 cxxRecordDecl(decl().bind("x"), isDerivedFrom("::A")),
3725 new VerifyIdIsBoundTo<Decl>("x", 1)));
3729 cxxRecordDecl(decl().bind("x"), isDerivedFrom("C")),
3730 new VerifyIdIsBoundTo<Decl>("x", 1)));
3733 functionDecl(decl().bind("x"), hasAncestor(recordDecl(hasName("::A")))),
3734 new VerifyIdIsBoundTo<Decl>("x", 1)));
3744 recordDecl(hasName("::A"), decl().bind("x"), unless(hasName("fooble"))),
3745 new VerifyIdIsBoundTo<Decl>("x", 1)));
3748 cxxConstructorDecl(hasName("::A::A"), decl().bind("x"),
3750 new VerifyIdIsBoundTo<Decl>("x", 1)));
3756 recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))),
3757 new VerifyIdIsBoundTo<FieldDecl>("decl", 1)));
3760 recordDecl(hasName("C"), forEachDescendant(decl().bind("decl"))),
3761 new VerifyIdIsBoundTo<FunctionDecl>("decl", 1)));
3782 findAll(decl(anyOf(recordDecl(hasName("::A")).bind("v"),
3784 new VerifyIdIsBoundTo<Decl>("v", 3)));
4033 decl(
4609 decl(hasDescendant(nestedNameSpecifier(specifiesType(
4652 decl(hasDescendant(loc(nestedNameSpecifier(specifiesType(
4685 new VerifyMatchOnNode<clang::Decl>(
4686 "X", decl(hasDescendant(recordDecl(hasName("X::Y")).bind("Y"))),
4690 new VerifyMatchOnNode<clang::Decl>(
4691 "X", decl(hasDescendant(recordDecl(hasName("X::Z")).bind("Z"))),
4703 "if", stmt(hasDescendant(declStmt().bind("decl"))), "decl")));
4709 new VerifyMatchOnNode<clang::Decl>(
4713 new VerifyMatchOnNode<clang::Decl>(
4736 bool verify(const BoundNodes &Nodes, ASTContext &Context, const Decl *Node) {
4741 "", match(decl(hasParent(
4742 decl(has(decl(equalsNode(TypedNode)))).bind(""))),
4749 const auto *Dec = Nodes.getNodeAs<FieldDecl>("decl");
4751 "", match(fieldDecl(hasParent(decl(has(fieldDecl(
4766 fieldDecl(hasName("y"), hasType(type().bind(""))).bind("decl"),
4780 Finder.addMatcher(decl(), &Callback);
4802 Finder.addMatcher(decl(), &VerifyCallback);
4828 Finder.addMatcher(decl(), &VerifyCallback);
4870 TEST(EqualsBoundNodeMatcher, Decl) {
4873 decl(allOf(recordDecl(hasName("::X::Y")).bind("record"),
4874 hasParent(decl(has(decl(equalsBoundNode("record")))))))));
4877 decl(allOf(recordDecl(hasName("::X")).bind("record"),
4878 has(decl(equalsBoundNode("record")))))));
4911 decl"))),
4913 new VerifyIdIsBoundTo<VarDecl>("decl", 2)));
4925 forEachDescendant(declRefExpr(to(decl(equalsBoundNode("d")))))),