gdb: remove mi_parse::make functions
[binutils-gdb.git] / gdb / stabsread.c
index 7a31d5598310097cc0819fed30fc700bd4863c7c..c3d87033f4f8e702dc730c1b09abf0f7232a219b 100644 (file)
@@ -311,7 +311,7 @@ dbx_lookup_type (int typenums[2], struct objfile *objfile)
          warning (_("GDB internal error: bad real_filenum"));
 
        error_return:
-         temp_type = objfile_type (objfile)->builtin_error;
+         temp_type = builtin_type (objfile)->builtin_error;
          return &temp_type;
        }
 
@@ -374,7 +374,7 @@ dbx_init_float_type (struct objfile *objfile, int bits)
   format = gdbarch_floatformat_for_type (gdbarch, NULL, bits);
   type_allocator alloc (objfile);
   if (format)
-    type = init_float_type (objfile, bits, NULL, format);
+    type = init_float_type (alloc, bits, NULL, format);
   else
     type = alloc.new_type (TYPE_CODE_ERROR, bits, NULL);
 
@@ -798,7 +798,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
            gdb_byte *dbl_valu;
            struct type *dbl_type;
 
-           dbl_type = objfile_type (objfile)->builtin_double;
+           dbl_type = builtin_type (objfile)->builtin_double;
            dbl_valu
              = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack,
                                            dbl_type->length ());
@@ -819,7 +819,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
               types; other languages probably should have at least
               unsigned as well as signed constants.  */
 
-           sym->set_type (objfile_type (objfile)->builtin_long);
+           sym->set_type (builtin_type (objfile)->builtin_long);
            sym->set_value_longest (atoi (p));
            sym->set_aclass_index (LOC_CONST);
          }
@@ -827,7 +827,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
 
        case 'c':
          {
-           sym->set_type (objfile_type (objfile)->builtin_char);
+           sym->set_type (builtin_type (objfile)->builtin_char);
            sym->set_value_longest (atoi (p));
            sym->set_aclass_index (LOC_CONST);
          }
@@ -877,12 +877,13 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
 
            /* NULL terminate the string.  */
            string_local[ind] = 0;
+           type_allocator alloc (objfile);
            range_type
-             = create_static_range_type (NULL,
-                                         objfile_type (objfile)->builtin_int,
+             = create_static_range_type (alloc,
+                                         builtin_type (objfile)->builtin_int,
                                          0, ind);
            sym->set_type
-             (create_array_type (NULL, objfile_type (objfile)->builtin_char,
+             (create_array_type (alloc, builtin_type (objfile)->builtin_char,
                                  range_type));
            string_value
              = (gdb_byte *) obstack_alloc (&objfile->objfile_obstack, ind + 1);
@@ -1001,7 +1002,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
                 it back into builtin_int here.
                 FIXME: Do we need a new builtin_promoted_int_arg ?  */
              if (ptype->code () == TYPE_CODE_VOID)
-               ptype = objfile_type (objfile)->builtin_int;
+               ptype = builtin_type (objfile)->builtin_int;
              ftype->field (nparams).set_type (ptype);
              TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
            }
@@ -1093,8 +1094,8 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
            {
              sym->set_type
                (sym->type ()->is_unsigned ()
-                ? objfile_type (objfile)->builtin_unsigned_int
-                : objfile_type (objfile)->builtin_int);
+                ? builtin_type (objfile)->builtin_unsigned_int
+                : builtin_type (objfile)->builtin_int);
            }
          break;
        }
@@ -1461,7 +1462,7 @@ error_type (const char **pp, struct objfile *objfile)
          break;
        }
     }
-  return objfile_type (objfile)->builtin_error;
+  return builtin_type (objfile)->builtin_error;
 }
 \f
 
@@ -2015,10 +2016,13 @@ again:
       break;
 
     case 'S':                  /* Set type */
