[PATCH] D102761: [clangd] New ParsingCallback for semantics changes
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 26 08:02:30 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG8f79203a22d8: [clangd] New ParsingCallback for semantics changes (authored by kadircet).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102761/new/
https://reviews.llvm.org/D102761
Files:
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/TUScheduler.cpp
clang-tools-extra/clangd/TUScheduler.h
Index: clang-tools-extra/clangd/TUScheduler.h
===================================================================
--- clang-tools-extra/clangd/TUScheduler.h
+++ clang-tools-extra/clangd/TUScheduler.h
@@ -169,6 +169,11 @@
/// Called whenever the TU status is updated.
virtual void onFileUpdated(PathRef File, const TUStatus &Status) {}
+
+ /// Preamble for the TU have changed. This might imply new semantics (e.g.
+ /// different highlightings). Any actions on the file are guranteed to see new
+ /// preamble after the callback.
+ virtual void onPreamblePublished(PathRef File) {}
};
/// Handles running tasks for ClangdServer and managing the resources (e.g.,
Index: clang-tools-extra/clangd/TUScheduler.cpp
===================================================================
--- clang-tools-extra/clangd/TUScheduler.cpp
+++ clang-tools-extra/clangd/TUScheduler.cpp
@@ -909,6 +909,7 @@
ASTPeer.updatePreamble(std::move(Req.CI), std::move(Req.Inputs),
LatestBuild, std::move(Req.CIDiags),
std::move(Req.WantDiags));
+ Callbacks.onPreamblePublished(FileName);
});
if (!LatestBuild || Inputs.ForceRebuild) {
Index: clang-tools-extra/clangd/ClangdServer.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdServer.cpp
+++ clang-tools-extra/clangd/ClangdServer.cpp
@@ -75,8 +75,6 @@
const CanonicalIncludes &CanonIncludes) override {
if (FIndex)
FIndex->updatePreamble(Path, Version, Ctx, std::move(PP), CanonIncludes);
- if (ServerCallbacks)
- ServerCallbacks->onSemanticsMaybeChanged(Path);
}
void onMainAST(PathRef Path, ParsedAST &AST, PublishFn Publish) override {
@@ -105,6 +103,11 @@
ServerCallbacks->onFileUpdated(File, Status);
}
+ void onPreamblePublished(PathRef File) override {
+ if (ServerCallbacks)
+ ServerCallbacks->onSemanticsMaybeChanged(File);
+ }
+
private:
FileIndex *FIndex;
ClangdServer::Callbacks *ServerCallbacks;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102761.347963.patch
Type: text/x-patch
Size: 2058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210526/78209b01/attachment.bin>
More information about the cfe-commits
mailing list