[clangd] Remove unused getDocument() API

This commit is contained in:
Sam McCall 2020-03-03 14:53:49 +01:00
parent 62fa3332c9
commit c0b27c4891
5 changed files with 0 additions and 24 deletions

View File

@ -194,10 +194,6 @@ void ClangdServer::addDocument(PathRef File, llvm::StringRef Contents,
void ClangdServer::removeDocument(PathRef File) { WorkScheduler.remove(File); }
llvm::StringRef ClangdServer::getDocument(PathRef File) const {
return WorkScheduler.getContents(File);
}
void ClangdServer::codeComplete(PathRef File, Position Pos,
const clangd::CodeCompleteOptions &Opts,
Callback<CodeCompleteResult> CB) {

View File

@ -175,9 +175,6 @@ public:
WantDiagnostics WD = WantDiagnostics::Auto,
bool ForceRebuild = false);
/// Get the contents of \p File, which should have been added.
llvm::StringRef getDocument(PathRef File) const;
/// Remove \p File from list of tracked files, schedule a request to free
/// resources associated with it. Pending diagnostics for closed files may not
/// be delivered, even if requested with WantDiags::Auto or WantDiags::Yes.

View File

@ -921,15 +921,6 @@ void TUScheduler::remove(PathRef File) {
File);
}
llvm::StringRef TUScheduler::getContents(PathRef File) const {
auto It = Files.find(File);
if (It == Files.end()) {
elog("getContents() for untracked file: {0}", File);
return "";
}
return It->second->Contents;
}
llvm::StringMap<std::string> TUScheduler::getAllFileContents() const {
llvm::StringMap<std::string> Results;
for (auto &It : Files)

View File

@ -213,10 +213,6 @@ public:
/// if requested with WantDiags::Auto or WantDiags::Yes.
void remove(PathRef File);
/// Returns the current contents of the buffer for File, per last update().
/// The returned StringRef may be invalidated by any write to TUScheduler.
llvm::StringRef getContents(PathRef File) const;
/// Returns a snapshot of all file buffer contents, per last update().
llvm::StringMap<std::string> getAllFileContents() const;

View File

@ -138,9 +138,7 @@ TEST_F(TUSchedulerTests, MissingFiles) {
auto Missing = testPath("missing.cpp");
Files[Missing] = "";
EXPECT_EQ(S.getContents(Added), "");
S.update(Added, getInputs(Added, "x"), WantDiagnostics::No);
EXPECT_EQ(S.getContents(Added), "x");
// Assert each operation for missing file is an error (even if it's
// available in VFS).
@ -159,9 +157,7 @@ TEST_F(TUSchedulerTests, MissingFiles) {
[&](Expected<InputsAndPreamble> Preamble) {
EXPECT_TRUE(bool(Preamble));
});
EXPECT_EQ(S.getContents(Added), "x");
S.remove(Added);
EXPECT_EQ(S.getContents(Added), "");
// Assert that all operations fail after removing the file.
S.runWithAST("", Added,