[llvm] r260190 - Remove TrailingObjects::operator delete. It's still suffering from

Richard Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 8 18:09:16 PST 2016


Author: rsmith
Date: Mon Feb  8 20:09:16 2016
New Revision: 260190

URL: http://llvm.org/viewvc/llvm-project?rev=260190&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/Support/TrailingObjects.h
    llvm/trunk/lib/IR/AttributeImpl.h
    llvm/trunk/unittests/Support/TrailingObjectsTest.cpp

Modified: llvm/trunk/include/llvm/Support/TrailingObjects.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TrailingObjects.h?rev=260190&r1=260189&r2=260190&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/TrailingObjects.h (original)
+++ llvm/trunk/include/llvm/Support/TrailingObjects.h Mon Feb  8 20:09:16 2016
@@ -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.

Modified: llvm/trunk/lib/IR/AttributeImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AttributeImpl.h?rev=260190&r1=260189&r2=260190&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AttributeImpl.h (original)
+++ llvm/trunk/lib/IR/AttributeImpl.h Mon Feb  8 20:09:16 2016
@@ -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<Attribute> 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; }

Modified: llvm/trunk/unittests/Support/TrailingObjectsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TrailingObjectsTest.cpp?rev=260190&r1=260189&r2=260190&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/TrailingObjectsTest.cpp (original)
+++ llvm/trunk/unittests/Support/TrailingObjectsTest.cpp Mon Feb  8 20:09:16 2016
@@ -34,7 +34,7 @@ public:
     void *Mem = ::operator new(totalSizeToAlloc<short>(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<short>()[Num]; }
 
@@ -79,7 +79,7 @@ public:
       *C->getTrailingObjects<double>() = 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)




More information about the llvm-commits mailing list