================
@@ -162,8 +187,13 @@ 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) {
+ llvm::SmallString<256> AbsFile(File);
+ llvm::sys::fs::make_absolute(AbsFile);
+ clang::clangd::WithContext WithCfg(ContextProvider(AbsFile));
----------------
HighCommander4 wrote:
For competeness, there is an additional issue with applying the context here in
the `ArgumentsAdjuster`: it's going to apply to the mangler call below (which
is what applies `CompileFlags`), but the context will be popped before the
indexer gets to the actual parse.
Unlike the relative path issue, this is more of a hypothetical issue than a
real one, because the config checks we currently do during the parse don't seem
to be relevant to clangd-indexer (they're about things like enabling and
suppressing diagnostics, which clangd-indexer basically just prints to stderr).
But it still seems fragile (it's hard to rule out interesting config checks
being added to the parse in the future) and worth documenting.
(A proper fix for this would also require libTooling changes.)
https://github.com/llvm/llvm-project/pull/214951
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits