aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.h')
-rw-r--r--lib/CodeGen/CodeGenFunction.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenFunction.h b/lib/CodeGen/CodeGenFunction.h
index b737a9ed7a..8740fd06df 100644
--- a/lib/CodeGen/CodeGenFunction.h
+++ b/lib/CodeGen/CodeGenFunction.h
@@ -854,8 +854,11 @@ public:
/// cleanups.
~LexicalScope() {
if (PopDebugStack) {
- CGDebugInfo *DI = CGF.getDebugInfo();
- if (DI) DI->EmitLexicalBlockEnd(CGF.Builder, Range.getEnd());
+ if (CGDebugInfo *DI = CGF.getDebugInfo()) {
+ if (RunCleanupsScope::requiresCleanups())
+ DI->EmitLocation(CGF.Builder, Range.getEnd());
+ DI->EmitLexicalBlockEnd(CGF.Builder, Range.getEnd());
+ }
}
}
@@ -864,6 +867,8 @@ public:
void ForceCleanup() {
RunCleanupsScope::ForceCleanup();
if (CGDebugInfo *DI = CGF.getDebugInfo()) {
+ if (RunCleanupsScope::requiresCleanups())
+ DI->EmitLocation(CGF.Builder, Range.getEnd());
DI->EmitLexicalBlockEnd(CGF.Builder, Range.getEnd());
PopDebugStack = false;
}