diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-06-26 06:17:51 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-06-26 06:17:51 +0000 |
commit | 8e62069f6298f517f97a333bdc3a7b1c50adad64 (patch) | |
tree | 01d56b6c853307ed749c5a25a2c811abefd6d568 /lib/Expr/Parser.cpp | |
parent | 553e2871ba937a91da303190631daf627f83eabb (diff) | |
download | klee-8e62069f6298f517f97a333bdc3a7b1c50adad64.tar.gz |
More large integer support.
- Allow constructing a ConstantExpr from an APInt, too painful otherwise. - Parser support for large integers. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@74278 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Expr/Parser.cpp')
-rw-r--r-- | lib/Expr/Parser.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp index 2b9777cb..42e8af03 100644 --- a/lib/Expr/Parser.cpp +++ b/lib/Expr/Parser.cpp @@ -1462,7 +1462,7 @@ ExprResult ParserImpl::ParseNumberToken(Expr::Width Type, const Token &Tok) { } // This is a simple but slow way to handle overflow. - APInt Val(std::max(64U, RadixBits * N), 0); + APInt Val(RadixBits * N, 0); APInt RadixVal(Val.getBitWidth(), Radix); APInt DigitVal(Val.getBitWidth(), 0); for (unsigned i=0; i<N; ++i) { @@ -1496,9 +1496,11 @@ ExprResult ParserImpl::ParseNumberToken(Expr::Width Type, const Token &Tok) { Val = -Val; if (Type < Val.getBitWidth()) - Val = Val.trunc(Type); + Val.trunc(Type); + else if (Type > Val.getBitWidth()) + Val.zext(Type); - return ExprResult(Builder->Constant(Val.getZExtValue(), Type)); + return ExprResult(Builder->Constant(Val)); } /// ParseTypeSpecifier - Parse a type specifier. |