[cfe-commits] r160233 - in /cfe/trunk: include/clang/ASTMatchers/ASTMatchers.h unittests/ASTMatchers/ASTMatchersTest.cpp
Daniel Jasper
djasper at google.com
Sun Jul 15 12:57:12 PDT 2012
Author: djasper
Date: Sun Jul 15 14:57:12 2012
New Revision: 160233
URL: http://llvm.org/viewvc/llvm-project?rev=160233&view=rev
Log:
Fix spelling of anyOf matcher and add missing test.
Patch by Sam Panzer!
Modified:
cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h?rev=160233&r1=160232&r2=160233&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Sun Jul 15 14:57:12 2012
@@ -702,7 +702,7 @@
internal::PolymorphicMatcherWithParam2<internal::AnyOfMatcher,
C3, C4> > >
anyOf(const C1 &P1, const C2 &P2, const C3 &P3, const C4 &P4) {
- return AnyOf(P1, AnyOf(P2, AnyOf(P3, P4)));
+ return anyOf(P1, anyOf(P2, anyOf(P3, P4)));
}
template<typename C1, typename C2, typename C3, typename C4, typename C5>
internal::PolymorphicMatcherWithParam2<internal::AnyOfMatcher, C1,
Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=160233&r1=160232&r2=160233&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Sun Jul 15 14:57:12 2012
@@ -291,7 +291,6 @@
TEST(DeclarationMatcher, MatchAnyOf) {
DeclarationMatcher YOrZDerivedFromX =
record(anyOf(hasName("Y"), allOf(isDerivedFrom("X"), hasName("Z"))));
-
EXPECT_TRUE(
matches("class X {}; class Z : public X {};", YOrZDerivedFromX));
EXPECT_TRUE(matches("class Y {};", YOrZDerivedFromX));
@@ -299,10 +298,14 @@
notMatches("class X {}; class W : public X {};", YOrZDerivedFromX));
EXPECT_TRUE(notMatches("class Z {};", YOrZDerivedFromX));
+ DeclarationMatcher XOrYOrZOrU =
+ record(anyOf(hasName("X"), hasName("Y"), hasName("Z"), hasName("U")));
+ EXPECT_TRUE(matches("class X {};", XOrYOrZOrU));
+ EXPECT_TRUE(notMatches("class V {};", XOrYOrZOrU));
+
DeclarationMatcher XOrYOrZOrUOrV =
record(anyOf(hasName("X"), hasName("Y"), hasName("Z"), hasName("U"),
- hasName("V")));
-
+ hasName("V")));
EXPECT_TRUE(matches("class X {};", XOrYOrZOrUOrV));
EXPECT_TRUE(matches("class Y {};", XOrYOrZOrUOrV));
EXPECT_TRUE(matches("class Z {};", XOrYOrZOrUOrV));
More information about the cfe-commits
mailing list