r353490 - [NFC] Variable auto-init: use getAsVariableArrayType helper

JF Bastien via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 7 16:51:05 PST 2019


Author: jfb
Date: Thu Feb  7 16:51:05 2019
New Revision: 353490

URL: http://llvm.org/viewvc/llvm-project?rev=353490&view=rev
Log:
[NFC] Variable auto-init: use getAsVariableArrayType helper

As suggested by @rjmccall in D57797.

Modified:
    cfe/trunk/lib/CodeGen/CGDecl.cpp

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=353490&r1=353489&r2=353490&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Thu Feb  7 16:51:05 2019
@@ -1658,8 +1658,7 @@ void CodeGenFunction::EmitAutoVarInit(co
     // Technically zero-sized or negative-sized VLAs are undefined, and UBSan
     // will catch that code, but there exists code which generates zero-sized
     // VLAs. Be nice and initialize whatever they requested.
-    const VariableArrayType *VlaType =
-        dyn_cast_or_null<VariableArrayType>(getContext().getAsArrayType(type));
+    const auto *VlaType = getContext().getAsVariableArrayType(type);
     if (!VlaType)
       return;
     auto VlaSize = getVLASize(VlaType);




More information about the cfe-commits mailing list