[PATCH] D54894: [clangd] Enable auto-index behind a flag.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 26 06:09:19 PST 2018
sammccall created this revision.
sammccall added a reviewer: kadircet.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay, ioeric, ilya-biryukov.
Ownership and configuration:
The auto-index (background index) is maintained by ClangdServer, like Dynamic.
(This means ClangdServer will be able to enqueue preamble indexing in future).
For now it's enabled by a simple boolean flag in ClangdServer::Options, but
we probably want to eventually allow injecting the storage strategy.
New 'sync' command:
In order to meaningfully test the integration (not just unit-test components)
we need a way for tests to ensure the asynchronous index reads/writes occur
before a certain point.
Because these tests and assertions are few, I think exposing an explicit "sync"
command for use in tests is simpler than allowing threading to be completely
disabled in the background index (as we do for TUScheduler).
Bugs:
I fixed a couple of trivial bugs I found while testing, but there's one I can't.
JSONCompilationDatabase::getAllFiles() may return relative paths, and currently
we trigger an assertion that assumes they are absolute.
There's no efficient way to resolve them (you have to retrieve the corresponding
command and then resolve against its directory property). In general I think
this behavior is broken and we should fix it in JSONCompilationDatabase and
require CompilationDatabase::getAllFiles() to be absolute.
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D54894
Files:
clangd/ClangdLSPServer.cpp
clangd/ClangdLSPServer.h
clangd/ClangdServer.cpp
clangd/ClangdServer.h
clangd/GlobalCompilationDatabase.cpp
clangd/index/BackgroundIndexStorage.cpp
clangd/tool/ClangdMain.cpp
test/clangd/Inputs/background-index/compile_commands.json
test/clangd/Inputs/background-index/definition.jsonrpc
test/clangd/Inputs/background-index/foo.cpp
test/clangd/Inputs/background-index/foo.h
test/clangd/background-index.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54894.175237.patch
Type: text/x-patch
Size: 11526 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181126/2c6e1d69/attachment.bin>
More information about the cfe-commits
mailing list