diff options
| author | Samuel Benzaquen <sbenza@google.com> | 2014-10-13 17:38:12 +0000 |
|---|---|---|
| committer | Samuel Benzaquen <sbenza@google.com> | 2014-10-13 17:38:12 +0000 |
| commit | 2009960ea33759a1848ade83640896db27a7382b (patch) | |
| tree | 223524dd02482725480875efa68226a3ccf00081 /clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp | |
| parent | 1ee5ac87e2bc14a7c04fdb735d69d445b3b7f24d (diff) | |
| download | bcm5719-llvm-2009960ea33759a1848ade83640896db27a7382b.tar.gz bcm5719-llvm-2009960ea33759a1848ade83640896db27a7382b.zip | |
Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Summary:
Change r219118 fixed the bug for anyOf and eachOf, but it is still
present for unless.
The variadic wrapper doesn't have enough information to know how to
restrict the type. Different operators handle restrict failures in
different ways.
Reviewers: klimek
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D5731
llvm-svn: 219622
Diffstat (limited to 'clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp')
| -rw-r--r-- | clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp index 9011b3f65ec..5483f8f3580 100644 --- a/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp +++ b/clang/unittests/ASTMatchers/Dynamic/RegistryTest.cpp @@ -380,6 +380,13 @@ TEST_F(RegistryTest, VariadicOp) { EXPECT_FALSE(matches("class Bar{ int Foo; };", D)); EXPECT_TRUE(matches("class OtherBar{ int Foo; };", D)); + + D = constructMatcher( + "namedDecl", constructMatcher("hasName", std::string("Foo")), + constructMatcher("unless", constructMatcher("recordDecl"))) + .getTypedMatcher<Decl>(); + EXPECT_TRUE(matches("void Foo(){}", D)); + EXPECT_TRUE(notMatches("struct Foo {};", D)); } TEST_F(RegistryTest, Errors) { |

