Add the cp_global_trees to the cache during the preload.

Those are preconstructed trees which we only need the pointers to (i.e. they 
should be identical in both the .cc and .h)

One exception to this is the keyed_classes tree which is generated during 
parsing.

We will need to merge the keyed_classes tree eventually when working with 
multiple pph's.

2011-06-28  Gabriel Charette  <gch...@google.com>

        * pph-streamer.c (pph_preload_common_nodes):
        Add cp_global_trees[] to cache.

        * g++.dg/pph/x1typerefs.cc: Remove xfail.

diff --git a/gcc/cp/pph-streamer.c b/gcc/cp/pph-streamer.c
index e919baf..c62864a 100644
--- a/gcc/cp/pph-streamer.c
+++ b/gcc/cp/pph-streamer.c
@@ -79,6 +79,17 @@ pph_preload_common_nodes (struct lto_streamer_cache_d *cache)
     if (c_global_trees[i])
       lto_streamer_cache_append (cache, c_global_trees[i]);
 
+  /* cp_global_trees[] can have NULL entries in it.  Skip them.  */
+  for (i = 0; i < CPTI_MAX; i++)
+    {
+      /* Also skip trees which are generated while parsing.  */
+      if (i == CPTI_KEYED_CLASSES)
+       continue;
+
+      if (cp_global_trees[i])
+       lto_streamer_cache_append (cache, cp_global_trees[i]);
+    }
+
   lto_streamer_cache_append (cache, global_namespace);
 }
 
diff --git a/gcc/testsuite/g++.dg/pph/x1typerefs.cc 
b/gcc/testsuite/g++.dg/pph/x1typerefs.cc
index ba7580f..6aa0e96 100644
--- a/gcc/testsuite/g++.dg/pph/x1typerefs.cc
+++ b/gcc/testsuite/g++.dg/pph/x1typerefs.cc
@@ -1,6 +1,3 @@
-// { dg-xfail-if "BOGUS" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "c1typerefs.h:11:18: error: cannot convert 'const 
std::type_info.' to 'const std::type_info.' in initialization" "" { xfail *-*-* 
} 0 }
-
 #include "x1typerefs.h"
 
 int derived::method() {

--
This patch is available for review at http://codereview.appspot.com/4635077

Reply via email to