Handle typedefs to VLAs (Emit the size expr when we encounter the typedef

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61290 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index e8084dc..86bc347 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -31,7 +31,6 @@
   default: assert(0 && "Unknown decl kind!");
   case Decl::ParmVar:
     assert(0 && "Parmdecls should not be in declstmts!");
-  case Decl::Typedef:   // typedef int X;
   case Decl::Function:  // void X();
   case Decl::Record:    // struct/union/class X;
   case Decl::Enum:      // enum X;
@@ -46,6 +45,14 @@
            "Should not see file-scope variables inside a function!");
     return EmitBlockVarDecl(VD);
   }
+        
+  case Decl::Typedef: {   // typedef int X;
+    const TypedefDecl &TD = cast<TypedefDecl>(D);
+    QualType Ty = TD.getUnderlyingType();
+    
+    if (Ty->isVariablyModifiedType())
+      EmitVLASize(Ty);
+  }
   }
 }