libabigail/tests/data/test-read-write/test12.xml
Dodji Seketeli d3b188f859 Fix template parameter hashing: make it know about enclosing template
* include/abg-ir.h (template_parameter_sptr, template_decl_sptr)
	(template_decl_wptr): Declare new typedefs.
	(class template_decl): Make this virtually inherit decl_base and
	pimpl-ify it.
	(class template_parameter): Pimpl-ify this.  Make the constructor
	take the enclosing template parameter.
	(struct template_decl::hash): Declare this here, rather than in
	src/abg-hash.cc
	(class type_tparameter, non_type_tparameter, template_tparameter)
	(class type_composition, function_tdecl, class_tdecl): Pimpl-ify
	this.
	* src/abg-hash.cc (template_parameter:#️⃣:operator()): Hash the
	enclosing template parameter.  Avoid infinite recursion due to the
	loop hash parameter -> hash template -> hash parameter.
	(template_decl:#️⃣:operator()) Define this here, now that it's
	declared in abg-ir.h.  Also, avoid infinite recursion here; this
	is complementary to what is done in the hashing for
	template_parameter.
	({type_tparameter, template_tparameter, }:#️⃣:operator()):
	Cache the calculated hash just as what is done for other types
	hashed.
	(template_decl::priv): Define this new type.
	(template_decl::{add_template_parameter, get_template_parameters,
	~template_decl}): Define these here to pimpl-ify template_decl.
	(template_parameter::priv): Define this new type.
	(template_parameter::template_parameter): Define this here to
	pimpl-ify template_parameter.  Note also that this now takes the
	enclosing template decl.
	(template_parameter::{get_index, get_enclosing_template_decl,
	get_hashing_has_started, set_hashing_has_started, operator::==}):
	Define these here to pimpl-ify template_parameter.
	(type_tparameter::priv): Define this new type.
	(type_tparameter::type_tparameter): Define this here to pimpl-ify
	type_tparameter.   Also, not that this constructor now takes the
	enclosing template decl.
	(class non_type_tparameter::priv): Define new type.
	(non_type_tparameter::{non_type_tparameter, get_type}): Define
	these here to pimpl-ify non_type_tparameter.  The constructor now
	takes the enclosing template.
	(template_tparameter::priv): Define new type.
	(template_tparameter::template_tparameter): Define this here to
	pimpl-ify template_tparameter.  This constructor now takes the
	enclosing template.
	(class type_composition::priv): New type.
	(type_composition::{type_composition, get_composed_type,
	set_composed_type}): Define these here to pimpl-ify
	type_composition.  The constructor now takes the enclosing
	template decl.
	(class function_tdecl::priv): Define new type.
	(function_tdecl::{function_tdecl, set_pattern, get_pattern,
	get_binding}): Define this here to pimpl-ify function_tdecl.
	(class class_tdecl::priv): Define this new type.
	(class_tdecl::class_tdecl): Define this here to pimpl-ify
	class_tdecl.
	(class_tdecl::set_pattern): Adjust to pimpl-ify.
	(class_tdecl::get_pattern): Define new pimpl-ified getter.
	* src/abg-reader.cc (build_function_tdecl, build_class_tdecl):
	Cleanup.  Pass the enclosing template to the template parameters
	that are built.
	(build_type_tparameter, build_type_composition)
	(build_non_type_tparameter, build_template_tparameter)
	(build_template_parameter): Take the enclosing template
	declaration and pass it to the template parameter being created.
	* tests/data/test-read-write/test12.xml: Fix and Adjust.
	* tests/data/test-read-write/test13.xml: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2014-11-07 12:16:34 +01:00

30 lines
1.2 KiB
XML

<abi-instr version='1.0' path='data/test-read-write/test12.xml'>
<type-decl name='int' size-in-bits='32' alignment-in-bits='32' id='type-id-1'/>
<namespace-decl name='ns0'>
<namespace-decl name='ns1'>
<function-template-decl id='fn-tmpl-id-2'>
<template-type-parameter id='type-id-3' name='T'/>
<template-type-parameter id='type-id-4' name='U'/>
<function-decl name='foo' binding='global' size-in-bits='8' alignment-in-bits='8'>
<parameter type-id='type-id-3' name='first'/>
<parameter type-id='type-id-4' name='second'/>
<return type-id='type-id-1'/>
</function-decl>
</function-template-decl>
</namespace-decl>
</namespace-decl>
<namespace-decl name='ns2'>
<namespace-decl name='ns3'>
<namespace-decl name='ns4'>
<function-template-decl id='fn-tmpl-id-5'>
<template-type-parameter id='type-id-6' name='T'/>
<function-decl name='bar' binding='global'>
<parameter type-id='type-id-6' name='first'/>
<return type-id='type-id-1'/>
</function-decl>
</function-template-decl>
</namespace-decl>
</namespace-decl>
</namespace-decl>
</abi-instr>