-      type1 = read_type (pp, objfile);
-      type = create_set_type (NULL, type1);
-      if (typenums[0] != -1)
-       *dbx_lookup_type (typenums, objfile) = type;
+      {
+       type1 = read_type (pp, objfile);
+       type_allocator alloc (objfile);
+       type = create_set_type (alloc, type1);
+       if (typenums[0] != -1)
+         *dbx_lookup_type (typenums, objfile) = type;
+      }
       break;
 
     default:
@@ -2059,7 +2063,7 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
   if (typenum >= 0 || typenum < -NUMBER_RECOGNIZED)
     {
       complaint (_("Unknown builtin type %d"), typenum);
-      return objfile_type (objfile)->builtin_error;
+      return builtin_type (objfile)->builtin_error;
     }
 
   if (!negative_types)
@@ -2090,87 +2094,87 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
         is other than 32 bits, then it should use a new negative type
         number (or avoid negative type numbers for that case).
         See stabs.texinfo.  */
-      rettype = init_integer_type (objfile, 32, 0, "int");
+      rettype = init_integer_type (alloc, 32, 0, "int");
       break;
     case 2:
-      rettype = init_integer_type (objfile, 8, 0, "char");
+      rettype = init_integer_type (alloc, 8, 0, "char");
       rettype->set_has_no_signedness (true);
       break;
     case 3:
-      rettype = init_integer_type (objfile, 16, 0, "short");
+      rettype = init_integer_type (alloc, 16, 0, "short");
       break;
     case 4:
-      rettype = init_integer_type (objfile, 32, 0, "long");
+      rettype = init_integer_type (alloc, 32, 0, "long");
       break;
     case 5:
-      rettype = init_integer_type (objfile, 8, 1, "unsigned char");
+      rettype = init_integer_type (alloc, 8, 1, "unsigned char");
       break;
     case 6:
-      rettype = init_integer_type (objfile, 8, 0, "signed char");
+      rettype = init_integer_type (alloc, 8, 0, "signed char");
       break;
     case 7:
-      rettype = init_integer_type (objfile, 16, 1, "unsigned short");
+      rettype = init_integer_type (alloc, 16, 1, "unsigned short");
       break;
     case 8:
-      rettype = init_integer_type (objfile, 32, 1, "unsigned int");
+      rettype = init_integer_type (alloc, 32, 1, "unsigned int");
       break;
     case 9:
-      rettype = init_integer_type (objfile, 32, 1, "unsigned");
+      rettype = init_integer_type (alloc, 32, 1, "unsigned");
       break;
     case 10:
-      rettype = init_integer_type (objfile, 32, 1, "unsigned long");
+      rettype = init_integer_type (alloc, 32, 1, "unsigned long");
       break;
     case 11:
       rettype = alloc.new_type (TYPE_CODE_VOID, TARGET_CHAR_BIT, "void");
       break;
     case 12:
       /* IEEE single precision (32 bit).  */
