summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2015-09-08 10:11:26 +0000
committerManuel Klimek <klimek@google.com>2015-09-08 10:11:26 +0000
commite67a9d6d24279c40e9e7acf16cc5d9e4e3b9ab23 (patch)
tree76fa968e4cedcbc9d8d074d33a58b6bfa87f4945
parent7cd48100214c7c7ccf3d0e093e3d88db969865f1 (diff)
downloadbcm5719-llvm-e67a9d6d24279c40e9e7acf16cc5d9e4e3b9ab23.tar.gz
bcm5719-llvm-e67a9d6d24279c40e9e7acf16cc5d9e4e3b9ab23.zip
Fix documentation of numSelectorArgs.
Currently, the documentation for numSelectorArgs includes an incorrect example. It shows a case where an argument of 1 will match a property getter, but a getter will be matched only when N == 0. This diff corrects the documentation and adds a test for numSelectorArgs(0). Patch by Dave Lee. llvm-svn: 246998
-rw-r--r--clang/include/clang/ASTMatchers/ASTMatchers.h2
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersTest.cpp3
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h
index cb10daf89e3..29f0da557e5 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchers.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h
@@ -2151,7 +2151,7 @@ AST_MATCHER(ObjCMessageExpr, hasKeywordSelector) {
/// \brief Matches when the selector has the specified number of arguments
///
-/// matcher = objCMessageExpr(numSelectorArgs(1));
+/// matcher = objCMessageExpr(numSelectorArgs(0));
/// matches self.bodyView in the code below
///
/// matcher = objCMessageExpr(numSelectorArgs(2));
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
index b4435583d53..b0cd8476f76 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp
@@ -4890,6 +4890,9 @@ TEST(ObjCMessageExprMatcher, SimpleExprs) {
objcMessageExpr(hasSelector("contents"), hasUnarySelector())));
EXPECT_TRUE(matchesObjC(
Objc1String,
+ objcMessageExpr(hasSelector("contents"), numSelectorArgs(0))));
+ EXPECT_TRUE(matchesObjC(
+ Objc1String,
objcMessageExpr(matchesSelector("uppercase*"),
argumentCountIs(0)
)));
OpenPOWER on IntegriCloud