(objc_detect_field_duplicates): New.
(hash_instance_variable): New.
(eq_instance_variable): New.
-
+
2011-04-14 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_declare_protocols): Renamed to
identifier as argument instead of a tree list. This means callers
don't have to build temporary tree lists to call this function.
(synth_module_prologue): Updated calls to objc_declare_class.
-
+
2011-04-13 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (build_keyword_selector): Use get_identifier_with_length
inefficient temporary argument lists. Compare the arguments
directly. (match_proto_with_proto): Removed; incorporated into
comp_proto_with_proto ().
-
+
2011-04-12 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (printable_ivar_name): New.
2011-02-26 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_v2_encode_prop_attr): Rewritten.
-
+
2011-02-23 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (build_private_template): Do not copy the
hook. Added assert. Use the get_class_super_ref and
get_category_super_ref runtime hooks.
(objc_v2_encode_prop_attr): New.
-
+
2011-01-17 Nicola Pero <nicola.pero@meta-innovation.com>
PR objc/47314
(objc_build_setter_call, objc_build_message_expr,
objc_finish_foreach_loop): Updated call to
objc_finish_message_expr.
-
+
2010-12-28 Nicola Pero <nicola.pero@meta-innovation.com>
PR objc/47076
c-family/c-objc.h.
(objc/objc-lang.o): Same change.
* config-lang.in (gtfiles): Added c-family/c-objc.h.
-
+
2010-12-02 Joseph Myers <joseph@codesourcery.com>
* lang-specs.h: Don't handle -ftraditional.
Allow 'make check-objc -j2'
* Make-lang.in (lang_checks_parallelized): New.
(check_objc_parallelize): New.
-
+
2010-11-29 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (start_class): When a class is reimplemented,
readonly properties.
(objc_build_class_component_ref): Updated call to
maybe_make_artificial_property_decl.
-
+
2010-11-27 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_build_struct): Fixed loops that save and
Duplicate TYPE_LANG_SPECIFIC for each type before restoring
TYPE_OBJC_INFO.
(objc_get_protocol_qualified_type): Updated comments.
-
+
2010-11-25 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_build_struct): Install TYPE_OBJC_INTERFACE
class of a category. Recognize the 'deprecated' attribute when
starting and interface, and mark the interface with
TREE_DEPRECATED if present. Store attributes in the interface.
-
-2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>
+
+2010-11-19 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (lookup_protocol): Added 'warn_if_deprecated'
argument. If it is 'true' and the protocol is deprecated, emit a
(check_protocol_recursively): Same change.
(lookup_and_install_protocols): Same change.
* objc-act.h: Updated comments.
-
+
2010-11-17 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (lookup_method_in_protocol_list): Search methods in
(objc_add_synthesize_declaration_for_property): Check that the
property to synthesize and the instance variable to use have the
same type.
-
+
2010-11-10 Joseph Myers <joseph@codesourcery.com>
* objc-act.c (objc_init): Use %' in diagnostic.
protocols and superclasses as well.
(objc_synthesize_setter): Search for the setter declaration in
protocols and superclasses as well.
-
+
2010-11-08 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (lookup_property): When checking categories, also
PROPERTY_GETTER_NAME here; this is now done earlier, in
objc_add_property_declaration.
* objc-act.h (CLASS_NAME, CLASS_SUPER_NAME): Added comments.
-
+
2010-11-06 Nicola Pero <nicola.pero@meta-innovation.com>
Fixed using the Objective-C 2.0 dot-syntax with self and super.
* objc-tree.def (PROPERTY_REF): Increased the number of operands
from 2 to 3. Updated comments.
* objc-act.h (PROPERTY_REF_GETTER_CALL): New.
-
+
2010-11-06 Iain Sandoe <iains@gcc.gnu.org>
PR target/44981
2010-11-04 Nicola Pero <nicola.pero@meta-innovation.com>
- Fixed using the Objective-C 2.0 dot-syntax with class names.
+ Fixed using the Objective-C 2.0 dot-syntax with class names.
* objc-act.c (objc_build_class_component_ref): New.
2010-11-03 Nicola Pero <nicola.pero@meta-innovation.com>
and do not warn if the property is readonly or if the type is a Class.
(objc_finish_foreach_loop): Updated calls to
objc_type_valid_for_messaging.
-
+
2010-11-03 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented -fobjc-std=objc1 flag.
(PROPERTY_HAS_NO_GETTER): New.
(PROPERTY_HAS_NO_SETTER): New.
* objc-tree.def: Updated comment.
-
+
2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented format and noreturn attributes for Objective-C methods.
"deprecated". In the case of "format", adjust the arguments.
Always process the attributes in the same way no matter if
"sentinel" is in the list or not.
-
+
2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_maybe_build_component_ref): Warn about using
deprecated properties.
(objc_maybe_printable_name): Support PROPERTY_DECL.
-
+
2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com>
- Implemented Objective-C 2.0 property accessors.
+ Implemented Objective-C 2.0 property accessors.
* objc-act.h (enum objc_tree_index): Added OCTI_GET_PROPERTY_DECL,
OCTI_SET_PROPERTY_DECL, OCTI_COPY_STRUCT_DECL,
OCTI_GET_PROPERTY_STRUCT_DECL and OCTI_SET_PROPERTY_STRUCT_DECL.
work with properties that are not nonatomic, assign properties.
(objc_synthesize_setter): Implemented synthesizing setters that
work with properties that are not nonatomic, assign properties.
-
+
2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented Objective-C 2.0 @property, @synthesize and @dynamic.
(objc_gimplify_property_ref): New.
(objc_gimplify_expr): Use a switch. In case of a PROPERTY_REF, call
objc_gimplify_property_ref.
-
+
2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_add_property_declaration): Added arguments to
(property_setter): Removed.
(property_getter): Removed.
(property_ivar): Removed.
- (property_copies): Removed.
+ (property_copies): Removed.
(objc_set_property_attr): Removed.
* objc-act.h (enum property_assign_semantics): New.
-
+
2010-10-27 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_add_property_variable): Renamed to
warnings and errors to use it. Use error, not fatal_error, if a
property declaration is found outside an interface or
implementation context.
-
+
2010-10-24 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_build_keyword_decl): Updated comments. Do not
of DECLs that we don't recognize. Immediately return NULL for them.
(objc_printable_name): Removed C++-specific case, which is no
longer used. Updated comments.
-
+
2010-10-23 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (OBJC_GEN_METHOD_LABEL): Updated comments.
2010-10-21 Iain Sandoe <iains@gcc.gnu.org>
Based on the CFString implementation in FSF apple/trunk branch.
-
+
* objc/objc-act.c (objc_build_string_object): Handle CFStrings.
2010-10-21 Nicola Pero <nicola.pero@meta-innovation.com>
twice. Added missing gcc_unreachable for default case - twice.
(dump_interface): Use a switch instead of a chain of ifs.
(handle_impent): Same change.
-
+
2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.h (objc_inherit_code): Removed.
(objc_synthesize_getter): Updated call to
objc_start_method_definition. Do not set objc_inherit_code.
(objc_synthesize_setter): Updated call to
- objc_start_method_definition. Do not set objc_inherit_code.
-
+ objc_start_method_definition. Do not set objc_inherit_code.
+
2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers. Obvious updates
(objc_declare_class): Enter class name into hash table.
(objc_is_class_name): Do a hash look up of class name.
(hash_init): Initialize the two new hash tables.
- * objc-act.h: Added cls_name_hash_list and als_name_hash_list
- declarations, removed class_chain and alias_chain.
+ * objc-act.h: Added cls_name_hash_list and als_name_hash_list
+ declarations, removed class_chain and alias_chain.
2010-10-20 Nicola Pero <nicola.pero@meta-innovation.com>
for syntax-only run or PCH generation as this is done by the
callers.
* objc-act.h (objc_finish_file): Removed.
-
+
2010-10-18 Nicola Pero <nicola.pero@meta-innovation.com>
Implemented parsing @synthesize and @dynamic for
* objc-act.c (objc_add_synthesize_declaration): New.
(objc_add_dynamic_declaration): New.
-2010-10-18 Nicola Pero <nicola.pero@meta-innovation.com>
+2010-10-18 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (lookup_and_install_protocols): Return NULL if passed
error_mark_node.
-
+
2010-10-18 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
* objc/objc-act.c (objc_is_class_name): template parameter is not
an objective class name.
(objc_generate_cxx_cdtors): Check for the null
- objc_implementation_context.
+ objc_implementation_context.
2010-10-18 Nicola Pero <nicola.pero@meta-innovation.com>
- Merge from 'apple/trunk' branch on FSF servers.
-
+ Merge from 'apple/trunk' branch on FSF servers.
+
2005-11-08 Fariborz Jahanian <fjahanian@apple.com>
Radar 4330422
* objc/objc-act.c (objc_non_volatilized_type): New
2005-10-07 Fariborz Jahanian <fjahanian@apple.com>
-
+
Radar 4204796
* objc-act.c (objc_build_volatilized_type): Build 'volatilzed'
types with proper attribute set and correctly.
(objc_type_quals_match): Use the new attribute to check on
'volatilzed' type.
(hash_init): removed unneeded code.
-
+
2010-10-17 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
-
+
2006-03-27 Fariborz Jahanian <fjahanian@apple.com>
Radar 4133425
2010-10-17 Iain Sandoe <iains@gcc.gnu.org>
* objc-act.c: Rename 'objc_public_flag' to objc_ivar_visibility and
- make its type 'objc_ivar_visibility_kind'.
+ make its type 'objc_ivar_visibility_kind'.
(objc_start_class_interface): Update to use visibility enum.
(objc_start_class_implementation): Likewise.
- (objc_set_visibility): Update to use visibility enum, warn that
+ (objc_set_visibility): Update to use visibility enum, warn that
@package is handle as per @public.
(add_instance_variable): Handle OBJC_IVAR_VIS_PACKAGE.
* objc-act.h: Rename 'objc_public_flag' to objc_ivar_visibility and
2010-10-14 Iain Sandoe <iains@gcc.gnu.org>
- merge from FSF apple 'trunk' branch.
+ merge from FSF apple 'trunk' branch.
2006 Fariborz Jahanian <fjahanian@apple.com>
-
+
Radars 4436866, 4505126, 4506903, 4517826
* objc-act.c (CALL_EXPR_OBJC_PROPERTY_GETTER): New.
property_readonly, property_getter, property_setter, property_ivar,
2010-10-13 Iain Sandoe <iains@gcc.gnu.org>
- merge from FSF apple 'trunk' branch.
+ merge from FSF apple 'trunk' branch.
2006-04-26 Fariborz Jahanian <fjahanian@apple.com>
Radar 3803157 (method attributes)
2010-10-07 Iain Sandoe <iains@gcc.gnu.org>
- * objc-act.c (build_objc_method_call): Replace calls to
+ * objc-act.c (build_objc_method_call): Replace calls to
build_function_call () with the VEC equivalent. Construct parameter
lists as VECs.
2010-10-07 Iain Sandoe <iains@gcc.gnu.org>
- * objc-act.c (objc_build_message_expr): Call mark_exp_read () to
+ * objc-act.c (objc_build_message_expr): Call mark_exp_read () to
signal that the receiver has been used.
2010-10-06 Nicola Pero <nicola.pero@meta-innovation.com>
for valid objc object types.
(objc_finish_foreach_loop): Check for invalid objc objects in
foreach header.
-
+
2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
Radar 4290840
* objc-act.c (objc_start_method_definition): Check for
error_mark_node for the selector name and make a quick exit.
-
+
2010-10-04 Andi Kleen <ak@linux.intel.com>
* Make-lang.in (cc1obj-dummy, cc1obj): Add + to build rule.
* objc/objc-act.h (CLASS_OPTIONAL_CLS_METHODS,
CLASS_OPTIONAL_NST_METHODS): New macros accessing a protocol
class's optional method chains.
-
+
2010-09-30 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
* objc-act.c (objc_is_reserved_word): Removed.
2010-09-28 Iain Sandoe <iains@gcc.gnu.org>
-
- * objc-act.c (objc_add_method_declaration): Handle and ignore
+
+ * objc-act.c (objc_add_method_declaration): Handle and ignore
attributes.
(objc_start_method_definition): Likewise.
(objc_generate_cxx_ctor_or_dtor): Pass NULL attributes to ctor/dtor.
* objc-act.c (objc_decay_parm_type): New function.
(get_arg_type_list): Decay types for all named arguments.
(objc_push_parm): Rebuild the PARM_DECL if its type has
- been decayed.
+ been decayed.
2010-09-28 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (objc_compare_types): A new silent comparison
mode (-4), differing from regular comparison (-3) in that
'false' is returned instead of issuing warnings.
-
+
2010-09-28 Nicola Pero <nicola.pero@meta-innovation.com>
* objc-act.c (encode_type): Do not add 'r' with the next runtime.
Encode C++ reference types as pointers. Call encode_vector to
encode vectors.
(encode_vector): New function.
-
+
2010-09-27 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers. I modified the
Radar 4301047
* objc-act.c (encode_type): Remove the hack.
-
+
2005-07-20 Ziemowit Laski <zlaski@apple.com>
Radar 4136935
Radar 4229905
* objc-act.c (objc_have_common_types): New function.
-
+
2005-06-22 Ziemowit Laski <zlaski@apple.com>
Radar 4154928
* objc-act.c (objc_common_type): New function.
-
+
2010-09-27 Richard Guenther <rguenther@suse.de>
* objc-act.c (objc_get_class_reference): Use CP_TYPE_CONTEXT.
* objc-act.c (objc_get_interface_ivars): New function.
(objc_collecting_ivars): New variable.
(continue_class): Set and reset objc_collecting_ivars for context.
-
+
2010-09-15 Nicola Pero <nicola.pero@meta-innovation.com>
Merge from 'apple/trunk' branch on FSF servers.
* objc-act.c (objc_get_protocol_qualified_type): When looking
at a typedef, retrieve the precise type it describes (rather
than merely looking up a class by name).
-
+
2010-09-10 Nicola Pero <nicola.pero@meta-innovation.com>
* objc/objc-act.c (objc_begin_try_stmt): Generate an error if
PR objc/44140
* objc-act.c: build_objc_string_decl() remove declaration.
(finish_var_decl): Remove forcing of var output and marking
- as "Used".
- (init_def_list): Use integer_zero_node.
+ as "Used".
+ (init_def_list): Use integer_zero_node.
(init_objc_symtab): Use integer_zero_node, make the short
integer type specific on relevant nodes.
- (generate_objc_symtab_decl): Remove call to
+ (generate_objc_symtab_decl): Remove call to
forward_declare_categories(). Use null_pointer_node where
- appropriate.
- (build_module_descriptor): Comment and mark this item as
- DECL_PRESERVE_P.
+ appropriate.
+ (build_module_descriptor): Comment and mark this item as
+ DECL_PRESERVE_P.
(generate_static_references): Use gcc_unreachable instead of
- abort ().
+ abort ().
(diagnose_missing_method): New.
(build_next_selector_translation_table): New.
(build_gnu_selector_translation_table): New.
... and delete build_objc_string_decl().
(generate_dispatch_table): Make integer types explicit.
(generate_category): Pass implent and arrange for the data
- to be extracted within the routine. Do not start new vars,
+ to be extracted within the routine. Do not start new vars,
but finish the ones collcted during parsing.
(generate_shared_structures): Likewise.
(finish_objc): Reorder code so that we finish variables before
referencing them. Save the global data before calling meta-data
- creation routines, and pass the current reference to the two
- main routines. Only call generate_objc_image_info () for the
+ creation routines, and pass the current reference to the two
+ main routines. Only call generate_objc_image_info () for the
NeXT runtime.
(generate_classref_translation_entry): Comment on and make this
item DECL_PRESERVE_P.
(handle_class_ref): Use varpool interfaces, comment on and make
this item DECL_PRESERVE_P.
(handle_impent): Likewise.
- (generate_objc_image_info): Only generate when the content is
+ (generate_objc_image_info): Only generate when the content is
non-zero. Make integer types explict.
2010-07-03 Nathan Froyd <froydnj@codesourcery.com>
2009-07-17 Aldy Hernandez <aldyh@redhat.com>
Manuel López-Ibáñez <manu@gcc.gnu.org>
- PR 40435
+ PR 40435
* objc-act.c: Add location argument to all calls to
build_fold_addr_expr.
-
+
2009-07-14 Taras Glek <tglek@mozilla.com>
Rafael Espindola <espindola@google.com>
* objc-act.c (next_sjlj_build_catch_list): Replace EXPR_LOCUS by
EXPR_LOCATION.
-
+
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
* objc-act.c: Replace %J by an explicit location. Update all
calls.
-
+
2009-07-07 Manuel López-Ibáñez <manu@gcc.gnu.org>
* objc-act.c: Replace %H by an explicit location. Update all
calls.
-
+
2009-06-22 Steven Bosscher <steven@gcc.gnu.org>
PR objc/28050
* objc-act.c (objc_build_message_args): Return if ARGS is the
error_mark_node.
-
+
2009-06-19 Ian Lance Taylor <iant@google.com>
* objc-act.c (objc_in_struct, objc_struct_types): Remove.
label_context_stack_se or label_context_stack_vm.
2009-06-12 Aldy Hernandez <aldyh@redhat.com>
-
+
* objc-act.c (finish_var_decl): Pass location to finish_decl.
(objc_get_parm_info): Same.
(get_super_receiver): Same.
build_modify_expr, build_compound_expr.
* objc-act.c: Add location to all calls to start_struct, build_decl,
finish_struct.
-
+
2009-06-09 Ian Lance Taylor <iant@google.com>
* objc-act.c (objc_gimplify_expr): Change return type to int.
(add_class): Likewise.
2007-01-02 Douglas Gregor <doug.gregor@gmail.com>
-
+
* objc-act.c (objc_build_volatilized_type): Keep track of
canonical types.
(objc_get_protocol_qualified_type): Ditto.
-
+
2006-11-02 Andreas Tobler <a.tobler@schweiz.org>
* objc-act.c (objc_finish_file): Remove ifdef clause for OBJCPLUS and
objc/objc-next-runtime-abi-02.o: objc/objc-next-runtime-abi-02.c $(START_HDRS) \
$(GGC_H) objc/objc-runtime-hooks.h \
objc/objc-next-metadata-tags.h gt-objc-objc-next-runtime-abi-02.h $(TARGET_H) \
- objc/objc-runtime-shared-support.h $(OBSTACK_H)
+ objc/objc-runtime-shared-support.h $(OBSTACK_H)
objc/objc-act.o : objc/objc-act.c $(START_HDRS) $(GGC_H) \
$(DIAGNOSTIC_CORE_H) toplev.h $(FLAGS_H) input.h $(FUNCTION_H) output.h debug.h \
#endif
/* objc attribute */
-static void objc_decl_method_attributes (tree*, tree, int);
+static void objc_decl_method_attributes (tree*, tree, int);
static tree build_keyword_selector (tree);
/* Hash tables to manage the global pool of method prototypes. */
#define OBJC_LOOKUP_NO_SUPER 2
/* Disable returning an instance method of a root class when a class
method can't be found. */
-#define OBJC_LOOKUP_NO_INSTANCE_METHODS_OF_ROOT_CLASS 4
+#define OBJC_LOOKUP_NO_INSTANCE_METHODS_OF_ROOT_CLASS 4
/* The OCTI_... enumeration itself is in objc/objc-act.h. */
tree objc_global_trees[OCTI_MAX];
/* TODO: consider an early exit here if either errorcount or sorrycount
is non-zero. Not only is it wasting time to generate the metadata,
- it needlessly imposes need to re-check for things that are already
+ it needlessly imposes need to re-check for things that are already
determined to be errors. */
/* Finalize Objective-C runtime data. No need to generate tables
tree protos, tree attributes)
{
if (flag_objc1_only && attributes)
- error_at (input_location, "class attributes are not available in Objective-C 1.0");
+ error_at (input_location, "class attributes are not available in Objective-C 1.0");
objc_interface_context
= objc_ivar_context
if (flag_objc1_only)
error_at (input_location, "category attributes are not available in Objective-C 1.0");
else
- warning_at (input_location, OPT_Wattributes,
+ warning_at (input_location, OPT_Wattributes,
"category attributes are not available in this version"
" of the compiler, (ignored)");
}
as the one we are extending, produce an error. */
if (TREE_CODE (t->imp_context) == CLASS_IMPLEMENTATION_TYPE
&& IDENTIFIER_POINTER (CLASS_NAME (t->imp_context)) == IDENTIFIER_POINTER (klass))
- error_at (input_location,
+ error_at (input_location,
"class extension for class %qE declared after its %<@implementation%>",
klass);
}
objc_start_protocol (tree name, tree protos, tree attributes)
{
if (flag_objc1_only && attributes)
- error_at (input_location, "protocol attributes are not available in Objective-C 1.0");
+ error_at (input_location, "protocol attributes are not available in Objective-C 1.0");
objc_interface_context
= start_protocol (PROTOCOL_INTERFACE_TYPE, name, protos, attributes);
if (flag_objc1_only)
{
if (optional)
- error_at (input_location, "%<@optional%> is not available in Objective-C 1.0");
+ error_at (input_location, "%<@optional%> is not available in Objective-C 1.0");
else
- error_at (input_location, "%<@required%> is not available in Objective-C 1.0");
+ error_at (input_location, "%<@required%> is not available in Objective-C 1.0");
}
objc_method_optional_flag = optional;
- if (!objc_interface_context
+ if (!objc_interface_context
|| TREE_CODE (objc_interface_context) != PROTOCOL_INTERFACE_TYPE)
{
if (optional)
}
/* Failing to find in categories, look for property in protocol list. */
- if (CLASS_PROTOCOL_LIST (inter)
+ if (CLASS_PROTOCOL_LIST (inter)
&& (x = lookup_property_in_protocol_list
(CLASS_PROTOCOL_LIST (inter), property)))
return x;
-
+
/* Failing that, climb up the inheritance hierarchy. */
inter = lookup_interface (CLASS_SUPER_NAME (inter));
}
{
if (parsed_property_readonly)
property_readonly = true;
-
+
if (parsed_property_readwrite)
property_readonly = false;
}
if (TREE_CODE (decl) != FIELD_DECL)
{
error_at (location, "invalid property declaration");
- return;
+ return;
}
/* Do some spot-checks for the most obvious invalid types. */
underlying instance variable could be a bitfield, but that is
a different matter. */
error_at (location, "property can not be a bit-field");
- return;
+ return;
}
#endif
/* Use 'false' so we do not warn for Class objects. */
if (objc_type_valid_for_messaging (TREE_TYPE (decl), false))
{
- warning_at (location,
+ warning_at (location,
0,
- "object property %qD has no %<assign%>, %<retain%> or %<copy%> attribute; assuming %<assign%>",
+ "object property %qD has no %<assign%>, %<retain%> or %<copy%> attribute; assuming %<assign%>",
decl);
- inform (location,
+ inform (location,
"%<assign%> can be unsafe for Objective-C objects; please state explicitly if you need it");
}
}
}
-
+
if (property_assign_semantics == OBJC_PROPERTY_RETAIN
&& !objc_type_valid_for_messaging (TREE_TYPE (decl), true))
error_at (location, "%<retain%> attribute is only valid for Objective-C objects");
-
+
if (property_assign_semantics == OBJC_PROPERTY_COPY
&& !objc_type_valid_for_messaging (TREE_TYPE (decl), true))
error_at (location, "%<copy%> attribute is only valid for Objective-C objects");
else
{
if (!property_readonly)
- parsed_property_setter_ident = get_identifier (objc_build_property_setter_name
+ parsed_property_setter_ident = get_identifier (objc_build_property_setter_name
(DECL_NAME (decl)));
}
else
{
location_t original_location = DECL_SOURCE_LOCATION (x);
-
+
error_at (location, "redeclaration of property %qD", decl);
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
{
warning_at (location, 0,
"'nonatomic' attribute of property %qD conflicts with previous declaration", decl);
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
{
warning_at (location, 0,
"'getter' attribute of property %qD conflicts with previous declaration", decl);
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
{
warning_at (location, 0,
"'setter' attribute of property %qD conflicts with previous declaration", decl);
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
{
warning_at (location, 0,
"assign semantics attributes of property %qD conflict with previous declaration", decl);
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
{
warning_at (location, 0,
"'readonly' attribute of property %qD conflicts with previous declaration", decl);
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
if (!comptypes (TREE_TYPE (x), TREE_TYPE (decl))
/* ... unless the property is readonly, in which case we
allow a new, more specialized, declaration. */
- && (!property_readonly
+ && (!property_readonly
|| !objc_compare_types (TREE_TYPE (x),
TREE_TYPE (decl), -5, NULL_TREE)))
{
TREE_TYPE (property_decl) = TREE_TYPE (decl);
DECL_SOURCE_LOCATION (property_decl) = DECL_SOURCE_LOCATION (decl);
TREE_DEPRECATED (property_decl) = TREE_DEPRECATED (decl);
-
+
/* Add property-specific information. */
PROPERTY_NAME (property_decl) = DECL_NAME (decl);
PROPERTY_GETTER_NAME (property_decl) = parsed_property_getter_ident;
any is found, then create an artificial property that uses them.
Return NULL_TREE if 'getter' or 'setter' could not be found. */
static tree
-maybe_make_artificial_property_decl (tree interface, tree implementation,
+maybe_make_artificial_property_decl (tree interface, tree implementation,
tree protocol_list, tree component, bool is_class,
tree getter_name)
{
Turn it off. */
if (is_class)
flags = OBJC_LOOKUP_CLASS | OBJC_LOOKUP_NO_INSTANCE_METHODS_OF_ROOT_CLASS;
-
+
getter = lookup_method_static (interface, getter_name, flags);
setter = lookup_method_static (interface, setter_name, flags);
}
else
{
getter = lookup_method (CLASS_NST_METHODS (implementation), getter_name);
- setter = lookup_method (CLASS_NST_METHODS (implementation), setter_name);
+ setter = lookup_method (CLASS_NST_METHODS (implementation), setter_name);
}
}
}
/* Yes ... determine the type of the expression. */
tree property_decl;
tree type;
-
+
if (getter)
type = TREE_VALUE (TREE_TYPE (getter));
else
type = TREE_VALUE (TREE_TYPE (METHOD_SEL_ARGS (setter)));
-
+
/* Create an artificial property declaration with the
information we collected on the type and getter/setter
names. */
property_decl = make_node (PROPERTY_DECL);
-
+
TREE_TYPE (property_decl) = type;
DECL_SOURCE_LOCATION (property_decl) = input_location;
TREE_DEPRECATED (property_decl) = 0;
/* Try to determine if 'object' is an Objective-C object or not. If
not, return. */
- if (object == NULL_TREE || object == error_mark_node
+ if (object == NULL_TREE || object == error_mark_node
|| (rtype = TREE_TYPE (object)) == NULL_TREE)
return NULL_TREE;
-
+
if (property_ident == NULL_TREE || property_ident == error_mark_node
|| TREE_CODE (property_ident) != IDENTIFIER_NODE)
return NULL_TREE;
if (TYPE_HAS_OBJC_INFO (TREE_TYPE (rtype)))
{
tree rprotos = TYPE_OBJC_PROTOCOL_LIST (TREE_TYPE (rtype));
-
+
if (rprotos)
{
/* No point looking up declared @properties if we are
an artifical property based on them if found. */
x = maybe_make_artificial_property_decl (NULL_TREE,
NULL_TREE,
- rprotos,
+ rprotos,
property_ident,
IS_CLASS (rtype),
NULL_TREE);
rprotos,
property_ident,
false,
- PROPERTY_GETTER_NAME (x));
+ PROPERTY_GETTER_NAME (x));
}
}
}
|| CONVERT_EXPR_P (t)
|| TREE_CODE (t) == COMPONENT_REF)
t = TREE_OPERAND (t, 0);
-
- if (t == UOBJC_SUPER_decl)
+
+ if (t == UOBJC_SUPER_decl)
interface_type = lookup_interface (CLASS_SUPER_NAME (implementation_template));
else if (t == self_decl)
interface_type = lookup_interface (CLASS_NAME (implementation_template));
{
if (TREE_CODE (objc_method_context) != CLASS_METHOD_DECL)
x = lookup_property (interface_type, property_ident);
-
+
if (x == NULL_TREE)
{
/* Try the dot-syntax without a declared property.
if (t == self_decl)
implementation = objc_implementation_context;
-
- x = maybe_make_artificial_property_decl
+
+ x = maybe_make_artificial_property_decl
(interface_type, implementation, NULL_TREE,
property_ident,
(TREE_CODE (objc_method_context) == CLASS_METHOD_DECL),
else if (PROPERTY_OPTIONAL (x) && PROPERTY_READONLY (x))
{
tree implementation = NULL_TREE;
-
+
if (t == self_decl)
implementation = objc_implementation_context;
-
+
x = maybe_make_artificial_property_decl (interface_type,
implementation,
NULL_TREE,
property_ident,
false,
- PROPERTY_GETTER_NAME (x));
+ PROPERTY_GETTER_NAME (x));
}
}
}
/* Traverse typedefs. */
while (basetype != NULL_TREE
- && TREE_CODE (basetype) == RECORD_TYPE
+ && TREE_CODE (basetype) == RECORD_TYPE
&& OBJC_TYPE_NAME (basetype)
&& TREE_CODE (OBJC_TYPE_NAME (basetype)) == TYPE_DECL
&& DECL_ORIGINAL_TYPE (OBJC_TYPE_NAME (basetype)))
tree interface_type = TYPE_OBJC_INTERFACE (basetype);
tree protocol_list = TYPE_OBJC_PROTOCOL_LIST (basetype);
- if (interface_type
+ if (interface_type
&& (TREE_CODE (interface_type) == CLASS_INTERFACE_TYPE
|| TREE_CODE (interface_type) == CATEGORY_INTERFACE_TYPE
|| TREE_CODE (interface_type) == PROTOCOL_INTERFACE_TYPE))
if (!IS_CLASS (rtype))
{
x = lookup_property (interface_type, property_ident);
-
+
if (x == NULL_TREE)
- x = lookup_property_in_protocol_list (protocol_list,
+ x = lookup_property_in_protocol_list (protocol_list,
property_ident);
}
-
+
if (x == NULL_TREE)
{
/* Try the dot-syntax without a declared property.
tree implementation = NULL_TREE;
if (objc_implementation_context
- && CLASS_NAME (objc_implementation_context)
+ && CLASS_NAME (objc_implementation_context)
== OBJC_TYPE_NAME (interface_type))
implementation = objc_implementation_context;
-
+
x = maybe_make_artificial_property_decl (interface_type,
implementation,
- protocol_list,
+ protocol_list,
property_ident,
IS_CLASS (rtype),
NULL_TREE);
tree implementation = NULL_TREE;
if (objc_implementation_context
- && CLASS_NAME (objc_implementation_context)
+ && CLASS_NAME (objc_implementation_context)
== OBJC_TYPE_NAME (interface_type))
implementation = objc_implementation_context;
-
+
x = maybe_make_artificial_property_decl (interface_type,
implementation,
protocol_list,
property_ident,
false,
- PROPERTY_GETTER_NAME (x));
- }
+ PROPERTY_GETTER_NAME (x));
+ }
}
}
}
deprecated_method_prototype);
SET_EXPR_LOCATION (expression, input_location);
TREE_SIDE_EFFECTS (expression) = 1;
-
+
return expression;
}
{
tree x = NULL_TREE;
tree object, rtype;
-
+
if (flag_objc1_only)
error_at (input_location, "the dot syntax is not available in Objective-C 1.0");
-
+
if (class_name == NULL_TREE || class_name == error_mark_node
|| TREE_CODE (class_name) != IDENTIFIER_NODE)
return error_mark_node;
-
+
if (property_ident == NULL_TREE || property_ident == error_mark_node
|| TREE_CODE (property_ident) != IDENTIFIER_NODE)
return NULL_TREE;
-
+
object = objc_get_class_reference (class_name);
if (!object)
{
/* We know that 'class_name' is an Objective-C class name as the
parser won't call this function if it is not. This is only a
double-check for safety. */
- error_at (input_location, "could not find class %qE", class_name);
+ error_at (input_location, "could not find class %qE", class_name);
return error_mark_node;
}
if (!rtype)
{
/* Again, this should never happen, but we do check. */
- error_at (input_location, "could not find interface for class %qE", class_name);
+ error_at (input_location, "could not find interface for class %qE", class_name);
return error_mark_node;
}
else
{
if (TREE_DEPRECATED (rtype))
- warning (OPT_Wdeprecated_declarations, "class %qE is deprecated", class_name);
+ warning (OPT_Wdeprecated_declarations, "class %qE is deprecated", class_name);
}
x = maybe_make_artificial_property_decl (rtype, NULL_TREE, NULL_TREE,
property_ident,
true, NULL_TREE);
-
+
if (x)
{
tree expression;
}
else
{
- error_at (input_location, "could not find setter/getter for %qE in class %qE",
- property_ident, class_name);
+ error_at (input_location, "could not find setter/getter for %qE in class %qE",
+ property_ident, class_name);
return error_mark_node;
}
{
tree object_expr = PROPERTY_REF_OBJECT (lhs);
tree property_decl = PROPERTY_REF_PROPERTY_DECL (lhs);
-
+
if (PROPERTY_READONLY (property_decl))
{
- error ("readonly property can not be set");
+ error ("readonly property can not be set");
return error_mark_node;
}
else
{
tree setter_argument = build_tree_list (NULL_TREE, rhs);
tree setter;
-
+
/* TODO: Check that the setter return type is 'void'. */
/* TODO: Decay arguments in C. */
- setter = objc_finish_message_expr (object_expr,
+ setter = objc_finish_message_expr (object_expr,
PROPERTY_SETTER_NAME (property_decl),
setter_argument, NULL);
return setter;
if (TREE_SIDE_EFFECTS (rhs))
{
tree bind;
-
+
/* Declare __objc_property_temp in a local bind. */
setter_argument = objc_create_temporary_var (TREE_TYPE (rhs), "__objc_property_temp");
DECL_SOURCE_LOCATION (setter_argument) = input_location;
setter_argument = rhs;
s1 = NULL_TREE;
}
-
+
/* Now build the compound statement. */
-
+
/* s2: [object setProperty: x] */
s2 = objc_build_setter_call (lhs, setter_argument);
-
+
/* This happens if building the setter failed because the
property is readonly. */
if (s2 == error_mark_node)
return error_mark_node;
SET_EXPR_LOCATION (s2, input_location);
-
+
/* s3: x */
s3 = convert (TREE_TYPE (lhs), setter_argument);
if (s1)
compound_expr = build_compound_expr (input_location, build_compound_expr (input_location, s1, s2), s3);
else
- compound_expr = build_compound_expr (input_location, s2, s3);
+ compound_expr = build_compound_expr (input_location, s2, s3);
/* Without this, with -Wall you get a 'valued computed is not
used' every time there is a "object.property = x" where the
'setter' for the property in an appropriate way to build the
appropriate expression. 'code' is the code for the expression (one
of the four mentioned above); 'argument' is the PROPERTY_REF, and
- 'increment' is how much we need to add or subtract. */
+ 'increment' is how much we need to add or subtract. */
tree
objc_build_incr_expr_for_property_ref (location_t location,
- enum tree_code code,
+ enum tree_code code,
tree argument, tree increment)
{
/* Here are the expressions that we want to build:
For PREINCREMENT_EXPR / PREDECREMENT_EXPR:
(temp = [object property] +/- increment, [object setProperty: temp], temp)
-
+
For POSTINCREMENT_EXPR / POSTECREMENT_EXPR:
(temp = [object property], [object setProperty: temp +/- increment], temp) */
-
+
tree temp_variable_decl, bind;
/* s1, s2 and s3 are the tree statements that we need in the
compound expression. */
tree s1, s2, s3, compound_expr;
-
+
/* Safety check. */
if (!argument || TREE_CODE (argument) != PROPERTY_REF)
return error_mark_node;
SET_EXPR_LOCATION (bind, location);
TREE_SIDE_EFFECTS (bind) = 1;
add_stmt (bind);
-
+
/* Now build the compound statement. */
-
+
/* Note that the 'getter' is generated at gimplify time; at this
time, we can simply put the property_ref (ie, argument) wherever
we want the getter ultimately to be. */
-
+
/* s1: __objc_property_temp = [object property] <+/- increment> */
switch (code)
{
- case PREINCREMENT_EXPR:
+ case PREINCREMENT_EXPR:
/* __objc_property_temp = [object property] + increment */
s1 = build_modify_expr (location, temp_variable_decl, NULL_TREE,
NOP_EXPR,
- location, build2 (PLUS_EXPR, TREE_TYPE (argument),
+ location, build2 (PLUS_EXPR, TREE_TYPE (argument),
argument, increment), NULL_TREE);
break;
case PREDECREMENT_EXPR:
/* __objc_property_temp = [object property] - increment */
s1 = build_modify_expr (location, temp_variable_decl, NULL_TREE,
NOP_EXPR,
- location, build2 (MINUS_EXPR, TREE_TYPE (argument),
+ location, build2 (MINUS_EXPR, TREE_TYPE (argument),
argument, increment), NULL_TREE);
break;
case POSTINCREMENT_EXPR:
default:
gcc_unreachable ();
}
-
+
/* s2: [object setProperty: __objc_property_temp <+/- increment>] */
switch (code)
{
- case PREINCREMENT_EXPR:
+ case PREINCREMENT_EXPR:
case PREDECREMENT_EXPR:
/* [object setProperty: __objc_property_temp] */
s2 = objc_build_setter_call (argument, temp_variable_decl);
case POSTINCREMENT_EXPR:
/* [object setProperty: __objc_property_temp + increment] */
s2 = objc_build_setter_call (argument,
- build2 (PLUS_EXPR, TREE_TYPE (argument),
+ build2 (PLUS_EXPR, TREE_TYPE (argument),
temp_variable_decl, increment));
break;
case POSTDECREMENT_EXPR:
/* [object setProperty: __objc_property_temp - increment] */
s2 = objc_build_setter_call (argument,
- build2 (MINUS_EXPR, TREE_TYPE (argument),
+ build2 (MINUS_EXPR, TREE_TYPE (argument),
temp_variable_decl, increment));
break;
default:
if (s2 == error_mark_node)
return error_mark_node;
- SET_EXPR_LOCATION (s2, location);
-
+ SET_EXPR_LOCATION (s2, location);
+
/* s3: __objc_property_temp */
s3 = convert (TREE_TYPE (argument), temp_variable_decl);
-
+
/* Now build the compound statement (s1, s2, s3) */
compound_expr = build_compound_expr (location, build_compound_expr (location, s1, s2), s3);
-2 Initialization;
-3 Comparison (LTYP and RTYP may match in either direction);
-4 Silent comparison (for C++ overload resolution);
- -5 Silent "specialization" comparison for RTYP to be a "specialization"
- of LTYP (a specialization means that RTYP is LTYP plus some constraints,
+ -5 Silent "specialization" comparison for RTYP to be a "specialization"
+ of LTYP (a specialization means that RTYP is LTYP plus some constraints,
so that each object of type RTYP is also of type LTYP). This is used
when comparing property types. */
if (!lproto && objc_is_object_id (ltyp))
return true;
}
-
+
pointers_compatible = (TYPE_MAIN_VARIANT (ltyp) == TYPE_MAIN_VARIANT (rtyp));
/* If the underlying types are the same, and at most one of them has
pointers_compatible
= (objc_is_object_id (ltyp) || objc_is_object_id (rtyp));
else
- pointers_compatible = objc_is_object_id (ltyp);
+ pointers_compatible = objc_is_object_id (ltyp);
}
if (!pointers_compatible)
variety and calls objc_common_type to obtain a common type. There is no commonolty
between two function-pointers in this regard. */
-bool
+bool
objc_have_common_type (tree ltyp, tree rtyp, int argno, tree callee)
{
if (objc_compare_types (ltyp, rtyp, argno, callee))
TREE_TYPE (type) = build_variant_type_copy (orig_pointee_type);
/* Set up the canonical type information. */
- TYPE_CANONICAL (type)
+ TYPE_CANONICAL (type)
= TYPE_CANONICAL (TYPE_POINTER_TO (orig_pointee_type));
TYPE_POINTER_TO (TREE_TYPE (type)) = type;
/* Declare struct _objc_fast_enumeration_state { ... }; */
build_fast_enumeration_state_template ();
-
+
/* void objc_enumeration_mutation (id) */
type = build_function_type_list (void_type_node,
objc_object_type, NULL_TREE);
- objc_enumeration_mutation_decl
- = add_builtin_function (TAG_ENUMERATION_MUTATION, type, 0, NOT_BUILT_IN,
+ objc_enumeration_mutation_decl
+ = add_builtin_function (TAG_ENUMERATION_MUTATION, type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (objc_enumeration_mutation_decl) = 0;
TREE_SET_CODE (string, STRING_CST);
length = TREE_STRING_LENGTH (string) - 1;
- /* The target may have different ideas on how to construct an ObjC string
- literal. On Darwin (Mac OS X), for example, we may wish to obtain a
+ /* The target may have different ideas on how to construct an ObjC string
+ literal. On Darwin (Mac OS X), for example, we may wish to obtain a
constant CFString reference instead.
At present, this is only supported for the NeXT runtime. */
- if (flag_next_runtime
+ if (flag_next_runtime
&& targetcm.objc_construct_string_object)
{
tree constructor = (*targetcm.objc_construct_string_object) (string);
{
*loc = desc = ggc_alloc_string_descriptor ();
desc->literal = string;
- desc->constructor =
+ desc->constructor =
(*runtime.build_const_string_constructor) (input_location, string, length);
}
#ifdef OBJCPLUS
pop_lang_context ();
#endif
- hash_class_name_enter (als_name_hash_list, alias_ident,
+ hash_class_name_enter (als_name_hash_list, alias_ident,
underlying_class);
}
}
if (! objc_is_class_name (identifier))
{
tree record = lookup_name (identifier), type = record;
-
+
if (record)
{
if (TREE_CODE (record) == TYPE_DECL)
type = DECL_ORIGINAL_TYPE (record)
? DECL_ORIGINAL_TYPE (record)
: TREE_TYPE (record);
-
+
if (!TYPE_HAS_OBJC_INFO (type)
|| !TYPE_OBJC_INTERFACE (type))
{
record);
}
}
-
+
record = xref_tag (RECORD_TYPE, identifier);
INIT_TYPE_OBJC_INFO (record);
/* In the case of a @class declaration, we store the ident in
NULL_TREE));
assemble_external (objc_assign_global_decl);
- return build_function_call (input_location,
+ return build_function_call (input_location,
objc_assign_global_decl, func_params);
}
bool
objc_detect_field_duplicates (bool check_superclasses_only)
{
- if (!objc_collecting_ivars || !objc_interface_context
+ if (!objc_collecting_ivars || !objc_interface_context
|| TREE_CODE (objc_interface_context) != CLASS_INTERFACE_TYPE)
return false;
/* We have two ways of doing this check:
-
+
"direct comparison": we iterate over the instance variables and
compare them directly. This works great for small numbers of
instance variables (such as 10 or 20), which are extremely common.
But it will potentially take forever for the pathological case with
a huge number (eg, 10k) of instance variables.
-
+
"hashtable": we use a hashtable, which requires a single sweep
through the list of instances variables. This is much slower for a
small number of variables, and we only use it for large numbers.
/* Exit if there is nothing to do. */
if (number_of_ivars_to_check == 0)
return true;
-
+
/* In case that there are only 1 or 2 instance variables to check,
we always use direct comparison. If there are more, it is
worth iterating over the instance variables in the superclass
}
/* We use a hashtable if we have over 10k comparisons. */
- if (number_of_ivars_to_check * (number_of_superclass_ivars
+ if (number_of_ivars_to_check * (number_of_superclass_ivars
+ (number_of_ivars_to_check / 2))
> 10000)
{
}
}
}
-
+
/* Now, we go through all the instance variables in the
class, and check that they are not in the
hashtable. */
}
}
}
-
+
/* This is the "direct comparison" approach, which is used in most
non-pathological cases. */
{
if (check_superclasses_only)
interface = lookup_interface (CLASS_SUPER_NAME (interface));
-
+
for ( ; interface; interface = lookup_interface
(CLASS_SUPER_NAME (interface)))
{
ivar_being_checked = DECL_CHAIN (ivar_being_checked))
{
tree decl;
-
+
/* Ignore anonymous ivars. */
if (DECL_NAME (ivar_being_checked) == NULL_TREE)
continue;
&& TYPE_OBJC_PROTOCOL_LIST (TREE_TYPE (type)))
{
error ("@catch parameter can not be protocol-qualified");
- type = error_mark_node;
+ type = error_mark_node;
}
else if (POINTER_TYPE_P (type) && objc_is_object_id (TREE_TYPE (type)))
/* @catch (id xyz) or @catch (...) but we note this for runtimes that
them and get a simple pointer to the class. */
bool is_typedef = false;
tree x = TYPE_MAIN_VARIANT (type);
-
+
/* Skip from the pointer to the pointee. */
if (TREE_CODE (x) == POINTER_TYPE)
x = TREE_TYPE (x);
-
+
/* Traverse typedef aliases */
while (TREE_CODE (x) == RECORD_TYPE && OBJC_TYPE_NAME (x)
&& TREE_CODE (OBJC_TYPE_NAME (x)) == TYPE_DECL
object_expr = error_mark_node;
}
}
-
+
if (object_expr == error_mark_node)
{
/* If we found an error, we simply ignore the '@synchronized'.
tree call;
tree args;
- /* objc_sync_enter (object_expr); */
+ /* objc_sync_enter (object_expr); */
object_expr = save_expr (object_expr);
args = tree_cons (NULL, object_expr, NULL);
call = build_function_call (input_location,
/* @try { body; } */
objc_begin_try_stmt (start_locus, body);
-
+
/* @finally { objc_sync_exit (object_expr); } */
objc_build_finally_clause (input_location, call);
-
+
/* End of try statement. */
return objc_finish_try_stmt ();
}
For example, take the Objective-C method
- -(NSString *)pathForResource:(NSString *)resource ofType:(NSString *)type;
+ -(NSString *)pathForResource:(NSString *)resource ofType:(NSString *)type;
the two fragments "pathForResource:(NSString *)resource" and
"ofType:(NSString *)type" will generate a KEYWORD_DECL each. The
'arg_name' is an identifier node and is required.
'attributes' is an optional tree containing parameter attributes. */
tree
-objc_build_keyword_decl (tree key_name, tree arg_type,
+objc_build_keyword_decl (tree key_name, tree arg_type,
tree arg_name, tree attributes)
{
tree keyword_decl;
for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute))
{
tree name = TREE_PURPOSE (attribute);
-
+
if (is_attribute_p ("deprecated", name)
|| is_attribute_p ("sentinel", name)
|| is_attribute_p ("noreturn", name))
{
/* An attribute that we support; add it to the filtered
attributes. */
- filtered_attributes = chainon (filtered_attributes,
+ filtered_attributes = chainon (filtered_attributes,
copy_node (attribute));
}
else if (is_attribute_p ("format", name))
&& TREE_CODE (number) == INTEGER_CST
&& TREE_INT_CST_HIGH (number) == 0)
{
- TREE_VALUE (second_argument)
+ TREE_VALUE (second_argument)
= build_int_cst (integer_type_node,
TREE_INT_CST_LOW (number) + 2);
}
-
+
/* This is the third argument, the "first-to-check",
which specifies the index of the first argument to
check. This could be 0, meaning it is not available,
&& TREE_INT_CST_HIGH (number) == 0
&& TREE_INT_CST_LOW (number) != 0)
{
- TREE_VALUE (third_argument)
+ TREE_VALUE (third_argument)
= build_int_cst (integer_type_node,
TREE_INT_CST_LOW (number) + 2);
}
(by setting TREE_DEPRECATED and TREE_THIS_VOLATILE) so there
is nothing to do. */
tree saved_type = TREE_TYPE (*node);
- TREE_TYPE (*node) = build_function_type
+ TREE_TYPE (*node) = build_function_type
(TREE_VALUE (saved_type), get_arg_type_list (*node, METHOD_REF, 0));
decl_attributes (node, filtered_attributes, flags);
METHOD_TYPE_ATTRIBUTES (*node) = TYPE_ATTRIBUTES (TREE_TYPE (*node));
}
}
-bool
+bool
objc_method_decl (enum tree_code opcode)
{
return opcode == INSTANCE_METHOD_DECL || opcode == CLASS_METHOD_DECL;
if (!rtype || TREE_CODE (rtype) == IDENTIFIER_NODE)
{
rtype = NULL_TREE;
- /* We could not find an @interface declaration, yet Message maybe in a
+ /* We could not find an @interface declaration, yet Message maybe in a
@class's protocol. */
if (!method_prototype && rprotos)
method_prototype
= lookup_method_in_hash_lists (sel_name, class_tree != NULL_TREE);
}
- if (!method_prototype)
+ if (!method_prototype)
{
static bool warn_missing_methods = false;
if (!warn_missing_methods)
{
- warning_at (input_location,
+ warning_at (input_location,
0, "(Messages without a matching method signature");
- warning_at (input_location,
+ warning_at (input_location,
0, "will be assumed to return %<id%> and accept");
- warning_at (input_location,
+ warning_at (input_location,
0, "%<...%> as arguments.)");
warn_missing_methods = true;
}
current_objc_message_selector = sel_name;
/* Build the method call.
- TODO: Get the location from somewhere that will work for delayed
+ TODO: Get the location from somewhere that will work for delayed
expansion. */
-
+
retval = (*runtime.build_objc_method_call) (input_location, method_prototype,
receiver, rtype, sel_name,
method_params, super);
}
\f
-/* This routine creates a static variable used to implement @protocol(MyProtocol)
+/* This routine creates a static variable used to implement @protocol(MyProtocol)
expression. This variable will be initialized to global protocol_t meta-data
pointer. */
}
else
{
- /* If an instance method was not found, return 0. */
+ /* If an instance method was not found, return 0. */
return NULL_TREE;
}
}
existing_method = lookup_method (PROTOCOL_OPTIONAL_CLS_METHODS (klass), method);
else
existing_method = lookup_method (PROTOCOL_OPTIONAL_NST_METHODS (klass), method);
-
+
if (!is_optional && existing_method)
{
error ("method %<%c%E%> declared %<@optional%> and %<@required%> at the same time",
VISIBILITY is 1 for public, 0 for protected, and 2 for private. */
static tree
-add_instance_variable (tree klass, objc_ivar_visibility_kind visibility,
+add_instance_variable (tree klass, objc_ivar_visibility_kind visibility,
tree field_decl)
{
tree field_type = TREE_TYPE (field_decl);
error ("instance variable %qs uses flexible array member",
printable_ivar_name (field_decl));
/* Return class as is without adding this ivar. */
- return klass;
+ return klass;
}
#endif
while (CLASS_SUPER_NAME (klass))
{
klass = lookup_interface (CLASS_SUPER_NAME (klass));
-
+
decl_chain = CLASS_RAW_IVARS (klass);
-
+
for ( ; decl_chain; decl_chain = DECL_CHAIN (decl_chain))
if (DECL_NAME (decl_chain) == ivar_name_ident)
return decl_chain;
&& (PROPERTY_GETTER_NAME (x) == METHOD_SEL_NAME (chain)
|| PROPERTY_SETTER_NAME (x) == METHOD_SEL_NAME (chain)))
break;
-
+
if (x != NULL_TREE)
{
chain = TREE_CHAIN (chain); /* next method... */
if (lookup_method (CLASS_NST_METHODS (interface), chain))
{
chain = DECL_CHAIN (chain);
- continue;
+ continue;
}
/* Else, get the superclass. */
&& (PROPERTY_GETTER_NAME (x) == METHOD_SEL_NAME (chain)
|| PROPERTY_SETTER_NAME (x) == METHOD_SEL_NAME (chain)))
break;
-
+
if (x != NULL_TREE)
{
chain = TREE_CHAIN (chain); /* next method... */
continue;
- }
+ }
context = base_context;
while (context)
if (super)
super_interface = lookup_interface (super);
-
+
if (!super_interface)
{
error ("cannot find interface declaration for %qE, superclass of %qE",
else
{
if (TREE_DEPRECATED (super_interface))
- warning (OPT_Wdeprecated_declarations, "class %qE is deprecated",
+ warning (OPT_Wdeprecated_declarations, "class %qE is deprecated",
super);
super_name = super;
}
case CLASS_IMPLEMENTATION_TYPE:
{
tree chain;
-
+
for (chain = implemented_classes; chain; chain = TREE_CHAIN (chain))
if (TREE_VALUE (chain) == class_name)
{
#endif
else
add_class (klass, class_name);
-
+
if (protocol_list)
CLASS_PROTOCOL_LIST (klass)
= lookup_and_install_protocols (protocol_list, /* definition_required */ true);
for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute))
{
tree name = TREE_PURPOSE (attribute);
-
+
/* TODO: Document what the objc_exception attribute is/does. */
/* We handle the 'deprecated' and (undocumented) 'objc_exception'
attributes. */
}
TYPE_ATTRIBUTES (klass) = attributes;
}
- break;
+ break;
case CATEGORY_INTERFACE_TYPE:
{
tree class_category_is_assoc_with;
-
+
/* For a category, class_name is really the name of the class that
the following set of methods will be associated with. We must
find the interface so that can derive the objects template. */
else
{
if (TREE_DEPRECATED (class_category_is_assoc_with))
- warning (OPT_Wdeprecated_declarations, "class %qE is deprecated",
+ warning (OPT_Wdeprecated_declarations, "class %qE is deprecated",
class_name);
if (super_name == NULL_TREE)
else
{
add_category (class_category_is_assoc_with, klass);
-
+
if (protocol_list)
CLASS_PROTOCOL_LIST (klass)
= lookup_and_install_protocols
}
}
break;
-
+
case CATEGORY_IMPLEMENTATION_TYPE:
/* Reset for multiple classes per file. */
method_slot = 0;
if (CLASS_RAW_IVARS (klass))
check_ivars (implementation_template, klass);
-
+
/* code generation */
#ifdef OBJCPLUS
push_lang_context (lang_name_c);
#ifdef OBJCPLUS
pop_lang_context ();
#endif /* OBJCPLUS */
-
+
return get_class_ivars (implementation_template, true);
break;
}
/* This routine prepares the declarations of the property accessor
helper functions (objc_getProperty(), etc) that are used when
- @synthesize is used.
-
- runtime-specific routines are built in the respective runtime
+ @synthesize is used.
+
+ runtime-specific routines are built in the respective runtime
initialize functions. */
-static void
+static void
build_common_objc_property_accessor_helpers (void)
{
tree type;
/* Declare the following function:
id
- objc_getProperty (id self, SEL _cmd,
+ objc_getProperty (id self, SEL _cmd,
ptrdiff_t offset, BOOL is_atomic); */
type = build_function_type_list (objc_object_type,
objc_object_type,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (objc_getProperty_decl) = 0;
-
+
/* Declare the following function:
void
- objc_setProperty (id self, SEL _cmd,
- ptrdiff_t offset, id new_value,
+ objc_setProperty (id self, SEL _cmd,
+ ptrdiff_t offset, id new_value,
BOOL is_atomic, BOOL should_copy); */
type = build_function_type_list (void_type_node,
objc_object_type,
while (interface)
{
tree decl_chain;
-
+
for (decl_chain = CLASS_IVARS (interface); decl_chain; decl_chain = DECL_CHAIN (decl_chain))
if (DECL_NAME (decl_chain) == instance_variable_name)
return decl_chain;
-
+
/* Not found. Search superclass if any. */
if (CLASS_SUPER_NAME (interface))
interface = lookup_interface (CLASS_SUPER_NAME (interface));
}
-
+
return NULL_TREE;
}
(NULL_TREE, is_atomic, NULL_TREE)))));
}
break;
- case OBJC_PROPERTY_ASSIGN:
+ case OBJC_PROPERTY_ASSIGN:
if (PROPERTY_NONATOMIC (property))
{
/* We build "return self->PROPERTY_IVAR_NAME;" */
size_of = c_sizeof_or_alignof_type (location, TREE_TYPE (property),
true /* is_sizeof */,
false /* complain */);
-
+
if (PROPERTY_NONATOMIC (property))
is_atomic = boolean_false_node;
else
is_atomic = boolean_true_node;
-
+
if (objc_copyStruct_decl)
function_decl = objc_copyStruct_decl;
else
here causes invalid code to be generated. */
(NULL_TREE, build_unary_op (location, ADDR_EXPR, objc_property_temp_decl, 0),
tree_cons /* &(self->PROPERTY_IVAR_NAME); */
- (NULL_TREE, build_fold_addr_expr_loc (location,
- objc_lookup_ivar
+ (NULL_TREE, build_fold_addr_expr_loc (location,
+ objc_lookup_ivar
(NULL_TREE, PROPERTY_IVAR_NAME (property))),
tree_cons /* sizeof (PROPERTY_IVAR) */
(NULL_TREE, size_of,
is_atomic = boolean_false_node;
else
is_atomic = boolean_true_node;
-
+
if (PROPERTY_ASSIGN_SEMANTICS (property) == OBJC_PROPERTY_COPY)
should_copy = boolean_true_node;
else
tree_cons /* new_value */
(NULL_TREE, new_value,
tree_cons /* is_atomic */
- (NULL_TREE, is_atomic,
+ (NULL_TREE, is_atomic,
tree_cons /* should_copy */
(NULL_TREE, should_copy, NULL_TREE)))))));
}
break;
- case OBJC_PROPERTY_ASSIGN:
+ case OBJC_PROPERTY_ASSIGN:
if (PROPERTY_NONATOMIC (property))
{
/* We build "self->PROPERTY_IVAR_NAME = new_value;" */
statement = build_modify_expr
(location,
objc_lookup_ivar (NULL_TREE, PROPERTY_IVAR_NAME (property)),
- NULL_TREE, NOP_EXPR,
+ NULL_TREE, NOP_EXPR,
location, new_value, NULL_TREE);
break;
}
size_of = c_sizeof_or_alignof_type (location, TREE_TYPE (property),
true /* is_sizeof */,
false /* complain */);
-
+
if (PROPERTY_NONATOMIC (property))
is_atomic = boolean_false_node;
else
is_atomic = boolean_true_node;
-
+
if (objc_copyStruct_decl)
function_decl = objc_copyStruct_decl;
else
function_decl = objc_setPropertyStruct_decl;
- statement = build_function_call
+ statement = build_function_call
(location,
/* Function prototype. */
function_decl,
/* Parameters. */
tree_cons /* &(self->PROPERTY_IVAR_NAME); */
- (NULL_TREE, build_fold_addr_expr_loc (location,
- objc_lookup_ivar
+ (NULL_TREE, build_fold_addr_expr_loc (location,
+ objc_lookup_ivar
(NULL_TREE, PROPERTY_IVAR_NAME (property))),
tree_cons /* &new_value */
(NULL_TREE, build_fold_addr_expr_loc (location, new_value),
}
gcc_assert (statement);
- add_stmt (statement);
+ add_stmt (statement);
add_stmt (c_end_compound_stmt (location, body, true));
fn = current_function_decl;
#ifdef OBJCPLUS
if (PROPERTY_NAME (property) == property_name)
{
location_t original_location = DECL_SOURCE_LOCATION (property);
-
+
if (PROPERTY_DYNAMIC (property))
- error_at (location, "property %qs already specified in %<@dynamic%>",
+ error_at (location, "property %qs already specified in %<@dynamic%>",
IDENTIFIER_POINTER (property_name));
else
- error_at (location, "property %qs already specified in %<@synthesize%>",
+ error_at (location, "property %qs already specified in %<@synthesize%>",
IDENTIFIER_POINTER (property_name));
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
if (!property)
{
- error_at (location, "no declaration of property %qs found in the interface",
+ error_at (location, "no declaration of property %qs found in the interface",
IDENTIFIER_POINTER (property_name));
return;
}
tree type_of_ivar;
if (!ivar)
{
- error_at (location, "ivar %qs used by %<@synthesize%> declaration must be an existing ivar",
+ error_at (location, "ivar %qs used by %<@synthesize%> declaration must be an existing ivar",
IDENTIFIER_POINTER (property_name));
return;
}
type_of_ivar = DECL_BIT_FIELD_TYPE (ivar);
else
type_of_ivar = TREE_TYPE (ivar);
-
+
/* If the instance variable has a different C type, we throw an error ... */
if (!comptypes (TREE_TYPE (property), type_of_ivar)
/* ... unless the property is readonly, in which case we allow
type_of_ivar, -5, NULL_TREE)))
{
location_t original_location = DECL_SOURCE_LOCATION (ivar);
-
+
error_at (location, "property %qs is using instance variable %qs of incompatible type",
IDENTIFIER_POINTER (property_name),
IDENTIFIER_POINTER (ivar_name));
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
}
if (PROPERTY_ASSIGN_SEMANTICS (property) != OBJC_PROPERTY_ASSIGN)
{
location_t original_location = DECL_SOURCE_LOCATION (ivar);
-
+
error_at (location, "'assign' property %qs is using bit-field instance variable %qs",
IDENTIFIER_POINTER (property_name),
IDENTIFIER_POINTER (ivar_name));
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
if (!PROPERTY_NONATOMIC (property))
{
location_t original_location = DECL_SOURCE_LOCATION (ivar);
-
+
error_at (location, "'atomic' property %qs is using bit-field instance variable %qs",
IDENTIFIER_POINTER (property_name),
IDENTIFIER_POINTER (ivar_name));
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
return;
if (PROPERTY_IVAR_NAME (x) == ivar_name)
{
location_t original_location = DECL_SOURCE_LOCATION (x);
-
+
error_at (location, "property %qs is using the same instance variable as property %qs",
IDENTIFIER_POINTER (property_name),
IDENTIFIER_POINTER (PROPERTY_NAME (x)));
-
+
if (original_location != UNKNOWN_LOCATION)
inform (original_location, "originally specified here");
-
+
/* We keep going on. This won't cause the compiler to fail;
the failure would most likely be at runtime. */
}
PROPERTY_IVAR_NAME to a non-NULL_TREE. You can recognize a
@synthesize by that. */
PROPERTY_IVAR_NAME (property) = ivar_name;
-
+
/* PROPERTY_SETTER_NAME and PROPERTY_GETTER_NAME are copied from the
original declaration; they are always set (with the exception of
PROPERTY_SETTER_NAME not being set if PROPERTY_READONLY == 1). */
if (!interface)
{
/* I can't see how this could happen, but it is good as a safety check. */
- error_at (location,
+ error_at (location,
"%<@synthesize%> requires the @interface of the class to be available");
return;
}
/* Now, iterate over the properties and do each of them. */
for (chain = property_and_ivar_list; chain; chain = TREE_CHAIN (chain))
{
- objc_add_synthesize_declaration_for_property (location, interface, TREE_VALUE (chain),
+ objc_add_synthesize_declaration_for_property (location, interface, TREE_VALUE (chain),
TREE_PURPOSE (chain));
}
}
if (PROPERTY_NAME (property) == property_name)
{
location_t original_location = DECL_SOURCE_LOCATION (property);
-
+
if (PROPERTY_DYNAMIC (property))
- error_at (location, "property %qs already specified in %<@dynamic%>",
+ error_at (location, "property %qs already specified in %<@dynamic%>",
IDENTIFIER_POINTER (property_name));
else
error_at (location, "property %qs already specified in %<@synthesize%>",
interface = lookup_interface (CLASS_NAME (objc_implementation_context));
break;
case CATEGORY_IMPLEMENTATION_TYPE:
- interface = lookup_category (implementation_template,
+ interface = lookup_category (implementation_template,
CLASS_SUPER_NAME (objc_implementation_context));
break;
default:
}
}
-/* Main routine to generate code/data for all the property information for
+/* Main routine to generate code/data for all the property information for
current implementation (class or category). CLASS is the interface where
ivars are declared. CLASS_METHODS is where methods are found which
could be a class or a category depending on whether we are implementing
/* @dynamic property - nothing to check or synthesize. */
if (PROPERTY_DYNAMIC (x))
continue;
-
+
/* @synthesize property - need to synthesize the accessors. */
if (PROPERTY_IVAR_NAME (x))
{
objc_synthesize_getter (klass, class_methods, x);
-
+
if (PROPERTY_READONLY (x) == 0)
objc_synthesize_setter (klass, class_methods, x);
case CLASS_IMPLEMENTATION_TYPE:
{
/* All metadata generation is done in runtime.generate_metadata(). */
-
+
/* Generate what needed for property; setters, getters, etc. */
objc_gen_property_data (implementation_template, implementation_template);
case CATEGORY_IMPLEMENTATION_TYPE:
{
tree category = lookup_category (implementation_template, CLASS_SUPER_NAME (klass));
-
+
if (category)
{
/* Generate what needed for property; setters, getters, etc. */
objc_implementation_context, '+');
check_methods (CLASS_NST_METHODS (category),
objc_implementation_context, '-');
-
+
if (CLASS_PROTOCOL_LIST (category))
check_protocols (CLASS_PROTOCOL_LIST (category),
"category",
and if not, we declare one ourselves. */
tree getter_decl = lookup_method (CLASS_NST_METHODS (klass),
PROPERTY_GETTER_NAME (x));
-
+
if (getter_decl)
{
/* TODO: Check that the declaration is consistent with the property. */
will be of the form
-(type)property_getter_name; */
tree rettype = build_tree_list (NULL_TREE, TREE_TYPE (x));
- getter_decl = build_method_decl (INSTANCE_METHOD_DECL,
- rettype, PROPERTY_GETTER_NAME (x),
+ getter_decl = build_method_decl (INSTANCE_METHOD_DECL,
+ rettype, PROPERTY_GETTER_NAME (x),
NULL_TREE, false);
if (PROPERTY_OPTIONAL (x))
objc_add_method (objc_interface_context, getter_decl, false, true);
{
/* Now we check that the appropriate setter is declared,
and if not, we declare on ourselves. */
- tree setter_decl = lookup_method (CLASS_NST_METHODS (klass),
+ tree setter_decl = lookup_method (CLASS_NST_METHODS (klass),
PROPERTY_SETTER_NAME (x));
-
+
if (setter_decl)
{
/* TODO: Check that the declaration is consistent with the property. */
size_t length = strlen (full_setter_name);
char *setter_name = (char *) alloca (length);
tree ret_type, selector, arg_type, arg_name;
-
+
strcpy (setter_name, full_setter_name);
setter_name[length - 1] = '\0';
ret_type = build_tree_list (NULL_TREE, void_type_node);
arg_name = get_identifier ("_value");
selector = objc_build_keyword_decl (get_identifier (setter_name),
arg_type, arg_name, NULL);
- setter_decl = build_method_decl (INSTANCE_METHOD_DECL,
+ setter_decl = build_method_decl (INSTANCE_METHOD_DECL,
ret_type, selector,
build_tree_list (NULL_TREE, NULL_TREE),
false);
objc_add_method (objc_interface_context, setter_decl, false, false);
TREE_DEPRECATED (setter_decl) = TREE_DEPRECATED (x);
METHOD_PROPERTY_CONTEXT (setter_decl) = x;
- }
+ }
}
}
break;
/* It would be nice to use warn_deprecated_use() here, but
we are using TREE_CHAIN (which is supposed to be the
TYPE_STUB_DECL for a TYPE) for something different. */
- warning (OPT_Wdeprecated_declarations, "protocol %qE is deprecated",
+ warning (OPT_Wdeprecated_declarations, "protocol %qE is deprecated",
PROTOCOL_NAME (chain));
}
for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute))
{
tree name = TREE_PURPOSE (attribute);
-
+
if (is_attribute_p ("deprecated", name))
deprecated = true;
else
/* definition_required */ false) == NULL_TREE)
{
tree protocol = make_node (PROTOCOL_INTERFACE_TYPE);
-
+
TYPE_LANG_SLOT_1 (protocol)
= make_tree_vec (PROTOCOL_LANG_SLOT_ELTS);
PROTOCOL_NAME (protocol) = name;
add_protocol (protocol);
PROTOCOL_DEFINED (protocol) = 0;
PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
-
+
if (attributes)
{
/* TODO: Do we need to store the attributes here ? */
for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute))
{
tree name = TREE_PURPOSE (attribute);
-
+
if (is_attribute_p ("deprecated", name))
deprecated = true;
else
identical. */
if (type1 == NULL_TREE && type2 == NULL_TREE)
return 1;
-
+
/* If one has protocols, and the other one hasn't, they are not
identical. */
if ((type1 == NULL_TREE && type2 != NULL_TREE)
for (t = type2; t; t = TREE_CHAIN (t))
if (!lookup_protocol_in_reflist (type1, TREE_VALUE (t)))
return 0;
-
+
for (t = type1; t; t = TREE_CHAIN (t))
if (!lookup_protocol_in_reflist (type2, TREE_VALUE (t)))
return 0;
-
+
return 1;
}
}
{
type1 = TREE_VALUE (TREE_TYPE (arg1));
type2 = TREE_VALUE (TREE_TYPE (arg2));
-
+
/* FIXME: Do we need to decay argument types to compare them ? */
type1 = objc_decay_parm_type (type1);
type2 = objc_decay_parm_type (type2);
-
+
if (!objc_types_are_equivalent (type1, type2)
&& (strict || !objc_types_share_size_and_alignment (type1, type2)))
return 0;
}
-
+
/* The loop ends when arg1 or arg2 are NULL. Make sure they are
both NULL. */
if (arg1 != arg2)
{
type1 = TREE_TYPE (TREE_VALUE (arg1));
type2 = TREE_TYPE (TREE_VALUE (arg2));
-
+
/* FIXME: Do we need to decay argument types to compare them ? */
type1 = objc_decay_parm_type (type1);
type2 = objc_decay_parm_type (type2);
-
+
if (!objc_types_are_equivalent (type1, type2)
&& (strict || !objc_types_share_size_and_alignment (type1, type2)))
return 0;
}
}
-
+
/* The loop ends when arg1 or arg2 are NULL. Make sure they are
both NULL. */
if (arg1 != arg2)
if (interface)
objc_add_method (interface, copy_node (method),
- TREE_CODE (method) == CLASS_METHOD_DECL,
+ TREE_CODE (method) == CLASS_METHOD_DECL,
/* is_optional= */ false);
}
}
DECL_READ_P (UOBJC_SUPER_decl) = 1;
lang_hooks.decls.pushdecl (UOBJC_SUPER_decl);
finish_decl (UOBJC_SUPER_decl, input_location, NULL_TREE, NULL_TREE,
- NULL_TREE);
+ NULL_TREE);
UOBJC_SUPER_scope = objc_get_current_scope ();
}
inst_meth = (TREE_CODE (objc_method_context) == INSTANCE_METHOD_DECL);
if (TREE_CODE (objc_implementation_context) == CLASS_IMPLEMENTATION_TYPE)
- class_expr = (*runtime.get_class_super_ref) (input_location,
+ class_expr = (*runtime.get_class_super_ref) (input_location,
imp_list, inst_meth);
else
/* We have a category. */
return error_mark_node;
}
- super_class = (*runtime.get_category_super_ref) (input_location,
+ super_class = (*runtime.get_category_super_ref) (input_location,
imp_list, inst_meth);
- class_expr = build_c_cast (input_location,
+ class_expr = build_c_cast (input_location,
TREE_TYPE (super_expr), super_class);
}
- super_expr = build_modify_expr (input_location, super_expr, NULL_TREE,
+ super_expr = build_modify_expr (input_location, super_expr, NULL_TREE,
NOP_EXPR,
input_location, class_expr, NULL_TREE);
- super_expr_list = build_compound_expr (input_location,
+ super_expr_list = build_compound_expr (input_location,
super_expr_list, super_expr);
- super_expr = build_unary_op (input_location,
+ super_expr = build_unary_op (input_location,
ADDR_EXPR, UOBJC_SUPER_decl, 0);
super_expr_list = build_compound_expr (input_location,
super_expr_list, super_expr);
type = DECL_NAME (type);
strcat (errbuf, TREE_CODE (type) == IDENTIFIER_NODE
- ? IDENTIFIER_POINTER (type)
+ ? IDENTIFIER_POINTER (type)
: "");
/* For 'id' and 'Class', adopted protocols are stored in the pointee. */
{
if (category_name)
{
- char *result = XNEWVEC (char, strlen (class_name) + strlen (category_name)
+ char *result = XNEWVEC (char, strlen (class_name) + strlen (category_name)
+ strlen (selector) + 7);
if (is_class_method)
else
sprintf (result, "-[%s %s]", class_name, selector);
- return result;
+ return result;
}
}
#endif
is impossible to disambiguate. */
for (; *cp; cp++)
if (*cp == '_')
- *cp = ':';
+ *cp = ':';
}
*cp++ = ']'; /* closing right brace */
*cp++ = 0; /* string terminator */
return IDENTIFIER_POINTER (DECL_NAME (decl));
}
-/* Routine is called to issue diagnostic when reference to a private
- ivar is made and no other variable with same name is found in
+/* Routine is called to issue diagnostic when reference to a private
+ ivar is made and no other variable with same name is found in
current scope. */
bool
objc_diagnose_private_ivar (tree id)
ivar = is_ivar (objc_ivar_chain, id);
if (ivar && is_private (ivar))
{
- error ("instance variable %qs is declared private",
+ error ("instance variable %qs is declared private",
IDENTIFIER_POINTER (id));
return true;
}
/* Look up the ivar, but do not use it if it is not accessible. */
ivar = is_ivar (objc_ivar_chain, id);
-
+
if (!ivar || is_private (ivar))
return other;
}
#endif
gcc_assert (TREE_CODE (call_exp) == CALL_EXPR);
-
+
*expr_p = call_exp;
}
is_gimple_val, fb_rvalue);
r1 = gimplify_expr (&OBJ_TYPE_REF_EXPR (*expr_p), pre_p, post_p,
is_gimple_val, fb_rvalue);
-
+
return MIN (r0, r1);
}
break;
};
Confusingly enough, NSFastEnumeration is then defined by libraries
- to be the same structure.
+ to be the same structure.
*/
static void
tree decls, *chain = NULL;
/* { */
- objc_fast_enumeration_state_template = objc_start_struct (get_identifier
+ objc_fast_enumeration_state_template = objc_start_struct (get_identifier
(TAG_FAST_ENUMERATION_STATE));
/* unsigned long state; */
decls = add_field_decl (long_unsigned_type_node, "state", &chain);
/* id *itemsPtr; */
- add_field_decl (build_pointer_type (objc_object_type),
+ add_field_decl (build_pointer_type (objc_object_type),
"itemsPtr", &chain);
/* unsigned long *mutationsPtr; */
- add_field_decl (build_pointer_type (long_unsigned_type_node),
+ add_field_decl (build_pointer_type (long_unsigned_type_node),
"mutationsPtr", &chain);
/* unsigned long extra[5]; */
- add_field_decl (build_sized_array_type (long_unsigned_type_node, 5),
+ add_field_decl (build_sized_array_type (long_unsigned_type_node, 5),
"extra", &chain);
/* } */
'continue').
The syntax is
-
+
for (<object expression> in <collection expression>)
<statements>
__objc_foreach_collection = <collection expression>;
__objc_foreach_enum_state = { 0 };
__objc_foreach_batchsize = [__objc_foreach_collection countByEnumeratingWithState: &__objc_foreach_enum_state objects: __objc_foreach_items count: 16];
-
+
if (__objc_foreach_batchsize == 0)
<object expression> = nil;
else
the user expects to 'continue' or 'break' the entire foreach loop.
We are provided the labels that 'break' and 'continue' jump to, so
we place them where we want them to jump to when they pick them.
-
+
Optimization TODO: we could cache the IMP of
countByEnumeratingWithState:objects:count:.
*/
#endif
void
-objc_finish_foreach_loop (location_t location, tree object_expression, tree collection_expression, tree for_body,
+objc_finish_foreach_loop (location_t location, tree object_expression, tree collection_expression, tree for_body,
tree break_label, tree continue_label)
{
/* A tree representing the __objcFastEnumerationState struct type,
if (DECL_ORIGINAL_TYPE (objc_NSFastEnumeration_type))
objc_fast_enumeration_state_type = DECL_ORIGINAL_TYPE (objc_NSFastEnumeration_type);
else
- objc_fast_enumeration_state_type = TREE_TYPE (objc_NSFastEnumeration_type);
+ objc_fast_enumeration_state_type = TREE_TYPE (objc_NSFastEnumeration_type);
}
}
}
bind = build3 (BIND_EXPR, void_type_node, objc_foreach_batchsize_decl, NULL, NULL);
SET_EXPR_LOCATION (bind, location);
TREE_SIDE_EFFECTS (bind) = 1;
-
+
/* __objc_foreach_collection = <collection expression>; */
t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_collection_decl, collection_expression);
SET_EXPR_LOCATION (t, location);
mark_exp_read (collection_expression);
/* __objc_foreach_enum_state.state = 0; */
- t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl,
+ t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl,
get_identifier ("state")),
build_int_cst (long_unsigned_type_node, 0));
SET_EXPR_LOCATION (t, location);
append_to_statement_list (t, &BIND_EXPR_BODY (bind));
/* __objc_foreach_enum_state.itemsPtr = NULL; */
- t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl,
+ t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl,
get_identifier ("itemsPtr")),
null_pointer_node);
SET_EXPR_LOCATION (t, location);
append_to_statement_list (t, &BIND_EXPR_BODY (bind));
/* __objc_foreach_enum_state.mutationsPtr = NULL; */
- t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl,
+ t = build2 (MODIFY_EXPR, void_type_node, objc_build_component_ref (objc_foreach_enum_state_decl,
get_identifier ("mutationsPtr")),
null_pointer_node);
SET_EXPR_LOCATION (t, location);
for (i = 0; i < 5 ; i++)
{
t = build2 (MODIFY_EXPR, void_type_node,
- build_array_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl,
+ build_array_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl,
get_identifier ("extra")),
build_int_cst (NULL_TREE, i)),
build_int_cst (long_unsigned_type_node, 0));
SET_EXPR_LOCATION (t, location);
append_to_statement_list (t, &BIND_EXPR_BODY (bind));
}
-
+
/* __objc_foreach_batchsize = [__objc_foreach_collection countByEnumeratingWithState: &__objc_foreach_enum_state objects: __objc_foreach_items count: 16]; */
selector_name = get_identifier ("countByEnumeratingWithState:objects:count:");
#ifdef OBJCPLUS
append_to_statement_list (t, &BIND_EXPR_BODY (bind));
/* if (__objc_foreach_batchsize == 0) */
- first_if = build3 (COND_EXPR, void_type_node,
+ first_if = build3 (COND_EXPR, void_type_node,
/* Condition. */
- c_fully_fold
- (c_common_truthvalue_conversion
- (location,
+ c_fully_fold
+ (c_common_truthvalue_conversion
+ (location,
build_binary_op (location,
- EQ_EXPR,
+ EQ_EXPR,
objc_foreach_batchsize_decl,
build_int_cst (long_unsigned_type_node, 0), 1)),
false, NULL),
TREE_SIDE_EFFECTS (first_else) = 1;
/* __objc_foreach_mutations_pointer = *__objc_foreach_enum_state.mutationsPtr; */
- t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_mutations_pointer_decl,
- build_indirect_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl,
+ t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_mutations_pointer_decl,
+ build_indirect_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl,
get_identifier ("mutationsPtr")),
RO_UNARY_STAR));
SET_EXPR_LOCATION (t, location);
/* next_batch: */
next_batch_label_decl = create_artificial_label (location);
- t = build1 (LABEL_EXPR, void_type_node, next_batch_label_decl);
+ t = build1 (LABEL_EXPR, void_type_node, next_batch_label_decl);
SET_EXPR_LOCATION (t, location);
append_to_statement_list (t, &BIND_EXPR_BODY (first_else));
-
+
/* { */
/* unsigned long __objc_foreach_index; */
append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind));
/* if (__objc_foreach_mutation_pointer != *__objc_foreach_enum_state.mutationsPtr) objc_enumeration_mutation (<collection expression>); */
- t = build3 (COND_EXPR, void_type_node,
+ t = build3 (COND_EXPR, void_type_node,
/* Condition. */
- c_fully_fold
- (c_common_truthvalue_conversion
- (location,
- build_binary_op
+ c_fully_fold
+ (c_common_truthvalue_conversion
+ (location,
+ build_binary_op
(location,
- NE_EXPR,
+ NE_EXPR,
objc_foreach_mutations_pointer_decl,
- build_indirect_ref (location,
- objc_build_component_ref (objc_foreach_enum_state_decl,
+ build_indirect_ref (location,
+ objc_build_component_ref (objc_foreach_enum_state_decl,
get_identifier ("mutationsPtr")),
RO_UNARY_STAR), 1)),
false, NULL),
append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind));
/* <object expression> = enumState.itemsPtr[__objc_foreach_index]; */
- t = build2 (MODIFY_EXPR, void_type_node, object_expression,
- build_array_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl,
+ t = build2 (MODIFY_EXPR, void_type_node, object_expression,
+ build_array_ref (location, objc_build_component_ref (objc_foreach_enum_state_decl,
get_identifier ("itemsPtr")),
objc_foreach_index_decl));
SET_EXPR_LOCATION (t, location);
}
/* __objc_foreach_index++; */
- t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_index_decl,
+ t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_index_decl,
build_binary_op (location,
PLUS_EXPR,
objc_foreach_index_decl,
append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind));
/* if (__objc_foreach_index < __objc_foreach_batchsize) goto next_object; */
- t = build3 (COND_EXPR, void_type_node,
+ t = build3 (COND_EXPR, void_type_node,
/* Condition. */
- c_fully_fold
- (c_common_truthvalue_conversion
- (location,
+ c_fully_fold
+ (c_common_truthvalue_conversion
+ (location,
build_binary_op (location,
- LT_EXPR,
+ LT_EXPR,
objc_foreach_index_decl,
objc_foreach_batchsize_decl, 1)),
false, NULL),
NULL_TREE);
SET_EXPR_LOCATION (t, location);
append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind));
-
+
/* __objc_foreach_batchsize = [__objc_foreach_collection countByEnumeratingWithState: &__objc_foreach_enum_state objects: __objc_foreach_items count: 16]; */
#ifdef OBJCPLUS
t = objc_finish_message_expr (objc_foreach_collection_decl, selector_name,
(NULL_TREE, build_int_cst (NULL_TREE, 16), NULL_TREE))), NULL);
}
#endif
- t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl,
+ t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl,
convert (long_unsigned_type_node, t));
SET_EXPR_LOCATION (t, location);
append_to_statement_list (t, &BIND_EXPR_BODY (next_batch_bind));
/* } */
/* if (__objc_foreach_batchsize != 0) goto next_batch; */
- t = build3 (COND_EXPR, void_type_node,
+ t = build3 (COND_EXPR, void_type_node,
/* Condition. */
- c_fully_fold
- (c_common_truthvalue_conversion
- (location,
+ c_fully_fold
+ (c_common_truthvalue_conversion
+ (location,
build_binary_op (location,
- NE_EXPR,
+ NE_EXPR,
objc_foreach_batchsize_decl,
build_int_cst (long_unsigned_type_node, 0), 1)),
false, NULL),
tmv = TYPE_MAIN_VARIANT (TREE_TYPE (strp));
tmv = OBJC_TYPE_NAME (tmv);
return (tmv
- && TREE_CODE (tmv) == IDENTIFIER_NODE
- && IDENTIFIER_POINTER (tmv)
+ && TREE_CODE (tmv) == IDENTIFIER_NODE
+ && IDENTIFIER_POINTER (tmv)
&& !strncmp (IDENTIFIER_POINTER (tmv), "NSString", 8));
}
/* At present the behavior of this is undefined and it does nothing. */
void
-objc_check_format_arg (tree ARG_UNUSED (format_arg),
+objc_check_format_arg (tree ARG_UNUSED (format_arg),
tree ARG_UNUSED (args_list))
{
}
/* It appears that "r*" means "const char *" rather than
"char *const". "char *const" is encoded as "*",
which is identical to "char *", so the "const" is
- unfortunately lost. */
+ unfortunately lost. */
if (TYPE_READONLY (pointer_to))
obstack_1grow (&util_obstack, 'r');
}
tree an_int_cst = TYPE_SIZE (type);
tree array_of = TREE_TYPE (type);
char buffer[40];
-
+
if (an_int_cst == NULL)
{
/* We are trying to encode an incomplete array. An incomplete
*/
{
char *enc = obstack_base (&util_obstack) + curtype;
- if (memchr (enc, '=',
+ if (memchr (enc, '=',
obstack_object_size (&util_obstack) - curtype) == NULL)
{
/* We are not inside a struct. Encode the array as a
sprintf (buffer, "![" HOST_WIDE_INT_PRINT_DEC ",%d",
/* We want to compute the equivalent of sizeof (<vector>).
Code inspired by c_sizeof_or_alignof_type. */
- ((TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type))
+ ((TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type))
/ (TYPE_PRECISION (char_type_node) / BITS_PER_UNIT))),
/* We want to compute the equivalent of __alignof__
(<vector>). Code inspired by
*/
char c1 = ob_size > 1 ? *(obstack_next_free (&util_obstack) - 2) : 0;
char c0 = ob_size > 0 ? *(obstack_next_free (&util_obstack) - 1) : 0;
-
+
if (c0 == '^' || (c1 == '^' && c0 == 'r'))
pointed_to = true;
-
+
if (format == OBJC_ENCODE_INLINE_DEFS || generating_instance_variables)
{
if (!pointed_to)
obstack_1grow (&util_obstack, '?');
break;
}
-
+
if (flag_next_runtime)
{
/* Super-kludge. Some ObjC qualifier and type combinations need
if (code == POINTER_TYPE && obstack_object_size (&util_obstack) >= 3)
{
char *enc = obstack_base (&util_obstack) + curtype;
-
+
/* Rewrite "in const" from "nr" to "rn". */
if (curtype >= 1 && !strncmp (enc - 1, "nr", 2))
strncpy (enc - 1, "rn", 2);
}
if (PROPERTY_DYNAMIC (property))
- obstack_grow (&util_obstack, ",D", 2);
+ obstack_grow (&util_obstack, ",D", 2);
if (PROPERTY_NONATOMIC (property))
obstack_grow (&util_obstack, ",N", 2);
/* PROPERTY_REF_PROPERTY_DECL is the PROPERTY_DECL for the property
used in the expression. From it, you can get the property type,
and the getter/setter names. This PROPERTY_DECL could be artificial
- if we are processing an 'object.component' syntax with no matching
+ if we are processing an 'object.component' syntax with no matching
declared property. */
#define PROPERTY_REF_PROPERTY_DECL(NODE) TREE_OPERAND (PROPERTY_REF_CHECK (NODE), 1)
#define objc_setjmp_decl objc_global_trees[OCTI_SETJMP_DECL]
#define objc_stack_exception_data \
objc_global_trees[OCTI_STACK_EXCEPTION_DATA_DECL]
-#define objc_caught_exception objc_global_trees[OCTI_LOCAL_EXCEPTION_DECL]
-#define objc_rethrow_exception objc_global_trees[OCTI_RETHROW_EXCEPTION_DECL]
-#define objc_eval_once objc_global_trees[OCTI_EVAL_ONCE_DECL]
+#define objc_caught_exception objc_global_trees[OCTI_LOCAL_EXCEPTION_DECL]
+#define objc_rethrow_exception objc_global_trees[OCTI_RETHROW_EXCEPTION_DECL]
+#define objc_eval_once objc_global_trees[OCTI_EVAL_ONCE_DECL]
#define objc_catch_type objc_global_trees[OCTI_CATCH_TYPE]
#define execclass_decl objc_global_trees[OCTI_EXECCLASS_DECL]
#define METHOD_REF 1
/* (Decide if these can ever be validly changed.) */
-#define OBJC_ENCODE_INLINE_DEFS 0
+#define OBJC_ENCODE_INLINE_DEFS 0
#define OBJC_ENCODE_DONT_INLINE_DEFS 1
#define BUFSIZE 1024
#define OBJC_VOID_AT_END void_list_node
/* Exception handling constructs. We begin by having the parser do most
- of the work and passing us blocks.
+ of the work and passing us blocks.
This allows us to handle different exceptions implementations. */
/* Stack of open try blocks. */
than making them externs. */
extern tree objc_create_temporary_var (tree, const char *);
-
+
#define objc_is_object_id(TYPE) (OBJC_TYPE_NAME (TYPE) == objc_object_id)
#define objc_is_class_id(TYPE) (OBJC_TYPE_NAME (TYPE) == objc_class_id)
/* This macro provides a method of removing ambiguity between runtimes
when LTO is in use on targets supporting multiple runtimes.
-
+
For example, at present, any target that includes an implementation of
the NeXT runtime needs to place Objective-C meta-data into specific
- named sections. This should _not_ be done for the GNU runtime, and the
+ named sections. This should _not_ be done for the GNU runtime, and the
folowing macro is used to attach Objective-C private attributes that may
be used to identify the runtime for which the meta-data are intended. */
static void finish_catch (struct objc_try_context **, tree);
static tree finish_try_stmt (struct objc_try_context **);
-bool
+bool
objc_gnu_runtime_abi_01_init (objc_runtime_hooks *rthooks)
{
/* GNU runtime does not need the compiler to change code in order to do GC. */
NULL, NULL_TREE);
/* id objc_getMetaClass (const char *); */
- objc_get_meta_class_decl = add_builtin_function (TAG_GETMETACLASS, type,
+ objc_get_meta_class_decl = add_builtin_function (TAG_GETMETACLASS, type,
0, NOT_BUILT_IN, NULL,
NULL_TREE);
/* static SEL _OBJC_SELECTOR_TABLE[]; */
build_selector_table_decl ();
-
- /* Stuff for properties.
+
+ /* Stuff for properties.
The codegen relies on this being NULL for GNU. */
objc_copyStruct_decl = NULL_TREE;
type = build_function_type_list (void_type_node,
ptr_type_node,
const_ptr_type_node,
- ptrdiff_type_node,
+ ptrdiff_type_node,
boolean_type_node,
boolean_type_node,
NULL_TREE);
/* Declare the following function:
void
- objc_getPropertyStruct (void *destination, const void *source,
+ objc_getPropertyStruct (void *destination, const void *source,
ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */
objc_getPropertyStruct_decl = add_builtin_function ("objc_getPropertyStruct",
type, 0, NOT_BUILT_IN,
TREE_NOTHROW (objc_getPropertyStruct_decl) = 0;
/* Declare the following function:
void
- objc_setPropertyStruct (void *destination, const void *source,
+ objc_setPropertyStruct (void *destination, const void *source,
ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */
objc_setPropertyStruct_decl = add_builtin_function ("objc_setPropertyStruct",
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (objc_setPropertyStruct_decl) = 0;
-
+
using_eh_for_cleanups ();
lang_hooks.eh_runtime_type = objc_eh_runtime_type;
lang_hooks.eh_personality = objc_eh_personality;
/* struct objc_class *sibling_class; */
ptype = build_pointer_type (objc_class_template);
add_field_decl (ptype, "sibling_class", &chain);
-
+
/* struct _objc_protocol **protocol_list; */
ptype = build_pointer_type (build_pointer_type
(xref_tag (RECORD_TYPE,
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_Class_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_Class_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass)));
decl = start_var_decl (objc_class_template, buf);
OBJCMETA (decl, objc_meta, meta_base);
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_MetaClass_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_MetaClass_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass)));
decl = start_var_decl (objc_class_template, buf);
OBJCMETA (decl, objc_meta, meta_base);
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s",
IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass)),
IDENTIFIER_POINTER (CLASS_NAME (klass)));
decl = start_var_decl (objc_category_template, buf);
}
static tree
-gnu_runtime_abi_01_string_decl (tree type, const char *name,
+gnu_runtime_abi_01_string_decl (tree type, const char *name,
string_section where ATTRIBUTE_UNUSED)
{
tree decl = start_var_decl (type, name);
add_class_reference (ident);
- params = build_tree_list (NULL_TREE, my_build_string_pointer
+ params = build_tree_list (NULL_TREE, my_build_string_pointer
(IDENTIFIER_LENGTH (ident) + 1,
IDENTIFIER_POINTER (ident)));
return build_function_call (input_location, objc_get_class_decl, params);
}
-/* Used by get_arg_type_list.
+/* Used by get_arg_type_list.
Return the types for receiver & _cmd at the start of a method argument list.
context is either METHOD_DEF or METHOD_REF, saying whether we are trying
to define a method or call one. superflag says this is for a send to super.
while (*chain)
{
- /* When we do a lookup for @selector () we have no idea of the
+ /* When we do a lookup for @selector () we have no idea of the
prototype - so match the first we find. */
- if (TREE_VALUE (*chain) == ident
+ if (TREE_VALUE (*chain) == ident
&& (!prototype || TREE_PURPOSE (*chain) == prototype))
goto return_at_index;
*chain = tree_cons (prototype, ident, NULL_TREE);
- /* TODO: Use a vec and keep this in it to (a) avoid re-creating and
+ /* TODO: Use a vec and keep this in it to (a) avoid re-creating and
(b) provide better diagnostics for the first time an undefined
selector is used. */
return_at_index:
tree lookup_object, tree selector,
tree method_params)
{
- tree sender = (super_flag ? umsg_super_decl
+ tree sender = (super_flag ? umsg_super_decl
: (flag_objc_direct_dispatch ? umsg_fast_decl
: umsg_decl));
tree rcv_p = (super_flag ? objc_super_type : objc_object_type);
? TREE_VALUE (TREE_TYPE (method_prototype))
: objc_object_type);
- tree method_param_types =
- get_arg_type_list (method_prototype, METHOD_REF, super_flag);
+ tree method_param_types =
+ get_arg_type_list (method_prototype, METHOD_REF, super_flag);
tree ftype = build_function_type (ret_type, method_param_types);
tree sender_cast;
tree method, t;
if (method_prototype && METHOD_TYPE_ATTRIBUTES (method_prototype))
- ftype = build_type_attribute_variant (ftype,
- METHOD_TYPE_ATTRIBUTES
+ ftype = build_type_attribute_variant (ftype,
+ METHOD_TYPE_ATTRIBUTES
(method_prototype));
sender_cast = build_pointer_type (ftype);
tree method_params,
int super ATTRIBUTE_UNUSED)
{
- tree selector =
- gnu_runtime_abi_01_build_typed_selector_reference (loc,
- sel_name,
+ tree selector =
+ gnu_runtime_abi_01_build_typed_selector_reference (loc,
+ sel_name,
method_prototype);
return build_objc_method_call (loc, super, method_prototype, receiver,
/* This type is a struct containing the fields of a Protocol
object. (Cfr. objc_protocol_type instead is the type of a pointer
to such a struct). */
- protocol_struct_type = xref_tag (RECORD_TYPE,
+ protocol_struct_type = xref_tag (RECORD_TYPE,
get_identifier (PROTOCOL_OBJECT_CLASS_NAME));
/* Look for the list of Protocol statically allocated instances
/* For ABI 8 an IVAR is just a fixed offset in the class struct. */
static tree
-gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED,
+gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED,
tree base, tree id)
{
return objc_build_component_ref (base, id);
built for the sake of efficiency). */
static tree
-gnu_runtime_abi_01_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED,
+gnu_runtime_abi_01_get_class_super_ref (location_t loc ATTRIBUTE_UNUSED,
struct imp_entry *imp, bool inst_meth)
{
if (inst_meth)
{
if (!ucls_super_ref)
- ucls_super_ref =
- objc_build_component_ref (imp->class_decl,
+ ucls_super_ref =
+ objc_build_component_ref (imp->class_decl,
get_identifier ("super_class"));
return ucls_super_ref;
}
else
{
if (!uucls_super_ref)
- uucls_super_ref =
- objc_build_component_ref (imp->meta_decl,
+ uucls_super_ref =
+ objc_build_component_ref (imp->meta_decl,
get_identifier ("super_class"));
return uucls_super_ref;
}
}
static tree
-gnu_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
+gnu_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
struct imp_entry *imp, bool inst_meth)
{
tree super_name = CLASS_SUPER_NAME (imp->imp_template);
OBJCMETA (decl, objc_meta, meta_base);
/* We may be writing something else just now.
- Postpone till end of input. */
+ Postpone till end of input. */
DECL_DEFER_OUTPUT (decl) = 1;
pushdecl_top_level (decl);
rest_of_decl_compilation (decl, 1, 0);
{
tree constructor, fields;
VEC(constructor_elt,gc) *v = NULL;
-
+
/* GNU: (NXConstantString *) & ((__builtin_ObjCString) { NULL, string, length }) */
fields = TYPE_FIELDS (internal_const_str_type);
CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, 0));
fields = DECL_CHAIN (fields);
- CONSTRUCTOR_APPEND_ELT (v, fields, build_unary_op (loc,
+ CONSTRUCTOR_APPEND_ELT (v, fields, build_unary_op (loc,
ADDR_EXPR, string, 1));
fields = DECL_CHAIN (fields);
{
const char *const class_name =
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
-
+
string = (char *) alloca (strlen (class_name) + 30);
-
+
sprintf (string, "__objc_class_name_%s", class_name);
break;
}
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
const char *const class_super_name =
IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context));
-
+
string = (char *) alloca (strlen (class_name)
+ strlen (class_super_name) + 30);
-
+
/* Do the same for categories. Even though no references to
these symbols are generated automatically by the compiler,
it gives you a handle to pull them into an archive by
/* TODO: pass the loc in or find it from args. */
loc = input_location;
- ttyp = build_pointer_type (xref_tag (RECORD_TYPE,
+ ttyp = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (UTAG_CLASS)));
/* Filling the "isa" in with a version allows the runtime system to
detect this ... */
switch (TREE_CODE (i_or_p))
{
case PROTOCOL_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (i_or_p)));
break;
case CLASS_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s",
IDENTIFIER_POINTER (CLASS_NAME (i_or_p)));
break;
case CATEGORY_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass_ctxt)),
IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass_ctxt)));
break;
return refs_decl;
}
-static tree
+static tree
generate_v1_meth_descriptor_table (tree chain, tree protocol, const char *prefix)
{
tree method_list_template, initlist, decl;
if (!objc_method_prototype_template)
objc_method_prototype_template = build_method_prototype_template ();
-
+
size = list_length (chain);
- method_list_template =
+ method_list_template =
build_method_prototype_list_template (objc_method_prototype_template,
size);
- snprintf (buf, BUFSIZE, "%s_%s", prefix,
+ snprintf (buf, BUFSIZE, "%s_%s", prefix,
IDENTIFIER_POINTER (PROTOCOL_NAME (protocol)));
decl = start_var_decl (method_list_template, buf);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size));
- initlist =
+ initlist =
build_descriptor_table_initializer (objc_method_prototype_template,
chain);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist);
nst_methods = DECL_CHAIN (nst_methods);
}
- UOBJC_INSTANCE_METHODS_decl =
+ UOBJC_INSTANCE_METHODS_decl =
generate_v1_meth_descriptor_table (PROTOCOL_NST_METHODS (p), p,
"_OBJC_PROTOCOL_INSTANCE_METHODS");
cls_methods = DECL_CHAIN (cls_methods);
}
- UOBJC_CLASS_METHODS_decl =
+ UOBJC_CLASS_METHODS_decl =
generate_v1_meth_descriptor_table (PROTOCOL_CLS_METHODS (p), p,
"_OBJC_PROTOCOL_CLASS_METHODS");
/* generate_method_descriptors (p);*/
decl = start_var_decl (method_list_template, name);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, integer_zero_node);
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (integer_type_node, size));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist);
/* objc_ivar_list = */
if (!ivar_list)
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (objc_ivar_list_ptr, 0));
else
{
expr = convert (objc_ivar_list_ptr,
- build_unary_op (input_location, ADDR_EXPR,
+ build_unary_op (input_location, ADDR_EXPR,
ivar_list, 0));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
}
/* objc_method_list = */
if (!dispatch_table)
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
convert (objc_method_list_ptr, null_pointer_node));
else
{
expr = convert (objc_method_list_ptr,
- build_unary_op (input_location, ADDR_EXPR,
+ build_unary_op (input_location, ADDR_EXPR,
dispatch_table, 0));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
}
else
{
expr = convert (ltyp,
- build_unary_op (input_location, ADDR_EXPR,
+ build_unary_op (input_location, ADDR_EXPR,
protocol_list, 0));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
}
location_t loc;
char buf[BUFSIZE];
int cls_flags = 0 ;
-
+
/* objc_implementation_context = impent->imp_context;
implementation_template = impent->imp_template;*/
class_decl = impent->class_decl;
meta_decl = impent->meta_decl;
/* UOBJC_CLASS_decl = impent->class_decl;
UOBJC_METACLASS_decl = impent->meta_decl;*/
-
+
loc = DECL_SOURCE_LOCATION (impent->class_decl);
my_super_id = CLASS_SUPER_NAME (impent->imp_template);
super_expr = add_objc_string (my_super_id, class_names);
else
super_expr = null_pointer_node;
-
+
super_expr = build_c_cast (loc, cast_type, super_expr);
root_expr = add_objc_string (my_root_id, class_names);
/* static struct objc_class _OBJC_METACLASS_Foo = { ... }; */
- initlist =
- build_shared_structure_initializer
+ initlist =
+ build_shared_structure_initializer
(TREE_TYPE (meta_decl),
root_expr, super_expr, name_expr,
- convert (integer_type_node,
+ convert (integer_type_node,
TYPE_SIZE_UNIT (objc_class_template)),
CLS_META, class_methods, class_ivars,
protocol_decl);
inst_ivars = generate_ivars_list (chain, buf);
}
- initlist =
- build_shared_structure_initializer
+ initlist =
+ build_shared_structure_initializer
(TREE_TYPE (class_decl),
build_unary_op (loc, ADDR_EXPR, meta_decl, 0),
super_expr, name_expr,
DECL_READ_P (decl) = 1;
DECL_ARTIFICIAL (decl) = 1;
DECL_INITIAL (decl) = error_mark_node;
-
+
/* We must force the reference. */
DECL_PRESERVE_P (decl) = 1;
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, encoding);
expr = objc_build_constructor (objc_selector_template, v);
-
+
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr);
} /* each element in the chain */
klass = TREE_VALUE (cl_chain);
class_name = get_objc_string_decl (OBJC_TYPE_NAME (klass), class_names);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
- build_unary_op (input_location,
+ build_unary_op (input_location,
ADDR_EXPR, class_name, 1));
/* Output {..., instance, ...}. */
ltyp = build_pointer_type (objc_selector_type);
if (sel_ref_chain)
- expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR,
+ expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR,
UOBJC_SELECTOR_TABLE_decl, 1));
else
expr = convert (ltyp, null_pointer_node);
/* cls_def_cnt = { ..., 5, ... } */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (short_integer_type_node, imp_count));
/* cat_def_cnt = { ..., 5, ... } */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (short_integer_type_node, cat_count));
/* cls_def = { ..., { &Foo, &Bar, ...}, ... } */
{
/* Make sure that the meta-data are identified as being
GNU-runtime. */
- build_module_descriptor (OBJC_VERSION,
+ build_module_descriptor (OBJC_VERSION,
build_tree_list (objc_meta, meta_base));
build_module_initializer_routine ();
}
if (POINTER_TYPE_P (type) && objc_is_object_id (TREE_TYPE (type)))
/* We don't want to identify 'id' for GNU. Instead, build a 0
entry in the exceptions table. */
- return null_pointer_node;
+ return null_pointer_node;
if (!POINTER_TYPE_P (type) || !TYPED_OBJECT (TREE_TYPE (type)))
{
return fold_convert (objc_object_type, t);
}
-static tree
+static tree
begin_catch (struct objc_try_context **cur_try_context, tree type,
tree decl, tree compound, bool ellipsis ATTRIBUTE_UNUSED)
{
return build2 (MODIFY_EXPR, void_type_node, decl, t);
}
-static void
+static void
finish_catch (struct objc_try_context **cur_try_context, tree current_catch)
{
append_to_statement_list (current_catch, &((*cur_try_context)->catch_list));
}
-static tree
+static tree
finish_try_stmt (struct objc_try_context **cur_try_context)
{
struct objc_try_context *c = *cur_try_context;
#define LANG_HOOKS_INIT objc_init
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
#define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name
-#undef LANG_HOOKS_GIMPLIFY_EXPR
+#undef LANG_HOOKS_GIMPLIFY_EXPR
#define LANG_HOOKS_GIMPLIFY_EXPR objc_gimplify_expr
#undef LANG_HOOKS_INIT_TS
#define LANG_HOOKS_INIT_TS objc_common_init_ts
/* Declarations for meta-data attribute tags.
Copyright (C) 2011 Free Software Foundation, Inc.
- Contributed by Iain Sandoe
+ Contributed by Iain Sandoe
This file is part of GCC.
{
OCTI_RT_OBJC_META,
OCTI_RT_META_BASE,
-
+
OCTI_RT_META_CLASS,
OCTI_RT_META_METACLASS,
OCTI_RT_META_CATEGORY,
OCTI_RT_META_PROTOCOL,
-
+
OCTI_RT_META_CLASS_CLS_VARS,
OCTI_RT_META_CLASS_NST_VARS,
-
+
OCTI_RT_META_CLASS_CLS_METH,
OCTI_RT_META_CLASS_NST_METH,
OCTI_RT_META_CATEG_CLS_METH,
OCTI_RT_META_CATEG_NST_METH,
OCTI_RT_META_PROTO_CLS_METH,
OCTI_RT_META_PROTO_NST_METH,
-
+
OCTI_RT_META_CLASS_PROT,
OCTI_RT_META_CATEG_PROT,
OCTI_RT_META_PROT_REFS,
-
+
OCTI_RT_META_MSG_REFS,
OCTI_RT_META_SEL_REFS,
-
+
OCTI_RT_META_CLSLST_REFS,
OCTI_RT_META_CLASS_REF,
OCTI_RT_META_SUPER_REF,
OCTI_RT_META_LAB_PROTOLIST,
OCTI_RT_META_LAB_NLZY_CAT,
OCTI_RT_META_LAB_CAT,
-
+
OCTI_RT_META_PROPERTY_LIST,
OCTI_RT_META_PROTOCOL_EXT,
OCTI_RT_META_CLASS_EXT,
-
+
OCTI_RT_META_CLASS_NAME,
OCTI_RT_META_METHD_NAME,
OCTI_RT_META_METHD_TYPE,
OCTI_RT_META_PROPN_ATTR,
-
+
OCTI_RT_META_MODULES,
OCTI_RT_META_SYMTAB,
OCTI_RT_META_INFO,
-
+
OCTI_RT_META_EHTYPE,
-
+
OCTI_RT_META_CONST_STR,
OCTI_RT_META_MAX
};
/* Tags for the META data so that the backend can put them in the correct
- sections for targets/runtimes (Darwin/NeXT) that require this.
+ sections for targets/runtimes (Darwin/NeXT) that require this.
This information also survives LTO - which might produce mixed language
output. */
/* Objective-C meta data attribute tag */
-#define objc_meta objc_rt_trees[OCTI_RT_OBJC_META]
+#define objc_meta objc_rt_trees[OCTI_RT_OBJC_META]
/* Attribute values, base = default section. */
#define meta_base objc_rt_trees[OCTI_RT_META_BASE]
static void finish_catch (struct objc_try_context **, tree);
static tree finish_try_stmt (struct objc_try_context **);
-bool
+bool
objc_next_runtime_abi_01_init (objc_runtime_hooks *rthooks)
{
- if (flag_objc_exceptions
+ if (flag_objc_exceptions
&& !flag_objc_sjlj_exceptions)
{
- warning_at (UNKNOWN_LOCATION, OPT_Wall,
+ warning_at (UNKNOWN_LOCATION, OPT_Wall,
"%<-fobjc-sjlj-exceptions%> is the only supported exceptions "
"system for %<-fnext-runtime%> with %<-fobjc-abi-version%> < 2");
}
given variable, since each type is expected (by the runtime) to be
found in a specific named section. The solution must be usable
with LTO.
-
+
The scheme used for NeXT ABI 0/1 (partial matching of variable
names) is not satisfactory for LTO & ABI-2. We now tag ObjC
meta-data with identification attributes in the front end. The
meta_meth_name = get_identifier ("V1_METN");
meta_meth_type = get_identifier ("V1_METT");
meta_prop_name_attr = get_identifier ("V1_STRG");
-
+
meta_modules = get_identifier ("V1_MODU");
meta_symtab = get_identifier ("V1_SYMT");
meta_info = get_identifier ("V1_INFO");
-
+
meta_proplist = get_identifier ("V1_PLST");
meta_protocol_extension = get_identifier ("V1_PEXT");
meta_class_extension = get_identifier ("V1_CEXT");
-
+
meta_const_str = get_identifier ("V1_CSTR");
}
type = build_function_type_list (void_type_node,
ptr_type_node,
const_ptr_type_node,
- ptrdiff_type_node,
+ ptrdiff_type_node,
boolean_type_node,
boolean_type_node,
NULL_TREE);
/* Declare the following function:
void
- objc_copyStruct (void *destination, const void *source,
+ objc_copyStruct (void *destination, const void *source,
ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */
objc_copyStruct_decl = add_builtin_function ("objc_copyStruct",
type, 0, NOT_BUILT_IN,
/* --- templates --- */
-/* struct _objc_class
+/* struct _objc_class
{
struct _objc_class *isa;
struct _objc_class *super_class;
if (flag_objc_abi >= 1)
{
add_field_decl (integer_type_node, "size", &chain);
-
+
/* struct _objc_property_list *instance_properties;
This field describes a category's @property declarations.
Properties from inherited protocols are not included. */
- ptype = build_pointer_type (xref_tag (RECORD_TYPE,
+ ptype = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (UTAG_PROPERTY_LIST)));
add_field_decl (ptype, "instance_properties", &chain);
}
struct _objc_protocol_extension *isa;
#else
struct _objc_class *isa;
- #endif
+ #endif
char *protocol_name;
struct _objc_protocol **protocol_list;
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_Class_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_Class_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass)));
decl = start_var_decl (objc_class_template, buf);
OBJCMETA (decl, objc_meta, meta_class);
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_MetaClass_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_MetaClass_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass)));
decl = start_var_decl (objc_class_template, buf);
OBJCMETA (decl, objc_meta, meta_metaclass);
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s",
IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass)),
IDENTIFIER_POINTER (CLASS_NAME (klass)));
decl = start_var_decl (objc_category_template, buf);
case prop_names_attr:
OBJCMETA (var, objc_meta, meta_prop_name_attr);
break;
- default:
+ default:
OBJCMETA (var, objc_meta, meta_base);
break;
}
}
}
-/* Used by get_arg_type_list.
+/* Used by get_arg_type_list.
Return the types for receiver & _cmd at the start of a method argument list.
context is either METHOD_DEF or METHOD_REF, saying whether we are trying
to define a method or call one. superflag says this is for a send to super.
t = buf;
while (*t)
{
- if (*t==':')
+ if (*t==':')
*t = '$'; /* Underscore would clash between foo:bar and foo_bar. */
t++;
}
? TREE_VALUE (TREE_TYPE (method_prototype))
: objc_object_type);
- tree method_param_types =
- get_arg_type_list (method_prototype, METHOD_REF, super_flag);
+ tree method_param_types =
+ get_arg_type_list (method_prototype, METHOD_REF, super_flag);
tree ftype = build_function_type (ret_type, method_param_types);
if (method_prototype && METHOD_TYPE_ATTRIBUTES (method_prototype))
- ftype = build_type_attribute_variant (ftype,
- METHOD_TYPE_ATTRIBUTES
+ ftype = build_type_attribute_variant (ftype,
+ METHOD_TYPE_ATTRIBUTES
(method_prototype));
sender_cast = build_pointer_type (ftype);
|| TREE_CODE (ret_type) == UNION_TYPE)
&& targetm.calls.return_in_memory (ret_type, 0))
sender = (super_flag ? umsg_super_stret_decl
- : flag_nil_receivers ? umsg_stret_decl
+ : flag_nil_receivers ? umsg_stret_decl
: umsg_nonnil_stret_decl);
else
- sender = (super_flag ? umsg_super_decl
- : (flag_nil_receivers ? (flag_objc_direct_dispatch
+ sender = (super_flag ? umsg_super_decl
+ : (flag_nil_receivers ? (flag_objc_direct_dispatch
? umsg_fast_decl
: umsg_decl)
: umsg_nonnil_decl));
VEC_quick_push (tree, parms, TREE_VALUE (method_params));
/* Build an obj_type_ref, with the correct cast for the method call. */
- t = build3 (OBJ_TYPE_REF, sender_cast, method,
+ t = build3 (OBJ_TYPE_REF, sender_cast, method,
lookup_object, size_zero_node);
t = build_function_call_vec (loc, t, parms, NULL);
VEC_free (tree, gc, parms);
/* For ABI 0/1 and IVAR is just a fixed offset in the class struct. */
static tree
-next_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED,
+next_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED,
tree base, tree id)
{
return objc_build_component_ref (base, id);
if (inst_meth)
{
if (!ucls_super_ref)
- ucls_super_ref =
- objc_build_component_ref (imp->class_decl,
+ ucls_super_ref =
+ objc_build_component_ref (imp->class_decl,
get_identifier ("super_class"));
return ucls_super_ref;
}
else
{
if (!uucls_super_ref)
- uucls_super_ref =
- objc_build_component_ref (imp->meta_decl,
+ uucls_super_ref =
+ objc_build_component_ref (imp->meta_decl,
get_identifier ("super_class"));
return uucls_super_ref;
}
}
static tree
-next_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
+next_runtime_abi_01_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
struct imp_entry *imp, bool inst_meth)
{
tree super_name = CLASS_SUPER_NAME (imp->imp_template);
super_class = objc_get_class_reference (super_name);
if (!inst_meth)
-
+
/* If we are in a class method, we must retrieve the
_metaclass_ for the current class, pointed at by
the class's "isa" pointer. The following assumes that
"isa" is the first ivar in a class (which it must be). */
- super_class =
+ super_class =
build_indirect_ref (input_location,
build_c_cast (input_location,
build_pointer_type (objc_class_type),
- super_class),
+ super_class),
RO_UNARY_STAR);
return super_class;
}
/* This routine builds the following type:
struct _prop_t {
const char * const name; // property name
- const char * const attributes; // comma-delimited, encoded,
+ const char * const attributes; // comma-delimited, encoded,
// property attributes
};
*/
static GTY(()) tree objc_protocol_extension_template;
-static void
+static void
build_v1_objc_protocol_extension_template (void)
{
tree decls, *chain = NULL;
-
- objc_protocol_extension_template =
+
+ objc_protocol_extension_template =
objc_start_struct (get_identifier (UTAG_PROTOCOL_EXT));
/* uint32_t size; */
}
/* This routine build following struct type:
- struct _objc_class_ext
+ struct _objc_class_ext
{
uint32_t size; // sizeof(struct _objc_class_ext)
const char *weak_ivar_layout;
/* --- emit metadata --- */
-static tree
+static tree
generate_v1_meth_descriptor_table (tree chain, tree protocol,
const char *prefix, tree attr)
{
if (!objc_method_prototype_template)
objc_method_prototype_template = build_method_prototype_template ();
-
+
size = list_length (chain);
- method_list_template =
+ method_list_template =
build_method_prototype_list_template (objc_method_prototype_template,
size);
- snprintf (buf, BUFSIZE, "%s_%s", prefix,
+ snprintf (buf, BUFSIZE, "%s_%s", prefix,
IDENTIFIER_POINTER (PROTOCOL_NAME (protocol)));
decl = start_var_decl (method_list_template, buf);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size));
- initlist =
+ initlist =
build_descriptor_table_initializer (objc_method_prototype_template,
chain);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist);
or NULL_TREE if none are present. */
static tree
-generate_v1_objc_protocol_extension (tree proto_interface,
+generate_v1_objc_protocol_extension (tree proto_interface,
tree opt_instance_meth,
tree opt_class_meth,
tree instance_props)
return NULL_TREE;
if (!objc_protocol_extension_template)
- build_v1_objc_protocol_extension_template ();
+ build_v1_objc_protocol_extension_template ();
/* uint32_t size */
size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_protocol_extension_template));
/* Try for meaningful diagnostics. */
loc = DECL_SOURCE_LOCATION (PROTOCOL_FORWARD_DECL (proto_interface));
-
+
/* struct objc_method_list *optional_instance_methods; */
if (opt_instance_meth)
- expr = convert (objc_method_list_ptr,
+ expr = convert (objc_method_list_ptr,
build_unary_op (loc, ADDR_EXPR, opt_instance_meth, 0));
else
expr = convert (objc_method_list_ptr, null_pointer_node);
/* struct objc_method_list *optional_class_methods; */
if (opt_class_meth)
- expr = convert (objc_method_list_ptr,
+ expr = convert (objc_method_list_ptr,
build_unary_op (loc, ADDR_EXPR, opt_class_meth, 0));
else
expr = convert (objc_method_list_ptr, null_pointer_node);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
/* struct objc_prop_list *instance_properties; */
if (instance_props)
- expr = convert (objc_prop_list_ptr,
+ expr = convert (objc_prop_list_ptr,
build_unary_op (loc, ADDR_EXPR, instance_props, 0));
else
expr = convert (objc_prop_list_ptr, null_pointer_node);
/* anonymous. */
property_list_t_record = objc_start_struct (NULL_TREE);
-
+
/* uint32_t const entsize */
decls = add_field_decl (integer_type_node, "entsize", &chain);
VEC(constructor_elt,gc) *elemlist = NULL;
tree attribute, name_ident = PROPERTY_NAME (x);
- CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE,
add_objc_string (name_ident, prop_names_attr));
attribute = objc_v2_encode_prop_attr (x);
- CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE,
add_objc_string (attribute, prop_names_attr));
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
VEC(constructor_elt,gc) *inits = NULL;
int init_val, size = 0;
char buf[BUFSIZE];
-
+
if (context)
{
gcc_assert (TREE_CODE (context) == PROTOCOL_INTERFACE_TYPE);
return NULL_TREE;
if (!objc_v1_property_template)
- objc_v1_property_template = build_v1_property_template ();
+ objc_v1_property_template = build_v1_property_template ();
- property_list_template =
- build_v1_property_list_template (objc_v1_property_template,
+ property_list_template =
+ build_v1_property_list_template (objc_v1_property_template,
size);
initlist = build_v1_property_table_initializer (objc_v1_property_template,
is_proto ? context
switch (TREE_CODE (i_or_p))
{
case PROTOCOL_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (i_or_p)));
attr = meta_proto_ref;
break;
case CLASS_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s",
IDENTIFIER_POINTER (CLASS_NAME (i_or_p)));
attr = meta_clas_prot;
break;
case CATEGORY_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass_ctxt)),
IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass_ctxt)));
attr = meta_catg_prot;
tree expr, ttyp;
location_t loc;
VEC(constructor_elt,gc) *inits = NULL;
-
+
if (!objc_protocol_extension_template)
- build_v1_objc_protocol_extension_template ();
+ build_v1_objc_protocol_extension_template ();
/* TODO: find a better representation of location from the inputs. */
loc = UNKNOWN_LOCATION;
return objc_build_constructor (type, inits);
}
-/* An updated version of generate_protocols () that emit the protocol
+/* An updated version of generate_protocols () that emit the protocol
extension for ABI=1. */
/* For each protocol which was referenced either from a @protocol()
nst_methods = TREE_CHAIN (nst_methods);
}
- UOBJC_INSTANCE_METHODS_decl =
+ UOBJC_INSTANCE_METHODS_decl =
generate_v1_meth_descriptor_table (PROTOCOL_NST_METHODS (p), p,
"_OBJC_ProtocolInstanceMethods",
meta_proto_nst_meth);
cls_methods = TREE_CHAIN (cls_methods);
}
- UOBJC_CLASS_METHODS_decl =
+ UOBJC_CLASS_METHODS_decl =
generate_v1_meth_descriptor_table (PROTOCOL_CLS_METHODS (p), p,
"_OBJC_ProtocolClassMethods",
meta_proto_cls_meth);
- /* There should be no optional methods for ABI-0 - but we need to
+ /* There should be no optional methods for ABI-0 - but we need to
check all this here before the lists are made. */
nst_methods = PROTOCOL_OPTIONAL_NST_METHODS (p);
while (nst_methods)
{
if (! METHOD_ENCODING (nst_methods))
- {
+ {
encoding = encode_method_prototype (nst_methods);
METHOD_ENCODING (nst_methods) = encoding;
}
meta_proto_nst_meth);
cls_methods = PROTOCOL_OPTIONAL_CLS_METHODS (p);
- while (cls_methods)
+ while (cls_methods)
{
if (! METHOD_ENCODING (cls_methods))
{
cls_methods = TREE_CHAIN (cls_methods);
}
- V1_Protocol_OPT_CLS_METHODS_decl =
+ V1_Protocol_OPT_CLS_METHODS_decl =
generate_v1_meth_descriptor_table (PROTOCOL_OPTIONAL_CLS_METHODS (p), p,
"_OBJC_OptionalProtocolClassMethods",
meta_proto_cls_meth);
build_unary_op (loc, ADDR_EXPR, refs_decl, 0));
else
refs_expr = convert (refs_type, null_pointer_node);
-
+
if (flag_objc_abi < 1)
{
/* Original ABI. */
- initlist =
+ initlist =
build_protocol_initializer (TREE_TYPE (decl),
protocol_name_expr, refs_expr,
UOBJC_INSTANCE_METHODS_decl,
/* else - V1 extensions. */
- V1_Property_decl =
+ V1_Property_decl =
generate_v1_property_table (p, NULL_TREE);
- V1_ProtocolExt_decl =
- generate_v1_objc_protocol_extension (p,
+ V1_ProtocolExt_decl =
+ generate_v1_objc_protocol_extension (p,
V1_Protocol_OPT_NST_METHODS_decl,
- V1_Protocol_OPT_CLS_METHODS_decl,
+ V1_Protocol_OPT_CLS_METHODS_decl,
V1_Property_decl);
initlist = build_v1_protocol_initializer (TREE_TYPE (decl),
decl = start_var_decl (method_list_template, name);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, integer_zero_node);
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (integer_type_node, size));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist);
/* TODO: pass the loc in or find it from args. */
loc = UNKNOWN_LOCATION;
- /* const char *weak_ivar_layout
+ /* const char *weak_ivar_layout
TODO: Figure the ivar layouts out... */
weak_ivar_layout_tree = NULL_TREE;
else
expr = convert (ltyp, null_pointer_node);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
-
+
/* struct _prop_list_t *properties; */
ltyp = objc_prop_list_ptr;
if (property_list)
expr = convert (ltyp, null_pointer_node);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
- ltyp = build_pointer_type (xref_tag (RECORD_TYPE,
+ ltyp = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier ("objc_cache")));
/* method_cache = */
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, convert (ltyp, null_pointer_node));
int cls_flags;
location_t loc;
char buf[BUFSIZE];
-
+
/* objc_implementation_context = impent->imp_context;
implementation_template = impent->imp_template;*/
class_decl = impent->class_decl;
meta_decl = impent->meta_decl;
cls_flags = impent->has_cxx_cdtors ? CLS_HAS_CXX_STRUCTORS : 0 ;
-
+
loc = DECL_SOURCE_LOCATION (impent->class_decl);
-
+
if (flag_objc_abi >= 1)
{
/* ABI=1 additions. */
/* static struct objc_class _OBJC_METACLASS_Foo = { ... }; */
- initlist = build_v1_shared_structure_initializer
+ initlist = build_v1_shared_structure_initializer
(TREE_TYPE (meta_decl),
root_expr, super_expr, name_expr,
convert (integer_type_node, TYPE_SIZE_UNIT (objc_class_template)),
(TREE_TYPE (class_decl),
build_unary_op (loc, ADDR_EXPR, meta_decl, 0),
super_expr, name_expr,
- convert (integer_type_node,
+ convert (integer_type_node,
TYPE_SIZE_UNIT (CLASS_STATIC_TEMPLATE (impent->imp_template))),
CLS_FACTORY | cls_flags, inst_methods, inst_ivars,
protocol_decl, class_ext_decl);
/* refs = { ..., _OBJC_SELECTOR_TABLE, ... } */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
convert (build_pointer_type (objc_selector_type),
integer_zero_node));
/* cls_def_cnt = { ..., 5, ... } */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (short_integer_type_node, imp_count));
/* cat_def_cnt = { ..., 5, ... } */
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (short_integer_type_node, cat_count));
/* cls_def = { ..., { &Foo, &Bar, ...}, ... } */
switch (TREE_CODE (impent->imp_context))
{
case CLASS_IMPLEMENTATION_TYPE:
- snprintf (buf, BUFSIZE, ".objc_class_name_%s",
+ snprintf (buf, BUFSIZE, ".objc_class_name_%s",
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)));
break;
case CATEGORY_IMPLEMENTATION_TYPE:
- snprintf (buf, BUFSIZE, "*.objc_category_name_%s_%s",
+ snprintf (buf, BUFSIZE, "*.objc_category_name_%s_%s",
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)),
IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context)));
break;
| (flag_objc_gc ? 2 : 0));
VEC(constructor_elt,gc) *v = NULL;
tree array_type;
-
+
array_type = build_sized_array_type (integer_type_node, 2);
decl = start_var_decl (array_type, "_OBJC_ImageInfo");
/* Build the complete FINALLY statement list. */
t = next_sjlj_build_try_exit (ctcp);
t = build_stmt (input_location, COND_EXPR,
- c_common_truthvalue_conversion
+ c_common_truthvalue_conversion
(input_location, rethrow_decl),
NULL, t);
SET_EXPR_LOCATION (t, cur_try_context->finally_locus);
t = build_function_call (input_location,
objc_exception_throw_decl, t);
t = build_stmt (input_location, COND_EXPR,
- c_common_truthvalue_conversion (input_location,
+ c_common_truthvalue_conversion (input_location,
rethrow_decl),
t, NULL);
SET_EXPR_LOCATION (t, cur_try_context->end_finally_locus);
}
}
-static tree
+static tree
begin_catch (struct objc_try_context **cur_try_context, tree type,
tree decl, tree compound, bool ellipsis ATTRIBUTE_UNUSED)
{
return build2 (MODIFY_EXPR, void_type_node, decl, t);
}
-static void
+static void
finish_catch (struct objc_try_context **cur_try_context, tree current_catch)
{
append_to_statement_list (current_catch, &((*cur_try_context)->catch_list));
}
-static tree
+static tree
finish_try_stmt (struct objc_try_context **cur_try_context)
{
tree stmt;
<http://www.gnu.org/licenses/>. */
/* The NeXT ABI2 is used for m64 implementations on Darwin/OSX machines.
-
+
This version is intended to match (logically) the output of Apple's
4.2.1 compiler. */
#define OBJC2_CLS_HAS_CXX_STRUCTORS 0x0004L
enum objc_v2_tree_index
-{
+{
/* Templates. */
OCTI_V2_CLS_TEMPL,
OCTI_V2_CAT_TEMPL,
OCTI_V2_IVAR_LIST_TEMPL,
OCTI_V2_MESSAGE_REF_TEMPL,
OCTI_V2_SUPER_MESSAGE_REF_TEMPL,
-
+
OCTI_V2_MESSAGE_SELECTOR_TYPE,
OCTI_V2_SUPER_MESSAGE_SELECTOR_TYPE,
OCTI_V2_IMP_TYPE,
OCTI_V2_VTABLE_DECL,
OCTI_V2_PROPERTY_TEMPL,
-
+
/* V2 messaging. */
OCTI_V2_UMSG_FIXUP_DECL,
OCTI_V2_UMSG_STRET_FIXUP_DECL,
OCTI_V2_UMSG_ID_STRET_FIXUP_DECL,
OCTI_V2_UMSG_SUPER2_FIXUP_DECL,
OCTI_V2_UMSG_SUPER2_STRET_FIXUP_DECL,
-
+
/* Exceptions - related. */
OCTI_V2_BEGIN_CATCH_DECL,
OCTI_V2_END_CATCH_DECL,
OCTI_V2_RETHROW_DECL,
-
+
OCTI_V2_MAX
};
/* struct message_ref_t */
#define objc_v2_message_ref_template \
- objc_v2_global_trees[OCTI_V2_MESSAGE_REF_TEMPL]
+ objc_v2_global_trees[OCTI_V2_MESSAGE_REF_TEMPL]
#define objc_v2_ivar_list_ptr objc_v2_global_trees[OCTI_V2_IVAR_LIST_TEMPL]
/* struct super_message_ref_t */
#define objc_v2_super_message_ref_template \
- objc_v2_global_trees[OCTI_V2_SUPER_MESSAGE_REF_TEMPL]
+ objc_v2_global_trees[OCTI_V2_SUPER_MESSAGE_REF_TEMPL]
/* struct message_ref_t* */
-#define objc_v2_selector_type objc_v2_global_trees[OCTI_V2_MESSAGE_SELECTOR_TYPE]
+#define objc_v2_selector_type objc_v2_global_trees[OCTI_V2_MESSAGE_SELECTOR_TYPE]
/* struct super_super_message_ref_t */
#define objc_v2_super_selector_type \
- objc_v2_global_trees[OCTI_V2_SUPER_MESSAGE_SELECTOR_TYPE]
+ objc_v2_global_trees[OCTI_V2_SUPER_MESSAGE_SELECTOR_TYPE]
#define objc_v2_imp_type objc_v2_global_trees[OCTI_V2_IMP_TYPE]
-#define objc_v2_super_imp_type objc_v2_global_trees[OCTI_V2_SUPER_IMP_TYPE]
+#define objc_v2_super_imp_type objc_v2_global_trees[OCTI_V2_SUPER_IMP_TYPE]
#define UOBJC_V2_CACHE_decl objc_v2_global_trees[OCTI_V2_CACHE_DECL]
#define UOBJC_V2_VTABLE_decl objc_v2_global_trees[OCTI_V2_VTABLE_DECL]
/* V2 Messaging */
/* objc_msgSend_fixup_rtp */
-#define umsg_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_FIXUP_DECL]
+#define umsg_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_FIXUP_DECL]
/* objc_msgSend_stret_fixup_rtp */
-#define umsg_stret_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_STRET_FIXUP_DECL]
+#define umsg_stret_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_STRET_FIXUP_DECL]
/* objc_msgSendId_fixup_rtp */
-#define umsg_id_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_ID_FIXUP_DECL]
+#define umsg_id_fixup_decl objc_v2_global_trees[OCTI_V2_UMSG_ID_FIXUP_DECL]
/* objc_msgSendId_stret_fixup_rtp */
#define umsg_id_stret_fixup_decl \
- objc_v2_global_trees[OCTI_V2_UMSG_ID_STRET_FIXUP_DECL]
+ objc_v2_global_trees[OCTI_V2_UMSG_ID_STRET_FIXUP_DECL]
/* objc_msgSendSuper2_fixup_rtp */
#define umsg_id_super2_fixup_decl \
objc_v2_global_trees[OCTI_V2_UMSG_SUPER2_FIXUP_DECL]
static GTY ((length ("SIZEHASHTABLE"))) hash *extern_names;
-bool
+bool
objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks)
{
extern_names = ggc_alloc_cleared_vec_hash (SIZEHASHTABLE);
if (flag_objc_exceptions && flag_objc_sjlj_exceptions)
{
inform (UNKNOWN_LOCATION, "%<-fobjc-sjlj-exceptions%> is ignored for "
- "%<-fnext-runtime%> when %<-fobjc-abi-version%> >= 2");
+ "%<-fnext-runtime%> when %<-fobjc-abi-version%> >= 2");
flag_objc_sjlj_exceptions = 0;
}
/* We need a way to convey what kind of meta-data are represented by a given
variable, since each type is expected (by the runtime) to be found in a
specific named section. The solution must be usable with LTO.
-
+
The scheme used for NeXT ABI 0/1 (partial matching of variable names) is not
satisfactory when LTO is used with ABI-2. We now tag ObjC meta-data with
identification attributes in the front end. The back-end may choose to act
meta_clac_meth =
meta_clai_meth =
meta_catc_meth =
- meta_cati_meth =
+ meta_cati_meth =
meta_proto_cls_meth =
meta_proto_nst_meth = meta_base;
objc_v2_selector_type. */
build_v2_message_ref_templates ();
- objc_v2_ivar_list_ptr =
- build_pointer_type (xref_tag (RECORD_TYPE,
+ objc_v2_ivar_list_ptr =
+ build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier ("_ivar_list_t")));
- objc_prop_list_ptr =
+ objc_prop_list_ptr =
build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier ("_prop_list_t")));
-
+
build_v2_class_templates ();
build_v2_super_template ();
build_v2_protocol_template ();
NULL, NULL_TREE);
TREE_NOTHROW (umsg_id_fixup_decl) = 0;
- /* id objc_msgSendId_stret_fixup_rtp
+ /* id objc_msgSendId_stret_fixup_rtp
(id, struct message_ref_t*, ...); */
umsg_id_stret_fixup_decl = add_builtin_function ("objc_msgSendId_stret_fixup",
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_id_stret_fixup_decl) = 0;
- /* id objc_msgSendSuper2_fixup_rtp
+ /* id objc_msgSendSuper2_fixup_rtp
(struct objc_super *, struct message_ref_t*, ...); */
type = build_varargs_function_type_list (objc_object_type,
objc_super_type,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_id_super2_fixup_decl) = 0;
- /* id objc_msgSendSuper2_stret_fixup_rtp
+ /* id objc_msgSendSuper2_stret_fixup_rtp
(struct objc_super *, struct message_ref_t*, ...); */
- umsg_id_super2_stret_fixup_decl =
+ umsg_id_super2_stret_fixup_decl =
add_builtin_function ("objc_msgSendSuper2_stret_fixup",
- type, 0, NOT_BUILT_IN,
+ type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
TREE_NOTHROW (umsg_id_super2_stret_fixup_decl) = 0;
/* Present in the library, but unused by the FE. */
- /* Protocol *objc_getProtocol (const char *)
+ /* Protocol *objc_getProtocol (const char *)
type = build_function_type_list (objc_protocol_type,
const_string_type_node,
NULL_TREE);
type = build_function_type_list (objc_object_type,
const_string_type_node,
NULL_TREE);
- objc_get_class_decl = add_builtin_function (TAG_GETCLASS,
+ objc_get_class_decl = add_builtin_function (TAG_GETCLASS,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
/* id objc_getMetaClass (const char *); */
- objc_get_meta_class_decl = add_builtin_function (TAG_GETMETACLASS,
+ objc_get_meta_class_decl = add_builtin_function (TAG_GETMETACLASS,
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
type = build_function_type_list (void_type_node,
ptr_type_node,
const_ptr_type_node,
- ptrdiff_type_node,
+ ptrdiff_type_node,
boolean_type_node,
boolean_type_node,
NULL_TREE);
/* Declare the following function:
void
- objc_copyStruct (void *destination, const void *source,
+ objc_copyStruct (void *destination, const void *source,
ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */
objc_copyStruct_decl = add_builtin_function ("objc_copyStruct",
type, 0, NOT_BUILT_IN,
TREE_NOTHROW (objc2_end_catch_decl) = 0;
/* void objc_exception_rethrow (void) */
- objc_rethrow_exception_decl =
+ objc_rethrow_exception_decl =
add_builtin_function ("objc_exception_rethrow",
type, 0, NOT_BUILT_IN,
NULL, NULL_TREE);
objc_start_struct (get_identifier ("_message_ref_t"));
/* IMP messenger; */
- ptr_message_ref_t =
- build_pointer_type (xref_tag (RECORD_TYPE,
+ ptr_message_ref_t =
+ build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier ("_message_ref_t")));
- objc_v2_imp_type =
- build_pointer_type (build_function_type_list
+ objc_v2_imp_type =
+ build_pointer_type (build_function_type_list
(objc_object_type,
objc_object_type,
ptr_message_ref_t,
objc_start_struct (get_identifier ("_super_message_ref_t"));
/* SUPER_IMP messenger; */
- ptr_message_ref_t = build_pointer_type
- (xref_tag (RECORD_TYPE,
+ ptr_message_ref_t = build_pointer_type
+ (xref_tag (RECORD_TYPE,
get_identifier ("_super_message_ref_t")));
- objc_v2_super_imp_type =
- build_pointer_type (build_function_type_list
+ objc_v2_super_imp_type =
+ build_pointer_type (build_function_type_list
(objc_object_type,
objc_super_type,
ptr_message_ref_t,
add_field_decl (objc_selector_type, "name", &chain);
objc_finish_struct (objc_v2_super_message_ref_template, decls);
- objc_v2_super_selector_type =
+ objc_v2_super_selector_type =
build_pointer_type (objc_v2_super_message_ref_template);
}
struct class_t *superclass;
void *cache;
IMP *vtable;
-
+
...When this is active - it will point to a rw version, but
when we build the meta-data we point it to the ro...
struct class_ro_t *data;
tree decls, *chain = NULL;
/* struct class_ro_t {...} */
- objc_v2_class_ro_template =
+ objc_v2_class_ro_template =
objc_start_struct (get_identifier (UTAG_V2_CLASS_RO));
/* uint32_t const flags; */
add_field_decl (objc_method_list_ptr, "baseMethods", &chain);
/* const struct objc_protocol_list *const baseProtocols; */
- add_field_decl (build_pointer_type
- (xref_tag (RECORD_TYPE,
+ add_field_decl (build_pointer_type
+ (xref_tag (RECORD_TYPE,
get_identifier (UTAG_V2_PROTOCOL_LIST))),
"baseProtocols", &chain);
/* const struct ivar_list_t *const ivars; */
- add_field_decl (objc_v2_ivar_list_ptr, "ivars", &chain);
+ add_field_decl (objc_v2_ivar_list_ptr, "ivars", &chain);
/* const uint8_t * const weakIvarLayout; */
add_field_decl (cnst_strg_type, "weakIvarLayout", &chain);
chain = NULL;
/* struct class_t {...} */
- objc_v2_class_template =
+ objc_v2_class_template =
objc_start_struct (get_identifier (UTAG_V2_CLASS));
/* struct class_t *isa; */
add_field_decl (build_pointer_type (objc_v2_imp_type), "vtable", &chain);
/* struct class_ro_t *ro; */
- add_field_decl (build_pointer_type (objc_v2_class_ro_template), "ro", &chain);
+ add_field_decl (build_pointer_type (objc_v2_class_ro_template), "ro", &chain);
objc_finish_struct (objc_v2_class_template, decls);
}
/* struct protocol_t
{
- Class isa;
+ Class isa;
const char * const protocol_name;
const struct protocol_list_t * const protocol_list;
const struct method_list_t * const instance_methods;
{
tree decls, *chain = NULL;
- objc_v2_protocol_template =
+ objc_v2_protocol_template =
objc_start_struct (get_identifier (UTAG_V2_PROTOCOL));
/* Class isa; */
{
tree decls, *chain = NULL;
- objc_v2_category_template =
+ objc_v2_category_template =
objc_start_struct (get_identifier ("_category_t"));
/* char *name; */
table. Note that hashing is done on its inner IDENTIFIER_NODE
node. */
-static void
+static void
hash_name_enter (hash *hashlist, tree id)
{
hash obj;
if (var)
return var;
/* New name. */
- var = start_var_decl (type, name);
+ var = start_var_decl (type, name);
TREE_STATIC (var) = 0;
DECL_EXTERNAL (var) = 1;
TREE_PUBLIC (var) = 1;
/* Create a symbol with __attribute__ ((visibility ("hidden")))
attribute (private extern). */
-static tree
+static tree
create_hidden_decl (tree type, const char *name)
{
tree decl = create_global_decl (type, name);
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "OBJC_CLASS_$_%s",
+ snprintf (buf, BUFSIZE, "OBJC_CLASS_$_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass)));
/* ObjC2 classes are extern visible. */
decl = create_global_decl (objc_v2_class_template, buf);
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s",
+ snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass)));
/* ObjC2 classes are extern visible. */
decl = create_global_decl (objc_v2_class_template, buf);
{
tree decl;
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_Category_%s_on_%s",
IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass)),
IDENTIFIER_POINTER (CLASS_NAME (klass)));
decl = start_var_decl (objc_v2_category_template, buf);
case prop_names_attr:
OBJCMETA (var, objc_meta, meta_prop_name_attr);
break;
- default:
+ default:
OBJCMETA (var, objc_meta, meta_base);
break;
}
t = buf;
while (*t)
{
- if (*t==':')
+ if (*t==':')
*t = '$'; /* Underscore would clash between foo:bar and foo_bar. */
t++;
}
t = buf;
while (*t)
{
- if (*t==':')
+ if (*t==':')
*t = '$'; /* Underscore would clash between foo:bar and foo_bar. */
t++;
}
msgrefs = VEC_alloc (msgref_entry, gc, 32);
/* We come here if we don't find a match or at the start. */
- decl = build_v2_message_reference_decl (sel_name,
+ decl = build_v2_message_reference_decl (sel_name,
DECL_NAME (message_func_decl));
e.func = message_func_decl;
e.selname = sel_name;
tree protocol_ident = PROTOCOL_NAME (protocol);
char buf[BUFSIZE];
- snprintf (buf, BUFSIZE, "_OBJC_ProtocolRef_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_ProtocolRef_%s",
IDENTIFIER_POINTER (protocol_ident));
/* TODO: other compiler versions make these hidden & weak. */
decl = create_global_decl (objc_protocol_type, buf);
tree field = NULL_TREE;
tree basetype = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
- if (TREE_CODE (basetype) == RECORD_TYPE
+ if (TREE_CODE (basetype) == RECORD_TYPE
&& TYPE_HAS_OBJC_INFO (basetype) && TYPE_OBJC_INTERFACE (basetype))
{
*klass = lookup_interface (OBJC_TYPE_NAME (basetype));
}
}
return field;
-}
+}
static void
create_ivar_offset_name (char *buf, tree class_name, tree field_decl)
ftype = TREE_TYPE (field);
/* (char*)datum */
- expr = build_c_cast (input_location,
+ expr = build_c_cast (input_location,
string_type_node, build_fold_addr_expr (datum));
/* (char*)datum + offset */
- expr = fold_build2_loc (input_location,
+ expr = fold_build2_loc (input_location,
POINTER_PLUS_EXPR, string_type_node, expr, offset);
-
+
/* (ftype*)((char*)datum + offset) */
expr = build_c_cast (input_location, build_pointer_type (ftype), expr);
on the fly. That is, unless they refer to (private) fields in the
class stucture. */
static tree
-next_runtime_abi_02_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED,
+next_runtime_abi_02_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED,
tree base, tree id)
{
tree ivar;
}
static tree
-next_runtime_abi_02_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
+next_runtime_abi_02_get_category_super_ref (location_t loc ATTRIBUTE_UNUSED,
struct imp_entry *imp, bool inst_meth)
{
/* ??? is this OK when zero-link = true? */
super_class = objc_get_class_reference (CLASS_NAME (imp->imp_template));
if (!inst_meth)
-
+
/* If we are in a class method, we must retrieve the
_metaclass_ for the current class, pointed at by the
class's "isa" pointer. The following assumes that "isa" is
the first ivar in a class (which it must be). */
- super_class =
+ super_class =
build_indirect_ref (input_location,
build_c_cast (input_location,
build_pointer_type (objc_class_type),
- super_class),
+ super_class),
RO_UNARY_STAR);
return super_class;
}
gcc_assert (TREE_CHAIN (typelist));
typetail = TREE_CHAIN (TREE_CHAIN (typelist));
- for (valtail = values; valtail;
+ for (valtail = values; valtail;
valtail = TREE_CHAIN (valtail), typetail = TREE_CHAIN (typetail))
{
tree value = TREE_VALUE (valtail);
tree type = typetail ? TREE_VALUE (typetail) : NULL_TREE;
if (type == NULL_TREE)
- break;
+ break;
if (!TREE_SIDE_EFFECTS (value))
continue;
/* To prevent re-evaluation. */
= (method_prototype
? TREE_VALUE (TREE_TYPE (method_prototype))
: objc_object_type);
- tree method_param_types = get_arg_type_list (method_prototype,
+ tree method_param_types = get_arg_type_list (method_prototype,
METHOD_REF, super_flag);
tree ftype = build_function_type (ret_type, method_param_types);
sender_cast = build_pointer_type (ftype);
if (check_for_nil)
- method_params = objc_copy_to_temp_side_effect_params (method_param_types,
+ method_params = objc_copy_to_temp_side_effect_params (method_param_types,
method_params);
/* Get &message_ref_t.messenger. */
- sender = build_c_cast (input_location,
+ sender = build_c_cast (input_location,
build_pointer_type (super_flag
? objc_v2_super_imp_type
: objc_v2_imp_type),
else
ftree = fold_convert (ret_type, integer_zero_node);
- ifexp = build_binary_op (input_location, NE_EXPR,
- lookup_object,
+ ifexp = build_binary_op (input_location, NE_EXPR,
+ lookup_object,
fold_convert (rcv_p, integer_zero_node), 1);
#ifdef OBJCPLUS
ret_val = build_conditional_expr (ifexp, ret_val, ftree, tf_warning_or_error);
#else
/* ??? CHECKME. */
- ret_val = build_conditional_expr (input_location,
+ ret_val = build_conditional_expr (input_location,
ifexp, 1,
ret_val, NULL_TREE,
ftree, NULL_TREE);
-#endif
+#endif
}
return ret_val;
}
tree message_func_decl;
bool check_for_nil = flag_objc_nilcheck;
- ret_type = (method_prototype ?
- TREE_VALUE (TREE_TYPE (method_prototype)) :
- objc_object_type);
+ ret_type = method_prototype
+ ? TREE_VALUE (TREE_TYPE (method_prototype))
+ : objc_object_type;
/* Do we need to check for nil receivers ? */
/* For now, message sent to classes need no nil check. In the
future, class declaration marked as weak_import must be nil
checked. */
- if (super
- || (TREE_CODE (receiver) == VAR_DECL
+ if (super
+ || (TREE_CODE (receiver) == VAR_DECL
&& TREE_TYPE (receiver) == objc_class_type))
check_for_nil = false;
if (!targetm.calls.struct_value_rtx (0, 0)
- && (TREE_CODE (ret_type) == RECORD_TYPE
- || TREE_CODE (ret_type) == UNION_TYPE)
+ && (TREE_CODE (ret_type) == RECORD_TYPE
+ || TREE_CODE (ret_type) == UNION_TYPE)
&& targetm.calls.return_in_memory (ret_type, 0))
{
if (super)
message_func_decl = umsg_id_super2_stret_fixup_decl;
else
- message_func_decl = objc_is_id (rtype)
- ? umsg_id_stret_fixup_decl
- : umsg_stret_fixup_decl;
+ message_func_decl = objc_is_id (rtype)
+ ? umsg_id_stret_fixup_decl
+ : umsg_stret_fixup_decl;
}
else
{
if (super)
message_func_decl = umsg_id_super2_fixup_decl;
else
- message_func_decl = objc_is_id (rtype)
- ? umsg_id_fixup_decl
- : umsg_fixup_decl;
+ message_func_decl = objc_is_id (rtype)
+ ? umsg_id_fixup_decl
+ : umsg_fixup_decl;
}
- selector = build_v2_selector_messenger_reference (sel_name,
+ selector = build_v2_selector_messenger_reference (sel_name,
message_func_decl);
/* selector = &_msg; */
selector = build_unary_op (loc, ADDR_EXPR, selector, 0);
-
- selector = build_c_cast (loc, (super ? objc_v2_super_selector_type
+
+ selector = build_c_cast (loc, (super ? objc_v2_super_selector_type
: objc_v2_selector_type),
selector);
/* (*_msg.messenger) (receiver, &_msg, ...); */
return build_v2_build_objc_method_call (super, method_prototype,
- receiver, selector,
+ receiver, selector,
method_params, check_for_nil);
}
available yet (in fact it is not in most cases). So, declare an
extern OBJC_CLASS_$_NSConstantString in its place. */
if (!string_class_decl)
- string_class_decl =
+ string_class_decl =
create_extern_decl (objc_v2_class_template,
IDENTIFIER_POINTER (constant_string_global_id));
struct _prop_t
{
const char * const name; // property name
- const char * const attributes; // comma-delimited, encoded,
+ const char * const attributes; // comma-delimited, encoded,
// property attributes
};
*/
objc_ivar_record = objc_start_struct (objc_ivar_id);
/* unsigned long int *offset; */
- decls = add_field_decl (build_pointer_type
+ decls = add_field_decl (build_pointer_type
(TREE_TYPE (size_zero_node)), "offset", &chain);
/* char *name; */
objc_method_template = build_method_template ();
if (!objc_v2_property_template)
- objc_v2_property_template = build_v2_property_template ();
+ objc_v2_property_template = build_v2_property_template ();
if (!objc_v2_ivar_template)
objc_v2_ivar_template = build_v2_ivar_t_template ();
objc_build_internal_classname (tree ident, bool metaclass)
{
static char string[512];
- snprintf (string, 512, "%s_%s", metaclass ? "OBJC_METACLASS_$"
- : "OBJC_CLASS_$",
+ snprintf (string, 512, "%s_%s", metaclass ? "OBJC_METACLASS_$"
+ : "OBJC_CLASS_$",
IDENTIFIER_POINTER (ident));
return string;
}
return string;
}
-/* Build the struct message_ref_t msg =
- {objc_msgSend_fixup_xxx, @selector(func)}
+/* Build the struct message_ref_t msg =
+ {objc_msgSend_fixup_xxx, @selector(func)}
table. */
-static
+static
void build_v2_message_ref_translation_table (void)
{
int count;
expr = build_selector (ref->selname);
CONSTRUCTOR_APPEND_ELT (initializer, NULL_TREE, expr);
constructor = objc_build_constructor (struct_type, initializer);
- finish_var_decl (ref->refdecl, constructor);
+ finish_var_decl (ref->refdecl, constructor);
}
}
expr = convert (objc_class_type, build_fold_addr_expr (expr));
}
/* The runtime wants this, even if it appears unused, so we must force the
- output.
+ output.
DECL_PRESERVE_P (decl) = 1; */
finish_var_decl (decl, expr);
}
static GTY(()) VEC(tree,gc) *class_list;
-static void
+static void
objc_v2_add_to_class_list (tree global_class_decl)
{
if (!class_list)
/* Add the global class meta-data declaration to the list which later
on ends up in the __nonlazy_class section. */
-static void
+static void
objc_v2_add_to_nonlazy_class_list (tree global_class_decl)
{
if (!nonlazy_class_list)
/* Add the category meta-data declaration to the list which later on
ends up in the __nonlazy_category section. */
-static void
+static void
objc_v2_add_to_category_list (tree decl)
{
if (!category_list)
/* Add the category meta-data declaration to the list which later on
ends up in the __category_list section. */
-static void
+static void
objc_v2_add_to_nonlazy_category_list (tree decl)
{
if (!nonlazy_category_list)
CONSTRUCTOR_APPEND_ELT (initlist, purpose, expr);
}
gcc_assert (count > 0);
- type = build_array_type (objc_class_type,
+ type = build_array_type (objc_class_type,
build_index_type (build_int_cst (NULL_TREE, count - 1)));
decl = start_var_decl (type, nam);
/* The runtime wants this, even if it appears unused, so we must
{
int count;
prot_list_entry *ref;
-
+
if (!protrefs)
return;
char buf[BUFSIZE];
tree expr;
gcc_assert (TREE_CODE (ref->id) == PROTOCOL_INTERFACE_TYPE);
- snprintf (buf, BUFSIZE, "_OBJC_Protocol_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_Protocol_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (ref->id)));
expr = start_var_decl (objc_v2_protocol_template, buf);
expr = convert (objc_protocol_type, build_fold_addr_expr (expr));
switch (TREE_CODE (i_or_p))
{
case PROTOCOL_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_ProtocolRefs_%s",
IDENTIFIER_POINTER (PROTOCOL_NAME (i_or_p)));
break;
case CLASS_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_ClassProtocols_%s",
IDENTIFIER_POINTER (CLASS_NAME (i_or_p)));
break;
case CATEGORY_INTERFACE_TYPE:
- snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s",
+ snprintf (buf, BUFSIZE, "_OBJC_CategoryProtocols_%s_%s",
IDENTIFIER_POINTER (CLASS_NAME (klass_ctxt)),
IDENTIFIER_POINTER (CLASS_SUPER_NAME (klass_ctxt)));
break;
/* ObjC2 puts all these in the base section. */
OBJCMETA (refs_decl, objc_meta, meta_base);
DECL_PRESERVE_P (refs_decl) = 1;
- finish_var_decl (refs_decl,
+ finish_var_decl (refs_decl,
objc_build_constructor (TREE_TYPE (refs_decl),initlist));
return refs_decl;
}
do
{
VEC(constructor_elt,gc) *eltlist = NULL;
- CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE,
build_selector (METHOD_SEL_NAME (entries)));
- CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE,
add_objc_string (METHOD_ENCODING (entries),
meth_var_types));
CONSTRUCTOR_APPEND_ELT (eltlist, NULL_TREE, null_pointer_node);
- CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
objc_build_constructor (type, eltlist));
entries = TREE_CHAIN (entries);
}
tree array_type, decls, *chain = NULL;
method_list_t_record = objc_start_struct (NULL_TREE);
-
+
/* uint32_t const entsize; */
decls = add_field_decl (integer_type_node, "entsize", &chain);
/* Note, as above that we are building to the objc_method_template
which has the *imp field. ABI0/1 build with
objc_method_prototype_template which is missing this field. */
-static tree
+static tree
generate_v2_meth_descriptor_table (tree chain, tree protocol,
const char *prefix, tree attr)
{
gcc_assert (size);
method_list_template = build_v2_method_list_template (objc_method_template,
size);
- snprintf (buf, BUFSIZE, "%s_%s", prefix,
+ snprintf (buf, BUFSIZE, "%s_%s", prefix,
IDENTIFIER_POINTER (PROTOCOL_NAME (protocol)));
decl = start_var_decl (method_list_template, buf);
entsize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, entsize));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, size));
- initlist =
+ initlist =
build_v2_descriptor_table_initializer (objc_method_template,
chain);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist);
later. */
tree attribute, name_ident = PROPERTY_NAME (x);
- CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE,
add_objc_string (name_ident, prop_names_attr));
attribute = objc_v2_encode_prop_attr (x);
- CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (elemlist, NULL_TREE,
add_objc_string (attribute, prop_names_attr));
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
/* anonymous. */
property_list_t_record = objc_start_struct (NULL_TREE);
-
+
/* uint32_t const entsize; */
decls = add_field_decl (integer_type_node, "entsize", &chain);
if (size == 0)
return NULL_TREE;
- property_list_template =
- build_v2_property_list_template (objc_v2_property_template,
+ property_list_template =
+ build_v2_property_list_template (objc_v2_property_template,
size);
initlist = build_v2_property_table_initializer (objc_v2_property_template,
decl = start_var_decl (property_list_template, buf);
- CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
build_int_cst (NULL_TREE, init_val));
- CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
build_int_cst (NULL_TREE, size));
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, initlist);
static tree
build_v2_protocol_initializer (tree type, tree protocol_name, tree protocol_list,
- tree inst_methods, tree class_methods,
+ tree inst_methods, tree class_methods,
tree opt_ins_meth, tree opt_cls_meth,
tree property_list)
{
loc = UNKNOWN_LOCATION;
/* This is NULL for the new ABI. */
- CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
convert (objc_object_type, null_pointer_node));
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, protocol_name);
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr);
/* const uint32_t size; = sizeof(struct protocol_t) */
- expr = build_int_cst (integer_type_node,
+ expr = build_int_cst (integer_type_node,
TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_protocol_template)));
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE, expr);
/* const uint32_t flags; = 0 */
loc = DECL_SOURCE_LOCATION (decl);
some = true;
- inst_meth =
+ inst_meth =
generate_v2_meth_descriptor_table (PROTOCOL_NST_METHODS (p), p,
"_OBJC_ProtocolInstanceMethods",
meta_proto_nst_meth);
- class_meth =
+ class_meth =
generate_v2_meth_descriptor_table (PROTOCOL_CLS_METHODS (p), p,
"_OBJC_ProtocolClassMethods",
meta_proto_cls_meth);
"_OBJC_OptProtocolInstMethods",
meta_proto_nst_meth);
- opt_class_meth =
+ opt_class_meth =
generate_v2_meth_descriptor_table (PROTOCOL_OPTIONAL_CLS_METHODS (p), p,
"_OBJC_OptProtocolClassMethods",
meta_proto_cls_meth);
decl = start_var_decl (method_list_template, name);
init_val = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template));
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (integer_type_node, init_val));
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
build_int_cst (integer_type_node, size));
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, initlist);
tree cat_decl = impent->class_decl;
location_t loc;
char buf[BUFSIZE];
-
+
loc = DECL_SOURCE_LOCATION (cat_decl);
/* ??? not sure this is really necessary, the following references should
- force appropriate linkage linkage...
+ force appropriate linkage linkage...
-- but ... ensure a reference to the class... */
t = objc_v2_get_class_reference (CLASS_NAME (cat));
/* ... which we ignore so force it out.. */
{
VEC(constructor_elt,gc) *inits = NULL;
- do
+ do
{
VEC(constructor_elt,gc) *ivar = NULL;
int val;
/* Set offset. */
CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE,
build_unary_op (input_location,
- ADDR_EXPR,
- ivar_offset_ref (class_name,
+ ADDR_EXPR,
+ ivar_offset_ref (class_name,
field_decl), 0));
/* Set name. */
/* Set alignment. */
val = DECL_ALIGN_UNIT (field_decl);
val = exact_log2 (val);
- CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE,
build_int_cst (integer_type_node, val));
-
+
/* Set size. */
val = TREE_INT_CST_LOW (DECL_SIZE_UNIT (field_decl));
- CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (ivar, NULL_TREE,
build_int_cst (integer_type_node, val));
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
tree decl, initlist, ivar_list_template;
VEC(constructor_elt,gc) *inits = NULL;
int size, ivar_t_size;
-
+
if (!chain || !name || !(size = ivar_list_length (chain)))
return NULL_TREE;
generating_instance_variables = 1;
ivar_list_template = build_v2_ivar_list_t_template (objc_v2_ivar_template,
size);
-
+
initlist = build_v2_ivar_list_initializer (CLASS_NAME (templ),
objc_v2_ivar_template, chain);
ivar_t_size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_ivar_template));
-
+
decl = start_var_decl (ivar_list_template, name);
- CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
build_int_cst (integer_type_node, ivar_t_size));
CONSTRUCTOR_APPEND_ELT (inits, NULL_TREE,
build_int_cst (integer_type_node, size));
/* Routine to build object of struct class_ro_t { ... }; */
static tree
-build_v2_class_ro_t_initializer (tree type, tree name,
+build_v2_class_ro_t_initializer (tree type, tree name,
unsigned int flags, unsigned int instanceStart,
- unsigned int instanceSize,
- tree ivarLayout,
- tree baseMethods, tree baseProtocols,
+ unsigned int instanceSize,
+ tree ivarLayout,
+ tree baseMethods, tree baseProtocols,
tree ivars, tree property_list)
{
tree expr, unsigned_char_star, ltyp;
loc = UNKNOWN_LOCATION;
/* flags */
- CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
build_int_cst (integer_type_node, flags));
/* instanceStart */
- CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
build_int_cst (integer_type_node, instanceStart));
/* instanceSize */
- CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
build_int_cst (integer_type_node, instanceSize));
/* This ABI is currently only used on m64 NeXT. We always
explicitly declare the alignment padding. */
/* reserved, pads alignment. */
- CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
build_int_cst (integer_type_node, 0));
/* ivarLayout */
CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE, expr);
/* baseProtocols */
- ltyp = build_pointer_type (xref_tag (RECORD_TYPE,
+ ltyp = build_pointer_type (xref_tag (RECORD_TYPE,
get_identifier (UTAG_V2_PROTOCOL_LIST)));
if (baseProtocols)
expr = convert (ltyp, build_unary_op (loc, ADDR_EXPR, baseProtocols, 0));
/* TODO: We don't yet have the weak/strong stuff... */
/* weakIvarLayout */
- CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
+ CONSTRUCTOR_APPEND_ELT (initlist, NULL_TREE,
convert (unsigned_char_star, null_pointer_node));
/* property list */
}
while (1);
- /* {extern} struct class_t OBJC_METACLASS_$_<my_root_int>
+ /* {extern} struct class_t OBJC_METACLASS_$_<my_root_int>
create extern if not already declared. */
- snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s",
+ snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s",
IDENTIFIER_POINTER (CLASS_NAME (my_root_int)));
root_expr = create_extern_decl (objc_v2_class_template, buf);
root_expr = build_fold_addr_expr (root_expr);
interface = lookup_interface (my_super_id);
gcc_assert (interface);
/* Similarly, for OBJC_CLASS_$_<interface>... */
- snprintf (buf, BUFSIZE, "OBJC_CLASS_$_%s",
+ snprintf (buf, BUFSIZE, "OBJC_CLASS_$_%s",
IDENTIFIER_POINTER (CLASS_NAME (interface)));
class_superclass_expr = create_extern_decl (objc_v2_class_template, buf);
class_superclass_expr = build_fold_addr_expr (class_superclass_expr);
/* ... and for OBJC_METACLASS_$_<interface>. */
- snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s",
+ snprintf (buf, BUFSIZE, "OBJC_METACLASS_$_%s",
IDENTIFIER_POINTER (CLASS_NAME (interface)));
metaclass_superclass_expr = create_extern_decl (objc_v2_class_template, buf);
metaclass_superclass_expr = build_fold_addr_expr (metaclass_superclass_expr);
{
snprintf (buf, BUFSIZE, "_OBJC_ClassMethods_%s",
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)));
- class_methods =
+ class_methods =
generate_v2_dispatch_table (CLASS_CLS_METHODS (impent->imp_context),
buf, meta_clac_meth);
}
class_ivars = NULL_TREE;
/* TODO: Add total size of class variables when implemented. */
- instanceSize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_class_template));
+ instanceSize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_v2_class_template));
/* So now build the META CLASS structs. */
/* static struct class_ro_t _OBJC_METACLASS_Foo = { ... }; */
(DECL_NAME (metaclass_decl))));
/* TODO: ivarLayout needs t be built. */
- initlist =
+ initlist =
build_v2_class_ro_t_initializer (TREE_TYPE (decl), name_expr,
(flags | cls_flags), instanceStart,
- instanceSize, ivarLayout,
+ instanceSize, ivarLayout,
class_methods, protocol_decl,
class_ivars, NULL_TREE);
/* The ROs sit in the default const section. */
finish_var_decl (decl, initlist);
/* static struct class_t _OBJC_METACLASS_Foo = { ... }; */
- initlist =
+ initlist =
build_v2_class_t_initializer (TREE_TYPE (metaclass_decl),
root_expr,
metaclass_superclass_expr,
build_fold_addr_expr (decl),
- build_fold_addr_expr (UOBJC_V2_CACHE_decl),
+ build_fold_addr_expr (UOBJC_V2_CACHE_decl),
build_fold_addr_expr (UOBJC_V2_VTABLE_decl));
/* The class section attributes are set when they are created. */
finish_var_decl (metaclass_decl, initlist);
{
snprintf (buf, BUFSIZE, "_OBJC_InstanceMethods_%s",
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)));
- inst_methods =
+ inst_methods =
generate_v2_dispatch_table (CLASS_NST_METHODS (impent->imp_context),
buf, meta_clai_meth);
}
{
snprintf (buf, BUFSIZE, "_OBJC_InstanceIvars_%s",
IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)));
- inst_ivars = generate_v2_ivars_list (chain, buf, meta_clai_vars,
+ inst_ivars = generate_v2_ivars_list (chain, buf, meta_clai_vars,
impent->imp_template);
}
while (field && TREE_CHAIN (field)
&& TREE_CODE (TREE_CHAIN (field)) == FIELD_DECL)
field = TREE_CHAIN (field);
-
+
if (field && TREE_CODE (field) == FIELD_DECL)
- instanceSize = int_byte_position (field) * BITS_PER_UNIT
+ instanceSize = int_byte_position (field) * BITS_PER_UNIT
+ tree_low_cst (DECL_SIZE (field), 0);
else
instanceSize = 0;
/* If the class has no ivars, instanceStart should be set to the
superclass's instanceSize. */
- instanceStart =
- (inst_ivars != NULL_TREE) ? (unsigned) int_byte_position (firstIvar)
+ instanceStart =
+ (inst_ivars != NULL_TREE) ? (unsigned) int_byte_position (firstIvar)
: instanceSize;
/* static struct class_ro_t _OBJC_CLASS_Foo = { ... }; */
- decl = start_var_decl (objc_v2_class_ro_template,
+ decl = start_var_decl (objc_v2_class_ro_template,
newabi_append_ro (IDENTIFIER_POINTER
- (DECL_NAME (class_decl))));
+ (DECL_NAME (class_decl))));
- initlist =
+ initlist =
build_v2_class_ro_t_initializer (TREE_TYPE (decl), name_expr,
(flags | cls_flags), instanceStart,
- instanceSize, ivarLayout,
+ instanceSize, ivarLayout,
inst_methods, protocol_decl,
inst_ivars, props);
/* The ROs sit in the default const section. */
build_fold_addr_expr (metaclass_decl),
class_superclass_expr,
build_fold_addr_expr (decl),
- build_fold_addr_expr (UOBJC_V2_CACHE_decl),
- build_fold_addr_expr (UOBJC_V2_VTABLE_decl));
+ build_fold_addr_expr (UOBJC_V2_CACHE_decl),
+ build_fold_addr_expr (UOBJC_V2_VTABLE_decl));
/* The class section attributes are set when they are created. */
finish_var_decl (class_decl, initlist);
{
tree decl, array_type;
VEC(constructor_elt,gc) *v = NULL;
- int flags =
+ int flags =
((flag_replace_objc_classes && imp_count ? 1 : 0)
| (flag_objc_gc ? 2 : 0));
flags |= 16;
-
+
array_type = build_sized_array_type (integer_type_node, 2);
decl = start_var_decl (array_type, "_OBJC_ImageInfo");
build_v2_protocol_list_translation_table ();
build_v2_protocol_list_address_table ();
- build_v2_address_table (class_list, "_OBJC_ClassList$",
+ build_v2_address_table (class_list, "_OBJC_ClassList$",
meta_label_classlist);
- build_v2_address_table (category_list, "_OBJC_CategoryList$",
+ build_v2_address_table (category_list, "_OBJC_CategoryList$",
meta_label_categorylist);
- build_v2_address_table (nonlazy_class_list, "_OBJC_NonLazyClassList$",
+ build_v2_address_table (nonlazy_class_list, "_OBJC_NonLazyClassList$",
meta_label_nonlazy_classlist);
- build_v2_address_table (nonlazy_category_list, "_OBJC_NonLazyCategoryList$",
+ build_v2_address_table (nonlazy_category_list, "_OBJC_NonLazyCategoryList$",
meta_label_nonlazy_categorylist);
/* This conveys information on GC usage and zero-link. */
name_expr = add_objc_string (name, class_names);
/* Extern ref. for the class. ??? Maybe we can look this up
somewhere. */
- class_name_expr =
+ class_name_expr =
create_extern_decl (objc_v2_class_template,
objc_build_internal_classname (name, false));
class_name_expr = build_fold_addr_expr (class_name_expr);
cls = lookup_interface (CLASS_SUPER_NAME (cls));
}
- return false;
+ return false;
}
-static bool
+static bool
is_implemented (tree name)
{
struct imp_entry *t;
{
/* This is provided by the Apple/NeXT libobjc.dylib so we
need only to reference it. */
- next_v2_EHTYPE_id_decl =
+ next_v2_EHTYPE_id_decl =
start_var_decl (objc_v2_ehtype_template, "OBJC_EHTYPE_id");
DECL_EXTERNAL (next_v2_EHTYPE_id_decl) = 1;
TREE_PUBLIC (next_v2_EHTYPE_id_decl) = 1;
goto err_mark_in;
#endif
}
- else
+ else
t = OBJC_TYPE_NAME (TREE_TYPE (type));
-
+
/* We have to build a reference to the OBJC_EHTYPE_<Class>. */
t = lookup_ehtype_ref (t);
if (!t)
}
/* try { catch-body } finally { objc_end_catch (); } */
-static void
+static void
finish_catch (struct objc_try_context **cur_try_context, tree curr_catch)
{
struct objc_try_context *ct;
}
/* Pick up the new context we made in begin_try above... */
- ct = *cur_try_context;
+ ct = *cur_try_context;
func = build_function_call_vec (loc, objc2_end_catch_decl, NULL, NULL);
append_to_statement_list (func, &ct->finally_body);
try_exp = build_stmt (loc, TRY_FINALLY_EXPR, ct->try_body, ct->finally_body);
append_to_statement_list (curr_catch, &((*cur_try_context)->catch_list));
}
-static tree
+static tree
finish_try_stmt (struct objc_try_context **cur_try_context)
{
struct objc_try_context *c = *cur_try_context;
/* Hooks to abstract the runtime meta-data generation for Objective C.
Copyright (C) 2011 Free Software Foundation, Inc.
- Contributed by Iain Sandoe
+ Contributed by Iain Sandoe
This file is part of GCC.
/* A set of hooks for the front end to obtain runtime-specific actions. */
-/* Objective-C supports several runtime library variants:
+/* Objective-C supports several runtime library variants:
"GNU" runtime selected by -fgnu-runtime (currently at ABI version 8).
"NeXT" runtime (selected by -fnext-runtime) and installed on OSX/Darwin
systems at API version 1 (for m32 code) and version 2 (for m64 code).
-
+
The runtimes require different data types/layouts, method call mechanisms
and so on, and the purpose of this interface is to abstract such
differences from the parser's perspective. */
/* TODO: Do we want the initial underscore ? */
-typedef struct _objc_runtime_hooks_r
+typedef struct _objc_runtime_hooks_r
{
/* TODO: Expand comments in this file. */
/* Initialize for this runtime. */
void (*initialize) (void);
const char *default_constant_string_class_name;
-
+
/* FIXME: Having to check this name should not be necessary. */
- const char *tag_getclass;
+ const char *tag_getclass;
/* id for superclass class field - named differently in the existing
runtimes. */
tree (*super_superclassfield_ident) (void);
tree (*get_arg_type_list_base) (tree, int, int);
/* Build method call. */
tree (*build_objc_method_call) (location_t, tree, tree, tree, tree, tree, int);
-
+
/* Check for or otherwise handle a request to check that the constant
string class reference is set-up & OK. */
bool (*setup_const_string_class_decl) (void);
/* Return the tree reprenting a const string constructor for the arg.
Most of the data are in global trees. */
tree (*build_const_string_constructor) (location_t, tree, int);
-
+
/* Exceptions. */
tree (*build_throw_stmt) (location_t, tree, bool);
tree (*build_exc_ptr) (struct objc_try_context **);
tree (*begin_catch) (struct objc_try_context **, tree, tree, tree, bool);
void (*finish_catch) (struct objc_try_context **, tree);
tree (*finish_try_stmt) (struct objc_try_context **);
-
+
/* Emit all the metadata required by the runtime - based on the tables built
during parsing. */
void (*generate_metadata) (void);
/* struct _objc_super {
struct _objc_object *self;
- struct _objc_class *super_class;
- [or Class cls; for the abi v2]
+ struct _objc_class *super_class;
+ [or Class cls; for the abi v2]
}; */
void
{
tree *chain, decl, type;
char buf[BUFSIZE];
-
+
switch (section)
{
case class_names:
}
type = build_sized_array_type (char_type_node, IDENTIFIER_LENGTH (ident) + 1);
- /* Get a runtime-specific string decl which will be finish_var()'ed in
+ /* Get a runtime-specific string decl which will be finish_var()'ed in
generate_strings (). */
decl = (*runtime.string_decl) (type, buf, section);
TREE_CONSTANT (decl) = 1;
*chain = tree_cons (decl, ident, NULL_TREE);
- return convert (string_type_node,
+ return convert (string_type_node,
build_unary_op (input_location, ADDR_EXPR, decl, 1));
}
/* No really useful place to point to. */
loc = UNKNOWN_LOCATION;
-
+
/* version = { 1, ... } */
expr = build_int_cst (long_integer_type_node, vers);
/* symtab = { ..., _OBJC_SYMBOLS, ... } */
ltyp = build_pointer_type (xref_tag (RECORD_TYPE,
- get_identifier (UTAG_SYMTAB)));
+ get_identifier (UTAG_SYMTAB)));
if (UOBJC_SYMBOLS_decl)
expr = convert (ltyp, build_unary_op (loc,
ADDR_EXPR, UOBJC_SYMBOLS_decl, 0));
/* Allow the runtime to mark meta-data such that it can be assigned to target
specific sections by the back-end. */
if (attr)
- DECL_ATTRIBUTES (UOBJC_MODULES_decl) = attr;
+ DECL_ATTRIBUTES (UOBJC_MODULES_decl) = attr;
finish_var_decl (UOBJC_MODULES_decl,
init_module_descriptor (TREE_TYPE (UOBJC_MODULES_decl),
if (warn_selector)
{
location_t loc;
- if (decl)
+ if (decl)
loc = DECL_SOURCE_LOCATION (decl);
else
loc = UNKNOWN_LOCATION;
if (decl)
{
/* Entries of this form are used for references to methods.
- The runtime re-writes these on start-up, but the compiler can't see
+ The runtime re-writes these on start-up, but the compiler can't see
that and optimizes it away unless we force it. */
DECL_PRESERVE_P (decl) = 1;
finish_var_decl (decl, expr);
/* Support routines shared by all runtimes.
Copyright (C) 2011 Free Software Foundation, Inc.
- Contributed by Iain Sandoe
+ Contributed by Iain Sandoe
This file is part of GCC.
it and we just need to swap Operand 2 in, and emit the deprecation
warnings from Operand 3 if needed.
- Please note that when the Objective-C 2.0 "dot-syntax" 'object.component'
+ Please note that when the Objective-C 2.0 "dot-syntax" 'object.component'
is encountered, where 'component' is not a property but there are valid
setter/getter methods for it, an artificial PROPERTY_DECL is generated
and used in the PROPERTY_REF. */