Skip to content

Commit 4289356

Browse files
committed
[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
1 parent bc6487f commit 4289356

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct ModuleDeps {
102102
bool ImportedByMainFile = false;
103103

104104
/// Compiler invocation that can be used to build this module (without paths).
105-
CompilerInvocation Invocation;
105+
CompilerInvocation BuildInvocation;
106106

107107
/// Gets the canonical command line suitable for passing to clang.
108108
///

clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ serializeCompilerInvocation(const CompilerInvocation &CI) {
8585
std::vector<std::string> ModuleDeps::getCanonicalCommandLine(
8686
std::function<StringRef(ModuleID)> LookupPCMPath,
8787
std::function<const ModuleDeps &(ModuleID)> LookupModuleDeps) const {
88-
CompilerInvocation CI(Invocation);
88+
CompilerInvocation CI(BuildInvocation);
8989
FrontendOptions &FrontendOpts = CI.getFrontendOpts();
9090

9191
InputKind ModuleMapInputKind(FrontendOpts.DashX.getLanguage(),
@@ -102,7 +102,7 @@ std::vector<std::string> ModuleDeps::getCanonicalCommandLine(
102102

103103
std::vector<std::string>
104104
ModuleDeps::getCanonicalCommandLineWithoutModulePaths() const {
105-
return serializeCompilerInvocation(Invocation);
105+
return serializeCompilerInvocation(BuildInvocation);
106106
}
107107

108108
std::vector<std::string>
@@ -115,7 +115,7 @@ ModuleDeps::getAdditionalArgsWithoutModulePaths() const {
115115
if (IsSystem)
116116
Ret.push_back("-fsystem-module");
117117

118-
if (Invocation.getLangOpts()->NeededByPCHOrCompilationUsesPCH)
118+
if (BuildInvocation.getLangOpts()->NeededByPCHOrCompilationUsesPCH)
119119
Ret.push_back("-fmodule-related-to-pch");
120120

121121
return Ret;
@@ -278,13 +278,14 @@ ModuleID ModuleDepCollectorPP::handleTopLevelModule(const Module *M) {
278278
llvm::DenseSet<const Module *> SeenModules;
279279
addAllSubmodulePrebuiltDeps(M, MD, SeenModules);
280280

281-
MD.Invocation = MDC.makeInvocationForModuleBuildWithoutPaths(
282-
MD, [&](CompilerInvocation &CI) {
281+
MD.BuildInvocation = MDC.makeInvocationForModuleBuildWithoutPaths(
282+
MD, [&](CompilerInvocation &BuildInvocation) {
283283
if (MDC.OptimizeArgs)
284-
optimizeHeaderSearchOpts(CI.getHeaderSearchOpts(),
284+
optimizeHeaderSearchOpts(BuildInvocation.getHeaderSearchOpts(),
285285
*MDC.ScanInstance.getASTReader(), *MF);
286286
});
287-
MD.ID.ContextHash = MD.Invocation.getModuleHash(Instance.getDiagnostics());
287+
MD.ID.ContextHash =
288+
MD.BuildInvocation.getModuleHash(MDC.ScanInstance.getDiagnostics());
288289

289290
llvm::DenseSet<const Module *> AddedModules;
290291
addAllSubmoduleDeps(M, MD, AddedModules);

clang/tools/clang-scan-deps/ClangScanDeps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ class FullDeps {
362362
SmallString<256> ExplicitPCMPath(
363363
!ModuleFilesDir.empty()
364364
? ModuleFilesDir
365-
: MD.Invocation.getHeaderSearchOpts().ModuleCachePath);
365+
: MD.BuildInvocation.getHeaderSearchOpts().ModuleCachePath);
366366
llvm::sys::path::append(ExplicitPCMPath, MD.ID.ContextHash, Filename);
367367
return std::string(ExplicitPCMPath);
368368
}

0 commit comments

Comments
 (0)