Make abg-fwd.h use *_sptr typedefs
authorDodji Seketeli <dodji@redhat.com>
Wed, 21 Dec 2016 19:50:08 +0000 (20:50 +0100)
committerDodji Seketeli <dodji@redhat.com>
Thu, 5 Jan 2017 11:18:32 +0000 (12:18 +0100)
Until now, the abg-fwd.h where the necessary forward generic
declarations where put didn't contain the convenience typedefs of the
form foo_sptr that designate a shared pointer to type foo.

This patch moves these convenience typedefs as well as the missing
forward declarations from abg-ir.h to abg-fwd.h.  The patch also
adjusts the function declarations in abg-fwd.h to make them use these
convenience typedefs.

* include/abg-ir.h: Move convience typedef declarations and some
necessary forward declarations to ...
* include/abg-fwd.h: ... here.
(is_enum_type, is_var_decl): Take a pointer to type_or_decl_base.
(lookup_type_in_scope): Return a type_base_sptr.
(lookup_type_through_scopes): Introduce this to later replace the
overload of lookup_type_in_translation_unit that takes a list of
strings.
(lookup_type_in_scope): Return a type_base_sptr, not a
decl_base_sptr.
* src/abg-ir.cc (lookup_type_in_scope, lookup_node_in_scope)
(lookup_var_decl_in_scope): Adjust.
(is_enum_type, is_var_decl): Take a pointer to type_or_decl_base.
(lookup_node_in_scope): Return a type_or_decl_base_sptr.
(lookup_type_in_scope): Return a type_base_sptr.
(lookup_node_in_translation_unit): Return a
type_or_decl_base_sptr.
(lookup_type_through_scopes): Replace
lookup_type_in_translation_unit.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
include/abg-fwd.h
include/abg-ir.h
src/abg-ir.cc

index 811fb8118b4f1612878a20621cf5ddb9b9e1b31e..a261efcf4e37a60f485af435302a546cce7fd6bd 100644 (file)
@@ -78,54 +78,228 @@ namespace ir
 class corpus;
 
 // Forward declarations for ir.
+
+struct ir_node_visitor;
+
+struct ir_traversable_base;
+
+/// Convenience typedef for a shared pointer to @ref
+/// ir_traversable_base.
+typedef shared_ptr<ir_traversable_base> ir_traversable_base_sptr;
+
 class environment;
+/// Convenience typedef for a shared pointer to an @ref environment
+typedef shared_ptr<environment> environment_sptr;
+
 class location;
 class location_manager;
+
 class corpus;
+/// A convenience typedef for shared pointer to @ref corpus.
+typedef shared_ptr<corpus> corpus_sptr;
+
+class type_or_decl_base;
+/// A convenience typedef for a shared_ptr to @ref type_or_decl_base.
+typedef shared_ptr<type_or_decl_base> type_or_decl_base_sptr;
+
+class type_base;
+
+// Convenience typedef for a shared pointer on a @ref type_base
+typedef shared_ptr<type_base> type_base_sptr;
+
+/// Convenience typedef for a weak pointer on a @ref type_base
+typedef weak_ptr<type_base> type_base_wptr;
+
+/// Convenience typedef for a weak pointer to a @ref corpus.
+typedef weak_ptr<corpus> corpus_wptr;
+
 class translation_unit;
+/// Convenience typedef for a shared pointer on a @ref
+/// translation_unit type.
+typedef shared_ptr<translation_unit> translation_unit_sptr;
+/// Convenience typedef for a vector of @ref translation_unit_sptr.
+typedef std::vector<translation_unit_sptr> translation_units;
+
+class decl_base;
+
+// Convenience typedef for a smart pointer on @ref decl_base.
+typedef shared_ptr<decl_base> decl_base_sptr;
+
+class type_decl;
+/// Convenience typedef for a shared pointer on a @ref type_decl.
+typedef shared_ptr<type_decl> type_decl_sptr;
+
+
+class typedef_decl;
+
+/// Convenience typedef for a shared pointer on a @ref typedef_decl.
+typedef shared_ptr<typedef_decl> typedef_decl_sptr;
+
+/// Convenience typedef for a weak pointer on a @ref typedef_decl.
+typedef weak_ptr<typedef_decl> typedef_decl_wptr;
+
+class enum_type_decl;
+
+/// Convenience typedef for shared pointer on enum_type_decl.
+typedef shared_ptr<enum_type_decl> enum_type_decl_sptr;
+
 class class_or_union;
+
+typedef shared_ptr<class_or_union> class_or_union_sptr;
+typedef weak_ptr<class_or_union> class_or_union_wptr;
+
+class scope_type_decl;
+
 class class_decl;
+
+/// Convenience typedef for a shared pointer on a @ref class_decl
+typedef shared_ptr<class_decl> class_decl_sptr;
+
+/// Convenience typedef for a vector of @ref class_decl_sptr
+typedef vector<class_decl_sptr> classes_type;
+
+/// Convenience typedef for a weak pointer on a @ref class_decl.
+typedef weak_ptr<class_decl> class_decl_wptr;
+
 class union_decl;
-class class_tdecl;
-class type_or_decl_base;
-class decl_base;
-class enum_type_decl;
-class function_decl;
-class function_tdecl;
+
+typedef shared_ptr<union_decl> union_decl_sptr;
+
 class function_type;
-class global_scope;
-class node_visitor;
-class location;
-class location_manager;
+/// Convenience typedef for a shared pointer on a @ref function_type
+typedef shared_ptr<function_type> function_type_sptr;
+
+/// Convenience typedef fo a vector of @ref function_type_sptr
+typedef vector<function_type_sptr> function_types_type;
+
+/// Convenience typedef for a weak pointer on a @ref function_type
+typedef weak_ptr<function_type> function_type_wptr;
+
 class method_type;
-class namespace_decl;
+
+/// Convenience typedef for shared pointer to @ref method_type.
+typedef shared_ptr<method_type> method_type_sptr;
+
 class pointer_type_def;
+
+/// Convenience typedef for a shared pointer on a @ref pointer_type_def
+typedef shared_ptr<pointer_type_def> pointer_type_def_sptr;
+
 class qualified_type_def;
+
+typedef shared_ptr<qualified_type_def> qualified_type_def_sptr;
+
 class reference_type_def;
+
+/// Convenience typedef for a shared pointer on a @ref reference_type_def
+typedef shared_ptr<reference_type_def> reference_type_def_sptr;
+
+class array_type_def;
+
+/// Convenience typedef for a shared pointer on a @ref array_type_def
+typedef shared_ptr<array_type_def> array_type_def_sptr;
+
+class subrange_type;
+
+class dm_context_rel;
+
+/// A convenience typedef for a shared pointer to dm_context_rel.
+typedef shared_ptr<dm_context_rel> dm_context_rel_sptr;
+
+class var_decl;
+
+/// Convenience typedef for a shared pointer on a @ref var_decl
+typedef shared_ptr<var_decl> var_decl_sptr;
+
 class scope_decl;
