Files
swift-mirror/test/ClangImporter/Inputs/enum-objc.h
Jordan Rose caa5be84d5 [ClangImporter] Use external_source_symbol to identify Swift decls (#27355)
...rather than replacing particular macros with an 'annotate'
attribute and then looking for that. This isn't /really/ any
particular win except maybe ever-so-slightly faster module imports
(with one fewer attribute being added to each declaration in a
mixed-source header).

This doesn't remove the SWIFT_CLASS_EXTRA, SWIFT_PROTOCOL_EXTRA, or
SWIFT_ENUM_EXTRA macros from PrintAsObjC (note that
SWIFT_EXTENSION_EXTRA was never used). They're not exactly needed
anymore, but they're not doing any harm if someone else is using them.
2019-09-25 15:30:03 -07:00

44 lines
1.7 KiB
Objective-C

@import Foundation;
#ifndef SWIFT_ENUM_EXTRA
# define SWIFT_ENUM_EXTRA
#endif
#define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) __attribute__((enum_extensibility(open))) SWIFT_ENUM_EXTRA _name : _type
#define SWIFT_EXHAUSTIVE_ENUM(_type, _name) enum _name : _type _name; enum __attribute__((enum_extensibility(closed))) SWIFT_ENUM_EXTRA _name : _type
#pragma clang attribute push( \
__attribute__((external_source_symbol(language="Swift", \
defined_in="Mixed",generated_declaration))), \
apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
typedef SWIFT_ENUM_NAMED(NSInteger, ObjCEnum, "SwiftEnum") {
ObjCEnumOne = 1,
ObjCEnumTwo,
ObjCEnumThree
};
typedef SWIFT_EXHAUSTIVE_ENUM(NSInteger, ExhaustiveEnum) {
ExhaustiveEnumOne = 1,
ExhaustiveEnumTwo,
ExhaustiveEnumThree
};
enum BareForwardEnum;
enum ForwardEnumWithUnderlyingType : int;
typedef SWIFT_ENUM_NAMED(NSInteger, ForwardObjCEnum, "ForwardSwiftEnum");
#pragma clang attribute pop
void forwardBarePointer(enum BareForwardEnum * _Nonnull);
void forwardWithUnderlyingValue(enum ForwardEnumWithUnderlyingType);
void forwardWithUnderlyingPointer(enum ForwardEnumWithUnderlyingType * _Nonnull);
void forwardObjCValue(ForwardObjCEnum);
void forwardObjCPointer(ForwardObjCEnum * _Nonnull);
@interface SomeClass : NSObject
+ (void)tryInferDefaultArgumentUnderlyingValue:(bool)dummy options:(enum ForwardEnumWithUnderlyingType)options;
+ (void)tryInferDefaultArgumentObjCValue:(bool)dummy options:(ForwardObjCEnum)options;
@end