[clangd] Fix clang-tidy warnings.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sat, 28 Oct 2017 17:32:56 +0000 (17:32 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sat, 28 Oct 2017 17:32:56 +0000 (17:32 +0000)
No functionality change intended.

llvm-svn: 316832

clang-tools-extra/clangd/ClangdLSPServer.h
clang-tools-extra/clangd/ClangdServer.cpp
clang-tools-extra/clangd/ClangdUnit.cpp
clang-tools-extra/clangd/ClangdUnit.h
clang-tools-extra/clangd/ClangdUnitStore.cpp
clang-tools-extra/clangd/ClangdUnitStore.h
clang-tools-extra/clangd/tool/ClangdMain.cpp

index 12533c9..261ff61 100644 (file)
@@ -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.
index 528b6eb..035f3ee 100644 (file)
@@ -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));
index eba37da..1a86339 100644 (file)
@@ -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(
index c740586..88c5b4d 100644 (file)
@@ -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,
index 64abb46..0c905c8 100644 (file)
@@ -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);
index 0428883..cf7f1fb 100644 (file)
@@ -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);
index cdfb6fd..420ef3a 100644 (file)
@@ -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()) {