]> granicus.if.org Git - clang/commitdiff
Replace a destructor of EHCleanupScope with a Destroy() method to reflect the current...
authorKostya Serebryany <kcc@google.com>
Wed, 8 Oct 2014 18:31:54 +0000 (18:31 +0000)
committerKostya Serebryany <kcc@google.com>
Wed, 8 Oct 2014 18:31:54 +0000 (18:31 +0000)
Summary:
The current code uses memset to re-initialize EHCleanupScope objects
with breaks the assumptions of the upcoming asan's intra-object-overflow checker.
If there is no DTOR, the new checker will refuse to work.

Test Plan: bootstrap with asan

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5656

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@219331 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGCleanup.cpp
lib/CodeGen/CGCleanup.h

index 911734ae8e8615580d11031f339e0ca31306d3ce..12c587ee95afc724f71527ffe41b592186a40512 100644 (file)
@@ -184,7 +184,7 @@ void EHScopeStack::popCleanup() {
   StartOfData += Cleanup.getAllocatedSize();
 
   // Destroy the cleanup.
-  Cleanup.~EHCleanupScope();
+  Cleanup.Destroy();
 
   // Check whether we can shrink the branch-fixups stack.
   if (!BranchFixups.empty()) {
index ef93389ce5abf587d240fd56c32e24799322e19e..cbc51c33cd1155d709d19fe5925563293beaa99e 100644 (file)
@@ -280,9 +280,11 @@ public:
     assert(CleanupBits.CleanupSize == cleanupSize && "cleanup size overflow");
   }
 
-  ~EHCleanupScope() {
+  void Destroy() {
     delete ExtInfo;
   }
+  // Objects of EHCleanupScope are not destructed. Use Destroy().
+  ~EHCleanupScope() LLVM_DELETED_FUNCTION;
 
   bool isNormalCleanup() const { return CleanupBits.IsNormalCleanup; }
   llvm::BasicBlock *getNormalBlock() const { return NormalBlock; }