diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-10-01 12:31:22 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-10-01 08:31:22 -0400 |
commit | 38f01e5a57f979f7427e99be377b4717a330cf7a (patch) | |
tree | cd6ba427351ab942ae84801955a4b69eb55427f9 /gcc | |
parent | 43cab252f98671186dc5aae755081c183a8f4595 (diff) | |
download | gcc-38f01e5a57f979f7427e99be377b4717a330cf7a.zip gcc-38f01e5a57f979f7427e99be377b4717a330cf7a.tar.gz gcc-38f01e5a57f979f7427e99be377b4717a330cf7a.tar.bz2 |
cp-tree.h (FORMAT_VBASE_NAME): New macro.
* cp-tree.h (FORMAT_VBASE_NAME): New macro.
* class.c (build_vbase_pointer): Use it.
* rtti.c (expand_class_desc): Likewise.
* tree.c (build_vbase_pointer_fields): Likewise.
From-SVN: r22713
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/class.c | 3 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 7 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 3 | ||||
-rw-r--r-- | gcc/cp/tree.c | 5 |
5 files changed, 18 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8f358d8..bb2a13b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +1998-10-01 Jason Merrill <jason@yorick.cygnus.com> + + * cp-tree.h (FORMAT_VBASE_NAME): New macro. + * class.c (build_vbase_pointer): Use it. + * rtti.c (expand_class_desc): Likewise. + * tree.c (build_vbase_pointer_fields): Likewise. + Thu Oct 1 10:43:45 1998 Nick Clifton <nickc@cygnus.com> * decl.c (start_decl): Add invocation of diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 624c058..8e7d715 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -146,9 +146,8 @@ build_vbase_pointer (exp, type) tree exp, type; { char *name; + FORMAT_VBASE_NAME (name, type); - name = (char *) alloca (TYPE_NAME_LENGTH (type) + sizeof (VBASE_NAME) + 1); - sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (type)); return build_component_ref (exp, get_identifier (name), NULL_TREE, 0); } diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 8d1247e..8fe0bd4 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -2140,6 +2140,13 @@ extern int current_function_parms_stored; && IDENTIFIER_POINTER (ID_NODE)[2] == 'b' \ && IDENTIFIER_POINTER (ID_NODE)[3] == JOINER) +/* Store the vbase pointer field name for type TYPE into pointer BUF. */ +#define FORMAT_VBASE_NAME(BUF,TYPE) do { \ + BUF = (char *) alloca (TYPE_ASSEMBLER_NAME_LENGTH (TYPE) \ + + sizeof (VBASE_NAME) + 1); \ + sprintf (BUF, VBASE_NAME_FORMAT, TYPE_ASSEMBLER_NAME_STRING (TYPE)); \ +} while (0) + #define TEMP_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), AUTO_TEMP_NAME, sizeof (AUTO_TEMP_NAME)-1)) #define VFIELD_NAME_P(ID_NODE) (!strncmp (IDENTIFIER_POINTER (ID_NODE), VFIELD_NAME, sizeof(VFIELD_NAME)-1)) diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 01c4a86..63a734d 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -801,8 +801,7 @@ expand_class_desc (tdecl, type) char *name; tree field; - name = (char *) alloca (TYPE_NAME_LENGTH (t)+sizeof (VBASE_NAME)+1); - sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (t)); + FORMAT_VBASE_NAME (name, t); field = lookup_field (type, get_identifier (name), 0, 0); offset = size_binop (FLOOR_DIV_EXPR, DECL_FIELD_BITPOS (field), size_int (BITS_PER_UNIT)); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 1a87a51..e66cbff 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -882,8 +882,7 @@ build_vbase_pointer_fields (rec) if (TREE_VIA_VIRTUAL (base_binfo)) { int j; - char *name = (char *)alloca (TYPE_NAME_LENGTH (basetype) - + sizeof (VBASE_NAME) + 1); + char *name; /* The offset for a virtual base class is only used in computing virtual function tables and for initializing virtual base @@ -903,7 +902,7 @@ build_vbase_pointer_fields (rec) )) goto got_it; } - sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (basetype)); + FORMAT_VBASE_NAME (name, basetype); decl = build_lang_field_decl (FIELD_DECL, get_identifier (name), build_pointer_type (basetype)); /* If you change any of the below, take a look at all the |