Move int type methods out of dwarf2_per_cu_data
[deliverable/binutils-gdb.git] / gdb / dwarf2 / read.c
index d58303098c1f18467177a2ab32149ddbf2479380..5ab0e8eefa28d0569c0376e4212b12060beceb6e 100644 (file)
@@ -421,6 +421,16 @@ struct dwarf2_cu
   /* Reset the builder.  */
   void reset_builder () { m_builder.reset (); }
 
+  /* Return a type that is a generic pointer type, the size of which
+     matches the address size given in the compilation unit header for
+     this CU.  */
+  struct type *addr_type () const;
+
+  /* Find an integer type the same size as the address size given in
+     the compilation unit header for this CU.  UNSIGNED_P controls if
+     the integer is unsigned or not.  */
+  struct type *addr_sized_int_type (bool unsigned_p) const;
+
   /* The header of the compilation unit.  */
   struct comp_unit_head header {};
 
@@ -1204,7 +1214,8 @@ static void dwarf2_find_base_address (struct die_info *die,
                                      struct dwarf2_cu *cu);
 
 static dwarf2_psymtab *create_partial_symtab
-  (struct dwarf2_per_cu_data *per_cu, const char *name);
+  (dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile,
+   const char *name);
 
 static void build_type_psymtabs_reader (const struct die_reader_specs *reader,
                                        const gdb_byte *info_ptr,
@@ -1571,11 +1582,13 @@ static void load_full_comp_unit (dwarf2_per_cu_data *per_cu,
                                 bool skip_partial,
                                 enum language pretend_language);
 
-static void process_full_comp_unit (struct dwarf2_per_cu_data *,
-                                   enum language);
+static void process_full_comp_unit (dwarf2_per_cu_data *per_cu,
+                                   dwarf2_per_objfile *per_objfile,
+                                   enum language pretend_language);
 
-static void process_full_type_unit (struct dwarf2_per_cu_data *,
-                                   enum language);
+static void process_full_type_unit (dwarf2_per_cu_data *per_cu,
+                                   dwarf2_per_objfile *per_objfile,
+                                   enum language pretend_language);
 
 static void dwarf2_add_dependence (struct dwarf2_cu *,
                                   struct dwarf2_per_cu_data *);
@@ -1669,10 +1682,11 @@ static struct dwp_file *get_dwp_file
   (struct dwarf2_per_objfile *dwarf2_per_objfile);
 
 static struct dwo_unit *lookup_dwo_comp_unit
-  (struct dwarf2_per_cu_data *, const char *, const char *, ULONGEST);
+  (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
+   ULONGEST signature);
 
 static struct dwo_unit *lookup_dwo_type_unit
-  (struct signatured_type *, const char *, const char *);
+  (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir);
 
 static void queue_and_load_all_dwo_tus (struct dwarf2_per_cu_data *);
 
@@ -6685,7 +6699,7 @@ init_cu_die_reader (struct die_reader_specs *reader,
    The result is non-zero if a valid (non-dummy) DIE was found.  */
 
 static int
-read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu,
+read_cutu_die_from_dwo (dwarf2_cu *cu,
                        struct dwo_unit *dwo_unit,
                        struct die_info *stub_comp_unit_die,
                        const char *stub_comp_dir,
@@ -6694,9 +6708,9 @@ read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu,
                        struct die_info **result_comp_unit_die,
                        abbrev_table_up *result_dwo_abbrev_table)
 {
-  struct dwarf2_per_objfile *dwarf2_per_objfile = this_cu->dwarf2_per_objfile;
+  struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_objfile;
+  dwarf2_per_cu_data *per_cu = cu->per_cu;
   struct objfile *objfile = dwarf2_per_objfile->objfile;
-  struct dwarf2_cu *cu = this_cu->cu;
   bfd *abfd;
   const gdb_byte *begin_info_ptr, *info_ptr;
   struct attribute *comp_dir, *stmt_list, *low_pc, *high_pc, *ranges;
@@ -6725,7 +6739,7 @@ read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu,
     {
       /* For TUs in DWO files, the DW_AT_stmt_list attribute lives in the
         DWO file.  */
-      if (! this_cu->is_debug_types)
+      if (!per_cu->is_debug_types)
        stmt_list = dwarf2_attr (stub_comp_unit_die, DW_AT_stmt_list, cu);
       low_pc = dwarf2_attr (stub_comp_unit_die, DW_AT_low_pc, cu);
       high_pc = dwarf2_attr (stub_comp_unit_die, DW_AT_high_pc, cu);
@@ -6758,9 +6772,9 @@ read_cutu_die_from_dwo (struct dwarf2_per_cu_data *this_cu,
                               + to_underlying (dwo_unit->sect_off));
   dwo_abbrev_section = &dwo_unit->dwo_file->sections.abbrev;
 
-  if (this_cu->is_debug_types)
+  if (per_cu->is_debug_types)
     {
-      struct signatured_type *sig_type = (struct signatured_type *) this_cu;
+      signatured_type *sig_type = (struct signatured_type *) per_cu;
 
       info_ptr = read_and_check_comp_unit_head (dwarf2_per_objfile,
                                                &cu->header, section,
@@ -6871,11 +6885,9 @@ lookup_dwo_id (struct dwarf2_cu *cu, struct die_info* comp_unit_die)
    Returns NULL if the specified DWO unit cannot be found.  */
 
 static struct dwo_unit *
-lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu,
-                struct die_info *comp_unit_die,
-                const char *dwo_name)
+lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name)
 {
-  struct dwarf2_cu *cu = this_cu->cu;
+  dwarf2_per_cu_data *per_cu = cu->per_cu;
   struct dwo_unit *dwo_unit;
   const char *comp_dir;
 
@@ -6885,24 +6897,18 @@ lookup_dwo_unit (struct dwarf2_per_cu_data *this_cu,
   dwo_name = dwarf2_dwo_name (comp_unit_die, cu);
   comp_dir = dwarf2_string_attr (comp_unit_die, DW_AT_comp_dir, cu);
 
-  if (this_cu->is_debug_types)
-    {
-      struct signatured_type *sig_type;
-
-      /* Since this_cu is the first member of struct signatured_type,
-        we can go from a pointer to one to a pointer to the other.  */
-      sig_type = (struct signatured_type *) this_cu;
-      dwo_unit = lookup_dwo_type_unit (sig_type, dwo_name, comp_dir);
-    }
+  if (per_cu->is_debug_types)
+    dwo_unit = lookup_dwo_type_unit (cu, dwo_name, comp_dir);
   else
     {
       gdb::optional<ULONGEST> signature = lookup_dwo_id (cu, comp_unit_die);
+
       if (!signature.has_value ())
        error (_("Dwarf Error: missing dwo_id for dwo_name %s"
                 " [in module %s]"),
-              dwo_name, bfd_get_filename (this_cu->per_bfd->obfd));
-      dwo_unit = lookup_dwo_comp_unit (this_cu, dwo_name, comp_dir,
-                                      *signature);
+              dwo_name, bfd_get_filename (per_cu->per_bfd->obfd));
+
+      dwo_unit = lookup_dwo_comp_unit (cu, dwo_name, comp_dir, *signature);
     }
 
   return dwo_unit;
@@ -6942,7 +6948,7 @@ cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu,
      abbrev table.  When reading DWOs with skeletonless TUs, all the TUs
      could share abbrev tables.  */
 
-  if (read_cutu_die_from_dwo (this_cu, sig_type->dwo_unit,
+  if (read_cutu_die_from_dwo (this_cu->cu, sig_type->dwo_unit,
                              NULL /* stub_comp_unit_die */,
                              sig_type->dwo_unit->dwo_file->comp_dir,
                              this, &info_ptr,
@@ -7129,10 +7135,10 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
                     sect_offset_str (this_cu->sect_off),
                     bfd_get_filename (abfd));
        }
-      dwo_unit = lookup_dwo_unit (this_cu, comp_unit_die, dwo_name);
+      dwo_unit = lookup_dwo_unit (cu, comp_unit_die, dwo_name);
       if (dwo_unit != NULL)
        {
-         if (read_cutu_die_from_dwo (this_cu, dwo_unit,
+         if (read_cutu_die_from_dwo (cu, dwo_unit,
                                      comp_unit_die, NULL,
                                      this, &info_ptr,
                                      &dwo_comp_unit_die,
@@ -7331,7 +7337,7 @@ create_type_unit_group (struct dwarf2_cu *cu, sect_offset line_offset_struct)
       else
        name = string_printf ("<type_units_at_0x%x>", line_offset);
 
-      pst = create_partial_symtab (per_cu, name.c_str ());
+      pst = create_partial_symtab (per_cu, dwarf2_per_objfile, name.c_str ());
       pst->anonymous = true;
     }
 
@@ -7405,9 +7411,11 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list)
    dirname, textlow, texthigh.  */
 
 static dwarf2_psymtab *
-create_partial_symtab (struct dwarf2_per_cu_data *per_cu, const char *name)
+create_partial_symtab (dwarf2_per_cu_data *per_cu,
+                      dwarf2_per_objfile *per_objfile,
+                      const char *name)
 {
-  struct objfile *objfile = per_cu->dwarf2_per_objfile->objfile;
+  struct objfile *objfile = per_objfile->objfile;
   dwarf2_psymtab *pst;
 
   pst = new dwarf2_psymtab (name, objfile, per_cu);
@@ -7429,7 +7437,8 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
                                  enum language pretend_language)
 {
   struct dwarf2_cu *cu = reader->cu;
-  struct objfile *objfile = cu->per_objfile->objfile;
+  dwarf2_per_objfile *per_objfile = cu->per_objfile;
+  struct objfile *objfile = per_objfile->objfile;
   struct gdbarch *gdbarch = objfile->arch ();
   struct dwarf2_per_cu_data *per_cu = cu->per_cu;
   CORE_ADDR baseaddr;
@@ -7456,7 +7465,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
       filename = debug_filename.get ();
     }
 
-  pst = create_partial_symtab (per_cu, filename);
+  pst = create_partial_symtab (per_cu, per_objfile, filename);
 
   /* This must be done before calling dwarf2_build_include_psymtabs.  */
   pst->dirname = dwarf2_string_attr (comp_unit_die, DW_AT_comp_dir, cu);
@@ -7637,7 +7646,7 @@ build_type_psymtabs_reader (const struct die_reader_specs *reader,
   tu_group->tus->push_back (sig_type);
 
   prepare_one_comp_unit (cu, type_unit_die, language_minimal);
-  pst = create_partial_symtab (per_cu, "");
+  pst = create_partial_symtab (per_cu, dwarf2_per_objfile, "");
   pst->anonymous = true;
 
   first_die = load_partial_dies (reader, info_ptr, 1);
@@ -9031,9 +9040,11 @@ process_queue (struct dwarf2_per_objfile *dwarf2_per_objfile)
            fprintf_unfiltered (gdb_stdlog, "Expanding symtab of %s\n", buf);
 
          if (per_cu->is_debug_types)
-           process_full_type_unit (per_cu, item.pretend_language);
+           process_full_type_unit (per_cu, dwarf2_per_objfile,
+                                   item.pretend_language);
          else
-           process_full_comp_unit (per_cu, item.pretend_language);
+           process_full_comp_unit (per_cu, dwarf2_per_objfile,
+                                   item.pretend_language);
 
          if (dwarf_read_debug >= debug_print_threshold)
            fprintf_unfiltered (gdb_stdlog, "Done expanding %s\n", buf);
@@ -9625,7 +9636,8 @@ rust_union_quirks (struct dwarf2_cu *cu)
 static void
 recursively_compute_inclusions (std::vector<compunit_symtab *> *result,
                                htab_t all_children, htab_t all_type_symtabs,
-                               struct dwarf2_per_cu_data *per_cu,
+                               dwarf2_per_cu_data *per_cu,
+                               dwarf2_per_objfile *per_objfile,
                                struct compunit_symtab *immediate_parent)
 {
   void **slot = htab_find_slot (all_children, per_cu, INSERT);
@@ -9638,7 +9650,7 @@ recursively_compute_inclusions (std::vector<compunit_symtab *> *result,
   *slot = per_cu;
 
   /* Only add a CU if it has a symbol table.  */
-  compunit_symtab *cust = per_cu->dwarf2_per_objfile->get_symtab (per_cu);
+  compunit_symtab *cust = per_objfile->get_symtab (per_cu);
   if (cust != NULL)
     {
       /* If this is a type unit only add its symbol table if we haven't
@@ -9666,7 +9678,8 @@ recursively_compute_inclusions (std::vector<compunit_symtab *> *result,
     for (dwarf2_per_cu_data *ptr : *per_cu->imported_symtabs)
       {
        recursively_compute_inclusions (result, all_children,
-                                       all_type_symtabs, ptr, cust);
+                                       all_type_symtabs, ptr, per_objfile,
+                                       cust);
       }
 }
 
@@ -9674,7 +9687,8 @@ recursively_compute_inclusions (std::vector<compunit_symtab *> *result,
    PER_CU.  */
 
 static void
-compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu)
+compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
+                                 dwarf2_per_objfile *per_objfile)
 {
   gdb_assert (! per_cu->is_debug_types);
 
@@ -9683,7 +9697,7 @@ compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu)
       int len;
       std::vector<compunit_symtab *> result_symtabs;
       htab_t all_children, all_type_symtabs;
-      compunit_symtab *cust = per_cu->dwarf2_per_objfile->get_symtab (per_cu);
+      compunit_symtab *cust = per_objfile->get_symtab (per_cu);
 
       /* If we don't have a symtab, we can just skip this case.  */
       if (cust == NULL)
@@ -9697,7 +9711,8 @@ compute_compunit_symtab_includes (struct dwarf2_per_cu_data *per_cu)
       for (dwarf2_per_cu_data *ptr : *per_cu->imported_symtabs)
        {
          recursively_compute_inclusions (&result_symtabs, all_children,
-                                         all_type_symtabs, ptr, cust);
+                                         all_type_symtabs, ptr, per_objfile,
+                                         cust);
        }
 
       /* Now we have a transitive closure of all the included symtabs.  */
@@ -9723,7 +9738,7 @@ process_cu_includes (struct dwarf2_per_objfile *dwarf2_per_objfile)
   for (dwarf2_per_cu_data *iter : dwarf2_per_objfile->per_bfd->just_read_cus)
     {
       if (! iter->is_debug_types)
-       compute_compunit_symtab_includes (iter);
+       compute_compunit_symtab_includes (iter, dwarf2_per_objfile);
     }
 
   dwarf2_per_objfile->per_bfd->just_read_cus.clear ();
@@ -9733,11 +9748,11 @@ process_cu_includes (struct dwarf2_per_objfile *dwarf2_per_objfile)
    already been loaded into memory.  */
 
 static void
-process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
+process_full_comp_unit (dwarf2_per_cu_data *per_cu,
+                       dwarf2_per_objfile *dwarf2_per_objfile,
                        enum language pretend_language)
 {
   struct dwarf2_cu *cu = per_cu->cu;
-  struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
   struct objfile *objfile = dwarf2_per_objfile->objfile;
   struct gdbarch *gdbarch = objfile->arch ();
   CORE_ADDR lowpc, highpc;
@@ -9833,11 +9848,11 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
    already been loaded into memory.  */
 
 static void
-process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
+process_full_type_unit (dwarf2_per_cu_data *per_cu,
+                       dwarf2_per_objfile *dwarf2_per_objfile,
                        enum language pretend_language)
 {
   struct dwarf2_cu *cu = per_cu->cu;
-  struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
   struct objfile *objfile = dwarf2_per_objfile->objfile;
   struct compunit_symtab *cust;
   struct signatured_type *sig_type;
@@ -12351,10 +12366,10 @@ dwarf2_locate_dwo_sections (bfd *abfd, asection *sectp, void *dwo_sections_ptr)
    The result is NULL if DWO_NAME can't be found.  */
 
 static struct dwo_file *
-open_and_init_dwo_file (struct dwarf2_per_cu_data *per_cu,
-                       const char *dwo_name, const char *comp_dir)
+open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
+                       const char *comp_dir)
 {
-  struct dwarf2_per_objfile *dwarf2_per_objfile = per_cu->dwarf2_per_objfile;
+  struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_objfile;
 
   gdb_bfd_ref_ptr dbfd = open_dwo_file (dwarf2_per_objfile, dwo_name, comp_dir);
   if (dbfd == NULL)
@@ -12372,7 +12387,7 @@ open_and_init_dwo_file (struct dwarf2_per_cu_data *per_cu,
   bfd_map_over_sections (dwo_file->dbfd.get (), dwarf2_locate_dwo_sections,
                         &dwo_file->sections);
 
-  create_cus_hash_table (dwarf2_per_objfile, per_cu->cu, *dwo_file,
+  create_cus_hash_table (dwarf2_per_objfile, cu, *dwo_file,
                         dwo_file->sections.info, dwo_file->cus);
 
   create_debug_types_hash_table (dwarf2_per_objfile, dwo_file.get (),
@@ -12683,11 +12698,10 @@ get_dwp_file (struct dwarf2_per_objfile *dwarf2_per_objfile)
    (dwo_id mismatch or couldn't find the DWO/DWP file).  */
 
 static struct dwo_unit *
-lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
-                const char *dwo_name, const char *comp_dir,
+lookup_dwo_cutu (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
                 ULONGEST signature, int is_debug_types)
 {
-  struct dwarf2_per_objfile *dwarf2_per_objfile = this_unit->dwarf2_per_objfile;
+  struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_objfile;
   struct objfile *objfile = dwarf2_per_objfile->objfile;
   const char *kind = is_debug_types ? "TU" : "CU";
   void **dwo_file_slot;
@@ -12733,7 +12747,7 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
       if (*dwo_file_slot == NULL)
        {
          /* Read in the file and build a table of the CUs/TUs it contains.  */
-         *dwo_file_slot = open_and_init_dwo_file (this_unit, dwo_name, comp_dir);
+         *dwo_file_slot = open_and_init_dwo_file (cu, dwo_name, comp_dir);
        }
       /* NOTE: This will be NULL if unable to open the file.  */
       dwo_file = (struct dwo_file *) *dwo_file_slot;
@@ -12798,10 +12812,8 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
 
     warning (_("Could not find DWO %s %s(%s)%s referenced by %s at offset %s"
               " [in module %s]"),
-            kind, dwo_name, hex_string (signature),
-            dwp_text.c_str (),
-            this_unit->is_debug_types ? "TU" : "CU",
-            sect_offset_str (this_unit->sect_off), objfile_name (objfile));
+            kind, dwo_name, hex_string (signature), dwp_text.c_str (), kind,
+            sect_offset_str (cu->per_cu->sect_off), objfile_name (objfile));
   }
   return NULL;
 }
@@ -12810,21 +12822,25 @@ lookup_dwo_cutu (struct dwarf2_per_cu_data *this_unit,
    See lookup_dwo_cutu_unit for details.  */
 
 static struct dwo_unit *
-lookup_dwo_comp_unit (struct dwarf2_per_cu_data *this_cu,
-                     const char *dwo_name, const char *comp_dir,
+lookup_dwo_comp_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir,
                      ULONGEST signature)
 {
-  return lookup_dwo_cutu (this_cu, dwo_name, comp_dir, signature, 0);
+  gdb_assert (!cu->per_cu->is_debug_types);
+
+  return lookup_dwo_cutu (cu, dwo_name, comp_dir, signature, 0);
 }
 
 /* Lookup the DWO TU DWO_NAME/SIGNATURE referenced from THIS_TU.
    See lookup_dwo_cutu_unit for details.  */
 
 static struct dwo_unit *
-lookup_dwo_type_unit (struct signatured_type *this_tu,
-                     const char *dwo_name, const char *comp_dir)
+lookup_dwo_type_unit (dwarf2_cu *cu, const char *dwo_name, const char *comp_dir)
 {
-  return lookup_dwo_cutu (&this_tu->per_cu, dwo_name, comp_dir, this_tu->signature, 1);
+  gdb_assert (cu->per_cu->is_debug_types);
+
+  signatured_type *sig_type = (signatured_type *) cu->per_cu;
+
+  return lookup_dwo_cutu (cu, dwo_name, comp_dir, sig_type->signature, 1);
 }
 
 /* Traversal function for queue_and_load_all_dwo_tus.  */
@@ -12864,8 +12880,8 @@ queue_and_load_all_dwo_tus (struct dwarf2_per_cu_data *per_cu)
   struct dwo_file *dwo_file;
 
   gdb_assert (!per_cu->is_debug_types);
-  gdb_assert (get_dwp_file (per_cu->dwarf2_per_objfile) == NULL);
   gdb_assert (per_cu->cu != NULL);
+  gdb_assert (get_dwp_file (per_cu->cu->per_objfile) == NULL);
 
   dwo_unit = per_cu->cu->dwo_unit;
   gdb_assert (dwo_unit != NULL);
@@ -13101,7 +13117,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
       newobj->static_link
        = XOBNEW (&objfile->objfile_obstack, struct dynamic_prop);
       attr_to_dynamic_prop (attr, die, cu, newobj->static_link,
-                           cu->per_cu->addr_type ());
+                           cu->addr_type ());
     }
 
   cu->list_in_scope = cu->get_builder ()->get_local_symbols ();
@@ -15493,8 +15509,7 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu)
       else
        {
          struct dynamic_prop prop;
-         if (attr_to_dynamic_prop (attr, die, cu, &prop,
-                                   cu->per_cu->addr_type ()))
+         if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type ()))
            type->add_dyn_prop (DYN_PROP_BYTE_SIZE, prop);
           TYPE_LENGTH (type) = 0;
        }
@@ -16180,7 +16195,7 @@ read_array_type (struct die_info *die, struct dwarf2_cu *cu)
   if (attr != NULL)
     {
       int stride_ok;
-      struct type *prop_type = cu->per_cu->addr_sized_int_type (false);
+      struct type *prop_type = cu->addr_sized_int_type (false);
 
       byte_stride_prop
        = (struct dynamic_prop *) alloca (sizeof (struct dynamic_prop));
@@ -16980,13 +16995,13 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
          /* Pass 0 as the default as we know this attribute is constant
             and the default value will not be returned.  */
          LONGEST sz = len->constant_value (0);
-         prop_type = cu->per_cu->int_type (sz, true);
+         prop_type = cu->per_objfile->int_type (sz, true);
        }
       else
        {
          /* If the size is not specified then we assume it is the size of
             an address on this target.  */
-         prop_type = cu->per_cu->addr_sized_int_type (true);
+         prop_type = cu->addr_sized_int_type (true);
        }
 
       /* Convert the attribute into a dynamic property.  */
@@ -17616,9 +17631,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
 /* See read.h.  */
 
 struct type *
-dwarf2_per_cu_data::int_type (int size_in_bytes, bool unsigned_p) const
+dwarf2_per_objfile::int_type (int size_in_bytes, bool unsigned_p) const
 {
-  struct objfile *objfile = dwarf2_per_objfile->objfile;
   struct type *int_type;
 
   /* Helper macro to examine the various builtin types.  */
@@ -17643,10 +17657,10 @@ dwarf2_per_cu_data::int_type (int size_in_bytes, bool unsigned_p) const
 /* See read.h.  */
 
 struct type *
-dwarf2_per_cu_data::addr_sized_int_type (bool unsigned_p) const
+dwarf2_cu::addr_sized_int_type (bool unsigned_p) const
 {
-  int addr_size = this->addr_size ();
-  return int_type (addr_size, unsigned_p);
+  int addr_size = this->per_cu->addr_size ();
+  return this->per_objfile->int_type (addr_size, unsigned_p);
 }
 
 /* Read the DW_AT_type attribute for a sub-range.  If this attribute is not
@@ -17671,7 +17685,7 @@ read_subrange_index_type (struct die_info *die, struct dwarf2_cu *cu)
      FIXME: muller/2010-05-28: Possible references to object for low bound,
      high bound or count are not yet handled by this code.  */
   if (index_type->code () == TYPE_CODE_VOID)
-    index_type = cu->per_cu->addr_sized_int_type (false);
+    index_type = cu->addr_sized_int_type (false);
 
   return index_type;
 }
@@ -17801,7 +17815,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
   attribute *attr_byte_stride = dwarf2_attr (die, DW_AT_byte_stride, cu);
   if (attr_byte_stride != nullptr)
     {
-      struct type *prop_type = cu->per_cu->addr_sized_int_type (false);
+      struct type *prop_type = cu->addr_sized_int_type (false);
       attr_to_dynamic_prop (attr_byte_stride, die, cu, &byte_stride_prop,
                            prop_type);
     }
@@ -17821,7 +17835,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
        }
       else
        {
-         struct type *prop_type = cu->per_cu->addr_sized_int_type (false);
+         struct type *prop_type = cu->addr_sized_int_type (false);
          attr_to_dynamic_prop (attr_bit_stride, die, cu, &bit_stride_prop,
                                prop_type);
        }
@@ -23389,12 +23403,12 @@ dwarf2_per_cu_data::text_offset () const
 /* See read.h.  */
 
 struct type *
-dwarf2_per_cu_data::addr_type () const
+dwarf2_cu::addr_type () const
 {
-  struct objfile *objfile = dwarf2_per_objfile->objfile;
+  struct objfile *objfile = this->per_objfile->objfile;
   struct type *void_type = objfile_type (objfile)->builtin_void;
   struct type *addr_type = lookup_pointer_type (void_type);
-  int addr_size = this->addr_size ();
+  int addr_size = this->per_cu->addr_size ();
 
   if (TYPE_LENGTH (addr_type) == addr_size)
     return addr_type;
@@ -23732,7 +23746,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
   attr = dwarf2_attr (die, DW_AT_allocated, cu);
   if (attr != NULL && attr->form_is_block ())
     {
-      struct type *prop_type = cu->per_cu->addr_sized_int_type (false);
+      struct type *prop_type = cu->addr_sized_int_type (false);
       if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
         type->add_dyn_prop (DYN_PROP_ALLOCATED, prop);
     }
@@ -23747,7 +23761,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
   attr = dwarf2_attr (die, DW_AT_associated, cu);
   if (attr != NULL && attr->form_is_block ())
     {
-      struct type *prop_type = cu->per_cu->addr_sized_int_type (false);
+      struct type *prop_type = cu->addr_sized_int_type (false);
       if (attr_to_dynamic_prop (attr, die, cu, &prop, prop_type))
         type->add_dyn_prop (DYN_PROP_ASSOCIATED, prop);
     }
@@ -23760,8 +23774,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
 
   /* Read DW_AT_data_location and set in type.  */
   attr = dwarf2_attr (die, DW_AT_data_location, cu);
-  if (attr_to_dynamic_prop (attr, die, cu, &prop,
-                           cu->per_cu->addr_type ()))
+  if (attr_to_dynamic_prop (attr, die, cu, &prop, cu->addr_type ()))
     type->add_dyn_prop (DYN_PROP_DATA_LOCATION, prop);
 
   if (dwarf2_per_objfile->die_type_hash == NULL)
This page took 0.086743 seconds and 4 git commands to generate.