gdb/dwarf: remove create_cu_from_index_list

I noticed that create_cu_from_index_list is only used in
read-gdb-index.c, so I started by moving it there.  But given that this
function is use at only one spot and doesn't do much, I opted to inline
its code in the caller instead.

Change-Id: Iebe0dc20d345fa70a2f11aa9ff1a04fe26a31407
Approved-By: Tom Tromey <tom@tromey.com>
diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
index 66d7209..282ac5b 100644
--- a/gdb/dwarf2/read-gdb-index.c
+++ b/gdb/dwarf2/read-gdb-index.c
@@ -1324,9 +1324,9 @@ create_cus_from_gdb_index_list (dwarf2_per_bfd *per_bfd,
       ULONGEST length = extract_unsigned_integer (cu_list + 8, 8, BFD_ENDIAN_LITTLE);
       cu_list += 2 * 8;
 
-      dwarf2_per_cu_up per_cu
-	= create_cu_from_index_list (per_bfd, section, is_dwz, sect_off,
-				     length);
+      dwarf2_per_cu_up per_cu = per_bfd->allocate_per_cu (section, sect_off, length);
+      per_cu->is_dwz = is_dwz;
+
       per_bfd->all_units.push_back (std::move (per_cu));
     }
 }
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b239458..0bef46a 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1841,20 +1841,6 @@ dwarf2_per_bfd::allocate_signatured_type (dwarf2_section_info *section,
   return result;
 }
 
-/* See read.h.  */
-
-dwarf2_per_cu_up
-create_cu_from_index_list (dwarf2_per_bfd *per_bfd,
-			   struct dwarf2_section_info *section,
-			   int is_dwz,
-			   sect_offset sect_off, ULONGEST length)
-{
-  dwarf2_per_cu_up the_cu
-    = per_bfd->allocate_per_cu (section, sect_off, length);
-  the_cu->is_dwz = is_dwz;
-  return the_cu;
-}
-
 /* die_reader_func for dw2_get_file_names.  */
 
 static void
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 43d0e5d..7a98eb4 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -998,13 +998,6 @@ extern void dw_expand_symtabs_matching_file_matcher
 extern const char *read_indirect_string_at_offset
   (dwarf2_per_objfile *per_objfile, LONGEST str_offset);
 
-/* Return a new dwarf2_per_cu allocated on the per-bfd obstack, and constructed
-   with the specified field values.  */
-
-extern dwarf2_per_cu_up create_cu_from_index_list
-  (dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section,
-   int is_dwz, sect_offset sect_off, ULONGEST length);
-
 /* Initialize the views on all_units.  */
 
 extern void finalize_all_units (dwarf2_per_bfd *per_bfd);