[clang] [clang][analyzer] Add StreamChecker note tags for "indeterminate stream position". (PR #83288)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 28 08:43:45 PST 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 9e1432069555d70e1f0148742e565b31d3ba8695 0d8b058dd8de3b29888f76554fca2d920410a4d7 -- clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp clang/test/Analysis/stream-note.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
index f3c3b0ce6d..5ad04ca8bf 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp
@@ -245,7 +245,9 @@ public:
PointerEscapeKind Kind) const;
const BugType *getBT_StreamEof() const { return &BT_StreamEof; }
- const BugType *getBT_IndeterminatePosition() const { return &BT_IndeterminatePosition; }
+ const BugType *getBT_IndeterminatePosition() const {
+ return &BT_IndeterminatePosition;
+ }
const NoteTag *constructSetEofNoteTag(CheckerContext &C,
SymbolRef StreamSym) const {
@@ -261,7 +263,7 @@ public:
}
const NoteTag *constructSetErrorNoteTag(CheckerContext &C,
- SymbolRef StreamSym) const {
+ SymbolRef StreamSym) const {
return C.getNoteTag([this, StreamSym](PathSensitiveBugReport &BR) {
if (!BR.isInteresting(StreamSym) ||
&BR.getBugType() != this->getBT_IndeterminatePosition())
@@ -274,7 +276,7 @@ public:
}
const NoteTag *constructSetEofOrErrorNoteTag(CheckerContext &C,
- SymbolRef StreamSym) const {
+ SymbolRef StreamSym) const {
return C.getNoteTag([this, StreamSym](PathSensitiveBugReport &BR) {
if (!BR.isInteresting(StreamSym))
return "";
@@ -526,7 +528,7 @@ private:
/// Generate a message for BugReporterVisitor if the stored symbol is
/// marked as interesting by the actual bug report.
const NoteTag *constructLeakNoteTag(CheckerContext &C, SymbolRef StreamSym,
- const std::string &Message) const {
+ const std::string &Message) const {
return C.getNoteTag([this, StreamSym,
Message](PathSensitiveBugReport &BR) -> std::string {
if (BR.isInteresting(StreamSym) && &BR.getBugType() == &BT_ResourceLeak)
@@ -645,7 +647,8 @@ struct StreamOperationEvaluator {
return C.getConstraintManager().assumeDual(State, RetVal);
}
- const NoteTag *getStreamErrorNoteTag(const StreamChecker *Ch, CheckerContext &C) {
+ const NoteTag *getStreamErrorNoteTag(const StreamChecker *Ch,
+ CheckerContext &C) {
bool SetFeof = NewES.FEof && !SS->ErrorState.FEof;
bool SetFerror = NewES.FError && !SS->ErrorState.FError;
if (SetFeof && !SetFerror)
``````````
</details>
https://github.com/llvm/llvm-project/pull/83288
More information about the cfe-commits
mailing list