From a64e1adf849c07232c2bd27b90a59f29659211e7 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 9 Feb 2016 02:09:16 +0000 Subject: [PATCH] Remove TrailingObjects::operator delete. It's still suffering from compiler-specific issues. Instead, repeat an 'operator delete' definition in each derived class that is actually deleted, and give up on the static type safety of an error when sized delete is accidentally used on a type derived from TrailingObjects. llvm-svn: 260190 --- llvm/include/llvm/Support/TrailingObjects.h | 4 ---- llvm/lib/IR/AttributeImpl.h | 4 ++-- llvm/unittests/Support/TrailingObjectsTest.cpp | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/llvm/include/llvm/Support/TrailingObjects.h b/llvm/include/llvm/Support/TrailingObjects.h index 2bd25ac..e28b33d 100644 --- a/llvm/include/llvm/Support/TrailingObjects.h +++ b/llvm/include/llvm/Support/TrailingObjects.h @@ -293,10 +293,6 @@ public: // Make this (privately inherited) member public. using ParentType::OverloadToken; - /// Disable sized deallocation for all objects with trailing object storage; - /// the inferred size will typically not be correct. - void operator delete(void *P) { return ::operator delete(P); } - /// Returns a pointer to the trailing object array of the given type /// (which must be one of those specified in the class template). The /// array may have zero or more elements in it. diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h index e87f4f7..3325043 100644 --- a/llvm/lib/IR/AttributeImpl.h +++ b/llvm/lib/IR/AttributeImpl.h @@ -171,7 +171,7 @@ class AttributeSetNode final void operator=(const AttributeSetNode &) = delete; AttributeSetNode(const AttributeSetNode &) = delete; public: - void operator delete(void *p) { TrailingObjects::operator delete(p); } + void operator delete(void *p) { ::operator delete(p); } static AttributeSetNode *get(LLVMContext &C, ArrayRef Attrs); @@ -268,7 +268,7 @@ public: } } - void operator delete(void *p) { TrailingObjects::operator delete(p); } + void operator delete(void *p) { ::operator delete(p); } /// \brief Get the context that created this AttributeSetImpl. LLVMContext &getContext() { return Context; } diff --git a/llvm/unittests/Support/TrailingObjectsTest.cpp b/llvm/unittests/Support/TrailingObjectsTest.cpp index 282f402..a1d3e7b 100644 --- a/llvm/unittests/Support/TrailingObjectsTest.cpp +++ b/llvm/unittests/Support/TrailingObjectsTest.cpp @@ -34,7 +34,7 @@ public: void *Mem = ::operator new(totalSizeToAlloc(NumShorts)); return new (Mem) Class1(ShortArray, NumShorts); } - void operator delete(void *p) { TrailingObjects::operator delete(p); } + void operator delete(void *p) { ::operator delete(p); } short get(unsigned Num) const { return getTrailingObjects()[Num]; } @@ -79,7 +79,7 @@ public: *C->getTrailingObjects() = D; return C; } - void operator delete(void *p) { TrailingObjects::operator delete(p); } + void operator delete(void *p) { ::operator delete(p); } short getShort() const { if (!HasShort) -- 2.7.4