[clang] NFCI: Mutate HeaderSearchOptions earlier (#130823)

This commit is contained in:
Jan Svoboda 2025-03-21 13:52:12 -07:00 committed by GitHub
parent 900be712ce
commit 7606f6773c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 7 deletions

View File

@ -235,6 +235,7 @@ public:
/// Whether to entirely skip writing diagnostic options.
/// Primarily used to speed up deserialization during dependency scanning.
/// FIXME: Consider moving these into separate `SerializationOptions` class.
LLVM_PREFERRED_TYPE(bool)
unsigned ModulesSkipDiagnosticOptions : 1;

View File

@ -4971,6 +4971,14 @@ bool CompilerInvocation::CreateFromArgsImpl(
llvm::Triple T(Res.getTargetOpts().Triple);
ParseHeaderSearchArgs(Res.getHeaderSearchOpts(), Args, Diags,
Res.getFileSystemOpts().WorkingDir);
if (Res.getFrontendOpts().GenReducedBMI ||
Res.getFrontendOpts().ProgramAction ==
frontend::GenerateReducedModuleInterface ||
Res.getFrontendOpts().ProgramAction ==
frontend::GenerateModuleInterface) {
Res.getHeaderSearchOpts().ModulesSkipDiagnosticOptions = true;
Res.getHeaderSearchOpts().ModulesSkipHeaderSearchPaths = true;
}
ParseAPINotesArgs(Res.getAPINotesOpts(), Args, Diags);
ParsePointerAuthArgs(LangOpts, Args, Diags);

View File

@ -120,13 +120,6 @@ Module *CXX20ModulesGenerator::getEmittingModule(ASTContext &Ctx) {
}
void CXX20ModulesGenerator::HandleTranslationUnit(ASTContext &Ctx) {
// FIMXE: We'd better to wrap such options to a new class ASTWriterOptions
// since this is not about searching header really.
HeaderSearchOptions &HSOpts =
getPreprocessor().getHeaderSearchInfo().getHeaderSearchOpts();
HSOpts.ModulesSkipDiagnosticOptions = true;
HSOpts.ModulesSkipHeaderSearchPaths = true;
PCHGenerator::HandleTranslationUnit(Ctx);
if (!isComplete())