[lld] r217491 - [MSVC]: use StringRef::getAsInteger instead of strtoull
Tim Northover
tnorthover at apple.com
Wed Sep 10 04:15:36 PDT 2014
Author: tnorthover
Date: Wed Sep 10 06:15:36 2014
New Revision: 217491
URL: http://llvm.org/viewvc/llvm-project?rev=217491&view=rev
Log:
[MSVC]: use StringRef::getAsInteger instead of strtoull
This keeps non-conformant MSVC implementations happy.
Modified:
lld/trunk/lib/Driver/DarwinLdDriver.cpp
Modified: lld/trunk/lib/Driver/DarwinLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/DarwinLdDriver.cpp?rev=217491&r1=217490&r2=217491&view=diff
==============================================================================
--- lld/trunk/lib/Driver/DarwinLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/DarwinLdDriver.cpp Wed Sep 10 06:15:36 2014
@@ -33,7 +33,6 @@
#include "llvm/Support/Signals.h"
#include <algorithm>
-#include <cstdlib>
using namespace lld;
@@ -314,12 +313,11 @@ bool DarwinLdDriver::parse(int argc, con
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;
}
More information about the llvm-commits
mailing list