[llvm-branch-commits] [clang] 844e372 - [clang][deps] Always generate module paths

Jan Svoboda via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Aug 10 11:56:29 PDT 2022


Author: Jan Svoboda
Date: 2022-08-10T11:55:17-07:00
New Revision: 844e3728fff59f00f9b4d6552acbcc0de41b6dd0

URL: https://github.com/llvm/llvm-project/commit/844e3728fff59f00f9b4d6552acbcc0de41b6dd0
DIFF: https://github.com/llvm/llvm-project/commit/844e3728fff59f00f9b4d6552acbcc0de41b6dd0.diff

LOG: [clang][deps] Always generate module paths

Since D129389 (and downstream PR https://github.com/apple/llvm-project/pull/4965), the dependency scanner is responsible for generating full command-lines, including the modules paths. This patch removes the flag that was making this an opt-in behavior in clang-scan-deps.

Reviewed By: benlangmuir

Differential Revision: https://reviews.llvm.org/D131420

Added: 
    

Modified: 
    clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
    clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
    clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
    clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
    clang/test/ClangScanDeps/diagnostics.c
    clang/test/ClangScanDeps/generate-modules-path-args.c
    clang/test/ClangScanDeps/modulemap-via-vfs.m
    clang/test/ClangScanDeps/modules-context-hash-module-map-path.c
    clang/test/ClangScanDeps/modules-context-hash-outputs.c
    clang/test/ClangScanDeps/modules-context-hash.c
    clang/test/ClangScanDeps/modules-disable-free.c
    clang/test/ClangScanDeps/modules-file-path-isolation.c
    clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
    clang/test/ClangScanDeps/modules-full.cpp
    clang/test/ClangScanDeps/modules-inferred-explicit-build.m
    clang/test/ClangScanDeps/modules-inferred.m
    clang/test/ClangScanDeps/modules-no-undeclared-includes.c
    clang/test/ClangScanDeps/modules-pch-common-submodule.c
    clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
    clang/test/ClangScanDeps/modules-pch-dangling.c
    clang/test/ClangScanDeps/modules-pch.c
    clang/test/ClangScanDeps/modules-symlink.c
    clang/test/ClangScanDeps/removed-args.c
    clang/test/ClangScanDeps/submodule-order.c
    clang/tools/clang-scan-deps/ClangScanDeps.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
index 0a092a433a22c..77263cd6233b8 100644
--- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
+++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
@@ -53,9 +53,6 @@ struct FullDependencies {
   std::vector<std::string> getCommandLine(
       llvm::function_ref<std::string(const ModuleID &, ModuleOutputKind)>
           LookupModuleOutput) const;
-
-  /// Get the full command line, excluding -fmodule-file=" arguments.
-  std::vector<std::string> getCommandLineWithoutModulePaths() const;
 };
 
 struct FullDependenciesResult {

diff  --git a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
index f4f13a34b1746..18c342ee85c11 100644
--- a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
+++ b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
@@ -138,10 +138,6 @@ struct ModuleDeps {
   std::vector<std::string> getCanonicalCommandLine(
       llvm::function_ref<std::string(const ModuleID &, ModuleOutputKind)>
           LookupModuleOutput) const;
-
-  /// Gets the canonical command line suitable for passing to clang, excluding
-  /// "-fmodule-file=" and "-o" arguments.
-  std::vector<std::string> getCanonicalCommandLineWithoutModulePaths() const;
 };
 
 class ModuleDepCollector;

diff  --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
index 411fd9676ffdb..03ad6dcc51b30 100644
--- a/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
+++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
@@ -16,24 +16,15 @@ using namespace dependencies;
 std::vector<std::string> FullDependencies::getCommandLine(
     llvm::function_ref<std::string(const ModuleID &, ModuleOutputKind)>
         LookupModuleOutput) const {
-  std::vector<std::string> Ret = getCommandLineWithoutModulePaths();
-
-  for (ModuleID MID : ClangModuleDeps) {
-    auto PCM = LookupModuleOutput(MID, ModuleOutputKind::ModuleFile);
-    Ret.push_back("-fmodule-file=" + PCM);
-  }
-
-  return Ret;
-}
-
-std::vector<std::string>
-FullDependencies::getCommandLineWithoutModulePaths() const {
   std::vector<std::string> Args = OriginalCommandLine;
 
   Args.push_back("-fno-implicit-modules");
   Args.push_back("-fno-implicit-module-maps");
   for (const PrebuiltModuleDep &PMD : PrebuiltModuleDeps)
     Args.push_back("-fmodule-file=" + PMD.PCMFile);
+  for (ModuleID MID : ClangModuleDeps)
+    Args.push_back("-fmodule-file=" +
+                   LookupModuleOutput(MID, ModuleOutputKind::ModuleFile));
 
   // These arguments are unused in explicit compiles.
   llvm::erase_if(Args, [](StringRef Arg) {

diff  --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index b3726b09a4400..c6e7b08f3a2b0 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -214,11 +214,6 @@ static std::string getModuleContextHash(const ModuleDeps &MD) {
   return toString(llvm::APInt(sizeof(Words) * 8, Words), 36, /*Signed=*/false);
 }
 
-std::vector<std::string>
-ModuleDeps::getCanonicalCommandLineWithoutModulePaths() const {
-  return serializeCompilerInvocation(BuildInvocation);
-}
-
 void ModuleDepCollectorPP::FileChanged(SourceLocation Loc,
                                        FileChangeReason Reason,
                                        SrcMgr::CharacteristicKind FileType,

diff  --git a/clang/test/ClangScanDeps/diagnostics.c b/clang/test/ClangScanDeps/diagnostics.c
index 0b36abc744062..bf42d3bf0e142 100644
--- a/clang/test/ClangScanDeps/diagnostics.c
+++ b/clang/test/ClangScanDeps/diagnostics.c
@@ -37,8 +37,8 @@
 // CHECK-NEXT:       ],
 // CHECK-NEXT:       "command-line": [
 // CHECK:              "-fno-implicit-modules"
-// CHECK-NEXT:         "-fno-implicit-module-maps"
-// CHECK-NEXT:       ],
+// CHECK:              "-fno-implicit-module-maps"
+// CHECK:            ],
 // CHECK-NEXT:       "file-deps": [
 // CHECK-NEXT:         "[[PREFIX]]/tu.c"
 // CHECK-NEXT:       ],

diff  --git a/clang/test/ClangScanDeps/generate-modules-path-args.c b/clang/test/ClangScanDeps/generate-modules-path-args.c
index 31fb3e897c641..a303b5883bd3d 100644
--- a/clang/test/ClangScanDeps/generate-modules-path-args.c
+++ b/clang/test/ClangScanDeps/generate-modules-path-args.c
@@ -3,16 +3,16 @@
 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
 // RUN: sed "s|DIR|%/t|g" %t/cdb_without.json.template > %t/cdb_without.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json \
-// RUN:   -format experimental-full -generate-modules-path-args > %t/deps.json
+// RUN:   -format experimental-full > %t/deps.json
 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
 // RUN: clang-scan-deps -compilation-database %t/cdb.json \
-// RUN:   -format experimental-full -generate-modules-path-args -dependency-target foo > %t/deps_mt1.json
+// RUN:   -format experimental-full -dependency-target foo > %t/deps_mt1.json
 // RUN: cat %t/deps_mt1.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s -check-prefix=DEPS_MT1
 // RUN: clang-scan-deps -compilation-database %t/cdb.json \
-// RUN:   -format experimental-full -generate-modules-path-args -dependency-target foo -dependency-target bar > %t/deps_mt2.json
+// RUN:   -format experimental-full -dependency-target foo -dependency-target bar > %t/deps_mt2.json
 // RUN: cat %t/deps_mt2.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s -check-prefix=DEPS_MT2
 // RUN: clang-scan-deps -compilation-database %t/cdb_without.json \
-// RUN:   -format experimental-full -generate-modules-path-args > %t/deps_without.json
+// RUN:   -format experimental-full > %t/deps_without.json
 // RUN: cat %t/deps_without.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t -check-prefix=WITHOUT %s
 
 // CHECK:      {

diff  --git a/clang/test/ClangScanDeps/modulemap-via-vfs.m b/clang/test/ClangScanDeps/modulemap-via-vfs.m
index 870aa820dacc9..6eb7df725a686 100644
--- a/clang/test/ClangScanDeps/modulemap-via-vfs.m
+++ b/clang/test/ClangScanDeps/modulemap-via-vfs.m
@@ -4,7 +4,7 @@
 // RUN: sed -e "s|DIR|%/t.dir|g" %t.dir/build/vfs.yaml.in > %t.dir/build/vfs.yaml
 // RUN: clang-scan-deps -compilation-database %t.dir/build/compile-commands.json \
 // RUN:   -reuse-filemanager=0 -j 1 -format experimental-full \
-// RUN:   -mode preprocess-dependency-directives -generate-modules-path-args > %t.db
+// RUN:   -mode preprocess-dependency-directives > %t.db
 // RUN: %deps-to-rsp %t.db --module-name=A > %t.A.cc1.rsp
 // RUN: cat %t.A.cc1.rsp | sed 's:\\\\\?:/:g' | FileCheck %s
 

diff  --git a/clang/test/ClangScanDeps/modules-context-hash-module-map-path.c b/clang/test/ClangScanDeps/modules-context-hash-module-map-path.c
index 0fde558ab095d..150112d008498 100644
--- a/clang/test/ClangScanDeps/modules-context-hash-module-map-path.c
+++ b/clang/test/ClangScanDeps/modules-context-hash-module-map-path.c
@@ -8,13 +8,13 @@
 // RUN: split-file %s %t
 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
 
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 -generate-modules-path-args \
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
 // RUN:   -format experimental-full > %t/deps.json
 
 // RUN: mv %t/module.modulemap %t/module.map
 // RUN: echo 'AFTER_MOVE' >> %t/deps.json
 
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 -generate-modules-path-args \
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
 // RUN:   -format experimental-full >> %t/deps.json
 
 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s

diff  --git a/clang/test/ClangScanDeps/modules-context-hash-outputs.c b/clang/test/ClangScanDeps/modules-context-hash-outputs.c
index 3eb7ec7020b7e..041c7cd60fe4f 100644
--- a/clang/test/ClangScanDeps/modules-context-hash-outputs.c
+++ b/clang/test/ClangScanDeps/modules-context-hash-outputs.c
@@ -5,7 +5,7 @@
 // RUN: split-file %s %t
 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
 
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 -generate-modules-path-args \
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 \
 // RUN:   -format experimental-full > %t/deps.json
 // RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s
 

diff  --git a/clang/test/ClangScanDeps/modules-context-hash.c b/clang/test/ClangScanDeps/modules-context-hash.c
index 7968e0284783b..2b285f8b14ce3 100644
--- a/clang/test/ClangScanDeps/modules-context-hash.c
+++ b/clang/test/ClangScanDeps/modules-context-hash.c
@@ -48,9 +48,7 @@
 // CHECK-NEXT:         }
 // CHECK-NEXT:       ],
 // CHECK-NEXT:       "command-line": [
-// CHECK:              "-fno-implicit-modules",
-// CHECK-NEXT:         "-fno-implicit-module-maps"
-// CHECK-NEXT:       ],
+// CHECK:            ],
 // CHECK-NEXT:       "file-deps": [
 // CHECK-NEXT:         "[[PREFIX]]/tu.c"
 // CHECK-NEXT:       ],
@@ -89,9 +87,7 @@
 // CHECK-NEXT:         }
 // CHECK-NEXT:       ],
 // CHECK-NEXT:       "command-line": [
-// CHECK:              "-fno-implicit-modules",
-// CHECK-NEXT:         "-fno-implicit-module-maps"
-// CHECK-NEXT:       ],
+// CHECK:            ],
 // CHECK-NEXT:       "file-deps": [
 // CHECK-NEXT:         "[[PREFIX]]/tu.c"
 // CHECK-NEXT:       ],

diff  --git a/clang/test/ClangScanDeps/modules-disable-free.c b/clang/test/ClangScanDeps/modules-disable-free.c
index 16e5092128764..35ca8cc3c88cd 100644
--- a/clang/test/ClangScanDeps/modules-disable-free.c
+++ b/clang/test/ClangScanDeps/modules-disable-free.c
@@ -3,7 +3,7 @@
 // RUN: sed -e "s|DIR|%/t|g" %t/compile-commands.json.in > %t/compile-commands.json
 
 // RUN: clang-scan-deps -compilation-database %t/compile-commands.json -j 1 -format experimental-full \
-// RUN:   -mode preprocess-dependency-directives -generate-modules-path-args > %t/output
+// RUN:   -mode preprocess-dependency-directives > %t/output
 // RUN: FileCheck %s < %t/output
 
 // CHECK: "-disable-free",

diff  --git a/clang/test/ClangScanDeps/modules-file-path-isolation.c b/clang/test/ClangScanDeps/modules-file-path-isolation.c
index e57157f2adbb3..0e55bba753841 100644
--- a/clang/test/ClangScanDeps/modules-file-path-isolation.c
+++ b/clang/test/ClangScanDeps/modules-file-path-isolation.c
@@ -11,7 +11,7 @@
 // RUN: ln -s A.h %t/Z.h
 
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 -format experimental-full \
-// RUN:   -mode preprocess-dependency-directives -generate-modules-path-args > %t/output
+// RUN:   -mode preprocess-dependency-directives > %t/output
 // RUN: FileCheck %s < %t/output
 
 // CHECK:      "modules": [

diff  --git a/clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m b/clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
index 52868308743ef..f9430bb876c7d 100644
--- a/clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
+++ b/clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
@@ -10,7 +10,7 @@
 // RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/module_fmodule_name_cdb.json > %t.cdb
 
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -format experimental-full \
-// RUN:   -generate-modules-path-args -mode preprocess-dependency-directives > %t.result
+// RUN:   -mode preprocess-dependency-directives > %t.result
 // RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK %s
 
 #import "header3.h"

diff  --git a/clang/test/ClangScanDeps/modules-full.cpp b/clang/test/ClangScanDeps/modules-full.cpp
index bce764b8952a3..ac8a71b86d9bd 100644
--- a/clang/test/ClangScanDeps/modules-full.cpp
+++ b/clang/test/ClangScanDeps/modules-full.cpp
@@ -12,20 +12,16 @@
 //
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
 // RUN:   -mode preprocess-dependency-directives > %t.result
-// RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-NO-ABS %s
-//
-// RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
-// RUN:   -generate-modules-path-args -mode preprocess-dependency-directives > %t.result
 // RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-ABS %s
 //
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 4 -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t.dir/custom \
+// RUN:   -module-files-dir %t.dir/custom \
 // RUN:   -mode preprocess-dependency-directives > %t.result
 // RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-CUSTOM %s
 //
 // RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -format experimental-full \
 // RUN:   -mode preprocess-dependency-directives > %t_clangcl.result
-// RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-NO-ABS %s
+// RUN: cat %t_clangcl.result | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t.dir --check-prefixes=CHECK,CHECK-ABS %s
 
 #include "header.h"
 
@@ -42,7 +38,6 @@
 // CHECK-NEXT:       "command-line": [
 // CHECK-NEXT:         "-cc1"
 // CHECK:              "-emit-module"
-// CHECK-NO-ABS-NOT:   "-fmodule-file={{.*}}"
 // CHECK-ABS:          "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H2_DINCLUDE]]/header2-{{[A-Z0-9]+}}.pcm"
 // CHECK-CUSTOM:       "-fmodule-file=[[PREFIX]]/custom/[[HASH_H2_DINCLUDE]]/header2-{{[A-Z0-9]+}}.pcm"
 // CHECK-NOT:          "-fimplicit-module-maps"
@@ -103,7 +98,6 @@
 // CHECK-NEXT:       "command-line": [
 // CHECK:              "-fno-implicit-modules"
 // CHECK-NEXT:         "-fno-implicit-module-maps"
-// CHECK-NO-ABS-NOT:   "-fmodule-file={{.*}}"
 // CHECK-ABS-NEXT:     "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
 // CHECK-CUSTOM-NEXT:  "-fmodule-file=[[PREFIX]]/custom/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
 // CHECK-NEXT:       ],
@@ -123,7 +117,6 @@
 // CHECK-NEXT:       "command-line": [
 // CHECK:              "-fno-implicit-modules"
 // CHECK-NEXT:         "-fno-implicit-module-maps"
-// CHECK-NO-ABS-NOT:   "-fmodule-file={{.*}},
 // CHECK-ABS-NEXT:     "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
 // CHECK-CUSTOM-NEXT:  "-fmodule-file=[[PREFIX]]/custom/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
 // CHECK-NEXT:       ],
@@ -143,7 +136,6 @@
 // CHECK-NEXT:       "command-line": [
 // CHECK:              "-fno-implicit-modules"
 // CHECK-NEXT:         "-fno-implicit-module-maps"
-// CHECK-NO-ABS-NOT:   "-fmodule-file={{.*}}"
 // CHECK-ABS-NEXT:     "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
 // CHECK-CUSTOM-NEXT:  "-fmodule-file=[[PREFIX]]/custom/[[HASH_H1]]/header1-{{[A-Z0-9]+}}.pcm"
 // CHECK-NEXT:       ],
@@ -163,7 +155,6 @@
 // CHECK-NEXT:       "command-line": [
 // CHECK:              "-fno-implicit-modules"
 // CHECK-NEXT:         "-fno-implicit-module-maps"
-// CHECK-NO-ABS-NOT:   "-fmodule-file={{.*}}"
 // CHECK-ABS-NEXT:     "-fmodule-file=[[PREFIX]]/module-cache{{(_clangcl)?}}/[[HASH_H1_DINCLUDE]]/header1-{{[A-Z0-9]+}}.pcm"
 // CHECK-CUSTOM-NEXT:  "-fmodule-file=[[PREFIX]]/custom/[[HASH_H1_DINCLUDE]]/header1-{{[A-Z0-9]+}}.pcm"
 // CHECK-NEXT:       ],

diff  --git a/clang/test/ClangScanDeps/modules-inferred-explicit-build.m b/clang/test/ClangScanDeps/modules-inferred-explicit-build.m
index 697e35b637d0b..6a631d4ab9d26 100644
--- a/clang/test/ClangScanDeps/modules-inferred-explicit-build.m
+++ b/clang/test/ClangScanDeps/modules-inferred-explicit-build.m
@@ -5,8 +5,7 @@
 // RUN: sed -e "s|DIR|%/t.dir|g" -e "s|FRAMEWORKS|%/S/Inputs/frameworks|g" -e "s|-E|-x objective-c -E|g" \
 // RUN:   %S/Inputs/modules_inferred_cdb.json > %t.cdb
 //
-// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -format experimental-full \
-// RUN:   -mode preprocess-dependency-directives -generate-modules-path-args > %t.db
+// RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -format experimental-full -mode preprocess-dependency-directives > %t.db
 // RUN: %deps-to-rsp %t.db --module-name=Inferred > %t.inferred.cc1.rsp
 // RUN: %deps-to-rsp %t.db --module-name=System > %t.system.cc1.rsp
 // RUN: %deps-to-rsp %t.db --tu-index=0 > %t.tu.rsp

diff  --git a/clang/test/ClangScanDeps/modules-inferred.m b/clang/test/ClangScanDeps/modules-inferred.m
index 71b0520ee16fd..0d7a6e06a7599 100644
--- a/clang/test/ClangScanDeps/modules-inferred.m
+++ b/clang/test/ClangScanDeps/modules-inferred.m
@@ -6,7 +6,7 @@
 // RUN:   %/S/Inputs/modules_inferred_cdb.json > %t.cdb
 //
 // RUN: clang-scan-deps -compilation-database %t.cdb -j 1 -format experimental-full \
-// RUN:   -generate-modules-path-args -mode preprocess-dependency-directives > %t.result
+// RUN:   -mode preprocess-dependency-directives > %t.result
 // RUN: cat %t.result | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t.dir -DSOURCEDIR=%/S --check-prefixes=CHECK
 
 #include <Inferred/Inferred.h>

diff  --git a/clang/test/ClangScanDeps/modules-no-undeclared-includes.c b/clang/test/ClangScanDeps/modules-no-undeclared-includes.c
index 166e89e623573..bdca47556a279 100644
--- a/clang/test/ClangScanDeps/modules-no-undeclared-includes.c
+++ b/clang/test/ClangScanDeps/modules-no-undeclared-includes.c
@@ -30,7 +30,7 @@ module User [no_undeclared_includes] { header "user.h" }
 
 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result.json
+// RUN:   -module-files-dir %t/build > %t/result.json
 // RUN: cat %t/result.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t
 
 // CHECK:        {

diff  --git a/clang/test/ClangScanDeps/modules-pch-common-submodule.c b/clang/test/ClangScanDeps/modules-pch-common-submodule.c
index 7d6eb0c2a394f..31068861d7e4c 100644
--- a/clang/test/ClangScanDeps/modules-pch-common-submodule.c
+++ b/clang/test/ClangScanDeps/modules-pch-common-submodule.c
@@ -15,7 +15,7 @@
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-submodule/cdb_pch.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_pch.json
+// RUN:   -module-files-dir %t/build > %t/result_pch.json
 // RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-PCH
 //
 // CHECK-PCH:      {
@@ -73,7 +73,7 @@
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-submodule/cdb_tu.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu.json
+// RUN:   -module-files-dir %t/build > %t/result_tu.json
 // RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU
 //
 // CHECK-TU:      {

diff  --git a/clang/test/ClangScanDeps/modules-pch-common-via-submodule.c b/clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
index 83434e664519d..239c7dde5282e 100644
--- a/clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
+++ b/clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
@@ -13,7 +13,7 @@
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-via-submodule/cdb_pch.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_pch.json
+// RUN:   -module-files-dir %t/build > %t/result_pch.json
 // RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-PCH
 //
 // CHECK-PCH:      {
@@ -70,7 +70,7 @@
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch-common-via-submodule/cdb_tu.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu.json
+// RUN:   -module-files-dir %t/build > %t/result_tu.json
 // RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU
 //
 // CHECK-TU:      {

diff  --git a/clang/test/ClangScanDeps/modules-pch-dangling.c b/clang/test/ClangScanDeps/modules-pch-dangling.c
index c0d0c08cd2c1c..89f63e556bef0 100644
--- a/clang/test/ClangScanDeps/modules-pch-dangling.c
+++ b/clang/test/ClangScanDeps/modules-pch-dangling.c
@@ -88,7 +88,7 @@ module mod    { header "mod.h"    }
 //
 // RUN: sed "s|DIR|%/t|g" %t/cdb_pch.json.template > %t/cdb_pch.json
 // RUN: clang-scan-deps -compilation-database %t/cdb_pch.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_pch.json
+// RUN:   -module-files-dir %t/build > %t/result_pch.json
 
 // Explicitly build the PCH:
 //
@@ -136,4 +136,4 @@ module mod    { header "mod.h"    }
 //
 // RUN: sed "s|DIR|%/t|g" %t/cdb_tu.json.template > %t/cdb_tu.json
 // RUN: clang-scan-deps -compilation-database %t/cdb_tu.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build
+// RUN:   -module-files-dir %t/build

diff  --git a/clang/test/ClangScanDeps/modules-pch.c b/clang/test/ClangScanDeps/modules-pch.c
index 9a7460b468212..61560589f3007 100644
--- a/clang/test/ClangScanDeps/modules-pch.c
+++ b/clang/test/ClangScanDeps/modules-pch.c
@@ -9,7 +9,7 @@
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_pch.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_pch.json
+// RUN:   -module-files-dir %t/build > %t/result_pch.json
 // RUN: cat %t/result_pch.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-PCH
 //
 // Check we didn't build the PCH during dependency scanning.
@@ -121,7 +121,7 @@
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu.json
+// RUN:   -module-files-dir %t/build > %t/result_tu.json
 // RUN: cat %t/result_tu.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU
 //
 // CHECK-TU:      {
@@ -179,7 +179,7 @@
 //
 // RUN: sed "s|DIR|%/t|g" %S/Inputs/modules-pch/cdb_tu_with_common.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu_with_common.json
+// RUN:   -module-files-dir %t/build > %t/result_tu_with_common.json
 // RUN: cat %t/result_tu_with_common.json | sed 's:\\\\\?:/:g' | FileCheck %s -DPREFIX=%/t -check-prefix=CHECK-TU-WITH-COMMON
 //
 // CHECK-TU-WITH-COMMON:      {

diff  --git a/clang/test/ClangScanDeps/modules-symlink.c b/clang/test/ClangScanDeps/modules-symlink.c
index a211871e1dfaf..c71c98323b35a 100644
--- a/clang/test/ClangScanDeps/modules-symlink.c
+++ b/clang/test/ClangScanDeps/modules-symlink.c
@@ -41,7 +41,7 @@ static int foo = MACRO; // Macro usage that will trigger
 
 // RUN: sed -e "s|DIR|%/t|g" %t/cdb_pch.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_pch.json
+// RUN:   -module-files-dir %t/build > %t/result_pch.json
 //
 // RUN: %deps-to-rsp %t/result_pch.json --module-name=mod > %t/mod.cc1.rsp
 // RUN: %deps-to-rsp %t/result_pch.json --tu-index=0 > %t/pch.rsp
@@ -51,4 +51,4 @@ static int foo = MACRO; // Macro usage that will trigger
 
 // RUN: sed -e "s|DIR|%/t|g" %t/cdb_tu.json > %t/cdb.json
 // RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full \
-// RUN:   -generate-modules-path-args -module-files-dir %t/build > %t/result_tu.json
+// RUN:   -module-files-dir %t/build > %t/result_tu.json

diff  --git a/clang/test/ClangScanDeps/removed-args.c b/clang/test/ClangScanDeps/removed-args.c
index 8be7c31578b98..8c07ca8d1f7e9 100644
--- a/clang/test/ClangScanDeps/removed-args.c
+++ b/clang/test/ClangScanDeps/removed-args.c
@@ -29,9 +29,6 @@
 // CHECK-NOT:          "-fbuild-session-timestamp=
 // CHECK-NOT:          "-fmodules-prune-interval=
 // CHECK-NOT:          "-fmodules-prune-after=
-// CHECK-NOT:          "-dependency-file"
-// CHECK-NOT:          "-MT"
-// CHECK-NOT:          "-serialize-diagnostic-file"
 // CHECK:            ],
 // CHECK-NEXT:       "context-hash": "[[HASH_MOD_HEADER:.*]]",
 // CHECK-NEXT:       "file-deps": [
@@ -53,9 +50,6 @@
 // CHECK-NOT:          "-fbuild-session-timestamp=
 // CHECK-NOT:          "-fmodules-prune-interval=
 // CHECK-NOT:          "-fmodules-prune-after=
-// CHECK-NOT:          "-dependency-file"
-// CHECK-NOT:          "-MT"
-// CHECK-NOT:          "-serialize-diagnostic-file"
 // CHECK:            ],
 // CHECK-NEXT:       "context-hash": "[[HASH_MOD_TU:.*]]",
 // CHECK-NEXT:       "file-deps": [

diff  --git a/clang/test/ClangScanDeps/submodule-order.c b/clang/test/ClangScanDeps/submodule-order.c
index 9ab84c120356f..3f2dbeccff3f0 100644
--- a/clang/test/ClangScanDeps/submodule-order.c
+++ b/clang/test/ClangScanDeps/submodule-order.c
@@ -1,9 +1,9 @@
 // RUN: rm -rf %t
 // RUN: split-file %s %t
 // RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -generate-modules-path-args > %t/deps1.json
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/deps1.json
 // RUN: mv %t/tu2.c %t/tu.c
-// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full -generate-modules-path-args > %t/deps2.json
+// RUN: clang-scan-deps -compilation-database %t/cdb.json -format experimental-full > %t/deps2.json
 // RUN: 
diff  -u %t/deps1.json %t/deps2.json
 // RUN: FileCheck %s < %t/deps1.json
 

diff  --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index aea9b913609f2..8dfa02cd3e0f8 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -138,36 +138,11 @@ static llvm::cl::opt<ScanningOutputFormat> Format(
     llvm::cl::init(ScanningOutputFormat::Make),
     llvm::cl::cat(DependencyScannerCategory));
 
-// This mode is mostly useful for development of explicitly built modules.
-// Command lines will contain arguments specifying modulemap file paths and
-// absolute paths to PCM files in the module cache directory.
-//
-// Build tools that want to put the PCM files in a 
diff erent location should use
-// the C++ APIs instead, of which there are two flavors:
-//
-// 1. APIs that generate arguments with paths PCM files via a callback provided
-//    by the client:
-//     * ModuleDeps::getCanonicalCommandLine(LookupPCMPath)
-//     * FullDependencies::getCommandLine(LookupPCMPath)
-//
-// 2. APIs that don't generate arguments with paths PCM files and instead expect
-//     the client to append them manually after the fact:
-//     * ModuleDeps::getCanonicalCommandLineWithoutModulePaths()
-//     * FullDependencies::getCommandLineWithoutModulePaths()
-//
-static llvm::cl::opt<bool> GenerateModulesPathArgs(
-    "generate-modules-path-args",
-    llvm::cl::desc(
-        "With '-format experimental-full', include arguments specifying "
-        "modules-related paths in the generated command lines: "
-        "'-fmodule-file=', '-o', '-fmodule-map-file='."),
-    llvm::cl::init(false), llvm::cl::cat(DependencyScannerCategory));
-
 static llvm::cl::opt<std::string> ModuleFilesDir(
     "module-files-dir",
-    llvm::cl::desc("With '-generate-modules-path-args', paths to module files "
-                   "in the generated command lines will begin with the "
-                   "specified directory instead the module cache directory."),
+    llvm::cl::desc(
+        "The build directory for modules. Defaults to the value of "
+        "'-fmodules-cache-path=' from command lines for implicit modules."),
     llvm::cl::cat(DependencyScannerCategory));
 
 static llvm::cl::opt<bool> OptimizeArgs(
@@ -198,8 +173,7 @@ llvm::cl::opt<std::string> ModuleName(
 
 llvm::cl::list<std::string> ModuleDepTargets(
     "dependency-target",
-    llvm::cl::desc("With '-generate-modules-path-args', the names of "
-                   "dependency targets for the dependency file"),
+    llvm::cl::desc("The names of dependency targets for the dependency file"),
     llvm::cl::cat(DependencyScannerCategory));
 
 enum ResourceDirRecipeKind {
@@ -295,11 +269,9 @@ class FullDeps {
     }
 
     ID.CommandLine =
-        GenerateModulesPathArgs
-            ? FD.getCommandLine([&](const ModuleID &MID, ModuleOutputKind MOK) {
-                return lookupModuleOutput(MID, MOK);
-              })
-            : FD.getCommandLineWithoutModulePaths();
+        FD.getCommandLine([&](const ModuleID &MID, ModuleOutputKind MOK) {
+          return lookupModuleOutput(MID, MOK);
+        });
     Inputs.push_back(std::move(ID));
   }
 
@@ -329,13 +301,10 @@ class FullDeps {
           {"file-deps", toJSONSorted(MD.FileDeps)},
           {"clang-module-deps", toJSONSorted(MD.ClangModuleDeps)},
           {"clang-modulemap-file", MD.ClangModuleMapFile},
-          {"command-line",
-           GenerateModulesPathArgs
-               ? MD.getCanonicalCommandLine(
-                     [&](const ModuleID &MID, ModuleOutputKind MOK) {
-                       return lookupModuleOutput(MID, MOK);
-                     })
-               : MD.getCanonicalCommandLineWithoutModulePaths()},
+          {"command-line", MD.getCanonicalCommandLine(
+                               [&](const ModuleID &MID, ModuleOutputKind MOK) {
+                                 return lookupModuleOutput(MID, MOK);
+                               })},
       };
       OutModules.push_back(std::move(O));
     }


        


More information about the llvm-branch-commits mailing list