[PATCH] D88065: [lld-macho] Make lld::getInteger() tolerate leading "0x"/"0X" when base is 16

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 22 17:01:16 PDT 2020


MaskRay added inline comments.


================
Comment at: lld/Common/Args.cpp:39
+    s = s.drop_front(2);
+  if (to_integer(s, v, base))
     return v;
----------------
gkm wrote:
> MaskRay wrote:
> > If base == 0, to_integer can parse the 0x prefix.
> I am unclear about the intention of your statement. Are you suggesting that I change `base` to `0` and let `to_integer()` strip the `0x` ?
> I considered that, but that way we perform the `0x` detection twice.
If you use base 0, `to_integer` does not need a change and you get `0x` ability for free.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D88065/new/

https://reviews.llvm.org/D88065



More information about the llvm-commits mailing list