Skip to content

Commit ed8933d

Browse files
committed
[-Wunsafe-buffer-usage][NFC] clang-format the PR
1 parent 1fdef3b commit ed8933d

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

clang/lib/Analysis/UnsafeBufferUsage.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,26 +411,30 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
411411
// FIXME: Proper solution:
412412
// - refactor Sema::CheckArrayAccess
413413
// - split safe/OOB/unknown decision logic from diagnostics emitting code
414-
// - e. g. "Try harder to find a NamedDecl to point at in the note." already duplicated
414+
// - e. g. "Try harder to find a NamedDecl to point at in the note."
415+
// already duplicated
415416
// - call both from Sema and from here
416417

417-
const DeclRefExpr * BaseDRE = dyn_cast_or_null<DeclRefExpr>(Node.getBase()->IgnoreParenImpCasts());
418+
const DeclRefExpr *BaseDRE =
419+
dyn_cast_or_null<DeclRefExpr>(Node.getBase()->IgnoreParenImpCasts());
418420
if (!BaseDRE)
419421
return false;
420422
if (!BaseDRE->getDecl())
421423
return false;
422424
auto BaseVarDeclTy = BaseDRE->getDecl()->getType();
423425
if (!BaseVarDeclTy->isConstantArrayType())
424426
return false;
425-
const auto * CATy = dyn_cast_or_null<ConstantArrayType>(BaseVarDeclTy);
427+
const auto *CATy = dyn_cast_or_null<ConstantArrayType>(BaseVarDeclTy);
426428
if (!CATy)
427429
return false;
428430
const APInt ArrSize = CATy->getSize();
429431

430-
if (const auto * IdxLit = dyn_cast<IntegerLiteral>(Node.getIdx())) {
432+
if (const auto *IdxLit = dyn_cast<IntegerLiteral>(Node.getIdx())) {
431433
const APInt ArrIdx = IdxLit->getValue();
432-
// FIXME: ArrIdx.isNegative() we could immediately emit an error as that's a bug
433-
if (ArrIdx.isNonNegative() && ArrIdx.getLimitedValue() < ArrSize.getLimitedValue())
434+
// FIXME: ArrIdx.isNegative() we could immediately emit an error as that's a
435+
// bug
436+
if (ArrIdx.isNonNegative() &&
437+
ArrIdx.getLimitedValue() < ArrSize.getLimitedValue())
434438
return true;
435439
}
436440

0 commit comments

Comments
 (0)