Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clangd] Propagate context into stdlib indexing thread #87611

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

kadircet
Copy link
Member

@kadircet kadircet commented Apr 4, 2024

Some FS implementations rely on snapshots available in the context.

@llvmbot
Copy link
Member

llvmbot commented Apr 4, 2024

@llvm/pr-subscribers-clangd

Author: kadir çetinkaya (kadircet)

Changes

Some FS implementations rely on snapshots available in the context.


Full diff: https://github.com/llvm/llvm-project/pull/87611.diff

1 Files Affected:

  • (modified) clang-tools-extra/clangd/ClangdServer.cpp (+4-1)
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index 5790273d625ef1..4eeed83b3e3751 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -112,7 +112,10 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
                  // Index outlives TUScheduler (declared first)
                  FIndex(FIndex),
                  // shared_ptr extends lifetime
-                 Stdlib(Stdlib)]() mutable {
+                 Stdlib(Stdlib),
+                 // We have some FS implementations that rely on infomration in
+                 // the context.
+                 Ctx(Context::current().clone())]() mutable {
       clang::noteBottomOfStack();
       IndexFileIn IF;
       IF.Symbols = indexStandardLibrary(std::move(CI), Loc, *TFS);

@llvmbot
Copy link
Member

llvmbot commented Apr 4, 2024

@llvm/pr-subscribers-clang-tools-extra

Author: kadir çetinkaya (kadircet)

Changes

Some FS implementations rely on snapshots available in the context.


Full diff: https://github.com/llvm/llvm-project/pull/87611.diff

1 Files Affected:

  • (modified) clang-tools-extra/clangd/ClangdServer.cpp (+4-1)
diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index 5790273d625ef1..4eeed83b3e3751 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -112,7 +112,10 @@ struct UpdateIndexCallbacks : public ParsingCallbacks {
                  // Index outlives TUScheduler (declared first)
                  FIndex(FIndex),
                  // shared_ptr extends lifetime
-                 Stdlib(Stdlib)]() mutable {
+                 Stdlib(Stdlib),
+                 // We have some FS implementations that rely on infomration in
+                 // the context.
+                 Ctx(Context::current().clone())]() mutable {
       clang::noteBottomOfStack();
       IndexFileIn IF;
       IF.Symbols = indexStandardLibrary(std::move(CI), Loc, *TFS);

Copy link
Collaborator

@sam-mccall sam-mccall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm iffy on whether this is semantically right or not, but we need to solve this problem somehow, so let's try the most obvious way.

clang-tools-extra/clangd/ClangdServer.cpp Show resolved Hide resolved
Some FS implementations rely on snapshots available in the context.
@kadircet kadircet merged commit acd736e into llvm:main Apr 18, 2024
3 of 4 checks passed
@kadircet kadircet deleted the prop_ctx_stdlib branch April 18, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants