objc_object_name = get_identifier (OBJECT_TYPEDEF_NAME);
objc_instancetype_name = get_identifier (INSTANCE_TYPEDEF_NAME);
objc_class_name = get_identifier (CLASS_TYPEDEF_NAME);
+ objc_selector_name = get_identifier (SEL_TYPEDEF_NAME);
/* Declare the 'id', 'instancetype' and 'Class' typedefs. */
type = lang_hooks.decls.pushdecl (build_decl (input_location,
OCTI_ID_NAME,
OCTI_INSTANCETYPE_NAME,
OCTI_CLASS_NAME,
+ OCTI_SEL_NAME,
OCTI_CNST_STR_ID,
OCTI_CNST_STR_TYPE,
OCTI_CNST_STR_GLOB_ID,
#define objc_object_name objc_global_trees[OCTI_ID_NAME]
#define objc_instancetype_name objc_global_trees[OCTI_INSTANCETYPE_NAME]
#define objc_class_name objc_global_trees[OCTI_CLASS_NAME]
+#define objc_selector_name objc_global_trees[OCTI_SEL_NAME]
/* Constant string classes. */
#define constant_string_id objc_global_trees[OCTI_CNST_STR_ID]
#define OBJECT_TYPEDEF_NAME "id"
#define INSTANCE_TYPEDEF_NAME "instancetype"
#define CLASS_TYPEDEF_NAME "Class"
+#define SEL_TYPEDEF_NAME "SEL"
#define TAG_OBJECT "objc_object"
#define TAG_CLASS "objc_class"
type = build_qualified_type (type, TYPE_QUAL_CONST);
objc_selector_type = build_pointer_type (type);
+ /* SEL typedef. */
+ type = lang_hooks.decls.pushdecl (build_decl (input_location,
+ TYPE_DECL,
+ objc_selector_name,
+ objc_selector_type));
+ TREE_NO_WARNING (type) = 1;
+
/* typedef id (*IMP)(id, SEL, ...); */
ftype = build_varargs_function_type_list (objc_object_type,
objc_object_type,
objc_selector_type = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (TAG_SELECTOR)));
+ /* SEL typedef. */
+ type = lang_hooks.decls.pushdecl (build_decl (input_location,
+ TYPE_DECL,
+ objc_selector_name,
+ objc_selector_type));
+ TREE_NO_WARNING (type) = 1;
+
build_v1_class_template ();
build_super_template ();
build_v1_protocol_template ();
objc_selector_type = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (TAG_SELECTOR)));
+ /* SEL typedef. */
+ type = lang_hooks.decls.pushdecl (build_decl (input_location,
+ TYPE_DECL,
+ objc_selector_name,
+ objc_selector_type));
+ TREE_NO_WARNING (type) = 1;
+
/* IMP : id (*) (id, _message_ref_t*, ...)
SUPER_IMP : id (*) ( super_t*, _super_message_ref_t*, ...)
objc_v2_selector_type. */
--- /dev/null
+/* Check that we accept the SEL typedef. */
+/* { dg-additional-options "-fsyntax-only " } */
+
+SEL aSelector;
+
+typedef SEL MySEL;
+
--- /dev/null
+/* Check that we accept the SEL typedef. */
+/* { dg-additional-options "-fsyntax-only " } */
+
+SEL aSelector;
+
+typedef SEL MySEL;
+