This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
xref_hier access patch
- To: egcs-patches at cygnus dot com
- Subject: xref_hier access patch
- From: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Mon, 29 Jun 1998 06:54:17 +0200
In xref_basetypes, non-identifier nodes are accessed as identifiers.
This patch fixes it.
Martin
1998-06-29 Martin von Löwis <loewis@informatik.hu-berlin.de>
* xref.c (classname): New function.
(GNU_xref_hier): Change class and base parameters to tree.
* decl.c (xref_baseypes): Change caller.
* friend.c (make_friend_class): Likewise.
Index: cp/cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.91
diff -c -p -r1.91 cp-tree.h
*** cp-tree.h 1998/06/25 15:21:36 1.91
--- cp-tree.h 1998/06/29 04:25:50
*************** extern void GNU_xref_decl PROTO((tree,
*** 2995,3001 ****
extern void GNU_xref_call PROTO((tree, char *));
extern void GNU_xref_function PROTO((tree, tree));
extern void GNU_xref_assign PROTO((tree));
! extern void GNU_xref_hier PROTO((char *, char *, int, int, int));
extern void GNU_xref_member PROTO((tree, tree));
/* -- end of C++ */
--- 2998,3004 ----
extern void GNU_xref_call PROTO((tree, char *));
extern void GNU_xref_function PROTO((tree, tree));
extern void GNU_xref_assign PROTO((tree));
! extern void GNU_xref_hier PROTO((tree, tree, int, int, int));
extern void GNU_xref_member PROTO((tree, tree));
/* -- end of C++ */
Index: cp/decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.145
diff -c -p -r1.145 decl.c
*** decl.c 1998/06/25 17:24:49 1.145
--- decl.c 1998/06/29 04:26:03
*************** xref_basetypes (code_type_node, name, re
*** 11315,11322 ****
tree basetype = TREE_VALUE (binfo);
tree base_binfo;
! GNU_xref_hier (IDENTIFIER_POINTER (name),
! IDENTIFIER_POINTER (TREE_VALUE (binfo)),
via_public, via_virtual, 0);
if (basetype && TREE_CODE (basetype) == TYPE_DECL)
--- 11377,11383 ----
tree basetype = TREE_VALUE (binfo);
tree base_binfo;
! GNU_xref_hier (name, TREE_VALUE (binfo),
via_public, via_virtual, 0);
if (basetype && TREE_CODE (basetype) == TYPE_DECL)
Index: cp/friend.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/friend.c,v
retrieving revision 1.19
diff -c -p -r1.19 friend.c
*** friend.c 1998/06/11 20:11:55 1.19
--- friend.c 1998/06/29 04:26:17
*************** make_friend_class (type, friend_type)
*** 267,274 ****
else
is_template_friend = 0;
! GNU_xref_hier (TYPE_NAME_STRING (type),
! TYPE_NAME_STRING (friend_type), 0, 0, 1);
if (is_template_friend)
friend_type = CLASSTYPE_TI_TEMPLATE (friend_type);
--- 267,273 ----
else
is_template_friend = 0;
! GNU_xref_hier (type, friend_type, 0, 0, 1);
if (is_template_friend)
friend_type = CLASSTYPE_TI_TEMPLATE (friend_type);
Index: cp/xref.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/xref.c,v
retrieving revision 1.11
diff -c -p -r1.11 xref.c
*** xref.c 1998/06/22 05:59:23 1.11
--- xref.c 1998/06/29 04:27:06
*************** gen_assign(xf, name)
*** 541,546 ****
--- 541,559 ----
fprintf(xref_file, "ASG %s %d %s\n", filename(xf), lineno, s);
}
+ static char*
+ classname (cls)
+ tree cls;
+ {
+ if (cls && TREE_CODE_CLASS (TREE_CODE (cls)) == 't')
+ cls = TYPE_NAME (cls);
+ if (cls && TREE_CODE_CLASS (TREE_CODE (cls)) == 'd')
+ cls = DECL_NAME (cls);
+ if (cls && TREE_CODE (cls) == IDENTIFIER_NODE)
+ return IDENTIFIER_POINTER (cls);
+ return "?";
+ }
+
/* Output cross-reference info about a class hierarchy.
CLS is the class type of interest. BASE is a baseclass
for CLS. PUB and VIRT give the access info about
*************** gen_assign(xf, name)
*** 551,558 ****
void
GNU_xref_hier(cls, base, pub, virt, frnd)
! char *cls;
! char *base;
int pub;
int virt;
int frnd;
--- 564,571 ----
void
GNU_xref_hier(cls, base, pub, virt, frnd)
! tree cls;
! tree base;
int pub;
int virt;
int frnd;
*************** GNU_xref_hier(cls, base, pub, virt, frnd
*** 564,570 ****
if (xf == NULL) return;
fprintf(xref_file, "HIE %s %d %s %s %d %d %d\n",
! filename(xf), lineno, cls, base, pub, virt, frnd);
}
/* Output cross-reference info about class members. CLS
--- 577,584 ----
if (xf == NULL) return;
fprintf(xref_file, "HIE %s %d %s %s %d %d %d\n",
! filename(xf), lineno, classname (cls), classname (base),
! pub, virt, frnd);
}
/* Output cross-reference info about class members. CLS