This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG729f7b122081: [clang][deps] NFC: Remove CompilationDatabase 
from DependencyScanningWorker API (authored by jansvoboda11).

Changed prior to commit:
  https://reviews.llvm.org/D108980?vs=369663&id=371840#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108980/new/

https://reviews.llvm.org/D108980

Files:
  clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
  clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
  clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -318,9 +318,8 @@
 }
 
 llvm::Error DependencyScanningWorker::computeDependencies(
-    const std::string &Input, StringRef WorkingDirectory,
-    const CompilationDatabase &CDB, DependencyConsumer &Consumer,
-    llvm::Optional<StringRef> ModuleName) {
+    StringRef WorkingDirectory, const std::vector<std::string> &CommandLine,
+    DependencyConsumer &Consumer, llvm::Optional<StringRef> ModuleName) {
   // Reset what might have been modified in the previous worker invocation.
   RealFS->setCurrentWorkingDirectory(WorkingDirectory);
   if (Files)
@@ -329,11 +328,6 @@
   llvm::IntrusiveRefCntPtr<FileManager> CurrentFiles =
       Files ? Files : new FileManager(FileSystemOptions(), RealFS);
 
-  // FIXME: Avoid this copy.
-  std::vector<CompileCommand> CompileCommands = CDB.getCompileCommands(Input);
-  const std::vector<std::string> &CommandLine =
-      CompileCommands.front().CommandLine;
-
   Optional<std::vector<std::string>> ModifiedCommandLine;
   if (ModuleName.hasValue()) {
     ModifiedCommandLine = CommandLine;
Index: clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
@@ -110,11 +110,13 @@
   // behavior.
   assert(Compilations.getAllCompileCommands().size() == 1 &&
          "Expected a compilation database with a single command!");
-  std::string Input = Compilations.getAllCompileCommands().front().Filename;
+  // FIXME: Avoid this copy.
+  std::vector<std::string> CommandLine =
+      Compilations.getAllCompileCommands().front().CommandLine;
 
   MakeDependencyPrinterConsumer Consumer;
-  auto Result = Worker.computeDependencies(Input, CWD, Compilations, Consumer,
-                                           ModuleName);
+  auto Result =
+      Worker.computeDependencies(CWD, CommandLine, Consumer, ModuleName);
   if (Result)
     return std::move(Result);
   std::string Output;
@@ -196,11 +198,13 @@
   // behavior.
   assert(Compilations.getAllCompileCommands().size() == 1 &&
          "Expected a compilation database with a single command!");
-  std::string Input = Compilations.getAllCompileCommands().front().Filename;
+  // FIXME: Avoid this copy.
+  std::vector<std::string> CommandLine =
+      Compilations.getAllCompileCommands().front().CommandLine;
 
   FullDependencyPrinterConsumer Consumer(AlreadySeen);
-  llvm::Error Result = Worker.computeDependencies(Input, CWD, Compilations,
-                                                  Consumer, ModuleName);
+  llvm::Error Result =
+      Worker.computeDependencies(CWD, CommandLine, Consumer, ModuleName);
   if (Result)
     return std::move(Result);
   return Consumer.getFullDependencies();
Index: clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
===================================================================
--- clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
+++ clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
@@ -74,16 +74,15 @@
 public:
   DependencyScanningWorker(DependencyScanningService &Service);
 
-  /// Run the dependency scanning tool for a given clang driver invocation (as
-  /// specified for the given Input in the CDB), and report the discovered
-  /// dependencies to the provided consumer. If \p ModuleName isn't empty, this
-  /// function reports the dependencies of module \p ModuleName.
+  /// Run the dependency scanning tool for a given clang driver command-line,
+  /// and report the discovered dependencies to the provided consumer. If \p
+  /// ModuleName isn't empty, this function reports the dependencies of module
+  /// \p ModuleName.
   ///
   /// \returns A \c StringError with the diagnostic output if clang errors
   /// occurred, success otherwise.
-  llvm::Error computeDependencies(const std::string &Input,
-                                  StringRef WorkingDirectory,
-                                  const CompilationDatabase &CDB,
+  llvm::Error computeDependencies(StringRef WorkingDirectory,
+                                  const std::vector<std::string> &CommandLine,
                                   DependencyConsumer &Consumer,
                                   llvm::Optional<StringRef> ModuleName = None);
 


Index: clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
@@ -318,9 +318,8 @@
 }
 
 llvm::Error DependencyScanningWorker::computeDependencies(
-    const std::string &Input, StringRef WorkingDirectory,
-    const CompilationDatabase &CDB, DependencyConsumer &Consumer,
-    llvm::Optional<StringRef> ModuleName) {
+    StringRef WorkingDirectory, const std::vector<std::string> &CommandLine,
+    DependencyConsumer &Consumer, llvm::Optional<StringRef> ModuleName) {
   // Reset what might have been modified in the previous worker invocation.
   RealFS->setCurrentWorkingDirectory(WorkingDirectory);
   if (Files)
@@ -329,11 +328,6 @@
   llvm::IntrusiveRefCntPtr<FileManager> CurrentFiles =
       Files ? Files : new FileManager(FileSystemOptions(), RealFS);
 
-  // FIXME: Avoid this copy.
-  std::vector<CompileCommand> CompileCommands = CDB.getCompileCommands(Input);
-  const std::vector<std::string> &CommandLine =
-      CompileCommands.front().CommandLine;
-
   Optional<std::vector<std::string>> ModifiedCommandLine;
   if (ModuleName.hasValue()) {
     ModifiedCommandLine = CommandLine;
Index: clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
+++ clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
@@ -110,11 +110,13 @@
   // behavior.
   assert(Compilations.getAllCompileCommands().size() == 1 &&
          "Expected a compilation database with a single command!");
-  std::string Input = Compilations.getAllCompileCommands().front().Filename;
+  // FIXME: Avoid this copy.
+  std::vector<std::string> CommandLine =
+      Compilations.getAllCompileCommands().front().CommandLine;
 
   MakeDependencyPrinterConsumer Consumer;
-  auto Result = Worker.computeDependencies(Input, CWD, Compilations, Consumer,
-                                           ModuleName);
+  auto Result =
+      Worker.computeDependencies(CWD, CommandLine, Consumer, ModuleName);
   if (Result)
     return std::move(Result);
   std::string Output;
@@ -196,11 +198,13 @@
   // behavior.
   assert(Compilations.getAllCompileCommands().size() == 1 &&
          "Expected a compilation database with a single command!");
-  std::string Input = Compilations.getAllCompileCommands().front().Filename;
+  // FIXME: Avoid this copy.
+  std::vector<std::string> CommandLine =
+      Compilations.getAllCompileCommands().front().CommandLine;
 
   FullDependencyPrinterConsumer Consumer(AlreadySeen);
-  llvm::Error Result = Worker.computeDependencies(Input, CWD, Compilations,
-                                                  Consumer, ModuleName);
+  llvm::Error Result =
+      Worker.computeDependencies(CWD, CommandLine, Consumer, ModuleName);
   if (Result)
     return std::move(Result);
   return Consumer.getFullDependencies();
Index: clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
===================================================================
--- clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
+++ clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
@@ -74,16 +74,15 @@
 public:
   DependencyScanningWorker(DependencyScanningService &Service);
 
-  /// Run the dependency scanning tool for a given clang driver invocation (as
-  /// specified for the given Input in the CDB), and report the discovered
-  /// dependencies to the provided consumer. If \p ModuleName isn't empty, this
-  /// function reports the dependencies of module \p ModuleName.
+  /// Run the dependency scanning tool for a given clang driver command-line,
+  /// and report the discovered dependencies to the provided consumer. If \p
+  /// ModuleName isn't empty, this function reports the dependencies of module
+  /// \p ModuleName.
   ///
   /// \returns A \c StringError with the diagnostic output if clang errors
   /// occurred, success otherwise.
-  llvm::Error computeDependencies(const std::string &Input,
-                                  StringRef WorkingDirectory,
-                                  const CompilationDatabase &CDB,
+  llvm::Error computeDependencies(StringRef WorkingDirectory,
+                                  const std::vector<std::string> &CommandLine,
                                   DependencyConsumer &Consumer,
                                   llvm::Optional<StringRef> ModuleName = None);
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D108980: [... Jan Svoboda via Phabricator via cfe-commits
    • [PATCH] D1089... Duncan P. N. Exon Smith via Phabricator via cfe-commits
    • [PATCH] D1089... Jan Svoboda via Phabricator via cfe-commits

Reply via email to