[PATCH] D88065: [lld-macho] Make lld::getInteger() tolerate leading "0x"/"0X" when base is 16
Greg McGary via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 21 19:06:17 PDT 2020
gkm created this revision.
gkm added a reviewer: lld-macho.
Herald added a reviewer: MaskRay.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
gkm requested review of this revision.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88065
Files:
lld/Common/Args.cpp
Index: lld/Common/Args.cpp
===================================================================
--- lld/Common/Args.cpp
+++ lld/Common/Args.cpp
@@ -33,7 +33,10 @@
return Default;
int64_t v;
- if (to_integer(a->getValue(), v, base))
+ StringRef s = a->getValue();
+ if (base == 16 && (s.startswith("0x") || s.startswith("0X")))
+ s = s.drop_front(2);
+ if (to_integer(s, v, base))
return v;
StringRef spelling = args.getArgString(a->getIndex());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88065.293314.patch
Type: text/x-patch
Size: 471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200922/fcb2e201/attachment.bin>
More information about the llvm-commits
mailing list