From patchwork Tue May 5 18:06:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giuliano Procida X-Patchwork-Id: 39219 From: gprocida@google.com (Giuliano Procida) Date: Tue, 5 May 2020 19:06:11 +0100 Subject: [PATCH 3/4] abg-reader.cc: Strip out WIP type tracking. In-Reply-To: <20200505180612.232158-1-gprocida@google.com> References: <20200505180612.232158-1-gprocida@google.com> Message-ID: <20200505180612.232158-4-gprocida@google.com> This functionality was needed only for early canonicalisation of types and is now no longer used. * src/abg-reader.cc (read_context): Drop m_wip_types_map member. Drop clear_wip_classes_map, mark_type_as_wip, unmark_type_as_wip and is_wip_type methods. Signed-off-by: Giuliano Procida --- src/abg-reader.cc | 67 ----------------------------------------------- 1 file changed, 67 deletions(-) diff --git a/src/abg-reader.cc b/src/abg-reader.cc index a2bd3c5c..27bc9d51 100644 --- a/src/abg-reader.cc +++ b/src/abg-reader.cc @@ -119,7 +119,6 @@ private: unordered_map > m_types_map; unordered_map > m_fn_tmpl_map; unordered_map > m_class_tmpl_map; - unordered_map m_wip_types_map; vector m_types_to_canonicalize; string_xml_node_map m_id_xml_node_map; xml_node_decl_base_sptr_map m_xml_node_decl_map; @@ -518,66 +517,6 @@ public: clear_types_to_canonicalize() {m_types_to_canonicalize.clear();} - /// Clean the map of classes that are "Work In Progress"; that is, - /// the map of the class that are currently being built, but at not - /// yet fully built. - void - clear_wip_classes_map() - {m_wip_types_map.clear();} - - /// Mark a given type as being "Work In Progress"; that is, mark it - /// as being currently built. - /// - /// @param t the class to mark as being "Work In Progress". - void - mark_type_as_wip(const type_base_sptr t) - { - if (!t) - return; - string qname = get_type_name(t, /*qualified=*/true); - unordered_map::iterator it = m_wip_types_map.find(qname); - if (it == m_wip_types_map.end()) - m_wip_types_map[qname] = 1; - else - ++it->second; - } - - /// Mark a given class as being *NOT* "Work In Progress" anymore; - /// that is, mark it as being fully built. - /// - /// @param t the type to mark as being built. - void - unmark_type_as_wip(const type_base_sptr t) - { - if (!t) - return; - - string qname = get_type_name(t, /*qualified=*/true); - unordered_map::iterator it = m_wip_types_map.find(qname); - if (it == m_wip_types_map.end()) - return; - if (it->second) - --it->second; - if (it->second == 0) - m_wip_types_map.erase(it); - } - - /// Test if a type is being currently built; that is, if it's "Work - /// In Progress". - /// - /// @param t the type to consider. - bool - is_wip_type(const type_base_sptr t) const - { - if (!t) - return false; - - string qname = get_type_name(t, /*qualified=*/true); - unordered_map::const_iterator i = - m_wip_types_map.find(qname); - return i != m_wip_types_map.end(); - } - /// Test if two types are equal, without comparing them structurally. /// /// This either tests that type pointers are equal, or it tests @@ -3815,7 +3754,6 @@ build_function_type(read_context& ctxt, parms, size, align)); ctxt.get_translation_unit()->bind_function_type_life_time(fn_type); - ctxt.mark_type_as_wip(fn_type); ctxt.key_type_decl(fn_type, id); for (xmlNodePtr n = node->children; n ; n = n->next) @@ -3842,7 +3780,6 @@ build_function_type(read_context& ctxt, } fn_type->set_parameters(parms); - ctxt.unmark_type_as_wip(fn_type); return fn_type; } @@ -4538,7 +4475,6 @@ build_class_decl(read_context& ctxt, ctxt.push_decl_to_current_scope(decl, add_to_current_scope); ctxt.map_xml_node_to_decl(node, decl); - ctxt.mark_type_as_wip(decl); ctxt.key_type_decl(decl, id); // If this class has a naming typedef, get it and refer to it. @@ -4762,7 +4698,6 @@ build_class_decl(read_context& ctxt, } ctxt.pop_scope_or_abort(decl); - ctxt.unmark_type_as_wip(decl); return decl; } @@ -4945,7 +4880,6 @@ build_union_decl(read_context& ctxt, ctxt.push_decl_to_current_scope(decl, add_to_current_scope); ctxt.map_xml_node_to_decl(node, decl); - ctxt.mark_type_as_wip(decl); ctxt.key_type_decl(decl, id); for (xmlNodePtr n = node->children; !is_decl_only && n; n = n->next) @@ -5097,7 +5031,6 @@ build_union_decl(read_context& ctxt, } ctxt.pop_scope_or_abort(decl); - ctxt.unmark_type_as_wip(decl); return decl; }