[clang] [analyzer] Factor out NoOwnershipChangeVisitor (PR #94357)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 4 07:47:18 PDT 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 703e83611cd8bb7174ae76ba2e301f5a5e88b905 b6beb7098bb8e5148fe0467dc976506ff6691f15 -- clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.cpp clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.h clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 41dd9cf3e68..4e7e88b93ca 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -731,7 +731,6 @@ private:
 namespace {
 class NoMemOwnershipChangeVisitor final : public NoOwnershipChangeVisitor {
 protected:
-
   /// Syntactically checks whether the callee is a deallocating function. Since
   /// we have no path-sensitive information on this call (we would need a
   /// CallEvent instead of a CallExpr for that), its possible that a
@@ -797,7 +796,6 @@ public:
   NoMemOwnershipChangeVisitor(SymbolRef Sym, const MallocChecker *Checker)
       : NoOwnershipChangeVisitor(Sym, Checker) {}
 
-
   void Profile(llvm::FoldingSetNodeID &ID) const override {
     static int Tag = 0;
     ID.AddPointer(&Tag);
diff --git a/clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.h b/clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.h
index 04c1cd80ffc..027f1a156a7 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.h
+++ b/clang/lib/StaticAnalyzer/Checkers/NoOwnershipChangeVisitor.h
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "clang/StaticAnalyzer/Core/Checker.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
+#include "clang/StaticAnalyzer/Core/Checker.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState_Fwd.h"
 
 namespace clang {
@@ -37,18 +37,16 @@ protected:
 
   virtual PathDiagnosticPieceRef emitNote(const ExplodedNode *N) = 0;
 
-  PathDiagnosticPieceRef
-  maybeEmitNoteForObjCSelf(PathSensitiveBugReport &R,
-                           const ObjCMethodCall &Call,
-                           const ExplodedNode *N) final {
+  PathDiagnosticPieceRef maybeEmitNoteForObjCSelf(PathSensitiveBugReport &R,
+                                                  const ObjCMethodCall &Call,
+                                                  const ExplodedNode *N) final {
     // TODO: Implement.
     return nullptr;
   }
 
-  PathDiagnosticPieceRef
-  maybeEmitNoteForCXXThis(PathSensitiveBugReport &R,
-                          const CXXConstructorCall &Call,
-                          const ExplodedNode *N) final {
+  PathDiagnosticPieceRef maybeEmitNoteForCXXThis(PathSensitiveBugReport &R,
+                                                 const CXXConstructorCall &Call,
+                                                 const ExplodedNode *N) final {
     // TODO: Implement.
     return nullptr;
   }
@@ -57,6 +55,7 @@ protected:
   PathDiagnosticPieceRef
   maybeEmitNoteForParameters(PathSensitiveBugReport &R, const CallEvent &Call,
                              const ExplodedNode *N) final;
+
 public:
   using OwnerSet = llvm::SmallPtrSet<const MemRegion *, 8>;
 

``````````

</details>


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


More information about the cfe-commits mailing list