Add an optional language feature for Library Evolution

Replace the one-off compiler flag for Library Evolution with an
optional language feature. This makes the
`hasFeature(LibraryEvolution)` check work in an `#if`, and is
otherwise just cleanup.

Tracked by rdar://161125572.
This commit is contained in:
Doug Gregor
2025-09-22 17:45:34 -07:00
parent 87cbe5d2a9
commit c68ef1cf71
12 changed files with 28 additions and 28 deletions

View File

@@ -308,6 +308,8 @@ UPCOMING_FEATURE(ImmutableWeakCaptures, 481, 7)
/// safety.
MIGRATABLE_OPTIONAL_LANGUAGE_FEATURE(StrictMemorySafety, 458, "Strict memory safety")
OPTIONAL_LANGUAGE_FEATURE(LibraryEvolution, 0, "Library evolution")
// Experimental features
EXPERIMENTAL_FEATURE(StaticAssert, false)

View File

@@ -298,11 +298,6 @@ public:
/// \see ModuleDecl::isImplicitDynamicEnabled
bool EnableImplicitDynamic = false;
/// Enables the "fully resilient" resilience strategy.
///
/// \see ResilienceStrategy::Resilient
bool EnableLibraryEvolution = false;
/// If set, this module is part of a mixed Objective-C/Swift framework, and
/// the Objective-C half should implicitly be visible to the Swift sources.
bool ImportUnderlyingModule = false;

View File

@@ -25,20 +25,16 @@ class SourceLoader : public ModuleLoader {
private:
ASTContext &Ctx;
std::vector<ModuleDecl *> ModulesToBindExtensions;
bool EnableLibraryEvolution;
explicit SourceLoader(ASTContext &ctx,
bool enableResilience,
DependencyTracker *tracker)
: ModuleLoader(tracker), Ctx(ctx),
EnableLibraryEvolution(enableResilience) {}
: ModuleLoader(tracker), Ctx(ctx) {}
public:
static std::unique_ptr<SourceLoader>
create(ASTContext &ctx, bool enableResilience,
DependencyTracker *tracker = nullptr) {
create(ASTContext &ctx, DependencyTracker *tracker = nullptr) {
return std::unique_ptr<SourceLoader>{
new SourceLoader(ctx, enableResilience, tracker)
new SourceLoader(ctx, tracker)
};
}