[clang] [analyzer] Check the correct first and last elements in cstring.UninitializedRead (PR #95408)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 1 04:30:08 PDT 2024
=?utf-8?q?Kristóf?= Umann <dkszelethus at gmail.com>,
=?utf-8?q?Kristóf?= Umann <dkszelethus at gmail.com>,
=?utf-8?q?Kristóf?= Umann <dkszelethus at gmail.com>,
=?utf-8?q?Kristóf?= Umann <dkszelethus at gmail.com>,
=?utf-8?q?Kristóf?= Umann <dkszelethus at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/95408 at github.com>
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 d78211912391b724a064ef017dbf239eff10380a d37f0cb4ceb0f99947be4ee65564b257dc095e6e -- clang/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp clang/lib/StaticAnalyzer/Core/MemRegion.cpp clang/test/Analysis/bstring_UninitRead.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 9fe53a0bcb..8dd08f14b2 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -359,12 +359,12 @@ REGISTER_MAP_WITH_PROGRAMSTATE(CStringLength, const MemRegion *, SVal)
// Individual checks and utility methods.
//===----------------------------------------------------------------------===//
-std::pair<ProgramStateRef , ProgramStateRef >
+std::pair<ProgramStateRef, ProgramStateRef>
CStringChecker::assumeZero(CheckerContext &C, ProgramStateRef State, SVal V,
QualType Ty) {
std::optional<DefinedSVal> val = V.getAs<DefinedSVal>();
if (!val)
- return std::pair<ProgramStateRef , ProgramStateRef >(State, State);
+ return std::pair<ProgramStateRef, ProgramStateRef>(State, State);
SValBuilder &svalBuilder = C.getSValBuilder();
DefinedOrUnknownSVal zero = svalBuilder.makeZeroVal(Ty);
``````````
</details>
https://github.com/llvm/llvm-project/pull/95408
More information about the cfe-commits
mailing list