After code completion inserts a header, running signature help using the old
preamble will usually fail. So we add support for consistent preamble reads.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
(This needs new TUScheduler tests for Consistent mode, but would like some feedback on the implementation first)
The implementation is really simple. LG!
To get proper operation order in tests, we can wait in the diagnostics callback that runs on the worker thread (IIRC, we do that in some of the other tests too).
clangd/TUScheduler.cpp | ||
---|---|---|
188 ↗ | (On Diff #163121) | As discussed offline, it looks like it shouldn't be a problem to call it from the working thread, so we could probably remove this restriction from the comment. |
474 ↗ | (On Diff #163121) | It seems we could remove the special-casing of RunSync and still get correct results (the Requests queue is always empty). |
clangd/TUScheduler.h | ||
123 ↗ | (On Diff #163121) | Maybe use a strongly-typed enum outside the class? Just a suggestion, feel free to ignore. |
clangd/TUScheduler.cpp | ||
---|---|---|
474 ↗ | (On Diff #163121) | Right, of course :-) |
clangd/TUScheduler.h | ||
123 ↗ | (On Diff #163121) | Yeah, the downside to that is that it *does* pollute the clangd:: namespace. So both are a bit sad. This header is fairly widely visible (since it's included by clangdserver) and this API is fairly narrowly interesting, so as far as completion goes I think I prefer it being hidden in TUScheduler. |
Hi Sam,
It took a very long time to identify it, but this commit broke ARMv7
bots, where this test hangs. Logs are available here (initial ones
are too old):
Thanks,
YvanOn Thu, 30 Aug 2018 at 17:15, Sam McCall via Phabricator via
cfe-commits <cfe-commits@lists.llvm.org> wrote:
sammccall added inline comments.
Comment at: clangd/TUScheduler.cpp:474
+ llvm::unique_function<void(std::shared_ptr<const PreambleData>)> Callback) {
+ if (RunSync)+ return Callback(getPossiblyStalePreamble());
ilya-biryukov wrote:
It seems we could remove the special-casing of RunSync and still get correct results (the Requests queue is always empty).
But feel free to keep it for clarity.Right, of course :-)
Replaced this with an assert before we write to the queue.Comment at: clangd/TUScheduler.h:123
+ /// Controls whether preamble reads wait for the preamble to be up-to-date.
+ enum PreambleConsistency {+ /// The preamble is generated from the current version of the file.
ilya-biryukov wrote:
Maybe use a strongly-typed enum outside the class?
TUScheduler::Stale will turn into PreambleConsistency::Stale at the call-site. The main upside is that it does not pollute completions inside the class with enumerators.Just a suggestion, feel free to ignore.
Yeah, the downside to that is that it *does* pollute the clangd:: namespace. So both are a bit sad.
This header is fairly widely visible (since it's included by clangdserver) and this API is fairly narrowly interesting, so as far as completion goes I think I prefer it being hidden in TUScheduler.
Repository:
rL LLVMhttps://reviews.llvm.org/D51438
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits