jansvoboda11 created this revision.
jansvoboda11 added reviewers: Bigcheese, dexonsmith.
jansvoboda11 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This patch removes the `-full-command-line` option from `clang-scan-deps`. It's 
only used with `-format=experimental-full`, where omitting the command lines 
doesn't make much sense. There are no tests without `-full-command-line`.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D100533

Files:
  clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/test/ClangScanDeps/modules-full.cpp
  clang/tools/clang-scan-deps/ClangScanDeps.cpp

Index: clang/tools/clang-scan-deps/ClangScanDeps.cpp
===================================================================
--- clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -131,11 +131,6 @@
     llvm::cl::init(ScanningOutputFormat::Make),
     llvm::cl::cat(DependencyScannerCategory));
 
-static llvm::cl::opt<bool> FullCommandLine(
-    "full-command-line",
-    llvm::cl::desc("Include the full command lines to use to build modules"),
-    llvm::cl::init(false), llvm::cl::cat(DependencyScannerCategory));
-
 llvm::cl::opt<unsigned>
     NumThreads("j", llvm::cl::Optional,
                llvm::cl::desc("Number of worker threads to use (default: use "
@@ -258,12 +253,11 @@
       Modules.insert(I, {{MD.ID, InputIndex}, std::move(MD)});
     }
 
-    if (FullCommandLine)
-      ID.AdditonalCommandLine = FD.getAdditionalCommandLine(
-          [&](ModuleID MID) { return lookupPCMPath(MID); },
-          [&](ModuleID MID) -> const ModuleDeps & {
-            return lookupModuleDeps(MID);
-          });
+    ID.AdditonalCommandLine = FD.getAdditionalCommandLine(
+        [&](ModuleID MID) { return lookupPCMPath(MID); },
+        [&](ModuleID MID) -> const ModuleDeps & {
+          return lookupModuleDeps(MID);
+        });
 
     Inputs.push_back(std::move(ID));
   }
@@ -294,14 +288,11 @@
           {"file-deps", toJSONSorted(MD.FileDeps)},
           {"clang-module-deps", toJSONSorted(MD.ClangModuleDeps)},
           {"clang-modulemap-file", MD.ClangModuleMapFile},
-          {"command-line",
-           FullCommandLine
-               ? MD.getFullCommandLine(
-                     [&](ModuleID MID) { return lookupPCMPath(MID); },
-                     [&](ModuleID MID) -> const ModuleDeps & {
-                       return lookupModuleDeps(MID);
-                     })
-               : MD.NonPathCommandLine},
+          {"command-line", MD.getFullCommandLine(
+                               [&](ModuleID MID) { return lookupPCMPath(MID); },
+                               [&](ModuleID MID) -> const ModuleDeps & {
+                                 return lookupModuleDeps(MID);
+                               })},
       };
       OutModules.push_back(std::move(O));
     }
Index: clang/test/ClangScanDeps/modules-full.cpp
===================================================================
--- clang/test/ClangScanDeps/modules-full.cpp
+++ clang/test/ClangScanDeps/modules-full.cpp
@@ -10,8 +10,8 @@
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb.json > %t.cdb
 //
 // RUN: echo %t.dir > %t.result
-// RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -full-command-line \
-// RUN:   -mode preprocess-minimized-sources -format experimental-full >> %t.result
+// RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
+// RUN:   -mode preprocess-minimized-sources >> %t.result
 // RUN: cat %t.result | sed 's/\\/\//g' | FileCheck --check-prefixes=CHECK %s
 
 // FIXME: Backslash issues.
Index: clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -20,13 +20,13 @@
 std::vector<std::string> ModuleDeps::getFullCommandLine(
     std::function<StringRef(ModuleID)> LookupPCMPath,
     std::function<const ModuleDeps &(ModuleID)> LookupModuleDeps) const {
-  std::vector<std::string> Ret = NonPathCommandLine;
-
   // TODO: Build full command line. That also means capturing the original
   //       command line into NonPathCommandLine.
 
-  Ret.push_back("-fno-implicit-modules");
-  Ret.push_back("-fno-implicit-module-maps");
+  std::vector<std::string> Ret{
+      "-fno-implicit-modules",
+      "-fno-implicit-module-maps",
+  };
 
   std::vector<std::string> PCMPaths;
   std::vector<std::string> ModMapPaths;
Index: clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
===================================================================
--- clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
+++ clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
@@ -67,12 +67,6 @@
   /// determined that the differences are benign for this compilation.
   std::vector<ModuleID> ClangModuleDeps;
 
-  /// A partial command line that can be used to build this module.
-  ///
-  /// Call \c getFullCommandLine() to get a command line suitable for passing to
-  /// clang.
-  std::vector<std::string> NonPathCommandLine;
-
   // Used to track which modules that were discovered were directly imported by
   // the primary TU.
   bool ImportedByMainFile = false;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to