summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-09-11 00:04:36 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-09-11 00:04:36 +0000
commit83876b45947d7656eb3909f912e2ae9593603e00 (patch)
tree72c19e656f36ff0187809910c6ae3d4cacc04b62 /clang/lib/CodeGen
parentaa9326c7e2670c946ed55928bccaad047e2c11a0 (diff)
downloadbcm5719-llvm-83876b45947d7656eb3909f912e2ae9593603e00.tar.gz
bcm5719-llvm-83876b45947d7656eb3909f912e2ae9593603e00.zip
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. llvm-svn: 56080
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index bbe43703cbf..b4eaff83859 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -136,6 +136,8 @@ public:
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 @@ CodeGenTypes::GetFunctionType(ArgTypeIterator begin, ArgTypeIterator end,
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 @@ void CodeGenModule::ConstructParamAttrList(const Decl *TargetDecl,
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()) {
OpenPOWER on IntegriCloud