summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCall.cpp
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
commit6660c8a4cc2115929d92be83bbc54c307002a321 (patch)
tree05fb7dac2a55feaf5bd5e193a8816f9d361d5a12 /lib/CodeGen/CGCall.cpp
parent637cebb67c59765e1412c589550c8c9ba001baeb (diff)
downloadclang-6660c8a4cc2115929d92be83bbc54c307002a321.tar.gz
clang-6660c8a4cc2115929d92be83bbc54c307002a321.tar.bz2
clang-6660c8a4cc2115929d92be83bbc54c307002a321.tar.xz
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
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r--lib/CodeGen/CGCall.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index bbe43703cb..b4eaff8385 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/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()) {