mirror of
git://sourceware.org/git/libabigail.git
synced 2025-01-29 12:42:50 +00:00
Fix synthesizing of reference type
Libabigail fails to synthesize a non-existing reference type to an existing type. This is similar to the previous commit "2f88edd Fix synthesizing of pointer type" which, obviously dealt with pointer types. This patch adds support for synthesizing a reference type to an existing type. * src/abg-ir.cc (synthesize_type_from_translation_unit): Support synthesizing reference types. * tests/data/test-abicompat/libtest9-fn-changed-v0.so: Add new test input. * tests/data/test-abicompat/libtest9-fn-changed-v1.so: Likewise. * tests/data/test-abicompat/test9-fn-changed-app: Likewise. * tests/data/test-abicompat/test9-fn-changed-app.cc: : Likewise. * tests/data/test-abicompat/test9-fn-changed-report-0.txt: Likewise. * tests/data/test-abicompat/test9-fn-changed-v0.cc: Likewise. * tests/data/test-abicompat/test9-fn-changed-v0.h: Likewise. * tests/data/test-abicompat/test9-fn-changed-v1.cc: Likewise. * tests/data/test-abicompat/test9-fn-changed-v1.h: Likewise. * tests/data/Makefile.am: Add the new material to source distribution. * tests/test-abicompat.cc (in_out_specs): Add the new test inputs to the test harness. Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
2f88edd3b3
commit
31aef952c8
@ -5874,6 +5874,20 @@ synthesize_type_from_translation_unit(const type_base_sptr& type,
|
||||
result->set_environment(pointed_to_type->get_environment());
|
||||
}
|
||||
}
|
||||
else if (reference_type_def_sptr r = is_reference_type(type))
|
||||
{
|
||||
type_base_sptr pointed_to_type =
|
||||
synthesize_type_from_translation_unit(r->get_pointed_to_type(), tu);
|
||||
if (pointed_to_type)
|
||||
{
|
||||
result.reset(new reference_type_def(pointed_to_type,
|
||||
r->is_lvalue(),
|
||||
r->get_size_in_bits(),
|
||||
r->get_alignment_in_bits(),
|
||||
r->get_location()));
|
||||
result->set_environment(pointed_to_type->get_environment());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result)
|
||||
|
@ -924,6 +924,15 @@ test-abicompat/test8-fn-changed-libapp-v0.h \
|
||||
test-abicompat/test8-fn-changed-libapp-v1.c \
|
||||
test-abicompat/test8-fn-changed-libapp-v1.h \
|
||||
test-abicompat/test8-fn-changed-report-0.txt \
|
||||
test-abicompat/libtest9-fn-changed-v0.so \
|
||||
test-abicompat/libtest9-fn-changed-v1.so \
|
||||
test-abicompat/test9-fn-changed-app.cc \
|
||||
test-abicompat/test9-fn-changed-v0.cc \
|
||||
test-abicompat/test9-fn-changed-v0.h \
|
||||
test-abicompat/test9-fn-changed-v1.cc \
|
||||
test-abicompat/test9-fn-changed-v1.h \
|
||||
test-abicompat/test9-fn-changed-app \
|
||||
test-abicompat/test9-fn-changed-report-0.txt \
|
||||
\
|
||||
test-diff-pkg/dbus-glib-0.104-3.fc23.x86_64.rpm \
|
||||
test-diff-pkg/dbus-glib-0.80-3.fc12.x86_64.rpm \
|
||||
|
BIN
tests/data/test-abicompat/libtest9-fn-changed-v0.so
Executable file
BIN
tests/data/test-abicompat/libtest9-fn-changed-v0.so
Executable file
Binary file not shown.
BIN
tests/data/test-abicompat/libtest9-fn-changed-v1.so
Executable file
BIN
tests/data/test-abicompat/libtest9-fn-changed-v1.so
Executable file
Binary file not shown.
BIN
tests/data/test-abicompat/test9-fn-changed-app
Executable file
BIN
tests/data/test-abicompat/test9-fn-changed-app
Executable file
Binary file not shown.
13
tests/data/test-abicompat/test9-fn-changed-app.cc
Normal file
13
tests/data/test-abicompat/test9-fn-changed-app.cc
Normal file
@ -0,0 +1,13 @@
|
||||
// Compile this with:
|
||||
//
|
||||
// gcc -g -Wall -L. -ltest9-fn-changed-v0 -o libtest9-fn-changed-app test9-fn-changed-app.cc
|
||||
//
|
||||
|
||||
#include "test9-fn-changed-v0.h"
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
S s;
|
||||
return foo(s);
|
||||
}
|
10
tests/data/test-abicompat/test9-fn-changed-report-0.txt
Normal file
10
tests/data/test-abicompat/test9-fn-changed-report-0.txt
Normal file
@ -0,0 +1,10 @@
|
||||
functions defined in library 'libtest9-fn-changed-v1.so'
|
||||
have sub-types that are different from what application 'test9-fn-changed-app' expects:
|
||||
|
||||
function int foo(S&):
|
||||
parameter 1 of type 'S&' has sub-type changes:
|
||||
in referenced type 'struct S' at test9-fn-changed-v1.h:1:1:
|
||||
type size changed from 32 to 64 bits
|
||||
1 data member insertion:
|
||||
'char S::m1', at offset 32 (in bits) at test9-fn-changed-v1.h:4:1
|
||||
|
10
tests/data/test-abicompat/test9-fn-changed-v0.cc
Normal file
10
tests/data/test-abicompat/test9-fn-changed-v0.cc
Normal file
@ -0,0 +1,10 @@
|
||||
// Compile this with:
|
||||
//
|
||||
// gcc -g -Wall -shared -o libtest9-fn-changed-v0.so test9-fn-changed-v0.cc
|
||||
//
|
||||
|
||||
#include "test9-fn-changed-v0.h"
|
||||
|
||||
int
|
||||
foo(S& s)
|
||||
{return s.m0;}
|
11
tests/data/test-abicompat/test9-fn-changed-v0.h
Normal file
11
tests/data/test-abicompat/test9-fn-changed-v0.h
Normal file
@ -0,0 +1,11 @@
|
||||
struct S
|
||||
{
|
||||
int m0;
|
||||
|
||||
S()
|
||||
: m0()
|
||||
{}
|
||||
};
|
||||
|
||||
int
|
||||
foo(S&);
|
9
tests/data/test-abicompat/test9-fn-changed-v1.cc
Normal file
9
tests/data/test-abicompat/test9-fn-changed-v1.cc
Normal file
@ -0,0 +1,9 @@
|
||||
// Compile this with:
|
||||
//
|
||||
// gcc -g -Wall -shared -o libtest9-fn-changed-v1.so test9-fn-changed-v1.cc
|
||||
//
|
||||
#include "test9-fn-changed-v1.h"
|
||||
|
||||
int
|
||||
foo(S& s)
|
||||
{return s.m0 + s.m1;}
|
12
tests/data/test-abicompat/test9-fn-changed-v1.h
Normal file
12
tests/data/test-abicompat/test9-fn-changed-v1.h
Normal file
@ -0,0 +1,12 @@
|
||||
struct S
|
||||
{
|
||||
int m0;
|
||||
char m1;
|
||||
|
||||
S()
|
||||
: m0(), m1()
|
||||
{}
|
||||
};
|
||||
|
||||
int
|
||||
foo(S&);
|
@ -191,6 +191,15 @@ InOutSpec in_out_specs[] =
|
||||
"data/test-abicompat/test8-fn-changed-report-0.txt",
|
||||
"output/test-abicompat/test8-fn-changed-report-0.txt",
|
||||
},
|
||||
{
|
||||
"data/test-abicompat/test9-fn-changed-app",
|
||||
"data/test-abicompat/libtest9-fn-changed-v1.so ",
|
||||
"",
|
||||
"",
|
||||
"--show-base-names --weak-mode",
|
||||
"data/test-abicompat/test9-fn-changed-report-0.txt",
|
||||
"output/test-abicompat/test9-fn-changed-report-0.txt",
|
||||
},
|
||||
// This entry must be the last one.
|
||||
{0, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user