On Fri, Jul 21, 2017 at 10:33:12PM +0200, Jakub Jelinek wrote:
> Hi!
> 
> DWARF5 introduced DW_AT_export_symbols that may be preset on
> DW_TAG_namespace or DW_TAG_{structure,union,class}_type to signalize
> inline or anonymous namespaces or anonymous structures/unions/classes.
> 
> What we were emitting instead is an implicit DW_TAG_imported_module
> in the outer namespace.
> 
> The following patch changes nothing for -gdwarf-4 and below with
> -gstrict-dwarf, for -gdwarf-4 and below -gno-strict-dwarf it
> just adds DW_AT_export_symbols to inline namespaces (so that interested
> consumers can find out it is inline namespace, but consumers not knowing
> about DW_AT_export_symbols still have the implicit DW_TAG_imported_module).
> In that mode, no changes for anonymous namespaces, because those
> are already easily detectable by the consumers (missing DW_AT_name).
> For -gdwarf-5 it emits DW_AT_export_symbols on both inline namespaces
> and anonymous namespaces and doesn't emit the implicit
> DW_TAG_imported_module, which is shorter.
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> This patch doesn't do anything about anon struct/union/class, I've tried
> to handle it, the problem is that ANON_AGGR_TYPE_P flag is set too late,
> after the debug hook adds the type DIE.  Any thoughts on how to handle that?
> And I wonder what is the counterpart of ANON_AGGR_TYPE_P in the C FE, CCing
> Marek on that.

I think you need to check RECORD_OR_UNION_TYPE_P && DECL_NAME == NULL_TREE.
Or do it in grokfield -- would that work?

        Marek

Reply via email to