diff options
author | John McCall <rjmccall@apple.com> | 2013-03-01 01:24:35 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-03-01 01:24:35 +0000 |
commit | 07e60263dd4da550d3c38dee37cbc346dc2d9660 (patch) | |
tree | 802bdd615a84ede692896b1b239740ac12c1192c /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 28dc83ceb32009d5ac67d62135ed64b0f729c161 (diff) | |
download | bcm5719-llvm-07e60263dd4da550d3c38dee37cbc346dc2d9660.tar.gz bcm5719-llvm-07e60263dd4da550d3c38dee37cbc346dc2d9660.zip |
Re-use bit from superclass and extract stuff into a local
function. Serves a patch we're kicking around out-of-tree.
llvm-svn: 176327
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index e64498859c4..f955db637ca 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -796,7 +796,9 @@ public: class RunCleanupsScope { EHScopeStack::stable_iterator CleanupStackDepth; bool OldDidCallStackSave; + protected: bool PerformCleanup; + private: RunCleanupsScope(const RunCleanupsScope &) LLVM_DELETED_FUNCTION; void operator=(const RunCleanupsScope &) LLVM_DELETED_FUNCTION; @@ -840,7 +842,6 @@ public: class LexicalScope: protected RunCleanupsScope { SourceRange Range; - bool PopDebugStack; LexicalScope(const LexicalScope &) LLVM_DELETED_FUNCTION; void operator=(const LexicalScope &) LLVM_DELETED_FUNCTION; @@ -848,7 +849,7 @@ public: public: /// \brief Enter a new cleanup scope. explicit LexicalScope(CodeGenFunction &CGF, SourceRange Range) - : RunCleanupsScope(CGF), Range(Range), PopDebugStack(true) { + : RunCleanupsScope(CGF), Range(Range) { if (CGDebugInfo *DI = CGF.getDebugInfo()) DI->EmitLexicalBlockStart(CGF.Builder, Range.getBegin()); } @@ -856,20 +857,20 @@ public: /// \brief Exit this cleanup scope, emitting any accumulated /// cleanups. ~LexicalScope() { - if (PopDebugStack) { - CGDebugInfo *DI = CGF.getDebugInfo(); - if (DI) DI->EmitLexicalBlockEnd(CGF.Builder, Range.getEnd()); - } + if (PerformCleanup) endLexicalScope(); } /// \brief Force the emission of cleanups now, instead of waiting /// until this object is destroyed. void ForceCleanup() { + endLexicalScope(); RunCleanupsScope::ForceCleanup(); - if (CGDebugInfo *DI = CGF.getDebugInfo()) { + } + + private: + void endLexicalScope() { + if (CGDebugInfo *DI = CGF.getDebugInfo()) DI->EmitLexicalBlockEnd(CGF.Builder, Range.getEnd()); - PopDebugStack = false; - } } }; |