ruiu added a comment.

It seems you converted the same string back and forth between UTF-8 and UTF-16 
to call Windows functions and LLVM functions. That's not only a waste of time 
(which is not a big problem) but complicates the code.

I'd define `std::error GetExecutableName(std::string &Result)` which returns a 
filename (fully expanded but not a fullpath) of the current executable in 
UTF-8. Then, add something like this at the *end* of 
`GetCommandLineArguments()`:

  SmallVector<char> Arg0(Args[0], strlen(Args[0]);
  sys::path::remove_filename(Arg0);
  GetExecutableName(Filename);
  sys::path::append(Arg0, Filename);
  Args[0] = AllocateString(Arg0, Alloc);


https://reviews.llvm.org/D47578



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to