r246998 - Fix documentation of numSelectorArgs.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 8 03:11:27 PDT 2015
Author: klimek
Date: Tue Sep 8 05:11:26 2015
New Revision: 246998
URL: http://llvm.org/viewvc/llvm-project?rev=246998&view=rev
Log:
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.
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=246998&r1=246997&r2=246998&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h Tue Sep 8 05:11:26 2015
@@ -2151,7 +2151,7 @@ AST_MATCHER(ObjCMessageExpr, hasKeywordS
/// \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));
Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=246998&r1=246997&r2=246998&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Tue Sep 8 05:11:26 2015
@@ -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)
)));
More information about the cfe-commits
mailing list