This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Rewrote AST and Preamble management.
ClosedPublic

Authored by ilya-biryukov on Aug 1 2017, 2:30 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

ilya-biryukov created this revision.Aug 1 2017, 2:30 AM

I also want to rename ClangdUnit and ClangdUnitStore accordingly, but will do that in a separate commit so that git-svn correctly detects the renames (i.e. don't want file contents changes).

bkramer added inline comments.Aug 1 2017, 3:20 AM
clangd/ClangdServer.h
113 ↗(On Diff #109063)

Why the template? This is awkward now because it can only be called from ClangdServer.cpp

clangd/ClangdUnit.cpp
887–889 ↗(On Diff #109063)

Move implementation into header

910 ↗(On Diff #109063)

Move implementation into header.

clangd/ClangdUnit.h
104 ↗(On Diff #109063)

Typo: Providse

clangd/ClangdUnitStore.cpp
22 ↗(On Diff #109063)

Not introduced in this commit, but this is equivalent to OpenedFiles.erase(File) without the find and check.

  • Fixed a bug that caused CppFiles to be deleted while used.

Addressed review comments.

  • Moved implementations of template function to header.
  • Fixed a typo.
ilya-biryukov marked 3 inline comments as done.Aug 1 2017, 8:08 AM
ilya-biryukov added inline comments.
clangd/ClangdServer.h
113 ↗(On Diff #109063)

Storing std::futures with std::async(std::launch::deferred, ... makes things easier than storing std::function, as that allows to move into the caller(std::function must be copyable).
But we want to store only properly created std::futures, so we create them on our own, hence the signature similar to std::async.

I actually think that the signature itself is not that bad, but the fact that definition is only available in .cpp file is wrong. I've moved definintions to header.

clangd/ClangdUnitStore.cpp
22 ↗(On Diff #109063)

The code has changed a bit after initial submission. It returns removed element now and there seems to be no equivalent in StringMap for that.

bkramer accepted this revision.Aug 1 2017, 8:34 AM

ship it!

This revision is now accepted and ready to land.Aug 1 2017, 8:34 AM
This revision was automatically updated to reflect the committed changes.