From: Daniel Dunbar Date: Thu, 29 Jan 2009 08:24:57 +0000 (+0000) Subject: ABI: When emitting calls which return an ignored argument, make sure X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc039fea2e985214e00387ce7404d358f56cf301;p=clang ABI: When emitting calls which return an ignored argument, make sure to still return an RValue of the correct type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63294 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index ee854f6cce..6ffe8c328c 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -1256,7 +1256,14 @@ RValue CodeGenFunction::EmitCall(llvm::Value *Callee, return RValue::get(RetTy->isVoidType() ? 0 : CI); case ABIArgInfo::Ignore: - return RValue::get(0); + if (RetTy->isVoidType()) + return RValue::get(0); + if (CodeGenFunction::hasAggregateLLVMType(RetTy)) { + llvm::Value *Res = + llvm::UndefValue::get(llvm::PointerType::getUnqual(ConvertType(RetTy))); + return RValue::getAggregate(Res); + } + return RValue::get(llvm::UndefValue::get(ConvertType(RetTy))); case ABIArgInfo::Coerce: { llvm::Value *V = CreateTempAlloca(ConvertType(RetTy), "coerce");