Skip to content

Commit 95820e3

Browse files
authored
Merge pull request #4431 from DougGregor/remove-code
Remove a bunch of dead language options
2 parents 59a7c73 + 68c3f3b commit 95820e3

File tree

72 files changed

+154
-1361
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+154
-1361
lines changed

include/swift/AST/ASTContext.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -522,13 +522,10 @@ class ASTContext {
522522
///
523523
/// \param dc The context in which bridging is occurring.
524524
/// \param type The Swift for which we are querying bridging behavior.
525-
/// \param resolver The lazy resolver.
526525
/// \param bridgedValueType The specific value type that is bridged,
527526
/// which will usually by the same as \c type.
528-
Optional<Type> getBridgedToObjC(const DeclContext *dc,
529-
Type type,
530-
LazyResolver *resolver,
531-
Type *bridgedValueType = nullptr) const;
527+
Type getBridgedToObjC(const DeclContext *dc, Type type,
528+
Type *bridgedValueType = nullptr) const;
532529

533530
/// Determine whether the given Swift type is representable in a
534531
/// given foreign language.

include/swift/AST/Attr.def

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ SIMPLE_DECL_ATTR(required, Required,
102102
SIMPLE_DECL_ATTR(optional, Optional,
103103
OnConstructor|OnFunc|OnVar|OnSubscript|DeclModifier, 5)
104104

105-
DECL_ATTR(swift3_migration, Swift3Migration,
106-
OnEnum | OnStruct | OnClass | OnProtocol | OnTypeAlias |
107-
OnVar | OnSubscript | OnConstructor | OnFunc | OnEnumElement |
108-
OnGenericTypeParam | OnAssociatedType | LongAttribute, 6)
105+
/// NOTE: 6 is unused
109106

110107
SIMPLE_DECL_ATTR(noreturn, NoReturn, OnFunc, 7)
111108

include/swift/AST/Attr.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,28 +1018,6 @@ class SynthesizedProtocolAttr : public DeclAttribute {
10181018
}
10191019
};
10201020

1021-
/// The @swift3_migration attribute which describes the transformations
1022-
/// required to migrate the given Swift 2.x API to Swift 3.
1023-
class Swift3MigrationAttr : public DeclAttribute {
1024-
DeclName Renamed;
1025-
StringRef Message;
1026-
1027-
public:
1028-
Swift3MigrationAttr(SourceLoc atLoc, SourceLoc attrLoc, SourceLoc lParenLoc,
1029-
DeclName renamed, StringRef message, SourceLoc rParenLoc,
1030-
bool implicit)
1031-
: DeclAttribute(DAK_Swift3Migration, atLoc, SourceRange(attrLoc, rParenLoc),
1032-
implicit),
1033-
Renamed(renamed), Message(message) { }
1034-
1035-
DeclName getRenamed() const { return Renamed; }
1036-
StringRef getMessage() const { return Message; }
1037-
1038-
static bool classof(const DeclAttribute *DA) {
1039-
return DA->getKind() == DAK_Swift3Migration;
1040-
}
1041-
};
1042-
10431021
/// The @_specialize attribute, which forces specialization on the specified
10441022
/// type list.
10451023
class SpecializeAttr : public DeclAttribute {

include/swift/AST/DiagnosticsParse.def

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,16 +1259,6 @@ ERROR(effects_attribute_expect_option,none,
12591259
ERROR(effects_attribute_unknown_option,none,
12601260
"unknown option '%0' for attribute '%1'", (StringRef, StringRef))
12611261

1262-
// swift3_migration
1263-
ERROR(attr_swift3_migration_label,none,
1264-
"expected 'renamed' or 'message' in 'swift3_migration' attribute", ())
1265-
WARNING(warn_attr_swift3_migration_unknown_label,none,
1266-
"expected 'renamed' or 'message' in 'swift3_migration' attribute", ())
1267-
ERROR(attr_swift3_migration_expected_rparen,none,
1268-
"expected ')' after name for 'swift3_migration' attribute", ())
1269-
ERROR(attr_bad_swift_name,none,
1270-
"ill-formed Swift name '%0'", (StringRef))
1271-
12721262
// unowned
12731263
ERROR(attr_unowned_invalid_specifier,none,
12741264
"expected 'safe' or 'unsafe'", ())

include/swift/AST/DiagnosticsSema.def

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3109,12 +3109,6 @@ WARNING(variable_never_read, none,
31093109
"%select{variable|parameter}1 %0 was written to, but never read",
31103110
(Identifier, unsigned))
31113111

3112-
//------------------------------------------------------------------------------
3113-
// Naming convention diagnostics
3114-
//------------------------------------------------------------------------------
3115-
WARNING(omit_needless_words, none,
3116-
"%0 could be named %1 [-Womit-needless-words]", (DeclName, DeclName))
3117-
31183112
WARNING(extraneous_default_args_in_call, none,
31193113
"call to %0 has extraneous arguments that could use defaults",
31203114
(DeclName))

include/swift/AST/Expr.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,8 @@ enum class CheckedCastKind : unsigned {
8181
ArrayDowncast,
8282
// A downcast from a dictionary type to another dictionary type.
8383
DictionaryDowncast,
84-
// A downcast from a dictionary type to another dictionary type that
85-
// requires bridging.
86-
DictionaryDowncastBridged,
8784
// A downcast from a set type to another set type.
8885
SetDowncast,
89-
// A downcast from a set type to another set type that requires bridging.
90-
SetDowncastBridged,
9186
/// A downcast from an object of class or Objective-C existential
9287
/// type to its bridged value type.
9388
BridgeFromObjectiveC,
@@ -392,9 +387,8 @@ class alignas(8) Expr {
392387
class CollectionUpcastConversionExprBitfields {
393388
friend class CollectionUpcastConversionExpr;
394389
unsigned : NumExprBits;
395-
unsigned BridgesToObjC : 1;
396390
};
397-
enum { NumCollectionUpcastConversionExprBits = NumExprBits + 1 };
391+
enum { NumCollectionUpcastConversionExprBits = NumExprBits + 0 };
398392
static_assert(NumCollectionUpcastConversionExprBits <= 32, "fits in an unsigned");
399393

400394
class ObjCSelectorExprBitfields {
@@ -2938,19 +2932,12 @@ class CollectionUpcastConversionExpr : public ImplicitConversionExpr {
29382932
public:
29392933
CollectionUpcastConversionExpr(Expr *subExpr, Type type,
29402934
ConversionPair keyConversion,
2941-
ConversionPair valueConversion,
2942-
bool bridgesToObjC)
2935+
ConversionPair valueConversion)
29432936
: ImplicitConversionExpr(
29442937
ExprKind::CollectionUpcastConversion, subExpr, type),
29452938
KeyConversion(keyConversion), ValueConversion(valueConversion) {
29462939
assert((!KeyConversion || ValueConversion)
29472940
&& "key conversion without value conversion");
2948-
CollectionUpcastConversionExprBits.BridgesToObjC = bridgesToObjC;
2949-
}
2950-
2951-
/// Whether this upcast bridges the source elements to Objective-C.
2952-
bool bridgesToObjC() const {
2953-
return CollectionUpcastConversionExprBits.BridgesToObjC;
29542941
}
29552942

29562943
/// Returns the expression that should be used to perform a

include/swift/AST/KnownDecls.def

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,12 @@ FUNC_DECL(ArrayForceCast, "_arrayForceCast")
2323
FUNC_DECL(ArrayConditionalCast, "_arrayConditionalCast")
2424

2525
FUNC_DECL(DictionaryUpCast, "_dictionaryUpCast")
26-
FUNC_DECL(DictionaryBridgeToObjectiveC, "_dictionaryBridgeToObjectiveC")
2726
FUNC_DECL(DictionaryDownCast, "_dictionaryDownCast")
2827
FUNC_DECL(DictionaryDownCastConditional, "_dictionaryDownCastConditional")
29-
FUNC_DECL(DictionaryBridgeFromObjectiveC,
30-
"_dictionaryBridgeFromObjectiveC")
31-
FUNC_DECL(DictionaryBridgeFromObjectiveCConditional,
32-
"_dictionaryBridgeFromObjectiveCConditional")
3328

3429
FUNC_DECL(SetUpCast, "_setUpCast")
35-
FUNC_DECL(SetBridgeToObjectiveC, "_setBridgeToObjectiveC")
3630
FUNC_DECL(SetDownCast, "_setDownCast")
3731
FUNC_DECL(SetDownCastConditional, "_setDownCastConditional")
38-
FUNC_DECL(SetBridgeFromObjectiveC, "_setBridgeFromObjectiveC")
39-
FUNC_DECL(SetBridgeFromObjectiveCConditional, "_setBridgeFromObjectiveCConditional")
4032

4133
FUNC_DECL(ConvertPointerToPointerArgument,
4234
"_convertPointerToPointerArgument")

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,6 @@ struct PrintOptions {
391391
result.ExcludeAttrList.push_back(DAK_Exported);
392392
result.ExcludeAttrList.push_back(DAK_Inline);
393393
result.ExcludeAttrList.push_back(DAK_Rethrows);
394-
result.ExcludeAttrList.push_back(DAK_Swift3Migration);
395394
result.PrintOverrideKeyword = false;
396395
result.AccessibilityFilter = Accessibility::Public;
397396
result.PrintIfConfig = false;
@@ -448,7 +447,6 @@ struct PrintOptions {
448447
result.PrintAccessibility = false;
449448
result.SkipUnavailable = false;
450449
result.ExcludeAttrList.push_back(DAK_Available);
451-
result.ExcludeAttrList.push_back(DAK_Swift3Migration);
452450
result.ArgAndParamPrinting =
453451
PrintOptions::ArgAndParamPrintingMode::BothAlways;
454452
result.PrintDocumentationComments = false;
@@ -493,7 +491,6 @@ struct PrintOptions {
493491
PO.PrintFunctionRepresentationAttrs = false;
494492
PO.PrintDocumentationComments = false;
495493
PO.ExcludeAttrList.push_back(DAK_Available);
496-
PO.ExcludeAttrList.push_back(DAK_Swift3Migration);
497494
PO.SkipPrivateStdlibDecls = true;
498495
PO.ExplodeEnumCaseDecls = true;
499496
return PO;

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ namespace swift {
4444
/// \brief Disable API availability checking.
4545
bool DisableAvailabilityChecking = false;
4646

47-
/// Whether to warn about "needless" words in declarations.
48-
bool WarnOmitNeedlessWords = false;
49-
5047
/// Should access control be respected?
5148
bool EnableAccessControl = true;
5249

@@ -95,9 +92,6 @@ namespace swift {
9592
/// was not compiled with -enable-testing.
9693
bool EnableTestableAttrRequiresTestableModule = true;
9794

98-
/// Whether to implement SE-0111, the removal of argument labels in types.
99-
bool SuppressArgumentLabelsInTypes = false;
100-
10195
///
10296
/// Flags for developers
10397
///
@@ -143,30 +137,17 @@ namespace swift {
143137
/// \brief Enable experimental nested generic types feature.
144138
bool EnableExperimentalNestedGenericTypes = false;
145139

146-
/// \brief Enable generalized collection casting.
147-
bool EnableExperimentalCollectionCasts = true;
148-
149140
/// Should we check the target OSs of serialized modules to see that they're
150141
/// new enough?
151142
bool EnableTargetOSChecking = true;
152143

153-
/// Should 'private' use Swift 3's lexical scoping, or the Swift 2 behavior
154-
/// of 'fileprivate'?
155-
bool EnableSwift3Private = true;
156-
157144
/// Whether to use the import as member inference system
158145
///
159146
/// When importing a global, try to infer whether we can import it as a
160147
/// member of some type instead. This includes inits, computed properties,
161148
/// and methods.
162149
bool InferImportAsMember = false;
163150

164-
/// Should 'id' in Objective-C be imported as 'Any' in Swift?
165-
bool EnableIdAsAny = true;
166-
167-
/// Enable the Swift 3 migration via Fix-Its.
168-
bool Swift3Migration = false;
169-
170151
/// Sets the target we are building for and updates platform conditions
171152
/// to match.
172153
///

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ def disable_testable_attr_requires_testable_module :
9494
Flag<["-"], "disable-testable-attr-requires-testable-module">,
9595
HelpText<"Disable checking of @testable">;
9696

97-
def suppress_argument_labels_in_types :
98-
Flag<["-"], "suppress-argument-labels-in-types">,
99-
HelpText<"SE-0111: Suppress argument labels in types">;
100-
10197
def enable_target_os_checking :
10298
Flag<["-"], "enable-target-os-checking">,
10399
HelpText<"Enable checking the target OS of serialized modules">;
@@ -231,10 +227,6 @@ def enable_experimental_nested_generic_types :
231227
Flag<["-"], "enable-experimental-nested-generic-types">,
232228
HelpText<"Enable experimental support for nested generic types">;
233229

234-
def enable_experimental_collection_casts :
235-
Flag<["-"], "enable-experimental-collection-casts">,
236-
HelpText<"Enable experimental support for general collection casting">;
237-
238230
def disable_availability_checking : Flag<["-"],
239231
"disable-availability-checking">,
240232
HelpText<"Disable checking for potentially unavailable APIs">;
@@ -247,20 +239,12 @@ def enable_swift_newtype :
247239
Flag<["-"], "enable-swift-newtype">,
248240
HelpText<"Enable the swift_newtype attribute">;
249241

250-
def swift3_migration :
251-
Flag<["-"], "swift3-migration">,
252-
HelpText<"Enable Fix-It based migration aids for Swift 3">;
253-
254242
def warn_long_function_bodies : Separate<["-"], "warn-long-function-bodies">,
255243
MetaVarName<"<n>">,
256244
HelpText<"Warns when type-checking a function takes longer than <n> ms">;
257245
def warn_long_function_bodies_EQ : Joined<["-"], "warn-long-function-bodies=">,
258246
Alias<warn_long_function_bodies>;
259247

260-
def warn_omit_needless_words :
261-
Flag<["-"], "Womit-needless-words">,
262-
HelpText<"Warn about needless words in names">;
263-
264248
def enable_source_import : Flag<["-"], "enable-source-import">,
265249
HelpText<"Enable importing of Swift source files">;
266250

@@ -349,7 +333,4 @@ def enable_resilience : Flag<["-"], "enable-resilience">,
349333
def group_info_path : Separate<["-"], "group-info-path">,
350334
HelpText<"The path to collect the group information of the compiled module">;
351335

352-
def enable_id_as_any: Flag<["-"], "enable-id-as-any">,
353-
HelpText<"Enable importing ObjC 'id' as Swift 'Any' type">;
354-
355336
} // end let Flags = [FrontendOption, NoDriverOption, HelpHidden]

include/swift/Serialization/ModuleFormat.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,14 +1357,6 @@ namespace decls_block {
13571357
BCArray<IdentifierIDField>
13581358
>;
13591359

1360-
using Swift3MigrationDeclAttrLayout = BCRecordLayout<
1361-
Swift3Migration_DECL_ATTR,
1362-
BCFixed<1>, // implicit flag
1363-
BCVBR<5>, // number of bytes in rename string
1364-
BCVBR<5>, // number of bytes in message string
1365-
BCBlob // rename, followed by message
1366-
>;
1367-
13681360
using SpecializeDeclAttrLayout = BCRecordLayout<
13691361
Specialize_DECL_ATTR,
13701362
BCArray<TypeIDField> // concrete types

lib/AST/ASTContext.cpp

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4002,46 +4002,14 @@ bool ASTContext::isStandardLibraryTypeBridgedInFoundation(
40024002
nominal->getName() == Id_CGFloat);
40034003
}
40044004

4005-
Optional<Type>
4006-
ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
4007-
LazyResolver *resolver,
4008-
Type *bridgedValueType) const {
4005+
Type ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
4006+
Type *bridgedValueType) const {
40094007
if (type->isBridgeableObjectType()) {
40104008
if (bridgedValueType) *bridgedValueType = type;
40114009

40124010
return type;
40134011
}
40144012

4015-
// Whitelist certain types even if Foundation is not imported, to ensure
4016-
// that casts from AnyObject to one of these types are not optimized away.
4017-
//
4018-
// Outside of these standard library types to which Foundation
4019-
// bridges, an _ObjectiveCBridgeable conformance can only be added
4020-
// in the same module where the Swift type itself is defined, so the
4021-
// optimizer will be guaranteed to see the conformance if it exists.
4022-
bool knownBridgedToObjC = false;
4023-
if (auto ntd = type->getAnyNominal())
4024-
knownBridgedToObjC = isStandardLibraryTypeBridgedInFoundation(ntd);
4025-
4026-
// TODO: Under id-as-any, container bridging is unconstrained. This check can
4027-
// go away.
4028-
if (!LangOpts.EnableIdAsAny) {
4029-
// If the type is generic, check whether its generic arguments are also
4030-
// bridged to Objective-C.
4031-
if (auto bgt = type->getAs<BoundGenericType>()) {
4032-
for (auto arg : bgt->getGenericArgs()) {
4033-
if (arg->hasTypeVariable())
4034-
continue;
4035-
4036-
if (!getBridgedToObjC(dc, arg, resolver))
4037-
return None;
4038-
}
4039-
}
4040-
} else {
4041-
// Under id-as-any, anything is bridged to objective c.
4042-
knownBridgedToObjC = true;
4043-
}
4044-
40454013
if (auto metaTy = type->getAs<MetatypeType>())
40464014
if (metaTy->getInstanceType()->mayHaveSuperclass())
40474015
return type;
@@ -4069,7 +4037,8 @@ ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
40694037
auto proto = getProtocol(known);
40704038
if (!proto) return None;
40714039

4072-
return dc->getParentModule()->lookupConformance(type, proto, resolver);
4040+
return dc->getParentModule()->lookupConformance(type, proto,
4041+
getLazyResolver());
40734042
};
40744043

40754044
// Do we conform to _ObjectiveCBridgeable?
@@ -4083,7 +4052,7 @@ ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
40834052
if (conformance->isConcrete()) {
40844053
return ProtocolConformance::getTypeWitnessByName(
40854054
type, conformance->getConcrete(), Id_ObjectiveCType,
4086-
resolver);
4055+
getLazyResolver());
40874056
} else {
40884057
return type->castTo<ArchetypeType>()->getNestedType(Id_ObjectiveCType)
40894058
.getValue();
@@ -4101,12 +4070,8 @@ ASTContext::getBridgedToObjC(const DeclContext *dc, Type type,
41014070
return nsErrorDecl->getDeclaredInterfaceType();
41024071
}
41034072

4104-
4105-
// If we haven't imported Foundation but this is a whitelisted type,
4106-
// behave as above.
4107-
if (knownBridgedToObjC)
4108-
return Type();
4109-
return None;
4073+
// No special bridging to Objective-C, but this can become an 'Any'.
4074+
return Type();
41104075
}
41114076

41124077
std::pair<ArchetypeBuilder *, ArchetypeBuilder::PotentialArchetype *>

lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1936,8 +1936,6 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
19361936
}
19371937
void visitCollectionUpcastConversionExpr(CollectionUpcastConversionExpr *E) {
19381938
printCommon(E, "collection_upcast_expr");
1939-
if (E->bridgesToObjC())
1940-
OS << " bridges_to_objc";
19411939
OS << '\n';
19421940
printRec(E->getSubExpr());
19431941
if (auto keyConversion = E->getKeyConversion()) {

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4398,12 +4398,8 @@ StringRef swift::getCheckedCastKindName(CheckedCastKind kind) {
43984398
return "array_downcast";
43994399
case CheckedCastKind::DictionaryDowncast:
44004400
return "dictionary_downcast";
4401-
case CheckedCastKind::DictionaryDowncastBridged:
4402-
return "dictionary_downcast_bridged";
44034401
case CheckedCastKind::SetDowncast:
44044402
return "set_downcast";
4405-
case CheckedCastKind::SetDowncastBridged:
4406-
return "set_downcast_bridged";
44074403
case CheckedCastKind::BridgeFromObjectiveC:
44084404
return "bridge_from_objc";
44094405
}

0 commit comments

Comments
 (0)