[PATCH] D54865: [clangd] Auto-index watches global CDB for changes.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 23 12:38:08 PST 2018


sammccall created this revision.
sammccall added reviewers: ioeric, kadircet.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay.

Instead of receiving compilation commands, auto-index is triggered by just
filenames to reindex, and gets commands from the global comp DB internally.
This has advantages:

- more of the work can be done asynchronously (fetching compilation commands upfront can be slow for large CDBs)
- we get access to the CDB which can be used to retrieve interpolated commands for headers (useful in some cases where the original TU goes away)
- fits nicely with the filename-only change observation from r347297

The interface to GlobalCompilationDatabase gets extended: when retrieving a
compile command, the GCDB can optionally report the project the file belongs to.
This naturally fits together with getCompileCommand: it's hard to implement one
without the other. But because most callers don't care, I've ended up with an
awkward optional-out-param-in-virtual method pattern - maybe there's a better
one.

This is the main missing integration point between ClangdServer and
BackgroundIndex, after this we should be able to add an auto-index flag.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54865

Files:
  clangd/GlobalCompilationDatabase.cpp
  clangd/GlobalCompilationDatabase.h
  clangd/index/Background.cpp
  clangd/index/Background.h
  unittests/clangd/BackgroundIndexTests.cpp
  unittests/clangd/GlobalCompilationDatabaseTests.cpp
  unittests/clangd/TestFS.cpp
  unittests/clangd/TestFS.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54865.175138.patch
Type: text/x-patch
Size: 15186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181123/5b92e106/attachment.bin>


More information about the cfe-commits mailing list