[llvm] r262891 - A couple more UB fixes for C++14 sized deallocation.
Richard Smith via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 16:59:44 PST 2016
Author: rsmith
Date: Mon Mar 7 18:59:44 2016
New Revision: 262891
URL: http://llvm.org/viewvc/llvm-project?rev=262891&view=rev
Log:
A couple more UB fixes for C++14 sized deallocation.
Modified:
llvm/trunk/include/llvm/TableGen/Record.h
llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
Modified: llvm/trunk/include/llvm/TableGen/Record.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/TableGen/Record.h?rev=262891&r1=262890&r2=262891&view=diff
==============================================================================
--- llvm/trunk/include/llvm/TableGen/Record.h (original)
+++ llvm/trunk/include/llvm/TableGen/Record.h Mon Mar 7 18:59:44 2016
@@ -468,6 +468,9 @@ class BitsInit final : public TypedInit,
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 @@ private:
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;
}
Modified: llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp?rev=262891&r1=262890&r2=262891&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp Mon Mar 7 18:59:44 2016
@@ -378,6 +378,10 @@ public:
}
}
+ // 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; }
More information about the llvm-commits
mailing list