Emit debug region end in unified return block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59081 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 1a26610..bcd1e09 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -70,18 +70,19 @@
// Finish emission of indirect switches.
EmitIndirectSwitches();
- // Emit debug descriptor for function end.
- if (CGDebugInfo *DI = CGM.getDebugInfo()) {
- DI->setLocation(EndLoc);
- DI->EmitRegionEnd(CurFn, Builder);
- }
-
assert(BreakContinueStack.empty() &&
"mismatched push/pop in break/continue stack!");
// Emit function epilog (to return). This has the nice side effect
// of also automatically handling code that falls off the end.
EmitBlock(ReturnBlock);
+
+ // Emit debug descriptor for function end.
+ if (CGDebugInfo *DI = CGM.getDebugInfo()) {
+ DI->setLocation(EndLoc);
+ DI->EmitRegionEnd(CurFn, Builder);
+ }
+
EmitFunctionEpilog(FnRetTy, ReturnValue);
// Remove the AllocaInsertPt instruction, which is just a convenience for us.