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 origin/main HEAD --extensions cpp,h -- 
clang-tools-extra/clang-tidy/readability/PointerToRefCheck.cpp 
clang-tools-extra/clang-tidy/readability/PointerToRefCheck.h 
clang-tools-extra/test/clang-tidy/checkers/readability/pointer-to-ref.cpp 
clang-tools-extra/clang-tidy/readability/ReadabilityTidyModule.cpp 
--diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

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

``````````diff
diff --git a/clang-tools-extra/clang-tidy/readability/PointerToRefCheck.cpp 
b/clang-tools-extra/clang-tidy/readability/PointerToRefCheck.cpp
index 12c03f306..81ff1e466 100644
--- a/clang-tools-extra/clang-tidy/readability/PointerToRefCheck.cpp
+++ b/clang-tools-extra/clang-tidy/readability/PointerToRefCheck.cpp
@@ -24,8 +24,7 @@ namespace {
 ///   - Pointer arithmetic
 ///   - Being passed to other functions as a pointer
 ///   - Address-of or array subscript usage
-class PointerUsageVisitor
-    : public RecursiveASTVisitor<PointerUsageVisitor> {
+class PointerUsageVisitor : public RecursiveASTVisitor<PointerUsageVisitor> {
 public:
   explicit PointerUsageVisitor(const ParmVarDecl *Param) : Param(Param) {}
 
@@ -65,8 +64,7 @@ public:
     }
 
     // Pointer comparison (relational).
-    if (BO->isRelationalOp() &&
-        (refersToParam(LHS) || refersToParam(RHS)))
+    if (BO->isRelationalOp() && (refersToParam(LHS) || refersToParam(RHS)))
       UsedAsPointer = true;
 
     // Pointer arithmetic: ptr + n, ptr - n.
@@ -83,10 +81,9 @@ public:
 
   // Detect being passed to a function expecting a pointer.
   bool VisitCallExpr(const CallExpr *CE) {
-    for (unsigned I = 0; I < CE->getNumArgs(); ++I) {
+    for (unsigned I = 0; I < CE->getNumArgs(); ++I)
       if (refersToParam(CE->getArg(I)->IgnoreImplicit()))
         UsedAsPointer = true;
-    }
     return true;
   }
 
@@ -137,12 +134,10 @@ void PointerToRefCheck::registerMatchers(MatchFinder 
*Finder) {
   // Match function definitions with at least one pointer parameter.
   // Match each pointer parameter individually.
   Finder->addMatcher(
-      parmVarDecl(
-          hasType(pointerType()),
-          hasAncestor(functionDecl(isDefinition(),
-                                   unless(isImplicit()),
-                                   unless(isDeleted()))
-                          .bind("func")))
+      parmVarDecl(hasType(pointerType()),
+                  hasAncestor(functionDecl(isDefinition(), 
unless(isImplicit()),
+                                           unless(isDeleted()))
+                                  .bind("func")))
           .bind("param"),
       this);
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/182068
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to