kadircet added a comment. In D133757#3791485 <https://reviews.llvm.org/D133757#3791485>, @nridge wrote:
> I think the sticking point for just having `QueryDriverDatabase` run after > the entirety of `CommandMangler` is this check > <https://searchfox.org/llvm/rev/f213128b292da85f68eeebbb68cba1541e1c39e2/clang-tools-extra/clangd/CompileCommands.cpp#160-165> > in `resolveDriver()`, which replaces e.g. `gcc` with > `/path/to/clang/bin/gcc`, which likely does not actually exist (i.e. > `QueryDriverDatabase` will not be able to query it, when it might have been > able to look up `gcc` in `PATH`). > > Do you know what the purpose of this logic in `resolveDriver()` is, and in > particular: > > - why is `gcc` treated differently than say `gcc-12`? > - why is turning `gcc` into `/path/to/clang/bin/gcc` performed **before** > trying to resolve `gcc` against `PATH`? We thought generic driver names would actually imply "not caring" about the compiler, hence it would be better to just use installation that came with clang, if we were able to detect any. this extremely helpful on macs, i think without this we won't have a working setup by default. since the clang coming from $PATH doesn't have stdlib installed, whereas clang we discover through xcode has it. > If we can change the order of the checks in `resolveDriver()` such that we > try to resolve `gcc` against `PATH` first, and only turn it into > `/path/to/clang/bin/gcc` if it was not found in `PATH`, I think that would > not interfere with `QueryDriverDatabase`. Right, that would be one way to go. But as explained above, I think this is actually making most of the "don't care" cases work by default and it wouldn't be great to give them up, without understanding the tradeoff. Hence I was trying to understand what exactly are we supporting by not doing this resolution eagerly. i.e.: - what are the cases in which we have a generic driver name in the compile commands, and user indeed has all the necessary system headers installed relative to resolved path of that generic compiler name in `$PATH` - do we lose anything by not resolving a driver name provided by CompileFlags.Compiler. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D133757/new/ https://reviews.llvm.org/D133757 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits