=?utf-8?q?Donát?= Nagy <[email protected]>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/[email protected]>
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 cpp,c --
clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
clang/test/Analysis/ArrayBound/assumption-reporting.c
clang/test/Analysis/ArrayBound/verbose-tests.c
``````````
: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/ArrayBoundChecker.cpp
b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
index bcd88f77c..630fc2a0c 100644
--- a/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp
@@ -130,14 +130,16 @@ struct Messages {
std::string Short, Full;
};
-enum class BadOffsetKind {Negative, Overflowing, Indeterminate};
+enum class BadOffsetKind { Negative, Overflowing, Indeterminate };
-constexpr llvm::StringLiteral Adjectives[] = {"a negative", "an overflowing",
"a negative or overflowing"};
+constexpr llvm::StringLiteral Adjectives[] = {"a negative", "an overflowing",
+ "a negative or overflowing"};
StringRef asAdjective(BadOffsetKind Problem) {
return Adjectives[static_cast<int>(Problem)];
}
-constexpr llvm::StringLiteral Prepositions[] = {"preceding", "after the end
of", "around"};
+constexpr llvm::StringLiteral Prepositions[] = {"preceding", "after the end
of",
+ "around"};
StringRef asPreposition(BadOffsetKind Problem) {
return Prepositions[static_cast<int>(Problem)];
}
@@ -420,9 +422,9 @@ static bool tryDividePair(std::optional<int64_t> &Val1,
}
static Messages getNonTaintMsgs(ASTContext &ACtx, const MemSpaceRegion *Space,
- const SubRegion *Region, NonLoc Offset,
- std::optional<NonLoc> Extent, SVal Location,
- BadOffsetKind Problem) {
+ const SubRegion *Region, NonLoc Offset,
+ std::optional<NonLoc> Extent, SVal Location,
+ BadOffsetKind Problem) {
std::string RegName = getRegionName(Space, Region);
const auto *EReg = Location.getAsRegion()->getAs<ElementRegion>();
assert(EReg && "this checker only handles element access");
@@ -471,8 +473,7 @@ static Messages getNonTaintMsgs(ASTContext &ACtx, const
MemSpaceRegion *Space,
}
return {formatv("Out of bound access to memory {0} {1}",
- asPreposition(Problem),
- RegName),
+ asPreposition(Problem), RegName),
std::string(Buf)};
}
@@ -642,7 +643,8 @@ void ArrayBoundChecker::performCheck(const Expr *E,
CheckerContext &C) const {
if (!WithinLowerBound) {
// ...and it cannot be valid (>= 0), so report an error.
Messages Msgs = getNonTaintMsgs(C.getASTContext(), Space, Reg,
- ByteOffset, /*Extent=*/std::nullopt, Location,
BadOffsetKind::Negative);
+ ByteOffset, /*Extent=*/std::nullopt,
+ Location, BadOffsetKind::Negative);
reportOOB(C, PrecedesLowerBound, Msgs, ByteOffset, std::nullopt);
return;
}
@@ -684,10 +686,12 @@ void ArrayBoundChecker::performCheck(const Expr *E,
CheckerContext &C) const {
return;
}
- BadOffsetKind Problem = AlsoMentionUnderflow ?
BadOffsetKind::Indeterminate : BadOffsetKind::Overflowing;
+ BadOffsetKind Problem = AlsoMentionUnderflow
+ ? BadOffsetKind::Indeterminate
+ : BadOffsetKind::Overflowing;
Messages Msgs =
getNonTaintMsgs(C.getASTContext(), Space, Reg, ByteOffset,
- *KnownSize, Location, Problem);
+ *KnownSize, Location, Problem);
reportOOB(C, ExceedsUpperBound, Msgs, ByteOffset, KnownSize);
return;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/158639
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits