ostream& o = ctxt.get_ostream();
const config& c = ctxt.get_config();
- // In a given translation unit, we'd like to ensure that a given
- // type is defined only once. The same type can be present in
- // several translation units, though. They'll be canonicalized
- // later, by the reader's code.
- //
- // So lets clear the map that contains the types that are emitted in
- // the translation unit tu.
- ctxt.clear_emitted_types_map();
- ctxt.clear_referenced_types_map();
-
do_indent(o, indent);
o << "<abi-instr version='"
ctxt.record_type_as_referenced(pointed_to_type);
- if (function_type_sptr f = is_function_type(decl->get_pointed_to_type()))
- ctxt.record_type_as_referenced(f);
-
write_size_and_alignment(decl, o);
string i = id;
o << " dimensions='" << decl->get_dimension_count() << "'";
- o << " type-id='" << ctxt.get_id_for_type(decl->get_element_type()) << "'";
+ type_base_sptr element_type = decl->get_element_type();
+ o << " type-id='" << ctxt.get_id_for_type(element_type) << "'";
+
+ ctxt.record_type_as_referenced(element_type);
write_array_size_and_alignment(decl, o);
o << ">\n";
+ type_base_sptr parm_type;
vector<shared_ptr<function_decl::parameter> >::const_iterator pi =
decl->get_parameters().begin();
for ((skip_first_parm && pi != decl->get_parameters().end()) ? ++pi: pi;
o << "<parameter is-variadic='yes'";
else
{
+ parm_type = (*pi)->get_type();
o << "<parameter type-id='"
- << ctxt.get_id_for_type((*pi)->get_type())
+ << ctxt.get_id_for_type(parm_type)
<< "'";
+ ctxt.record_type_as_referenced(parm_type);
if (!(*pi)->get_name().empty())
o << " name='" << (*pi)->get_name() << "'";
{
do_indent(o, indent + ctxt.get_config().get_xml_element_indent());
o << "<return type-id='" << ctxt.get_id_for_type(return_type) << "'/>\n";
+ ctxt.record_type_as_referenced(return_type);
}
do_indent(o, indent);
<< ctxt.get_id_for_type(decl) << "'";
o << ">\n";
+ type_base_sptr parm_type;
for (vector<shared_ptr<function_decl::parameter> >::const_iterator pi =
decl->get_parameters().begin();
pi != decl->get_parameters().end();
o << "<parameter is-variadic='yes'";
else
{
+ parm_type = (*pi)->get_type();
o << "<parameter type-id='"
- << ctxt.get_id_for_type((*pi)->get_type())
+ << ctxt.get_id_for_type(parm_type)
<< "'";
+ ctxt.record_type_as_referenced(parm_type);
if (!(*pi)->get_name().empty())
o << " name='" << (*pi)->get_name() << "'";
{
do_indent(o, indent + ctxt.get_config().get_xml_element_indent());
o << "<return type-id='" << ctxt.get_id_for_type(return_type) << "'/>\n";
+ ctxt.record_type_as_referenced(return_type);
}
do_indent(o, indent);
o << ">\n";
unsigned nb_ws = get_indent_to_level(ctxt, indent, 1);
+ type_base_sptr base_type;
for (class_decl::base_specs::const_iterator base =
decl->get_base_specifiers().begin();
base != decl->get_base_specifiers().end();
if ((*base)->get_is_virtual ())
o << " is-virtual='yes'";
+ base_type = (*base)->get_base_class();
o << " type-id='"
- << ctxt.get_id_for_type((*base)->get_base_class())
+ << ctxt.get_id_for_type(base_type)
<< "'/>\n";
+
+ ctxt.record_type_as_referenced(base_type);
}
for (class_decl::member_types::const_iterator ti =
o << "</class-decl>";
}
- if (!(decl->get_is_declaration_only()
- && decl->get_definition_of_declaration()))
+ // We allow several *declarations* of the same class in the corpus,
+ // but only one definition.
+ if (!decl->get_is_declaration_only())
ctxt.record_type_as_emitted(decl);
return true;