From 5349eedfdd762162c6380a2351f08f129ee7d292 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 28 Oct 2017 17:32:56 +0000 Subject: [PATCH] [clangd] Fix clang-tidy warnings. No functionality change intended. llvm-svn: 316832 --- clang-tools-extra/clangd/ClangdLSPServer.h | 6 ------ clang-tools-extra/clangd/ClangdServer.cpp | 8 ++++---- clang-tools-extra/clangd/ClangdUnit.cpp | 18 +++++++++--------- clang-tools-extra/clangd/ClangdUnit.h | 5 +++-- clang-tools-extra/clangd/ClangdUnitStore.cpp | 3 +-- clang-tools-extra/clangd/ClangdUnitStore.h | 6 ++---- clang-tools-extra/clangd/tool/ClangdMain.cpp | 1 - 7 files changed, 19 insertions(+), 28 deletions(-) diff --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h index 12533c9..261ff61 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.h +++ b/clang-tools-extra/clangd/ClangdLSPServer.h @@ -73,12 +73,6 @@ private: std::vector 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 Diagnostics); - JSONOutput &Out; /// Used to indicate that the 'shutdown' request was received from the /// Language Server client. diff --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp index 528b6eb..035f3ee 100644 --- a/clang-tools-extra/clangd/ClangdServer.cpp +++ b/clang-tools-extra/clangd/ClangdServer.cpp @@ -166,8 +166,8 @@ std::future ClangdServer::addDocument(PathRef File, StringRef Contents) { DocVersion Version = DraftMgr.updateDraft(File, Contents); auto TaggedFS = FSProvider.getTaggedFileSystem(File); - std::shared_ptr Resources = Units.getOrCreateFile( - File, ResourceDir, CDB, PCHs, TaggedFS.Value, Logger); + std::shared_ptr 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 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/clang-tools-extra/clangd/ClangdUnit.cpp b/clang-tools-extra/clangd/ClangdUnit.cpp index eba37da..1a86339 100644 --- a/clang-tools-extra/clangd/ClangdUnit.cpp +++ b/clang-tools-extra/clangd/ClangdUnit.cpp @@ -157,7 +157,7 @@ getOptionalParameters(const CodeCompletionString &CCS, return Result; } -llvm::Optional toClangdDiag(StoredDiagnostic D) { +llvm::Optional 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 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 -clangd::codeComplete(PathRef FileName, tooling::CompileCommand Command, +clangd::codeComplete(PathRef FileName, const tooling::CompileCommand &Command, PrecompiledPreamble const *Preamble, StringRef Contents, Position Pos, IntrusiveRefCntPtr VFS, std::shared_ptr 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, std::shared_ptr PCHs, @@ -859,9 +859,9 @@ ParsedAST::Build(std::unique_ptr CI, std::vector 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 CICleanup( diff --git a/clang-tools-extra/clangd/ClangdUnit.h b/clang-tools-extra/clangd/ClangdUnit.h index c740586..88c5b4d 100644 --- a/clang-tools-extra/clangd/ClangdUnit.h +++ b/clang-tools-extra/clangd/ClangdUnit.h @@ -289,14 +289,15 @@ struct CodeCompleteOptions { /// Get code completions at a specified \p Pos in \p FileName. std::vector -codeComplete(PathRef FileName, tooling::CompileCommand Command, +codeComplete(PathRef FileName, const tooling::CompileCommand &Command, PrecompiledPreamble const *Preamble, StringRef Contents, Position Pos, IntrusiveRefCntPtr VFS, std::shared_ptr 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, diff --git a/clang-tools-extra/clangd/ClangdUnitStore.cpp b/clang-tools-extra/clangd/ClangdUnitStore.cpp index 64abb46..0c905c8 100644 --- a/clang-tools-extra/clangd/ClangdUnitStore.cpp +++ b/clang-tools-extra/clangd/ClangdUnitStore.cpp @@ -29,8 +29,7 @@ std::shared_ptr CppFileCollection::removeIfPresent(PathRef File) { CppFileCollection::RecreateResult CppFileCollection::recreateFileIfCompileCommandChanged( PathRef File, PathRef ResourceDir, GlobalCompilationDatabase &CDB, - std::shared_ptr PCHs, - IntrusiveRefCntPtr VFS, clangd::Logger &Logger) { + std::shared_ptr PCHs, clangd::Logger &Logger) { auto NewCommand = getCompileCommand(CDB, File, ResourceDir); std::lock_guard Lock(Mutex); diff --git a/clang-tools-extra/clangd/ClangdUnitStore.h b/clang-tools-extra/clangd/ClangdUnitStore.h index 0428883..cf7f1fb 100644 --- a/clang-tools-extra/clangd/ClangdUnitStore.h +++ b/clang-tools-extra/clangd/ClangdUnitStore.h @@ -27,8 +27,7 @@ class CppFileCollection { public: std::shared_ptr getOrCreateFile( PathRef File, PathRef ResourceDir, GlobalCompilationDatabase &CDB, - std::shared_ptr PCHs, - IntrusiveRefCntPtr VFS, clangd::Logger &Logger) { + std::shared_ptr PCHs, clangd::Logger &Logger) { std::lock_guard 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 PCHs, - IntrusiveRefCntPtr VFS, clangd::Logger &Logger); + std::shared_ptr PCHs, clangd::Logger &Logger); std::shared_ptr getFile(PathRef File) { std::lock_guard Lock(Mutex); diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp index cdfb6fd..420ef3a 100644 --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/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 CompileCommandsDirPath; if (CompileCommandsDir.empty()) { -- 2.7.4