diff --git a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h --- a/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h +++ b/clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h @@ -53,9 +53,6 @@ std::vector getCommandLine( llvm::function_ref LookupModuleOutput) const; - - /// Get the full command line, excluding -fmodule-file=" arguments. - std::vector getCommandLineWithoutModulePaths() const; }; struct FullDependenciesResult { diff --git a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h --- a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h +++ b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h @@ -138,10 +138,6 @@ std::vector getCanonicalCommandLine( llvm::function_ref LookupModuleOutput) const; - - /// Gets the canonical command line suitable for passing to clang, excluding - /// "-fmodule-file=" and "-o" arguments. - std::vector getCanonicalCommandLineWithoutModulePaths() const; }; class ModuleDepCollector; diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp --- a/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp +++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp @@ -16,24 +16,15 @@ std::vector FullDependencies::getCommandLine( llvm::function_ref LookupModuleOutput) const { - std::vector Ret = getCommandLineWithoutModulePaths(); - - for (ModuleID MID : ClangModuleDeps) { - auto PCM = LookupModuleOutput(MID, ModuleOutputKind::ModuleFile); - Ret.push_back("-fmodule-file=" + PCM); - } - - return Ret; -} - -std::vector -FullDependencies::getCommandLineWithoutModulePaths() const { std::vector 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 --- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp +++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp @@ -214,11 +214,6 @@ return toString(llvm::APInt(sizeof(Words) * 8, Words), 36, /*Signed=*/false); } -std::vector -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 --- 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 --- 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 --- a/clang/test/ClangScanDeps/modulemap-via-vfs.m +++ b/clang/test/ClangScanDeps/modulemap-via-vfs.m @@ -3,7 +3,7 @@ // RUN: sed -e "s|DIR|%/t.dir|g" %t.dir/build/compile-commands.json.in > %t.dir/build/compile-commands.json // 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 -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 --- 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 --- 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 --- 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 --- 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-fmodule-name-no-module-built.m b/clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m --- 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 --- 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 --- 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 --- 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 diff --git a/clang/test/ClangScanDeps/modules-no-undeclared-includes.c b/clang/test/ClangScanDeps/modules-no-undeclared-includes.c --- a/clang/test/ClangScanDeps/modules-no-undeclared-includes.c +++ b/clang/test/ClangScanDeps/modules-no-undeclared-includes.c @@ -30,7 +30,7 @@ // 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 --- 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 --- 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 --- a/clang/test/ClangScanDeps/modules-pch-dangling.c +++ b/clang/test/ClangScanDeps/modules-pch-dangling.c @@ -88,7 +88,7 @@ // // 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 @@ // // 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 --- 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 --- a/clang/test/ClangScanDeps/modules-symlink.c +++ b/clang/test/ClangScanDeps/modules-symlink.c @@ -41,7 +41,7 @@ // 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 @@ // 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 --- 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 --- 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 --- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp +++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -138,36 +138,11 @@ 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 different 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 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 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 OptimizeArgs( @@ -198,8 +173,7 @@ llvm::cl::list 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 @@ } 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 @@ {"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)); }