зеркало из https://github.com/microsoft/clang-1.git
Simplify overflow-on-add check in NumericLiteralParser::GetIntegerValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57629 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6d69b5d822
Коммит
d70cb64570
|
@ -481,10 +481,9 @@ bool NumericLiteralParser::GetIntegerValue(llvm::APInt &Val) {
|
|||
Val *= RadixVal;
|
||||
OverflowOccurred |= Val.udiv(RadixVal) != OldVal;
|
||||
|
||||
OldVal = Val;
|
||||
// Add value, did overflow occur on the value?
|
||||
// (a + b) ult b <=> overflow
|
||||
Val += CharVal;
|
||||
OverflowOccurred |= Val.ult(OldVal);
|
||||
OverflowOccurred |= Val.ult(CharVal);
|
||||
}
|
||||
return OverflowOccurred;
|
||||
|
|
Загрузка…
Ссылка в новой задаче