aboutsummaryrefslogtreecommitdiff
path: root/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp')
-rw-r--r--clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp b/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
index 56fbf742..3844f68e 100644
--- a/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
+++ b/clang-tidy/cppcoreguidelines/ProBoundsConstantArrayIndexCheck.cpp
@@ -47,12 +47,12 @@ void ProBoundsConstantArrayIndexCheck::registerMatchers(MatchFinder *Finder) {
// Note: if a struct contains an array member, the compiler-generated
// constructor has an arraySubscriptExpr.
- Finder->addMatcher(arraySubscriptExpr(hasBase(ignoringImpCasts(hasType(
- constantArrayType().bind("type")))),
- hasIndex(expr().bind("index")),
- unless(hasAncestor(isImplicit())))
- .bind("expr"),
- this);
+ Finder->addMatcher(
+ arraySubscriptExpr(
+ hasBase(ignoringImpCasts(hasType(constantArrayType().bind("type")))),
+ hasIndex(expr().bind("index")), unless(hasAncestor(isImplicit())))
+ .bind("expr"),
+ this);
Finder->addMatcher(
cxxOperatorCallExpr(
@@ -112,8 +112,7 @@ void ProBoundsConstantArrayIndexCheck::check(
return;
if (Index.isSigned() && Index.isNegative()) {
- diag(Matched->getExprLoc(),
- "std::array<> index %0 is negative")
+ diag(Matched->getExprLoc(), "std::array<> index %0 is negative")
<< Index.toString(10);
return;
}
@@ -130,8 +129,9 @@ void ProBoundsConstantArrayIndexCheck::check(
// Get uint64_t values, because different bitwidths would lead to an assertion
// in APInt::uge.
if (Index.getZExtValue() >= ArraySize.getZExtValue()) {
- diag(Matched->getExprLoc(), "std::array<> index %0 is past the end of the array "
- "(which contains %1 elements)")
+ diag(Matched->getExprLoc(),
+ "std::array<> index %0 is past the end of the array "
+ "(which contains %1 elements)")
<< Index.toString(10) << ArraySize.toString(10, false);
}
}