[clang] c62220f - [clang][deps] NFC: Rename building CompilerInvocation
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 21 05:00:44 PDT 2021
Author: Jan Svoboda
Date: 2021-10-21T13:51:27+02:00
New Revision: c62220f9623dde699b88baf47c0a3dca400767fb
URL: https://github.com/llvm/llvm-project/commit/c62220f9623dde699b88baf47c0a3dca400767fb
DIFF: https://github.com/llvm/llvm-project/commit/c62220f9623dde699b88baf47c0a3dca400767fb.diff
LOG: [clang][deps] NFC: Rename building CompilerInvocation
The dependency scanner works with multiple instances of `Compiler{Instance,Invocation}`. From names of the variables/members, their purpose is not obvious.
This patch gives descriptive name to the generated `CompilerInvocation` that can be used to derive the command-line to build a modular dependency.
Depends on D111725.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D111728
Added:
Modified:
clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.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 6966ed8a1bde9..e61147d6f2b0a 100644
--- a/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
+++ b/clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
@@ -101,7 +101,7 @@ struct ModuleDeps {
bool ImportedByMainFile = false;
/// Compiler invocation that can be used to build this module (without paths).
- CompilerInvocation Invocation;
+ CompilerInvocation BuildInvocation;
/// Gets the canonical command line suitable for passing to clang.
///
diff --git a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
index cb04bc1a9d829..0e419ab4e2918 100644
--- a/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ b/clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -84,7 +84,7 @@ serializeCompilerInvocation(const CompilerInvocation &CI) {
std::vector<std::string> ModuleDeps::getCanonicalCommandLine(
std::function<StringRef(ModuleID)> LookupPCMPath,
std::function<const ModuleDeps &(ModuleID)> LookupModuleDeps) const {
- CompilerInvocation CI(Invocation);
+ CompilerInvocation CI(BuildInvocation);
FrontendOptions &FrontendOpts = CI.getFrontendOpts();
InputKind ModuleMapInputKind(FrontendOpts.DashX.getLanguage(),
@@ -101,7 +101,7 @@ std::vector<std::string> ModuleDeps::getCanonicalCommandLine(
std::vector<std::string>
ModuleDeps::getCanonicalCommandLineWithoutModulePaths() const {
- return serializeCompilerInvocation(Invocation);
+ return serializeCompilerInvocation(BuildInvocation);
}
void dependencies::detail::collectPCMAndModuleMapPaths(
@@ -260,13 +260,13 @@ ModuleID ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
llvm::DenseSet<const Module *> SeenModules;
addAllSubmodulePrebuiltDeps(M, MD, SeenModules);
- MD.Invocation = MDC.makeInvocationForModuleBuildWithoutPaths(
- MD, [&](CompilerInvocation &CI) {
+ MD.BuildInvocation = MDC.makeInvocationForModuleBuildWithoutPaths(
+ MD, [&](CompilerInvocation &BuildInvocation) {
if (MDC.OptimizeArgs)
- optimizeHeaderSearchOpts(CI.getHeaderSearchOpts(),
+ optimizeHeaderSearchOpts(BuildInvocation.getHeaderSearchOpts(),
*MDC.ScanInstance.getASTReader(), *MF);
});
- MD.ID.ContextHash = MD.Invocation.getModuleHash();
+ MD.ID.ContextHash = MD.BuildInvocation.getModuleHash();
llvm::DenseSet<const Module *> AddedModules;
addAllSubmoduleDeps(M, MD, AddedModules);
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
index b77abeacc195f..450a4efead099 100644
--- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp
+++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp
@@ -362,7 +362,7 @@ class FullDeps {
SmallString<256> ExplicitPCMPath(
!ModuleFilesDir.empty()
? ModuleFilesDir
- : MD.Invocation.getHeaderSearchOpts().ModuleCachePath);
+ : MD.BuildInvocation.getHeaderSearchOpts().ModuleCachePath);
llvm::sys::path::append(ExplicitPCMPath, MD.ID.ContextHash, Filename);
return std::string(ExplicitPCMPath);
}
More information about the cfe-commits
mailing list