<div dir="ltr">Seems it confuses msvc.<br>See <a href="http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/9526">http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/9526</a><br><a href="http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/5449">http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/5449</a><br></div><br><div class="gmail_quote"><div dir="ltr">On Sat, Feb 6, 2016 at 7:37 AM Richard Smith via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rsmith<br>
Date: Fri Feb 5 16:32:52 2016<br>
New Revision: 259942<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=259942&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=259942&view=rev</a><br>
Log:<br>
More workarounds for undefined behavior exposed when compiling in C++14 with<br>
-fsized-deallocation. Disable sized deallocation for all objects derived from<br>
TrailingObjects, as we expect the storage allocated for these objects to be<br>
larger than the size of their dynamic type.<br>
<br>
Modified:<br>
llvm/trunk/include/llvm/Support/TrailingObjects.h<br>
llvm/trunk/lib/IR/AttributeImpl.h<br>
llvm/trunk/unittests/Support/TrailingObjectsTest.cpp<br>
<br>
Modified: llvm/trunk/include/llvm/Support/TrailingObjects.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TrailingObjects.h?rev=259942&r1=259941&r2=259942&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/TrailingObjects.h?rev=259942&r1=259941&r2=259942&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/include/llvm/Support/TrailingObjects.h (original)<br>
+++ llvm/trunk/include/llvm/Support/TrailingObjects.h Fri Feb 5 16:32:52 2016<br>
@@ -79,6 +79,11 @@ public:<br>
<br>
/// The base class for TrailingObjects* classes.<br>
class TrailingObjectsBase {<br>
+public:<br>
+ /// Disable sized deallocation for all objects with trailing object storage;<br>
+ /// the inferred size will typically not be correct.<br>
+ void operator delete(void *P) { return ::operator delete(P); }<br>
+<br>
protected:<br>
/// OverloadToken's purpose is to allow specifying function overloads<br>
/// for different types, without actually taking the types as<br>
@@ -290,7 +295,8 @@ class TrailingObjects : private trailing<br>
}<br>
<br>
public:<br>
- // make this (privately inherited) class public.<br>
+ // Make these (privately inherited) members public.<br>
+ using ParentType::operator delete;<br>
using ParentType::OverloadToken;<br>
<br>
/// Returns a pointer to the trailing object array of the given type<br>
<br>
Modified: llvm/trunk/lib/IR/AttributeImpl.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AttributeImpl.h?rev=259942&r1=259941&r2=259942&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AttributeImpl.h?rev=259942&r1=259941&r2=259942&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/AttributeImpl.h (original)<br>
+++ llvm/trunk/lib/IR/AttributeImpl.h Fri Feb 5 16:32:52 2016<br>
@@ -171,6 +171,8 @@ class AttributeSetNode final<br>
void operator=(const AttributeSetNode &) = delete;<br>
AttributeSetNode(const AttributeSetNode &) = delete;<br>
public:<br>
+ using TrailingObjects::operator delete;<br>
+<br>
static AttributeSetNode *get(LLVMContext &C, ArrayRef<Attribute> Attrs);<br>
<br>
bool hasAttribute(Attribute::AttrKind Kind) const {<br>
@@ -266,6 +268,8 @@ public:<br>
}<br>
}<br>
<br>
+ using TrailingObjects::operator delete;<br>
+<br>
/// \brief Get the context that created this AttributeSetImpl.<br>
LLVMContext &getContext() { return Context; }<br>
<br>
<br>
Modified: llvm/trunk/unittests/Support/TrailingObjectsTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TrailingObjectsTest.cpp?rev=259942&r1=259941&r2=259942&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TrailingObjectsTest.cpp?rev=259942&r1=259941&r2=259942&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/unittests/Support/TrailingObjectsTest.cpp (original)<br>
+++ llvm/trunk/unittests/Support/TrailingObjectsTest.cpp Fri Feb 5 16:32:52 2016<br>
@@ -34,6 +34,7 @@ public:<br>
void *Mem = ::operator new(totalSizeToAlloc<short>(NumShorts));<br>
return new (Mem) Class1(ShortArray, NumShorts);<br>
}<br>
+ using TrailingObjects::operator delete;<br>
<br>
short get(unsigned Num) const { return getTrailingObjects<short>()[Num]; }<br>
<br>
@@ -78,6 +79,7 @@ public:<br>
*C->getTrailingObjects<double>() = D;<br>
return C;<br>
}<br>
+ using TrailingObjects::operator delete;<br>
<br>
short getShort() const {<br>
if (!HasShort)<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>