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
llvm-svn: 219331
diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp
index 911734a..12c587e 100644
--- a/clang/lib/CodeGen/CGCleanup.cpp
+++ b/clang/lib/CodeGen/CGCleanup.cpp
@@ -184,7 +184,7 @@
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/clang/lib/CodeGen/CGCleanup.h b/clang/lib/CodeGen/CGCleanup.h
index ef93389..cbc51c3 100644
--- a/clang/lib/CodeGen/CGCleanup.h
+++ b/clang/lib/CodeGen/CGCleanup.h
@@ -280,9 +280,11 @@
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; }