diff options
author | Ziemowit Laski <zlaski@apple.com> | 2004-09-22 01:13:07 +0000 |
---|---|---|
committer | Ziemowit Laski <zlaski@gcc.gnu.org> | 2004-09-22 01:13:07 +0000 |
commit | 86c440722e1c91d4bccb6ab1fc038cbfb00f55cd (patch) | |
tree | d35e40ac9524f339521769d9f0f6bfe8fb6d51a2 /gcc/objc/objc-act.c | |
parent | 76419821c6f3f12f40049b33d63660a11f228758 (diff) | |
download | gcc-86c440722e1c91d4bccb6ab1fc038cbfb00f55cd.zip gcc-86c440722e1c91d4bccb6ab1fc038cbfb00f55cd.tar.gz gcc-86c440722e1c91d4bccb6ab1fc038cbfb00f55cd.tar.bz2 |
objc-act.c (objc_fold_objc_type_ref): New function.
[gcc/objc/ChangeLog]
2004-09-21 Ziemowit Laski <zlaski@apple.com>
* objc-act.c (objc_fold_objc_type_ref): New function.
* objc-act.h (objc_fold_objc_type_ref): New prototype.
From-SVN: r87838
Diffstat (limited to 'gcc/objc/objc-act.c')
-rw-r--r-- | gcc/objc/objc-act.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index f115ba4..5488b78 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 |