-      rettype = init_float_type (objfile, 32, "float",
+      rettype = init_float_type (alloc, 32, "float",
                                 floatformats_ieee_single);
       break;
     case 13:
       /* IEEE double precision (64 bit).  */
-      rettype = init_float_type (objfile, 64, "double",
+      rettype = init_float_type (alloc, 64, "double",
                                 floatformats_ieee_double);
       break;
     case 14:
       /* This is an IEEE double on the RS/6000, and different machines with
         different sizes for "long double" should use different negative
         type numbers.  See stabs.texinfo.  */
-      rettype = init_float_type (objfile, 64, "long double",
+      rettype = init_float_type (alloc, 64, "long double",
                                 floatformats_ieee_double);
       break;
     case 15:
-      rettype = init_integer_type (objfile, 32, 0, "integer");
+      rettype = init_integer_type (alloc, 32, 0, "integer");
       break;
     case 16:
-      rettype = init_boolean_type (objfile, 32, 1, "boolean");
+      rettype = init_boolean_type (alloc, 32, 1, "boolean");
       break;
     case 17:
-      rettype = init_float_type (objfile, 32, "short real",
+      rettype = init_float_type (alloc, 32, "short real",
                                 floatformats_ieee_single);
       break;
     case 18:
-      rettype = init_float_type (objfile, 64, "real",
+      rettype = init_float_type (alloc, 64, "real",
                                 floatformats_ieee_double);
       break;
     case 19:
       rettype = alloc.new_type (TYPE_CODE_ERROR, 0, "stringptr");
       break;
     case 20:
-      rettype = init_character_type (objfile, 8, 1, "character");
+      rettype = init_character_type (alloc, 8, 1, "character");
       break;
     case 21:
-      rettype = init_boolean_type (objfile, 8, 1, "logical*1");
+      rettype = init_boolean_type (alloc, 8, 1, "logical*1");
       break;
     case 22:
-      rettype = init_boolean_type (objfile, 16, 1, "logical*2");
+      rettype = init_boolean_type (alloc, 16, 1, "logical*2");
       break;
     case 23:
-      rettype = init_boolean_type (objfile, 32, 1, "logical*4");
+      rettype = init_boolean_type (alloc, 32, 1, "logical*4");
       break;
     case 24:
-      rettype = init_boolean_type (objfile, 32, 1, "logical");
+      rettype = init_boolean_type (alloc, 32, 1, "logical");
       break;
     case 25:
       /* Complex type consisting of two IEEE single precision values.  */
@@ -2183,28 +2187,28 @@ rs6000_builtin_type (int typenum, struct objfile *objfile)
                                   rs6000_builtin_type (13, objfile));
       break;
     case 27:
-      rettype = init_integer_type (objfile, 8, 0, "integer*1");
+      rettype = init_integer_type (alloc, 8, 0, "integer*1");
       break;
     case 28:
-      rettype = init_integer_type (objfile, 16, 0, "integer*2");
+      rettype = init_integer_type (alloc, 16, 0, "integer*2");
       break;
     case 29:
-      rettype = init_integer_type (objfile, 32, 0, "integer*4");
+      rettype = init_integer_type (alloc, 32, 0, "integer*4");
       break;
     case 30:
-      rettype = init_character_type (objfile, 16, 0, "wchar");
+      rettype = init_character_type (alloc, 16, 0, "wchar");
       break;
     case 31:
-      rettype = init_integer_type (objfile, 64, 0, "long long");
+      rettype = init_integer_type (alloc, 64, 0, "long long");
       break;
     case 32:
-      rettype = init_integer_type (objfile, 64, 1, "unsigned long long");
+      rettype = init_integer_type (alloc, 64, 1, "unsigned long long");
       break;
     case 33:
-      rettype = init_integer_type (objfile, 64, 1, "logical*8");
+      rettype = init_integer_type (alloc, 64, 1, "logical*8");
       break;
     case 34:
-      rettype = init_integer_type (objfile, 64, 0, "integer*8");
+      rettype = init_integer_type (alloc, 64, 0, "integer*8");
       break;
     }
   negative_types[-typenum] = rettype;
@@ -3547,9 +3551,11 @@ read_array_type (const char **pp, struct type *type,
       upper = -1;
     }
 
+  type_allocator alloc (objfile);
   range_type =
-    create_static_range_type (NULL, index_type, lower, upper);
-  type = create_array_type (type, element_type, range_type);
+    create_static_range_type (alloc, index_type, lower, upper);
+  type_allocator smash_alloc (type, type_allocator::SMASH);
+  type = create_array_type (smash_alloc, element_type, range_type);
 
   return type;
 }
@@ -3759,9 +3765,9 @@ read_sun_builtin_type (const char **pp, int typenums[2], struct objfile *objfile
     }
 
   if (boolean_type)
-    return init_boolean_type (objfile, type_bits, unsigned_type, NULL);
+    return init_boolean_type (alloc, type_bits, unsigned_type, NULL);
   else
-    return init_integer_type (objfile, type_bits, unsigned_type, NULL);
+    return init_integer_type (alloc, type_bits, unsigned_type, NULL);
 }
 
 static struct type *
@@ -4059,7 +4065,7 @@ read_range_type (const char **pp, int typenums[2], int type_size,
        }
 
       if (got_signed || got_unsigned)
-       return init_integer_type (objfile, nbits, got_unsigned, NULL);
+       return init_integer_type (alloc, nbits, got_unsigned, NULL);
       else
        return error_type (pp, objfile);
     }
