@@ -295,7 +295,22 @@ bool ArgsToFrontendOptionsConverter::convert(
295
295
A->getOption ().matches (OPT_serialize_debugging_options);
296
296
}
297
297
298
+ // To allow non-resilient access from clients, internal contents
299
+ // besides exportable decls should be generated. If built from
300
+ // interface, or with -enable-library-evolution, we ignore this
301
+ // option (-experimental-allow-non-resilient-access). This option
302
+ // will however override -experimental-skip-non-exportable-decls
303
+ // if both are passed.
304
+ Opts.AllowNonResilientAccess = Args.hasArg (OPT_experimental_allow_non_resilient_access);
305
+
298
306
if (Args.hasArg (OPT_enable_library_evolution)) {
307
+ if (Opts.AllowNonResilientAccess ) {
308
+ Diags.diagnose (SourceLoc (), diag::warn_ignore_option_due_to_conflict,
309
+ " -experimental-allow-non-resilient-access" ,
310
+ " -enable-library-evolution" );
311
+ Opts.AllowNonResilientAccess = false ;
312
+ }
313
+
299
314
Opts.SkipNonExportableDecls |=
300
315
Args.hasArg (OPT_experimental_skip_non_exportable_decls);
301
316
@@ -304,10 +319,26 @@ bool ArgsToFrontendOptionsConverter::convert(
304
319
Args.hasArg (
305
320
OPT_experimental_skip_non_inlinable_function_bodies_is_lazy);
306
321
} else {
307
- if (Args.hasArg (OPT_experimental_skip_non_exportable_decls))
322
+ if (Args.hasArg (OPT_experimental_skip_non_exportable_decls)) {
308
323
Diags.diagnose (SourceLoc (), diag::ignoring_option_requires_option,
309
324
" -experimental-skip-non-exportable-decls" ,
310
325
" -enable-library-evolution" );
326
+ if (Opts.AllowNonResilientAccess ) {
327
+ Diags.diagnose (SourceLoc (), diag::warn_ignore_option_due_to_conflict,
328
+ " -experimental-skip-non-exportable-decls" ,
329
+ " -experimental-allow-non-resilient-access" );
330
+ }
331
+ }
332
+ }
333
+
334
+ // To allow non-resilient access from clients, it should be built from source.
335
+ if (Opts.AllowNonResilientAccess &&
336
+ (Opts.RequestedAction == FrontendOptions::ActionType::CompileModuleFromInterface ||
337
+ Opts.RequestedAction == FrontendOptions::ActionType::TypecheckModuleFromInterface)) {
338
+ Diags.diagnose (SourceLoc (), diag::warn_ignore_option_due_to_conflict,
339
+ " -experimental-allow-non-resilient-access" ,
340
+ " -compile-module-from-interface or -typecheck-module-from-interface" );
341
+ Opts.AllowNonResilientAccess = false ;
311
342
}
312
343
313
344
// HACK: The driver currently erroneously passes all flags to module interface
0 commit comments