[clang-tools-extra] r316832 - [clangd] Fix clang-tidy warnings.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 28 10:32:56 PDT 2017


Author: d0k
Date: Sat Oct 28 10:32:56 2017
New Revision: 316832

URL: http://llvm.org/viewvc/llvm-project?rev=316832&view=rev
Log:
[clangd] Fix clang-tidy warnings.

No functionality change intended.

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

Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.h?rev=316832&r1=316831&r2=316832&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdLSPServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h Sat Oct 28 10:32:56 2017
@@ -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.

Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=316832&r1=316831&r2=316832&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Sat Oct 28 10:32:56 2017
@@ -166,8 +166,8 @@ std::future<void> ClangdServer::addDocum
   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::forceRep
          "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));

Modified: clang-tools-extra/trunk/clangd/ClangdUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnit.cpp?rev=316832&r1=316831&r2=316832&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdUnit.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnit.cpp Sat Oct 28 10:32:56 2017
@@ -157,7 +157,7 @@ getOptionalParameters(const CodeCompleti
   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<
       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::CodeC
 }
 
 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, t
 }
 
 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::
   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(

Modified: clang-tools-extra/trunk/clangd/ClangdUnit.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnit.h?rev=316832&r1=316831&r2=316832&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdUnit.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnit.h Sat Oct 28 10:32:56 2017
@@ -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,

Modified: clang-tools-extra/trunk/clangd/ClangdUnitStore.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnitStore.cpp?rev=316832&r1=316831&r2=316832&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdUnitStore.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnitStore.cpp Sat Oct 28 10:32:56 2017
@@ -29,8 +29,7 @@ std::shared_ptr<CppFile> CppFileCollecti
 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);

Modified: clang-tools-extra/trunk/clangd/ClangdUnitStore.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdUnitStore.h?rev=316832&r1=316831&r2=316832&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdUnitStore.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdUnitStore.h Sat Oct 28 10:32:56 2017
@@ -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);

Modified: clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp?rev=316832&r1=316831&r2=316832&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp (original)
+++ clang-tools-extra/trunk/clangd/tool/ClangdMain.cpp Sat Oct 28 10:32:56 2017
@@ -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()) {




More information about the cfe-commits mailing list