mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Turn -implicit-objc-with on by default <rdar://problem/16795899>.
Swift SVN r17796
This commit is contained in:
@@ -62,7 +62,7 @@ namespace swift {
|
|||||||
/// Whether to make the "with" at the beginning of the first argument of
|
/// Whether to make the "with" at the beginning of the first argument of
|
||||||
/// an initializer implicit (i.e., dropped on import, added when computing
|
/// an initializer implicit (i.e., dropped on import, added when computing
|
||||||
/// a selector).
|
/// a selector).
|
||||||
bool ImplicitObjCWith = false;
|
bool ImplicitObjCWith = true;
|
||||||
|
|
||||||
/// Enables checking that uses of @objc require importing
|
/// Enables checking that uses of @objc require importing
|
||||||
/// the ObjectiveC module.
|
/// the ObjectiveC module.
|
||||||
|
|||||||
@@ -2303,7 +2303,7 @@ namespace {
|
|||||||
///
|
///
|
||||||
/// \code
|
/// \code
|
||||||
/// // in objc: [[NSArray alloc] initWithCapacity:1024]
|
/// // in objc: [[NSArray alloc] initWithCapacity:1024]
|
||||||
/// NSArray(withCapacity: 1024)
|
/// NSArray(capacity: 1024)
|
||||||
/// \endcode
|
/// \endcode
|
||||||
ConstructorDecl *importConstructor(const clang::ObjCMethodDecl *objcMethod,
|
ConstructorDecl *importConstructor(const clang::ObjCMethodDecl *objcMethod,
|
||||||
DeclContext *dc,
|
DeclContext *dc,
|
||||||
@@ -2345,7 +2345,7 @@ namespace {
|
|||||||
///
|
///
|
||||||
/// \code
|
/// \code
|
||||||
/// // in objc: [[NSArray alloc] initWithCapacity:1024]
|
/// // in objc: [[NSArray alloc] initWithCapacity:1024]
|
||||||
/// NSArray(withCapacity: 1024)
|
/// NSArray(capacity: 1024)
|
||||||
/// \endcode
|
/// \endcode
|
||||||
///
|
///
|
||||||
/// This variant of the function is responsible for actually binding the
|
/// This variant of the function is responsible for actually binding the
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ sil private @_TToFC18class_isa_pointers7Mongrel6methodfS0_FT_T_ : $@thin @cc(obj
|
|||||||
entry(%0 : $Purebred):
|
entry(%0 : $Purebred):
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
sil private @_TToFC18class_isa_pointers7MongrelcfMS0_FT11withBellsOnSi_S0_ : $@thin @cc(objc_method) (Int, Purebred) -> () {
|
sil private @_TToFC18class_isa_pointers7MongrelcfMS0_FT7bellsOnSi_S0_ : $@thin @cc(objc_method) (Int, Purebred) -> () {
|
||||||
entry(%0 : $Int, %1 : $Purebred):
|
entry(%0 : $Int, %1 : $Purebred):
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import gizmo
|
|||||||
// CHECK: @_PROPERTIES__TtC19objc_attr_NSManaged10SwiftGizmo = private constant { {{.*}}i32, i32, [1 x { i8*, i8* }] } { i32 16, i32 1, [1 x { i8*, i8* }] [{ i8*, i8* } { i8* getelementptr inbounds ([2 x i8]* [[X]], i64 0, i64 0),
|
// CHECK: @_PROPERTIES__TtC19objc_attr_NSManaged10SwiftGizmo = private constant { {{.*}}i32, i32, [1 x { i8*, i8* }] } { i32 16, i32 1, [1 x { i8*, i8* }] [{ i8*, i8* } { i8* getelementptr inbounds ([2 x i8]* [[X]], i64 0, i64 0),
|
||||||
|
|
||||||
// The getter/setter should not show up in the Swift metadata.
|
// The getter/setter should not show up in the Swift metadata.
|
||||||
// CHECK: @_TMdC19objc_attr_NSManaged10SwiftGizmo = global { {{.*}} } { void (%C19objc_attr_NSManaged10SwiftGizmo*)* @_TFC19objc_attr_NSManaged10SwiftGizmoD, i8** @_TWVBO, i64 ptrtoint (%objc_class* @"OBJC_METACLASS_$__TtC19objc_attr_NSManaged10SwiftGizmo" to i64), %objc_class* @"OBJC_CLASS_$_Gizmo", %swift.opaque* @_objc_empty_cache, %swift.opaque* @_objc_empty_vtable, i64 add (i64 ptrtoint ({ i32, i32, i32, i32, i8*, i8*, { i32, i32, [2 x { i8*, i8*, i8* }] }*, i8*, i8*, i8*, { i32, i32, [1 x { i8*, i8* }] }* }* @_DATA__TtC19objc_attr_NSManaged10SwiftGizmo to i64), i64 1), i32 16, i32 7, i32 96, i32 16, { i64, i8*, i32, i32, i8*, %swift.type** (%swift.type*)*, i32, i32 }* @_TMnC19objc_attr_NSManaged10SwiftGizmo, %C19objc_attr_NSManaged10SwiftGizmo* (i64, %C19objc_attr_NSManaged10SwiftGizmo*)* @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT11withBellsOnSi_S0_, %C19objc_attr_NSManaged10SwiftGizmo* (%C19objc_attr_NSManaged10SwiftGizmo*)* @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT_S0_ }
|
// CHECK: @_TMdC19objc_attr_NSManaged10SwiftGizmo = global { {{.*}} } { void (%C19objc_attr_NSManaged10SwiftGizmo*)* @_TFC19objc_attr_NSManaged10SwiftGizmoD, i8** @_TWVBO, i64 ptrtoint (%objc_class* @"OBJC_METACLASS_$__TtC19objc_attr_NSManaged10SwiftGizmo" to i64), %objc_class* @"OBJC_CLASS_$_Gizmo", %swift.opaque* @_objc_empty_cache, %swift.opaque* @_objc_empty_vtable, i64 add (i64 ptrtoint ({ i32, i32, i32, i32, i8*, i8*, { i32, i32, [2 x { i8*, i8*, i8* }] }*, i8*, i8*, i8*, { i32, i32, [1 x { i8*, i8* }] }* }* @_DATA__TtC19objc_attr_NSManaged10SwiftGizmo to i64), i64 1), i32 16, i32 7, i32 96, i32 16, { i64, i8*, i32, i32, i8*, %swift.type** (%swift.type*)*, i32, i32 }* @_TMnC19objc_attr_NSManaged10SwiftGizmo, %C19objc_attr_NSManaged10SwiftGizmo* (i64, %C19objc_attr_NSManaged10SwiftGizmo*)* @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_S0_, %C19objc_attr_NSManaged10SwiftGizmo* (%C19objc_attr_NSManaged10SwiftGizmo*)* @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT_S0_ }
|
||||||
|
|
||||||
@objc class SwiftGizmo : Gizmo {
|
@objc class SwiftGizmo : Gizmo {
|
||||||
@objc @NSManaged var x: X
|
@objc @NSManaged var x: X
|
||||||
@@ -35,7 +35,7 @@ bb0(%0 : $SwiftGizmo):
|
|||||||
return %0 : $SwiftGizmo
|
return %0 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|
||||||
sil @_TToFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT11withBellsOnSi_S0_ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
sil @_TToFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_S0_ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
||||||
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
||||||
return %1 : $SwiftGizmo
|
return %1 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
@@ -45,12 +45,12 @@ bb0(%0 : $SwiftGizmo):
|
|||||||
return %0 : $SwiftGizmo
|
return %0 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|
||||||
sil @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT11withBellsOnSi_S0_ : $@cc(method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
sil @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_S0_ : $@cc(method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
||||||
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
||||||
return %1 : $SwiftGizmo
|
return %1 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|
||||||
sil_vtable SwiftGizmo {
|
sil_vtable SwiftGizmo {
|
||||||
#SwiftGizmo.init!initializer.1: _TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT_S0_ // objc_attr_NSManaged.SwiftGizmo.init (objc_attr_NSManaged.SwiftGizmo.Type)() -> objc_attr_NSManaged.SwiftGizmo
|
#SwiftGizmo.init!initializer.1: _TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT_S0_ // objc_attr_NSManaged.SwiftGizmo.init (objc_attr_NSManaged.SwiftGizmo.Type)() -> objc_attr_NSManaged.SwiftGizmo
|
||||||
#SwiftGizmo.init!initializer.1: _TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT11withBellsOnSi_S0_ // objc_attr_NSManaged.SwiftGizmo.init (objc_attr_NSManaged.SwiftGizmo.Type)(withBellsOn : Swift.Int) -> objc_attr_NSManaged.SwiftGizmo
|
#SwiftGizmo.init!initializer.1: _TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_S0_ // objc_attr_NSManaged.SwiftGizmo.init (objc_attr_NSManaged.SwiftGizmo.Type)(withBellsOn : Swift.Int) -> objc_attr_NSManaged.SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ bb0(%0 : $SwiftGizmo):
|
|||||||
return %0 : $SwiftGizmo
|
return %0 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|
||||||
sil @_TToFC12objc_dealloc10SwiftGizmocfMS0_FT11withBellsOnSi_S0_ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
sil @_TToFC12objc_dealloc10SwiftGizmocfMS0_FT7bellsOnSi_S0_ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
||||||
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
||||||
return %1 : $SwiftGizmo
|
return %1 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ bb0:
|
|||||||
return %0 : $() // id: %1
|
return %0 : $() // id: %1
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: define {{.*}} @_TFCSo4HiveCfMS_FT9withQueenGSQCSo1B__S_
|
// CHECK-LABEL: define {{.*}} @_TFCSo4HiveCfMS_FT5queenGSQCSo1B__S_
|
||||||
sil @_TFCSo4HiveCfMS_FT9withQueenGSQCSo1B__S_ : $@thin (@owned ImplicitlyUnwrappedOptional<B>, @thick Hive.Type) -> @owned Hive {
|
sil @_TFCSo4HiveCfMS_FT5queenGSQCSo1B__S_ : $@thin (@owned ImplicitlyUnwrappedOptional<B>, @thick Hive.Type) -> @owned Hive {
|
||||||
bb0(%0 : $ImplicitlyUnwrappedOptional<B>, %1 : $@thick Hive.Type):
|
bb0(%0 : $ImplicitlyUnwrappedOptional<B>, %1 : $@thick Hive.Type):
|
||||||
%2 = thick_to_objc_metatype %1 : $@thick Hive.Type to $@objc_metatype Hive.Type // users: %3, %4
|
%2 = thick_to_objc_metatype %1 : $@thick Hive.Type to $@objc_metatype Hive.Type // users: %3, %4
|
||||||
// CHECK: load i8** @"\01L_selector(hiveWithQueen:)"
|
// CHECK: load i8** @"\01L_selector(hiveWithQueen:)"
|
||||||
%3 = class_method %2 : $@objc_metatype Hive.Type, #Hive.init!allocator.1.foreign : Hive.Type -> (withQueen: ImplicitlyUnwrappedOptional<B>) -> Hive , $@cc(objc_method) @thin (ImplicitlyUnwrappedOptional<B>, @objc_metatype Hive.Type) -> @autoreleased Hive // user: %4
|
%3 = class_method %2 : $@objc_metatype Hive.Type, #Hive.init!allocator.1.foreign : Hive.Type -> (queen: ImplicitlyUnwrappedOptional<B>) -> Hive , $@cc(objc_method) @thin (ImplicitlyUnwrappedOptional<B>, @objc_metatype Hive.Type) -> @autoreleased Hive // user: %4
|
||||||
// CHECK: call {{.*}} @objc_msgSend
|
// CHECK: call {{.*}} @objc_msgSend
|
||||||
%4 = apply %3(%0, %2) : $@cc(objc_method) @thin (ImplicitlyUnwrappedOptional<B>, @objc_metatype Hive.Type) -> @autoreleased Hive // users: %5, %6
|
%4 = apply %3(%0, %2) : $@cc(objc_method) @thin (ImplicitlyUnwrappedOptional<B>, @objc_metatype Hive.Type) -> @autoreleased Hive // users: %5, %6
|
||||||
// CHECK: call {{.*}} @objc_retainAutoreleasedReturnValue
|
// CHECK: call {{.*}} @objc_retainAutoreleasedReturnValue
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ entry(%f : $(Builtin.Word) -> (), %x : $Builtin.Word):
|
|||||||
// CHECK-NOT: swift_retain
|
// CHECK-NOT: swift_retain
|
||||||
// CHECK: [[SELF:%.*]] = load %C13partial_apply9ObjCClass** [[X_ADDR]], align 8
|
// CHECK: [[SELF:%.*]] = load %C13partial_apply9ObjCClass** [[X_ADDR]], align 8
|
||||||
// CHECK-NOT: swift_retain
|
// CHECK-NOT: swift_retain
|
||||||
// CHECK: [[CMD:%.*]] = load i8** @"\01L_selector(methodX:)", align 8
|
// CHECK: [[CMD:%.*]] = load i8** @"\01L_selector(methodWithX:)", align 8
|
||||||
// CHECK: [[I8PTRSELF:%.*]] = bitcast %C13partial_apply9ObjCClass* [[SELF]] to [[OPAQUE0:%.*]]*
|
// CHECK: [[I8PTRSELF:%.*]] = bitcast %C13partial_apply9ObjCClass* [[SELF]] to [[OPAQUE0:%.*]]*
|
||||||
// CHECK-NOT: swift_retain
|
// CHECK-NOT: swift_retain
|
||||||
// CHECK: call void bitcast (void ()* @objc_msgSend to void ([[OPAQUE2:%.*]]*, i8*, i64)*)([[OPAQUE2]]* [[I8PTRSELF]], i8* [[CMD]], i64 %0)
|
// CHECK: call void bitcast (void ()* @objc_msgSend to void ([[OPAQUE2:%.*]]*, i8*, i64)*)([[OPAQUE2]]* [[I8PTRSELF]], i8* [[CMD]], i64 %0)
|
||||||
@@ -132,7 +132,7 @@ entry(%x : $Int):
|
|||||||
// CHECK-LABEL: define { i8*, %swift.refcounted* } @dynamic_lookup_br_partial_apply(%objc_object*) {
|
// CHECK-LABEL: define { i8*, %swift.refcounted* } @dynamic_lookup_br_partial_apply(%objc_object*) {
|
||||||
// CHECK: phi i8* [ bitcast (void (i64)* @dummy to i8*), {{%.*}} ], [ bitcast (void (i64, %swift.refcounted*)* [[DYNAMIC_LOOKUP_BR_PARTIAL_APPLY_STUB:@_TPA[A-Za-z0-9_]*]] to i8*), {{%.*}} ]
|
// CHECK: phi i8* [ bitcast (void (i64)* @dummy to i8*), {{%.*}} ], [ bitcast (void (i64, %swift.refcounted*)* [[DYNAMIC_LOOKUP_BR_PARTIAL_APPLY_STUB:@_TPA[A-Za-z0-9_]*]] to i8*), {{%.*}} ]
|
||||||
// CHECK: define internal void [[DYNAMIC_LOOKUP_BR_PARTIAL_APPLY_STUB]](i64, %swift.refcounted*) {
|
// CHECK: define internal void [[DYNAMIC_LOOKUP_BR_PARTIAL_APPLY_STUB]](i64, %swift.refcounted*) {
|
||||||
// CHECK: load i8** @"\01L_selector(methodX:)", align 8
|
// CHECK: load i8** @"\01L_selector(methodWithX:)", align 8
|
||||||
|
|
||||||
sil @dynamic_lookup_br_partial_apply : $@thin Builtin.UnknownObject -> @callee_owned Int -> () {
|
sil @dynamic_lookup_br_partial_apply : $@thin Builtin.UnknownObject -> @callee_owned Int -> () {
|
||||||
entry(%o : $Builtin.UnknownObject):
|
entry(%o : $Builtin.UnknownObject):
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
Latest
|
Latest
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* The word "with" is now removed from the first keyword argument name
|
||||||
|
if an initialized imported from Objective-C. For example, instead of
|
||||||
|
building UIColor as:
|
||||||
|
|
||||||
|
UIColor(withRed: r, green: g, blue: b, alpha: a)
|
||||||
|
|
||||||
|
it will now be:
|
||||||
|
|
||||||
|
UIColor(red: r, green: g, blue: b, alpha: a)
|
||||||
|
|
||||||
* `Dictionary` can be bridged to `NSDictionary` and vice versa:
|
* `Dictionary` can be bridged to `NSDictionary` and vice versa:
|
||||||
|
|
||||||
- `NSDictionary` has an implicit convertion to `Dictionary<NSObject,
|
- `NSDictionary` has an implicit conversion to `Dictionary<NSObject,
|
||||||
AnyObject>`. It bridges in O(1), without memory allocation.
|
AnyObject>`. It bridges in O(1), without memory allocation.
|
||||||
|
|
||||||
- `Dictionary<K, V>` has an implicit convertion to `NSDictionary`.
|
- `Dictionary<K, V>` has an implicit conversion to `NSDictionary`.
|
||||||
`Dictionary<K, V>` bridges to `NSDictionary` iff both `K` and `V` are
|
`Dictionary<K, V>` bridges to `NSDictionary` iff both `K` and `V` are
|
||||||
bridged. Otherwise, a runtime error is raised.
|
bridged. Otherwise, a runtime error is raised.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user