[clang] 23e9146 - Modules: Rename ModuleBuildFailed => DisableGeneratingGlobalModuleIndex, NFC
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu May 13 10:22:47 PDT 2021
Author: Duncan P. N. Exon Smith
Date: 2021-05-13T10:22:40-07:00
New Revision: 23e9146fba298d38142337b615e17067fb8ccb91
URL: https://github.com/llvm/llvm-project/commit/23e9146fba298d38142337b615e17067fb8ccb91
DIFF: https://github.com/llvm/llvm-project/commit/23e9146fba298d38142337b615e17067fb8ccb91.diff
LOG: Modules: Rename ModuleBuildFailed => DisableGeneratingGlobalModuleIndex, NFC
Rename CompilerInstance's ModuleBuildFailed field to
DisableGeneratingGlobalModuleIndex, which more precisely describes its
role. Otherwise, it's hard to suss out how it's different from
ModuleLoader::HadFatalFailure, and what sort of code simplifications are
safe.
Differential Revision: https://reviews.llvm.org/D101670
Added:
Modified:
clang/include/clang/Frontend/CompilerInstance.h
clang/lib/Frontend/CompilerInstance.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h
index 54d57019fa548..7778924fc452f 100644
--- a/clang/include/clang/Frontend/CompilerInstance.h
+++ b/clang/include/clang/Frontend/CompilerInstance.h
@@ -150,7 +150,7 @@ class CompilerInstance : public ModuleLoader {
bool HaveFullGlobalModuleIndex = false;
/// One or more modules failed to build.
- bool ModuleBuildFailed = false;
+ bool DisableGeneratingGlobalModuleIndex = false;
/// The stream for verbose output if owned, otherwise nullptr.
std::unique_ptr<raw_ostream> OwnedVerboseOutputStream;
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 695c7e335fb40..54917b3fb0fbe 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -77,7 +77,7 @@ bool CompilerInstance::shouldBuildGlobalModuleIndex() const {
return (BuildGlobalModuleIndex ||
(TheASTReader && TheASTReader->isGlobalIndexUnavailable() &&
getFrontendOpts().GenerateGlobalModuleIndex)) &&
- !ModuleBuildFailed;
+ !DisableGeneratingGlobalModuleIndex;
}
void CompilerInstance::setDiagnostics(DiagnosticsEngine *Value) {
@@ -1683,7 +1683,7 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
// We can't find a module, error out here.
getDiagnostics().Report(ModuleNameLoc, diag::err_module_not_found)
<< ModuleName << SourceRange(ImportLoc, ModuleNameLoc);
- ModuleBuildFailed = true;
+ DisableGeneratingGlobalModuleIndex = true;
return nullptr;
}
if (ModuleFilename.empty()) {
@@ -1695,7 +1695,7 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
getDiagnostics().Report(ModuleNameLoc, diag::err_module_build_disabled)
<< ModuleName;
- ModuleBuildFailed = true;
+ DisableGeneratingGlobalModuleIndex = true;
return nullptr;
}
@@ -1742,7 +1742,7 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
if (*ModuleFile == M->getASTFile())
return M;
- ModuleBuildFailed = true;
+ DisableGeneratingGlobalModuleIndex = true;
getDiagnostics().Report(ModuleNameLoc, diag::err_module_prebuilt)
<< ModuleName;
return ModuleLoadResult();
@@ -1764,14 +1764,14 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
LLVM_FALLTHROUGH;
case ASTReader::VersionMismatch:
case ASTReader::HadErrors:
- // FIXME: Should this set ModuleBuildFailed = true?
+ // FIXME: Should this set DisableGeneratingGlobalModuleIndex = true?
ModuleLoader::HadFatalFailure = true;
// FIXME: The ASTReader will already have complained, but can we shoehorn
// that diagnostic information into a more useful form?
return ModuleLoadResult();
case ASTReader::Failure:
- // FIXME: Should this set ModuleBuildFailed = true?
+ // FIXME: Should this set DisableGeneratingGlobalModuleIndex = true?
ModuleLoader::HadFatalFailure = true;
return ModuleLoadResult();
}
@@ -1781,7 +1781,7 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
// We don't know the desired configuration for this module and don't
// necessarily even have a module map. Since ReadAST already produces
// diagnostics for these two cases, we simply error out here.
- ModuleBuildFailed = true;
+ DisableGeneratingGlobalModuleIndex = true;
return ModuleLoadResult();
}
@@ -1806,7 +1806,7 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
getDiagnostics().Report(ModuleNameLoc, diag::err_module_cycle)
<< ModuleName << CyclePath;
- // FIXME: Should this set ModuleBuildFailed = true?
+ // FIXME: Should this set DisableGeneratingGlobalModuleIndex = true?
return nullptr;
}
@@ -1816,7 +1816,7 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
getPreprocessorOpts().FailedModules->hasAlreadyFailed(ModuleName)) {
getDiagnostics().Report(ModuleNameLoc, diag::err_module_not_built)
<< ModuleName << SourceRange(ImportLoc, ModuleNameLoc);
- ModuleBuildFailed = true;
+ DisableGeneratingGlobalModuleIndex = true;
return nullptr;
}
@@ -1827,7 +1827,7 @@ ModuleLoadResult CompilerInstance::findOrCompileModuleAndReadAST(
"undiagnosed error in compileModuleAndReadAST");
if (getPreprocessorOpts().FailedModules)
getPreprocessorOpts().FailedModules->addFailed(ModuleName);
- ModuleBuildFailed = true;
+ DisableGeneratingGlobalModuleIndex = true;
return nullptr;
}
@@ -1871,16 +1871,16 @@ CompilerInstance::loadModule(SourceLocation ImportLoc,
//if (Module == nullptr) {
// getDiagnostics().Report(ModuleNameLoc, diag::err_module_not_found)
// << ModuleName;
- // ModuleBuildFailed = true;
+ // DisableGeneratingGlobalModuleIndex = true;
// return ModuleLoadResult();
//}
MM.cacheModuleLoad(*Path[0].first, Module);
} else {
ModuleLoadResult Result = findOrCompileModuleAndReadAST(
ModuleName, ImportLoc, ModuleNameLoc, IsInclusionDirective);
- // FIXME: Can we pull 'ModuleBuildFailed = true' out of the return
- // sequences for findOrCompileModuleAndReadAST and do it here (as long as
- // the result is not a config mismatch)? See FIXMEs there.
+ // FIXME: Can we pull 'DisableGeneratingGlobalModuleIndex = true' out of
+ // the return sequences for findOrCompileModuleAndReadAST and do it here
+ // (as long as the result is not a config mismatch)? See FIXMEs there.
if (!Result.isNormal())
return Result;
Module = Result;
More information about the cfe-commits
mailing list