@@ -4105,14 +4111,14 @@ read_range_type (const char **pp, int typenums[2], int type_size,
          bits = gdbarch_int_bit (gdbarch);
        }
 
-      return init_integer_type (objfile, bits, 1, NULL);
+      return init_integer_type (alloc, bits, 1, NULL);
     }
 
   /* Special case: char is defined (Who knows why) as a subrange of
      itself with range 0-127.  */
   else if (self_subrange && n2 == 0 && n3 == 127)
     {
-      struct type *type = init_integer_type (objfile, TARGET_CHAR_BIT,
+      struct type *type = init_integer_type (alloc, TARGET_CHAR_BIT,
                                             0, NULL);
       type->set_has_no_signedness (true);
       return type;
@@ -4126,7 +4132,7 @@ read_range_type (const char **pp, int typenums[2], int type_size,
 
       if (n3 < 0)
        /* n3 actually gives the size.  */
-       return init_integer_type (objfile, -n3 * TARGET_CHAR_BIT, 1, NULL);
+       return init_integer_type (alloc, -n3 * TARGET_CHAR_BIT, 1, NULL);
 
       /* Is n3 == 2**(8n)-1 for some integer n?  Then it's an
         unsigned n-byte integer.  But do require n to be a power of
@@ -4140,7 +4146,7 @@ read_range_type (const char **pp, int typenums[2], int type_size,
          bits >>= 8;
        if (bits == 0
            && ((bytes - 1) & bytes) == 0) /* "bytes is a power of two" */
-         return init_integer_type (objfile, bytes * TARGET_CHAR_BIT, 1, NULL);
+         return init_integer_type (alloc, bytes * TARGET_CHAR_BIT, 1, NULL);
       }
     }
   /* I think this is for Convex "long long".  Since I don't know whether
@@ -4150,15 +4156,15 @@ read_range_type (const char **pp, int typenums[2], int type_size,
           && (self_subrange
               || n2 == -gdbarch_long_long_bit
                          (gdbarch) / TARGET_CHAR_BIT))
-    return init_integer_type (objfile, -n2 * TARGET_CHAR_BIT, 0, NULL);
+    return init_integer_type (alloc, -n2 * TARGET_CHAR_BIT, 0, NULL);
   else if (n2 == -n3 - 1)
     {
       if (n3 == 0x7f)
-       return init_integer_type (objfile, 8, 0, NULL);
+       return init_integer_type (alloc, 8, 0, NULL);
       if (n3 == 0x7fff)
-       return init_integer_type (objfile, 16, 0, NULL);
+       return init_integer_type (alloc, 16, 0, NULL);
       if (n3 == 0x7fffffff)
-       return init_integer_type (objfile, 32, 0, NULL);
+       return init_integer_type (alloc, 32, 0, NULL);
     }
 
   /* We have a real range type on our hands.  Allocate space and
@@ -4166,7 +4172,7 @@ read_range_type (const char **pp, int typenums[2], int type_size,
 handle_true_range:
 
   if (self_subrange)
-    index_type = objfile_type (objfile)->builtin_int;
+    index_type = builtin_type (objfile)->builtin_int;
   else
     index_type = *dbx_lookup_type (rangenums, objfile);
   if (index_type == NULL)
@@ -4176,11 +4182,11 @@ handle_true_range:
 
       complaint (_("base type %d of range type is not defined"), rangenums[1]);
 
-      index_type = objfile_type (objfile)->builtin_int;
+      index_type = builtin_type (objfile)->builtin_int;
     }
 
   result_type
-    = create_static_range_type (NULL, index_type, n2, n3);
+    = create_static_range_type (alloc, index_type, n2, n3);
   return (result_type);
 }