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 | e0265decdac966c98cede46cf612cc2cd8eb6c6c (patch) | |
tree | 71d3da67cf5642dc7eab6204c1d283b4a063e50f /unittests/ASTMatchers/Dynamic | |
parent | bd01824a0f5da08387a20165216383b20fe5164f (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ASTMatchers/Dynamic')
-rw-r--r-- | unittests/ASTMatchers/Dynamic/RegistryTest.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/unittests/ASTMatchers/Dynamic/RegistryTest.cpp index 9011b3f65e..5483f8f358 100644 --- a/unittests/ASTMatchers/Dynamic/RegistryTest.cpp +++ b/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) { |