diff options
author | John McCall <rjmccall@apple.com> | 2010-07-13 23:19:49 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-13 23:19:49 +0000 |
commit | 11e577b99a871f1b921063ae98b401fc1bcf3087 (patch) | |
tree | 5294155dc6399838d591aae690197146e53509c8 /clang/lib/CodeGen | |
parent | 51954276ccee058ba3e82f41fb09e77da39d2d85 (diff) | |
download | bcm5719-llvm-11e577b99a871f1b921063ae98b401fc1bcf3087.tar.gz bcm5719-llvm-11e577b99a871f1b921063ae98b401fc1bcf3087.zip |
Work around an obnoxious GCC warning by changing semantics in a hopefully-
harmless way.
llvm-svn: 108295
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 19 |
2 files changed, 15 insertions, 8 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index bfe00ea158a..4980aad1b38 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -1541,4 +1541,6 @@ CodeGenFunction::CleanupBlock::~CleanupBlock() { CGF.Builder.restoreIP(SavedIP); } -void EHScopeStack::LazyCleanup::_anchor() {} +EHScopeStack::LazyCleanup::~LazyCleanup() { + llvm_unreachable("LazyCleanup is indestructable"); +} diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 90a5421c695..5ee3db08eea 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -125,18 +125,23 @@ public: } }; - /// A lazy cleanup. These will be allocated on the cleanup stack - /// and so must be trivially copyable. We "enforce" this by - /// providing no virtual destructor so that subclasses will be - /// encouraged to contain no non-POD types. + /// A lazy cleanup. Subclasses must be POD-like: cleanups will + /// not be destructed, and they will be allocated on the cleanup + /// stack and freely copied and moved around. /// /// LazyCleanup implementations should generally be declared in an /// anonymous namespace. class LazyCleanup { - // Anchor the construction vtable. - virtual void _anchor(); - public: + // Anchor the construction vtable. We use the destructor because + // gcc gives an obnoxious warning if there are virtual methods + // with an accessible non-virtual destructor. Unfortunately, + // declaring this destructor makes it non-trivial, but there + // doesn't seem to be any other way around this warning. + // + // This destructor will never be called. + virtual ~LazyCleanup(); + /// Emit the cleanup. For normal cleanups, this is run in the /// same EH context as when the cleanup was pushed, i.e. the /// immediately-enclosing context of the cleanup scope. For |