From 936e053da02addea9f584b50f523122c13e4c79c Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Wed, 10 Sep 2014 11:15:36 +0000 Subject: [PATCH] [MSVC]: use StringRef::getAsInteger instead of strtoull This keeps non-conformant MSVC implementations happy. llvm-svn: 217491 --- lld/lib/Driver/DarwinLdDriver.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lld/lib/Driver/DarwinLdDriver.cpp b/lld/lib/Driver/DarwinLdDriver.cpp index af7b2fa4152fd..69eec46f556a8 100644 --- a/lld/lib/Driver/DarwinLdDriver.cpp +++ b/lld/lib/Driver/DarwinLdDriver.cpp @@ -33,7 +33,6 @@ #include "llvm/Support/Signals.h" #include -#include using namespace lld; @@ -314,12 +313,11 @@ bool DarwinLdDriver::parse(int argc, const char *argv[], ctx.setOutputPath("a.out"); if (llvm::opt::Arg *imageBase = parsedArgs->getLastArg(OPT_image_base)) { - char *endPtr; - uint64_t baseAddress = strtoull(imageBase->getValue(), &endPtr, 16); - if (*endPtr != 0) { + uint64_t baseAddress; + if (StringRef(imageBase->getValue()).getAsInteger(16, baseAddress)) { diagnostics << "error: image_base expects a hex number\n"; return false; - } else if (baseAddress < ctx.pageZeroSize()) { + } else if (baseAddress < ctx.pageZeroSize()) { diagnostics << "error: image_base overlaps with __PAGEZERO\n"; return false; }