summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/clangd/TestFS.h
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2018-11-26 09:51:50 +0000
committerSam McCall <sam.mccall@gmail.com>2018-11-26 09:51:50 +0000
commit6e2d2a33b6be376e52688705db22534b336f5529 (patch)
tree1e7ed4997044b9a0784a97d8da0d945a05574616 /clang-tools-extra/unittests/clangd/TestFS.h
parentdbfa9c3e0a34807489d31fca7dac3de5c1e0446d (diff)
downloadbcm5719-llvm-6e2d2a33b6be376e52688705db22534b336f5529.tar.gz
bcm5719-llvm-6e2d2a33b6be376e52688705db22534b336f5529.zip
[clangd] Auto-index watches global CDB for changes.
Summary: 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. Reviewers: ioeric, kadircet Subscribers: MaskRay, jkorous, arphaman, cfe-commits, ilya-biryukov Differential Revision: https://reviews.llvm.org/D54865 llvm-svn: 347538
Diffstat (limited to 'clang-tools-extra/unittests/clangd/TestFS.h')
-rw-r--r--clang-tools-extra/unittests/clangd/TestFS.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang-tools-extra/unittests/clangd/TestFS.h b/clang-tools-extra/unittests/clangd/TestFS.h
index 56bf8a35591..0226fc3dcb5 100644
--- a/clang-tools-extra/unittests/clangd/TestFS.h
+++ b/clang-tools-extra/unittests/clangd/TestFS.h
@@ -41,7 +41,7 @@ public:
class MockCompilationDatabase : public GlobalCompilationDatabase {
public:
/// If \p Directory is not empty, use that as the Directory field of the
- /// CompileCommand.
+ /// CompileCommand, and as project SourceRoot.
///
/// If \p RelPathPrefix is not empty, use that as a prefix in front of the
/// source file name, instead of using an absolute path.
@@ -49,7 +49,7 @@ public:
StringRef RelPathPrefix = StringRef());
llvm::Optional<tooling::CompileCommand>
- getCompileCommand(PathRef File) const override;
+ getCompileCommand(PathRef File, ProjectInfo * = nullptr) const override;
std::vector<std::string> ExtraClangFlags;
OpenPOWER on IntegriCloud