aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2017-10-28 17:32:56 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2017-10-28 17:32:56 +0000
commite64c916212cae1e5c207ef8f07573febb8710632 (patch)
tree8efb5f949576876b496ebfa6d2b05bf361fc129c
parent8ce68f41833f47d4f3e82bb550140465d6eef85a (diff)
[clangd] Fix clang-tidy warnings.linaro-local/yvan.roux/B32999
No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@316832 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--clangd/ClangdLSPServer.h6
-rw-r--r--clangd/ClangdServer.cpp8
-rw-r--r--clangd/ClangdUnit.cpp18
-rw-r--r--clangd/ClangdUnit.h5
-rw-r--r--clangd/ClangdUnitStore.cpp3
-rw-r--r--clangd/ClangdUnitStore.h6
-rw-r--r--clangd/tool/ClangdMain.cpp1
7 files changed, 19 insertions, 28 deletions
diff --git a/clangd/ClangdLSPServer.h b/clangd/ClangdLSPServer.h
index 12533c97..261ff611 100644
--- a/clangd/ClangdLSPServer.h
+++ b/clangd/ClangdLSPServer.h
@@ -73,12 +73,6 @@ private:
std::vector<clang::tooling::Replacement>
getFixIts(StringRef File, const clangd::Diagnostic &D);
- /// Function that will be called on a separate thread when diagnostics are
- /// ready. Sends the Dianostics to LSP client via Out.writeMessage and caches
- /// corresponding fixits in the FixItsMap.
- void consumeDiagnostics(PathRef File,
- std::vector<DiagWithFixIts> Diagnostics);
-
JSONOutput &Out;
/// Used to indicate that the 'shutdown' request was received from the
/// Language Server client.
diff --git a/clangd/ClangdServer.cpp b/clangd/ClangdServer.cpp
index 528b6eba..035f3ee2 100644
--- a/clangd/ClangdServer.cpp
+++ b/clangd/ClangdServer.cpp
@@ -166,8 +166,8 @@ std::future<void> ClangdServer::addDocument(PathRef File, StringRef Contents) {
DocVersion Version = DraftMgr.updateDraft(File, Contents);
auto TaggedFS = FSProvider.getTaggedFileSystem(File);
- std::shared_ptr<CppFile> Resources = Units.getOrCreateFile(
- File, ResourceDir, CDB, PCHs, TaggedFS.Value, Logger);
+ std::shared_ptr<CppFile> Resources =
+ Units.getOrCreateFile(File, ResourceDir, CDB, PCHs, Logger);
return scheduleReparseAndDiags(File, VersionedDraft{Version, Contents.str()},
std::move(Resources), std::move(TaggedFS));
}
@@ -184,8 +184,8 @@ std::future<void> ClangdServer::forceReparse(PathRef File) {
"forceReparse() was called for non-added document");
auto TaggedFS = FSProvider.getTaggedFileSystem(File);
- auto Recreated = Units.recreateFileIfCompileCommandChanged(
- File, ResourceDir, CDB, PCHs, TaggedFS.Value, Logger);
+ auto Recreated = Units.recreateFileIfCompileCommandChanged(File, ResourceDir,
+ CDB, PCHs, Logger);
// Note that std::future from this cleanup action is ignored.
scheduleCancelRebuild(std::move(Recreated.RemovedFile));
diff --git a/clangd/ClangdUnit.cpp b/clangd/ClangdUnit.cpp
index eba37da6..1a863394 100644
--- a/clangd/ClangdUnit.cpp
+++ b/clangd/ClangdUnit.cpp
@@ -157,7 +157,7 @@ getOptionalParameters(const CodeCompletionString &CCS,
return Result;
}
-llvm::Optional<DiagWithFixIts> toClangdDiag(StoredDiagnostic D) {
+llvm::Optional<DiagWithFixIts> toClangdDiag(const StoredDiagnostic &D) {
auto Location = D.getLocation();
if (!Location.isValid() || !Location.getManager().isInMainFile(Location))
return llvm::None;
@@ -744,9 +744,9 @@ bool invokeCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
Preamble = nullptr;
}
- auto Clang = prepareCompilerInstance(std::move(CI), Preamble,
- std::move(ContentsBuffer), PCHs, VFS,
- DummyDiagsConsumer);
+ auto Clang = prepareCompilerInstance(
+ std::move(CI), Preamble, std::move(ContentsBuffer), std::move(PCHs),
+ std::move(VFS), DummyDiagsConsumer);
auto &DiagOpts = Clang->getDiagnosticOpts();
DiagOpts.IgnoreWarnings = true;
@@ -804,7 +804,7 @@ clang::CodeCompleteOptions clangd::CodeCompleteOptions::getClangCompleteOpts() {
}
std::vector<CompletionItem>
-clangd::codeComplete(PathRef FileName, tooling::CompileCommand Command,
+clangd::codeComplete(PathRef FileName, const tooling::CompileCommand &Command,
PrecompiledPreamble const *Preamble, StringRef Contents,
Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
std::shared_ptr<PCHContainerOperations> PCHs,
@@ -826,7 +826,7 @@ clangd::codeComplete(PathRef FileName, tooling::CompileCommand Command,
}
SignatureHelp
-clangd::signatureHelp(PathRef FileName, tooling::CompileCommand Command,
+clangd::signatureHelp(PathRef FileName, const tooling::CompileCommand &Command,
PrecompiledPreamble const *Preamble, StringRef Contents,
Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
std::shared_ptr<PCHContainerOperations> PCHs,
@@ -859,9 +859,9 @@ ParsedAST::Build(std::unique_ptr<clang::CompilerInvocation> CI,
std::vector<DiagWithFixIts> ASTDiags;
StoreDiagsConsumer UnitDiagsConsumer(/*ref*/ ASTDiags);
- auto Clang =
- prepareCompilerInstance(std::move(CI), Preamble, std::move(Buffer), PCHs,
- VFS, /*ref*/ UnitDiagsConsumer);
+ auto Clang = prepareCompilerInstance(
+ std::move(CI), Preamble, std::move(Buffer), std::move(PCHs),
+ std::move(VFS), /*ref*/ UnitDiagsConsumer);
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<CompilerInstance> CICleanup(
diff --git a/clangd/ClangdUnit.h b/clangd/ClangdUnit.h
index c740586d..88c5b4d5 100644
--- a/clangd/ClangdUnit.h
+++ b/clangd/ClangdUnit.h
@@ -289,14 +289,15 @@ struct CodeCompleteOptions {
/// Get code completions at a specified \p Pos in \p FileName.
std::vector<CompletionItem>
-codeComplete(PathRef FileName, tooling::CompileCommand Command,
+codeComplete(PathRef FileName, const tooling::CompileCommand &Command,
PrecompiledPreamble const *Preamble, StringRef Contents,
Position Pos, IntrusiveRefCntPtr<vfs::FileSystem> VFS,
std::shared_ptr<PCHContainerOperations> PCHs,
clangd::CodeCompleteOptions Opts, clangd::Logger &Logger);
/// Get signature help at a specified \p Pos in \p FileName.
-SignatureHelp signatureHelp(PathRef FileName, tooling::CompileCommand Command,
+SignatureHelp signatureHelp(PathRef FileName,
+ const tooling::CompileCommand &Command,
PrecompiledPreamble const *Preamble,
StringRef Contents, Position Pos,
IntrusiveRefCntPtr<vfs::FileSystem> VFS,
diff --git a/clangd/ClangdUnitStore.cpp b/clangd/ClangdUnitStore.cpp
index 64abb469..0c905c81 100644
--- a/clangd/ClangdUnitStore.cpp
+++ b/clangd/ClangdUnitStore.cpp
@@ -29,8 +29,7 @@ std::shared_ptr<CppFile> CppFileCollection::removeIfPresent(PathRef File) {
CppFileCollection::RecreateResult
CppFileCollection::recreateFileIfCompileCommandChanged(
PathRef File, PathRef ResourceDir, GlobalCompilationDatabase &CDB,
- std::shared_ptr<PCHContainerOperations> PCHs,
- IntrusiveRefCntPtr<vfs::FileSystem> VFS, clangd::Logger &Logger) {
+ std::shared_ptr<PCHContainerOperations> PCHs, clangd::Logger &Logger) {
auto NewCommand = getCompileCommand(CDB, File, ResourceDir);
std::lock_guard<std::mutex> Lock(Mutex);
diff --git a/clangd/ClangdUnitStore.h b/clangd/ClangdUnitStore.h
index 04288837..cf7f1fb7 100644
--- a/clangd/ClangdUnitStore.h
+++ b/clangd/ClangdUnitStore.h
@@ -27,8 +27,7 @@ class CppFileCollection {
public:
std::shared_ptr<CppFile> getOrCreateFile(
PathRef File, PathRef ResourceDir, GlobalCompilationDatabase &CDB,
- std::shared_ptr<PCHContainerOperations> PCHs,
- IntrusiveRefCntPtr<vfs::FileSystem> VFS, clangd::Logger &Logger) {
+ std::shared_ptr<PCHContainerOperations> PCHs, clangd::Logger &Logger) {
std::lock_guard<std::mutex> Lock(Mutex);
auto It = OpenedFiles.find(File);
@@ -59,8 +58,7 @@ public:
/// will be returned in RecreateResult.RemovedFile.
RecreateResult recreateFileIfCompileCommandChanged(
PathRef File, PathRef ResourceDir, GlobalCompilationDatabase &CDB,
- std::shared_ptr<PCHContainerOperations> PCHs,
- IntrusiveRefCntPtr<vfs::FileSystem> VFS, clangd::Logger &Logger);
+ std::shared_ptr<PCHContainerOperations> PCHs, clangd::Logger &Logger);
std::shared_ptr<CppFile> getFile(PathRef File) {
std::lock_guard<std::mutex> Lock(Mutex);
diff --git a/clangd/tool/ClangdMain.cpp b/clangd/tool/ClangdMain.cpp
index cdfb6fd7..420ef3a8 100644
--- a/clangd/tool/ClangdMain.cpp
+++ b/clangd/tool/ClangdMain.cpp
@@ -89,7 +89,6 @@ int main(int argc, char *argv[]) {
// If --compile-commands-dir arg was invoked, check value and override default
// path.
- namespace path = llvm::sys::path;
llvm::Optional<Path> CompileCommandsDirPath;
if (CompileCommandsDir.empty()) {