]> granicus.if.org Git - clang/commitdiff
ABI: When emitting calls which return an ignored argument, make sure
authorDaniel Dunbar <daniel@zuster.org>
Thu, 29 Jan 2009 08:24:57 +0000 (08:24 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 29 Jan 2009 08:24:57 +0000 (08:24 +0000)
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

lib/CodeGen/CGCall.cpp

index ee854f6ccee75c51db69ecdf3c7356be836ea35a..6ffe8c328ca23b7d69192cf6d9369eb8ecdcc4ec 100644 (file)
@@ -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");