From: Kostya Serebryany Date: Wed, 8 Oct 2014 18:31:54 +0000 (+0000) Subject: Replace a destructor of EHCleanupScope with a Destroy() method to reflect the current... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=43992fe7b17de5553ac06d323cb80cc6723a9ae3;p=clang Replace a destructor of EHCleanupScope with a Destroy() method to reflect the current usage. 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 --- diff --git a/lib/CodeGen/CGCleanup.cpp b/lib/CodeGen/CGCleanup.cpp index 911734ae8e..12c587ee95 100644 --- a/lib/CodeGen/CGCleanup.cpp +++ b/lib/CodeGen/CGCleanup.cpp @@ -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()) { diff --git a/lib/CodeGen/CGCleanup.h b/lib/CodeGen/CGCleanup.h index ef93389ce5..cbc51c33cd 100644 --- a/lib/CodeGen/CGCleanup.h +++ b/lib/CodeGen/CGCleanup.h @@ -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; }