diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-10-16 06:39:30 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-16 06:39:30 +0000 |
commit | d70cb645702bdbb42aee58403306a7c47e0d901c (patch) | |
tree | 0f542e303be9a3af1fb5498253f08e064f5ee4e0 /lib/Lex/LiteralSupport.cpp | |
parent | 6d69b5d82281992e981caa9bc038e3f6cac6594a (diff) |
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
Diffstat (limited to 'lib/Lex/LiteralSupport.cpp')
-rw-r--r-- | lib/Lex/LiteralSupport.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Lex/LiteralSupport.cpp b/lib/Lex/LiteralSupport.cpp index f63e6cfffc..1b86ba5def 100644 --- a/lib/Lex/LiteralSupport.cpp +++ b/lib/Lex/LiteralSupport.cpp @@ -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; |