Michael137 wrote: > (hmm, can't use the foundation library on godbolt/compiler explorer) Can you > show a small example of the code you're interested in and the DWARF it > produces? The documentation I can find seems to suggest that the extensible > enums have ctors that take the underlying integer type, but the > non-extensible ones don't, so I'd have thought that might be adequate to > differentiate without an extra attribute?
`NS_ENUM` is just a `#define` that adds the `enum_extensibility(open)` attribute to a plain C enum. Given following example: ``` #import <Foundation/Foundation.h> enum Enum { e1 } e; enum class EnumClass : unsigned { ec1 } ec; enum __attribute__((enum_extensibility(open))) OpenEnum { oe1 } oe; enum __attribute__((enum_extensibility(open))) OpenEnumClass : unsigned { oec1 } oec; typedef NS_ENUM(unsigned, ns_enum) { ns1 } ns; ``` Here are all the `DW_TAG_enumeration_type`s: ``` 0x0000002c: DW_TAG_enumeration_type DW_AT_type (0x00000039 "unsigned int") DW_AT_name ("Enum") DW_AT_byte_size (0x04) DW_AT_decl_file ("/Users/michaelbuch/ns_enum.m") DW_AT_decl_line (3) 0x00000035: DW_TAG_enumerator DW_AT_name ("e1") DW_AT_const_value (0) 0x00000048: DW_TAG_enumeration_type DW_AT_type (0x00000039 "unsigned int") DW_AT_enum_class (true) DW_AT_name ("EnumClass") DW_AT_byte_size (0x04) DW_AT_decl_file ("/Users/michaelbuch/ns_enum.m") DW_AT_decl_line (7) 0x00000051: DW_TAG_enumerator DW_AT_name ("ec1") DW_AT_const_value (0) 0x00000060: DW_TAG_enumeration_type DW_AT_type (0x00000039 "unsigned int") DW_AT_name ("OpenEnum") DW_AT_byte_size (0x04) DW_AT_decl_file ("/Users/michaelbuch/ns_enum.m") DW_AT_decl_line (11) 0x00000069: DW_TAG_enumerator DW_AT_name ("oe1") DW_AT_const_value (0) 0x00000078: DW_TAG_enumeration_type DW_AT_type (0x00000039 "unsigned int") DW_AT_enum_class (true) DW_AT_name ("OpenEnumClass") DW_AT_byte_size (0x04) DW_AT_decl_file ("/Users/michaelbuch/ns_enum.m") DW_AT_decl_line (15) 0x00000081: DW_TAG_enumerator DW_AT_name ("oec1") DW_AT_const_value (0) 0x00000090: DW_TAG_enumeration_type DW_AT_type (0x00000039 "unsigned int") DW_AT_name ("ns_enum") DW_AT_byte_size (0x04) DW_AT_decl_file ("/Users/michaelbuch/ns_enum.m") DW_AT_decl_line (19) 0x00000099: DW_TAG_enumerator DW_AT_name ("ns1") DW_AT_const_value (0) ``` So nothing about the extensibility is reflected here https://github.com/llvm/llvm-project/pull/124752 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits