kadircet 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. ---------------- ilya-biryukov wrote: > 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. ah sorry, I've mixed that one actually. the behavior is: if the "-target" is missing, we always use the default target(depends on the host). even though `ClangExecutable` is available in the Driver and set correctly to `argv[0]`. tools that care about target deduction needs to pass "-target" to driver explicitly. currently the driver only deduces "driver-mode" from the executable name. adding this to rather driver side, looks like nothing is broken. 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