From: Ziemowit Laski Date: Wed, 22 Sep 2004 01:13:07 +0000 (+0000) Subject: objc-act.c (objc_fold_objc_type_ref): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86c440722e1c91d4bccb6ab1fc038cbfb00f55cd;p=gcc.git objc-act.c (objc_fold_objc_type_ref): New function. [gcc/objc/ChangeLog] 2004-09-21 Ziemowit Laski * objc-act.c (objc_fold_objc_type_ref): New function. * objc-act.h (objc_fold_objc_type_ref): New prototype. From-SVN: r87838 --- diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index bfee61589e6..b391c39e8db 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,8 @@ +2004-09-21 Ziemowit Laski + + * objc-act.c (objc_fold_objc_type_ref): New function. + * objc-act.h (objc_fold_objc_type_ref): New prototype. + 2004-09-09 Joseph S. Myers * objc-act.c (objc_start_function, really_start_method, diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index f115ba44fd1..5488b78a836 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -7530,6 +7530,33 @@ comp_proto_with_proto (tree proto1, tree proto2) return (!type1 && !type2); } +/* Fold an OBJ_TYPE_REF expression for ObjC method dispatches, where + this occurs. ObjC method dispatches are _not_ like C++ virtual + member function dispatches, and we account for the difference here. */ +tree +#ifdef OBJCPLUS +objc_fold_obj_type_ref (tree ref, tree known_type) +#else +objc_fold_obj_type_ref (tree ref ATTRIBUTE_UNUSED, + tree known_type ATTRIBUTE_UNUSED) +#endif +{ +#ifdef OBJCPLUS + tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type)); + + /* If the receiver does not have virtual member functions, there + is nothing we can (or need to) do here. */ + if (!v) + return NULL_TREE; + + /* Let C++ handle C++ virtual functions. */ + return cp_fold_obj_type_ref (ref, known_type); +#else + /* For plain ObjC, we currently do not need to do anything. */ + return NULL_TREE; +#endif +} + static void objc_start_function (tree name, tree type, tree attrs, #ifdef OBJCPLUS diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index b80761d310f..52eeb448cfa 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -27,6 +27,7 @@ Boston, MA 02111-1307, USA. */ bool objc_init (void); const char *objc_printable_name (tree, int); void objc_finish_file (void); +tree objc_fold_obj_type_ref (tree, tree); /* NB: The remaining public functions are prototyped in c-common.h, for the benefit of stub-objc.c and objc-act.c. */