Skip to content

Commit f048a51

Browse files
authored
Merge pull request #16827 from huonw/disable-emit-public-type-metadata-accessors-4.2
[4.2] [IRGen] Make -emit-public-type-metadata-accessors a no-op.
2 parents dd60100 + 635198b commit f048a51

File tree

10 files changed

+12
-44
lines changed

10 files changed

+12
-44
lines changed

include/swift/AST/DiagnosticsDriver.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ WARNING(warn_use_filelists_deprecated, none,
155155
"the option '-driver-use-filelists' is deprecated; use "
156156
"'-driver-filelist-threshold=0' instead", ())
157157

158+
WARNING(warn_emit_public_type_metadata_accessors_deprecated, none,
159+
"the option '-emit-public-type-metadata-accessors' is no longer "
160+
"needed and is deprecated; consider removing it", ())
161+
158162
REMARK(remark_using_batch_mode,none, "using batch mode", ())
159163

160164
#ifndef DIAG_NO_UNDEF

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ namespace swift {
223223
/// Enables key path resilience.
224224
bool EnableKeyPathResilience = false;
225225

226-
/// Enables public emission of private metadata accessors.
227-
bool EmitPublicTypeMetadataAccessors = false;
228-
229226
/// If set to true, the diagnosis engine can assume the emitted diagnostics
230227
/// will be used in editor. This usually leads to more aggressive fixit.
231228
bool DiagnosticsEditorMode = false;

include/swift/Option/Options.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def warn_swift3_objc_inference : Flag<["-"], "warn-swift3-objc-inference">,
358358
def emit_public_type_metadata_accessors :
359359
Flag<["-"], "emit-public-type-metadata-accessors">,
360360
Flags<[FrontendOption]>,
361-
HelpText<"Emit all type metadata accessors as public">;
361+
HelpText<"Emit all type metadata accessors as public (deprecated: now does nothing)">;
362362

363363
def Rpass_EQ : Joined<["-"], "Rpass=">,
364364
Flags<[FrontendOption]>,

lib/Driver/Driver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ static void validateArgs(DiagnosticEngine &diags, const ArgList &args) {
244244
validateDebugInfoArgs(diags, args);
245245
validateCompilationConditionArgs(diags, args);
246246
validateAutolinkingArgs(diags, args);
247+
248+
if (args.hasArg(options::OPT_emit_public_type_metadata_accessors))
249+
diags.diagnose(SourceLoc(),
250+
diag::warn_emit_public_type_metadata_accessors_deprecated);
247251
}
248252

249253
std::unique_ptr<ToolChain>

lib/Driver/ToolChains.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ static void addCommonFrontendArgs(const ToolChain &TC,
184184
options::OPT_warn_swift3_objc_inference_minimal,
185185
options::OPT_warn_swift3_objc_inference_complete);
186186
inputArgs.AddLastArg(arguments, options::OPT_typo_correction_limit);
187-
inputArgs.AddLastArg(arguments,
188-
options::OPT_emit_public_type_metadata_accessors);
189187
inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension);
190188
inputArgs.AddLastArg(arguments, options::OPT_enable_testing);
191189
inputArgs.AddLastArg(arguments, options::OPT_g_Group);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
304304
}
305305
}
306306

307-
Opts.EmitPublicTypeMetadataAccessors =
308-
Args.hasArg(OPT_emit_public_type_metadata_accessors);
309-
310307
Opts.EnableNSKeyedArchiverDiagnostics =
311308
Args.hasFlag(OPT_enable_nskeyedarchiver_diagnostics,
312309
OPT_disable_nskeyedarchiver_diagnostics,

lib/IRGen/MetadataRequest.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -601,17 +601,6 @@ bool irgen::isTypeMetadataAccessTrivial(IRGenModule &IGM, CanType type) {
601601
return false;
602602
}
603603

604-
/// Determine whether we should promote the type metadata access function
605-
/// for the given nominal type to "public".
606-
static bool promoteMetadataAccessFunctionToPublic(
607-
const NominalTypeDecl *nominal) {
608-
ASTContext &ctx = nominal->getASTContext();
609-
610-
// When -emit-public-type-metadata-accessors is provided, promote all
611-
// of the metadata access functions to public.
612-
return ctx.LangOpts.EmitPublicTypeMetadataAccessors;
613-
}
614-
615604
/// Return the standard access strategy for getting a non-dependent
616605
/// type metadata object.
617606
MetadataAccessStrategy irgen::getTypeMetadataAccessStrategy(CanType type) {
@@ -644,12 +633,8 @@ MetadataAccessStrategy irgen::getTypeMetadataAccessStrategy(CanType type) {
644633
case FormalLinkage::PublicUnique:
645634
return MetadataAccessStrategy::PublicUniqueAccessor;
646635
case FormalLinkage::HiddenUnique:
647-
if (promoteMetadataAccessFunctionToPublic(nominal))
648-
return MetadataAccessStrategy::PublicUniqueAccessor;
649636
return MetadataAccessStrategy::HiddenUniqueAccessor;
650637
case FormalLinkage::Private:
651-
if (promoteMetadataAccessFunctionToPublic(nominal))
652-
return MetadataAccessStrategy::PublicUniqueAccessor;
653638
return MetadataAccessStrategy::PrivateAccessor;
654639

655640
case FormalLinkage::PublicNonUnique:
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// RUN: %target-build-swift %s -emit-public-type-metadata-accessors 2>&1 | %FileCheck %s
2+
3+
// CHECK: the option '-emit-public-type-metadata-accessors' is no longer needed and is deprecated; consider removing it

test/IRGen/Inputs/emit_public_type_metadata_accessors_other.swift

Lines changed: 0 additions & 3 deletions
This file was deleted.

test/IRGen/emit_public_type_metadata_accessors.swift

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)