summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-24 17:30:16 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-24 17:30:16 +0000
commit8fb87aec78b52b6133b4359c24c2407431e8c2a4 (patch)
tree9f6e911138ca10f3d9efaef0f8ff6469daa8b99e /clang/lib/CodeGen/CodeGenFunction.h
parentcbb421887de951f0d689415522430fcad3c764fd (diff)
downloadbcm5719-llvm-8fb87aec78b52b6133b4359c24c2407431e8c2a4.tar.gz
bcm5719-llvm-8fb87aec78b52b6133b4359c24c2407431e8c2a4.zip
Patch implements passing arrays to functions expecting
vla. Implements pr7827. llvm-svn: 114737
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h20
1 files changed, 17 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index 74037111552..8dc8ac1e3d2 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/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));
}
OpenPOWER on IntegriCloud