c++: Adjust pushdecl/duplicate_decls API
[gcc.git] / gcc / ipa-reference.c
index 09aa9280d0fc0a4e57ec04604bda86bae0716e0f..4a6c011c525eceb1e096618ff169a1b8ed95467d 100644 (file)
@@ -1,5 +1,5 @@
 /* Callgraph based analysis of static variables.
-   Copyright (C) 2004-2019 Free Software Foundation, Inc.
+   Copyright (C) 2004-2020 Free Software Foundation, Inc.
    Contributed by Kenneth Zadeck <zadeck@naturalbridge.com>
 
 This file is part of GCC.
@@ -48,6 +48,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "calls.h"
 #include "ipa-utils.h"
 #include "ipa-reference.h"
+#include "alloc-pool.h"
 #include "symbol-summary.h"
 
 /* The static variables defined within the compilation unit that are
@@ -1038,7 +1039,7 @@ stream_out_bitmap (struct lto_simple_output_block *ob,
   EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi)
     {
       tree decl = (*reference_vars_to_consider) [index];
-      lto_output_var_decl_index (ob->decl_state, ob->main_stream, decl);
+      lto_output_var_decl_ref (ob->decl_state, ob->main_stream, decl);
     }
 }
 
@@ -1056,7 +1057,7 @@ ipa_reference_write_optimization_summary (void)
   int i;
 
   vec_alloc (reference_vars_to_consider, ipa_reference_vars_uids);
-  reference_vars_to_consider->safe_grow (ipa_reference_vars_uids);
+  reference_vars_to_consider->safe_grow (ipa_reference_vars_uids, true);
 
   /* See what variables we are interested in.  */
   for (i = 0; i < lto_symtab_encoder_size (encoder); i++)
@@ -1157,9 +1158,7 @@ ipa_reference_read_optimization_summary (void)
            fprintf (dump_file, "all module statics:");
          for (i = 0; i < (unsigned int)b_count; i++)
            {
-             unsigned int var_index = streamer_read_uhwi (ib);
-             tree v_decl = lto_file_decl_data_get_var_decl (file_data,
-                                                            var_index);
+             tree v_decl = lto_input_var_decl_ref (ib, file_data);
              bool existed;
              bitmap_set_bit (all_module_statics,
                              ipa_reference_var_get_or_insert_uid
@@ -1205,9 +1204,7 @@ ipa_reference_read_optimization_summary (void)
                    (&optimization_summary_obstack);
                  for (j = 0; j < (unsigned int)v_count; j++)
                    {
-                     unsigned int var_index = streamer_read_uhwi (ib);
-                     tree v_decl = lto_file_decl_data_get_var_decl (file_data,
-                                                                    var_index);
+                     tree v_decl = lto_input_var_decl_ref (ib, file_data);
                      bitmap_set_bit (info->statics_read,
                                      ipa_reference_var_uid (v_decl));
                      if (dump_file)
@@ -1234,9 +1231,7 @@ ipa_reference_read_optimization_summary (void)
                    (&optimization_summary_obstack);
                  for (j = 0; j < (unsigned int)v_count; j++)
                    {
-                     unsigned int var_index = streamer_read_uhwi (ib);
-                     tree v_decl = lto_file_decl_data_get_var_decl (file_data,
-                                                                    var_index);
+                     tree v_decl = lto_input_var_decl_ref (ib, file_data);
                      bitmap_set_bit (info->statics_written,
                                      ipa_reference_var_uid (v_decl));
                      if (dump_file)