Make sure to generate code for arguments that have a variably modified type.

llvm-svn: 61288
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 6f32553..73b71b2 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -131,6 +131,16 @@
   }
 
   EmitFunctionProlog(CurFn, FnRetTy, Args);
+  
+  // If any of the arguments have a variably modified type, make sure to
+  // emit the type size.
+  for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end();
+       i != e; ++i) {
+    QualType Ty = i->second;
+
+    if (Ty->isVariablyModifiedType())
+      EmitVLASize(Ty);
+  }
 }
 
 void CodeGenFunction::GenerateCode(const FunctionDecl *FD,