Skip to content

Commit 6fdb076

Browse files
committed
Add a staging flag -enable-experimental-deserialization-recovery.
No promises that this is stable yet!
1 parent e831dca commit 6fdb076

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ namespace swift {
175175
/// new enough?
176176
bool EnableTargetOSChecking = true;
177177

178+
/// Whether to attempt to recover from missing cross-references and other
179+
/// errors when deserializing from a Swift module.
180+
///
181+
/// This is a staging flag; eventually it will be on by default.
182+
bool EnableDeserializationRecovery = false;
183+
178184
/// Should we use \c ASTScope-based resolution for unqualified name lookup?
179185
bool EnableASTScopeLookup = false;
180186

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ def enable_experimental_property_behaviors :
260260
Flag<["-"], "enable-experimental-property-behaviors">,
261261
HelpText<"Enable experimental property behaviors">;
262262

263+
def enable_experimental_deserialization_recovery :
264+
Flag<["-"], "enable-experimental-deserialization-recovery">,
265+
HelpText<"Attempt to recover from missing xrefs (etc) in swiftmodules">;
266+
263267
def enable_cow_existentials : Flag<["-"], "enable-cow-existentials">,
264268
HelpText<"Enable the copy-on-write existential implementation">;
265269

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
874874
Opts.EnableClassResilience |=
875875
Args.hasArg(OPT_enable_class_resilience);
876876

877+
Opts.EnableDeserializationRecovery |=
878+
Args.hasArg(OPT_enable_experimental_deserialization_recovery);
879+
877880
Opts.DisableAvailabilityChecking |=
878881
Args.hasArg(OPT_disable_availability_checking);
879882

tools/swift-ide-test/swift-ide-test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,12 @@ EnableSwift3ObjCInference(
318318
llvm::cl::desc("Enable Swift 3's @objc inference rules"),
319319
llvm::cl::init(false));
320320

321+
static llvm::cl::opt<bool>
322+
EnableDeserializationRecovery(
323+
"enable-experimental-deserialization-recovery",
324+
llvm::cl::desc("Attempt to recover from missing xrefs (etc) in swiftmodules"),
325+
llvm::cl::init(false));
326+
321327
static llvm::cl::opt<bool>
322328
DisableObjCAttrRequiresFoundationModule(
323329
"disable-objc-attr-requires-foundation-module",
@@ -2995,6 +3001,8 @@ int main(int argc, char *argv[]) {
29953001
InitInvok.getLangOptions().EnableSwift3ObjCInference =
29963002
options::EnableSwift3ObjCInference ||
29973003
InitInvok.getLangOptions().isSwiftVersion3();
3004+
InitInvok.getLangOptions().EnableDeserializationRecovery |=
3005+
options::EnableDeserializationRecovery;
29983006
InitInvok.getClangImporterOptions().ImportForwardDeclarations |=
29993007
options::ObjCForwardDeclarations;
30003008
InitInvok.getClangImporterOptions().InferImportAsMember |=

0 commit comments

Comments
 (0)