[clang] [analyzer] Untangle subcheckers of CStringChecker (PR #113312)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 22 06:36:08 PDT 2024
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 181cc75ea8be70e3fa7145456e1bf2331e0bc5e4 306e0f0869582a9618f4c871200814c75bc34f56 --extensions cpp,c -- clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp clang/test/Analysis/bstring.cpp clang/test/Analysis/malloc.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 6dd5863909..ad9abc3907 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -583,8 +583,8 @@ ProgramStateRef CStringChecker::CheckLocation(CheckerContext &C,
// chose not to emit a report here. However, as long as our out-of-bounds
// checker is in alpha, lets just pretend nothing happened.
if (!Filter.CheckCStringOutOfBounds) {
- //C.addSink();
- //return nullptr;
+ // C.addSink();
+ // return nullptr;
return state;
}
@@ -710,8 +710,8 @@ ProgramStateRef CStringChecker::CheckOverlap(CheckerContext &C,
// FIXME: We detected a fatal error here, we should stop analysis even if we
// chose not to emit a report here. However, as long as our overlap checker
// is in alpha, lets just pretend nothing happened.
- //C.addSink();
- //return nullptr;
+ // C.addSink();
+ // return nullptr;
return state;
}
@@ -784,8 +784,8 @@ ProgramStateRef CStringChecker::CheckOverlap(CheckerContext &C,
// FIXME: We detected a fatal error here, we should stop analysis even if we
// chose not to emit a report here. However, as long as our overlap checker
// is in alpha, lets just pretend nothing happened.
- //C.addSink();
- //return nullptr;
+ // C.addSink();
+ // return nullptr;
return state;
}
@@ -862,7 +862,7 @@ void CStringChecker::emitOutOfBoundsBug(CheckerContext &C,
StringRef WarningMsg) const {
// FIXME: This is absurd. If a checker is disabled, we just emit the bug
// under another name?
- assert((Filter.CheckCStringOutOfBounds || Filter.CheckCStringNullArg) &&
+ assert((Filter.CheckCStringOutOfBounds || Filter.CheckCStringNullArg) &&
"Can't emit from a checker that is not enabled!");
if (ExplodedNode *N = C.generateErrorNode(State)) {
@@ -933,9 +933,9 @@ void CStringChecker::emitAdditionOverflowBug(CheckerContext &C,
}
ProgramStateRef CStringChecker::checkAdditionOverflow(CheckerContext &C,
- ProgramStateRef state,
- NonLoc left,
- NonLoc right) const {
+ ProgramStateRef state,
+ NonLoc left,
+ NonLoc right) const {
// If a previous check has failed, propagate the failure.
if (!state)
return nullptr;
@@ -974,11 +974,11 @@ ProgramStateRef CStringChecker::checkAdditionOverflow(CheckerContext &C,
if (Filter.CheckCStringOutOfBounds)
emitAdditionOverflowBug(C, stateOverflow);
- // FIXME: We detected a fatal error here, we should stop analysis even if we
- // chose not to emit a report here. However, as long as our overlap checker
- // is in alpha, lets just pretend nothing happened.
- //C.addSink();
- //return nullptr;
+ // FIXME: We detected a fatal error here, we should stop analysis even if
+ // we chose not to emit a report here. However, as long as our overlap
+ // checker is in alpha, lets just pretend nothing happened.
+ // C.addSink();
+ // return nullptr;
return state;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/113312
More information about the cfe-commits
mailing list