From 751358ff73b155f5384e151e1d18aa3f6e7b061c Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sat, 20 Dec 2008 21:28:43 +0000 Subject: [PATCH] Make sure to generate code for arguments that have a variably modified type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61288 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 6f32553118..73b71b2f62 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -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, -- 2.50.1