[clang] [analyzer] Fix FP for cplusplus.placement new #149240 (PR #150161)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 23 00:16:25 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 -- clang/test/SemaCXX/placement-new-bounds.cpp clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
index 4c4ca15ef..2a57fa2e8 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CheckPlacementNew.cpp
@@ -115,10 +115,10 @@ bool PlacementNewChecker::checkPlaceCapacityIsSufficient(
     if (ExplodedNode *N = C.generateErrorNode(C.getState())) {
       std::string Msg;
       // TODO: use clang constant
-      Msg = std::string(llvm::formatv(
-          "Storage provided to placement new is only {0} bytes, "
-          "whereas the allocated type requires {1} bytes",
-          SizeOfPlaceCI->getValue(), SizeOfTargetCI->getValue()));
+      Msg = std::string(
+          llvm::formatv("Storage provided to placement new is only {0} bytes, "
+                        "whereas the allocated type requires {1} bytes",
+                        SizeOfPlaceCI->getValue(), SizeOfTargetCI->getValue()));
 
       auto R = std::make_unique<PathSensitiveBugReport>(SBT, Msg, N);
       bugreporter::trackExpressionValue(N, NE->getPlacementArg(0), *R);

``````````

</details>


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


More information about the cfe-commits mailing list