[clang] [analyzer] Give CStringChecker bug types proper descriptions (PR #219699)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 29 09:48:40 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-static-analyzer-1
Author: anondeveg
<details>
<summary>Changes</summary>
fixed a typo and gave proper bug types descriptions preserving the old categories.
---
Full diff: https://github.com/llvm/llvm-project/pull/219699.diff
1 Files Affected:
- (modified) clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp (+5-9)
``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 9fd8d4880c59f..63c58cc633e5d 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -31,6 +31,7 @@
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/raw_ostream.h"
+#include <clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h>
#include <functional>
#include <optional>
@@ -86,17 +87,12 @@ class CStringChecker
mutable StringRef CurrentFunctionDescription;
public:
- // FIXME: The bug types emitted by this checker family have confused garbage
- // in their Description and Category fields (e.g. `categories::UnixAPI` is
- // passed as the description in several cases and `uninitialized` is mistyped
- // as `unitialized`). This should be cleaned up.
- CheckerFrontendWithBugType NullArg{categories::UnixAPI};
+ CheckerFrontendWithBugType NullArg{"Null pointer argument"};
CheckerFrontendWithBugType OutOfBounds{"Out-of-bound array access"};
- CheckerFrontendWithBugType BufferOverlap{categories::UnixAPI,
- "Improper arguments"};
- CheckerFrontendWithBugType NotNullTerm{categories::UnixAPI};
+ CheckerFrontendWithBugType BufferOverlap{"Overlapping buffers","Improper arguments"};
+ CheckerFrontendWithBugType NotNullTerm{"Not null-terminated string"};
CheckerFrontendWithBugType UninitializedRead{
- "Accessing unitialized/garbage values"};
+ "Accessing uninitialized/garbage values"};
StringRef getDebugTag() const override { return "MallocChecker"; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/219699
More information about the cfe-commits
mailing list