-class scope_type_decl;
+
+/// Convenience typedef for a shared pointer on a @ref scope_decl.
+typedef shared_ptr<scope_decl> scope_decl_sptr;
+
+class function_decl;
+
+/// Convenience typedef for a shared pointer on a @ref function_decl
+typedef shared_ptr<function_decl> function_decl_sptr;
+
+class method_decl;
+
+typedef shared_ptr<method_decl> method_decl_sptr;
+
+class mem_fn_context_rel;
+
+/// A convenience typedef for a shared pointer to @ref
+/// mem_fn_context_rel.
+typedef shared_ptr<mem_fn_context_rel> mem_fn_context_rel_sptr;
+
+class namespace_decl;
+
+/// Convenience typedef for a shared pointer on namespace_decl.
+typedef shared_ptr<namespace_decl> namespace_decl_sptr;
+
+class class_tdecl;
+
+/// Convenience typedef for a shared pointer on a @ref class_tdecl
+typedef shared_ptr<class_tdecl> class_tdecl_sptr;
+
+class function_tdecl;
+
+/// Convenience typedef for a shared pointer on a @ref function_tdecl
+typedef shared_ptr<function_tdecl> function_tdecl_sptr;
+
+class global_scope;
+
+/// Convenience typedef for shared pointer on @ref global_scope.
+typedef shared_ptr<global_scope> global_scope_sptr;
+
+class node_visitor;
+
 class template_decl;
+
+/// Convenience typedef for a shared pointer to @ref template_decl
+typedef shared_ptr<template_decl> template_decl_sptr;
+
+/// Convenience typedef for a weak pointer to template_decl
+typedef weak_ptr<template_decl> template_decl_wptr;
+
 class template_parameter;
+
+/// Convenience typedef for shared pointer to template parameter
+typedef shared_ptr<template_parameter> template_parameter_sptr;
+
 class non_type_tparameter;
+
+/// Convenience typedef for shared pointer to @ref
+/// non_type_template_parameter
+typedef shared_ptr<non_type_tparameter> non_type_tparameter_sptr;
+
 class type_tparameter;
+
 class template_tparameter;
 
+/// Convenience typedef for a shared_ptr to @ref template_tparameter.
+typedef shared_ptr<template_tparameter> template_tparameter_sptr;
+
+/// Convenience typedef for a shared pointer to @ref type_tparameter.
+typedef shared_ptr<type_tparameter> type_tparameter_sptr;
+
 class type_composition;
-class type_base;
-class type_decl;
-class typedef_decl;
-class var_decl;
-class array_type_def;
-class subrange_type;
 
-struct type_shared_ptr_equal;
-struct traversable_base;
+class member_function_template;
+typedef shared_ptr<member_function_template> member_function_template_sptr;
+typedef vector<member_function_template_sptr> member_function_templates;
+
+class member_class_template;
+typedef shared_ptr<member_class_template> member_class_template_sptr;
+typedef vector<member_class_template_sptr> member_class_templates;
 
-shared_ptr<decl_base>
-add_decl_to_scope(shared_ptr<decl_base>, scope_decl*);
+/// Convenience typedef for shared pointer to type_composition
+typedef shared_ptr<type_composition> type_composition_sptr;
 
-shared_ptr<decl_base>
-add_decl_to_scope(shared_ptr<decl_base>, const shared_ptr<scope_decl>&);
+decl_base_sptr
+add_decl_to_scope(decl_base_sptr, scope_decl*);
+
+decl_base_sptr
+add_decl_to_scope(decl_base_sptr, const scope_decl_sptr&);
 
 const global_scope*
 get_global_scope(const decl_base&);
@@ -134,7 +308,7 @@ const global_scope*
 get_global_scope(const decl_base*);
 
 const global_scope*
-get_global_scope(const shared_ptr<decl_base>);
+get_global_scope(const decl_base_sptr);
 
 translation_unit*
 get_translation_unit(const decl_base&);
@@ -143,7 +317,7 @@ translation_unit*
 get_translation_unit(const decl_base*);
 
 translation_unit*
-get_translation_unit(const shared_ptr<decl_base>);
+get_translation_unit(const decl_base_sptr);
 
 bool
 is_global_scope(const scope_decl&);
@@ -152,16 +326,16 @@ const global_scope*
 is_global_scope(const scope_decl*);
 
 bool
-is_global_scope(const shared_ptr<scope_decl>);
+is_global_scope(const scope_decl_sptr);
 
 bool
 is_at_global_scope(const decl_base&);
 
 bool
-is_at_global_scope(const shared_ptr<decl_base>);
+is_at_global_scope(const decl_base_sptr);
 
 bool
-is_at_class_scope(const shared_ptr<decl_base>);
+is_at_class_scope(const decl_base_sptr);
 
 bool
 is_at_class_scope(const decl_base*);
@@ -170,16 +344,16 @@ bool
 is_at_class_scope(const decl_base&);
 
 bool
-is_at_template_scope(const shared_ptr<decl_base>);
+is_at_template_scope(const decl_base_sptr);
 
 bool
-is_template_parameter(const shared_ptr<decl_base>);
+is_template_parameter(const decl_base_sptr);
 
 function_decl*
 is_function_decl(const type_or_decl_base*);
 
-shared_ptr<function_decl>
-is_function_decl(const shared_ptr<type_or_decl_base>&);
+function_decl_sptr
+is_function_decl(const type_or_decl_base_sptr&);
 
 bool
 is_function_decl(const type_or_decl_base&);
@@ -187,8 +361,8 @@ is_function_decl(const type_or_decl_base&);
 decl_base*
 is_decl(const type_or_decl_base*);
 
-shared_ptr<decl_base>
-is_decl(const shared_ptr<type_or_decl_base>&);
+decl_base_sptr
+is_decl(const type_or_decl_base_sptr&);
 
 bool
 is_type(const type_or_decl_base&);
@@ -196,14 +370,14 @@ is_type(const type_or_decl_base&);
 type_base*
 is_type(const type_or_decl_base*);
 
-shared_ptr<type_base>
-is_type(const shared_ptr<type_or_decl_base>& tod);
+type_base_sptr
+is_type(const type_or_decl_base_sptr& tod);
 
 bool
 is_type(const decl_base&);
 
-shared_ptr<type_base>
-is_type(const shared_ptr<decl_base>);
+type_base_sptr
+is_type(const decl_base_sptr);
 
 type_base*
 is_type(decl_base*);
@@ -212,19 +386,19 @@ bool
 is_anonymous_type(type_base*);
 
 bool
-is_anonymous_type(const shared_ptr<type_base>&);
+is_anonymous_type(const type_base_sptr&);
 
-shared_ptr<type_decl>
-is_type_decl(const shared_ptr<type_base>&);
+type_decl_sptr
+is_type_decl(const type_base_sptr&);
 
-shared_ptr<type_decl>
-is_type_decl(const shared_ptr<decl_base>&);
+type_decl_sptr
+is_type_decl(const decl_base_sptr&);
 
