When evaluating variably modified types for function parameters, dig out the
type as written from the ParmVarDecl; it's unclear whether the standard (C99 6.9.1p10) requires this, but we're following the precedent set by gcc, and hopefully nobody will ever ask about this again. PR9559 / <rdar://problem/12621983>. llvm-svn: 167985
This commit is contained in:
@@ -454,7 +454,16 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
|
||||
// emit the type size.
|
||||
for (FunctionArgList::const_iterator i = Args.begin(), e = Args.end();
|
||||
i != e; ++i) {
|
||||
QualType Ty = (*i)->getType();
|
||||
const VarDecl *VD = *i;
|
||||
|
||||
// Dig out the type as written from ParmVarDecls; it's unclear whether
|
||||
// the standard (C99 6.9.1p10) requires this, but we're following the
|
||||
// precedent set by gcc.
|
||||
QualType Ty;
|
||||
if (const ParmVarDecl *PVD = dyn_cast<ParmVarDecl>(VD))
|
||||
Ty = PVD->getOriginalType();
|
||||
else
|
||||
Ty = VD->getType();
|
||||
|
||||
if (Ty->isVariablyModifiedType())
|
||||
EmitVariablyModifiedType(Ty);
|
||||
|
||||
Reference in New Issue
Block a user