[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
This commit is contained in:
Jan Svoboda 2021-03-30 10:45:04 +02:00
parent df9597cf5a
commit 2b73565210
4 changed files with 18 additions and 33 deletions

View File

@ -67,12 +67,6 @@ struct ModuleDeps {
/// 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;

View File

@ -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;

View File

@ -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.

View File

@ -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 @@ public:
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 @@ public:
{"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));
}