From 49c513844db2e1513827a7c5b3c08acf87cfbd2b Mon Sep 17 00:00:00 2001 From: Jan Svoboda Date: Fri, 9 May 2025 08:33:28 -0700 Subject: [clang][modules] Allow not forcing validation of user headers (#139091) Force-validation of user headers was implemented in acb803e8 to deal with files changing during build. The dependency scanner guarantees an immutable file system during single build session, so the validation is unnecessary. (We don't hit the disk too often due to the caching VFS, but even avoiding going to the cache and deserializing the input files makes sense.) --- clang/lib/Frontend/CompilerInstance.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'clang/lib/Frontend/CompilerInstance.cpp') diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp index b59496b..503d364 100644 --- a/clang/lib/Frontend/CompilerInstance.cpp +++ b/clang/lib/Frontend/CompilerInstance.cpp @@ -638,8 +638,9 @@ IntrusiveRefCntPtr CompilerInstance::createPCHExternalASTSource( PP, ModCache, &Context, PCHContainerRdr, Extensions, Sysroot.empty() ? "" : Sysroot.data(), DisableValidation, AllowPCHWithCompilerErrors, /*AllowConfigurationMismatch*/ false, - HSOpts.ModulesValidateSystemHeaders, HSOpts.ValidateASTInputFilesContent, - UseGlobalModuleIndex)); + HSOpts.ModulesValidateSystemHeaders, + HSOpts.ModulesForceValidateUserHeaders, + HSOpts.ValidateASTInputFilesContent, UseGlobalModuleIndex)); // We need the external source to be set up before we read the AST, because // eagerly-deserialized declarations may use it. @@ -1752,6 +1753,7 @@ void CompilerInstance::createASTReader() { PPOpts.DisablePCHOrModuleValidation, /*AllowASTWithCompilerErrors=*/FEOpts.AllowPCMWithCompilerErrors, /*AllowConfigurationMismatch=*/false, HSOpts.ModulesValidateSystemHeaders, + HSOpts.ModulesForceValidateUserHeaders, HSOpts.ValidateASTInputFilesContent, getFrontendOpts().UseGlobalModuleIndex, std::move(ReadTimer)); if (hasASTConsumer()) { -- cgit v1.1