]> granicus.if.org Git - clang/commitdiff
Make sure to generate code for arguments that have a variably modified type.
authorAnders Carlsson <andersca@mac.com>
Sat, 20 Dec 2008 21:28:43 +0000 (21:28 +0000)
committerAnders Carlsson <andersca@mac.com>
Sat, 20 Dec 2008 21:28:43 +0000 (21:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61288 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp

index 6f32553118b61750aad8ee43f07dffe3f14684ca..73b71b2f6260baaa166d317c745d2921a57c7678 100644 (file)
@@ -131,6 +131,16 @@ void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy,
   }
 
   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,