aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r--lib/CodeGen/CGCall.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index 24a64cfa44..29104424ac 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -975,7 +975,8 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) {
Builder.CreateRetVoid();
return;
}
-
+
+ llvm::MDNode *RetDbgInfo = 0;
llvm::Value *RV = 0;
QualType RetTy = FI.getReturnType();
const ABIArgInfo &RetAI = FI.getReturnInfo();
@@ -1009,6 +1010,7 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) {
RV = Builder.CreateLoad(ReturnValue);
} else {
// Get the stored value and nuke the now-dead store.
+ RetDbgInfo = SI->getDbgMetadata();
RV = SI->getValueOperand();
SI->eraseFromParent();
@@ -1031,10 +1033,9 @@ void CodeGenFunction::EmitFunctionEpilog(const CGFunctionInfo &FI) {
assert(0 && "Invalid ABI kind for return argument");
}
- if (RV)
- Builder.CreateRet(RV);
- else
- Builder.CreateRetVoid();
+ llvm::Instruction *Ret = RV ? Builder.CreateRet(RV) : Builder.CreateRetVoid();
+ if (RetDbgInfo)
+ Ret->setDbgMetadata(RetDbgInfo);
}
RValue CodeGenFunction::EmitDelegateCallArg(const VarDecl *Param) {