[PATCH] D45550: Use GetArgumentVector to retrieve the utf-8 encoded arguments on all platforms

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 12 15:13:28 PDT 2018


ruiu added inline comments.


================
Comment at: tools/lld/lld.cpp:129-130
+  SpecificBumpPtrAllocator<char> ArgAllocator;
+  ExitOnErr(errorCodeToError(sys::Process::GetArgumentVector(
+      Argv, makeArrayRef(Argv_, Argc_), ArgAllocator)));
+
----------------
stella.stamenova wrote:
> ruiu wrote:
> > Why is this function's signature so complex? How can it fail?
> On Windows, this calls several functions which can fail:
> * GetCommandLineW
> * CommandLineToArgvW
> * WideCharToMultiByte
IIUC, you want to do the same thing for all llvm tools that have their own main() functions. And I think that you always exit on error. If that's the case, I'd reduce the amount of boilerplate by moving code.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45550





More information about the llvm-commits mailing list