]> granicus.if.org Git - clang/commitdiff
Fix documentation of numSelectorArgs.
authorManuel Klimek <klimek@google.com>
Tue, 8 Sep 2015 10:11:26 +0000 (10:11 +0000)
committerManuel Klimek <klimek@google.com>
Tue, 8 Sep 2015 10:11:26 +0000 (10:11 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@246998 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/ASTMatchers/ASTMatchers.h
unittests/ASTMatchers/ASTMatchersTest.cpp

index cb10daf89e35e33c48cf99289cff9320a0943424..29f0da557e5587e1483c746c85759de3763c93f4 100644 (file)
@@ -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));
index b4435583d530ca45077c6fc976d67b8081b5e719..b0cd8476f7607195ccef250e975d73ba9a991980 100644 (file)
@@ -4888,6 +4888,9 @@ TEST(ObjCMessageExprMatcher, SimpleExprs) {
   EXPECT_TRUE(matchesObjC(
       Objc1String,
       objcMessageExpr(hasSelector("contents"), hasUnarySelector())));
+  EXPECT_TRUE(matchesObjC(
+      Objc1String,
+      objcMessageExpr(hasSelector("contents"), numSelectorArgs(0))));
   EXPECT_TRUE(matchesObjC(
       Objc1String,
       objcMessageExpr(matchesSelector("uppercase*"),