Implement allocation and sizeof VLAs. This is very basic for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60943 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 7f417b3..857a40e 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -663,7 +663,14 @@
   if (TypeToSize->isVoidType() || TypeToSize->isFunctionType())
     return llvm::ConstantInt::get(llvm::APInt(ResultWidth, 1));
   
-  /// FIXME: This doesn't handle VLAs yet!
+  if (const VariableArrayType *VAT = 
+        CGF.getContext().getAsVariableArrayType(TypeToSize)) {
+    if (E->isSizeOf())
+      return CGF.GetVLASize(VAT);
+    else
+      assert(0 && "alignof VLAs not implemented yet");
+  }
+  
   std::pair<uint64_t, unsigned> Info = CGF.getContext().getTypeInfo(TypeToSize);
   
   uint64_t Val = E->isSizeOf() ? Info.first : Info.second;