A couple more UB fixes for C++14 sized deallocation.
llvm-svn: 262891
diff --git a/llvm/include/llvm/TableGen/Record.h b/llvm/include/llvm/TableGen/Record.h
index 2069b27..9140b3a 100644
--- a/llvm/include/llvm/TableGen/Record.h
+++ b/llvm/include/llvm/TableGen/Record.h
@@ -468,6 +468,9 @@
BitsInit &operator=(const BitsInit &Other) = delete;
public:
+ // Do not use sized deallocation due to trailing objects.
+ void operator delete(void *p) { ::operator delete(p); }
+
static bool classof(const Init *I) {
return I->getKind() == IK_BitsInit;
}
@@ -601,6 +604,9 @@
ListInit &operator=(const ListInit &Other) = delete;
public:
+ // Do not use sized deallocation due to trailing objects.
+ void operator delete(void *p) { ::operator delete(p); }
+
static bool classof(const Init *I) {
return I->getKind() == IK_ListInit;
}
diff --git a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
index 5c64d78..a0b15d5 100644
--- a/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
+++ b/llvm/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
@@ -378,6 +378,10 @@
}
}
+ // Disable use of sized deallocation due to overallocation of PPCOperand
+ // objects in CreateTokenWithStringCopy.
+ void operator delete(void *p) { ::operator delete(p); }
+
/// getStartLoc - Get the location of the first token of this operand.
SMLoc getStartLoc() const override { return StartLoc; }