mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +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:
@@ -85,6 +85,9 @@ class ModuleFileSharedCore {
|
||||
/// \c true if this module has incremental dependency information.
|
||||
bool HasIncrementalInfo = false;
|
||||
|
||||
/// \c true if this module was compiled with -enable-ossa-modules.
|
||||
bool RequiresOSSAModules;
|
||||
|
||||
public:
|
||||
/// Represents another module that has been imported as a dependency.
|
||||
class Dependency {
|
||||
@@ -363,10 +366,12 @@ private:
|
||||
}
|
||||
|
||||
/// Constructs a new module and validates it.
|
||||
ModuleFileSharedCore(std::unique_ptr<llvm::MemoryBuffer> moduleInputBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
|
||||
bool isFramework, serialization::ValidationInfo &info);
|
||||
ModuleFileSharedCore(
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleInputBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
|
||||
bool isFramework, bool requiresOSSAModules,
|
||||
serialization::ValidationInfo &info);
|
||||
|
||||
/// Change the status of the current module.
|
||||
Status error(Status issue) {
|
||||
@@ -491,6 +496,8 @@ public:
|
||||
/// of the buffer, even if there's an error in loading.
|
||||
/// \param isFramework If true, this is treated as a framework module for
|
||||
/// linking purposes.
|
||||
/// \param requiresOSSAModules If true, this requires dependent modules to be
|
||||
/// compiled with -enable-ossa-modules.
|
||||
/// \param[out] theModule The loaded module.
|
||||
/// \returns Whether the module was successfully loaded, or what went wrong
|
||||
/// if it was not.
|
||||
@@ -499,12 +506,13 @@ public:
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleInputBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleDocInputBuffer,
|
||||
std::unique_ptr<llvm::MemoryBuffer> moduleSourceInfoInputBuffer,
|
||||
bool isFramework,
|
||||
bool isFramework, bool requiresOSSAModules,
|
||||
std::shared_ptr<const ModuleFileSharedCore> &theModule) {
|
||||
serialization::ValidationInfo info;
|
||||
auto *core = new ModuleFileSharedCore(
|
||||
std::move(moduleInputBuffer), std::move(moduleDocInputBuffer),
|
||||
std::move(moduleSourceInfoInputBuffer), isFramework, info);
|
||||
std::move(moduleSourceInfoInputBuffer), isFramework,
|
||||
requiresOSSAModules, info);
|
||||
if (!moduleInterfacePath.empty()) {
|
||||
ArrayRef<char> path;
|
||||
core->allocateBuffer(path, moduleInterfacePath);
|
||||
|
||||
Reference in New Issue
Block a user