[clang] [clang][Analyzer] Fix error path of builtin overflow (PR #136345)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 18 12:06:24 PDT 2025


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 HEAD~1 HEAD --extensions cpp,c -- clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp clang/test/Analysis/builtin_overflow.c clang/test/Analysis/builtin_overflow_notes.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
index a2f6172ca..4dd692b5f 100644
--- a/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/BuiltinFunctionChecker.cpp
@@ -121,10 +121,9 @@ private:
 } // namespace
 
 const NoteTag *BuiltinFunctionChecker::createBuiltinOverflowNoteTag(
-    CheckerContext &C, bool overflow, SVal Arg1, SVal Arg2,
-    SVal Result) const {
-  return C.getNoteTag([Result, Arg1, Arg2, overflow](
-                          PathSensitiveBugReport &BR, llvm::raw_ostream &OS) {
+    CheckerContext &C, bool overflow, SVal Arg1, SVal Arg2, SVal Result) const {
+  return C.getNoteTag([Result, Arg1, Arg2, overflow](PathSensitiveBugReport &BR,
+                                                     llvm::raw_ostream &OS) {
     if (!BR.isInteresting(Result))
       return;
 
@@ -200,10 +199,9 @@ void BuiltinFunctionChecker::handleOverflowBuiltin(const CallEvent &Call,
         NewState = addTaint(NewState, *L);
     }
 
-    C.addTransition(
-        NewState,
-        createBuiltinOverflowNoteTag(
-            C, /*overflow=*/isOverflow, Arg1, Arg2, RetVal));
+    C.addTransition(NewState,
+                    createBuiltinOverflowNoteTag(C, /*overflow=*/isOverflow,
+                                                 Arg1, Arg2, RetVal));
   };
 
   if (NotOverflow)

``````````

</details>


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


More information about the cfe-commits mailing list