-shared_ptr<typedef_decl>
-is_typedef(const shared_ptr<type_base>);
+typedef_decl_sptr
+is_typedef(const type_base_sptr);
 
-shared_ptr<typedef_decl>
-is_typedef(const shared_ptr<decl_base>);
+typedef_decl_sptr
+is_typedef(const decl_base_sptr);
 
 const typedef_decl*
 is_typedef(const type_base*);
@@ -232,35 +406,32 @@ is_typedef(const type_base*);
 typedef_decl*
 is_typedef(type_base*);
 
-shared_ptr<enum_type_decl>
-is_enum_type(const shared_ptr<type_base>&);
-
-shared_ptr<enum_type_decl>
-is_enum_type(const shared_ptr<decl_base>&);
+enum_type_decl_sptr
+is_enum_type(const type_or_decl_base_sptr&);
 
 class_decl*
 is_class_type(const type_or_decl_base*);
 
-shared_ptr<class_decl>
-is_class_type(const shared_ptr<type_or_decl_base>&);
+class_decl_sptr
+is_class_type(const type_or_decl_base_sptr&);
 
 class_or_union*
 is_class_or_union_type(const type_or_decl_base*);
 
-shared_ptr<class_or_union>
-is_class_or_union_type(const shared_ptr<type_or_decl_base>&);
+class_or_union_sptr
+is_class_or_union_type(const type_or_decl_base_sptr&);
 
 union_decl*
 is_union_type(const type_or_decl_base*);
 
-shared_ptr<union_decl>
-is_union_type(const shared_ptr<type_or_decl_base>&);
+union_decl_sptr
+is_union_type(const type_or_decl_base_sptr&);
 
-shared_ptr<class_decl>
-is_compatible_with_class_type(const shared_ptr<type_base>&);
+class_decl_sptr
+is_compatible_with_class_type(const type_base_sptr&);
 
-shared_ptr<class_decl>
-is_compatible_with_class_type(const shared_ptr<decl_base>&);
+class_decl_sptr
+is_compatible_with_class_type(const decl_base_sptr&);
 
 pointer_type_def*
 is_pointer_type(type_or_decl_base*);
@@ -268,8 +439,8 @@ is_pointer_type(type_or_decl_base*);
 const pointer_type_def*
 is_pointer_type(const type_or_decl_base*);
 
-shared_ptr<pointer_type_def>
-is_pointer_type(const shared_ptr<type_or_decl_base>&);
+pointer_type_def_sptr
+is_pointer_type(const type_or_decl_base_sptr&);
 
 reference_type_def*
 is_reference_type(type_or_decl_base*);
@@ -277,17 +448,17 @@ is_reference_type(type_or_decl_base*);
 const reference_type_def*
 is_reference_type(const type_or_decl_base*);
 
-shared_ptr<reference_type_def>
-is_reference_type(const shared_ptr<type_or_decl_base>&);
+reference_type_def_sptr
+is_reference_type(const type_or_decl_base_sptr&);
 
 qualified_type_def*
 is_qualified_type(const type_or_decl_base*);
 
-shared_ptr<qualified_type_def>
-is_qualified_type(const shared_ptr<type_or_decl_base>&);
+qualified_type_def_sptr
+is_qualified_type(const type_or_decl_base_sptr&);
 
-shared_ptr<function_type>
-is_function_type(const shared_ptr<type_or_decl_base>&);
+function_type_sptr
+is_function_type(const type_or_decl_base_sptr&);
 
 function_type*
 is_function_type(type_or_decl_base*);
@@ -295,8 +466,8 @@ is_function_type(type_or_decl_base*);
 const function_type*
 is_function_type(const type_or_decl_base*);
 
-shared_ptr<method_type>
-is_method_type(const shared_ptr<type_or_decl_base>&);
+method_type_sptr
+is_method_type(const type_or_decl_base_sptr&);
 
 const method_type*
 is_method_type(const type_or_decl_base*);
@@ -304,49 +475,49 @@ is_method_type(const type_or_decl_base*);
 method_type*
 is_method_type(type_or_decl_base*);
 
-shared_ptr<class_decl>
-look_through_decl_only_class(shared_ptr<class_decl>);
+class_decl_sptr
+look_through_decl_only_class(class_decl_sptr);
 
 var_decl*
 is_var_decl(const type_or_decl_base*);
 
-shared_ptr<var_decl>
-is_var_decl(const shared_ptr<decl_base>);
+var_decl_sptr
+is_var_decl(const type_or_decl_base_sptr&);
 
-shared_ptr<namespace_decl>
-is_namespace(const shared_ptr<decl_base>&);
+namespace_decl_sptr
+is_namespace(const decl_base_sptr&);
 
 namespace_decl*
 is_namespace(const decl_base*);
 
 bool
-is_template_parm_composition_type(const shared_ptr<decl_base>);
+is_template_parm_composition_type(const decl_base_sptr);
 
 bool
-is_template_decl(const shared_ptr<decl_base>);
+is_template_decl(const decl_base_sptr);
 
 bool
