diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2015-09-17 13:30:52 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2015-09-17 13:30:52 +0000 |
commit | 512fb64765c7d61e89531b8ff697a85d815d9a13 (patch) | |
tree | 13b547afff599de69cc832efbd2d67313e33f98b /clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp | |
parent | 6c1f0933ac1490cc44083c7f1063d1d280a6310f (diff) | |
download | bcm5719-llvm-512fb64765c7d61e89531b8ff697a85d815d9a13.tar.gz bcm5719-llvm-512fb64765c7d61e89531b8ff697a85d815d9a13.zip |
Rename AST node matchers to match the AST node names directly. Part of this rename also splits recordDecl() (which used to match CXXRecordDecl) into recordDecl() (that matches RecordDecl) and cxxRecordDecl (that matches CXXRecordDecl). Also adds isStruct(), isUnion(), and isClass() narrowing matchers for RecordDecl objects.
llvm-svn: 247885
Diffstat (limited to 'clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp index a6b0a1b41d6..ca1dfefd538 100644 --- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp +++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp @@ -129,7 +129,7 @@ TEST_F(RegistryTest, CanConstructNoArgs) { Matcher<Stmt> IsArrowValue = constructMatcher( "memberExpr", constructMatcher("isArrow")).getTypedMatcher<Stmt>(); Matcher<Stmt> BoolValue = - constructMatcher("boolLiteral").getTypedMatcher<Stmt>(); + constructMatcher("cxxBoolLiteral").getTypedMatcher<Stmt>(); const std::string ClassSnippet = "struct Foo { int x; };\n" "Foo *foo = new Foo;\n" @@ -195,7 +195,7 @@ TEST_F(RegistryTest, OverloadedMatchers) { "callExpr", constructMatcher( "callee", - constructMatcher("methodDecl", + constructMatcher("cxxMethodDecl", constructMatcher("hasName", StringRef("x"))))) .getTypedMatcher<Stmt>(); @@ -255,11 +255,11 @@ TEST_F(RegistryTest, PolymorphicMatchers) { EXPECT_FALSE(matches("void Foo(){};", RecordDecl)); Matcher<Stmt> ConstructExpr = constructMatcher( - "constructExpr", + "cxxConstructExpr", constructMatcher( "hasDeclaration", constructMatcher( - "methodDecl", + "cxxMethodDecl", constructMatcher( "ofClass", constructMatcher("hasName", StringRef("Foo")))))) .getTypedMatcher<Stmt>(); @@ -300,7 +300,7 @@ TEST_F(RegistryTest, TypeTraversal) { TEST_F(RegistryTest, CXXCtorInitializer) { Matcher<Decl> CtorDecl = constructMatcher( - "constructorDecl", + "cxxConstructorDecl", constructMatcher( "hasAnyConstructorInitializer", constructMatcher("forField", @@ -416,9 +416,10 @@ TEST_F(RegistryTest, Errors) { "(Actual = String)", Error->toString()); Error.reset(new Diagnostics()); - EXPECT_TRUE(constructMatcher("recordDecl", constructMatcher("recordDecl"), - constructMatcher("parameterCountIs", 3), - Error.get()).isNull()); + EXPECT_TRUE( + constructMatcher("cxxRecordDecl", constructMatcher("cxxRecordDecl"), + constructMatcher("parameterCountIs", 3), Error.get()) + .isNull()); EXPECT_EQ("Incorrect type for arg 2. (Expected = Matcher<CXXRecordDecl>) != " "(Actual = Matcher<FunctionDecl>)", Error->toString()); @@ -432,7 +433,7 @@ TEST_F(RegistryTest, Errors) { Error->toString()); Error.reset(new Diagnostics()); EXPECT_TRUE(constructMatcher( - "recordDecl", + "cxxRecordDecl", constructMatcher("allOf", constructMatcher("isDerivedFrom", StringRef("FOO")), constructMatcher("isArrow")), |