summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-05-20 05:54:35 +0000
committerDouglas Gregor <dgregor@apple.com>2010-05-20 05:54:35 +0000
commitaa2ac80eaaaea7d99e1efecf52abb4b167dc11c8 (patch)
tree5a0dd6fcd0575d8af615c491b9d8b5643e7a7734 /clang/lib
parentc53cc4f8bff66f88b4c612135ea878eb070aa08e (diff)
downloadbcm5719-llvm-aa2ac80eaaaea7d99e1efecf52abb4b167dc11c8.tar.gz
bcm5719-llvm-aa2ac80eaaaea7d99e1efecf52abb4b167dc11c8.zip
When creating a this-adjustment thunk where the return value is of C++
class type (that uses a return slot), pass the return slot to the callee directly rather than allocating new storage and trying to copy the object. This appears to have been the cause of the remaining two Boost.Interprocess failures. llvm-svn: 104215
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGVTables.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index 368e2483c86..3c9b45ba8c1 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -2657,8 +2657,15 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn, GlobalDecl GD,
CGM.getTypes().getFunctionInfo(ResultType, CallArgs,
FPT->getExtInfo());
+ // Determine whether we have a return value slot to use.
+ ReturnValueSlot Slot;
+ if (!ResultType->isVoidType() &&
+ FnInfo.getReturnInfo().getKind() == ABIArgInfo::Indirect &&
+ hasAggregateLLVMType(CurFnInfo->getReturnType()))
+ Slot = ReturnValueSlot(ReturnValue, ResultType.isVolatileQualified());
+
// Now emit our call.
- RValue RV = EmitCall(FnInfo, Callee, ReturnValueSlot(), CallArgs, MD);
+ RValue RV = EmitCall(FnInfo, Callee, Slot, CallArgs, MD);
if (!Thunk.Return.isEmpty()) {
// Emit the return adjustment.
@@ -2701,7 +2708,7 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn, GlobalDecl GD,
RV = RValue::get(ReturnValue);
}
- if (!ResultType->isVoidType())
+ if (!ResultType->isVoidType() && Slot.isNull())
EmitReturnOfRValue(RV, ResultType);
FinishFunction();
OpenPOWER on IntegriCloud