Skip to content

Commit

Permalink
[MSVC]: use StringRef::getAsInteger instead of strtoull
Browse files Browse the repository at this point in the history
This keeps non-conformant MSVC implementations happy.

llvm-svn: 217491
  • Loading branch information
TNorthover committed Sep 10, 2014
1 parent d4abb8d commit 936e053
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lld/lib/Driver/DarwinLdDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
#include "llvm/Support/Signals.h"

#include <algorithm>
#include <cstdlib>

using namespace lld;

Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 936e053

Please sign in to comment.