Skip to content

Commit d1bdec8

Browse files
authored
Merge pull request #16808 from huonw/disable-emit-public-type-metadata-accessors
[IRGen] Make -emit-public-type-metadata-accessors a no-op.
2 parents a90aeca + 60ae475 commit d1bdec8

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
@@ -183,8 +183,6 @@ static void addCommonFrontendArgs(const ToolChain &TC, const OutputInfo &OI,
183183
options::OPT_warn_swift3_objc_inference_minimal,
184184
options::OPT_warn_swift3_objc_inference_complete);
185185
inputArgs.AddLastArg(arguments, options::OPT_typo_correction_limit);
186-
inputArgs.AddLastArg(arguments,
187-
options::OPT_emit_public_type_metadata_accessors);
188186
inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension);
189187
inputArgs.AddLastArg(arguments, options::OPT_enable_testing);
190188
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
@@ -309,9 +309,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
309309
}
310310
}
311311

312-
Opts.EmitPublicTypeMetadataAccessors =
313-
Args.hasArg(OPT_emit_public_type_metadata_accessors);
314-
315312
Opts.EnableNSKeyedArchiverDiagnostics =
316313
Args.hasFlag(OPT_enable_nskeyedarchiver_diagnostics,
317314
OPT_disable_nskeyedarchiver_diagnostics,

lib/IRGen/MetadataRequest.cpp

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

592-
/// Determine whether we should promote the type metadata access function
593-
/// for the given nominal type to "public".
594-
static bool promoteMetadataAccessFunctionToPublic(
595-
const NominalTypeDecl *nominal) {
596-
ASTContext &ctx = nominal->getASTContext();
597-
598-
// When -emit-public-type-metadata-accessors is provided, promote all
599-
// of the metadata access functions to public.
600-
return ctx.LangOpts.EmitPublicTypeMetadataAccessors;
601-
}
602-
603592
/// Return the standard access strategy for getting a non-dependent
604593
/// type metadata object.
605594
MetadataAccessStrategy irgen::getTypeMetadataAccessStrategy(CanType type) {
@@ -632,12 +621,8 @@ MetadataAccessStrategy irgen::getTypeMetadataAccessStrategy(CanType type) {
632621
case FormalLinkage::PublicUnique:
633622
return MetadataAccessStrategy::PublicUniqueAccessor;
634623
case FormalLinkage::HiddenUnique:
635-
if (promoteMetadataAccessFunctionToPublic(nominal))
636-
return MetadataAccessStrategy::PublicUniqueAccessor;
637624
return MetadataAccessStrategy::HiddenUniqueAccessor;
638625
case FormalLinkage::Private:
639-
if (promoteMetadataAccessFunctionToPublic(nominal))
640-
return MetadataAccessStrategy::PublicUniqueAccessor;
641626
return MetadataAccessStrategy::PrivateAccessor;
642627

643628
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)