[clang] [analyzer] Standardize diagnostic messages that contained multiple sentences (PR #237410)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 30 14:48:11 PDT 2026


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 c,cpp -- clang/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp clang/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp clang/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp clang/lib/StaticAnalyzer/Checkers/MIGChecker.cpp clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp clang/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp clang/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp clang/lib/StaticAnalyzer/Checkers/WebKit/RetainPtrCtorAdoptChecker.cpp clang/test/Analysis/CheckThatArraySubsciptNodeIsNotCollected.cpp clang/test/Analysis/c11lock.c clang/test/Analysis/cstring-syntax.c clang/test/Analysis/fuchsia_lock.c clang/test/Analysis/mmap-writeexec.c clang/test/Analysis/osobject-retain-release.cpp clang/test/Analysis/padding_message.cpp clang/test/Analysis/pthreadlock.c clang/test/Analysis/security-syntax-checks.c clang/test/Analysis/std-c-library-functions-arg-constraints-notes.cpp clang/test/Analysis/stream-note.c clang/test/Analysis/stream-notes-missing-close.cpp clang/test/Analysis/stream.c clang/test/Analysis/stream.cpp clang/test/Analysis/void-call-exit-modelling.c --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/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp
index 1ba3d75d1..8ac980433 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp
@@ -228,8 +228,10 @@ void WalkAST::VisitCallExpr(CallExpr *CE) {
       llvm::raw_svector_ostream os(S);
       os << "Potential buffer overflow; ";
       if (!DstName.empty()) {
-        os << "replace with 'sizeof(" << DstName << ") "
-              "- strlen(" << DstName <<") - 1'";
+        os << "replace with 'sizeof(" << DstName
+           << ") "
+              "- strlen("
+           << DstName << ") - 1'";
         os << " or u";
       } else
         os << "u";

``````````

</details>


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


More information about the cfe-commits mailing list