Skip to content

Commit c1cfa18

Browse files
author
mxms
committed
Remove integer literal check
Simplifies the logic, as per recommendation by rnk@
1 parent 2ffd0df commit c1cfa18

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

clang/lib/Analysis/UnsafeBufferUsage.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -463,16 +463,6 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
463463
size = SLiteral->getLength() + 1;
464464
}
465465

466-
if (const auto *IdxLit = dyn_cast<IntegerLiteral>(Node.getIdx())) {
467-
const APInt ArrIdx = IdxLit->getValue();
468-
// FIXME: ArrIdx.isNegative() we could immediately emit an error as that's a
469-
// bug
470-
if (ArrIdx.isNonNegative() && ArrIdx.getLimitedValue() < size)
471-
return true;
472-
}
473-
474-
// Array index wasn't an integer literal, let's see if it was an enum or
475-
// something similar
476466
const auto IntConst = Node.getIdx()->getIntegerConstantExpr(Finder->getASTContext());
477467
if (IntConst && 0 <= *IntConst && *IntConst < size) {
478468
return true;

0 commit comments

Comments
 (0)