-is_function_template_pattern(const shared_ptr<decl_base>);
+is_function_template_pattern(const decl_base_sptr);
 
 
-shared_ptr<decl_base>
-insert_decl_into_scope(shared_ptr<decl_base>,
-                      vector<shared_ptr<decl_base> >::iterator,
+decl_base_sptr
+insert_decl_into_scope(decl_base_sptr,
+                      vector<decl_base_sptr >::iterator,
                       scope_decl*);
 
-shared_ptr<decl_base>
-insert_decl_into_scope(shared_ptr<decl_base>,
-                      vector<shared_ptr<decl_base> >::iterator,
-                      shared_ptr<scope_decl>);
+decl_base_sptr
+insert_decl_into_scope(decl_base_sptr,
+                      vector<decl_base_sptr >::iterator,
+                      scope_decl_sptr);
 
 bool
 has_scope(const decl_base&);
 
 bool
-has_scope(const shared_ptr<decl_base>);
+has_scope(const decl_base_sptr);
 
 bool
-is_member_decl(const shared_ptr<decl_base>);
+is_member_decl(const decl_base_sptr);
 
 bool
 is_member_decl(const decl_base*);
@@ -357,14 +528,14 @@ is_member_decl(const decl_base&);
 scope_decl*
 is_scope_decl(decl_base*);
 
-shared_ptr<scope_decl>
-is_scope_decl(const shared_ptr<decl_base>&);
+scope_decl_sptr
+is_scope_decl(const decl_base_sptr&);
 
 bool
-is_member_type(const shared_ptr<type_base>&);
+is_member_type(const type_base_sptr&);
 
 void
-remove_decl_from_scope(shared_ptr<decl_base>);
+remove_decl_from_scope(decl_base_sptr);
 
 bool
 get_member_is_static(const decl_base&);
@@ -373,13 +544,13 @@ bool
 get_member_is_static(const decl_base*);
 
 bool
-get_member_is_static(const shared_ptr<decl_base>&);
+get_member_is_static(const decl_base_sptr&);
 
 void
 set_member_is_static(decl_base&, bool);
 
 void
-set_member_is_static(const shared_ptr<decl_base>&, bool);
+set_member_is_static(const decl_base_sptr&, bool);
 
 bool
 is_data_member(const var_decl&);
@@ -388,37 +559,37 @@ bool
 is_data_member(const var_decl*);
 
 bool
-is_data_member(const shared_ptr<var_decl>);
+is_data_member(const var_decl_sptr);
 
-shared_ptr<var_decl>
-is_data_member(const shared_ptr<decl_base>&);
+var_decl_sptr
+is_data_member(const decl_base_sptr&);
 
 array_type_def*
 is_array_type(const type_or_decl_base* decl);
 
-shared_ptr<array_type_def>
-is_array_type(const shared_ptr<type_or_decl_base>& decl);
+array_type_def_sptr
+is_array_type(const type_or_decl_base_sptr& decl);
 
 void
-set_data_member_offset(shared_ptr<var_decl>, size_t);
+set_data_member_offset(var_decl_sptr, size_t);
 
 size_t
 get_data_member_offset(const var_decl&);
 
 size_t
-get_data_member_offset(const shared_ptr<var_decl>);
+get_data_member_offset(const var_decl_sptr);
 
 size_t
-get_data_member_offset(const shared_ptr<decl_base>);
+get_data_member_offset(const decl_base_sptr);
 
 void
-set_data_member_is_laid_out(shared_ptr<var_decl>, bool);
+set_data_member_is_laid_out(var_decl_sptr, bool);
 
 bool
 get_data_member_is_laid_out(const var_decl&);
 
 bool
-get_data_member_is_laid_out(const shared_ptr<var_decl>);
+get_data_member_is_laid_out(const var_decl_sptr);
 
 bool
 is_member_function(const function_decl&);
@@ -427,63 +598,63 @@ bool
 is_member_function(const function_decl*);
 
 bool
-is_member_function(const shared_ptr<function_decl>&);
+is_member_function(const function_decl_sptr&);
 
 bool
 get_member_function_is_ctor(const function_decl&);
 
 bool
-get_member_function_is_ctor(const shared_ptr<function_decl>&);
+get_member_function_is_ctor(const function_decl_sptr&);
 
 void
 set_member_function_is_ctor(const function_decl&, bool);
 
 void
-set_member_function_is_ctor(const shared_ptr<function_decl>&, bool);
+set_member_function_is_ctor(const function_decl_sptr&, bool);
 
 bool
 get_member_function_is_dtor(const function_decl&);
 
 bool
-get_member_function_is_dtor(const shared_ptr<function_decl>&);
+get_member_function_is_dtor(const function_decl_sptr&);
 
 void
 set_member_function_is_dtor(function_decl&, bool);
 
 void
-set_member_function_is_dtor(const shared_ptr<function_decl>&, bool);
+set_member_function_is_dtor(const function_decl_sptr&, bool);
 
 bool
 get_member_function_is_const(const function_decl&);
 
 bool
-get_member_function_is_const(const shared_ptr<function_decl>&);
+get_member_function_is_const(const function_decl_sptr&);
 
 void
 set_member_function_is_const(function_decl&, bool);
 
 void
-set_member_function_is_const(const shared_ptr<function_decl>&, bool);
+set_member_function_is_const(const function_decl_sptr&, bool);
 
 size_t
 get_member_function_vtable_offset(const function_decl&);
 
 size_t
-get_member_function_vtable_offset(const shared_ptr<function_decl>&);
+get_member_function_vtable_offset(const function_decl_sptr&);
 
 void
 set_member_function_vtable_offset(const function_decl& f,
                                  size_t s);
 
 void
-set_member_function_vtable_offset(const shared_ptr<function_decl> &f,
+set_member_function_vtable_offset(const function_decl_sptr &f,
                                  size_t s);
 
 bool
 get_member_function_is_virtual(const function_decl&);
 
 bool
-get_member_function_is_virtual(const shared_ptr<function_decl>&);
+get_member_function_is_virtual(const function_decl_sptr&);
 
 bool
 get_member_function_is_virtual(const function_decl*);
@@ -492,31 +663,31 @@ void
 set_member_function_is_virtual(function_decl&, bool);
 
 void
-set_member_function_is_virtual(const shared_ptr<function_decl>&, bool);
+set_member_function_is_virtual(const function_decl_sptr&, bool);
 
-shared_ptr<type_base>
-strip_typedef(const shared_ptr<type_base>);
+type_base_sptr
+strip_typedef(const type_base_sptr);
 
-shared_ptr<type_base>
-peel_typedef_type(const shared_ptr<type_base>&);
+type_base_sptr
+peel_typedef_type(const type_base_sptr&);
 
 const type_base*
 peel_typedef_type(const type_base*);
 
-shared_ptr<type_base>
-peel_pointer_type(const shared_ptr<type_base>&);
+type_base_sptr
+peel_pointer_type(const type_base_sptr&);
 
 const type_base*
 peel_pointer_type(const type_base*);
 
-shared_ptr<type_base>
-peel_reference_type(const shared_ptr<type_base>&);
+type_base_sptr
+peel_reference_type(const type_base_sptr&);
 
 const type_base*
 peel_reference_type(const type_base*);
 
-const shared_ptr<type_base>
-peel_array_type(const shared_ptr<type_base>&);
+const type_base_sptr
+peel_array_type(const type_base_sptr&);
 
 const type_base*
 peel_array_type(const type_base*);
@@ -524,40 +695,40 @@ peel_array_type(const type_base*);
 const type_base*
 peel_qualified_type(const type_base*);
 
-const shared_ptr<type_base>
-peel_qualified_type(const shared_ptr<type_base>&);
+const type_base_sptr
+peel_qualified_type(const type_base_sptr&);
 
-shared_ptr<type_base>
-peel_typedef_pointer_or_reference_type(const shared_ptr<type_base>);
+type_base_sptr
+peel_typedef_pointer_or_reference_type(const type_base_sptr);
 
 type_base*
 peel_typedef_pointer_or_reference_type(const type_base*);
 
 string
-get_name(const shared_ptr<type_or_decl_base>&,
+get_name(const type_or_decl_base_sptr&,
         bool qualified = true);
 
 location
-get_location(const shared_ptr<type_base>& type);
+get_location(const type_base_sptr& type);
 
 location
-get_location(const shared_ptr<decl_base>& decl);
+get_location(const decl_base_sptr& decl);
 
 string
 build_qualified_name(const scope_decl* scope, const string& name);
 
 string
 build_qualified_name(const scope_decl* scope,
-                    const shared_ptr<type_base>& type);
+                    const type_base_sptr& type);
 
 scope_decl*
 get_type_scope(type_base*);
 
 scope_decl*
-get_type_scope(const shared_ptr<type_base>&);
+get_type_scope(const type_base_sptr&);
 
 interned_string
-get_type_name(const shared_ptr<type_base>&,
+get_type_name(const type_base_sptr&,
              bool qualified = true,
              bool internal = false);
 
@@ -572,7 +743,7 @@ get_type_name(const type_base&,
              bool internal = false);
 
 interned_string
-get_function_type_name(const shared_ptr<function_type>&,
+get_function_type_name(const function_type_sptr&,
                       bool internal = false);
 
 interned_string
@@ -582,7 +753,7 @@ interned_string
 get_function_type_name(const function_type&, bool internal = false);
 
 interned_string
-get_method_type_name(const shared_ptr<method_type>&, bool internal = false);
+get_method_type_name(const method_type_sptr&, bool internal = false);
 
 interned_string
 get_method_type_name(const method_type*, bool internal = false);
@@ -600,14 +771,14 @@ string
 get_pretty_representation(const type_or_decl_base*,bool internal = false);
 
 string
-get_pretty_representation(const shared_ptr<type_or_decl_base>&,
+get_pretty_representation(const type_or_decl_base_sptr&,
                          bool internal = false);
 
 string
-get_pretty_representation(const shared_ptr<decl_base>&, bool internal = false);
+get_pretty_representation(const decl_base_sptr&, bool internal = false);
 
 string
-get_pretty_representation(const shared_ptr<type_base>&, bool internal = false);
+get_pretty_representation(const type_base_sptr&, bool internal = false);
 
 string
 get_pretty_representation(const function_type&, bool internal = false);
@@ -616,7 +787,7 @@ string
 get_pretty_representation(const function_type*, bool internal = false);
 
 string
-get_pretty_representation(const shared_ptr<function_type>&,
+get_pretty_representation(const function_type_sptr&,
                          bool internal = false);
 
 string
@@ -626,7 +797,7 @@ string
 get_pretty_representation(const method_type*, bool internal = false);
 
 string
-get_pretty_representation(const shared_ptr<method_type>&,
+get_pretty_representation(const method_type_sptr&,
                          bool internal = false);
 
 const decl_base*
@@ -635,28 +806,28 @@ get_type_declaration(const type_base*);
 decl_base*
 get_type_declaration(type_base*);
 
-shared_ptr<decl_base>
-get_type_declaration(const shared_ptr<type_base>);
+decl_base_sptr
+get_type_declaration(const type_base_sptr);
 
 bool
-types_are_compatible(const shared_ptr<type_base>,
-                    const shared_ptr<type_base>);
+types_are_compatible(const type_base_sptr,
+                    const type_base_sptr);
 
 bool
-types_are_compatible(const shared_ptr<decl_base>,
-                    const shared_ptr<decl_base>);
+types_are_compatible(const decl_base_sptr,
+                    const decl_base_sptr);
 
 const scope_decl*
 get_top_most_scope_under(const decl_base*,
                         const scope_decl*);
 
 const scope_decl*
-get_top_most_scope_under(const shared_ptr<decl_base>,
+get_top_most_scope_under(const decl_base_sptr,
                         const scope_decl*);
 
 const scope_decl*
-get_top_most_scope_under(const shared_ptr<decl_base>,
-                        const shared_ptr<scope_decl>);
+get_top_most_scope_under(const decl_base_sptr,
+                        const scope_decl_sptr);
 
 void
 fqn_to_components(const std::string&,
@@ -674,13 +845,16 @@ lookup_class_type_in_corpus(const string&, const corpus&);
 const shared_ptr<function_type>
 lookup_function_type_in_corpus(const function_type&, const corpus&);
 
-const shared_ptr<decl_base>
-lookup_type_in_translation_unit(const string&,
-                               const translation_unit&);
+type_base_sptr
+lookup_type_through_scopes(const std::list<string>&,
+                          const translation_unit&);
 
 const shared_ptr<decl_base>
 lookup_type_in_translation_unit(const std::list<string>&,
                                const translation_unit&);
+const shared_ptr<decl_base>
+lookup_type_in_translation_unit(const string&,
+                               const translation_unit&);
 
 const shared_ptr<class_decl>
 lookup_class_type_in_translation_unit(const std::list<string>& fqn,
@@ -698,13 +872,7 @@ shared_ptr<function_type>
 lookup_function_type_in_translation_unit(const function_type&,
                                         const translation_unit&);
 
-shared_ptr<type_base>
-synthesize_type_from_translation_unit(const shared_ptr<type_base>& type,
-                                     translation_unit& tu);
 
-shared_ptr<function_type>
-synthesize_function_type_from_translation_unit(const function_type&,
-                                              translation_unit&);
 
 shared_ptr<function_type>
 lookup_function_type_in_translation_unit(const shared_ptr<function_type>&,
@@ -713,50 +881,56 @@ lookup_function_type_in_translation_unit(const shared_ptr<function_type>&,
 shared_ptr<function_type>
 lookup_function_type_in_corpus(const shared_ptr<function_type>&,
                               corpus&);
+type_base_sptr
+synthesize_type_from_translation_unit(const type_base_sptr& type,
+                                     translation_unit& tu);
 
 shared_ptr<type_base>
 lookup_type_in_corpus(const shared_ptr<type_base>&, corpus&);
+function_type_sptr
+synthesize_function_type_from_translation_unit(const function_type&,
+                                              translation_unit&);
 
-const shared_ptr<decl_base>
+const type_base_sptr
 lookup_type_in_scope(const string&,
-                    const shared_ptr<scope_decl>&);
+                    const scope_decl_sptr&);
 
-const shared_ptr<decl_base>
+const type_base_sptr
 lookup_type_in_scope(const std::list<string>&,
-                    const shared_ptr<scope_decl>&);
+                    const scope_decl_sptr&);
 
-const shared_ptr<decl_base>
+const decl_base_sptr
 lookup_var_decl_in_scope(const string&,
-                        const shared_ptr<scope_decl>&);
+                        const scope_decl_sptr&);
 
-const shared_ptr<decl_base>
+const decl_base_sptr
 lookup_var_decl_in_scope(const std::list<string>&,
-                        const shared_ptr<scope_decl>&);
+                        const scope_decl_sptr&);
 
 string
 demangle_cplus_mangled_name(const string&);
 
-shared_ptr<type_base>
-type_or_void(const shared_ptr<type_base>, const environment*);
+type_base_sptr
+type_or_void(const type_base_sptr, const environment*);
 
-shared_ptr<type_base>
-canonicalize(shared_ptr<type_base>);
+type_base_sptr
+canonicalize(type_base_sptr);
 
 type_base*
-type_has_non_canonicalized_subtype(shared_ptr<type_base> t);
+type_has_non_canonicalized_subtype(type_base_sptr t);
 
 bool
-type_has_sub_type_changes(shared_ptr<type_base> t_v1,
-                         shared_ptr<type_base> t_v2);
+type_has_sub_type_changes(type_base_sptr t_v1,
+                         type_base_sptr t_v2);
 
 void
-keep_type_alive(shared_ptr<type_base> t);
+keep_type_alive(type_base_sptr t);
 
 size_t
 hash_type_or_decl(const type_or_decl_base *);
 
 size_t
-hash_type_or_decl(const shared_ptr<type_or_decl_base>&);
+hash_type_or_decl(const type_or_decl_base_sptr &);
 } // end namespace ir
 
 using namespace abigail::ir;
@@ -774,22 +948,22 @@ typedef vector<suppression_sptr> suppressions_type;
 } // end namespace comparison
 
 void
-dump(const shared_ptr<decl_base>, std::ostream&);
+dump(const decl_base_sptr, std::ostream&);
 
 void
-dump(const shared_ptr<decl_base>);
+dump(const decl_base_sptr);
 
 void
-dump(const shared_ptr<type_base>, std::ostream&);
+dump(const type_base_sptr, std::ostream&);
 
 void
-dump(const shared_ptr<type_base>);
+dump(const type_base_sptr);
 
 void
-dump(const shared_ptr<var_decl>, std::ostream&);
+dump(const var_decl_sptr, std::ostream&);
 
 void
-dump(const shared_ptr<var_decl>);
+dump(const var_decl_sptr);
 
 void
 dump(const translation_unit&, std::ostream&);
@@ -798,10 +972,10 @@ void
 dump(const translation_unit&);
 
 void
-dump(const shared_ptr<translation_unit>, std::ostream&);
+dump(const translation_unit_sptr, std::ostream&);
 
 void
-dump(const shared_ptr<translation_unit>);
+dump(const translation_unit_sptr);
 
 void
 dump_decl_location(const decl_base&);
@@ -810,7 +984,7 @@ void
 dump_decl_location(const decl_base*);
 
 void
-dump_decl_location(const shared_ptr<decl_base>&);
+dump_decl_location(const decl_base_sptr&);
 
 } // end namespace abigail
 #endif // __ABG_IRFWD_H__
index ab6fc59a80d99bd276c9dc132c610706be96cd3a..d3cd997cefe5a24e15c240035cf0d2ef2ff74d9f 100644 (file)
@@ -107,29 +107,6 @@ namespace ir
 // Inject some std::tr1 types in here.
 using std::tr1::unordered_map;
 
-/// Convenience typedef for a shared pointer to a @ref corpus.
-typedef shared_ptr<corpus> corpus_sptr;
-
-/// Convenience typedef for a weak pointer to a @ref corpus.
-typedef weak_ptr<corpus> corpus_wptr;
-
-/// A convenience typedef for a shared_ptr to @ref type_or_decl_base.
-typedef shared_ptr<type_or_decl_base> type_or_decl_base_sptr;
-
-/// Convenience typedef for a shared pointer on a @ref type_base
-typedef shared_ptr<type_base> type_base_sptr;
-
-/// Convenience typedef for a shared pointer on a @ref type_decl.
-typedef shared_ptr<type_decl> type_decl_sptr;
-
-class class_or_union;
-
-typedef shared_ptr<class_or_union> class_or_union_sptr;
-typedef weak_ptr<class_or_union> class_or_union_wptr;
-
-/// Convenience typedef for a shared pointer to an @ref environment
-typedef shared_ptr<environment> environment_sptr;
-
 /// This is an abstraction of the set of resources necessary to manage
 /// several aspects of the internal representations of the Abigail
 /// library.
@@ -321,40 +298,6 @@ public:
                  unsigned& line, unsigned& column) const;
 };
 
-struct ir_node_visitor;
-
-/// Convenience typedef for a shared pointer on a @ref
-/// translation_unit type.
-typedef shared_ptr<translation_unit> translation_unit_sptr;
-
-/// Convenience typedef for a vector of @ref translation_unit_sptr.
-typedef std::vector<translation_unit_sptr> translation_units;
-
-/// Convenience typedef for a weak pointer on a @ref type_base
-typedef weak_ptr<type_base> type_base_wptr;
-
-/// Convenience typedef for a smart pointer on @ref decl_base.
-typedef shared_ptr<decl_base> decl_base_sptr;
-
-class function_type;
-
-class function_decl;
-
-/// Convenience typedef for a shared pointer on a @ref function_type
-typedef shared_ptr<function_type> function_type_sptr;
-
-/// Convenience typedef fo a vector of @ref function_type_sptr
-typedef vector<function_type_sptr> function_types_type;
-
-/// Convenience typedef for a weak pointer on a @ref function_type
-typedef weak_ptr<function_type> function_type_wptr;
-
-struct ir_traversable_base;
-
-/// Convenience typedef for a shared pointer to @ref
-/// ir_traversable_base.
-typedef shared_ptr<ir_traversable_base> ir_traversable_base_sptr;
-
 /// The base of an entity of the intermediate representation that is
 /// to be traversed.
 struct ir_traversable_base : public traversable_base
@@ -925,17 +868,6 @@ public:
   virtual ~context_rel();
 };// end class context_rel
 
-class class_decl;
-
-/// Convenience typedef for a shared pointer on a @ref class_decl
-typedef shared_ptr<class_decl> class_decl_sptr;
-
-/// Convenience typedef for a vector of @ref class_decl_sptr
-typedef vector<class_decl_sptr> classes_type;
-
-/// Convenience typedef for a weak pointer on a @ref class_decl.
-typedef weak_ptr<class_decl> class_decl_wptr;
-
 /// A bitfield that gives callers of abigail::ir::equals() some
 /// insight about how different two internal representation artifacts
 /// are.
@@ -1265,9 +1197,6 @@ operator<<(std::ostream&, decl_base::binding);
 bool
 equals(const scope_decl&, const scope_decl&, change_kind*);
 
-/// Convenience typedef for a shared pointer on a @ref scope_decl.
-typedef shared_ptr<scope_decl> scope_decl_sptr;
-
 /// A declaration that introduces a scope.
 class scope_decl : public virtual decl_base
 {
@@ -1369,9 +1298,6 @@ struct scope_decl::hash
   operator()(const scope_decl* d) const;
 };
 
-/// Convenience typedef for shared pointer on @ref global_scope.
-typedef shared_ptr<global_scope> global_scope_sptr;
-
 /// This abstracts the global scope of a given translation unit.
 ///
 /// Only one instance of this class must be present in a given
@@ -1604,9 +1530,6 @@ public:
   virtual ~scope_type_decl();
 };
 
-/// Convenience typedef for a shared pointer on namespace_decl.
-typedef shared_ptr<namespace_decl> namespace_decl_sptr;
-
 /// The abstraction of a namespace declaration
 class namespace_decl : public scope_decl
 {
@@ -1632,8 +1555,6 @@ public:
 bool
 equals(const qualified_type_def&, const qualified_type_def&, change_kind*);
 
-typedef shared_ptr<qualified_type_def> qualified_type_def_sptr;
-
 /// The abstraction of a qualified type.
 class qualified_type_def : public virtual type_base, public virtual decl_base
 {
@@ -1722,9 +1643,6 @@ operator<<(std::ostream&, qualified_type_def::CV);
 bool
 equals(const pointer_type_def&, const pointer_type_def&, change_kind*);
 
-/// Convenience typedef for a shared pointer on a @ref pointer_type_def
-typedef shared_ptr<pointer_type_def> pointer_type_def_sptr;
-
 /// The abstraction of a pointer type.
 class pointer_type_def : public virtual type_base, public virtual decl_base
 {
@@ -1780,8 +1698,6 @@ operator!=(const pointer_type_def_sptr&, const pointer_type_def_sptr&);
 bool
 equals(const reference_type_def&, const reference_type_def&, change_kind*);
 
-/// Convenience typedef for a shared pointer on a @ref reference_type_def
-typedef shared_ptr<reference_type_def> reference_type_def_sptr;
 
 /// Abstracts a reference type.
 class reference_type_def : public virtual type_base, public virtual decl_base
@@ -1838,9 +1754,6 @@ operator!=(const reference_type_def_sptr&, const reference_type_def_sptr&);
 bool
 equals(const array_type_def&, const array_type_def&, change_kind*);
 
-/// Convenience typedef for a shared pointer on a @ref array_type_def
-typedef shared_ptr<array_type_def> array_type_def_sptr;
-
 /// The abstraction of an array type.
 class array_type_def : public virtual type_base, public virtual decl_base
 {
@@ -1974,9 +1887,6 @@ public:
 bool
 equals(const enum_type_decl&, const enum_type_decl&, change_kind*);
 
-/// Convenience typedef for shared pointer on enum_type_decl.
-typedef shared_ptr<enum_type_decl> enum_type_decl_sptr;
-
 /// Abstracts a declaration for an enum type.
 class enum_type_decl : public virtual type_base, public virtual decl_base
 {
@@ -2104,12 +2014,6 @@ public:
 bool
 equals(const typedef_decl&, const typedef_decl&, change_kind*);
 
-/// Convenience typedef for a shared pointer on a @ref typedef_decl.
-typedef shared_ptr<typedef_decl> typedef_decl_sptr;
-
-/// Convenience typedef for a weak pointer on a @ref typedef_decl.
-typedef weak_ptr<typedef_decl> typedef_decl_wptr;
-
 /// The abstraction of a typedef declaration.
 class typedef_decl : public virtual type_base, public virtual decl_base
 {
@@ -2156,11 +2060,6 @@ public:
   virtual ~typedef_decl();
 };// end class typedef_decl
 
-class dm_context_rel;
-
-/// A convenience typedef for a shared pointer to dm_context_rel.
-typedef shared_ptr<dm_context_rel> dm_context_rel_sptr;
-
 /// The abstraction for a data member context relationship.  This
 /// relates a data member to its parent class.
 ///
@@ -2231,9 +2130,6 @@ public:
 bool
 equals(const var_decl&, const var_decl&, change_kind*);
 
-/// Convenience typedef for a shared pointer on a @ref var_decl
-typedef shared_ptr<var_decl> var_decl_sptr;
-
 /// Abstracts a variable declaration.
 class var_decl : public virtual decl_base
 {
@@ -2321,9 +2217,6 @@ public:
 bool
 equals(const function_decl&, const function_decl&, change_kind*);
 
-/// Convenience typedef for a shared pointer on a @ref function_decl
-typedef shared_ptr<function_decl> function_decl_sptr;
-
 /// Abstraction for a function declaration.
 class function_decl : public virtual decl_base
 {
@@ -2646,8 +2539,6 @@ struct function_type::hash
   operator()(const function_type_sptr t) const;
 };// end struct function_type::hash
 
-/// Convenience typedef for shared pointer to @ref method_type.
-typedef shared_ptr<method_type> method_type_sptr;
 /// Abstracts the type of a class member function.
 class method_type : public function_type
 {
@@ -2704,15 +2595,6 @@ public:
   get_method_type_name(const method_type& fn_type, bool internal);
 };// end class method_type.
 
-/// Convenience typedef for shared pointer to template parameter
-typedef shared_ptr<template_parameter> template_parameter_sptr;
-
-/// Convenience typedef for a shared pointer to @ref template_decl
-typedef shared_ptr<template_decl> template_decl_sptr;
-
-/// Convenience typedef for a weak pointer to template_decl
-typedef weak_ptr<template_decl> template_decl_wptr;
-
 /// The base class of templates.
 class template_decl : public virtual decl_base
 {
@@ -2744,9 +2626,6 @@ public:
   virtual ~template_decl();
 };//end class template_decl
 
-/// Convenience typedef for a shared_ptr to @ref template_parameter
-typedef shared_ptr<template_parameter> template_parameter_sptr;
-
 /// Base class for a template parameter.  Client code should use the
 /// more specialized type_template_parameter,
 /// non_type_template_parameter and template_template_parameter below.
@@ -2796,9 +2675,6 @@ struct template_decl::hash
     operator()(const template_decl& t) const;
 };// end struct template_decl::hash
 
-/// Convenience typedef for a shared pointer to @ref type_tparameter.
-typedef shared_ptr<type_tparameter> type_tparameter_sptr;
-
 /// Abstracts a type template parameter.
 class type_tparameter : public template_parameter, public virtual type_decl
 {
@@ -2832,10 +2708,6 @@ public:
   virtual ~type_tparameter();
 };// end class type_tparameter.
 
-/// Convenience typedef for shared pointer to @ref
-/// non_type_template_parameter
-typedef shared_ptr<non_type_tparameter> non_type_tparameter_sptr;
-
 /// Abstracts non type template parameters.
 class non_type_tparameter : public template_parameter, public virtual decl_base
 {
@@ -2885,9 +2757,6 @@ struct non_type_tparameter::hash
 
 class template_tparameter;
 
-/// Convenience typedef for a shared_ptr to @ref template_tparameter.
-typedef shared_ptr<template_tparameter> template_tparameter_sptr;
-
 /// Abstracts a template template parameter.
 class template_tparameter : public type_tparameter, public template_decl
 {
@@ -2920,9 +2789,6 @@ public:
   virtual ~template_tparameter();
 };
 
-/// Convenience typedef for shared pointer to type_composition
-typedef shared_ptr<type_composition> type_composition_sptr;
-
 /// This abstracts a composition of types based on template type
 /// parameters.  The result of the composition is a type that can be
 /// referred to by a template non-type parameter.  Instances of this
@@ -2967,9 +2833,6 @@ struct type_composition::hash
 
 }; //struct type_composition::hash
 
-/// Convenience typedef for a shared pointer on a @ref function_tdecl
-typedef shared_ptr<function_tdecl> function_tdecl_sptr;
-
 /// Abstract a function template declaration.
 class function_tdecl : public template_decl, public scope_decl
 {
@@ -3021,9 +2884,6 @@ public:
   virtual ~function_tdecl();
 }; // end class function_tdecl.
 
-/// Convenience typedef for a shared pointer on a @ref class_tdecl
-typedef shared_ptr<class_tdecl> class_tdecl_sptr;
-
 /// Abstract a class template.
 class class_tdecl : public template_decl, public scope_decl
 {
@@ -3121,9 +2981,6 @@ public:
   operator==(const member_base& o) const;
 };// end class member_base
 
-class method_decl;
-typedef shared_ptr<method_decl>                        method_decl_sptr;
-
 /// Abstraction of the declaration of a method.
 class method_decl : public function_decl
 {
@@ -3217,14 +3074,6 @@ public:
   virtual ~method_decl();
 };// end class method_decl
 
-class member_function_template;
-typedef shared_ptr<member_function_template> member_function_template_sptr;
-typedef vector<member_function_template_sptr> member_function_templates;
-
-class member_class_template;
-typedef shared_ptr<member_class_template> member_class_template_sptr;
-typedef vector<member_class_template_sptr> member_class_templates;
-
 /// The base type of @ref class_decl and @ref union_decl
 class class_or_union : public scope_type_decl
 {
@@ -3672,8 +3521,6 @@ is_class_base_spec(type_or_decl_base*);
 class_decl::base_spec_sptr
 is_class_base_spec(type_or_decl_base_sptr);
 
-typedef shared_ptr<union_decl> union_decl_sptr;
-
 /// Abstracts a union type declaration.
 class union_decl : public class_or_union
 {
@@ -3723,12 +3570,6 @@ method_decl_sptr
 copy_member_function(const union_decl_sptr& union_type,
                     const method_decl* f);
 
-class mem_fn_context_rel;
-
-/// A convenience typedef for a shared pointer to @ref
-/// mem_fn_context_rel.
-typedef shared_ptr<mem_fn_context_rel> mem_fn_context_rel_sptr;
-
 /// Abstraction of a member function context relationship.  This
 /// relates a member function to its parent class.
 class mem_fn_context_rel : public context_rel
index 5513847ad1bfffa108052c2798d17a388e5eee20..96882c88fa2264a9fd843e9c1354ff3b5ab17de8 100644 (file)
@@ -5858,18 +5858,9 @@ is_typedef(type_base* t)
 ///
 /// @return the enum_type_decl_sptr if @p d is an enum, nil otherwise.
 enum_type_decl_sptr
-is_enum_type(const decl_base_sptr& d)
+is_enum_type(const type_or_decl_base_sptr& d)
 {return dynamic_pointer_cast<enum_type_decl>(d);}
 
-/// Test if a type is an enum_type_decl
-///
-/// @param t the type to test for.
-///
-/// @return the enum_type_decl_sptr if @p t is an enum, nil otherwise.
-enum_type_decl_sptr
-is_enum_type(const type_base_sptr& t)
-{return dynamic_pointer_cast<enum_type_decl>(t);}
-
 /// Test if a type is a class. This function looks through typedefs.
 ///
 /// @parm t the type to consider.
@@ -6138,7 +6129,7 @@ is_var_decl(const type_or_decl_base* tod)
 /// @return the var_decl_sptr iff decl is a variable declaration; nil
 /// otherwise.
 var_decl_sptr
-is_var_decl(const shared_ptr<decl_base> decl)
+is_var_decl(const type_or_decl_base_sptr& decl)
 {return dynamic_pointer_cast<var_decl>(decl);}
 
 /// Tests if a declaration is a namespace declaration.
@@ -6588,7 +6579,7 @@ synthesize_function_type_from_translation_unit(const function_type& fn_type,
 /// @param skope the scope to look into.
 ///
 /// @return the declaration of the type if found, NULL otherwise.
-const decl_base_sptr
+const type_base_sptr
 lookup_type_in_scope(const string& fqn,
                     const scope_decl_sptr& skope)
 {
@@ -6710,11 +6701,11 @@ convert_node_to_decl(var_decl_sptr node)
 /// @return the declaration of the looked up node, or NULL if it
 /// wasn't found.
 template<typename NodeKind>
-static const decl_base_sptr
+static const type_or_decl_base_sptr
 lookup_node_in_scope(const list<string>& fqn,
                     const scope_decl_sptr& skope)
 {
-  decl_base_sptr resulting_decl;
+  type_or_decl_base_sptr resulting_decl;
   shared_ptr<NodeKind> node;
   bool it_is_last = false;
   scope_decl_sptr cur_scope = skope, new_scope, scope;
@@ -6749,7 +6740,7 @@ lookup_node_in_scope(const list<string>& fqn,
                    if (cl->get_is_declaration_only()
                        && !cl->get_definition_of_declaration())
                      continue;
-                 resulting_decl = convert_node_to_decl(node);
+                 resulting_decl = node;
                  break;
                }
            }
@@ -6770,10 +6761,10 @@ lookup_node_in_scope(const list<string>& fqn,
 /// @param skope the scope to look into.
 ///
 /// @return the declaration of the type found.
-const decl_base_sptr
+const type_base_sptr
 lookup_type_in_scope(const list<string>& comps,
                     const scope_decl_sptr& scope)
-{return lookup_node_in_scope<type_base>(comps, scope);}
+{return is_type(lookup_node_in_scope<type_base>(comps, scope));}
 
 /// lookup a type in a scope.
 ///
@@ -6872,7 +6863,7 @@ lookup_type_in_scope(const type_base_sptr type,
 const decl_base_sptr
 lookup_var_decl_in_scope(const std::list<string>& comps,
                         const scope_decl_sptr& skope)
-{return lookup_node_in_scope<var_decl>(comps, skope);}
+{return is_var_decl(lookup_node_in_scope<var_decl>(comps, skope));}
 
 /// Lookup an IR node from a translation unit.
 ///
@@ -6886,7 +6877,7 @@ lookup_var_decl_in_scope(const std::list<string>& comps,
 ///
 /// @return the declaration of the IR node found, NULL otherwise.
 template<typename NodeKind>
-static const decl_base_sptr
+static const type_or_decl_base_sptr
 lookup_node_in_translation_unit(const list<string>& fqn,
                                const translation_unit& tu)
 {return lookup_node_in_scope<NodeKind>(fqn, tu.get_global_scope());}
@@ -6899,10 +6890,10 @@ lookup_node_in_translation_unit(const list<string>& fqn,
 /// @param tu the translation unit to perform lookup from.
 ///
 /// @return the declaration of the IR node found, NULL otherwise.
-const decl_base_sptr
-lookup_type_in_translation_unit(const list<string>& fqn,
-                               const translation_unit& tu)
-{return lookup_node_in_translation_unit<type_base>(fqn, tu);}
+type_base_sptr
+lookup_type_through_scopes(const list<string>& fqn,
+                          const translation_unit& tu)
+{return is_type(lookup_node_in_translation_unit<type_base>(fqn,tu));}
 
 /// Lookup a class type from a translation unit.
 ///