[PATCH] D63092: [Frontend] Use executable path when creating invocation from cmdline

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 10 13:26:20 PDT 2019


sammccall added a comment.
Herald added a subscriber: ormris.

`argv[0]` does carry important information though, I think this will break a lot of things. It's... concerning that no tests broke.

For example, if it's `clang` or `g++` or `clang-cl` then that affects how command lines are parsed (regardless of whether the path actually exists).

Additionally I don't think all tools that call createInvocationFromCommandLine carry around all the files you want.

The wrapper tool case is a problem though, I see some options:

- change the process that generates the compilation database to emit a path to the underlying compiler instead, as tooling currently expects. This may be painful if e.g. goma pretends to be a regular toolchain. An argument can be made it should pretend harder (e.g. symlinking directories around it so discovery works as usual)
- change the process that generates the CDB to inject the relevant directory paths explicitly as flags
- make driver aware of the distinction between "invoked-as" and "current binary" and use the right path in the right places

(Incidentally if Driver is going to use the current binary, we shouldn't need to pass it in as a parameter, right?)

There are some potentially-unsolvable cases here: e.g. if your wrapper is `magic-remote-build` then maybe there's no standard library locally, or no way to find it.


Repository:
  rC Clang

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

https://reviews.llvm.org/D63092





More information about the cfe-commits mailing list