Files
swift-mirror/test/IDE/Inputs/print_clang_header_swift_name.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

38 lines
1.1 KiB
C

@import Foundation;
#ifndef SWIFT_ENUM_EXTRA
# define SWIFT_ENUM_EXTRA
#endif
#define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
#define SWIFT_ENUM(_type, _name) enum _name : _type _name; enum __attribute__((enum_extensibility(open))) 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(NSInteger, Normal) {
NormalOne = 0,
NormalTwo,
NormalThree
};
#define SWIFT_ENUM_NAMED(_type, _name, _swiftName) enum _name : _type _name SWIFT_COMPILE_NAME(_swiftName); enum SWIFT_COMPILE_NAME(_swiftName) __attribute__((enum_extensibility(open))) SWIFT_ENUM_EXTRA _name : _type
typedef SWIFT_ENUM_NAMED(NSInteger, ObjCEnum, "SwiftEnum") {
ObjCEnumOne = 0,
ObjCEnumTwo,
ObjCEnumThree
};
typedef SWIFT_ENUM_NAMED(NSInteger, ObjCEnumTwo, "SwiftEnumTwo") {
// the following shouldn't have their prefixes stripped
SwiftEnumTwoA,
SwiftEnumTwoB,
SwiftEnumTwoC
};
#pragma clang attribute pop