Support: Remove undefined behavior from &raw_ostream::operator<<

Don't negate signed integer types in &raw_ostream::operator<<(const
FormattedNumber &FN).

llvm-svn: 218496
This commit is contained in:
David Majnemer 2014-09-26 02:48:14 +00:00
parent beff8bf746
commit 4b3c90f209
1 changed files with 1 additions and 1 deletions

View File

@ -433,7 +433,7 @@ raw_ostream &raw_ostream::operator<<(const FormattedNumber &FN) {
char *EndPtr = NumberBuffer+sizeof(NumberBuffer);
char *CurPtr = EndPtr;
bool Neg = (FN.DecValue < 0);
uint64_t N = Neg ? -FN.DecValue : FN.DecValue;
uint64_t N = Neg ? -static_cast<uint64_t>(FN.DecValue) : FN.DecValue;
while (N) {
*--CurPtr = '0' + char(N % 10);
N /= 10;