[clang-tools-extra] [clangd] Re-land "support outgoing calls in call hierarchy" (PR #117673)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 07:30:27 PST 2024


================
@@ -88,9 +90,12 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
       indexStdlib(CI, std::move(*Loc));
 
     // FIndex outlives the UpdateIndexCallbacks.
-    auto Task = [FIndex(FIndex), Path(Path.str()), Version(Version.str()),
+    auto Task = [this, FIndex(FIndex), Path(Path.str()), Version(Version.str()),
                  ASTCtx(std::move(ASTCtx)), PI(std::move(PI))]() mutable {
       trace::Span Tracer("PreambleIndexing");
+      std::optional<WithContext> WithProvidedContext;
+      if (ContextProvider)
+        WithProvidedContext.emplace(ContextProvider(""));
----------------
kadircet wrote:

why do we need to caputre contextprovider here, can we just use `Context::current()`? `onPreambleAST` is only invoked by preamble-thread, which already has the relevant context set up. you can just capture and set it via `[Ctx(Context::current().clone()] { WithContext WithCtx(std::move(Ctx)); ... };`

https://github.com/llvm/llvm-project/pull/117673


More information about the cfe-commits mailing list