summaryrefslogtreecommitdiffstats
path: root/unittests/ASTMatchers/Dynamic
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2014-08-25 11:23:50 +0000
committerManuel Klimek <klimek@google.com>2014-08-25 11:23:50 +0000
commitccbd7aeb11adc607a43f7d95deee4c1b9c9afc94 (patch)
tree166ce37b820cbbbb490a947e198f2e2e8e75aec5 /unittests/ASTMatchers/Dynamic
parent89692ccf3dbc16ca84efae4378d0588123f192b8 (diff)
Add hasAttr matcher for declarations.
Delete special-case CUDA attribute matchers. Patch by Jacques Pienaar. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216379 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/Dynamic')
-rw-r--r--unittests/ASTMatchers/Dynamic/RegistryTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
index 5552790bca..f8a9430f16 100644
--- a/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ b/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -472,6 +472,14 @@ TEST_F(RegistryTest, Completion) {
"Matcher<NamedDecl> hasName(string)"));
}
+TEST_F(RegistryTest, HasArgs) {
+ Matcher<Decl> Value = constructMatcher(
+ "decl", constructMatcher("hasAttr", std::string("attr::WarnUnused")))
+ .getTypedMatcher<Decl>();
+ EXPECT_TRUE(matches("struct __attribute__((warn_unused)) X {};", Value));
+ EXPECT_FALSE(matches("struct X {};", Value));
+}
+
} // end anonymous namespace
} // end namespace dynamic
} // end namespace ast_matchers