This revision was automatically updated to reflect the committed changes. Closed by commit rL316670: Add objcCategoryImplDecl matcher (authored by kastiglione).
Changed prior to commit: https://reviews.llvm.org/D39293?vs=120269&id=120431#toc Repository: rL LLVM https://reviews.llvm.org/D39293 Files: cfe/trunk/docs/LibASTMatchersReference.html cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp Index: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp =================================================================== --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp @@ -375,6 +375,7 @@ REGISTER_MATCHER(numSelectorArgs); REGISTER_MATCHER(ofClass); REGISTER_MATCHER(objcCategoryDecl); + REGISTER_MATCHER(objcCategoryImplDecl); REGISTER_MATCHER(objcImplementationDecl); REGISTER_MATCHER(objcInterfaceDecl); REGISTER_MATCHER(objcIvarDecl); Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp =================================================================== --- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -1590,7 +1590,7 @@ ))); } -TEST(ObjCDeclMacher, CoreDecls) { +TEST(ObjCDeclMatcher, CoreDecls) { std::string ObjCString = "@protocol Proto " "- (void)protoDidThing; " @@ -1605,6 +1605,9 @@ "{ id _ivar; } " "- (void)anything {} " "@end " + "@implementation Thing (ABC) " + "- (void)abc_doThing {} " + "@end " ; EXPECT_TRUE(matchesObjC( @@ -1618,6 +1621,9 @@ objcCategoryDecl(hasName("ABC")))); EXPECT_TRUE(matchesObjC( ObjCString, + objcCategoryImplDecl(hasName("ABC")))); + EXPECT_TRUE(matchesObjC( + ObjCString, objcMethodDecl(hasName("protoDidThing")))); EXPECT_TRUE(matchesObjC( ObjCString, Index: cfe/trunk/docs/LibASTMatchersReference.html =================================================================== --- cfe/trunk/docs/LibASTMatchersReference.html +++ cfe/trunk/docs/LibASTMatchersReference.html @@ -346,6 +346,15 @@ </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('objcCategoryImplDecl0')"><a name="objcCategoryImplDecl0Anchor">objcCategoryImplDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCCategoryImplDecl.html">ObjCCategoryImplDecl</a>>...</td></tr> +<tr><td colspan="4" class="doc" id="objcCategoryImplDecl0"><pre>Matches Objective-C category definitions. + +Example matches Foo (Additions) + @implementation Foo (Additions) + @end +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('objcImplementationDecl0')"><a name="objcImplementationDecl0Anchor">objcImplementationDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCImplementationDecl.html">ObjCImplementationDecl</a>>...</td></tr> <tr><td colspan="4" class="doc" id="objcImplementationDecl0"><pre>Matches Objective-C implementation declarations. Index: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h @@ -1178,6 +1178,17 @@ Decl, ObjCCategoryDecl> objcCategoryDecl; +/// \brief Matches Objective-C category definitions. +/// +/// Example matches Foo (Additions) +/// \code +/// @implementation Foo (Additions) +/// @end +/// \endcode +const internal::VariadicDynCastAllOfMatcher< + Decl, + ObjCCategoryImplDecl> objcCategoryImplDecl; + /// \brief Matches Objective-C method declarations. /// /// Example matches both declaration and definition of -[Foo method]
Index: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp =================================================================== --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp @@ -375,6 +375,7 @@ REGISTER_MATCHER(numSelectorArgs); REGISTER_MATCHER(ofClass); REGISTER_MATCHER(objcCategoryDecl); + REGISTER_MATCHER(objcCategoryImplDecl); REGISTER_MATCHER(objcImplementationDecl); REGISTER_MATCHER(objcInterfaceDecl); REGISTER_MATCHER(objcIvarDecl); Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp =================================================================== --- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -1590,7 +1590,7 @@ ))); } -TEST(ObjCDeclMacher, CoreDecls) { +TEST(ObjCDeclMatcher, CoreDecls) { std::string ObjCString = "@protocol Proto " "- (void)protoDidThing; " @@ -1605,6 +1605,9 @@ "{ id _ivar; } " "- (void)anything {} " "@end " + "@implementation Thing (ABC) " + "- (void)abc_doThing {} " + "@end " ; EXPECT_TRUE(matchesObjC( @@ -1618,6 +1621,9 @@ objcCategoryDecl(hasName("ABC")))); EXPECT_TRUE(matchesObjC( ObjCString, + objcCategoryImplDecl(hasName("ABC")))); + EXPECT_TRUE(matchesObjC( + ObjCString, objcMethodDecl(hasName("protoDidThing")))); EXPECT_TRUE(matchesObjC( ObjCString, Index: cfe/trunk/docs/LibASTMatchersReference.html =================================================================== --- cfe/trunk/docs/LibASTMatchersReference.html +++ cfe/trunk/docs/LibASTMatchersReference.html @@ -346,6 +346,15 @@ </pre></td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('objcCategoryImplDecl0')"><a name="objcCategoryImplDecl0Anchor">objcCategoryImplDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCCategoryImplDecl.html">ObjCCategoryImplDecl</a>>...</td></tr> +<tr><td colspan="4" class="doc" id="objcCategoryImplDecl0"><pre>Matches Objective-C category definitions. + +Example matches Foo (Additions) + @implementation Foo (Additions) + @end +</pre></td></tr> + + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>></td><td class="name" onclick="toggle('objcImplementationDecl0')"><a name="objcImplementationDecl0Anchor">objcImplementationDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCImplementationDecl.html">ObjCImplementationDecl</a>>...</td></tr> <tr><td colspan="4" class="doc" id="objcImplementationDecl0"><pre>Matches Objective-C implementation declarations. Index: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h @@ -1178,6 +1178,17 @@ Decl, ObjCCategoryDecl> objcCategoryDecl; +/// \brief Matches Objective-C category definitions. +/// +/// Example matches Foo (Additions) +/// \code +/// @implementation Foo (Additions) +/// @end +/// \endcode +const internal::VariadicDynCastAllOfMatcher< + Decl, + ObjCCategoryImplDecl> objcCategoryImplDecl; + /// \brief Matches Objective-C method declarations. /// /// Example matches both declaration and definition of -[Foo method]
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits