Files
swift-mirror/test/ClangImporter/Inputs/enum-error.h
Jordan Rose 52af3f3f65 [ClangImporter] Translate Clang's enum_extensibility to @_frozen
Still to do: test and fix up the use of multiple enum_extensibility
annotations, possibly with API notes. This is important because the
definition of NS/CF_ENUM /includes/ enum_extensibility(open) as of
Xcode 9.0; there should be a convenient out people can use to declare
exhaustive enums in C that's backwards-compatible.
2018-03-20 14:49:10 -07:00

37 lines
961 B
Objective-C

#import <Foundation/Foundation.h>
#define MY_ERROR_ENUM(_type, _name, _domain) \
enum _name : _type _name; \
enum __attribute__((ns_error_domain(_domain))) _name : _type
@class NSString;
extern NSString *const TestErrorDomain;
typedef MY_ERROR_ENUM(int, TestError, TestErrorDomain) {
TENone,
TEOne,
TETwo,
};
extern NSString *const ExhaustiveErrorDomain;
typedef MY_ERROR_ENUM(int, ExhaustiveError, ExhaustiveErrorDomain) {
EENone,
EEOne,
EETwo,
} __attribute__((enum_extensibility(closed)));
extern NSString *const OtherErrorDomain;
typedef MY_ERROR_ENUM(int, OtherErrorCode, OtherErrorDomain) {
OtherA,
OtherB,
OtherC,
};
extern NSString *TypedefOnlyErrorDomain;
typedef enum __attribute__((ns_error_domain(TypedefOnlyErrorDomain))) {
TypedefOnlyErrorBadness
} TypedefOnlyError;
TestError getErr(void);
ExhaustiveError getExhaustiveErr(void);