Bug fix, apply default argument promotion in message sends for which
no method declaration was found.
- This was allowing arrays to pass "by value" among other things.
Add assert in CodeGen that arguments cannot have array type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56080 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index bbe4370..b4eaff8 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -136,6 +136,8 @@
static ABIArgInfo classifyReturnType(QualType RetTy,
ASTContext &Context) {
+ assert(!RetTy->isArrayType() &&
+ "Array types cannot be passed directly.");
if (CodeGenFunction::hasAggregateLLVMType(RetTy)) {
uint64_t Size = Context.getTypeSize(RetTy);
if (Size == 8) {
@@ -198,6 +200,8 @@
for (++begin; begin != end; ++begin) {
const llvm::Type *Ty = ConvertType(*begin);
+ assert(!(*begin)->isArrayType() &&
+ "Array types cannot be passed directly.");
if (Ty->isSingleValueType())
ArgTys.push_back(Ty);
else
@@ -254,6 +258,8 @@
for (++begin; begin != end; ++begin, ++Index) {
QualType ParamType = *begin;
unsigned ParamAttrs = 0;
+ assert(!ParamType->isArrayType() &&
+ "Array types cannot be passed directly.");
if (ParamType->isRecordType())
ParamAttrs |= llvm::ParamAttr::ByVal;
if (ParamType->isPromotableIntegerType()) {