8484# define INDEXSTORE_NOESCAPE
8585#endif
8686
87+ #if __has_attribute (flag_enum )
88+ # define INDEXSTORE_FLAG_ENUM_ATTR __attribute__((flag_enum))
89+ #else
90+ # define INDEXSTORE_FLAG_ENUM_ATTR
91+ #endif
92+
93+ #if __has_attribute (enum_extensibility )
94+ # define INDEXSTORE_OPEN_ENUM_ATTR __attribute__((enum_extensibility(open)))
95+ #else
96+ # define INDEXSTORE_OPEN_ENUM_ATTR
97+ #endif
98+
99+ #define INDEXSTORE_OPTIONS_ATTRS INDEXSTORE_OPEN_ENUM_ATTR INDEXSTORE_FLAG_ENUM_ATTR
100+
101+ #if __has_extension (cxx_strong_enums )|| __has_feature (objc_fixed_enum )
102+ # define INDEXSTORE_OPTIONS (_type ,_name ) enum INDEXSTORE_OPTIONS_ATTRS _name : _type _name; enum INDEXSTORE_OPTIONS_ATTRS _name : _type
103+ #else
104+ # define INDEXSTORE_OPTIONS (_type ,_name ) _type _name; enum INDEXSTORE_OPTIONS_ATTRS
105+ #endif
106+
87107INDEXSTORE_BEGIN_DECLS
88108
89109typedef void * indexstore_error_t ;
@@ -266,7 +286,7 @@ typedef enum {
266286INDEXSTORE_SYMBOL_SUBKIND_SWIFTACCESSORMODIFY = 1015 ,
267287}indexstore_symbol_subkind_t ;
268288
269- typedef enum {
289+ typedef INDEXSTORE_OPTIONS ( uint64_t , indexstore_symbol_property_t ) {
270290INDEXSTORE_SYMBOL_PROPERTY_GENERIC = 1 <<0 ,
271291INDEXSTORE_SYMBOL_PROPERTY_TEMPLATE_PARTIAL_SPECIALIZATION = 1 <<1 ,
272292INDEXSTORE_SYMBOL_PROPERTY_TEMPLATE_SPECIALIZATION = 1 <<2 ,
@@ -276,7 +296,7 @@ typedef enum {
276296INDEXSTORE_SYMBOL_PROPERTY_GKINSPECTABLE = 1 <<6 ,
277297INDEXSTORE_SYMBOL_PROPERTY_LOCAL = 1 <<7 ,
278298INDEXSTORE_SYMBOL_PROPERTY_PROTOCOL_INTERFACE = 1 <<8 ,
279- }indexstore_symbol_property_t ;
299+ };
280300
281301typedef enum {
282302INDEXSTORE_SYMBOL_LANG_C = 0 ,
@@ -286,7 +306,7 @@ typedef enum {
286306INDEXSTORE_SYMBOL_LANG_SWIFT = 100 ,
287307}indexstore_symbol_language_t ;
288308
289- typedef enum {
309+ typedef INDEXSTORE_OPTIONS ( uint64_t , indexstore_symbol_role_t ) {
290310INDEXSTORE_SYMBOL_ROLE_DECLARATION = 1 <<0 ,
291311INDEXSTORE_SYMBOL_ROLE_DEFINITION = 1 <<1 ,
292312INDEXSTORE_SYMBOL_ROLE_REFERENCE = 1 <<2 ,
@@ -310,7 +330,7 @@ typedef enum {
310330INDEXSTORE_SYMBOL_ROLE_REL_CONTAINEDBY = 1 <<16 ,
311331INDEXSTORE_SYMBOL_ROLE_REL_IBTYPEOF = 1 <<17 ,
312332INDEXSTORE_SYMBOL_ROLE_REL_SPECIALIZATIONOF = 1 <<18 ,
313- }indexstore_symbol_role_t ;
333+ };
314334
315335INDEXSTORE_PUBLIC indexstore_symbol_language_t
316336indexstore_symbol_get_language (indexstore_symbol_t );
@@ -321,13 +341,13 @@ indexstore_symbol_get_kind(indexstore_symbol_t);
321341INDEXSTORE_PUBLIC indexstore_symbol_subkind_t
322342indexstore_symbol_get_subkind (indexstore_symbol_t );
323343
324- INDEXSTORE_PUBLIC uint64_t
344+ INDEXSTORE_PUBLIC indexstore_symbol_property_t
325345indexstore_symbol_get_properties (indexstore_symbol_t );
326346
327- INDEXSTORE_PUBLIC uint64_t
347+ INDEXSTORE_PUBLIC indexstore_symbol_role_t
328348indexstore_symbol_get_roles (indexstore_symbol_t );
329349
330- INDEXSTORE_PUBLIC uint64_t
350+ INDEXSTORE_PUBLIC indexstore_symbol_role_t
331351indexstore_symbol_get_related_roles (indexstore_symbol_t );
332352
333353INDEXSTORE_PUBLIC indexstore_string_ref_t
@@ -341,7 +361,7 @@ indexstore_symbol_get_codegen_name(indexstore_symbol_t);
341361
342362typedef void * indexstore_symbol_relation_t ;
343363
344- INDEXSTORE_PUBLIC uint64_t
364+ INDEXSTORE_PUBLIC indexstore_symbol_role_t
345365indexstore_symbol_relation_get_roles (indexstore_symbol_relation_t );
346366
347367INDEXSTORE_PUBLIC indexstore_symbol_t
@@ -363,7 +383,7 @@ indexstore_occurrence_relations_apply_f(indexstore_occurrence_t,
363383void * context ,
364384INDEXSTORE_NOESCAPE bool (* applier )(void * context ,indexstore_symbol_relation_t symbol_rel ));
365385
366- INDEXSTORE_PUBLIC uint64_t
386+ INDEXSTORE_PUBLIC indexstore_symbol_role_t
367387indexstore_occurrence_get_roles (indexstore_occurrence_t );
368388
369389INDEXSTORE_PUBLIC void