This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PROPOSED PATCH: Robustify cp_fold_obj_type_ref() for ObjC++ use


For some reason, RTH introduced OBJ_TYPE_REF nodes for dispatching ObjC/ObjC++ method
calls. In ObjC, this just falls through to the surrounding CALL_EXPR, but in ObjC++
it trips over cp_fold_obj_type_ref() since ObjC classes do not actually have any
virtual member functions. The change below is the easiest way to get things going
again. Would that be OK (with ChangeLog entry, of course), or should redirect this
to an ObjC++-specific lang hook? Or perhaps revert the use of OBJ_TYPE_REF for
ObjC/ObjC++ methods altogether (as I honestly don't know what it is trying to accomplish)?


Please advise,

--Zem

Index: gcc/cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.675
diff -u -3 -p -r1.675 class.c
--- gcc/cp/class.c      18 Sep 2004 17:23:58 -0000      1.675
+++ gcc/cp/class.c      20 Sep 2004 21:10:08 -0000
@@ -7784,6 +7784,11 @@ cp_fold_obj_type_ref (tree ref, tree kno
   tree v = BINFO_VIRTUALS (TYPE_BINFO (known_type));
   tree fndecl;

+  /* If the receiver does not have virtual member functions, there
+     is nothing we can (or need to) do here.  */
+  if (!v)
+    return NULL_TREE;
+
   while (i != index)
     {
       i += (TARGET_VTABLE_USES_DESCRIPTORS

--------------------------------------------------------------
Ziemowit Laski                 1 Infinite Loop, MS 301-2K
Mac OS X Compiler Group        Cupertino, CA USA  95014-2083
Apple Computer, Inc.           +1.408.974.6229  Fax .5477


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]