mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag (#39516)
* Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag This includes a bit in the module format to represent if the module was compiled with -enable-ossa-modules flag. When compiling a client module with -enable-ossa-modules flag, all dependent modules are checked for this bit, if not on, recompilation is triggered with -enable-ossa-modules. * Updated tests
This commit is contained in:
@@ -198,8 +198,10 @@ public:
|
||||
|
||||
namespace path = llvm::sys::path;
|
||||
|
||||
static bool serializedASTLooksValid(const llvm::MemoryBuffer &buf) {
|
||||
auto VI = serialization::validateSerializedAST(buf.getBuffer());
|
||||
static bool serializedASTLooksValid(const llvm::MemoryBuffer &buf,
|
||||
bool requiresOSSAModules) {
|
||||
auto VI = serialization::validateSerializedAST(buf.getBuffer(),
|
||||
requiresOSSAModules);
|
||||
return VI.status == serialization::Status::Valid;
|
||||
}
|
||||
|
||||
@@ -497,7 +499,8 @@ class ModuleInterfaceLoaderImpl {
|
||||
|
||||
LLVM_DEBUG(llvm::dbgs() << "Validating deps of " << path << "\n");
|
||||
auto validationInfo = serialization::validateSerializedAST(
|
||||
buf.getBuffer(), /*ExtendedValidationInfo=*/nullptr, &allDeps);
|
||||
buf.getBuffer(), requiresOSSAModules,
|
||||
/*ExtendedValidationInfo=*/nullptr, &allDeps);
|
||||
|
||||
if (validationInfo.status != serialization::Status::Valid) {
|
||||
rebuildInfo.setSerializationStatus(path, validationInfo.status);
|
||||
@@ -538,7 +541,7 @@ class ModuleInterfaceLoaderImpl {
|
||||
|
||||
// First, make sure the underlying module path exists and is valid.
|
||||
auto modBuf = fs.getBufferForFile(fwd.underlyingModulePath);
|
||||
if (!modBuf || !serializedASTLooksValid(*modBuf.get()))
|
||||
if (!modBuf || !serializedASTLooksValid(*modBuf.get(), requiresOSSAModules))
|
||||
return false;
|
||||
|
||||
// Next, check the dependencies in the forwarding file.
|
||||
@@ -646,12 +649,6 @@ class ModuleInterfaceLoaderImpl {
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string> getCompiledModuleCandidates() {
|
||||
// If we require ossa modules, then we /always/ rebuild the module interface
|
||||
// regardless of the module loading mode.
|
||||
if (requiresOSSAModules) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::pair<std::string, std::string> result;
|
||||
// Keep track of whether we should attempt to load a .swiftmodule adjacent
|
||||
// to the .swiftinterface.
|
||||
|
||||
Reference in New Issue
Block a user