================
@@ -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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to