diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-14 20:54:17 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-12-14 20:54:17 +0000 |
commit | f8f3752147e0722f805fd1063a4b22e69f9740ce (patch) | |
tree | 05360f26f61441741762e034d1fa1b831ba0023b /gcc/hash-table.h | |
parent | 78d9d5fcd3d21f1281bfec73b8f47b1105b4863a (diff) | |
download | gcc-f8f3752147e0722f805fd1063a4b22e69f9740ce.tar.gz |
PR c++/68309
gcc/
* hash-table.h: Add copy constructor.
* hash-map.h: Add copy constructor.
gcc/cp/
* pt.c (instantiate_decl): Copy local_specializations for nested
function.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231632 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/hash-table.h')
-rw-r--r-- | gcc/hash-table.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/hash-table.h b/gcc/hash-table.h index 85598301e9b..53e72e66f33 100644 --- a/gcc/hash-table.h +++ b/gcc/hash-table.h @@ -365,6 +365,10 @@ public: bool gather_mem_stats = GATHER_STATISTICS, mem_alloc_origin origin = HASH_TABLE_ORIGIN CXX_MEM_STAT_INFO); + hash_table (const hash_table &, bool ggc = false, + bool gather_mem_stats = GATHER_STATISTICS, + mem_alloc_origin origin = HASH_TABLE_ORIGIN + CXX_MEM_STAT_INFO); ~hash_table (); /* Create a hash_table in gc memory. */ @@ -582,6 +586,35 @@ hash_table<Descriptor, Allocator>::hash_table (size_t size, bool ggc, bool } template<typename Descriptor, template<typename Type> class Allocator> +hash_table<Descriptor, Allocator>::hash_table (const hash_table &h, bool ggc, + bool gather_mem_stats, + mem_alloc_origin origin + MEM_STAT_DECL) : + m_n_elements (h.m_n_elements), m_n_deleted (h.m_n_deleted), + m_searches (0), m_collisions (0), m_ggc (ggc), + m_gather_mem_stats (gather_mem_stats) +{ + size_t size = h.m_size; + + if (m_gather_mem_stats) + hash_table_usage.register_descriptor (this, origin, ggc + FINAL_PASS_MEM_STAT); + + value_type *nentries = alloc_entries (size PASS_MEM_STAT); + for (size_t i = 0; i < size; ++i) + { + value_type &entry = h.m_entries[i]; + if (is_deleted (entry)) + mark_deleted (nentries[i]); + else if (!is_empty (entry)) + nentries[i] = entry; + } + m_entries = nentries; + m_size = size; + m_size_prime_index = h.m_size_prime_index; +} + +template<typename Descriptor, template<typename Type> class Allocator> hash_table<Descriptor, Allocator>::~hash_table () { for (size_t i = m_size - 1; i < m_size; i--) |