ccdc44b Setup per-corpus type maps indexed by type names

Authored and Committed by Dodji Seketeli 8 years ago
    Setup per-corpus type maps indexed by type names
    
    This patch creates per-corpus maps that associate, for a certain kind
    of type, the fully qualified name of the type to the type.
    
    So there is a map for class_decl, one for enum_type_decl, one for
    type_decl, etc.
    
    These maps are populated when a new type is added to its scope.
    
    The patch defines overloads of the function
    maybe_update_types_lookup_map() that update the right map, depending
    on the kind of type we are looking at.
    
    Note that there also is a map in each class that associates a
    signature string to a member functions.  This is so that member
    functions of a given class can be looked up by signature.
    
    This is so that looking up a type becomes now much faster than having
    to walk all the translation units of a corpus to find one.
    
    Note that this patch is specifically part of the series of patches
    that implements types and declarations de-duplication while reading
    DWARF information.
    
    The patch might slightly change the output of abi serialization or
    comparison so it needs some adjustments of some test reference files.
    That adjustment is not done here.  Rather, it's done at once in
    another patch of the set.
    
    	* include/abg-corpus.h (corpus::priv_): Make this public so that
    	functions from outside of the class can access it.  These
    	functions are meant to be used only by code that is *inside*
    	libabigail.so, though.
    	* src/abg-corpus-priv.h: New file.
    	* src/abg-corpus.cc: Include the new abg-corpus-priv.h file.
    	(struct regex_t_deleter): Move this to abg-sptr-utils.h.
    	(build_sptr<regex_t>): Move the declaration of this function
    	template specialization to abg-sptr-utils.h and its definition to
    	abg-sptr-utils.cc.
    	(typedef regex_t_sptrs_type, typedef str_var_ptr_map_type)
    	(struct corpus::exported_decls_builder::priv, struct
    	corpus::priv): Move these declarations to the new
    	abg-corpus-priv.h.
    	(maybe_update_types_lookup_map): Define overloads of this (one per
    	kind of type).
    	(lookup_{basic, class, enum, typedef, class_or_typedef,
    	class_typedef_or_enum, qualified, pointer, reference, array,
    	function}_type): Define new functions.
    	* include/abg-ir.h (typedef istring_type_base_wptr_map_type)
    	(typedef istring_type_or_decl_base_sptr_map_type): Declare new
    	typedefs.
    	(class_decl::find_member_function_from_signature): Declare new
    	member function.
    	* src/abg-ir.cc: Include the new abg-corpus-priv.h file.
    	(maybe_update_types_lookup_map): Remove this initial function.
    	There are now new overloads in abg-corpus.cc for it.
    	(scope_decl::{add_member_decl, insert_member_decl}): Adjust.
    	(class_decl::{set_is_declaration_only, find_member_function,
    	add_member_function}): Adjust.
    	(class_decl::find_member_function_from_signature): Define new
    	member function.
    	* include/abg-sptr-utils.h (struct regex_t_deleter): Declare new
    	type.
    	(build_sptr<regex_t>): New build function template
    	specializations.
    	* src/abg-sptr-utils.cc: New file.
    	* src/Makefile.am: Add src/abg-sptr-utils.cc and
    	src/abg-corpus-priv.h to the build system.
    
    Signed-off-by: Dodji Seketeli <dodji@redhat.com>
    
        
file modified
+1 -2
file modified
+21 -5
file modified
+38 -1
file modified
+2 -0
file added
+969
file modified
+663 -716
file modified
+51 -70