Skip to content

Commit 397c82f

Browse files
[Caching] Use subInvocation to verify interface
The interface verification needs to read some command-line from the interface file so it needs to be built inside sub-invocation. rdar://122423965
1 parent 821da75 commit 397c82f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,8 +2043,6 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
20432043
info.Instance = &subInstance;
20442044
info.CompilerVersion = interfaceInfo.CompilerVersion;
20452045

2046-
subInstance.getSourceMgr().setFileSystem(SM.getFileSystem());
2047-
20482046
ForwardingDiagnosticConsumer FDC(*Diags);
20492047
NullDiagnosticConsumer noopConsumer;
20502048
if (!silenceErrors) {
@@ -2053,11 +2051,19 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
20532051
subInstance.addDiagnosticConsumer(&noopConsumer);
20542052
}
20552053

2054+
// If doing typecheck, emit warnings.
2055+
if (subInvocation.getFrontendOptions().isTypeCheckAction())
2056+
subInvocation.getDiagnosticOptions().SuppressWarnings = false;
2057+
20562058
std::string InstanceSetupError;
20572059
if (subInstance.setup(subInvocation, InstanceSetupError)) {
20582060
return std::make_error_code(std::errc::not_supported);
20592061
}
20602062

2063+
// Set the file system after setup to make sure the file system is shared in
2064+
// subInstance.
2065+
subInstance.getSourceMgr().setFileSystem(SM.getFileSystem());
2066+
20612067
info.BuildArguments = BuildArgs;
20622068
info.Hash = CacheHash;
20632069
auto target = *(std::find(BuildArgs.rbegin(), BuildArgs.rend(), "-target") - 1);

lib/FrontendTool/FrontendTool.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,7 @@ static bool buildModuleFromInterface(CompilerInstance &Instance) {
418418
// currently we need to ensure it still reads the flags written out
419419
// in the .swiftinterface file itself. Instead, creation of that
420420
// job should incorporate those flags.
421-
if (FEOpts.ExplicitInterfaceBuild &&
422-
!(FEOpts.isTypeCheckAction() &&
423-
!Invocation.getCASOptions().EnableCaching))
421+
if (FEOpts.ExplicitInterfaceBuild && !(FEOpts.isTypeCheckAction()))
424422
return ModuleInterfaceLoader::buildExplicitSwiftModuleFromSwiftInterface(
425423
Instance, Invocation.getClangModuleCachePath(),
426424
FEOpts.BackupModuleInterfaceDir, PrebuiltCachePath, ABIPath, InputPath,

0 commit comments

Comments
 (0)