[-Wunsafe-buffer-usage] Fix warning after #102953

This commit is contained in:
Fangrui Song 2024-08-15 14:17:26 -07:00
parent c1a750b8bf
commit 99313575b6

View File

@ -2797,8 +2797,7 @@ fixVariable(const VarDecl *VD, FixitStrategy::Kind K,
return {};
}
case FixitStrategy::Kind::Array: {
if (VD->isLocalVarDecl())
if (auto CAT = Ctx.getAsConstantArrayType(VD->getType()))
if (VD->isLocalVarDecl() && Ctx.getAsConstantArrayType(VD->getType()))
return fixVariableWithArray(VD, Tracker, Ctx, Handler);
DEBUG_NOTE_DECL_FAIL(VD, " : not a local const-size array");