Don't blindly drop DIEs defined in the scope of a function

* src/abg-dwarf-reader.cc (get_scope_for_die): Do not drop a DIE
	on the floor just because it is in the scope of a function.  We
	were dropping a function parameter because its type is a typedef
	defined right before the parameter, in the scope of the function.
	Urgh.  So with this change, that function parameter is not dropped
	anymore.  I have seen that happening in a DWARF generated by GCC
	4.7.1 on libstdc++.so.  Hard to come up with a regression test
	case for this one.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2014-04-17 13:21:40 +02:00
parent 57ceb9e3d1
commit fffb903ea0

View File

@ -1920,15 +1920,21 @@ get_scope_for_die(read_context& ctxt,
scope_decl_sptr s;
decl_base_sptr d;
if (dwarf_tag(&parent_die) == DW_TAG_subprogram)
;
// this is an entity defined in a scope that is a function.
// Normally, I would say that this should be dropped. But I have
// seen a case where a typedef DIE needed by a function parameter
// was defined right before the parameter, under the scope of the
// function. Yeah, weird. So if I drop the typedef DIE, I'd drop
// the function parm too. So for that case, let's say that the
// scope is the scope of the function itself.
return get_scope_for_die(ctxt, &parent_die, called_for_public_decl);
else
d = build_ir_node_from_die(ctxt, &parent_die,
called_for_public_decl);
s = dynamic_pointer_cast<scope_decl>(d);
if (!s)
// this is an entity defined in a scope that is e.g, a
// function. It cannot be public from an ABI standpoint, so
// let's just drop it.
// this is an entity defined in someting that is not a scope.
// Let's drop it.
return scope_decl_sptr();
class_decl_sptr cl = dynamic_pointer_cast<class_decl>(d);