mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Enable imports of failable initializers by default.
Swift SVN r21699
This commit is contained in:
@@ -35,7 +35,7 @@ public:
|
|||||||
bool InferImplicitProperties = false;
|
bool InferImplicitProperties = false;
|
||||||
|
|
||||||
/// If true, use failable initializers.
|
/// If true, use failable initializers.
|
||||||
bool UseFailableInitializers = false;
|
bool UseFailableInitializers = true;
|
||||||
|
|
||||||
/// If true, Clang diagnostics will be dumped to stderr using Clang's
|
/// If true, Clang diagnostics will be dumped to stderr using Clang's
|
||||||
/// diagnostic printer as well as being passed to Swift's diagnostic engine.
|
/// diagnostic printer as well as being passed to Swift's diagnostic engine.
|
||||||
|
|||||||
@@ -657,10 +657,31 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
|
|||||||
case OverloadChoiceKind::DeclViaBridge:
|
case OverloadChoiceKind::DeclViaBridge:
|
||||||
case OverloadChoiceKind::DeclViaUnwrappedOptional:
|
case OverloadChoiceKind::DeclViaUnwrappedOptional:
|
||||||
// Determine whether one declaration is more specialized than the other.
|
// Determine whether one declaration is more specialized than the other.
|
||||||
if (isDeclAsSpecializedAs(tc, cs.DC, decl1, decl2))
|
bool firstAsSpecializedAs = false;
|
||||||
|
bool secondAsSpecializedAs = false;
|
||||||
|
if (isDeclAsSpecializedAs(tc, cs.DC, decl1, decl2)) {
|
||||||
++score1;
|
++score1;
|
||||||
if (isDeclAsSpecializedAs(tc, cs.DC, decl2, decl1))
|
firstAsSpecializedAs = true;
|
||||||
|
}
|
||||||
|
if (isDeclAsSpecializedAs(tc, cs.DC, decl2, decl1)) {
|
||||||
++score2;
|
++score2;
|
||||||
|
secondAsSpecializedAs = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If each is as specialized as the other, and both are constructors,
|
||||||
|
// check the constructor kind.
|
||||||
|
if (firstAsSpecializedAs && secondAsSpecializedAs) {
|
||||||
|
if (auto ctor1 = dyn_cast<ConstructorDecl>(decl1)) {
|
||||||
|
if (auto ctor2 = dyn_cast<ConstructorDecl>(decl2)) {
|
||||||
|
if (ctor1->getInitKind() != ctor2->getInitKind()) {
|
||||||
|
if (ctor1->getInitKind() < ctor2->getInitKind())
|
||||||
|
++score1;
|
||||||
|
else
|
||||||
|
++score2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If one declaration is available and the other is not,
|
// If one declaration is available and the other is not,
|
||||||
bool unavail1 = decl1->getAttrs().isUnavailable(cs.getASTContext());
|
bool unavail1 = decl1->getAttrs().isUnavailable(cs.getASTContext());
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ extension NSString : StringLiteralConvertible {
|
|||||||
immutableResult = NSString(
|
immutableResult = NSString(
|
||||||
bytes: &uintValue,
|
bytes: &uintValue,
|
||||||
length: 4,
|
length: 4,
|
||||||
encoding: NSUTF32StringEncoding)
|
encoding: NSUTF32StringEncoding)!
|
||||||
}
|
}
|
||||||
return self(string: immutableResult)
|
return self(string: immutableResult)
|
||||||
}
|
}
|
||||||
@@ -1118,7 +1118,7 @@ public typealias NSErrorPointer = AutoreleasingUnsafeMutablePointer<NSError?>
|
|||||||
extension NSPredicate {
|
extension NSPredicate {
|
||||||
// + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat, ...;
|
// + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat, ...;
|
||||||
public
|
public
|
||||||
convenience init(format predicateFormat: String, _ args: CVarArgType...) {
|
convenience init?(format predicateFormat: String, _ args: CVarArgType...) {
|
||||||
let va_args = getVaList(args)
|
let va_args = getVaList(args)
|
||||||
self.init(format: predicateFormat, arguments: va_args)
|
self.init(format: predicateFormat, arguments: va_args)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ extension String {
|
|||||||
encoding enc: NSStringEncoding,
|
encoding enc: NSStringEncoding,
|
||||||
error: NSErrorPointer = nil
|
error: NSErrorPointer = nil
|
||||||
) -> String? {
|
) -> String? {
|
||||||
return NSString.stringWithContentsOfFile(path, encoding: enc, error: error)
|
return NSString(contentsOfFile: path, encoding: enc, error: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// + (instancetype)
|
// + (instancetype)
|
||||||
@@ -215,7 +215,7 @@ extension String {
|
|||||||
usedEncoding: UnsafeMutablePointer<NSStringEncoding> = nil,
|
usedEncoding: UnsafeMutablePointer<NSStringEncoding> = nil,
|
||||||
error: NSErrorPointer = nil
|
error: NSErrorPointer = nil
|
||||||
) -> String? {
|
) -> String? {
|
||||||
return NSString.stringWithContentsOfFile(path, usedEncoding: usedEncoding,
|
return NSString(contentsOfFile: path, usedEncoding: usedEncoding,
|
||||||
error: error)
|
error: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ extension String {
|
|||||||
public static func stringWithContentsOfURL(
|
public static func stringWithContentsOfURL(
|
||||||
url: NSURL, encoding enc: NSStringEncoding, error: NSErrorPointer = nil
|
url: NSURL, encoding enc: NSStringEncoding, error: NSErrorPointer = nil
|
||||||
) -> String? {
|
) -> String? {
|
||||||
return NSString.stringWithContentsOfURL(url, encoding: enc, error: error)
|
return NSString(contentsOfURL: url, encoding: enc, error: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// + (instancetype)
|
// + (instancetype)
|
||||||
@@ -246,7 +246,7 @@ extension String {
|
|||||||
usedEncoding enc: UnsafeMutablePointer<NSStringEncoding> = nil,
|
usedEncoding enc: UnsafeMutablePointer<NSStringEncoding> = nil,
|
||||||
error: NSErrorPointer = nil
|
error: NSErrorPointer = nil
|
||||||
) -> String? {
|
) -> String? {
|
||||||
return NSString.stringWithContentsOfURL(url, usedEncoding: enc,
|
return NSString(contentsOfURL: url, usedEncoding: enc,
|
||||||
error: error)
|
error: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ func extensionMethods(#b: B) {
|
|||||||
|
|
||||||
// CHECK: define void @_TF7objc_ir19initCallToAllocInitFT1iVSs5Int32_T_
|
// CHECK: define void @_TF7objc_ir19initCallToAllocInitFT1iVSs5Int32_T_
|
||||||
func initCallToAllocInit(#i: CInt) {
|
func initCallToAllocInit(#i: CInt) {
|
||||||
// CHECK: call [[B]]* @_TFCSo1BCfMS_FT3intVSs5Int32_S_
|
// CHECK: call {{.*}} @_TFCSo1BCfMS_FT3intVSs5Int32_GSQS__
|
||||||
|
|
||||||
B(int: i)
|
B(int: i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: linkonce_odr hidden [[B]]* @_TFCSo1BCfMS_FT3intVSs5Int32_S_
|
// CHECK: linkonce_odr hidden {{.*}} @_TFCSo1BCfMS_FT3intVSs5Int32_GSQS__
|
||||||
// CHECK: load i8** @"\01L_selector(allocWithZone:)"
|
// CHECK: load i8** @"\01L_selector(allocWithZone:)"
|
||||||
// CHECK: call [[OPAQUE:%.*]]* bitcast (void ()* @objc_msgSend
|
// CHECK: call [[OPAQUE:%.*]]* bitcast (void ()* @objc_msgSend
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ func pointerProperties(obj: PointerWrapper) {
|
|||||||
obj.idPtr = AutoreleasingUnsafeMutablePointer()
|
obj.idPtr = AutoreleasingUnsafeMutablePointer()
|
||||||
}
|
}
|
||||||
|
|
||||||
// CHECK: linkonce_odr hidden [[B]]* @_TTOFCSo1BcfMS_FT3intVSs5Int32_S_
|
// CHECK: linkonce_odr hidden {{.*}} @_TTOFCSo1BcfMS_FT3intVSs5Int32_GSQS__
|
||||||
// CHECK: load i8** @"\01L_selector(initWithInt:)"
|
// CHECK: load i8** @"\01L_selector(initWithInt:)"
|
||||||
// CHECK: call [[OPAQUE:%.*]]* bitcast (void ()* @objc_msgSend
|
// CHECK: call [[OPAQUE:%.*]]* bitcast (void ()* @objc_msgSend
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ sil private @_TToFC18class_isa_pointers7Mongrel6methodfS0_FT_T_ : $@thin @cc(obj
|
|||||||
entry(%0 : $Purebred):
|
entry(%0 : $Purebred):
|
||||||
unreachable
|
unreachable
|
||||||
}
|
}
|
||||||
sil private @_TToFC18class_isa_pointers7MongrelcfMS0_FT7bellsOnSi_S0_ : $@thin @cc(objc_method) (Int, Purebred) -> () {
|
sil private @_TToFC18class_isa_pointers7MongrelcfMS0_FT7bellsOnSi_GSQS0__ : $@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 1, i32 0, i32 16, i16 7, i16 0, i32 104, i32 16, { i64, i8*, i32, i32, i8*, %swift.type** (%swift.type*)*, i32, 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_ }
|
// 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 1, i32 0, i32 16, i16 7, i16 0, i32 104, i32 16, { i64, i8*, i32, i32, i8*, %swift.type** (%swift.type*)*, i32, i32, i32 }* @_TMnC19objc_attr_NSManaged10SwiftGizmo, i64 (i64, %C19objc_attr_NSManaged10SwiftGizmo*)* @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_GSQS0__, %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,9 +35,9 @@ bb0(%0 : $SwiftGizmo):
|
|||||||
return %0 : $SwiftGizmo
|
return %0 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|
||||||
sil @_TToFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_S0_ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
sil @_TToFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_GSQS0__ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo! {
|
||||||
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
||||||
return %1 : $SwiftGizmo
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
sil @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT_S0_ : $@cc(method) @thin (@owned SwiftGizmo) -> @owned SwiftGizmo {
|
sil @_TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT_S0_ : $@cc(method) @thin (@owned SwiftGizmo) -> @owned SwiftGizmo {
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ bb0(%0 : $SwiftGizmo):
|
|||||||
return %0 : $SwiftGizmo
|
return %0 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|
||||||
sil @_TToFC12objc_dealloc10SwiftGizmocfMS0_FT7bellsOnSi_S0_ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
sil @_TToFC12objc_dealloc10SwiftGizmocfMS0_FT7bellsOnSi_GSQS0__ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo! {
|
||||||
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
||||||
return %1 : $SwiftGizmo
|
unreachable
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// RUN: rm -rf %t
|
// RUN: rm -rf %t
|
||||||
// RUN: %swift -target x86_64-apple-macosx10.9 -module-cache-path %t/clang-module-cache %clang-importer-sdk %s -emit-ir | FileCheck %s
|
// RUN: %swift -target x86_64-apple-macosx10.9 -module-cache-path %t/clang-module-cache %clang-importer-sdk %s -emit-ir | FileCheck %s
|
||||||
|
|
||||||
// CHECK: [[HIVE:%CSo4Hive]] = type opaque
|
|
||||||
// CHECK: [[SWIFT_TYPE:%swift.type]] = type { i64 }
|
// CHECK: [[SWIFT_TYPE:%swift.type]] = type { i64 }
|
||||||
sil_stage canonical
|
sil_stage canonical
|
||||||
|
|
||||||
@@ -17,15 +16,15 @@ bb0:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CHECK-LABEL: define {{.*}} @_TFCSo4HiveCfMS_FT5queenGSQCSo1B__S_
|
// CHECK-LABEL: define {{.*}} @_TFCSo4HiveCfMS_FT5queenGSQCSo1B__S_
|
||||||
sil @_TFCSo4HiveCfMS_FT5queenGSQCSo1B__S_ : $@thin (@owned ImplicitlyUnwrappedOptional<B>, @thick Hive.Type) -> @owned Hive {
|
sil @_TFCSo4HiveCfMS_FT5queenGSQCSo1B__S_ : $@thin (@owned ImplicitlyUnwrappedOptional<B>, @thick Hive.Type) -> @owned ImplicitlyUnwrappedOptional<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 -> (queen: 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 ImplicitlyUnwrappedOptional<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 ImplicitlyUnwrappedOptional<Hive> // users: %5, %6
|
||||||
// CHECK: call {{.*}} @objc_retainAutoreleasedReturnValue
|
// CHECK: call {{.*}} @objc_autorelease
|
||||||
strong_retain_autoreleased %4 : $Hive // id: %5
|
autorelease_value %4 : $ImplicitlyUnwrappedOptional<Hive>
|
||||||
return %4 : $Hive // id: %6
|
return %4 : $ImplicitlyUnwrappedOptional<Hive>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ bb0(%0 : $Float, %1 : $Float, %2 : $Float, %3 : $SwiftGizmo):
|
|||||||
return %3 : $SwiftGizmo
|
return %3 : $SwiftGizmo
|
||||||
}
|
}
|
||||||
|
|
||||||
sil @_TToFC18objc_implicit_with10SwiftGizmocfMS0_FT7bellsOnSi_S0_ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo {
|
sil @_TToFC18objc_implicit_with10SwiftGizmocfMS0_FT7bellsOnSi_GSQS0__ : $@cc(objc_method) @thin (Int, @owned SwiftGizmo) -> @owned SwiftGizmo! {
|
||||||
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
bb0(%0 : $Int, %1 : $SwiftGizmo):
|
||||||
return %1 : $SwiftGizmo
|
unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
sil @_TToFC18objc_implicit_with10SwiftGizmocfMS0_FT_S0_ : $@cc(objc_method) @thin (@owned SwiftGizmo) -> @owned SwiftGizmo {
|
sil @_TToFC18objc_implicit_with10SwiftGizmocfMS0_FT_S0_ : $@cc(objc_method) @thin (@owned SwiftGizmo) -> @owned SwiftGizmo {
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
// CHECK: }, {
|
// CHECK: }, {
|
||||||
// CHECK: i8* getelementptr inbounds ([17 x i8]* @"\01L_selector_data(initWithBellsOn:)", i64 0, i64 0),
|
// CHECK: i8* getelementptr inbounds ([17 x i8]* @"\01L_selector_data(initWithBellsOn:)", i64 0, i64 0),
|
||||||
// CHECK: i8* getelementptr inbounds ([11 x i8]* {{@[0-9]+}}, i64 0, i64 0),
|
// CHECK: i8* getelementptr inbounds ([11 x i8]* {{@[0-9]+}}, i64 0, i64 0),
|
||||||
// CHECK: i8* bitcast ([[OPAQUE11:%.*]]* ([[OPAQUE12:%.*]]*, i8*, i64)* @_TToFC13objc_subclass10SwiftGizmocfMS0_FT7bellsOnSi_S0_ to i8*)
|
// CHECK: i8* bitcast ([[OPAQUE11:%.*]]* ([[OPAQUE12:%.*]]*, i8*, i64)* @_TToFC13objc_subclass10SwiftGizmocfMS0_FT7bellsOnSi_GSQS0__ to i8*)
|
||||||
// CHECK: }, {
|
// CHECK: }, {
|
||||||
// CHECK: i8* getelementptr inbounds ([15 x i8]* @"\01L_selector_data(.cxx_construct)", i64 0, i64 0),
|
// CHECK: i8* getelementptr inbounds ([15 x i8]* @"\01L_selector_data(.cxx_construct)", i64 0, i64 0),
|
||||||
// CHECK: i8* getelementptr inbounds ([3 x i8]* {{@[0-9]+}}, i64 0, i64 0),
|
// CHECK: i8* getelementptr inbounds ([3 x i8]* {{@[0-9]+}}, i64 0, i64 0),
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
// CHECK: }, {
|
// CHECK: }, {
|
||||||
// CHECK: i8* getelementptr inbounds ([17 x i8]* @"\01L_selector_data(initWithBellsOn:)", i64 0, i64 0),
|
// CHECK: i8* getelementptr inbounds ([17 x i8]* @"\01L_selector_data(initWithBellsOn:)", i64 0, i64 0),
|
||||||
// CHECK: i8* getelementptr inbounds ([11 x i8]* {{@[0-9]+}}, i64 0, i64 0),
|
// CHECK: i8* getelementptr inbounds ([11 x i8]* {{@[0-9]+}}, i64 0, i64 0),
|
||||||
// CHECK: i8* bitcast ([[OPAQUE21:%.*]]* ([[OPAQUE22:%.*]]*, i8*, i64)* @_TToFC13objc_subclass11SwiftGizmo2cfMS0_FT7bellsOnSi_S0_ to i8*)
|
// CHECK: i8* bitcast ([[OPAQUE21:%.*]]* ([[OPAQUE22:%.*]]*, i8*, i64)* @_TToFC13objc_subclass11SwiftGizmo2cfMS0_FT7bellsOnSi_GSQS0__ to i8*)
|
||||||
// CHECK: }, {
|
// CHECK: }, {
|
||||||
// CHECK: i8* getelementptr inbounds ([14 x i8]* @"\01L_selector_data(.cxx_destruct)", i64 0, i64 0),
|
// CHECK: i8* getelementptr inbounds ([14 x i8]* @"\01L_selector_data(.cxx_destruct)", i64 0, i64 0),
|
||||||
// CHECK: i8* getelementptr inbounds ([3 x i8]* {{@[0-9]+}}, i64 0, i64 0)
|
// CHECK: i8* getelementptr inbounds ([3 x i8]* {{@[0-9]+}}, i64 0, i64 0)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
// Test overlain variadic methods.
|
// Test overlain variadic methods.
|
||||||
let s = NSPredicate(format: "(lastName like[cd] %@) AND (birthday > %@)", "LLLL", "BBBB")
|
let s = NSPredicate(format: "(lastName like[cd] %@) AND (birthday > %@)", "LLLL", "BBBB")!
|
||||||
println(s.predicateFormat)
|
println(s.predicateFormat)
|
||||||
|
|
||||||
// CHECK: lastName LIKE[cd] "LLLL" AND birthday > "BBBB"
|
// CHECK: lastName LIKE[cd] "LLLL" AND birthday > "BBBB"
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ FoundationTestSuite.test("NSRange") {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
FoundationTestSuite.test("NSURL") {
|
FoundationTestSuite.test("NSURL") {
|
||||||
let nsURL = NSURL(string: "http://llvm.org")
|
let nsURL = NSURL(string: "http://llvm.org")!
|
||||||
expectEqual("http://llvm.org", nsURL.description)
|
expectEqual("http://llvm.org", nsURL.description)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,9 +76,9 @@ println("NSError out:")
|
|||||||
autoreleasepool {
|
autoreleasepool {
|
||||||
var err: NSError? = NSError()
|
var err: NSError? = NSError()
|
||||||
hangCanary(err!)
|
hangCanary(err!)
|
||||||
if let s = NSString.stringWithContentsOfFile("/hopefully/does/not/exist\u{1B}",
|
if let s = NSString(contentsOfFile: "/hopefully/does/not/exist\u{1B}",
|
||||||
encoding: NSUTF8StringEncoding,
|
encoding: NSUTF8StringEncoding,
|
||||||
error: &err) {
|
error: &err) {
|
||||||
_preconditionFailure("file should not actually exist")
|
_preconditionFailure("file should not actually exist")
|
||||||
} else if let err_ = err {
|
} else if let err_ = err {
|
||||||
// The original value should have died
|
// The original value should have died
|
||||||
@@ -96,10 +96,9 @@ class DumbString: NSString {
|
|||||||
override func characterAtIndex(x: Int) -> unichar { _preconditionFailure("nope") }
|
override func characterAtIndex(x: Int) -> unichar { _preconditionFailure("nope") }
|
||||||
override var length: Int { return 0 }
|
override var length: Int { return 0 }
|
||||||
|
|
||||||
override class func stringWithContentsOfFile(s: String,
|
convenience init?(contentsOfFile s: String, encoding: NSStringEncoding,
|
||||||
encoding: NSStringEncoding,
|
error: AutoreleasingUnsafeMutablePointer<NSError?>) {
|
||||||
error: AutoreleasingUnsafeMutablePointer<NSError?>)
|
self.init()
|
||||||
-> DumbString? {
|
|
||||||
error.memory = NSError(domain: "Malicious Mischief", code: 594, userInfo: nil)
|
error.memory = NSError(domain: "Malicious Mischief", code: 594, userInfo: nil)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -109,8 +108,7 @@ class DumbString: NSString {
|
|||||||
println("NSError in:")
|
println("NSError in:")
|
||||||
autoreleasepool {
|
autoreleasepool {
|
||||||
var err: NSError? = nil
|
var err: NSError? = nil
|
||||||
DumbString.stringWithContentsOfFile("foo", encoding: NSUTF8StringEncoding,
|
DumbString(contentsOfFile: "foo", encoding: NSUTF8StringEncoding, error: &err)
|
||||||
error: &err)
|
|
||||||
let err_ = err!
|
let err_ = err!
|
||||||
println(err_.domain) // CHECK-NEXT: Malicious Mischief
|
println(err_.domain) // CHECK-NEXT: Malicious Mischief
|
||||||
println(err_.code) // CHECK-NEXT: 594
|
println(err_.code) // CHECK-NEXT: 594
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ extension NSObject: Hashish {}
|
|||||||
|
|
||||||
func getHash<T: Hashish>(x: T) -> Int { return x.hash }
|
func getHash<T: Hashish>(x: T) -> Int { return x.hash }
|
||||||
|
|
||||||
let u = NSURL(string: "http://www.example.com")
|
let u = NSURL(string: "http://www.example.com")!
|
||||||
|
|
||||||
// CHECK: true
|
// CHECK: true
|
||||||
println(u.hash == getHash(u))
|
println(u.hash == getHash(u))
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ import gizmo
|
|||||||
class DesignatedStubs : Gizmo {
|
class DesignatedStubs : Gizmo {
|
||||||
override init() { super.init() }
|
override init() { super.init() }
|
||||||
}
|
}
|
||||||
// CHECK-DEBUG: sil @_TFC25unimplemented_initializer15DesignatedStubscfMS0_FT7bellsOnSi_S0_
|
// CHECK-DEBUG: sil @_TFC25unimplemented_initializer15DesignatedStubscfMS0_FT7bellsOnSi_GSQS0__
|
||||||
// CHECK-DEBUG: string_literal utf8 "{{.*}}unimplemented_initializer.swift"
|
// CHECK-DEBUG: string_literal utf8 "{{.*}}unimplemented_initializer.swift"
|
||||||
// CHECK-DEBUG: function_ref @_TFVSs12StaticString14withUTF8BufferfS_U__FFGVSs19UnsafeBufferPointerVSs5UInt8_Q_Q_
|
// CHECK-DEBUG: function_ref @_TFVSs12StaticString14withUTF8BufferfS_U__FFGVSs19UnsafeBufferPointerVSs5UInt8_Q_Q_
|
||||||
|
|
||||||
// CHECK-RELEASE: sil @_TFC25unimplemented_initializer15DesignatedStubscfMS0_FT7bellsOnSi_S0_
|
// CHECK-RELEASE: sil @_TFC25unimplemented_initializer15DesignatedStubscfMS0_FT7bellsOnSi_GSQS0__
|
||||||
// CHECK-RELEASE-NOT: unimplemented_initializer.swift"
|
// CHECK-RELEASE-NOT: unimplemented_initializer.swift"
|
||||||
// CHECK-RELEASE: function_ref @_TFVSs12StaticString14withUTF8BufferfS_U__FFGVSs19UnsafeBufferPointerVSs5UInt8_Q_Q_
|
// CHECK-RELEASE: function_ref @_TFVSs12StaticString14withUTF8BufferfS_U__FFGVSs19UnsafeBufferPointerVSs5UInt8_Q_Q_
|
||||||
// CHECK-RELEASE-NOT: unimplemented_initializer.swift"
|
// CHECK-RELEASE-NOT: unimplemented_initializer.swift"
|
||||||
|
|||||||
@@ -289,7 +289,7 @@ func managedDispatch(c: Foo) {
|
|||||||
|
|
||||||
// CHECK-LABEL: sil @_TF7dynamic21foreignMethodDispatchFT_T_
|
// CHECK-LABEL: sil @_TF7dynamic21foreignMethodDispatchFT_T_
|
||||||
func foreignMethodDispatch() {
|
func foreignMethodDispatch() {
|
||||||
// CHECK: function_ref @_TFCSo9GuisemeauCfMS_FT_S_
|
// CHECK: function_ref @_TFCSo9GuisemeauCfMS_FT_GSQS__
|
||||||
let g = Guisemeau()
|
let g = Guisemeau()
|
||||||
// CHECK: class_method [volatile] {{%.*}} : $Gizmo, #Gizmo.frob!1.foreign
|
// CHECK: class_method [volatile] {{%.*}} : $Gizmo, #Gizmo.frob!1.foreign
|
||||||
g.frob()
|
g.frob()
|
||||||
|
|||||||
@@ -12,13 +12,12 @@ hasNoPrototype()
|
|||||||
// CHECK-LABEL: sil private @top_level_code
|
// CHECK-LABEL: sil private @top_level_code
|
||||||
// -- Foreign function is referenced with C calling conv and ownership semantics
|
// -- Foreign function is referenced with C calling conv and ownership semantics
|
||||||
// CHECK: [[NSANSE:%.*]] = function_ref @NSAnse : $@cc(cdecl) @thin (ImplicitlyUnwrappedOptional<Ansible>) -> @autoreleased ImplicitlyUnwrappedOptional<Ansible>
|
// CHECK: [[NSANSE:%.*]] = function_ref @NSAnse : $@cc(cdecl) @thin (ImplicitlyUnwrappedOptional<Ansible>) -> @autoreleased ImplicitlyUnwrappedOptional<Ansible>
|
||||||
// CHECK: [[ANSIBLE_CTOR:%.*]] = function_ref @_TFCSo7AnsibleCfMS_FT7bellsOnGSQPSs9AnyObject___S_ : $@thin (@owned ImplicitlyUnwrappedOptional<AnyObject>, @thick Ansible.Type) -> @owned Ansible
|
// CHECK: [[ANSIBLE_CTOR:%.*]] = function_ref @_TFCSo7AnsibleCfMS_FT7bellsOnGSQPSs9AnyObject___GSQS__
|
||||||
// CHECK: [[NSOBJECT_CTOR:%.*]] = function_ref @_TFCSo8NSObjectCfMS_FT_S_ : $@thin (@thick NSObject.Type) -> @owned NSObject
|
// CHECK: [[NSOBJECT_CTOR:%.*]] = function_ref @_TFCSo8NSObjectCfMS_FT_S_ : $@thin (@thick NSObject.Type) -> @owned NSObject
|
||||||
// CHECK: [[ANSIBLE:%.*]] = apply [[ANSIBLE_CTOR]]
|
// CHECK: [[ANSIBLE:%.*]] = apply [[ANSIBLE_CTOR]]
|
||||||
// CHECK: [[OANSIBLE:%.*]] = unchecked_ref_bit_cast [[ANSIBLE]]
|
// CHECK: [[NSANSE_RESULT:%.*]] = apply [[NSANSE]]([[ANSIBLE]])
|
||||||
// CHECK: [[NSANSE_RESULT:%.*]] = apply [[NSANSE]]([[OANSIBLE]])
|
|
||||||
// CHECK: retain_autoreleased [[NSANSE_RESULT]]
|
// CHECK: retain_autoreleased [[NSANSE_RESULT]]
|
||||||
// CHECK: strong_release [[ANSIBLE]]
|
// CHECK: release_value [[ANSIBLE]] : $ImplicitlyUnwrappedOptional<Ansible>
|
||||||
// -- Referencing unapplied C function goes through a thunk
|
// -- Referencing unapplied C function goes through a thunk
|
||||||
// CHECK: [[NSANSE:%.*]] = function_ref @_TTOFSC6NSAnseFGSQCSo7Ansible_GSQS__ : $@thin (@owned ImplicitlyUnwrappedOptional<Ansible>) -> @owned ImplicitlyUnwrappedOptional<Ansible>
|
// CHECK: [[NSANSE:%.*]] = function_ref @_TTOFSC6NSAnseFGSQCSo7Ansible_GSQS__ : $@thin (@owned ImplicitlyUnwrappedOptional<Ansible>) -> @owned ImplicitlyUnwrappedOptional<Ansible>
|
||||||
// -- Referencing unprototyped C function passes no parameters
|
// -- Referencing unprototyped C function passes no parameters
|
||||||
@@ -26,7 +25,7 @@ hasNoPrototype()
|
|||||||
// CHECK: apply [[NOPROTO]]()
|
// CHECK: apply [[NOPROTO]]()
|
||||||
|
|
||||||
// -- Constructors for imported Ansible
|
// -- Constructors for imported Ansible
|
||||||
// CHECK-LABEL: sil shared @_TFCSo7AnsibleCfMS_FT7bellsOnGSQPSs9AnyObject___S_ : $@thin (@owned ImplicitlyUnwrappedOptional<AnyObject>, @thick Ansible.Type) -> @owned Ansible
|
// CHECK-LABEL: sil shared @_TFCSo7AnsibleCfMS_FT7bellsOnGSQPSs9AnyObject___GSQS__ : $@thin (@owned ImplicitlyUnwrappedOptional<AnyObject>, @thick Ansible.Type) -> @owned ImplicitlyUnwrappedOptional<Ansible>
|
||||||
|
|
||||||
|
|
||||||
// -- Constructors for imported NSObject
|
// -- Constructors for imported NSObject
|
||||||
|
|||||||
@@ -33,6 +33,6 @@ class SwiftGizmo : Gizmo {
|
|||||||
// The vtable should not contain any entry points for getters and setters.
|
// The vtable should not contain any entry points for getters and setters.
|
||||||
// CHECK-LABEL: sil_vtable SwiftGizmo {
|
// CHECK-LABEL: sil_vtable SwiftGizmo {
|
||||||
// CHECK-NEXT: #SwiftGizmo.modifyX!1: _TFC19objc_attr_NSManaged10SwiftGizmo7modifyXfS0_FT_T_ // objc_attr_NSManaged.SwiftGizmo.modifyX (objc_attr_NSManaged.SwiftGizmo)() -> ()
|
// CHECK-NEXT: #SwiftGizmo.modifyX!1: _TFC19objc_attr_NSManaged10SwiftGizmo7modifyXfS0_FT_T_ // objc_attr_NSManaged.SwiftGizmo.modifyX (objc_attr_NSManaged.SwiftGizmo)() -> ()
|
||||||
// CHECK-NEXT: #SwiftGizmo.init!initializer.1: _TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT_S0_ // objc_attr_NSManaged.SwiftGizmo.init (objc_attr_NSManaged.SwiftGizmo.Type)() -> objc_attr_NSManaged.SwiftGizmo
|
// CHECK-NEXT: #SwiftGizmo.init!initializer.1: _TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT_GSQS0__
|
||||||
// CHECK-NEXT: #SwiftGizmo.init!initializer.1: _TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_S0_ // objc_attr_NSManaged.SwiftGizmo.init (objc_attr_NSManaged.SwiftGizmo.Type)(bellsOn : Swift.Int) -> objc_attr_NSManaged.SwiftGizmo
|
// CHECK-NEXT: #SwiftGizmo.init!initializer.1: _TFC19objc_attr_NSManaged10SwiftGizmocfMS0_FT7bellsOnSi_GSQS0__
|
||||||
// CHECK-NEXT: }
|
// CHECK-NEXT: }
|
||||||
|
|||||||
@@ -11,12 +11,11 @@ extension Gizmo {
|
|||||||
// CHECK: [[SELF:%[0-9]+]] = mark_uninitialized [delegatingself] [[ORIG_SELF]] : $Gizmo
|
// CHECK: [[SELF:%[0-9]+]] = mark_uninitialized [delegatingself] [[ORIG_SELF]] : $Gizmo
|
||||||
// CHECK: store [[SELF]] to [[SELF_BOX]]#1 : $*Gizmo
|
// CHECK: store [[SELF]] to [[SELF_BOX]]#1 : $*Gizmo
|
||||||
// CHECK: [[SELF:%[0-9]+]] = load [[SELF_BOX]]#1 : $*Gizmo
|
// CHECK: [[SELF:%[0-9]+]] = load [[SELF_BOX]]#1 : $*Gizmo
|
||||||
// CHECK: [[INIT_DELEG:%[0-9]+]] = class_method [volatile] [[SELF]] : $Gizmo, #Gizmo.init!initializer.1.foreign : Gizmo.Type -> (bellsOn: Int) -> Gizmo , $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned Gizmo
|
// CHECK: [[INIT_DELEG:%[0-9]+]] = class_method [volatile] [[SELF]] : $Gizmo, #Gizmo.init!initializer.1.foreign : Gizmo.Type -> (bellsOn: Int) -> Gizmo! , $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK: [[SELF_RET:%[0-9]+]] = apply [[INIT_DELEG]]([[I]], [[SELF]]) : $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned Gizmo
|
// CHECK: [[SELF_RET:%[0-9]+]] = apply [[INIT_DELEG]]([[I]], [[SELF]]) : $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK: store [[SELF_RET]] to [[SELF_BOX]]#1 : $*Gizmo
|
// CHECK: store [[SELF_RET]] to [[SELF_BOX:%[0-9]+]]#1 : $*ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK: [[SELF4:%[0-9]+]] = load [[SELF_BOX]]#1 : $*Gizmo
|
// CHECK: strong_retain [[SELF4:%[0-9]+]] : $Gizmo
|
||||||
// CHECK: strong_retain [[SELF4]] : $Gizmo
|
// CHECK: strong_release [[SELF_BOX:%[0-9]+]]#0 : $Builtin.NativeObject
|
||||||
// CHECK: strong_release [[SELF_BOX]]#0 : $Builtin.NativeObject
|
|
||||||
// CHECK: return [[SELF4]] : $Gizmo
|
// CHECK: return [[SELF4]] : $Gizmo
|
||||||
self.init(bellsOn:i)
|
self.init(bellsOn:i)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,22 +7,22 @@ import gizmo
|
|||||||
func test3() -> NSObject {
|
func test3() -> NSObject {
|
||||||
// initializer returns at +1
|
// initializer returns at +1
|
||||||
return Gizmo()
|
return Gizmo()
|
||||||
// CHECK: [[CTOR:%[0-9]+]] = function_ref @_TFCSo5GizmoCfMS_FT_S_ : $@thin (@thick Gizmo.Type) -> @owned Gizmo
|
// CHECK: [[CTOR:%[0-9]+]] = function_ref @_TFCSo5GizmoCfMS_FT_GSQS__ : $@thin (@thick Gizmo.Type) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK-NEXT: [[GIZMO_META:%[0-9]+]] = metatype $@thick Gizmo.Type
|
// CHECK-NEXT: [[GIZMO_META:%[0-9]+]] = metatype $@thick Gizmo.Type
|
||||||
// CHECK-NEXT: [[GIZMO:%[0-9]+]] = apply [[CTOR]]([[GIZMO_META]]) : $@thin (@thick Gizmo.Type) -> @owned Gizmo
|
// CHECK-NEXT: [[GIZMO:%[0-9]+]] = apply [[CTOR]]([[GIZMO_META]]) : $@thin (@thick Gizmo.Type) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK-NEXT: [[GIZMO_NS:%[0-9]+]] = upcast [[GIZMO]] : $Gizmo to $NSObject
|
// CHECK: [[GIZMO_NS:%[0-9]+]] = upcast [[GIZMO:%[0-9]+]] : $Gizmo to $NSObject
|
||||||
// CHECK-NEXT: return [[GIZMO_NS]] : $NSObject
|
// CHECK: return [[GIZMO_NS]] : $NSObject
|
||||||
|
|
||||||
// CHECK-LABEL: sil shared @_TFCSo5GizmoCfMS_FT_S_ : $@thin (@thick Gizmo.Type) -> @owned Gizmo
|
// CHECK-LABEL: sil shared @_TFCSo5GizmoCfMS_FT_GSQS__ : $@thin (@thick Gizmo.Type) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// alloc is implicitly ns_returns_retained
|
// alloc is implicitly ns_returns_retained
|
||||||
// init is implicitly ns_consumes_self and ns_returns_retained
|
// init is implicitly ns_consumes_self and ns_returns_retained
|
||||||
// CHECK-NEXT: bb0([[GIZMO_META:%[0-9]+]] : $@thick Gizmo.Type):
|
// CHECK-NEXT: bb0([[GIZMO_META:%[0-9]+]] : $@thick Gizmo.Type):
|
||||||
// CHECK-NEXT: [[GIZMO_META_OBJC:%[0-9]+]] = thick_to_objc_metatype [[GIZMO_META]] : $@thick Gizmo.Type to $@objc_metatype Gizmo.Type
|
// CHECK-NEXT: [[GIZMO_META_OBJC:%[0-9]+]] = thick_to_objc_metatype [[GIZMO_META]] : $@thick Gizmo.Type to $@objc_metatype Gizmo.Type
|
||||||
// CHECK-NEXT: [[GIZMO:%[0-9]+]] = alloc_ref_dynamic [objc] [[GIZMO_META_OBJC]] : $@objc_metatype Gizmo.Type, $Gizmo
|
// CHECK-NEXT: [[GIZMO:%[0-9]+]] = alloc_ref_dynamic [objc] [[GIZMO_META_OBJC]] : $@objc_metatype Gizmo.Type, $Gizmo
|
||||||
// CHECK-NEXT: // function_ref
|
// CHECK-NEXT: // function_ref
|
||||||
// CHECK-NEXT: [[INIT_CTOR:%[0-9]+]] = function_ref @_TTOFCSo5GizmocfMS_FT_S_
|
// CHECK-NEXT: [[INIT_CTOR:%[0-9]+]] = function_ref @_TTOFCSo5GizmocfMS_FT_GSQS__
|
||||||
// CHECK-NEXT: [[RESULT:%[0-9]+]] = apply [[INIT_CTOR]]([[GIZMO]]) : $@cc(method) @thin (@owned Gizmo) -> @owned Gizmo
|
// CHECK-NEXT: [[RESULT:%[0-9]+]] = apply [[INIT_CTOR]]([[GIZMO]]) : $@cc(method) @thin (@owned Gizmo) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK-NEXT: return [[RESULT]] : $Gizmo
|
// CHECK-NEXT: return [[RESULT]] : $ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -188,15 +188,15 @@ class Hoozit : Gizmo {
|
|||||||
// CHECK-LABEL: sil @_TFC11objc_thunks6HoozitcfMS0_FT7bellsOnSi_S0_ : $@cc(method) @thin (Int, @owned Hoozit) -> @owned Hoozit {
|
// CHECK-LABEL: sil @_TFC11objc_thunks6HoozitcfMS0_FT7bellsOnSi_S0_ : $@cc(method) @thin (Int, @owned Hoozit) -> @owned Hoozit {
|
||||||
// CHECK: [[SELF_BOX:%[0-9]+]] = alloc_box $Hoozit
|
// CHECK: [[SELF_BOX:%[0-9]+]] = alloc_box $Hoozit
|
||||||
// CHECK: [[GIZMO:%[0-9]+]] = upcast [[SELF:%[0-9]+]] : $Hoozit to $Gizmo
|
// CHECK: [[GIZMO:%[0-9]+]] = upcast [[SELF:%[0-9]+]] : $Hoozit to $Gizmo
|
||||||
// CHECK-NEXT: [[SUPERMETHOD:%[0-9]+]] = super_method [volatile] [[SELF]] : $Hoozit, #Gizmo.init!initializer.1.foreign : Gizmo.Type -> (bellsOn: Int) -> Gizmo , $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned Gizmo
|
// CHECK-NEXT: [[SUPERMETHOD:%[0-9]+]] = super_method [volatile] [[SELF]] : $Hoozit, #Gizmo.init!initializer.1.foreign : Gizmo.Type -> (bellsOn: Int) -> Gizmo! , $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK-NEXT: [[SELF_REPLACED:%[0-9]+]] = apply [[SUPERMETHOD]](%0, [[X:%[0-9]+]]) : $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned Gizmo
|
// CHECK-NEXT: [[SELF_REPLACED:%[0-9]+]] = apply [[SUPERMETHOD]](%0, [[X:%[0-9]+]]) : $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK-NOT: unconditional_checked_cast downcast [[SELF_REPLACED]] : $Gizmo to $Hoozit
|
// CHECK-NOT: unconditional_checked_cast downcast [[SELF_REPLACED]] : $Gizmo to $Hoozit
|
||||||
// CHECK: unchecked_ref_cast
|
// CHECK: unchecked_ref_cast
|
||||||
// CHECK-NEXT: store [[SELF:%[0-9]+]] to [[SELF_BOX]]#1 : $*Hoozit
|
// CHECK-NEXT: store [[SELF:%[0-9]+]] to [[SELF_BOX]]#1 : $*Hoozit
|
||||||
// CHECK-NEXT: [[NONNULL:%[0-9]+]] = is_nonnull [[SELF]] : $Hoozit
|
// CHECK-NEXT: [[NONNULL:%[0-9]+]] = is_nonnull [[SELF]] : $Hoozit
|
||||||
// CHECK-NEXT: cond_br [[NONNULL]], [[NONNULL_BB:bb[0-9]+]], [[NULL_BB:bb[0-9]+]]
|
// CHECK-NEXT: cond_br [[NONNULL]], [[NONNULL_BB:bb[0-9]+]], [[NULL_BB:bb[0-9]+]]
|
||||||
// CHECK: [[NULL_BB]]:
|
// CHECK: [[NULL_BB]]:
|
||||||
// CHECK-NEXT: br [[EPILOG_BB:bb[0-9]+]]
|
// CHECK: br [[EPILOG_BB:bb[0-9]+]]
|
||||||
|
|
||||||
// CHECK: [[NONNULL_BB]]:
|
// CHECK: [[NONNULL_BB]]:
|
||||||
// CHECK: [[OTHER_REF:%[0-9]+]] = function_ref @_TF11objc_thunks5otherFT_T_ : $@thin () -> ()
|
// CHECK: [[OTHER_REF:%[0-9]+]] = function_ref @_TF11objc_thunks5otherFT_T_ : $@thin () -> ()
|
||||||
@@ -341,7 +341,7 @@ class DesignatedStubs : Gizmo {
|
|||||||
|
|
||||||
override init() { i = 5 }
|
override init() { i = 5 }
|
||||||
|
|
||||||
// CHECK-LABEL: sil @_TFC11objc_thunks15DesignatedStubscfMS0_FT7bellsOnSi_S0_ : $@cc(method) @thin (Int, @owned DesignatedStubs) -> @owned DesignatedStubs
|
// CHECK-LABEL: sil @_TFC11objc_thunks15DesignatedStubscfMS0_FT7bellsOnSi_GSQS0__
|
||||||
// CHECK: function_ref @_TFSs26_unimplemented_initializer
|
// CHECK: function_ref @_TFSs26_unimplemented_initializer
|
||||||
// CHECK: string_literal utf8 "objc_thunks.DesignatedStubs"
|
// CHECK: string_literal utf8 "objc_thunks.DesignatedStubs"
|
||||||
// CHECK: string_literal utf8 "init(bellsOn:)"
|
// CHECK: string_literal utf8 "init(bellsOn:)"
|
||||||
@@ -354,14 +354,14 @@ class DesignatedStubs : Gizmo {
|
|||||||
class DesignatedOverrides : Gizmo {
|
class DesignatedOverrides : Gizmo {
|
||||||
var i: Int = 5
|
var i: Int = 5
|
||||||
|
|
||||||
// CHECK-LABEL: sil @_TFC11objc_thunks19DesignatedOverridescfMS0_FT_S0_ : $@cc(method) @thin (@owned DesignatedOverrides) -> @owned DesignatedOverrides
|
// CHECK-LABEL: sil @_TFC11objc_thunks19DesignatedOverridescfMS0_FT_GSQS0__
|
||||||
// CHECK-NOT: return
|
// CHECK-NOT: return
|
||||||
// CHECK: function_ref @_TFSi33_convertFromBuiltinIntegerLiteralf
|
// CHECK: function_ref @_TFSi33_convertFromBuiltinIntegerLiteralf
|
||||||
// CHECK: super_method [volatile] [[SELF:%[0-9]+]] : $DesignatedOverrides, #Gizmo.init!initializer.1.foreign : Gizmo.Type -> () -> Gizmo , $@cc(objc_method) @thin (@owned Gizmo) -> @owned Gizmo
|
// CHECK: super_method [volatile] [[SELF:%[0-9]+]] : $DesignatedOverrides, #Gizmo.init!initializer.1.foreign : Gizmo.Type -> () -> Gizmo! , $@cc(objc_method) @thin (@owned Gizmo) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK: return
|
// CHECK: return
|
||||||
|
|
||||||
// CHECK-LABEL: sil @_TFC11objc_thunks19DesignatedOverridescfMS0_FT7bellsOnSi_S0_ : $@cc(method) @thin (Int, @owned DesignatedOverrides) -> @owned DesignatedOverrides
|
// CHECK-LABEL: sil @_TFC11objc_thunks19DesignatedOverridescfMS0_FT7bellsOnSi_GSQS0__
|
||||||
// CHECK: function_ref @_TFSi33_convertFromBuiltinIntegerLiteralfMSiFBi2048_Si
|
// CHECK: function_ref @_TFSi33_convertFromBuiltinIntegerLiteralfMSiFBi2048_Si
|
||||||
// CHECK: super_method [volatile] [[SELF:%[0-9]+]] : $DesignatedOverrides, #Gizmo.init!initializer.1.foreign : Gizmo.Type -> (bellsOn: Int) -> Gizmo , $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned Gizmo
|
// CHECK: super_method [volatile] [[SELF:%[0-9]+]] : $DesignatedOverrides, #Gizmo.init!initializer.1.foreign : Gizmo.Type -> (bellsOn: Int) -> Gizmo! , $@cc(objc_method) @thin (Int, @owned Gizmo) -> @owned ImplicitlyUnwrappedOptional<Gizmo>
|
||||||
// CHECK: return
|
// CHECK: return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,8 +135,8 @@ NSStringAPIs.test("stringWithContentsOfFile(_:usedEncoding:error:)") {
|
|||||||
|
|
||||||
NSStringAPIs.test("stringWithContentsOfURL(_:encoding:error:)") {
|
NSStringAPIs.test("stringWithContentsOfURL(_:encoding:error:)") {
|
||||||
let (existingPath, nonExistentPath) = createNSStringTemporaryFile()
|
let (existingPath, nonExistentPath) = createNSStringTemporaryFile()
|
||||||
let existingURL = NSURL(string: "file://" + existingPath)
|
let existingURL = NSURL(string: "file://" + existingPath)!
|
||||||
let nonExistentURL = NSURL(string: "file://" + nonExistentPath)
|
let nonExistentURL = NSURL(string: "file://" + nonExistentPath)!
|
||||||
if true {
|
if true {
|
||||||
var err: NSError?
|
var err: NSError?
|
||||||
var content = String.stringWithContentsOfURL(existingURL,
|
var content = String.stringWithContentsOfURL(existingURL,
|
||||||
@@ -159,8 +159,8 @@ NSStringAPIs.test("stringWithContentsOfURL(_:encoding:error:)") {
|
|||||||
|
|
||||||
NSStringAPIs.test("stringWithContentsOfURL(_:usedEncoding:error:)") {
|
NSStringAPIs.test("stringWithContentsOfURL(_:usedEncoding:error:)") {
|
||||||
let (existingPath, nonExistentPath) = createNSStringTemporaryFile()
|
let (existingPath, nonExistentPath) = createNSStringTemporaryFile()
|
||||||
let existingURL = NSURL(string: "file://" + existingPath)
|
let existingURL = NSURL(string: "file://" + existingPath)!
|
||||||
let nonExistentURL = NSURL(string: "file://" + nonExistentPath)
|
let nonExistentURL = NSURL(string: "file://" + nonExistentPath)!
|
||||||
if true {
|
if true {
|
||||||
var usedEncoding: NSStringEncoding = 0
|
var usedEncoding: NSStringEncoding = 0
|
||||||
var err: NSError?
|
var err: NSError?
|
||||||
@@ -1539,7 +1539,7 @@ NSStringAPIs.test("writeToFile(_:atomically:encoding:error:)") {
|
|||||||
|
|
||||||
NSStringAPIs.test("writeToURL(_:atomically:encoding:error:)") {
|
NSStringAPIs.test("writeToURL(_:atomically:encoding:error:)") {
|
||||||
let (_, nonExistentPath) = createNSStringTemporaryFile()
|
let (_, nonExistentPath) = createNSStringTemporaryFile()
|
||||||
let nonExistentURL = NSURL(string: "file://" + nonExistentPath)
|
let nonExistentURL = NSURL(string: "file://" + nonExistentPath)!
|
||||||
if true {
|
if true {
|
||||||
let s = "Lorem ipsum dolor sit amet, consectetur adipisicing elit"
|
let s = "Lorem ipsum dolor sit amet, consectetur adipisicing elit"
|
||||||
var err: NSError?
|
var err: NSError?
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ if unsafeNil == (nil as UnsafeMutablePointer<Int>) {
|
|||||||
// CHECK: ok unsafeNil == (nil as UnsafeMutablePointer<Int>)
|
// CHECK: ok unsafeNil == (nil as UnsafeMutablePointer<Int>)
|
||||||
}
|
}
|
||||||
|
|
||||||
let removed = NSFileManager.defaultManager().removeItemAtURL(NSURL(string:"/this/file/does/not/exist"), error:nil)
|
let removed = NSFileManager.defaultManager().removeItemAtURL(NSURL(string:"/this/file/does/not/exist")!, error:nil)
|
||||||
if !removed {
|
if !removed {
|
||||||
println("ok !removed")
|
println("ok !removed")
|
||||||
// CHECK: ok !removed
|
// CHECK: ok !removed
|
||||||
|
|||||||
Reference in New Issue
Block a user