<div dir="ltr">Indeed. Switched to format_hex() in r254560, thanks!</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 2, 2015 at 2:32 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">We also have `format_hex` in Support/Format.h<span class="HOEnZb"><font color="#888888"><div><br></div><div>-- Sean Silva</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 2, 2015 at 1:13 PM, Alexey Samsonov via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: samsonov<br>
Date: Wed Dec 2 15:13:43 2015<br>
New Revision: 254547<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=254547&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=254547&view=rev</a><br>
Log:<br>
[Hexagon] Remove std::hex in favor of format().<br>
<br>
std::hex is not used anywhere in LLVM code base except for this place,<br>
and it has a known undefined behavior (at least in libstdc++ 4.9.3):<br>
<a href="https://llvm.org/bugs/show_bug.cgi?id=18156" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=18156</a>, which fires in UBSan<br>
bootstrap of LLVM.<br>
<br>
Modified:<br>
llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp<br>
<br>
Modified: llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp?rev=254547&r1=254546&r2=254547&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp?rev=254547&r1=254546&r2=254547&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp (original)<br>
+++ llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp Wed Dec 2 15:13:43 2015<br>
@@ -38,6 +38,7 @@<br>
#include "llvm/Support/CommandLine.h"<br>
#include "llvm/Support/Debug.h"<br>
#include "llvm/Support/ELF.h"<br>
+#include "llvm/Support/Format.h"<br>
#include "llvm/Support/SourceMgr.h"<br>
#include "llvm/Support/MemoryBuffer.h"<br>
#include "llvm/Support/TargetRegistry.h"<br>
@@ -1511,14 +1512,15 @@ unsigned HexagonAsmParser::validateTarge<br>
}<br>
<br>
void HexagonAsmParser::OutOfRange(SMLoc IDLoc, long long Val, long long Max) {<br>
- std::stringstream errStr;<br>
- errStr << "value " << Val << "(0x" << std::hex << Val << std::dec<br>
+ std::string errStr;<br>
+ raw_string_ostream ES(errStr);<br>
+ ES << "value " << Val << "(" << format("0x%" PRIx64, Val)<br>
<< ") out of range: ";<br>
if (Max >= 0)<br>
- errStr << "0-" << Max;<br>
+ ES << "0-" << Max;<br>
else<br>
- errStr << Max << "-" << (-Max - 1);<br>
- Error(IDLoc, errStr.str().c_str());<br>
+ ES << Max << "-" << (-Max - 1);<br>
+ Error(IDLoc, ES.str().c_str());<br>
}<br>
<br>
int HexagonAsmParser::processInstruction(MCInst &Inst,<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><br></div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Alexey Samsonov<br><a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a></div></div>
</div>