diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp index c064aa30e8aed..c51398698922b 100644 --- a/clang/lib/Analysis/UnsafeBufferUsage.cpp +++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp @@ -930,7 +930,7 @@ AST_MATCHER(CallExpr, hasUnsafeSnprintfBuffer) { // The array element type must be compatible with `char` otherwise an // explicit cast will be needed, which will make this check unreachable. // Therefore, the array extent is same as its' bytewise size. - if (Size->EvaluateAsConstantExpr(ER, Ctx)) { + if (Size->EvaluateAsInt(ER, Ctx)) { APSInt EVal = ER.Val.getInt(); // Size must have integer type return APSInt::compareValues(EVal, APSInt(CAT->getSize(), true)) != 0;