[clang] 2b73565 - [clang][deps] Remove the -full-command-line flag
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 19 03:28:09 PDT 2021
Author: Jan Svoboda
Date: 2021-04-19T12:28:02+02:00
New Revision: 2b73565210ef0b3b29e0f067eef150a32adbb967
URL: https://github.com/llvm/llvm-project/commit/2b73565210ef0b3b29e0f067eef150a32adbb967
DIFF: https://github.com/llvm/llvm-project/commit/2b73565210ef0b3b29e0f067eef150a32adbb967.diff
LOG: [clang][deps] Remove the -full-command-line flag
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`.
Depends on D100531.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D100533
Added:
Modified:
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
Removed:
################################################################################
diff --git a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
index d482607559b57..c85aed8af2c72 100644
--- a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
+++ b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
@@ -67,12 +67,6 @@ struct ModuleDeps {
/// determined that the
diff erences 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;
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index f9edae2d2f0ad..e85ac63843a5b 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -20,13 +20,13 @@ using namespace dependencies;
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;
diff --git a/clang/test/ClangScanDeps/modules-full.cpp b/clang/test/ClangScanDeps/modules-full.cpp
index 1f95d777422e7..14c08b25996b2 100644
--- a/clang/test/ClangScanDeps/modules-full.cpp
+++ b/clang/test/ClangScanDeps/modules-full.cpp
@@ -11,13 +11,13 @@
// RUN: sed -e "s|DIR|%/t.dir|g" %S/Inputs/modules_cdb_clangcl.json > %t_clangcl.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
// RUN: echo %t.dir > %t_clangcl.result
-// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -full-command-line \
-// RUN: -mode preprocess-minimized-sources -format experimental-full >> %t_clangcl.result
+// RUN: clang-scan-deps -compilation-database %t_clangcl.cdb -j 4 -format experimental-full \
+// RUN: -mode preprocess-minimized-sources >> %t_clangcl.result
// RUN: cat %t_clangcl.result | sed 's/\\/\//g' | FileCheck --check-prefixes=CHECK %s
// FIXME: Backslash issues.
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index baae2c615c625..00cbc0f2fce1c 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -138,11 +138,6 @@ static llvm::cl::opt<ScanningOutputFormat> Format(
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 "
@@ -265,12 +260,11 @@ class FullDeps {
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));
}
@@ -301,14 +295,11 @@ class FullDeps {
{"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));
}
More information about the cfe-commits
mailing list