diff gcc/hash-map.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/hash-map.h	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/hash-map.h	Thu Oct 25 07:37:49 2018 +0900
@@ -1,5 +1,5 @@
 /* A type-safe hash map.
-   Copyright (C) 2014-2017 Free Software Foundation, Inc.
+   Copyright (C) 2014-2018 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -62,6 +62,12 @@
 	gt_ggc_mx (e.m_value);
       }
 
+    static void ggc_maybe_mx (hash_entry &e)
+      {
+	if (Traits::maybe_mx)
+	  ggc_mx (e);
+      }
+
     static void pch_nx (hash_entry &e)
       {
 	gt_pch_nx (e.m_key);
@@ -74,6 +80,11 @@
 	pch_nx_helper (e.m_value, op, c);
       }
 
+    static int keep_cache_entry (hash_entry &e)
+      {
+	return ggc_marked_p (e.m_key);
+      }
+
   private:
     template<typename T>
     static void
@@ -212,10 +223,10 @@
       return *this;
     }
 
-    std::pair<Key, Value> operator* ()
+    std::pair<const Key&, Value&> operator* ()
     {
       hash_entry &e = *m_iter;
-      return std::pair<Key, Value> (e.m_key, e.m_value);
+      return std::pair<const Key&, Value&> (e.m_key, e.m_value);
     }
 
     bool
@@ -237,7 +248,8 @@
 
   template<typename T, typename U, typename V> friend void gt_ggc_mx (hash_map<T, U, V> *);
   template<typename T, typename U, typename V> friend void gt_pch_nx (hash_map<T, U, V> *);
-      template<typename T, typename U, typename V> friend void gt_pch_nx (hash_map<T, U, V> *, gt_pointer_operator, void *);
+  template<typename T, typename U, typename V> friend void gt_pch_nx (hash_map<T, U, V> *, gt_pointer_operator, void *);
+  template<typename T, typename U, typename V> friend void gt_cleare_cache (hash_map<T, U, V> *);
 
   hash_table<hash_entry> m_table;
 };
@@ -260,6 +272,14 @@
 
 template<typename K, typename V, typename H>
 static inline void
+gt_cleare_cache (hash_map<K, V, H> *h)
+{
+  if (h)
+    gt_cleare_cache (&h->m_table);
+}
+
+template<typename K, typename V, typename H>
+static inline void
 gt_pch_nx (hash_map<K, V, H> *h, gt_pointer_operator op, void *cookie)
 {
   op (&h->m_table.m_entries, cookie);