This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Serialize onDiagnosticsReady callbacks for the same file.
ClosedPublic

Authored by ilya-biryukov on Sep 19 2017, 3:20 AM.

Details

Summary

Calls to onDiagnosticsReady were done concurrently before. This sometimes
led to older versions of diagnostics being reported to the user after
the newer versions.

Event Timeline

ilya-biryukov created this revision.Sep 19 2017, 3:20 AM
  • Removed an incidental Mutex.unlock(), a leftover from previous drafts.
klimek added inline comments.Sep 20 2017, 3:41 AM
clangd/ClangdServer.cpp
323–326

Why is this a FIXME? Do we intend to use a different mechanism? 2^64 versions of a file seem to be a lot?

unittests/clangd/ClangdTests.cpp
918

Why not hand in a signal to wait for?

ilya-biryukov added inline comments.Sep 20 2017, 4:36 AM
clangd/ClangdServer.cpp
323–326

I think we can get rid of it after refactoring threading. But we should definitely be fine with 2^64 versions.

unittests/clangd/ClangdTests.cpp
918

The signal should be fired on a second call to onDiagnosticsReady, but the second call won't happen before the fist one returns.
Is there some other way to fire the signal that I'm missing?

klimek accepted this revision.Sep 20 2017, 4:48 AM

LG

clangd/ClangdServer.h
292

Comment what it maps from.

unittests/clangd/ClangdTests.cpp
918

Thinking a bit more about it, I can't find a better way.

This revision is now accepted and ready to land.Sep 20 2017, 4:48 AM
ilya-biryukov marked an inline comment as done.
  • Added a comment to version map.
  • Fixed compilation after rebase.

Thanks for the review!

This revision was automatically updated to reflect the committed changes.