[clang] [analyzer] Add an ownership change visitor to StreamChecker (PR #94957)

via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 03:51:56 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 e622996eddfb2826d258b3a3760eed195f97aabe faf00d0e1286e053ba9fb457513bd8309eb541ed -- clang/test/Analysis/stream-visitor.cpp clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index d726ab5eaa..b5681ad83d 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -11,8 +11,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "NoOwnershipChangeVisitor.h"
-#include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
 #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h"
 #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h"
 #include "clang/StaticAnalyzer/Core/Checker.h"
@@ -194,7 +194,7 @@ namespace {
 
 class StreamChecker;
 using FnCheckTy = void(const StreamChecker *, const FnDescription *,
-                                   const CallEvent &, CheckerContext &);
+                       const CallEvent &, CheckerContext &);
 using FnCheck = std::function<FnCheckTy>;
 
 using ArgNoTy = unsigned int;
@@ -346,8 +346,7 @@ private:
        {&StreamChecker::preFreopen, &StreamChecker::evalFreopen, 2}},
       {{CDM::CLibrary, {"tmpfile"}, 0},
        {nullptr, &StreamChecker::evalFopen, ArgNone}},
-      {FCloseDesc,
-       {&StreamChecker::preDefault, &StreamChecker::evalFclose, 0}},
+      {FCloseDesc, {&StreamChecker::preDefault, &StreamChecker::evalFclose, 0}},
       {{CDM::CLibrary, {"fread"}, 4},
        {&StreamChecker::preRead,
         std::bind(&StreamChecker::evalFreadFwrite, _1, _2, _3, _4, true), 3}},

``````````

</details>


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


More information about the cfe-commits mailing list