mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL already does this where necessary, except with foreign throwing functions; this patch changes Sema and the ClangImporter to give them an ObjCBool foreign error result type explicitly. This fixes a problem where calls to functions taking and returning the C99 _Bool type were miscompiled on Mac OS X x86-64, because IRGen was conflating the Objective-C BOOL type (which is a signed char on some platforms) and C99 _Bool (which lowers as the LLVM i1 type). Fixes <rdar://problem/26506458> and <rdar://problem/27365520>.
109 lines
2.4 KiB
Objective-C
109 lines
2.4 KiB
Objective-C
#ifndef SWIFT_TEST_OBJC_CLASSES_H
|
|
#define SWIFT_TEST_OBJC_CLASSES_H
|
|
|
|
#import <Foundation/NSArray.h>
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
/* This class has instance variables which are not apparent in the
|
|
interface. Subclasses will need to be slid by the ObjC runtime. */
|
|
@interface HasHiddenIvars : NSObject
|
|
@property NSInteger x;
|
|
@property NSInteger y;
|
|
@property NSInteger z;
|
|
@property NSInteger t;
|
|
@end
|
|
|
|
@interface TestingNSError : NSObject
|
|
+ (BOOL)throwNilError:(NSError**)error;
|
|
+ (nullable void *)maybeThrow:(BOOL)shouldThrow error:(NSError **)error;
|
|
+ (nullable void (^)(void))blockThrowError:(NSError **)error;
|
|
@end
|
|
|
|
@interface Container<C> : NSObject
|
|
- (id)initWithObject:(C)object NS_DESIGNATED_INITIALIZER;
|
|
- (id)init NS_UNAVAILABLE;
|
|
|
|
@property C object;
|
|
|
|
- (void)processObjectWithBlock:(void (^)(C))block;
|
|
- (void)updateObjectWithBlock:(C (^)())block;
|
|
@end
|
|
|
|
@interface Container<D> (Cat1)
|
|
- (id)initWithCat1:(D)object;
|
|
- (D)getCat1;
|
|
- (void)setCat1:(D)object;
|
|
@property D cat1Property;
|
|
@end
|
|
|
|
@interface SubContainer<E> : Container<E>
|
|
@end
|
|
|
|
@interface NestedContainer<F> : Container<Container<F> *>
|
|
@end
|
|
|
|
@interface StringContainer : Container<NSString *>
|
|
@end
|
|
|
|
@interface CopyingContainer<C: id<NSCopying>> : Container<C>
|
|
@end
|
|
|
|
@interface Animal : NSObject
|
|
@property (readonly) NSString *noise;
|
|
@end
|
|
|
|
@interface Dog : Animal
|
|
@end
|
|
|
|
@interface AnimalContainer<C: Animal *> : Container<C>
|
|
@end
|
|
|
|
#if __has_feature(objc_class_property)
|
|
@protocol ProtoWithClassProperty
|
|
+ (void)reset;
|
|
@property (class) int value;
|
|
|
|
@optional
|
|
@property (class, readonly) BOOL optionalClassProp;
|
|
@end
|
|
|
|
@interface ClassWithClassProperty : NSObject <ProtoWithClassProperty>
|
|
@end
|
|
|
|
@interface ObjCSubclassWithClassProperty : ClassWithClassProperty
|
|
// Deliberately redeclared.
|
|
@property (class) int value;
|
|
@end
|
|
|
|
@protocol PropertyNamingConflictProto
|
|
@property (nullable) id protoProp;
|
|
@property (class, nullable) id protoProp;
|
|
@end
|
|
|
|
@interface PropertyNamingConflict : NSObject
|
|
@property (readonly, nullable) id prop;
|
|
@property (class, readonly, nullable) id prop;
|
|
@end
|
|
|
|
#endif // __has_feature(objc_class_property)
|
|
|
|
@interface BridgedInitializer<T> : NSObject
|
|
@property (readwrite) NSArray<T> *objects;
|
|
@property (readonly) NSInteger count;
|
|
- (id) initWithArray: (NSArray<T>*) array;
|
|
@end
|
|
|
|
@interface NSLifetimeTracked : NSObject
|
|
+ (unsigned) count;
|
|
@end
|
|
|
|
@interface TestingBool : NSObject
|
|
- (void) shouldBeTrueObjCBool: (BOOL)value;
|
|
- (void) shouldBeTrueCBool: (_Bool)value;
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|
|
|
|
#endif
|