ilya-biryukov added inline comments.

================
Comment at: clang-tools-extra/clangd/GlobalCompilationDatabase.cpp:36
   Cmd.CommandLine = ArgsAdjuster(Cmd.CommandLine, Cmd.Filename);
+  tooling::addTargetAndModeForProgramName(Cmd.CommandLine, Cmd.CommandLine[0]);
   // Inject the resource dir.
----------------
kadircet wrote:
> ilya-biryukov wrote:
> > Do we actually need this if we provide a proper `Argv[0]` to the driver?
> > My understanding is that the driver should figure out the targets from 
> > custom binary names on its own.
> unfortunately yes. 
> 
> because if the "-target" is missing, driver tries to deduce it from the 
> "running binary" which is "clangd" in our case.
I wonder if it would sense to change this? Where does this code live?

That's exactly what `argv[0]` is for in `compile_commands.json`. Fixing that at 
the driver level would "fix" all libclang- and libtooling-based binaries, like 
`clang-tidy`, etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63194



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

Reply via email to