Update aosp/master clang for rebase to r233350
Change-Id: I12d4823f10bc9e445b8b86e7721b71f98d1df442
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp
index 0d27b5d..7edec96 100644
--- a/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -1790,6 +1790,9 @@
methodDecl(isOverride())));
EXPECT_TRUE(notMatches("class X { int f(); int f(int); }; ",
methodDecl(isOverride())));
+ EXPECT_TRUE(
+ matches("template <typename Base> struct Y : Base { void f() override;};",
+ methodDecl(isOverride(), hasName("::Y::f"))));
}
TEST(Matcher, ConstructorCall) {
@@ -2538,10 +2541,9 @@
HasClassB, new VerifyIdIsBoundTo<Decl>("b")));
}
-AST_POLYMORPHIC_MATCHER_P(
- polymorphicHas,
- AST_POLYMORPHIC_SUPPORTED_TYPES_2(Decl, Stmt),
- internal::Matcher<Decl>, AMatcher) {
+AST_POLYMORPHIC_MATCHER_P(polymorphicHas,
+ AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt),
+ internal::Matcher<Decl>, AMatcher) {
return Finder->matchesChildOf(
Node, AMatcher, Builder,
ASTMatchFinder::TK_IgnoreImplicitCastsAndParentheses,
@@ -4712,5 +4714,50 @@
#endif // LLVM_ON_WIN32
+
+TEST(ObjCMessageExprMatcher, SimpleExprs) {
+ // don't find ObjCMessageExpr where none are present
+ EXPECT_TRUE(notMatchesObjC("", objcMessageExpr(anything())));
+
+ std::string Objc1String =
+ "@interface Str "
+ " - (Str *)uppercaseString:(Str *)str;"
+ "@end "
+ "@interface foo "
+ "- (void)meth:(Str *)text;"
+ "@end "
+ " "
+ "@implementation foo "
+ "- (void) meth:(Str *)text { "
+ " [self contents];"
+ " Str *up = [text uppercaseString];"
+ "} "
+ "@end ";
+ EXPECT_TRUE(matchesObjC(
+ Objc1String,
+ objcMessageExpr(anything())));
+ EXPECT_TRUE(matchesObjC(
+ Objc1String,
+ objcMessageExpr(hasSelector("contents"))));
+ EXPECT_TRUE(matchesObjC(
+ Objc1String,
+ objcMessageExpr(matchesSelector("cont*"))));
+ EXPECT_FALSE(matchesObjC(
+ Objc1String,
+ objcMessageExpr(matchesSelector("?cont*"))));
+ EXPECT_TRUE(notMatchesObjC(
+ Objc1String,
+ objcMessageExpr(hasSelector("contents"), hasNullSelector())));
+ EXPECT_TRUE(matchesObjC(
+ Objc1String,
+ objcMessageExpr(hasSelector("contents"), hasUnarySelector())));
+ EXPECT_TRUE(matchesObjC(
+ Objc1String,
+ objcMessageExpr(matchesSelector("uppercase*"),
+ argumentCountIs(0)
+ )));
+
+}
+
} // end namespace ast_matchers
} // end namespace clang