Skip to content

[4.2] [IRGen] Make -emit-public-type-metadata-accessors a no-op. #16827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/swift/AST/DiagnosticsDriver.def
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ WARNING(warn_use_filelists_deprecated, none,
"the option '-driver-use-filelists' is deprecated; use "
"'-driver-filelist-threshold=0' instead", ())

WARNING(warn_emit_public_type_metadata_accessors_deprecated, none,
"the option '-emit-public-type-metadata-accessors' is no longer "
"needed and is deprecated; consider removing it", ())

REMARK(remark_using_batch_mode,none, "using batch mode", ())

#ifndef DIAG_NO_UNDEF
Expand Down
3 changes: 0 additions & 3 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,6 @@ namespace swift {
/// Enables key path resilience.
bool EnableKeyPathResilience = false;

/// Enables public emission of private metadata accessors.
bool EmitPublicTypeMetadataAccessors = false;

/// If set to true, the diagnosis engine can assume the emitted diagnostics
/// will be used in editor. This usually leads to more aggressive fixit.
bool DiagnosticsEditorMode = false;
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Option/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def warn_swift3_objc_inference : Flag<["-"], "warn-swift3-objc-inference">,
def emit_public_type_metadata_accessors :
Flag<["-"], "emit-public-type-metadata-accessors">,
Flags<[FrontendOption]>,
HelpText<"Emit all type metadata accessors as public">;
HelpText<"Emit all type metadata accessors as public (deprecated: now does nothing)">;

def Rpass_EQ : Joined<["-"], "Rpass=">,
Flags<[FrontendOption]>,
Expand Down
4 changes: 4 additions & 0 deletions lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ static void validateArgs(DiagnosticEngine &diags, const ArgList &args) {
validateDebugInfoArgs(diags, args);
validateCompilationConditionArgs(diags, args);
validateAutolinkingArgs(diags, args);

if (args.hasArg(options::OPT_emit_public_type_metadata_accessors))
diags.diagnose(SourceLoc(),
diag::warn_emit_public_type_metadata_accessors_deprecated);
}

std::unique_ptr<ToolChain>
Expand Down
2 changes: 0 additions & 2 deletions lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ static void addCommonFrontendArgs(const ToolChain &TC,
options::OPT_warn_swift3_objc_inference_minimal,
options::OPT_warn_swift3_objc_inference_complete);
inputArgs.AddLastArg(arguments, options::OPT_typo_correction_limit);
inputArgs.AddLastArg(arguments,
options::OPT_emit_public_type_metadata_accessors);
inputArgs.AddLastArg(arguments, options::OPT_enable_app_extension);
inputArgs.AddLastArg(arguments, options::OPT_enable_testing);
inputArgs.AddLastArg(arguments, options::OPT_g_Group);
Expand Down
3 changes: 0 additions & 3 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
}
}

Opts.EmitPublicTypeMetadataAccessors =
Args.hasArg(OPT_emit_public_type_metadata_accessors);

Opts.EnableNSKeyedArchiverDiagnostics =
Args.hasFlag(OPT_enable_nskeyedarchiver_diagnostics,
OPT_disable_nskeyedarchiver_diagnostics,
Expand Down
15 changes: 0 additions & 15 deletions lib/IRGen/MetadataRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,17 +601,6 @@ bool irgen::isTypeMetadataAccessTrivial(IRGenModule &IGM, CanType type) {
return false;
}

/// Determine whether we should promote the type metadata access function
/// for the given nominal type to "public".
static bool promoteMetadataAccessFunctionToPublic(
const NominalTypeDecl *nominal) {
ASTContext &ctx = nominal->getASTContext();

// When -emit-public-type-metadata-accessors is provided, promote all
// of the metadata access functions to public.
return ctx.LangOpts.EmitPublicTypeMetadataAccessors;
}

/// Return the standard access strategy for getting a non-dependent
/// type metadata object.
MetadataAccessStrategy irgen::getTypeMetadataAccessStrategy(CanType type) {
Expand Down Expand Up @@ -644,12 +633,8 @@ MetadataAccessStrategy irgen::getTypeMetadataAccessStrategy(CanType type) {
case FormalLinkage::PublicUnique:
return MetadataAccessStrategy::PublicUniqueAccessor;
case FormalLinkage::HiddenUnique:
if (promoteMetadataAccessFunctionToPublic(nominal))
return MetadataAccessStrategy::PublicUniqueAccessor;
return MetadataAccessStrategy::HiddenUniqueAccessor;
case FormalLinkage::Private:
if (promoteMetadataAccessFunctionToPublic(nominal))
return MetadataAccessStrategy::PublicUniqueAccessor;
return MetadataAccessStrategy::PrivateAccessor;

case FormalLinkage::PublicNonUnique:
Expand Down
3 changes: 3 additions & 0 deletions test/Driver/emit_public_type_metadata_accessors.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// RUN: %target-build-swift %s -emit-public-type-metadata-accessors 2>&1 | %FileCheck %s

// CHECK: the option '-emit-public-type-metadata-accessors' is no longer needed and is deprecated; consider removing it

This file was deleted.

17 changes: 0 additions & 17 deletions test/IRGen/emit_public_type_metadata_accessors.swift

This file was deleted.