mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Move Clang importer test SDK to a toplevel dir test/Inputs where it can be
shared between Clang importer and IDE tests Swift SVN r11292
This commit is contained in:
119
test/Inputs/clang-importer-sdk/usr/include/Foundation.h
Normal file
119
test/Inputs/clang-importer-sdk/usr/include/Foundation.h
Normal file
@@ -0,0 +1,119 @@
|
||||
@import ObjectiveC;
|
||||
|
||||
typedef struct objc_object { void *isa; } *id;
|
||||
|
||||
typedef unsigned long NSUInteger;
|
||||
|
||||
typedef signed char BOOL;
|
||||
|
||||
@class NSString;
|
||||
|
||||
@interface NSArray : NSObject
|
||||
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
|
||||
- description;
|
||||
|
||||
@property NSString *nsstringProperty;
|
||||
@property BOOL boolProperty;
|
||||
|
||||
@end
|
||||
|
||||
@protocol NSCoding
|
||||
@end
|
||||
|
||||
@protocol NSSecureCoding <NSCoding>
|
||||
@end
|
||||
|
||||
@interface NSString : NSObject <NSSecureCoding>
|
||||
- (void)onlyOnNSString;
|
||||
@end
|
||||
|
||||
NSString *NSStringToNSString(NSString *str);
|
||||
|
||||
@interface Hive
|
||||
@property __attribute__((iboutletcollection(B))) NSArray *bees;
|
||||
@end
|
||||
|
||||
BOOL BOOLtoBOOL(BOOL b);
|
||||
|
||||
typedef struct _NSZone NSZone;
|
||||
|
||||
void *allocate(NSZone *zone);
|
||||
|
||||
|
||||
@interface BadCollection
|
||||
- (id)objectForKeyedSubscript:(id)key;
|
||||
- (void)setObject:(id)object forKeyedSubscript:(NSString *)key;
|
||||
@end
|
||||
|
||||
@interface BadCollectionParent
|
||||
- (id)objectForKeyedSubscript:(NSString *)key;
|
||||
@end
|
||||
|
||||
@interface BadCollectionChild : BadCollectionParent
|
||||
- (void)setObject:(id)object forKeyedSubscript:(id)key;
|
||||
@end
|
||||
|
||||
@interface ReadOnlyCollectionChild : BadCollectionParent
|
||||
- (void)setObject:(id)object forKeyedSubscript:(id)key;
|
||||
@end
|
||||
|
||||
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
|
||||
#define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type
|
||||
|
||||
typedef NS_ENUM(NSUInteger, NSRuncingMode) {
|
||||
NSRuncingMince,
|
||||
NSRuncingQuince
|
||||
};
|
||||
|
||||
typedef NS_ENUM(int, NSUnderlyingType) {
|
||||
NSUnderlyingTypeZim,
|
||||
NSUnderlyingTypeZang,
|
||||
NSUnderlyingTypeFoo = 11,
|
||||
NSUnderlyingTypeBar = 22,
|
||||
NSUnderlyingTypeBas
|
||||
};
|
||||
|
||||
typedef NS_ENUM(unsigned, NSUnsignedUnderlyingTypeNegativeValue) {
|
||||
NSNegativeOne = -1,
|
||||
NSNegativeTwo = -2,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, NSPrefixWordBreak) {
|
||||
NSPrefixWordBreakBanjo,
|
||||
NSPrefixWordBreakBandana
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, NSPrefixWordBreak2) {
|
||||
NSPrefixWordBreakBarBas,
|
||||
NSPrefixWordBreakBareBass,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSInteger, NSSingleConstantEnum) {
|
||||
NSSingleConstantValue,
|
||||
};
|
||||
|
||||
typedef NS_ENUM(unsigned char, NSEnumWithAliases) {
|
||||
NSAliasesOriginal = 129,
|
||||
NSAliasesBySameValue = 129,
|
||||
NSAliasesByEquivalentValue = -127,
|
||||
NSAliasesByName = NSAliasesOriginal,
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSRuncingOptions) {
|
||||
NSRuncingEnableMince = 1,
|
||||
NSRuncingEnableQuince = 2,
|
||||
};
|
||||
|
||||
typedef NS_OPTIONS(NSUInteger, NSSingleOptions) {
|
||||
NSSingleValue = 1,
|
||||
};
|
||||
|
||||
@protocol NSWobbling
|
||||
-(void)wobble;
|
||||
|
||||
@optional
|
||||
-(void)wibble;
|
||||
|
||||
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
|
||||
@end
|
||||
|
||||
14
test/Inputs/clang-importer-sdk/usr/include/blocks.h
Normal file
14
test/Inputs/clang-importer-sdk/usr/include/blocks.h
Normal file
@@ -0,0 +1,14 @@
|
||||
@import Foundation;
|
||||
|
||||
typedef struct dispatch_queue_t {} dispatch_queue_t;
|
||||
|
||||
dispatch_queue_t dispatch_get_current_queue(void);
|
||||
void dispatch_async(dispatch_queue_t q, void (^f)(void));
|
||||
|
||||
@interface NSString ()
|
||||
|
||||
- (void)enumerateLinesUsingBlock:(void (^)(NSString *line)) f;
|
||||
// FIXME: The importer drops this.
|
||||
//- (void)enumerateLinesUsingBlock:(void (^)(NSString *line, BOOL *b)) f;
|
||||
|
||||
@end
|
||||
33
test/Inputs/clang-importer-sdk/usr/include/cfuncs.h
Normal file
33
test/Inputs/clang-importer-sdk/usr/include/cfuncs.h
Normal file
@@ -0,0 +1,33 @@
|
||||
void cfunc1();
|
||||
void cfunc1(void);
|
||||
float cfunc2();
|
||||
float cfunc2(long a, int b);
|
||||
|
||||
typedef double (^double_bin_op_block)(double, double);
|
||||
double_bin_op_block cfunc3(double (^)(double, double));
|
||||
|
||||
float cfunc4();
|
||||
|
||||
void exit(int);
|
||||
|
||||
double pow(double, double);
|
||||
|
||||
int puts(const char *);
|
||||
|
||||
typedef struct {
|
||||
int inode;
|
||||
} FILE;
|
||||
|
||||
FILE *fopen(const char *, const char *);
|
||||
|
||||
inline int createSomething(void);
|
||||
|
||||
int renamed(int) __asm("_something_else");
|
||||
|
||||
void decay_param_array(int p[]);
|
||||
|
||||
// FIXME: These two should work some day, too. Right now we don't import
|
||||
// function types.
|
||||
void decay_param_func(void g(int));
|
||||
void decay_param_nested(void g(int p[]));
|
||||
|
||||
130
test/Inputs/clang-importer-sdk/usr/include/ctypes.h
Normal file
130
test/Inputs/clang-importer-sdk/usr/include/ctypes.h
Normal file
@@ -0,0 +1,130 @@
|
||||
typedef enum { red, green, blue } Color;
|
||||
|
||||
enum Tribool {
|
||||
True, False, Indeterminate
|
||||
};
|
||||
|
||||
enum {
|
||||
AnonConst1 = 0x700000000,
|
||||
AnonConst2
|
||||
};
|
||||
|
||||
struct Point {
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
struct {
|
||||
int a;
|
||||
float b;
|
||||
struct {
|
||||
double c;
|
||||
};
|
||||
};
|
||||
} AnonStructs;
|
||||
|
||||
typedef struct __NSFastEnumerationState_s {
|
||||
unsigned long state;
|
||||
void *itemsPtr;
|
||||
unsigned long *mutationsPtr;
|
||||
unsigned long extra[5];
|
||||
} NSFastEnumerationState;
|
||||
|
||||
typedef void *CFTypeRef;
|
||||
typedef void const *HWND;
|
||||
typedef struct __CFString *CFStringRef;
|
||||
|
||||
typedef struct {
|
||||
struct CGPoint {
|
||||
double x;
|
||||
double y;
|
||||
} origin;
|
||||
struct CGSize {
|
||||
double width;
|
||||
double height;
|
||||
} size;
|
||||
} CGRect;
|
||||
|
||||
//===---
|
||||
// Tag decls and typedefs.
|
||||
//===---
|
||||
|
||||
struct FooStruct1 {
|
||||
int x;
|
||||
double y;
|
||||
};
|
||||
|
||||
typedef struct FooStruct2 {
|
||||
int x;
|
||||
double y;
|
||||
} FooStructTypedef1;
|
||||
|
||||
typedef struct {
|
||||
int x;
|
||||
double y;
|
||||
} FooStructTypedef2;
|
||||
|
||||
typedef struct FooStruct3 {
|
||||
int x;
|
||||
double y;
|
||||
} FooStruct3;
|
||||
|
||||
struct FooStruct4 {
|
||||
int x;
|
||||
double y;
|
||||
};
|
||||
typedef struct FooStruct4 FooStruct4;
|
||||
|
||||
struct FooStruct5;
|
||||
typedef struct FooStruct5 FooStruct5;
|
||||
struct FooStruct5 {
|
||||
int x;
|
||||
double y;
|
||||
};
|
||||
|
||||
typedef struct FooStruct6 FooStruct6;
|
||||
struct FooStruct6 {
|
||||
int x;
|
||||
double y;
|
||||
};
|
||||
|
||||
//===---
|
||||
// Typedefs.
|
||||
//===---
|
||||
|
||||
typedef CGRect NSRect;
|
||||
|
||||
typedef void MyVoid;
|
||||
MyVoid returnsMyVoid(void);
|
||||
|
||||
// Function and struct with same name.
|
||||
int funcOrStruct(void);
|
||||
struct funcOrStruct { int i; };
|
||||
|
||||
// Names from MacTypes.h that conflict with swift's library types.
|
||||
// rdar://14175675
|
||||
typedef unsigned __INT8_TYPE__ UInt8;
|
||||
typedef unsigned __INT16_TYPE__ UInt16;
|
||||
typedef unsigned __INT32_TYPE__ UInt32;
|
||||
typedef unsigned __INT64_TYPE__ UInt64;
|
||||
typedef float Float32;
|
||||
typedef double Float64;
|
||||
typedef long double Float80;
|
||||
|
||||
// Other types from MacTypes.h.
|
||||
typedef __INT8_TYPE__ SInt8;
|
||||
typedef __INT16_TYPE__ SInt16;
|
||||
typedef __INT32_TYPE__ SInt32;
|
||||
typedef __INT64_TYPE__ SInt64;
|
||||
|
||||
// Types from stdint.h.
|
||||
typedef unsigned __INT8_TYPE__ uint8_t;
|
||||
typedef unsigned __INT16_TYPE__ uint16_t;
|
||||
typedef unsigned __INT32_TYPE__ uint32_t;
|
||||
typedef unsigned __INT64_TYPE__ uint64_t;
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
typedef __INT64_TYPE__ int64_t;
|
||||
|
||||
3
test/Inputs/clang-importer-sdk/usr/include/ctypes/bits.h
Normal file
3
test/Inputs/clang-importer-sdk/usr/include/ctypes/bits.h
Normal file
@@ -0,0 +1,3 @@
|
||||
typedef int DWORD;
|
||||
|
||||
#define MY_INT 123
|
||||
1
test/Inputs/clang-importer-sdk/usr/include/cvars.h
Normal file
1
test/Inputs/clang-importer-sdk/usr/include/cvars.h
Normal file
@@ -0,0 +1 @@
|
||||
extern float PI;
|
||||
13
test/Inputs/clang-importer-sdk/usr/include/macros.h
Normal file
13
test/Inputs/clang-importer-sdk/usr/include/macros.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#define M_PI 3.14159265358979
|
||||
#define M_PIf 3.14159265358979F
|
||||
#define GL_FALSE 0
|
||||
#define GL_RGB 0x1907
|
||||
#define GL_RGBA 0x1908
|
||||
#define EOF (-1)
|
||||
#define UINT32_MAX 0xFFFFFFFFU
|
||||
#define INT64_MAX 0x7FFFFFFFFFFFFFFFLL
|
||||
#define MINUS_THREE -3
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define A_PI M_PI
|
||||
16
test/Inputs/clang-importer-sdk/usr/include/module.map
Normal file
16
test/Inputs/clang-importer-sdk/usr/include/module.map
Normal file
@@ -0,0 +1,16 @@
|
||||
module cfuncs { header "cfuncs.h" }
|
||||
module ctypes {
|
||||
header "ctypes.h"
|
||||
explicit module bits {
|
||||
header "ctypes/bits.h"
|
||||
}
|
||||
}
|
||||
module cvars { header "cvars.h" }
|
||||
module blocks { header "blocks.h" }
|
||||
module Foundation {
|
||||
header "Foundation.h"
|
||||
export *
|
||||
}
|
||||
module objc_ext { header "objc_ext.h" }
|
||||
module macros { header "macros.h" }
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
module ObjectiveC [system] {
|
||||
umbrella "."
|
||||
export *
|
||||
}
|
||||
121
test/Inputs/clang-importer-sdk/usr/include/objc/objc.h
Normal file
121
test/Inputs/clang-importer-sdk/usr/include/objc/objc.h
Normal file
@@ -0,0 +1,121 @@
|
||||
@protocol NSObject
|
||||
- description;
|
||||
@end
|
||||
|
||||
@interface NSObject <NSObject>
|
||||
+ alloc;
|
||||
- init;
|
||||
+ new;
|
||||
- performSelector:(SEL)selector withObject:(id)obj;
|
||||
- (Class)myClass;
|
||||
+ description;
|
||||
@end
|
||||
|
||||
@interface A : NSObject
|
||||
- (int)method:(int)arg withDouble:(double)d;
|
||||
+ (int)classMethod;
|
||||
+ (int)classMethod:(int)arg;
|
||||
- (int)counter;
|
||||
@property int counter;
|
||||
- (void)setCounter:(int)value;
|
||||
|
||||
- (int)informalProp;
|
||||
|
||||
- (int)informalMadeFormal;
|
||||
- init;
|
||||
|
||||
@property int overriddenProp;
|
||||
@end
|
||||
|
||||
@protocol B
|
||||
- (int)method:(int)arg withFloat:(float)f;
|
||||
- (int)otherMethod:(int)arg withFloat:(float)f;
|
||||
@end
|
||||
|
||||
@protocol Cat1
|
||||
- cat1Method;
|
||||
@end
|
||||
|
||||
@interface B : A <B>
|
||||
- (int)method:(int)arg withFloat:(float)f;
|
||||
+ (int)classMethod:(int)arg withInt:(int)i;
|
||||
- (id<B>)getAsProto;
|
||||
- (id<B, Cat1>)getAsProtoWithCat;
|
||||
- performAdd:(int)x withValue:(int)y withValue:(int)z withValue2:(int)w;
|
||||
@property (readonly) int readCounter;
|
||||
|
||||
@property int informalMadeFormal;
|
||||
|
||||
@property int overriddenProp;
|
||||
|
||||
- initWithInt:(int)i;
|
||||
- initWithInt:(int)i andDouble:(double)d;
|
||||
- initWithDouble:(double)d1 :(double)d2;
|
||||
- initBBB:(B*)b;
|
||||
- initForWorldDomination;
|
||||
- notAnInit __attribute__((objc_method_family(init), ns_returns_retained));
|
||||
- (id)_initFoo;
|
||||
- (void)anotherMethodOnB;
|
||||
@end
|
||||
|
||||
@interface A(Cat1) <Cat1>
|
||||
- method:(int)i onCat1:(double)d;
|
||||
- cat1Method;
|
||||
@end
|
||||
|
||||
@interface A()
|
||||
- method:(int)i onExtA:(double)d;
|
||||
@end
|
||||
|
||||
@interface B()
|
||||
- method:(int)i onExtB:(double)d;
|
||||
+ newWithA:(A*)a;
|
||||
@end
|
||||
|
||||
typedef long NSInteger;
|
||||
|
||||
@interface A(Subscripting)
|
||||
- objectAtIndexedSubscript:(NSInteger)idx;
|
||||
- (void)setObject:(id)object atIndexedSubscript:(NSInteger)idx;
|
||||
|
||||
- objectForKeyedSubscript:(id)key;
|
||||
@end
|
||||
|
||||
@interface B(Subscripting)
|
||||
- (void)setObject:(id)object forKeyedSubscript:(id)key;
|
||||
@end
|
||||
|
||||
@protocol P2
|
||||
- (void)p2Method;
|
||||
- (id)initViaP2:(double)x second:(double)y;
|
||||
@end
|
||||
|
||||
@interface B(P2) <P2>
|
||||
@end
|
||||
|
||||
@interface NSDate : NSObject
|
||||
- (signed char)isEqualToDate:(NSDate *)anotherDate;
|
||||
@end
|
||||
|
||||
NSDate *swift_createDate(void);
|
||||
|
||||
@interface NSProxy
|
||||
+ alloc;
|
||||
@end
|
||||
|
||||
@interface AProxy : NSProxy
|
||||
- initWithInt:(int)i;
|
||||
@end
|
||||
|
||||
typedef signed char BOOL;
|
||||
|
||||
@interface A(BoolStuff)
|
||||
- setEnabled:(BOOL)enabled;
|
||||
@end
|
||||
|
||||
typedef struct objc_selector *SEL;
|
||||
|
||||
@interface AlmostSubscriptable
|
||||
- (A*) objectForKeyedSubscript:(id)key;
|
||||
- (void)setObject:(id)object forKeyedSubscript:(id)key;
|
||||
@end
|
||||
25
test/Inputs/clang-importer-sdk/usr/include/objc_ext.h
Normal file
25
test/Inputs/clang-importer-sdk/usr/include/objc_ext.h
Normal file
@@ -0,0 +1,25 @@
|
||||
@import ObjectiveC;
|
||||
|
||||
@interface B(Separate)
|
||||
- (id)method:(int)i separateExtMethod:(double)d;
|
||||
- (void)anotherCategoryMethod;
|
||||
@end
|
||||
|
||||
@class RefedSub;
|
||||
|
||||
@interface SuperRefsSub
|
||||
- takesSub:(RefedSub*)sub;
|
||||
- overridden;
|
||||
@end
|
||||
|
||||
@interface RefedSub : SuperRefsSub
|
||||
- overridden;
|
||||
@end
|
||||
|
||||
@protocol NSRuncing
|
||||
- (void)runce;
|
||||
@end
|
||||
|
||||
@interface NSMince
|
||||
- (void)eatWith:(id <NSRuncing>)runcer;
|
||||
@end
|
||||
Reference in New Issue
Block a user