[PATCH] D37643: Add objcImplementationDecl matcher

Dave Lee via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 10 14:01:39 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL312889: Add objcImplementationDecl matcher (authored by kastiglione).

Changed prior to commit:
  https://reviews.llvm.org/D37643?vs=114442&id=114526#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D37643

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
@@ -374,6 +374,7 @@
   REGISTER_MATCHER(numSelectorArgs);
   REGISTER_MATCHER(ofClass);
   REGISTER_MATCHER(objcCategoryDecl);
+  REGISTER_MATCHER(objcImplementationDecl);
   REGISTER_MATCHER(objcInterfaceDecl);
   REGISTER_MATCHER(objcIvarDecl);
   REGISTER_MATCHER(objcMessageExpr);
Index: cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
===================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -1612,6 +1612,9 @@
     objcProtocolDecl(hasName("Proto"))));
   EXPECT_TRUE(matchesObjC(
     ObjCString,
+    objcImplementationDecl(hasName("Thing"))));
+  EXPECT_TRUE(matchesObjC(
+    ObjCString,
     objcCategoryDecl(hasName("ABC"))));
   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('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.
+
+Example matches Foo
+  @implementation Foo
+  @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('objcInterfaceDecl0')"><a name="objcInterfaceDecl0Anchor">objcInterfaceDecl</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCInterfaceDecl.html">ObjCInterfaceDecl</a>>...</td></tr>
 <tr><td colspan="4" class="doc" id="objcInterfaceDecl0"><pre>Matches Objective-C interface declarations.
 
Index: cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
===================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchers.h
@@ -1145,6 +1145,17 @@
   Decl,
   ObjCInterfaceDecl> objcInterfaceDecl;
 
+/// \brief Matches Objective-C implementation declarations.
+///
+/// Example matches Foo
+/// \code
+///   @implementation Foo
+///   @end
+/// \endcode
+const internal::VariadicDynCastAllOfMatcher<
+  Decl,
+  ObjCImplementationDecl> objcImplementationDecl;
+
 /// \brief Matches Objective-C protocol declarations.
 ///
 /// Example matches FooDelegate


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37643.114526.patch
Type: text/x-patch
Size: 2995 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170910/1bbce9b6/attachment.bin>


More information about the cfe-commits mailing list