[clang] [ASTMatchers] AST matcher support for ObjC pointers (PR #117021)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 20 10:34:28 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff def22f4e718daa74c2d0c03a32e32d4913a46278 87ba2a10ca7435fdf6b5c47d2c1c97c1e188cfcd --extensions h,cpp -- clang/include/clang/ASTMatchers/ASTMatchers.h clang/include/clang/ASTMatchers/ASTMatchersInternal.h clang/lib/ASTMatchers/ASTMatchersInternal.cpp clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index 2c690275da..04804d5def 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -1116,8 +1116,7 @@ private:
     return matchesDecl(Node.getDecl(), Finder, Builder);
   }
 
-  bool matchesSpecialized(const ObjCInterfaceDecl &Node,
-                          ASTMatchFinder *Finder,
+  bool matchesSpecialized(const ObjCInterfaceDecl &Node, ASTMatchFinder *Finder,
                           BoundNodesTreeBuilder *Builder) const {
     return matchesDecl(Node.getCanonicalDecl(), Finder, Builder);
   }
diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
index 8def98ff6d..d9749a2b14 100644
--- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
+++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp
@@ -1097,7 +1097,8 @@ AST_TYPELOC_TRAVERSE_MATCHER_DEF(hasValueType,
 AST_TYPELOC_TRAVERSE_MATCHER_DEF(
     pointee,
     AST_POLYMORPHIC_SUPPORTED_TYPES(BlockPointerType, MemberPointerType,
-                                    PointerType, ReferenceType, ObjCObjectPointerType));
+                                    PointerType, ReferenceType,
+                                    ObjCObjectPointerType));
 
 const internal::VariadicDynCastAllOfMatcher<Stmt, OMPExecutableDirective>
     ompExecutableDirective;
diff --git a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
index adf8749a64..75d6ca5ba1 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersTraversalTest.cpp
@@ -284,10 +284,9 @@ TEST(HasDeclaration, HasDeclarationOfTypeAlias) {
 }
 
 TEST(HasDeclaration, HasDeclarationOfObjCInterface) {
-  EXPECT_TRUE(matchesObjC(
-      "@interface BaseClass @end void f() {BaseClass* b;}",
-      varDecl(hasType(objcObjectPointerType(pointee(hasDeclaration(
-          objcInterfaceDecl())))))));
+  EXPECT_TRUE(matchesObjC("@interface BaseClass @end void f() {BaseClass* b;}",
+                          varDecl(hasType(objcObjectPointerType(
+                              pointee(hasDeclaration(objcInterfaceDecl())))))));
 }
 
 TEST(HasUnqualifiedDesugaredType, DesugarsUsing) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/117021


More information about the cfe-commits mailing list