<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 23, 2014 at 8:37 PM, Tyler Nowicki <span dir="ltr"><<a href="mailto:tyler.nowicki@gmail.com" target="_blank">tyler.nowicki@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Richard,<div><br></div><div>I will make the change you suggested. However, the first code I committed worked on my system (MSVS) but not on many others. I don't suppose you could suggest a syntax that is more portable?</div></div></blockquote><div><br></div><div>See below.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Sorry for the delayed response,</div></div></blockquote><div><br></div><div>Likewise.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Tyler</div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 12, 2014 at 7:51 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Sun, Oct 12, 2014 at 2:28 PM, Tyler Nowicki <span dir="ltr"><<a href="mailto:tyler.nowicki@gmail.com" target="_blank">tyler.nowicki@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: tnowicki<br>
Date: Sun Oct 12 16:28:02 2014<br>
New Revision: 219590<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=219590&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=219590&view=rev</a><br>
Log:<br>
Fixed a problem in r19589.<br>
<br>
Several systems failed to compile the array allocation of the TokenArray.<br>
<br>
Modified:<br>
    cfe/trunk/lib/Parse/ParsePragma.cpp<br>
<br>
Modified: cfe/trunk/lib/Parse/ParsePragma.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=219590&r1=219589&r2=219590&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParsePragma.cpp?rev=219590&r1=219589&r2=219590&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Parse/ParsePragma.cpp (original)<br>
+++ cfe/trunk/lib/Parse/ParsePragma.cpp Sun Oct 12 16:28:02 2014<br>
@@ -1877,8 +1877,8 @@ static bool ParseLoopHintValue(Preproces<br>
   EOFTok.setLocation(Tok.getLocation());<br>
   ValueList.push_back(EOFTok); // Terminates expression for parsing.<br>
<br>
-  Token *TokenArray =<br>
-      new (PP.getPreprocessorAllocator()) Token[ValueList.size()];<br>
+  Token *TokenArray = (Token *)PP.getPreprocessorAllocator().Allocate(<br>
+      ValueList.size() * sizeof(Token), llvm::alignOf<Token>());<br></blockquote><div><br></div></span><div>You should placement-new an array of Tokens here, rather than assuming that they don't need construction.</div></div></div></div></blockquote></div></div></div></div></blockquote><div><br></div><div>Try this:</div><div><br></div><div>void *Buffer = PP.getPreprocessorAllocator().Allocate(</div><div><div>    ValueList.size() * sizeof(Token), llvm::alignOf<Token>());</div></div><div>Token *TokenArray = new (Buffer) Token[ValueList.size()];</div><div><br></div><div>(It looks like compilers were rejecting the old code because we only have a normal placement new and not an array placement new for BumpPtrAllocator. Another possible fix would be to add such a placement operator new[] and revert this change.)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
   std::copy(ValueList.begin(), ValueList.end(), TokenArray);<br>
   Info.Toks = TokenArray;<br>
   Info.TokSize = ValueList.size();<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu" target="_blank">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></span></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>