Fix the pretty representation for member functions

* src/abg-ir.cc (function_decl::get_pretty_representation): Fix
	this to properly display the representation of member functions.
	* tests/data/test-bidiff/test-enum0-report.txt: Update this.
	* tests/data/test-bidiff/test-enum1-report.txt: Likewise.
	* tests/data/test-bidiff/test-qual-type0-report.txt: Likewise.
	* tests/data/test-bidiff/test-struct0-report.txt: Likewise.
	* tests/data/test-bidiff/test-struct1-report.txt: Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2014-02-11 16:17:50 +01:00
parent 9b1e3cd86a
commit 2c3dbbdb62
6 changed files with 22 additions and 11 deletions

View File

@ -2141,15 +2141,26 @@ function_decl::get_pretty_representation() const
dynamic_cast<const class_decl::member_function*>(this);
string result = mem_fn ? "method ": "function ";
decl_base_sptr type = dynamic_pointer_cast<decl_base>(get_return_type());
decl_base_sptr type =
mem_fn
? get_type_declaration(mem_fn->get_type()->get_return_type())
: get_type_declaration(get_type()->get_return_type());
if (type)
result += type->get_qualified_name() + " ";
else if (!(mem_fn && (mem_fn->is_destructor() || mem_fn->is_constructor())))
result += "void ";
if (mem_fn && mem_fn->is_destructor())
result += "~";
result += get_qualified_name() + "(";
if (mem_fn)
result += mem_fn->get_type()->get_class_type()->get_qualified_name()
+ "::" + mem_fn->get_name();
else
result += get_qualified_name();
result += "(";
parameters::const_iterator i = get_parameters().begin(),
end = get_parameters().end();

View File

@ -8,7 +8,7 @@
1 changed declaration:
'function void foo(E)' was changed to 'function void foo(E)':
parameter 0 of type 'E' changed:
parameter 0 of type 'enum E' changed:
1 enumerator deletion:
'E::e2' value '1'

View File

@ -8,7 +8,7 @@
1 changed declaration:
'function void foo(E)' was changed to 'function void foo(E)':
parameter 0 of type 'E' changed:
parameter 0 of type 'enum E' changed:
1 enumerator insertion:
'E::e1' value '1'

View File

@ -3,7 +3,7 @@
size changed from 32 to 64 bits
1 member type change:
'typedef S0::S0' changed:
underlying type class S0 changed; details are being reported
underlying type 'class S0' changed; details are being reported
1 data member insertion:
'char S0::m1', at offset 32 (in bits)

View File

@ -3,10 +3,10 @@
size changed from 64 to 96 bits
1 member type change:
'typedef s0::s0' changed:
underlying type class s0 changed; details are being reported
underlying type 'class s0' changed; details are being reported
1 data member change:
'char s0::m1' type changed:
type of 'char s0::m1' changed:
name changed from 'char' to 'unsigned int'
size changed from 8 to 32 bits
alignment changed from 8 to 32 bits

View File

@ -4,9 +4,9 @@
size changed from 192 to 256 bits
2 member type changes:
'typedef s0::s0' changed:
underlying type class s0 changed; details are being reported
underlying type 'class s0' changed; details are being reported
'typedef s0::number_type' changed:
underlying type changed:
underlying type 'int' changed:
name changed from 'int' to 'char'
size changed from 32 to 8 bits
alignment changed from 32 to 8 bits
@ -18,8 +18,8 @@
'char s0::m1', at offset 96 (in bits)
2 data member changes:
's0::m2' offset changed from 128 to 192
'int s0::m0' type changed:
'unsigned int s0::m2' offset changed from 128 to 192
type of 'int s0::m0' changed:
name changed from 'int' to 'char'
size changed from 32 to 8 bits
alignment changed from 32 to 8 bits