================
@@ -162,8 +221,23 @@ int main(int argc, const char **argv) {
auto Err = Executor->get()->execute(
std::make_unique<clang::clangd::IndexActionFactory>(Data),
clang::tooling::ArgumentsAdjuster(
- [Mangler = std::move(Mangler)](const std::vector<std::string> &Args,
- llvm::StringRef File) {
+ [Mangler = std::move(Mangler),
+ ContextProvider = std::move(ContextProvider)](
+ const std::vector<std::string> &Args, llvm::StringRef File) {
+ // Issue: If File is relative, it's relative to the compile
+ // command's "directory", not our CWD, but ToolExecutor doesn't
+ // expose "directory" here, so make_absolute can resolve it wrong
+ // and miss the .clangd file. See
+ // indexer-clangd-config-relative-path.test.
----------------
HighCommander4 wrote:
There is one thing we can/should do to mitigate the effects of this limitation
IMO: only apply the config if we have an absolute path. Otherwise, we can pick
up unrelated `.clangd` files which happen to be on the ancestor path of the
working directory.
Suggested formulation:
```c++
std::optional<clang::clangd::WithContext> WithCfg;
if (llvm::sys::path::is_absolute(File)) {
WithCfg.emplace(ContextProvider(File));
}
```
https://github.com/llvm/llvm-project/pull/214951
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits