mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-18 16:04:34 +00:00
Initial support to lookup types per location
This patch adds support to associate a type to its source location. The location being a string of the form "filepath:line:column". The association is done by a per-translation unit map which associates a location to a type. For the moment this only associates one type to a given location. For the general case, though, we need to associate a vector or types to a given location. We'll add that support later. The patch provides lookup functions, each of which looking up a particular kind of type by its location. * include/abg-fwd.h (get_name_of_qualified_type) (get_name_of_reference_to_type, lookup_basic_type_per_location) (lookup_class_type_per_location, lookup_union_type_per_location) (lookup_enum_type_per_location, lookup_typedef_type) (lookup_typedef_type_per_location, lookup_pointer_type) (lookup_reference_type, lookup_type_per_location) (lookup_type_through_translation_units) (lookup_type_from_translation_unit, odr_is_relevant): Declare new functions or new function overloads. * include/abg-ir.h (location::expand): Declare new member function. (type_maps::empty): Likewise. (operator|=): Declare an overload for qualified_type_def::CV. (get_string_representation_of_cv_quals) (get_name_of_qualified_type, lookup_qualified_type): Declare new functions. * src/abg-ir.cc (location::expand): Define new member function. (type_maps::empty): Likewise. (odr_is_relevant): Likewise. (get_string_representation_of_cv_quals) (get_name_of_reference_to_type, get_name_of_qualified_type) (lookup_union_type_per_location): Define new functions or overloads. (lookup_basic_type, lookup_enum_type, lookup_typedef_type) (lookup_qualified_type, lookup_pointer_type) (lookup_reference_type, lookup_type_from_translation_unit) (lookup_basic_type_per_location, lookup_basic_type_per_location) (lookup_class_type_per_location, lookup_class_type_per_location) (lookup_enum_type_per_location, lookup_enum_type_per_location) (lookup_typedef_type_per_location) (lookup_typedef_type_per_location, lookup_type_per_location): Define new overloads. (maybe_update_types_lookup_map) (maybe_update_types_lookup_map<class_decl>) (maybe_update_types_lookup_map<function_type>): Add a new use_type_name_as_key parameter. If it's false, then associates the type to its location rather than to its name. (maybe_update_types_lookup_map): In the overloads for type_decl, class_decl, union_decl, enum_type, typedef_decl, array_type_def, record the type in the lookup map per location, in addition to the per-name recording. (qualified_type_def::build_name): Use the new get_name_of_qualified_type. (qualified_type_def::get_cv_quals_string_prefix): Use the new get_string_representation_of_cv_quals. (operator|=): Define a new overload for qualified_type_def::CV. (pointer_type_def::get_qualified_name): Use the new get_name_of_pointer_to_type. (reference_type_def::get_qualified_name): Use the new get_name_of_reference_to_type. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
50231b5537
commit
c99addc245
@ -758,6 +758,17 @@ get_type_name(const type_base&,
|
||||
bool qualified = true,
|
||||
bool internal = false);
|
||||
|
||||
interned_string
|
||||
get_name_of_pointer_to_type(const type_base& pointed_to_type,
|
||||
bool qualified = true,
|
||||
bool internal = false);
|
||||
|
||||
interned_string
|
||||
get_name_of_reference_to_type(const type_base& pointed_to_type,
|
||||
bool lvalue_reference = false,
|
||||
bool qualified = true,
|
||||
bool internal = false);
|
||||
|
||||
interned_string
|
||||
get_function_type_name(const function_type_sptr&,
|
||||
bool internal = false);
|
||||
@ -816,6 +827,9 @@ string
|
||||
get_pretty_representation(const method_type_sptr&,
|
||||
bool internal = false);
|
||||
|
||||
bool
|
||||
odr_is_relevant(type_or_decl_base&);
|
||||
|
||||
const decl_base*
|
||||
get_type_declaration(const type_base*);
|
||||
|
||||
@ -870,6 +884,12 @@ lookup_basic_type(const string&, const corpus&);
|
||||
type_decl_sptr
|
||||
lookup_basic_type(const interned_string&, const corpus&);
|
||||
|
||||
type_decl_sptr
|
||||
lookup_basic_type_per_location(const interned_string&, const corpus&);
|
||||
|
||||
type_decl_sptr
|
||||
lookup_basic_type_per_location(const string&, const corpus&);
|
||||
|
||||
class_decl_sptr
|
||||
lookup_class_type(const class_decl&, const translation_unit&);
|
||||
|
||||
@ -885,6 +905,12 @@ lookup_class_type(const class_decl&, const corpus&);
|
||||
class_decl_sptr
|
||||
lookup_class_type(const interned_string&, const corpus&);
|
||||
|
||||
class_decl_sptr
|
||||
lookup_class_type_per_location(const interned_string&, const corpus&);
|
||||
|
||||
class_decl_sptr
|
||||
lookup_class_type_per_location(const string&, const corpus&);
|
||||
|
||||
class_decl_sptr
|
||||
lookup_class_type(const string&, const corpus&);
|
||||
|
||||
@ -898,6 +924,12 @@ lookup_union_type(const interned_string&, const translation_unit&);
|
||||
union_decl_sptr
|
||||
lookup_union_type(const interned_string&, const corpus&);
|
||||
|
||||
union_decl_sptr
|
||||
lookup_union_type_per_location(const interned_string&, const corpus&);
|
||||
|
||||
union_decl_sptr
|
||||
lookup_union_type_per_location(const string&, const corpus&);
|
||||
|
||||
union_decl_sptr
|
||||
lookup_union_type(const string&, const corpus&);
|
||||
|
||||
@ -916,15 +948,34 @@ lookup_enum_type(const string&, const corpus&);
|
||||
enum_type_decl_sptr
|
||||
lookup_enum_type(const interned_string&, const corpus&);
|
||||
|
||||
enum_type_decl_sptr
|
||||
lookup_enum_type_per_location(const interned_string&, const corpus&);
|
||||
|
||||
enum_type_decl_sptr
|
||||
lookup_enum_type_per_location(const string&, const corpus&);
|
||||
|
||||
typedef_decl_sptr
|
||||
lookup_typedef_type(const typedef_decl&, const translation_unit&);
|
||||
|
||||
typedef_decl_sptr
|
||||
lookup_typedef_type(const typedef_decl&, const corpus&);
|
||||
|
||||
typedef_decl_sptr
|
||||
lookup_typedef_type(const interned_string& type_name,
|
||||
const translation_unit& tu);
|
||||
|
||||
typedef_decl_sptr
|
||||
lookup_typedef_type(const string& type_name, const translation_unit& tu);
|
||||
|
||||
typedef_decl_sptr
|
||||
lookup_typedef_type(const interned_string&, const corpus&);
|
||||
|
||||
typedef_decl_sptr
|
||||
lookup_typedef_type_per_location(const interned_string&, const corpus &);
|
||||
|
||||
typedef_decl_sptr
|
||||
lookup_typedef_type_per_location(const string&, const corpus &);
|
||||
|
||||
typedef_decl_sptr
|
||||
lookup_typedef_type(const string&, const corpus&);
|
||||
|
||||
@ -958,6 +1009,10 @@ lookup_pointer_type(const pointer_type_def&, const translation_unit&);
|
||||
pointer_type_def_sptr
|
||||
lookup_pointer_type(const string&, const translation_unit&);
|
||||
|
||||
pointer_type_def_sptr
|
||||
lookup_pointer_type(const type_base_sptr& pointed_to_type,
|
||||
const translation_unit& tu);
|
||||
|
||||
pointer_type_def_sptr
|
||||
lookup_pointer_type(const pointer_type_def&, const corpus&);
|
||||
|
||||
@ -970,6 +1025,11 @@ lookup_reference_type(const reference_type_def&, const translation_unit&);
|
||||
const reference_type_def_sptr
|
||||
lookup_reference_type(const string&, const translation_unit&);
|
||||
|
||||
const reference_type_def_sptr
|
||||
lookup_reference_type(const type_base_sptr& pointed_to_type,
|
||||
bool lvalue_reference,
|
||||
const translation_unit& tu);
|
||||
|
||||
reference_type_def_sptr
|
||||
lookup_reference_type(const reference_type_def&, const corpus&);
|
||||
|
||||
@ -1025,6 +1085,9 @@ lookup_type(const type_base_sptr, const translation_unit&);
|
||||
type_base_sptr
|
||||
lookup_type(const interned_string&, const corpus&);
|
||||
|
||||
type_base_sptr
|
||||
lookup_type_per_location(const interned_string&, const corpus&);
|
||||
|
||||
type_base_sptr
|
||||
lookup_type(const type_base&, const corpus&);
|
||||
|
||||
@ -1035,6 +1098,14 @@ type_base_sptr
|
||||
lookup_type_through_scopes(const std::list<string>&,
|
||||
const translation_unit&);
|
||||
|
||||
type_base_sptr
|
||||
lookup_type_through_translation_units(const string&, const corpus&);
|
||||
|
||||
type_base_sptr
|
||||
lookup_type_from_translation_unit(const string& type_name,
|
||||
const string& tu_path,
|
||||
const corpus& corp);
|
||||
|
||||
function_type_sptr
|
||||
lookup_or_synthesize_fn_type(const function_type_sptr&,
|
||||
const corpus&);
|
||||
|
@ -272,6 +272,9 @@ public:
|
||||
void
|
||||
expand(std::string& path, unsigned& line, unsigned& column) const;
|
||||
|
||||
string
|
||||
expand(void) const;
|
||||
|
||||
friend class location_manager;
|
||||
}; // end class location
|
||||
|
||||
@ -344,6 +347,9 @@ public:
|
||||
|
||||
type_maps();
|
||||
|
||||
bool
|
||||
empty() const;
|
||||
|
||||
const istring_type_base_wptr_map_type&
|
||||
basic_types() const;
|
||||
|
||||
@ -1721,6 +1727,9 @@ operator!=(const qualified_type_def_sptr&, const qualified_type_def_sptr&);
|
||||
qualified_type_def::CV
|
||||
operator|(qualified_type_def::CV, qualified_type_def::CV);
|
||||
|
||||
qualified_type_def::CV&
|
||||
operator|=(qualified_type_def::CV&, qualified_type_def::CV);
|
||||
|
||||
qualified_type_def::CV
|
||||
operator&(qualified_type_def::CV, qualified_type_def::CV);
|
||||
|
||||
@ -1730,6 +1739,18 @@ operator~(qualified_type_def::CV);
|
||||
std::ostream&
|
||||
operator<<(std::ostream&, qualified_type_def::CV);
|
||||
|
||||
string
|
||||
get_string_representation_of_cv_quals(const qualified_type_def::CV);
|
||||
|
||||
interned_string
|
||||
get_name_of_qualified_type(const type_base_sptr& underlying_type,
|
||||
qualified_type_def::CV quals,
|
||||
bool qualified = true, bool internal = false);
|
||||
|
||||
qualified_type_def_sptr
|
||||
lookup_qualified_type(const type_base_sptr&,
|
||||
qualified_type_def::CV,
|
||||
const translation_unit&);
|
||||
bool
|
||||
equals(const pointer_type_def&, const pointer_type_def&, change_kind*);
|
||||
|
||||
|
813
src/abg-ir.cc
813
src/abg-ir.cc
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user