]> gcc.gnu.org Git - gcc.git/commitdiff
cp-tree.h (FORMAT_VBASE_NAME): New macro.
authorJason Merrill <jason@yorick.cygnus.com>
Thu, 1 Oct 1998 12:31:22 +0000 (12:31 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 1 Oct 1998 12:31:22 +0000 (08:31 -0400)
* 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

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/rtti.c
gcc/cp/tree.c

index 8f358d87e81e0cb7bffbf8d6dffcf9db8a2fff2b..bb2a13bcc64d75be78e6b09ebd591906d97a4333 100644 (file)
@@ -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
index 624c05898db621de84e090684c8de230afc13a3c..8e7d715eb89674b6087aeb568f76687555a2b501 100644 (file)
@@ -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);
 }
 
index 8d1247e7192bb2310b843a184bcd26fccb9ad354..8fe0bd45b1fbd4f070bff0bb99d2911dd45bff16 100644 (file)
@@ -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))
 
index 01c4a861ec25b0e1091c2369b0fdf013aea0382d..63a734db399949704ef6bd55c042b8c1ea030a6c 100644 (file)
@@ -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));
index 1a87a5128e1b6cee0b3a9246964c553099327145..e66cbff5b603fa0d1f7ebacc3270f6bd28ecc0c3 100644 (file)
@@ -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
This page took 0.099427 seconds and 5 git commands to generate.