diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-24 17:30:16 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-09-24 17:30:16 +0000 |
commit | 745da3a5bb4ea35f93f50301e7fbbb7d78d3b6bb (patch) | |
tree | d2de835a949cf37da086500c49d5421662dea3c5 /lib/CodeGen/CodeGenFunction.h | |
parent | 51c7a789b17d708617946d5f9fde0a2e4feaefd1 (diff) |
Patch implements passing arrays to functions expecting
vla. Implements pr7827.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114737 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h index 7403711155..8dc8ac1e3d 100644 --- a/lib/CodeGen/CodeGenFunction.h +++ b/lib/CodeGen/CodeGenFunction.h @@ -1714,12 +1714,26 @@ private: E = CallArgTypeInfo->arg_type_end(); I != E; ++I, ++Arg) { assert(Arg != ArgEnd && "Running over edge of argument list!"); QualType ArgType = *I; - +#ifndef NDEBUG + QualType ActualArgType = Arg->getType(); + if (ArgType->isPointerType() && ActualArgType->isPointerType()) { + QualType ActualBaseType = + ActualArgType->getAs<PointerType>()->getPointeeType(); + QualType ArgBaseType = + ArgType->getAs<PointerType>()->getPointeeType(); + if (ArgBaseType->isVariableArrayType()) { + if (const VariableArrayType *VAT = + getContext().getAsVariableArrayType(ActualBaseType)) { + if (!VAT->getSizeExpr()) + ActualArgType = ArgType; + } + } + } assert(getContext().getCanonicalType(ArgType.getNonReferenceType()). getTypePtr() == - getContext().getCanonicalType(Arg->getType()).getTypePtr() && + getContext().getCanonicalType(ActualArgType).getTypePtr() && "type mismatch in call argument!"); - +#endif Args.push_back(std::make_pair(EmitCallArg(*Arg, ArgType), ArgType)); } |