summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/llvm/tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp')
-rw-r--r--gnu/llvm/tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/gnu/llvm/tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/gnu/llvm/tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
index 8e97566f692..6bbbc2bd356 100644
--- a/gnu/llvm/tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ b/gnu/llvm/tools/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -421,7 +421,7 @@ TEST_F(RegistryTest, Errors) {
constructMatcher("parameterCountIs", 3), Error.get())
.isNull());
EXPECT_EQ("Incorrect type for arg 2. (Expected = Matcher<CXXRecordDecl>) != "
- "(Actual = Matcher<FunctionDecl>)",
+ "(Actual = Matcher<FunctionDecl|FunctionProtoType>)",
Error->toString());
// Bad argument type with variadic.
@@ -449,26 +449,25 @@ TEST_F(RegistryTest, Completion) {
// Overloaded
EXPECT_TRUE(hasCompletion(
Comps, "hasParent(",
- "Matcher<TemplateArgument|NestedNameSpecifierLoc|Decl|...> "
- "hasParent(Matcher<TemplateArgument|NestedNameSpecifierLoc|Decl|...>)"));
+ "Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...> "
+ "hasParent(Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...>)"));
// Variadic.
EXPECT_TRUE(hasCompletion(Comps, "whileStmt(",
"Matcher<Stmt> whileStmt(Matcher<WhileStmt>...)"));
// Polymorphic.
EXPECT_TRUE(hasCompletion(
Comps, "hasDescendant(",
- "Matcher<TemplateArgument|NestedNameSpecifier|NestedNameSpecifierLoc|...>"
- " hasDescendant(Matcher<TemplateArgument|NestedNameSpecifier|"
- "NestedNameSpecifierLoc|...>)"));
+ "Matcher<NestedNameSpecifierLoc|QualType|TypeLoc|...> "
+ "hasDescendant(Matcher<NestedNameSpecifierLoc|QualType|TypeLoc|...>)"));
CompVector WhileComps = getCompletions("whileStmt", 0);
EXPECT_TRUE(hasCompletion(WhileComps, "hasBody(",
"Matcher<WhileStmt> hasBody(Matcher<Stmt>)"));
- EXPECT_TRUE(hasCompletion(WhileComps, "hasParent(",
- "Matcher<Stmt> "
- "hasParent(Matcher<TemplateArgument|"
- "NestedNameSpecifierLoc|Decl|...>)"));
+ EXPECT_TRUE(hasCompletion(
+ WhileComps, "hasParent(",
+ "Matcher<Stmt> "
+ "hasParent(Matcher<NestedNameSpecifierLoc|TypeLoc|Decl|...>)"));
EXPECT_TRUE(
hasCompletion(WhileComps, "allOf(", "Matcher<T> allOf(Matcher<T>...)"));
@@ -506,6 +505,12 @@ TEST_F(RegistryTest, HasArgs) {
EXPECT_FALSE(matches("struct X {};", Value));
}
+TEST_F(RegistryTest, ParenExpr) {
+ Matcher<Stmt> Value = constructMatcher("parenExpr").getTypedMatcher<Stmt>();
+ EXPECT_TRUE(matches("int i = (1);", Value));
+ EXPECT_FALSE(matches("int i = 1;", Value));
+}
+
} // end anonymous namespace
} // end namespace dynamic
} // end namespace ast_matchers