traverse(ir_node_visitor&);
virtual string
- get_pretty_representation(bool internal = false) const = 0;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const = 0;
}; // end class type_or_decl_base
bool
get_hash() const;
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
virtual void
get_qualified_name(interned_string& qualified_name,
bool operator!=(const type_decl&)const;
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = false) const;
virtual bool
traverse(ir_node_visitor&);
const location& locus, visibility vis = VISIBILITY_DEFAULT);
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
virtual bool
operator==(const decl_base&) const;
vector_as_string(const vector<subrange_sptr>&);
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
virtual bool
traverse(ir_node_visitor&);
is_infinite() const;
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
virtual string
get_subrange_representation() const;
get_enumerators();
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
virtual bool
operator==(const decl_base&) const;
operator==(const type_base&) const;
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
type_base_sptr
get_underlying_type() const;
get_hash() const;
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
virtual bool
traverse(ir_node_visitor& v);
binding bind = BINDING_GLOBAL);
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
string
get_pretty_representation_of_declarator (bool internal = false) const;
bool internal = false) const;
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
}; // end class function_decl::parameter
bool
operator==(const type_base&) const;
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
virtual bool
traverse(ir_node_visitor&);
virtual ~method_type();
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
friend interned_string
get_method_type_name(const method_type& fn_type, bool internal);
get_naked_definition_of_declaration() const;
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
void
is_struct(bool f);
bool is_declaration_only = true);
virtual string
- get_pretty_representation(bool internal = false) const;
+ get_pretty_representation(bool internal = false,
+ bool qualified_name = true) const;
virtual bool
operator==(const decl_base&) const;
/// otherwise. If you don't know what this is for, then set it to
/// false.
///
+/// @param qualified_name if true, names emitted in the pretty
+/// representation are fully qualified.
+///
/// @return the default pretty representation for a decl. This is
/// basically the fully qualified name of the decl optionally prefixed
/// with a meaningful string to add context for the user.
string
-decl_base::get_pretty_representation(bool internal) const
-{return get_qualified_name(internal);}
+decl_base::get_pretty_representation(bool internal,
+ bool qualified_name) const
+{
+ if (qualified_name)
+ return get_qualified_name(internal);
+ return get_name();
+}
/// Return the qualified name of the decl.
///
string
get_class_or_union_flat_representation(const class_or_union& cou,
const string& indent,
- bool one_line)
+ bool one_line,
+ bool qualified_names)
{
string repr;
string local_indent = " ";
repr +=
get_class_or_union_flat_representation
(anonymous_data_member_to_class_or_union(*dm),
- real_indent, one_line);
+ real_indent, one_line, qualified_names);
else
{
if (one_line)
{
if (dm != dmems.begin())
repr += real_indent;
- repr += (*dm)->get_pretty_representation();
+ repr += (*dm)->get_pretty_representation(/*internal=*/false,
+ qualified_names);
}
else
- repr += real_indent+ (*dm)->get_pretty_representation();
+ repr +=
+ real_indent+ (*dm)->get_pretty_representation(/*internal=*/false,
+ qualified_names);
}
repr += ";";
}
- repr += indent + "}";
+ if (one_line)
+ repr += "}";
+ else
+ repr += indent + "}";
return repr;
}
string
get_class_or_union_flat_representation(const class_or_union* cou,
const string& indent,
- bool one_line)
+ bool one_line,
+ bool qualified_names)
{
if (cou)
- return get_class_or_union_flat_representation(*cou, indent, one_line);
+ return get_class_or_union_flat_representation(*cou, indent, one_line,
+ qualified_names);
return "";
}
string
get_class_or_union_flat_representation(const class_or_union_sptr& cou,
const string& indent,
- bool one_line)
-{return get_class_or_union_flat_representation(cou.get(), indent, one_line);}
+ bool one_line,
+ bool qualified_names)
+{return get_class_or_union_flat_representation(cou.get(),
+ indent,
+ one_line,
+ qualified_names);}
/// By looking at the language of the TU a given ABI artifact belongs
/// to, test if the ONE Definition Rule should apply.
/// otherwise. If you don't know what this is for, then set it to
/// false.
///
+/// @param qualified_name if true, names emitted in the pretty
+/// representation are fully qualified.
+///
/// @return the pretty representatin of the @ref type_decl.
string
-type_decl::get_pretty_representation(bool internal) const
-{return get_qualified_name(internal);}
+type_decl::get_pretty_representation(bool internal,
+ bool qualified_name) const
+{
+ if (qualified_name)
+ return get_qualified_name(internal);
+ return get_name();
+}
/// This implements the ir_traversable_base::traverse pure virtual
/// function.
/// otherwise. If you don't know what this is for, then set it to
/// false.
///
+/// @param qualified_name if true, names emitted in the pretty
+/// representation are fully qualified.
+///
/// @return a copy of the pretty representation of the namespace.
string
-namespace_decl::get_pretty_representation(bool internal) const
+namespace_decl::get_pretty_representation(bool internal,
+ bool qualified_name) const
{
- string r = "namespace " + scope_decl::get_pretty_representation(internal);
+ string r =
+ "namespace " + scope_decl::get_pretty_representation(internal,
+ qualified_name);
return r;
}
/// @return a copy of the pretty representation of the current
/// instance of typedef_decl.
string
-array_type_def::subrange_type::get_pretty_representation(bool) const
+array_type_def::subrange_type::get_pretty_representation(bool, bool) const
{
string name = get_name();
string repr;
/// otherwise. If you don't know what this is for, then set it to
/// false.
string
-array_type_def::get_pretty_representation(bool internal) const
+array_type_def::get_pretty_representation(bool internal,
+ bool /*qualified_name*/) const
{return get_type_representation(*this, internal);}
/// Compares two instances of @ref array_type_def.
/// otherwise. If you don't know what this is for, then set it to
/// false.
///
+/// @param qualified_name if true, names emitted in the pretty
+/// representation are fully qualified.
+///
/// @return the pretty representation of the enum type.
string
-enum_type_decl::get_pretty_representation(bool internal) const
+enum_type_decl::get_pretty_representation(bool internal,
+ bool qualified_name) const
{
- string r = "enum " + decl_base::get_pretty_representation(internal);
+ string r = "enum " + decl_base::get_pretty_representation(internal,
+ qualified_name);
return r;
}
/// otherwise. If you don't know what this is for, then set it to
/// false.
///
+/// @param qualified_name if true, names emitted in the pretty
+/// representation are fully qualified.
+///
/// @return a copy of the pretty representation of the current
/// instance of typedef_decl.
string
-typedef_decl::get_pretty_representation(bool internal) const
+typedef_decl::get_pretty_representation(bool internal,
+ bool qualified_name) const
{
- string result = "typedef " + get_qualified_name(internal);
+
+ string result = "typedef ";
+ if (qualified_name)
+ result += get_qualified_name(internal);
+ else
+ result += get_name();
+
return result;
}
/// otherwise. If you don't know what this is for, then set it to
/// false.
///
+/// @param qualified_name if true, names emitted in the pretty
+/// representation are fully qualified.
+///
/// @return a copy of the pretty representation of this variable.
string
-var_decl::get_pretty_representation(bool internal) const
+var_decl::get_pretty_representation(bool internal, bool qualified_name) const
{
string result;
if (array_type_def_sptr t = is_array_type(get_type()))
{
string name;
- if (member_of_anonymous_class)
+ if (member_of_anonymous_class || !qualified_name)
name = get_name();
else
name = get_qualified_name(internal);
(is_class_or_union_type(get_type()),
"", /*one_line=*/true);
result += " ";
- if (member_of_anonymous_class)
+ if (member_of_anonymous_class || !qualified_name)
// It doesn't make sense to name the member of an
// anonymous class or union like:
// "__anonymous__::data_member_name". So let's just use
get_type_declaration(get_type())->get_qualified_name(internal)
+ " ";
- if (member_of_anonymous_class)
+ if (member_of_anonymous_class || !qualified_name)
// It doesn't make sense to name the member of an
// anonymous class or union like:
// "__anonymous__::data_member_name". So let's just use
/// @return a copy of the pretty representation of the current @ref
/// function_type.
string
-function_type::get_pretty_representation(bool internal) const
+function_type::get_pretty_representation(bool internal,
+ bool /*qualified_name*/) const
{return ir::get_pretty_representation(this, internal);}
/// Traverses an instance of @ref function_type, visiting all the
/// @return a copy of the pretty representation of the current @ref
/// method_type.
string
-method_type::get_pretty_representation(bool internal) const
+method_type::get_pretty_representation(bool internal,
+ bool /*qualified_name*/) const
{return ir::get_pretty_representation(*this, internal);}
/// Setter of the "is-const" property of @ref method_type.
///
/// @return the pretty representation for a function.
string
-function_decl::get_pretty_representation(bool internal) const
+function_decl::get_pretty_representation(bool internal,
+ bool /*qualified_name*/) const
{
const method_decl* mem_fn =
dynamic_cast<const method_decl*>(this);
/// @return a copy of the textual representation of the current
/// function parameter.
string
-function_decl::parameter::get_pretty_representation(bool internal) const
+function_decl::parameter::get_pretty_representation(bool internal,
+ bool /*qualified_name*/) const
{
const environment* env = get_environment();
ABG_ASSERT(env);
/// otherwise. If you don't know what this is for, then set it to
/// false.
///
+/// @param qualified_name if true, names emitted in the pretty
+/// representation are fully qualified.
+///
/// @return the pretty representaion for a class_decl.
string
-class_decl::get_pretty_representation(bool internal) const
+class_decl::get_pretty_representation(bool internal,
+ bool qualified_name) const
{
string cl = "class ";
if (!internal && is_struct())
/*one_line=*/true);
}
- return cl + get_qualified_name(internal);
+ string result = cl;
+ if (qualified_name)
+ result += get_qualified_name(internal);
+ else
+ result += get_name();
+
+ return result;
}
decl_base_sptr
/// otherwise. If you don't know what this is for, then set it to
/// false.
///
+/// @param qualified_name if true, names emitted in the pretty
+/// representation are fully qualified.
+///
/// @return the pretty representaion for a union_decl.
string
-union_decl::get_pretty_representation(bool internal) const
+union_decl::get_pretty_representation(bool internal,
+ bool qualified_name) const
{
string repr;
if (get_is_anonymous() && !internal)
repr = get_class_or_union_flat_representation(this, "",
/*one_line=*/true);
else
- repr = "union " + get_qualified_name(internal);
+ {
+ repr = "union ";
+ if (qualified_name)
+ repr += get_qualified_name(internal);
+ else
+ repr += get_name();
+ }
return repr;
}