[PATCH] D133757: [clangd] Turn QueryDriverDatabase into a CompileCommandsAdjuster

Nathan Ridge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 15 00:13:35 PDT 2022


nridge added a comment.

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`?

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`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133757



More information about the cfe-commits mailing list