summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-01-22 01:17:12 +0000
committerChris Lattner <sabre@nondot.org>2010-01-22 01:17:12 +0000
commit03949c9db3e8f02d6ec7cd53782507e3a4e9e4fc (patch)
treec5175a33aa2d2c6347bc3d474db6fc57060f4922 /tools
parenta27f64f3e34ee82f87f9cb197d02504a8b2cdae7 (diff)
downloadllvm-03949c9db3e8f02d6ec7cd53782507e3a4e9e4fc.tar.gz
llvm-03949c9db3e8f02d6ec7cd53782507e3a4e9e4fc.tar.bz2
llvm-03949c9db3e8f02d6ec7cd53782507e3a4e9e4fc.tar.xz
remove some confused code that used strtoull
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94128 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/llvm-mc/AsmLexer.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/tools/llvm-mc/AsmLexer.cpp b/tools/llvm-mc/AsmLexer.cpp
index 234b8f33ad..de61e7f5b7 100644
--- a/tools/llvm-mc/AsmLexer.cpp
+++ b/tools/llvm-mc/AsmLexer.cpp
@@ -14,7 +14,6 @@
#include "AsmLexer.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Config/config.h" // for strtoull.
#include "llvm/MC/MCAsmInfo.h"
#include <cerrno>
#include <cstdio>
@@ -163,19 +162,13 @@ AsmToken AsmLexer::LexDigit() {
// Requires at least one hex digit.
if (CurPtr == NumStart)
return ReturnError(CurPtr-2, "Invalid hexadecimal number");
-
- errno = 0;
- if (errno == EINVAL)
+
+ unsigned long long Result;
+ if (StringRef(TokStart, CurPtr - TokStart).getAsInteger(0, Result))
return ReturnError(CurPtr-2, "Invalid hexadecimal number");
- if (errno == ERANGE) {
- errno = 0;
- if (errno == EINVAL)
- return ReturnError(CurPtr-2, "Invalid hexadecimal number");
- if (errno == ERANGE)
- return ReturnError(CurPtr-2, "Hexadecimal number out of range");
- }
+
return AsmToken(AsmToken::Integer, StringRef(TokStart, CurPtr - TokStart),
- (int64_t) strtoull(NumStart, 0, 16));
+ (int64_t)Result);
}
// Must be an octal number, it starts with 0.