Skip to content

Commit 3b67a17

Browse files
committed
[cxx-interop] Use up-to-date definition of CF_OPTIONS in tests
(cherry picked from commit f20617b)
1 parent 35e44f3 commit 3b67a17

File tree

1 file changed

+39
-21
lines changed

1 file changed

+39
-21
lines changed

test/Interop/Cxx/enum/Inputs/c-enums-withOptions-omit.h

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,57 @@
1-
// Enum usage that is bitwise-able and assignable in C++, aka how CF_OPTIONS
2-
// does things.
3-
typedef int __attribute__((availability(swift, unavailable))) NSEnumerationOptions;
4-
enum : NSEnumerationOptions { NSEnumerationConcurrent, NSEnumerationReverse };
1+
typedef unsigned NSUInteger;
2+
3+
#define __CF_OPTIONS_ATTRIBUTES __attribute__((flag_enum,enum_extensibility(open)))
4+
#if (__cplusplus)
5+
#define CF_OPTIONS(_type, _name) __attribute__((availability(swift,unavailable))) _type _name; enum __CF_OPTIONS_ATTRIBUTES : _name
6+
#else
7+
#define CF_OPTIONS(_type, _name) enum __CF_OPTIONS_ATTRIBUTES _name : _type _name; enum _name : _type
8+
#endif
9+
10+
typedef CF_OPTIONS(NSUInteger, NSEnumerationOptions) {
11+
NSEnumerationConcurrent = (1UL << 0),
12+
NSEnumerationReverse = (1UL << 1),
13+
};
514

615
@interface NSSet
716
- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts ;
817
@end
918

10-
typedef int __attribute__((availability(swift, unavailable))) NSOrderedCollectionDifferenceCalculationOptions;
11-
enum : NSOrderedCollectionDifferenceCalculationOptions {
19+
typedef CF_OPTIONS(NSUInteger, NSOrderedCollectionDifferenceCalculationOptions) {
1220
NSOrderedCollectionDifferenceCalculationOptions1,
1321
NSOrderedCollectionDifferenceCalculationOptions2
1422
};
1523

16-
typedef int __attribute__((availability(swift, unavailable))) NSCalendarUnit;
17-
enum : NSCalendarUnit { NSCalendarUnit1, NSCalendarUnit2 };
24+
typedef CF_OPTIONS(NSUInteger, NSCalendarUnit) {
25+
NSCalendarUnit1,
26+
NSCalendarUnit2
27+
};
1828

19-
typedef int __attribute__((availability(swift, unavailable))) NSSearchPathDomainMask;
20-
enum : NSSearchPathDomainMask { NSSearchPathDomainMask1, NSSearchPathDomainMask2 };
29+
typedef CF_OPTIONS(NSUInteger, NSSearchPathDomainMask) {
30+
NSSearchPathDomainMask1,
31+
NSSearchPathDomainMask2
32+
};
2133

22-
typedef int __attribute__((availability(swift, unavailable))) NSControlCharacterAction;
23-
enum : NSControlCharacterAction { NSControlCharacterAction1, NSControlCharacterAction2 };
34+
typedef CF_OPTIONS(NSUInteger, NSControlCharacterAction) {
35+
NSControlCharacterAction1,
36+
NSControlCharacterAction2
37+
};
2438

25-
typedef int __attribute__((availability(swift, unavailable))) UIControlState;
26-
enum : UIControlState { UIControlState1, UIControlState2 };
39+
typedef CF_OPTIONS(NSUInteger, UIControlState) {
40+
UIControlState1,
41+
UIControlState2
42+
};
2743

28-
typedef int __attribute__((availability(swift, unavailable))) UITableViewCellStateMask;
29-
enum : UITableViewCellStateMask { UITableViewCellStateMask1, UITableViewCellStateMask2 };
44+
typedef CF_OPTIONS(NSUInteger, UITableViewCellStateMask) {
45+
UITableViewCellStateMask1,
46+
UITableViewCellStateMask2
47+
};
3048

31-
typedef int __attribute__((availability(swift, unavailable))) UIControlEvents;
32-
enum : UIControlEvents { UIControlEvents1, UIControlEvents2 };
49+
typedef CF_OPTIONS(NSUInteger, UIControlEvents) {
50+
UIControlEvents1,
51+
UIControlEvents2
52+
};
3353

34-
typedef int __attribute__((availability(swift, unavailable)))
35-
UITableViewScrollPosition;
36-
enum : UITableViewScrollPosition {
54+
typedef CF_OPTIONS(NSUInteger, UITableViewScrollPosition) {
3755
UITableViewScrollPosition1,
3856
UITableViewScrollPosition2
3957
};

0 commit comments

Comments
 (0)