forked from OSchip/llvm-project
[NFC] Variable auto-init: use getAsVariableArrayType helper
As suggested by @rjmccall in D57797. llvm-svn: 353490
This commit is contained in:
parent
c782f18835
commit
ddeb2f2a16
|
@ -1658,8 +1658,7 @@ void CodeGenFunction::EmitAutoVarInit(const AutoVarEmission &emission) {
|
||||||
// Technically zero-sized or negative-sized VLAs are undefined, and UBSan
|
// Technically zero-sized or negative-sized VLAs are undefined, and UBSan
|
||||||
// will catch that code, but there exists code which generates zero-sized
|
// will catch that code, but there exists code which generates zero-sized
|
||||||
// VLAs. Be nice and initialize whatever they requested.
|
// VLAs. Be nice and initialize whatever they requested.
|
||||||
const VariableArrayType *VlaType =
|
const auto *VlaType = getContext().getAsVariableArrayType(type);
|
||||||
dyn_cast_or_null<VariableArrayType>(getContext().getAsArrayType(type));
|
|
||||||
if (!VlaType)
|
if (!VlaType)
|
||||||
return;
|
return;
|
||||||
auto VlaSize = getVLASize(VlaType);
|
auto VlaSize = getVLASize(VlaType);
|
||||||
|
|
Loading…
Reference in New Issue