mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-18 07:54:36 +00:00
Template naming compression.
* include/abg-ir.h: Template naming compressions. (class_template_decl): To class_tdecl. (function_template_decl): To function_tdecl. (template_type_parameter): To type_tparameter. (template_non_type_parameter): To non_type_tparameter. (template_template_parameter): To template_tparameter. (tmpl_parm_type_composition): To type_composition. * include/abg-irfwd.h: Same. * src/abg-hash.cc: Same. * src/abg-ir.cc: Same. * src/abg-reader.cc: Same.
This commit is contained in:
parent
9f7c830236
commit
9258b41534
@ -1735,7 +1735,7 @@ CLASS_GRAPH = YES
|
||||
# indirect implementation dependencies (inheritance, containment, and
|
||||
# class references variables) of the class with other documented classes.
|
||||
|
||||
COLLABORATION_GRAPH = YES
|
||||
COLLABORATION_GRAPH = NO
|
||||
|
||||
# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
|
||||
# will generate a graph for groups, showing the direct groups dependencies
|
||||
|
131
include/abg-ir.h
131
include/abg-ir.h
@ -1330,7 +1330,7 @@ public:
|
||||
|
||||
void
|
||||
add_template_parameter(shared_ptr<template_parameter> p)
|
||||
{m_parms.push_back(p); }
|
||||
{ m_parms.push_back(p); }
|
||||
|
||||
const std::list<shared_ptr<template_parameter> >&
|
||||
get_template_parameters() const
|
||||
@ -1374,18 +1374,18 @@ class template_parameter
|
||||
};
|
||||
|
||||
/// Abstracts a type template parameter.
|
||||
class template_type_parameter
|
||||
class type_tparameter
|
||||
: public template_parameter, public virtual type_decl
|
||||
{
|
||||
// Forbidden
|
||||
template_type_parameter();
|
||||
type_tparameter();
|
||||
|
||||
public:
|
||||
|
||||
/// Hasher.
|
||||
struct hash;
|
||||
|
||||
template_type_parameter(unsigned index, const std::string& name,
|
||||
type_tparameter(unsigned index, const std::string& name,
|
||||
location locus)
|
||||
: decl_base(name, locus),
|
||||
type_base(0, 0),
|
||||
@ -1394,25 +1394,25 @@ public:
|
||||
{ }
|
||||
|
||||
virtual bool
|
||||
operator==(const template_type_parameter&) const;
|
||||
operator==(const type_tparameter&) const;
|
||||
|
||||
virtual ~template_type_parameter();
|
||||
virtual ~type_tparameter();
|
||||
};
|
||||
|
||||
/// Abstracts non type template parameters.
|
||||
class template_non_type_parameter
|
||||
class non_type_tparameter
|
||||
: public template_parameter, public virtual decl_base
|
||||
{
|
||||
shared_ptr<type_base> m_type;
|
||||
|
||||
// Forbidden
|
||||
template_non_type_parameter();
|
||||
non_type_tparameter();
|
||||
|
||||
public:
|
||||
/// Hasher.
|
||||
struct hash;
|
||||
|
||||
template_non_type_parameter(unsigned index, const std::string& name,
|
||||
non_type_tparameter(unsigned index, const std::string& name,
|
||||
shared_ptr<type_base> type, location locus)
|
||||
: decl_base(name, locus, ""),
|
||||
template_parameter(index),
|
||||
@ -1420,41 +1420,41 @@ public:
|
||||
{ }
|
||||
|
||||
virtual bool
|
||||
operator==(const template_non_type_parameter&) const;
|
||||
operator==(const non_type_tparameter&) const;
|
||||
|
||||
|
||||
shared_ptr<type_base>
|
||||
get_type() const
|
||||
{ return m_type; }
|
||||
|
||||
virtual ~template_non_type_parameter();
|
||||
virtual ~non_type_tparameter();
|
||||
};
|
||||
|
||||
/// Abstracts a template template parameter.
|
||||
class template_template_parameter
|
||||
: public template_type_parameter, public template_decl
|
||||
class template_tparameter
|
||||
: public type_tparameter, public template_decl
|
||||
{
|
||||
// Forbidden
|
||||
template_template_parameter();
|
||||
template_tparameter();
|
||||
|
||||
public:
|
||||
|
||||
/// A hasher for instances of template_template_parameter
|
||||
/// A hasher for instances of template_tparameter
|
||||
struct hash;
|
||||
|
||||
template_template_parameter(unsigned index,
|
||||
template_tparameter(unsigned index,
|
||||
const std::string& name,
|
||||
location locus)
|
||||
: decl_base(name, locus),
|
||||
type_base(0, 0),
|
||||
type_decl(name, 0, 0, locus, name, VISIBILITY_DEFAULT),
|
||||
template_type_parameter(index, name, locus)
|
||||
type_tparameter(index, name, locus)
|
||||
{ }
|
||||
|
||||
virtual bool
|
||||
operator==(const template_template_parameter& o) const;
|
||||
operator==(const template_tparameter& o) const;
|
||||
|
||||
virtual ~template_template_parameter();
|
||||
virtual ~template_tparameter();
|
||||
};
|
||||
|
||||
/// This abstracts a composition of types based on template type
|
||||
@ -1462,15 +1462,15 @@ public:
|
||||
/// referred to by a template non-type parameter. Instances of this
|
||||
/// type can appear at the same level as template parameters, in the
|
||||
/// scope of a template_decl.
|
||||
class tmpl_parm_type_composition
|
||||
class type_composition
|
||||
: public template_parameter, public virtual decl_base
|
||||
{
|
||||
shared_ptr<type_base> m_type;
|
||||
|
||||
tmpl_parm_type_composition();
|
||||
type_composition();
|
||||
|
||||
public:
|
||||
tmpl_parm_type_composition(unsigned index,
|
||||
type_composition(unsigned index,
|
||||
shared_ptr<type_base> composed_type);
|
||||
|
||||
shared_ptr<type_base>
|
||||
@ -1482,18 +1482,18 @@ public:
|
||||
{m_type = t; }
|
||||
|
||||
|
||||
virtual ~tmpl_parm_type_composition();
|
||||
virtual ~type_composition();
|
||||
};
|
||||
|
||||
/// Abstract a function template declaration.
|
||||
class function_template_decl
|
||||
class function_tdecl
|
||||
: public template_decl, public scope_decl
|
||||
{
|
||||
shared_ptr<function_decl> m_pattern;
|
||||
binding m_binding;
|
||||
|
||||
// Forbidden
|
||||
function_template_decl();
|
||||
function_tdecl();
|
||||
|
||||
public:
|
||||
|
||||
@ -1501,14 +1501,14 @@ public:
|
||||
struct hash;
|
||||
struct shared_ptr_hash;
|
||||
|
||||
function_template_decl(location locus,
|
||||
function_tdecl(location locus,
|
||||
visibility vis = VISIBILITY_DEFAULT,
|
||||
binding bind = BINDING_NONE)
|
||||
: decl_base("", locus, "", vis), scope_decl("", locus),
|
||||
m_binding(bind)
|
||||
{ }
|
||||
|
||||
function_template_decl(shared_ptr<function_decl> pattern,
|
||||
function_tdecl(shared_ptr<function_decl> pattern,
|
||||
location locus,
|
||||
visibility vis = VISIBILITY_DEFAULT,
|
||||
binding bind = BINDING_NONE)
|
||||
@ -1519,7 +1519,7 @@ public:
|
||||
{ set_pattern(pattern); }
|
||||
|
||||
virtual bool
|
||||
operator==(const function_template_decl&) const;
|
||||
operator==(const function_tdecl&) const;
|
||||
|
||||
void
|
||||
set_pattern(shared_ptr<function_decl> p)
|
||||
@ -1545,17 +1545,17 @@ public:
|
||||
void
|
||||
traverse(ir_node_visitor& v);
|
||||
|
||||
virtual ~function_template_decl();
|
||||
virtual ~function_tdecl();
|
||||
};
|
||||
|
||||
|
||||
/// Abstract a class template.
|
||||
class class_template_decl : public template_decl, public scope_decl
|
||||
class class_tdecl : public template_decl, public scope_decl
|
||||
{
|
||||
shared_ptr<class_decl> m_pattern;
|
||||
|
||||
// Forbidden
|
||||
class_template_decl();
|
||||
class_tdecl();
|
||||
|
||||
public:
|
||||
|
||||
@ -1563,11 +1563,11 @@ public:
|
||||
struct hash;
|
||||
struct shared_ptr_hash;
|
||||
|
||||
class_template_decl(location locus, visibility vis = VISIBILITY_DEFAULT)
|
||||
class_tdecl(location locus, visibility vis = VISIBILITY_DEFAULT)
|
||||
: decl_base("", locus, "", vis), scope_decl("", locus)
|
||||
{ }
|
||||
|
||||
/// Constructor for the class_template_decl type.
|
||||
/// Constructor for the class_tdecl type.
|
||||
///
|
||||
/// @param pattrn The details of the class template. This must NOT be a
|
||||
/// null pointer. If you really this to be null, please use the
|
||||
@ -1577,12 +1577,12 @@ public:
|
||||
///
|
||||
/// @param vis the visibility of the instances of class instantiated
|
||||
/// from this template.
|
||||
class_template_decl(shared_ptr<class_decl> pattrn,
|
||||
class_tdecl(shared_ptr<class_decl> pattrn,
|
||||
location locus, visibility vis = VISIBILITY_DEFAULT);
|
||||
|
||||
|
||||
virtual bool
|
||||
operator==(const class_template_decl&) const;
|
||||
operator==(const class_tdecl&) const;
|
||||
|
||||
void
|
||||
set_pattern(shared_ptr<class_decl> p);
|
||||
@ -1599,7 +1599,7 @@ public:
|
||||
void
|
||||
traverse(ir_node_visitor& v);
|
||||
|
||||
virtual ~class_template_decl();
|
||||
virtual ~class_tdecl();
|
||||
};
|
||||
|
||||
|
||||
@ -2328,11 +2328,11 @@ public:
|
||||
|
||||
/// Abstract a member function template.
|
||||
class class_decl::member_function_template
|
||||
: public member_base, public virtual traversable_base
|
||||
: public member_base, public virtual traversable_base
|
||||
{
|
||||
bool m_is_constructor;
|
||||
bool m_is_const;
|
||||
shared_ptr<function_template_decl> m_fn_tmpl;
|
||||
shared_ptr<function_tdecl> m_fn_tmpl;
|
||||
|
||||
// Forbiden
|
||||
member_function_template();
|
||||
@ -2341,16 +2341,11 @@ public:
|
||||
/// Hasher.
|
||||
struct hash;
|
||||
|
||||
member_function_template
|
||||
(shared_ptr<function_template_decl> f,
|
||||
access_specifier access,
|
||||
bool is_static,
|
||||
bool is_constructor,
|
||||
bool is_const)
|
||||
: member_base(access, is_static),
|
||||
m_is_constructor(is_constructor),
|
||||
m_is_const(is_const),
|
||||
m_fn_tmpl(f)
|
||||
member_function_template(shared_ptr<function_tdecl> f,
|
||||
access_specifier access, bool is_static,
|
||||
bool is_constructor, bool is_const)
|
||||
: member_base(access, is_static), m_is_constructor(is_constructor),
|
||||
m_is_const(is_const), m_fn_tmpl(f)
|
||||
{ }
|
||||
|
||||
bool
|
||||
@ -2361,11 +2356,11 @@ public:
|
||||
is_const() const
|
||||
{ return m_is_const; }
|
||||
|
||||
operator const function_template_decl& () const
|
||||
operator const function_tdecl& () const
|
||||
{ return *m_fn_tmpl; }
|
||||
|
||||
shared_ptr<function_template_decl>
|
||||
as_function_template_decl() const
|
||||
shared_ptr<function_tdecl>
|
||||
as_function_tdecl() const
|
||||
{ return m_fn_tmpl; }
|
||||
|
||||
bool
|
||||
@ -2383,9 +2378,9 @@ public:
|
||||
|
||||
/// Abstracts a member class template template
|
||||
class class_decl::member_class_template
|
||||
: public member_base, public virtual traversable_base
|
||||
: public member_base, public virtual traversable_base
|
||||
{
|
||||
shared_ptr<class_template_decl> m_class_tmpl;
|
||||
shared_ptr<class_tdecl> m_class_tmpl;
|
||||
|
||||
// Forbidden
|
||||
member_class_template();
|
||||
@ -2395,16 +2390,16 @@ public:
|
||||
/// Hasher.
|
||||
struct hash;
|
||||
|
||||
member_class_template(shared_ptr<class_template_decl> c,
|
||||
member_class_template(shared_ptr<class_tdecl> c,
|
||||
access_specifier access, bool is_static)
|
||||
: member_base(access, is_static), m_class_tmpl(c)
|
||||
: member_base(access, is_static), m_class_tmpl(c)
|
||||
{ }
|
||||
|
||||
operator const class_template_decl& () const
|
||||
operator const class_tdecl& () const
|
||||
{ return *m_class_tmpl; }
|
||||
|
||||
shared_ptr<class_template_decl>
|
||||
as_class_template_decl() const
|
||||
shared_ptr<class_tdecl>
|
||||
as_class_tdecl() const
|
||||
{ return m_class_tmpl; }
|
||||
|
||||
bool
|
||||
@ -2433,28 +2428,28 @@ struct type_base::dynamic_hash
|
||||
operator()(const type_base* t) const;
|
||||
};
|
||||
|
||||
struct function_template_decl::hash
|
||||
struct function_tdecl::hash
|
||||
{
|
||||
size_t
|
||||
operator()(const function_template_decl& t) const;
|
||||
operator()(const function_tdecl& t) const;
|
||||
};
|
||||
|
||||
struct function_template_decl::shared_ptr_hash
|
||||
struct function_tdecl::shared_ptr_hash
|
||||
{
|
||||
size_t
|
||||
operator()(const shared_ptr<function_template_decl> f) const;
|
||||
operator()(const shared_ptr<function_tdecl> f) const;
|
||||
};
|
||||
|
||||
struct class_template_decl::hash
|
||||
struct class_tdecl::hash
|
||||
{
|
||||
size_t
|
||||
operator()(const class_template_decl& t) const;
|
||||
operator()(const class_tdecl& t) const;
|
||||
};
|
||||
|
||||
struct class_template_decl::shared_ptr_hash
|
||||
struct class_tdecl::shared_ptr_hash
|
||||
{
|
||||
size_t
|
||||
operator()(const shared_ptr<class_template_decl> t) const;
|
||||
operator()(const shared_ptr<class_tdecl> t) const;
|
||||
};
|
||||
|
||||
|
||||
@ -2480,8 +2475,8 @@ struct ir_node_visitor
|
||||
virtual void visit(typedef_decl&);
|
||||
virtual void visit(var_decl&);
|
||||
virtual void visit(function_decl&);
|
||||
virtual void visit(function_template_decl&);
|
||||
virtual void visit(class_template_decl&);
|
||||
virtual void visit(function_tdecl&);
|
||||
virtual void visit(class_tdecl&);
|
||||
virtual void visit(class_decl&);
|
||||
virtual void visit(class_decl::data_member&);
|
||||
virtual void visit(class_decl::member_function&);
|
||||
|
@ -64,12 +64,12 @@ namespace abigail
|
||||
|
||||
// Forward class declarations.
|
||||
class class_decl;
|
||||
class class_template_decl;
|
||||
class class_tdecl;
|
||||
class decl_base;
|
||||
class enum_type_decl;
|
||||
//class enumerator;
|
||||
class function_decl;
|
||||
class function_template_decl;
|
||||
class function_tdecl;
|
||||
class function_type;
|
||||
class global_scope;
|
||||
class ir_node_visitor;
|
||||
@ -84,11 +84,12 @@ namespace abigail
|
||||
class scope_decl;
|
||||
class scope_type_decl;
|
||||
class template_decl;
|
||||
class template_non_type_parameter;
|
||||
class template_parameter;
|
||||
class template_template_parameter;
|
||||
class template_type_parameter;
|
||||
class tmpl_parm_type_composition;
|
||||
class non_type_tparameter;
|
||||
class type_tparameter;
|
||||
class template_tparameter;
|
||||
|
||||
class type_composition;
|
||||
class translation_unit;
|
||||
class type_base;
|
||||
class type_decl;
|
||||
|
@ -407,11 +407,11 @@ struct class_decl::member_function_template::hash
|
||||
operator()(const member_function_template& t) const
|
||||
{
|
||||
std::tr1::hash<bool> hash_bool;
|
||||
function_template_decl::hash hash_function_template_decl;
|
||||
function_tdecl::hash hash_function_tdecl;
|
||||
member_base::hash hash_member;
|
||||
|
||||
size_t v = hash_member(t);
|
||||
v = hashing::combine_hashes(v, hash_function_template_decl(t));
|
||||
v = hashing::combine_hashes(v, hash_function_tdecl(t));
|
||||
v = hashing::combine_hashes(v, hash_bool(t.is_constructor()));
|
||||
v = hashing::combine_hashes(v, hash_bool(t.is_const()));
|
||||
|
||||
@ -425,10 +425,10 @@ struct class_decl::member_class_template::hash
|
||||
operator()(member_class_template& t) const
|
||||
{
|
||||
member_base::hash hash_member;
|
||||
class_template_decl::hash hash_class_template_decl;
|
||||
class_tdecl::hash hash_class_tdecl;
|
||||
|
||||
size_t v = hash_member(t);
|
||||
v = hashing::combine_hashes(v, hash_class_template_decl(t));
|
||||
v = hashing::combine_hashes(v, hash_class_tdecl(t));
|
||||
return v;
|
||||
}
|
||||
};
|
||||
@ -552,10 +552,10 @@ struct template_decl::hash
|
||||
}
|
||||
};
|
||||
|
||||
struct template_type_parameter::hash
|
||||
struct type_tparameter::hash
|
||||
{
|
||||
size_t
|
||||
operator()(const template_type_parameter& t) const
|
||||
operator()(const type_tparameter& t) const
|
||||
{
|
||||
std::tr1::hash<string> hash_string;
|
||||
template_parameter::hash hash_template_parameter;
|
||||
@ -569,10 +569,10 @@ struct template_type_parameter::hash
|
||||
}
|
||||
};
|
||||
|
||||
struct template_non_type_parameter::hash
|
||||
struct non_type_tparameter::hash
|
||||
{
|
||||
size_t
|
||||
operator()(const template_non_type_parameter& t) const
|
||||
operator()(const non_type_tparameter& t) const
|
||||
{
|
||||
template_parameter::hash hash_template_parameter;
|
||||
std::tr1::hash<string> hash_string;
|
||||
@ -587,13 +587,13 @@ struct template_non_type_parameter::hash
|
||||
}
|
||||
};
|
||||
|
||||
struct template_template_parameter::hash
|
||||
struct template_tparameter::hash
|
||||
{
|
||||
size_t
|
||||
operator()(const template_template_parameter& t) const
|
||||
operator()(const template_tparameter& t) const
|
||||
{
|
||||
std::tr1::hash<string> hash_string;
|
||||
template_type_parameter::hash hash_template_type_parm;
|
||||
type_tparameter::hash hash_template_type_parm;
|
||||
template_decl::hash hash_template_decl;
|
||||
|
||||
size_t v = hash_string(typeid(t).name());
|
||||
@ -608,23 +608,23 @@ size_t
|
||||
template_parameter::dynamic_hash::
|
||||
operator()(const template_parameter* t) const
|
||||
{
|
||||
if (const template_template_parameter* p =
|
||||
dynamic_cast<const template_template_parameter*>(t))
|
||||
return template_template_parameter::hash()(*p);
|
||||
else if (const template_type_parameter* p =
|
||||
dynamic_cast<const template_type_parameter*>(t))
|
||||
return template_type_parameter::hash()(*p);
|
||||
if (const template_non_type_parameter* p =
|
||||
dynamic_cast<const template_non_type_parameter*>(t))
|
||||
return template_non_type_parameter::hash()(*p);
|
||||
if (const template_tparameter* p =
|
||||
dynamic_cast<const template_tparameter*>(t))
|
||||
return template_tparameter::hash()(*p);
|
||||
else if (const type_tparameter* p =
|
||||
dynamic_cast<const type_tparameter*>(t))
|
||||
return type_tparameter::hash()(*p);
|
||||
if (const non_type_tparameter* p =
|
||||
dynamic_cast<const non_type_tparameter*>(t))
|
||||
return non_type_tparameter::hash()(*p);
|
||||
|
||||
// Poor man's fallback.
|
||||
return template_parameter::hash()(*t);
|
||||
}
|
||||
|
||||
size_t
|
||||
function_template_decl::hash::
|
||||
operator()(const function_template_decl& t) const
|
||||
function_tdecl::hash::
|
||||
operator()(const function_tdecl& t) const
|
||||
{
|
||||
std::tr1::hash<string> hash_string;
|
||||
decl_base::hash hash_decl_base;
|
||||
@ -642,18 +642,18 @@ operator()(const function_template_decl& t) const
|
||||
}
|
||||
|
||||
size_t
|
||||
function_template_decl::shared_ptr_hash::
|
||||
operator()(const shared_ptr<function_template_decl> f) const
|
||||
function_tdecl::shared_ptr_hash::
|
||||
operator()(const shared_ptr<function_tdecl> f) const
|
||||
{
|
||||
function_template_decl::hash hash_fn_tmpl_decl;
|
||||
function_tdecl::hash hash_fn_tmpl_decl;
|
||||
if (f)
|
||||
return hash_fn_tmpl_decl(*f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t
|
||||
class_template_decl::hash::
|
||||
operator()(const class_template_decl& t) const
|
||||
class_tdecl::hash::
|
||||
operator()(const class_tdecl& t) const
|
||||
{
|
||||
std::tr1::hash<string> hash_string;
|
||||
decl_base::hash hash_decl_base;
|
||||
@ -670,10 +670,10 @@ operator()(const class_template_decl& t) const
|
||||
}
|
||||
|
||||
size_t
|
||||
class_template_decl::shared_ptr_hash::
|
||||
operator()(const shared_ptr<class_template_decl> t) const
|
||||
class_tdecl::shared_ptr_hash::
|
||||
operator()(const shared_ptr<class_tdecl> t) const
|
||||
{
|
||||
class_template_decl::hash hash_class_tmpl_decl;
|
||||
class_tdecl::hash hash_class_tmpl_decl;
|
||||
|
||||
if (t)
|
||||
return hash_class_tmpl_decl(*t);
|
||||
@ -699,12 +699,12 @@ operator()(const type_base* t) const
|
||||
{
|
||||
if (t == 0)
|
||||
return 0;
|
||||
if (const template_template_parameter* d =
|
||||
dynamic_cast<const template_template_parameter*>(t))
|
||||
return template_template_parameter::hash()(*d);
|
||||
if (const template_type_parameter* d =
|
||||
dynamic_cast<const template_type_parameter*>(t))
|
||||
return template_type_parameter::hash()(*d);
|
||||
if (const template_tparameter* d =
|
||||
dynamic_cast<const template_tparameter*>(t))
|
||||
return template_tparameter::hash()(*d);
|
||||
if (const type_tparameter* d =
|
||||
dynamic_cast<const type_tparameter*>(t))
|
||||
return type_tparameter::hash()(*d);
|
||||
if (const type_decl* d = dynamic_cast<const type_decl*> (t))
|
||||
return type_decl::hash()(*d);
|
||||
if (const qualified_type_def* d = dynamic_cast<const qualified_type_def*>(t))
|
||||
|
@ -337,9 +337,9 @@ is_at_template_scope(const shared_ptr<decl_base> decl)
|
||||
bool
|
||||
is_template_parameter(const shared_ptr<decl_base> decl)
|
||||
{
|
||||
return (decl && (dynamic_pointer_cast<template_type_parameter>(decl)
|
||||
|| dynamic_pointer_cast<template_non_type_parameter>(decl)
|
||||
|| dynamic_pointer_cast<template_template_parameter>(decl)));
|
||||
return (decl && (dynamic_pointer_cast<type_tparameter>(decl)
|
||||
|| dynamic_pointer_cast<non_type_tparameter>(decl)
|
||||
|| dynamic_pointer_cast<template_tparameter>(decl)));
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1203,12 +1203,12 @@ void
|
||||
class_decl::add_member_function_template
|
||||
(shared_ptr<member_function_template> m)
|
||||
{
|
||||
decl_base* c = m->as_function_template_decl()->get_scope();
|
||||
decl_base* c = m->as_function_tdecl()->get_scope();
|
||||
/// TODO: use our own assertion facility that adds a meaningful
|
||||
/// error message or something like a structured error.
|
||||
assert(!c || c == this);
|
||||
if (!c)
|
||||
add_decl_to_scope(m->as_function_template_decl(), this);
|
||||
add_decl_to_scope(m->as_function_tdecl(), this);
|
||||
|
||||
m_member_function_templates.push_back(m);
|
||||
}
|
||||
@ -1216,12 +1216,12 @@ class_decl::add_member_function_template
|
||||
void
|
||||
class_decl::add_member_class_template(shared_ptr<member_class_template> m)
|
||||
{
|
||||
decl_base* c = m->as_class_template_decl()->get_scope();
|
||||
decl_base* c = m->as_class_tdecl()->get_scope();
|
||||
/// TODO: use our own assertion facility that adds a meaningful
|
||||
/// error message or something like a structured error.
|
||||
assert(!c || c == this);
|
||||
if (!c)
|
||||
add_decl_to_scope(m->as_class_template_decl(), this);
|
||||
add_decl_to_scope(m->as_class_tdecl(), this);
|
||||
|
||||
m_member_class_templates.push_back(m);
|
||||
}
|
||||
@ -1386,8 +1386,8 @@ class_decl::member_function_template::operator==
|
||||
&& static_cast<member_base>(*this) == o))
|
||||
return false;
|
||||
|
||||
if (as_function_template_decl())
|
||||
return static_cast<function_template_decl>(*this) == o;
|
||||
if (as_function_tdecl())
|
||||
return static_cast<function_tdecl>(*this) == o;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1396,7 +1396,7 @@ void
|
||||
class_decl::member_function_template::traverse(ir_node_visitor& v)
|
||||
{
|
||||
v.visit(*this);
|
||||
as_function_template_decl()->traverse(v);
|
||||
as_function_tdecl()->traverse(v);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1406,8 +1406,8 @@ class_decl::member_class_template::operator==
|
||||
if (!(static_cast<member_base>(*this) == o))
|
||||
return false;
|
||||
|
||||
if (as_class_template_decl())
|
||||
return static_cast<class_template_decl>(*this) == o;
|
||||
if (as_class_tdecl())
|
||||
return static_cast<class_tdecl>(*this) == o;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1416,7 +1416,7 @@ void
|
||||
class_decl::member_class_template::traverse(ir_node_visitor& v)
|
||||
{
|
||||
v.visit(*this);
|
||||
as_class_template_decl()->get_pattern()->traverse(v);
|
||||
as_class_tdecl()->get_pattern()->traverse(v);
|
||||
}
|
||||
// </class_decl>
|
||||
|
||||
@ -1464,54 +1464,49 @@ template_parameter::~template_parameter()
|
||||
{ }
|
||||
|
||||
bool
|
||||
template_type_parameter::operator==(const template_type_parameter& o) const
|
||||
type_tparameter::operator==(const type_tparameter& o) const
|
||||
{
|
||||
return (static_cast<template_parameter>(*this) == o);
|
||||
}
|
||||
|
||||
template_type_parameter::~template_type_parameter()
|
||||
type_tparameter::~type_tparameter()
|
||||
{ }
|
||||
|
||||
bool
|
||||
template_non_type_parameter::operator==
|
||||
(const template_non_type_parameter& o) const
|
||||
non_type_tparameter::operator==
|
||||
(const non_type_tparameter& o) const
|
||||
{
|
||||
return (static_cast<template_parameter>(*this) == o
|
||||
&& *get_type() == *o.get_type());
|
||||
}
|
||||
|
||||
template_non_type_parameter::~template_non_type_parameter()
|
||||
non_type_tparameter::~non_type_tparameter()
|
||||
{ }
|
||||
|
||||
bool
|
||||
template_template_parameter::operator==
|
||||
(const template_template_parameter& o) const
|
||||
template_tparameter::operator==
|
||||
(const template_tparameter& o) const
|
||||
{
|
||||
return (static_cast<template_type_parameter>(*this) == o
|
||||
return (static_cast<type_tparameter>(*this) == o
|
||||
&& (static_cast<template_decl>(*this) == o));
|
||||
}
|
||||
|
||||
template_template_parameter::~template_template_parameter()
|
||||
template_tparameter::~template_tparameter()
|
||||
{ }
|
||||
|
||||
tmpl_parm_type_composition::tmpl_parm_type_composition
|
||||
(unsigned index,
|
||||
shared_ptr<type_base> t)
|
||||
: decl_base("", location()),
|
||||
template_parameter(index),
|
||||
m_type(std::tr1::dynamic_pointer_cast<type_base>(t))
|
||||
{
|
||||
}
|
||||
type_composition::type_composition(unsigned index, shared_ptr<type_base> t)
|
||||
: decl_base("", location()), template_parameter(index),
|
||||
m_type(std::tr1::dynamic_pointer_cast<type_base>(t))
|
||||
{ }
|
||||
|
||||
tmpl_parm_type_composition::~tmpl_parm_type_composition()
|
||||
{
|
||||
}
|
||||
type_composition::~type_composition()
|
||||
{ }
|
||||
|
||||
//</template_parameter>
|
||||
|
||||
// <function_template>
|
||||
bool
|
||||
function_template_decl::operator==(const function_template_decl& o) const
|
||||
function_tdecl::operator==(const function_tdecl& o) const
|
||||
{
|
||||
if (!(get_binding() == o.get_binding()
|
||||
&& static_cast<template_decl>(*this) == o
|
||||
@ -1526,18 +1521,18 @@ function_template_decl::operator==(const function_template_decl& o) const
|
||||
}
|
||||
|
||||
void
|
||||
function_template_decl::traverse(ir_node_visitor&v)
|
||||
function_tdecl::traverse(ir_node_visitor&v)
|
||||
{
|
||||
v.visit(*this);
|
||||
get_pattern()->traverse(v);
|
||||
}
|
||||
|
||||
function_template_decl::~function_template_decl()
|
||||
function_tdecl::~function_tdecl()
|
||||
{ }
|
||||
// </function_template>
|
||||
|
||||
// <class template>
|
||||
class_template_decl::class_template_decl(shared_ptr<class_decl> pattern,
|
||||
class_tdecl::class_tdecl(shared_ptr<class_decl> pattern,
|
||||
location locus, visibility vis)
|
||||
: decl_base(pattern->get_name(), locus,
|
||||
pattern->get_name(), vis),
|
||||
@ -1545,7 +1540,7 @@ class_template_decl::class_template_decl(shared_ptr<class_decl> pattern,
|
||||
{ set_pattern(pattern);}
|
||||
|
||||
void
|
||||
class_template_decl::set_pattern(shared_ptr<class_decl> p)
|
||||
class_tdecl::set_pattern(shared_ptr<class_decl> p)
|
||||
{
|
||||
m_pattern = p;
|
||||
add_decl_to_scope(p, this);
|
||||
@ -1553,7 +1548,7 @@ class_template_decl::set_pattern(shared_ptr<class_decl> p)
|
||||
}
|
||||
|
||||
bool
|
||||
class_template_decl::operator==(const class_template_decl& o) const
|
||||
class_tdecl::operator==(const class_tdecl& o) const
|
||||
{
|
||||
if (!(static_cast<template_decl>(*this) == o
|
||||
&& static_cast<scope_decl>(*this) == o
|
||||
@ -1564,7 +1559,7 @@ class_template_decl::operator==(const class_template_decl& o) const
|
||||
}
|
||||
|
||||
void
|
||||
class_template_decl::traverse(ir_node_visitor&v)
|
||||
class_tdecl::traverse(ir_node_visitor&v)
|
||||
{
|
||||
v.visit(*this);
|
||||
|
||||
@ -1573,7 +1568,7 @@ class_template_decl::traverse(ir_node_visitor&v)
|
||||
pattern->traverse(v);
|
||||
}
|
||||
|
||||
class_template_decl::~class_template_decl()
|
||||
class_tdecl::~class_tdecl()
|
||||
{ }
|
||||
|
||||
void
|
||||
@ -1617,11 +1612,11 @@ ir_node_visitor::visit(function_decl&)
|
||||
{ }
|
||||
|
||||
void
|
||||
ir_node_visitor::visit(function_template_decl&)
|
||||
ir_node_visitor::visit(function_tdecl&)
|
||||
{ }
|
||||
|
||||
void
|
||||
ir_node_visitor::visit(class_template_decl&)
|
||||
ir_node_visitor::visit(class_tdecl&)
|
||||
{ }
|
||||
|
||||
void
|
||||
|
@ -66,11 +66,11 @@ public:
|
||||
const_types_map_it;
|
||||
|
||||
typedef unordered_map<string,
|
||||
shared_ptr<function_template_decl> >::const_iterator
|
||||
shared_ptr<function_tdecl> >::const_iterator
|
||||
const_fn_tmpl_map_it;
|
||||
|
||||
typedef unordered_map<string,
|
||||
shared_ptr<class_template_decl> >::const_iterator
|
||||
shared_ptr<class_tdecl> >::const_iterator
|
||||
const_class_tmpl_map_it;
|
||||
|
||||
read_context(xml::reader_sptr reader) : m_depth(0), m_reader(reader)
|
||||
@ -116,12 +116,12 @@ public:
|
||||
/// @return the function template identified by id, or a null
|
||||
/// pointer if no function template has ever been associated with
|
||||
/// id before.
|
||||
shared_ptr<function_template_decl>
|
||||
shared_ptr<function_tdecl>
|
||||
get_fn_tmpl_decl(const string& id) const
|
||||
{
|
||||
const_fn_tmpl_map_it i = m_fn_tmpl_map.find(id);
|
||||
if (i == m_fn_tmpl_map.end())
|
||||
return shared_ptr<function_template_decl>();
|
||||
return shared_ptr<function_tdecl>();
|
||||
return i->second;
|
||||
}
|
||||
|
||||
@ -135,12 +135,12 @@ public:
|
||||
///
|
||||
/// @return the class template identified by id, or a null pointer
|
||||
/// if no class template has ever been associated with id before.
|
||||
shared_ptr<class_template_decl>
|
||||
shared_ptr<class_tdecl>
|
||||
get_class_tmpl_decl(const string& id) const
|
||||
{
|
||||
const_class_tmpl_map_it i = m_class_tmpl_map.find(id);
|
||||
if (i == m_class_tmpl_map.end())
|
||||
return shared_ptr<class_template_decl>();
|
||||
return shared_ptr<class_tdecl>();
|
||||
return i->second;
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ public:
|
||||
/// that the function returns false if an ID was previously
|
||||
/// associated to the function template.
|
||||
bool
|
||||
key_fn_tmpl_decl(shared_ptr<function_template_decl> fn_tmpl_decl,
|
||||
key_fn_tmpl_decl(shared_ptr<function_tdecl> fn_tmpl_decl,
|
||||
const string& id)
|
||||
{
|
||||
assert(fn_tmpl_decl);
|
||||
@ -283,7 +283,7 @@ public:
|
||||
/// that the function returns false if an ID was previously
|
||||
/// associated to the class template.
|
||||
bool
|
||||
key_class_tmpl_decl(shared_ptr<class_template_decl> class_tmpl_decl,
|
||||
key_class_tmpl_decl(shared_ptr<class_tdecl> class_tmpl_decl,
|
||||
const string& id)
|
||||
{
|
||||
assert(class_tmpl_decl);
|
||||
@ -387,8 +387,8 @@ private:
|
||||
// The depth of the current node in the xml tree.
|
||||
int m_depth;
|
||||
unordered_map<string, shared_ptr<type_base> > m_types_map;
|
||||
unordered_map<string, shared_ptr<function_template_decl> > m_fn_tmpl_map;
|
||||
unordered_map<string, shared_ptr<class_template_decl> > m_class_tmpl_map;
|
||||
unordered_map<string, shared_ptr<function_tdecl> > m_fn_tmpl_map;
|
||||
unordered_map<string, shared_ptr<class_tdecl> > m_class_tmpl_map;
|
||||
xml::reader_sptr m_reader;
|
||||
stack<shared_ptr<decl_base> > m_decls_stack;
|
||||
};
|
||||
@ -414,44 +414,55 @@ static bool read_is_virtual(xmlNodePtr, bool&);
|
||||
// should be the last function of the list of declarated function below.
|
||||
static shared_ptr<function_decl::parameter>
|
||||
build_function_parameter (read_context&, const xmlNodePtr);
|
||||
|
||||
static shared_ptr<function_decl>
|
||||
build_function_decl(read_context&, const xmlNodePtr,
|
||||
shared_ptr<class_decl>, bool);
|
||||
|
||||
static shared_ptr<var_decl>
|
||||
build_var_decl(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<type_decl>
|
||||
build_type_decl(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<qualified_type_def>
|
||||
build_qualified_type_decl(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<pointer_type_def>
|
||||
build_pointer_type_def(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<reference_type_def>
|
||||
build_reference_type_def(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<enum_type_decl>
|
||||
build_enum_type_decl(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<typedef_decl>
|
||||
build_typedef_decl(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<class_decl>
|
||||
build_class_decl(read_context&, const xmlNodePtr, bool);
|
||||
static shared_ptr<function_template_decl>
|
||||
build_function_template_decl(read_context&, const xmlNodePtr, bool);
|
||||
static shared_ptr<class_template_decl>
|
||||
build_class_template_decl(read_context&, const xmlNodePtr, bool);
|
||||
static shared_ptr<template_type_parameter>
|
||||
build_template_type_parameter(read_context&, const xmlNodePtr, unsigned, bool);
|
||||
static shared_ptr<tmpl_parm_type_composition>
|
||||
build_tmpl_parm_type_composition(read_context&,
|
||||
const xmlNodePtr,
|
||||
unsigned, bool);
|
||||
static shared_ptr<template_non_type_parameter>
|
||||
build_template_non_type_parameter(read_context&, const xmlNodePtr,
|
||||
unsigned, bool);
|
||||
static shared_ptr<template_template_parameter>
|
||||
build_template_template_parameter(read_context&, const xmlNodePtr,
|
||||
unsigned, bool);
|
||||
|
||||
static shared_ptr<function_tdecl>
|
||||
build_function_tdecl(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<class_tdecl>
|
||||
build_class_tdecl(read_context&, const xmlNodePtr, bool);
|
||||
|
||||
static shared_ptr<type_tparameter>
|
||||
build_type_tparameter(read_context&, const xmlNodePtr, unsigned, bool);
|
||||
|
||||
static shared_ptr<type_composition>
|
||||
build_type_composition(read_context&, const xmlNodePtr, unsigned, bool);
|
||||
|
||||
static shared_ptr<non_type_tparameter>
|
||||
build_non_type_tparameter(read_context&, const xmlNodePtr, unsigned, bool);
|
||||
|
||||
static shared_ptr<template_tparameter>
|
||||
build_template_tparameter(read_context&, const xmlNodePtr, unsigned, bool);
|
||||
|
||||
static shared_ptr<template_parameter>
|
||||
build_template_parameter(read_context&, const xmlNodePtr,
|
||||
unsigned, bool);
|
||||
build_template_parameter(read_context&, const xmlNodePtr, unsigned, bool);
|
||||
|
||||
// Please make this build_type function be the last one of the list.
|
||||
// Note that it should call each type-building function above. So
|
||||
@ -472,8 +483,8 @@ static bool handle_typedef_decl(read_context&);
|
||||
static bool handle_var_decl(read_context&);
|
||||
static bool handle_function_decl(read_context&);
|
||||
static bool handle_class_decl(read_context&);
|
||||
static bool handle_function_template_decl(read_context&);
|
||||
static bool handle_class_template_decl(read_context&);
|
||||
static bool handle_function_tdecl(read_context&);
|
||||
static bool handle_class_tdecl(read_context&);
|
||||
|
||||
/// Updates the instance of read_context. Basically update thee path
|
||||
/// of elements from the root to the current element, that we maintain
|
||||
@ -668,10 +679,10 @@ handle_element(read_context& ctxt)
|
||||
return handle_class_decl(ctxt);
|
||||
if (xmlStrEqual(XML_READER_GET_NODE_NAME(reader).get(),
|
||||
BAD_CAST("function-template-decl")))
|
||||
return handle_function_template_decl(ctxt);
|
||||
return handle_function_tdecl(ctxt);
|
||||
if (xmlStrEqual(XML_READER_GET_NODE_NAME(reader).get(),
|
||||
BAD_CAST("class-template-decl")))
|
||||
return handle_class_template_decl(ctxt);
|
||||
return handle_class_tdecl(ctxt);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -1754,8 +1765,8 @@ build_class_decl(read_context& ctxt, const xmlNodePtr node,
|
||||
if (p->type != XML_ELEMENT_NODE)
|
||||
continue;
|
||||
|
||||
if (shared_ptr<function_template_decl> f =
|
||||
build_function_template_decl(ctxt, p,
|
||||
if (shared_ptr<function_tdecl> f =
|
||||
build_function_tdecl(ctxt, p,
|
||||
/*update_depth_info=*/true))
|
||||
{
|
||||
shared_ptr<class_decl::member_function_template> m
|
||||
@ -1765,8 +1776,8 @@ build_class_decl(read_context& ctxt, const xmlNodePtr node,
|
||||
is_const));
|
||||
decl->add_member_function_template(m);
|
||||
}
|
||||
else if (shared_ptr<class_template_decl> c =
|
||||
build_class_template_decl(ctxt, p,
|
||||
else if (shared_ptr<class_tdecl> c =
|
||||
build_class_tdecl(ctxt, p,
|
||||
/*update_depth_info=*/true))
|
||||
{
|
||||
shared_ptr<class_decl::member_class_template> m
|
||||
@ -1784,7 +1795,7 @@ build_class_decl(read_context& ctxt, const xmlNodePtr node,
|
||||
return decl;
|
||||
}
|
||||
|
||||
/// Build an intance of function_template_decl, from an
|
||||
/// Build an intance of function_tdecl, from an
|
||||
/// 'function-template-decl' xml element node.
|
||||
///
|
||||
/// @param ctxt the context of the parsing.
|
||||
@ -1801,14 +1812,14 @@ build_class_decl(read_context& ctxt, const xmlNodePtr node,
|
||||
/// should be true. In that case this function will update the depth
|
||||
/// information that is maintained by in the context of the parsing.
|
||||
///
|
||||
/// @return the newly built function_template_decl upon successful
|
||||
/// @return the newly built function_tdecl upon successful
|
||||
/// completion, a null pointer otherwise.
|
||||
static shared_ptr<function_template_decl>
|
||||
build_function_template_decl(read_context& ctxt,
|
||||
static shared_ptr<function_tdecl>
|
||||
build_function_tdecl(read_context& ctxt,
|
||||
const xmlNodePtr node,
|
||||
bool update_depth_info)
|
||||
{
|
||||
shared_ptr<function_template_decl> nil, result;
|
||||
shared_ptr<function_tdecl> nil, result;
|
||||
|
||||
if (!xmlStrEqual(node->name, BAD_CAST("function-template-decl")))
|
||||
return nil;
|
||||
@ -1828,8 +1839,8 @@ build_function_template_decl(read_context& ctxt,
|
||||
decl_base::binding bind = decl_base::BINDING_NONE;
|
||||
read_binding(node, bind);
|
||||
|
||||
shared_ptr<function_template_decl> fn_tmpl_decl
|
||||
(new function_template_decl(loc, vis, bind));
|
||||
shared_ptr<function_tdecl> fn_tmpl_decl
|
||||
(new function_tdecl(loc, vis, bind));
|
||||
|
||||
ctxt.push_decl_to_current_scope(fn_tmpl_decl, node, update_depth_info);
|
||||
|
||||
@ -1857,7 +1868,7 @@ build_function_template_decl(read_context& ctxt,
|
||||
return fn_tmpl_decl;
|
||||
}
|
||||
|
||||
/// Build an intance of class_template_decl, from a
|
||||
/// Build an intance of class_tdecl, from a
|
||||
/// 'class-template-decl' xml element node.
|
||||
///
|
||||
/// @param ctxt the context of the parsing.
|
||||
@ -1874,14 +1885,13 @@ build_function_template_decl(read_context& ctxt,
|
||||
/// should be true. In that case this function will update the depth
|
||||
/// information that is maintained by in the context of the parsing.
|
||||
///
|
||||
/// @return the newly built function_template_decl upon successful
|
||||
/// @return the newly built function_tdecl upon successful
|
||||
/// completion, a null pointer otherwise.
|
||||
static shared_ptr<class_template_decl>
|
||||
build_class_template_decl(read_context& ctxt,
|
||||
const xmlNodePtr node,
|
||||
bool update_depth_info)
|
||||
static shared_ptr<class_tdecl>
|
||||
build_class_tdecl(read_context& ctxt, const xmlNodePtr node,
|
||||
bool update_depth_info)
|
||||
{
|
||||
shared_ptr<class_template_decl> nil, result;
|
||||
shared_ptr<class_tdecl> nil, result;
|
||||
|
||||
if (!xmlStrEqual(node->name, BAD_CAST("class-template-decl")))
|
||||
return nil;
|
||||
@ -1898,8 +1908,8 @@ build_class_template_decl(read_context& ctxt,
|
||||
decl_base::visibility vis = decl_base::VISIBILITY_NONE;
|
||||
read_visibility(node, vis);
|
||||
|
||||
shared_ptr<class_template_decl> class_tmpl
|
||||
(new class_template_decl(loc, vis));
|
||||
shared_ptr<class_tdecl> class_tmpl
|
||||
(new class_tdecl(loc, vis));
|
||||
|
||||
ctxt.push_decl_to_current_scope(class_tmpl, node, update_depth_info);
|
||||
|
||||
@ -1926,7 +1936,7 @@ build_class_template_decl(read_context& ctxt,
|
||||
return class_tmpl;
|
||||
}
|
||||
|
||||
/// Build a template_type_parameter from a 'template-type-parameter'
|
||||
/// Build a type_tparameter from a 'template-type-parameter'
|
||||
/// xml element node.
|
||||
///
|
||||
/// @param ctxt the context of the parsing.
|
||||
@ -1937,14 +1947,12 @@ build_class_template_decl(read_context& ctxt,
|
||||
/// template parameter.
|
||||
///
|
||||
/// @return a pointer to a newly created instance of
|
||||
/// template_type_parameter, a null pointer otherwise.
|
||||
static shared_ptr<template_type_parameter>
|
||||
build_template_type_parameter(read_context& ctxt,
|
||||
const xmlNodePtr node,
|
||||
unsigned index,
|
||||
bool update_depth_info)
|
||||
/// type_tparameter, a null pointer otherwise.
|
||||
static shared_ptr<type_tparameter>
|
||||
build_type_tparameter(read_context& ctxt, const xmlNodePtr node,
|
||||
unsigned index, bool update_depth_info)
|
||||
{
|
||||
shared_ptr<template_type_parameter> nil, result;
|
||||
shared_ptr<type_tparameter> nil, result;
|
||||
|
||||
if (!xmlStrEqual(node->name, BAD_CAST("template-type-parameter")))
|
||||
return nil;
|
||||
@ -1959,7 +1967,7 @@ build_template_type_parameter(read_context& ctxt,
|
||||
if (xml_char_sptr s = XML_NODE_GET_ATTRIBUTE(node, "type-id"))
|
||||
type_id = CHAR_STR(s);
|
||||
if (!type_id.empty()
|
||||
&& !(result = dynamic_pointer_cast<template_type_parameter>
|
||||
&& !(result = dynamic_pointer_cast<type_tparameter>
|
||||
(ctxt.get_type_decl(type_id))))
|
||||
return nil;
|
||||
|
||||
@ -1970,7 +1978,7 @@ build_template_type_parameter(read_context& ctxt,
|
||||
location loc;
|
||||
read_location(ctxt, node,loc);
|
||||
|
||||
result.reset(new template_type_parameter(index, name, loc));
|
||||
result.reset(new type_tparameter(index, name, loc));
|
||||
|
||||
if (id.empty())
|
||||
ctxt.push_decl_to_current_scope(dynamic_pointer_cast<decl_base>(result),
|
||||
@ -1996,19 +2004,17 @@ build_template_type_parameter(read_context& ctxt,
|
||||
///
|
||||
/// @return a pointer to a new instance of tmpl_parm_type_composition
|
||||
/// upon successful completion, a null pointer otherwise.
|
||||
static shared_ptr<tmpl_parm_type_composition>
|
||||
build_tmpl_parm_type_composition(read_context& ctxt,
|
||||
const xmlNodePtr node,
|
||||
unsigned index,
|
||||
bool update_depth_info)
|
||||
static shared_ptr<type_composition>
|
||||
build_type_composition(read_context& ctxt, const xmlNodePtr node,
|
||||
unsigned index, bool update_depth_info)
|
||||
{
|
||||
shared_ptr<tmpl_parm_type_composition> nil, result;
|
||||
shared_ptr<type_composition> nil, result;
|
||||
|
||||
if (!xmlStrEqual(node->name, BAD_CAST("template-parameter-type-composition")))
|
||||
return nil;
|
||||
|
||||
shared_ptr<type_base> composed_type;
|
||||
result.reset(new tmpl_parm_type_composition(index, composed_type));
|
||||
result.reset(new type_composition(index, composed_type));
|
||||
ctxt.push_decl_to_current_scope(dynamic_pointer_cast<decl_base>(result),
|
||||
node, update_depth_info);
|
||||
|
||||
@ -2035,7 +2041,7 @@ build_tmpl_parm_type_composition(read_context& ctxt,
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Build an instance of template_non_type_parameter from a
|
||||
/// Build an instance of non_type_tparameter from a
|
||||
/// 'template-non-type-parameter' xml element node.
|
||||
///
|
||||
/// @param ctxt the context of the parsing.
|
||||
@ -2045,15 +2051,15 @@ build_tmpl_parm_type_composition(read_context& ctxt,
|
||||
/// @param index the index of the parameter.
|
||||
///
|
||||
/// @return a pointer to a newly created instance of
|
||||
/// template_non_type_parameter upon successful completion, a null
|
||||
/// non_type_tparameter upon successful completion, a null
|
||||
/// pointer code otherwise.
|
||||
static shared_ptr<template_non_type_parameter>
|
||||
build_template_non_type_parameter(read_context& ctxt,
|
||||
static shared_ptr<non_type_tparameter>
|
||||
build_non_type_tparameter(read_context& ctxt,
|
||||
const xmlNodePtr node,
|
||||
unsigned index,
|
||||
bool update_depth_info)
|
||||
{
|
||||
shared_ptr<template_non_type_parameter> r;
|
||||
shared_ptr<non_type_tparameter> r;
|
||||
|
||||
if (!xmlStrEqual(node->name, BAD_CAST("template-non-type-parameter")))
|
||||
return r;
|
||||
@ -2073,14 +2079,14 @@ build_template_non_type_parameter(read_context& ctxt,
|
||||
location loc;
|
||||
read_location(ctxt, node,loc);
|
||||
|
||||
r.reset(new template_non_type_parameter(index, name, type, loc));
|
||||
r.reset(new non_type_tparameter(index, name, type, loc));
|
||||
ctxt.push_decl_to_current_scope(dynamic_pointer_cast<decl_base>(r),
|
||||
node, update_depth_info);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/// Build an intance of template_template_parameter from a
|
||||
/// Build an intance of template_tparameter from a
|
||||
/// 'template-template-parameter' xml element node.
|
||||
///
|
||||
/// @param ctxt the context of the parsing.
|
||||
@ -2089,15 +2095,15 @@ build_template_non_type_parameter(read_context& ctxt,
|
||||
///
|
||||
/// @param index the index of the template parameter.
|
||||
///
|
||||
/// @return a pointer to a new instance of template_template_parameter
|
||||
/// @return a pointer to a new instance of template_tparameter
|
||||
/// upon successful completion, a null pointer otherwise.
|
||||
static shared_ptr<template_template_parameter>
|
||||
build_template_template_parameter(read_context& ctxt,
|
||||
static shared_ptr<template_tparameter>
|
||||
build_template_tparameter(read_context& ctxt,
|
||||
const xmlNodePtr node,
|
||||
unsigned index,
|
||||
bool update_depth_info)
|
||||
{
|
||||
shared_ptr<template_template_parameter> nil;
|
||||
shared_ptr<template_tparameter> nil;
|
||||
|
||||
if (!xmlStrEqual(node->name, BAD_CAST("template-template-parameter")))
|
||||
return nil;
|
||||
@ -2114,7 +2120,7 @@ build_template_template_parameter(read_context& ctxt,
|
||||
type_id = CHAR_STR(s);
|
||||
// Bail out if no type with this ID exists.
|
||||
if (!type_id.empty()
|
||||
&& !(dynamic_pointer_cast<template_template_parameter>
|
||||
&& !(dynamic_pointer_cast<template_tparameter>
|
||||
(ctxt.get_type_decl(type_id))))
|
||||
return nil;
|
||||
|
||||
@ -2125,8 +2131,8 @@ build_template_template_parameter(read_context& ctxt,
|
||||
location loc;
|
||||
read_location(ctxt, node, loc);
|
||||
|
||||
shared_ptr<template_template_parameter> result
|
||||
(new template_template_parameter(index, name, loc));
|
||||
shared_ptr<template_tparameter> result
|
||||
(new template_tparameter(index, name, loc));
|
||||
|
||||
ctxt.push_decl_to_current_scope(result, node, update_depth_info);
|
||||
|
||||
@ -2171,14 +2177,10 @@ build_template_parameter(read_context& ctxt,
|
||||
bool update_depth_info)
|
||||
{
|
||||
shared_ptr<template_parameter> r;
|
||||
((r = build_template_type_parameter(ctxt, node, index,
|
||||
update_depth_info))
|
||||
|| (r = build_template_non_type_parameter(ctxt, node, index,
|
||||
update_depth_info))
|
||||
|| (r = build_template_template_parameter(ctxt, node, index,
|
||||
update_depth_info))
|
||||
|| (r = build_tmpl_parm_type_composition(ctxt, node, index,
|
||||
update_depth_info)));
|
||||
((r = build_type_tparameter(ctxt, node, index, update_depth_info))
|
||||
|| (r = build_non_type_tparameter(ctxt, node, index, update_depth_info))
|
||||
|| (r = build_template_tparameter(ctxt, node, index, update_depth_info))
|
||||
|| (r = build_type_composition(ctxt, node, index, update_depth_info)));
|
||||
|
||||
return r;
|
||||
}
|
||||
@ -2562,7 +2564,7 @@ handle_class_decl(read_context& ctxt)
|
||||
/// @return true upon successful completion of the parsing, false
|
||||
/// otherwise.
|
||||
static bool
|
||||
handle_function_template_decl(read_context& ctxt)
|
||||
handle_function_tdecl(read_context& ctxt)
|
||||
{
|
||||
xml::reader_sptr r = ctxt.get_reader();
|
||||
if (!r)
|
||||
@ -2572,7 +2574,7 @@ handle_function_template_decl(read_context& ctxt)
|
||||
if (!node)
|
||||
return false;
|
||||
|
||||
bool is_ok = build_function_template_decl(ctxt, node,
|
||||
bool is_ok = build_function_tdecl(ctxt, node,
|
||||
/*update_depth_info=*/false);
|
||||
|
||||
xmlTextReaderNext(r.get());
|
||||
@ -2586,7 +2588,7 @@ handle_function_template_decl(read_context& ctxt)
|
||||
///
|
||||
/// @return true upon successful completion, false otherwise.
|
||||
static bool
|
||||
handle_class_template_decl(read_context& ctxt)
|
||||
handle_class_tdecl(read_context& ctxt)
|
||||
{
|
||||
xml::reader_sptr r = ctxt.get_reader();
|
||||
if (!r)
|
||||
@ -2596,7 +2598,7 @@ handle_class_template_decl(read_context& ctxt)
|
||||
if (!node)
|
||||
return false;
|
||||
|
||||
bool is_ok = build_class_template_decl(ctxt, node,
|
||||
bool is_ok = build_class_tdecl(ctxt, node,
|
||||
/*update_depth_info=*/false);
|
||||
xmlTextReaderNext(r.get());
|
||||
|
||||
|
@ -80,13 +80,13 @@ typedef unordered_map<shared_ptr<type_base>,
|
||||
type_base::shared_ptr_hash,
|
||||
type_shared_ptr_equal> type_shared_ptr_map;
|
||||
|
||||
typedef unordered_map<shared_ptr<function_template_decl>,
|
||||
typedef unordered_map<shared_ptr<function_tdecl>,
|
||||
string,
|
||||
function_template_decl::shared_ptr_hash> fn_tmpl_shared_ptr_map;
|
||||
function_tdecl::shared_ptr_hash> fn_tmpl_shared_ptr_map;
|
||||
|
||||
typedef unordered_map<shared_ptr<class_template_decl>,
|
||||
typedef unordered_map<shared_ptr<class_tdecl>,
|
||||
string,
|
||||
class_template_decl::shared_ptr_hash> class_tmpl_shared_ptr_map;
|
||||
class_tdecl::shared_ptr_hash> class_tmpl_shared_ptr_map;
|
||||
|
||||
class write_context
|
||||
{
|
||||
@ -132,7 +132,7 @@ public:
|
||||
}
|
||||
|
||||
string
|
||||
get_id_for_fn_tmpl(shared_ptr<function_template_decl> f)
|
||||
get_id_for_fn_tmpl(shared_ptr<function_tdecl> f)
|
||||
{
|
||||
fn_tmpl_shared_ptr_map::const_iterator it = m_fn_tmpl_id_map.find(f);
|
||||
if (it == m_fn_tmpl_id_map.end())
|
||||
@ -145,7 +145,7 @@ public:
|
||||
}
|
||||
|
||||
string
|
||||
get_id_for_class_tmpl(shared_ptr<class_template_decl> c)
|
||||
get_id_for_class_tmpl(shared_ptr<class_tdecl> c)
|
||||
{
|
||||
class_tmpl_shared_ptr_map::const_iterator it = m_class_tmpl_id_map.find(c);
|
||||
if (it == m_class_tmpl_id_map.end())
|
||||
@ -202,23 +202,23 @@ static bool write_function_decl(const shared_ptr<function_decl>,
|
||||
write_context&, bool, unsigned);
|
||||
static bool write_class_decl(const shared_ptr<class_decl>,
|
||||
write_context&, unsigned);
|
||||
static bool write_template_type_parameter
|
||||
(const shared_ptr<template_type_parameter>, write_context&, unsigned);
|
||||
static bool write_template_non_type_parameter
|
||||
(const shared_ptr<template_non_type_parameter>, write_context&, unsigned);
|
||||
static bool write_template_template_parameter
|
||||
(const shared_ptr<template_template_parameter>, write_context&, unsigned);
|
||||
static bool write_tmpl_parm_type_composition
|
||||
(const shared_ptr<tmpl_parm_type_composition>, write_context&, unsigned);
|
||||
static bool write_type_tparameter
|
||||
(const shared_ptr<type_tparameter>, write_context&, unsigned);
|
||||
static bool write_non_type_tparameter
|
||||
(const shared_ptr<non_type_tparameter>, write_context&, unsigned);
|
||||
static bool write_template_tparameter
|
||||
(const shared_ptr<template_tparameter>, write_context&, unsigned);
|
||||
static bool write_type_composition
|
||||
(const shared_ptr<type_composition>, write_context&, unsigned);
|
||||
static bool write_template_parameter(const shared_ptr<template_parameter>,
|
||||
write_context&, unsigned);
|
||||
static void write_template_parameters(const shared_ptr<template_decl>,
|
||||
write_context&, unsigned);
|
||||
static bool write_function_template_decl
|
||||
(const shared_ptr<function_template_decl>,
|
||||
static bool write_function_tdecl
|
||||
(const shared_ptr<function_tdecl>,
|
||||
write_context&, unsigned);
|
||||
static bool write_class_template_decl
|
||||
(const shared_ptr<class_template_decl>,
|
||||
static bool write_class_tdecl
|
||||
(const shared_ptr<class_tdecl>,
|
||||
write_context&, unsigned);
|
||||
static void do_indent(ostream&, unsigned);
|
||||
static void do_indent_to_level(write_context&, unsigned, unsigned);
|
||||
@ -565,10 +565,10 @@ write_decl(const shared_ptr<decl_base> decl, write_context& ctxt,
|
||||
|| write_function_decl(dynamic_pointer_cast<function_decl>(decl),
|
||||
ctxt, /*skip_first_parameter=*/false, indent)
|
||||
|| write_class_decl(dynamic_pointer_cast<class_decl>(decl), ctxt, indent)
|
||||
|| (write_function_template_decl
|
||||
(dynamic_pointer_cast<function_template_decl>(decl), ctxt, indent))
|
||||
|| (write_class_template_decl
|
||||
(dynamic_pointer_cast<class_template_decl>(decl), ctxt, indent)))
|
||||
|| (write_function_tdecl
|
||||
(dynamic_pointer_cast<function_tdecl>(decl), ctxt, indent))
|
||||
|| (write_class_tdecl
|
||||
(dynamic_pointer_cast<class_tdecl>(decl), ctxt, indent)))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -1149,7 +1149,7 @@ write_class_decl(const shared_ptr<class_decl> decl,
|
||||
write_cdtor_const_static((*fn)->is_constructor(), false,
|
||||
(*fn)->is_static(), o);
|
||||
o << ">\n";
|
||||
write_function_template_decl((*fn)->as_function_template_decl(), ctxt,
|
||||
write_function_tdecl((*fn)->as_function_tdecl(), ctxt,
|
||||
get_indent_to_level(ctxt, indent, 2));
|
||||
o << "\n";
|
||||
do_indent(o, nb_ws);
|
||||
@ -1166,7 +1166,7 @@ write_class_decl(const shared_ptr<class_decl> decl,
|
||||
write_access(*cl, o);
|
||||
write_cdtor_const_static(false, false, (*cl)->is_static(), o);
|
||||
o << ">\n";
|
||||
write_class_template_decl((*cl)->as_class_template_decl(), ctxt,
|
||||
write_class_tdecl((*cl)->as_class_tdecl(), ctxt,
|
||||
get_indent_to_level(ctxt, indent, 2));
|
||||
o << "\n";
|
||||
do_indent(o, nb_ws);
|
||||
@ -1181,7 +1181,7 @@ write_class_decl(const shared_ptr<class_decl> decl,
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Serialize an instance of template_type_parameter.
|
||||
/// Serialize an instance of type_tparameter.
|
||||
///
|
||||
/// @param decl the instance to serialize.
|
||||
///
|
||||
@ -1191,7 +1191,7 @@ write_class_decl(const shared_ptr<class_decl> decl,
|
||||
///
|
||||
/// @return true upon successful completion, false otherwise.
|
||||
static bool
|
||||
write_template_type_parameter(const shared_ptr<template_type_parameter> decl,
|
||||
write_type_tparameter(const shared_ptr<type_tparameter> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
{
|
||||
if (!decl)
|
||||
@ -1220,7 +1220,7 @@ write_template_type_parameter(const shared_ptr<template_type_parameter> decl,
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Serialize an instance of template_non_type_parameter.
|
||||
/// Serialize an instance of non_type_tparameter.
|
||||
///
|
||||
/// @param decl the instance to serialize.
|
||||
///
|
||||
@ -1230,8 +1230,8 @@ write_template_type_parameter(const shared_ptr<template_type_parameter> decl,
|
||||
///
|
||||
/// @return true open successful completion, false otherwise.
|
||||
static bool
|
||||
write_template_non_type_parameter(
|
||||
const shared_ptr<template_non_type_parameter> decl,
|
||||
write_non_type_tparameter(
|
||||
const shared_ptr<non_type_tparameter> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
{
|
||||
if (!decl)
|
||||
@ -1266,8 +1266,8 @@ write_template_non_type_parameter(
|
||||
/// @return true upon successful completion, false otherwise.
|
||||
|
||||
static bool
|
||||
write_template_template_parameter
|
||||
(const shared_ptr<template_template_parameter> decl,
|
||||
write_template_tparameter
|
||||
(const shared_ptr<template_tparameter> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
{
|
||||
if (!decl)
|
||||
@ -1305,7 +1305,7 @@ write_template_template_parameter
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Serialize an instance of tmpl_parm_type_composition.
|
||||
/// Serialize an instance of type_composition.
|
||||
///
|
||||
/// @param decl the decl to serialize.
|
||||
///
|
||||
@ -1315,8 +1315,8 @@ write_template_template_parameter
|
||||
///
|
||||
/// @return true upon successful completion, false otherwise.
|
||||
static bool
|
||||
write_tmpl_parm_type_composition
|
||||
(const shared_ptr<tmpl_parm_type_composition> decl,
|
||||
write_type_composition
|
||||
(const shared_ptr<type_composition> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
{
|
||||
if (!decl)
|
||||
@ -1360,16 +1360,16 @@ static bool
|
||||
write_template_parameter(const shared_ptr<template_parameter> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
{
|
||||
if ((!write_template_type_parameter
|
||||
(dynamic_pointer_cast<template_type_parameter>(decl), ctxt, indent))
|
||||
&& (!write_template_non_type_parameter
|
||||
(dynamic_pointer_cast<template_non_type_parameter>(decl),
|
||||
if ((!write_type_tparameter
|
||||
(dynamic_pointer_cast<type_tparameter>(decl), ctxt, indent))
|
||||
&& (!write_non_type_tparameter
|
||||
(dynamic_pointer_cast<non_type_tparameter>(decl),
|
||||
ctxt, indent))
|
||||
&& (!write_template_template_parameter
|
||||
(dynamic_pointer_cast<template_template_parameter>(decl),
|
||||
&& (!write_template_tparameter
|
||||
(dynamic_pointer_cast<template_tparameter>(decl),
|
||||
ctxt, indent))
|
||||
&& (!write_tmpl_parm_type_composition
|
||||
(dynamic_pointer_cast<tmpl_parm_type_composition>(decl),
|
||||
&& (!write_type_composition
|
||||
(dynamic_pointer_cast<type_composition>(decl),
|
||||
ctxt, indent)))
|
||||
return false;
|
||||
|
||||
@ -1399,7 +1399,7 @@ write_template_parameters(const shared_ptr<template_decl> tmpl,
|
||||
}
|
||||
}
|
||||
|
||||
/// Serialize an instance of function_template_decl.
|
||||
/// Serialize an instance of function_tdecl.
|
||||
///
|
||||
/// @param decl the instance to serialize.
|
||||
///
|
||||
@ -1407,8 +1407,8 @@ write_template_parameters(const shared_ptr<template_decl> tmpl,
|
||||
///
|
||||
/// @param indent the initial indentation.
|
||||
static bool
|
||||
write_function_template_decl(const shared_ptr<function_template_decl> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
write_function_tdecl(const shared_ptr<function_tdecl> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
{
|
||||
if (!decl)
|
||||
return false;
|
||||
@ -1442,9 +1442,9 @@ write_function_template_decl(const shared_ptr<function_template_decl> decl,
|
||||
}
|
||||
|
||||
|
||||
/// Serialize an instance of class_template_decl
|
||||
/// Serialize an instance of class_tdecl
|
||||
///
|
||||
/// @param decl a pointer to the instance of class_template_decl to serialize.
|
||||
/// @param decl a pointer to the instance of class_tdecl to serialize.
|
||||
///
|
||||
/// @param ctxt the context of the serializtion.
|
||||
///
|
||||
@ -1453,8 +1453,8 @@ write_function_template_decl(const shared_ptr<function_template_decl> decl,
|
||||
///
|
||||
/// @return true upon successful completion, false otherwise.
|
||||
static bool
|
||||
write_class_template_decl (const shared_ptr<class_template_decl> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
write_class_tdecl(const shared_ptr<class_tdecl> decl,
|
||||
write_context& ctxt, unsigned indent)
|
||||
{
|
||||
if (!decl)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user