]> granicus.if.org Git - clang/commitdiff
Simplify overflow-on-add check in NumericLiteralParser::GetIntegerValue.
authorDaniel Dunbar <daniel@zuster.org>
Thu, 16 Oct 2008 06:39:30 +0000 (06:39 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Thu, 16 Oct 2008 06:39:30 +0000 (06:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57629 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/LiteralSupport.cpp

index f63e6cfffc0dd4073bff44f443b255edc4b1d98b..1b86ba5def85f8741b3700661eb434f8071dd46e 100644 (file)
@@ -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;