summaryrefslogtreecommitdiffstats
path: root/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
diff options
context:
space:
mode:
authorSamuel Benzaquen <sbenza@google.com>2013-11-22 23:05:57 +0000
committerSamuel Benzaquen <sbenza@google.com>2013-11-22 23:05:57 +0000
commitef77f3cca73261c2c03d0b3586dba5bfeafb4920 (patch)
tree3b007f76642b3dc80a0ae4a256618672a4b2f382 /clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
parent82e366e78f3a6bf5cedba54b3785fa295ad441fe (diff)
downloadbcm5719-llvm-ef77f3cca73261c2c03d0b3586dba5bfeafb4920.tar.gz
bcm5719-llvm-ef77f3cca73261c2c03d0b3586dba5bfeafb4920.zip
Make the negative test more specific.
Summary: Make the negative test more specific. Otherwise it can accidentally match injected code. Reviewers: aaron.ballman CC: klimek, cfe-commits, revane Differential Revision: http://llvm-reviews.chandlerc.com/D2257 llvm-svn: 195512
Diffstat (limited to 'clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp')
-rw-r--r--clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
index dad9499ad4b..8694c642cd5 100644
--- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
+++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
@@ -296,16 +296,16 @@ TEST_F(RegistryTest, VariadicOp) {
EXPECT_TRUE(matches("class Bar{};", D));
EXPECT_FALSE(matches("class OtherBar{};", D));
- D = constructMatcher(
- "recordDecl",
+ D = recordDecl(
+ has(fieldDecl(hasName("Foo"))),
constructMatcher(
"unless",
constructMatcher("namedDecl",
- constructMatcher("hasName", std::string("Bar")))))
- .getTypedMatcher<Decl>();
+ constructMatcher("hasName", std::string("Bar"))))
+ .getTypedMatcher<Decl>());
- EXPECT_FALSE(matches("class Bar{};", D));
- EXPECT_TRUE(matches("class OtherBar{};", D));
+ EXPECT_FALSE(matches("class Bar{ int Foo; };", D));
+ EXPECT_TRUE(matches("class OtherBar{ int Foo; };", D));
}
TEST_F(RegistryTest, Errors) {
OpenPOWER on IntegriCloud