Skip to content

Commit 1159af5

Browse files
committed
Rename -enable-resilience to -enable-library-evolution and make it a driver flag
Fixes <rdar://problem/47679085>.
1 parent bdd3695 commit 1159af5

File tree

148 files changed

+332
-328
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+332
-328
lines changed

cmake/modules/SwiftSource.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,9 @@ function(_compile_swift_files
226226
list(APPEND swift_flags "-Xfrontend" "-sil-verify-all")
227227
endif()
228228

229-
# The standard library and overlays are always built with resilience.
229+
# The standard library and overlays are always built resiliently.
230230
if(SWIFTFILE_IS_STDLIB)
231-
list(APPEND swift_flags "-Xfrontend" "-enable-resilience")
231+
list(APPEND swift_flags "-enable-library-evolution")
232232
endif()
233233

234234
if(SWIFT_STDLIB_USE_NONATOMIC_RC)

docs/SIL.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3961,7 +3961,7 @@ unless the enum can be exhaustively switched in the current function, i.e. when
39613961
the compiler can be sure that it knows all possible present and future values
39623962
of the enum in question. This is generally true for enums defined in Swift, but
39633963
there are two exceptions: *non-frozen enums* declared in libraries compiled
3964-
with the ``-enable-resilience`` flag, which may grow new cases in the future in
3964+
with the ``-enable-library-evolution`` flag, which may grow new cases in the future in
39653965
an ABI-compatible way; and enums marked with the ``objc`` attribute, for which
39663966
other bit patterns are permitted for compatibility with C. All enums imported
39673967
from C are treated as "non-exhaustive" for the same reason, regardless of the

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ ERROR(indirect_case_without_payload,none,
13051305
ERROR(indirect_case_in_indirect_enum,none,
13061306
"enum case in 'indirect' enum cannot also be 'indirect'", ())
13071307
WARNING(enum_frozen_nonresilient,none,
1308-
"%0 has no effect without -enable-resilience", (DeclAttribute))
1308+
"%0 has no effect without -enable-library-evolution", (DeclAttribute))
13091309
WARNING(enum_frozen_nonpublic,none,
13101310
"%0 has no effect on non-public enums", (DeclAttribute))
13111311

include/swift/AST/Module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ enum class ResilienceStrategy : unsigned {
117117
/// Public nominal types: resilient
118118
/// Non-inlinable function bodies: resilient
119119
///
120-
/// This is the behavior with -enable-resilience.
120+
/// This is the behavior with -enable-library-evolution.
121121
Resilient
122122
};
123123

include/swift/Frontend/FrontendOptions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ class FrontendOptions {
214214
/// Enables the "fully resilient" resilience strategy.
215215
///
216216
/// \see ResilienceStrategy::Resilient
217-
bool EnableResilience = false;
217+
bool EnableLibraryEvolution = false;
218218

219219
/// Indicates that the frontend should emit "verbose" SIL
220220
/// (if asked to emit SIL).

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ def disable_objc_attr_requires_foundation_module :
174174
HelpText<"Disable requiring uses of @objc to require importing the "
175175
"Foundation module">;
176176

177-
def enable_resilience : Flag<["-"], "enable-resilience">,
178-
HelpText<"Compile the module to export resilient interfaces for all "
179-
"public declarations by default">;
180177
}
181178

182179

include/swift/Option/Options.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ def module_cache_path : Separate<["-"], "module-cache-path">,
305305
Flags<[FrontendOption, DoesNotAffectIncrementalBuild, ArgumentIsPath]>,
306306
HelpText<"Specifies the Clang module cache path">;
307307

308+
def enable_library_evolution : Flag<["-"], "enable-library-evolution">,
309+
Flags<[FrontendOption, ParseableInterfaceOption]>,
310+
HelpText<"Build the module to allow binary-compatible library evolution">;
311+
308312
def module_name : Separate<["-"], "module-name">,
309313
Flags<[FrontendOption, ParseableInterfaceOption]>,
310314
HelpText<"Name of the module to build">;

include/swift/Sema/SourceLoader.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class SourceLoader : public ModuleLoader {
2525
private:
2626
ASTContext &Ctx;
2727
bool SkipBodies;
28-
bool EnableResilience;
28+
bool EnableLibraryEvolution;
2929

3030
explicit SourceLoader(ASTContext &ctx,
3131
bool skipBodies,
3232
bool enableResilience,
3333
DependencyTracker *tracker)
3434
: ModuleLoader(tracker), Ctx(ctx),
35-
SkipBodies(skipBodies), EnableResilience(enableResilience) {}
35+
SkipBodies(skipBodies), EnableLibraryEvolution(enableResilience) {}
3636

3737
public:
3838
static std::unique_ptr<SourceLoader>

lib/Driver/ToolChains.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
185185
inputArgs.AddLastArg(arguments, options::OPT_warn_implicit_overrides);
186186
inputArgs.AddLastArg(arguments, options::OPT_typo_correction_limit);
187187
inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension);
188+
inputArgs.AddLastArg(arguments, options::OPT_enable_library_evolution);
188189
inputArgs.AddLastArg(arguments, options::OPT_enable_testing);
189190
inputArgs.AddLastArg(arguments, options::OPT_enable_private_imports);
190191
inputArgs.AddLastArg(arguments, options::OPT_g_Group);

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ bool ArgsToFrontendOptionsConverter::convert(
7171

7272
Opts.EnableTesting |= Args.hasArg(OPT_enable_testing);
7373
Opts.EnablePrivateImports |= Args.hasArg(OPT_enable_private_imports);
74-
Opts.EnableResilience |= Args.hasArg(OPT_enable_resilience);
74+
Opts.EnableLibraryEvolution |= Args.hasArg(OPT_enable_library_evolution);
7575
Opts.EnableImplicitDynamic |= Args.hasArg(OPT_enable_implicit_dynamic);
7676

7777
Opts.TrackSystemDeps |= Args.hasArg(OPT_track_system_dependencies);

0 commit comments

Comments
 (0)