Define member operator delete
authorXinliang David Li <davidxl@google.com>
Tue, 1 Dec 2015 23:05:27 +0000 (23:05 +0000)
committerXinliang David Li <davidxl@google.com>
Tue, 1 Dec 2015 23:05:27 +0000 (23:05 +0000)
For the struct with trailing objects, define
a member operator delete. Without this, the program
will fail when -fsized-deallocation option is used
where the wrong size will be passed to the global
delete operator.

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

include/llvm/ProfileData/InstrProfData.inc

index 8ff7003..a2f0a8a 100644 (file)
@@ -291,6 +291,7 @@ typedef struct ValueProfData {
    */
   void deserializeTo(InstrProfRecord &Record,
                      InstrProfRecord::ValueMapType *VMap);
    */
   void deserializeTo(InstrProfRecord &Record,
                      InstrProfRecord::ValueMapType *VMap);
+  void operator delete(void *ptr) { ::operator delete(ptr); }
 #endif
 } ValueProfData;
 
 #endif
 } ValueProfData;