Skip to content

Commit a4ded1c

Browse files
Merge pull request #9868 from swiftlang/msamak-chpick-const-eval-expression
Cherry pick commits that relanded commit 34a72d1
2 parents 4302e57 + 56c176f commit a4ded1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clang/lib/Analysis/UnsafeBufferUsage.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,9 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
969969
}
970970

971971
Expr::EvalResult EVResult;
972-
if (Node.getIdx()->EvaluateAsInt(EVResult, Finder->getASTContext())) {
972+
const Expr *IndexExpr = Node.getIdx();
973+
if (!IndexExpr->isValueDependent() &&
974+
IndexExpr->EvaluateAsInt(EVResult, Finder->getASTContext())) {
973975
llvm::APSInt ArrIdx = EVResult.Val.getInt();
974976
// FIXME: ArrIdx.isNegative() we could immediately emit an error as that's a
975977
// bug

0 commit comments

Comments
 (0)