DECL_NAME() yields ._69 for anonymous union parsed with g++

Peter Colberg peter@colberg.org
Sat Nov 10 22:20:00 GMT 2012


On Fri, Nov 09, 2012 at 12:28:03AM -0500, Peter Colberg wrote:
> How can one differentiate between a named and an unnamed union, if
> the TYPE_DECL node has an (user- or compiler-generated) identifier
> in both cases?

Ok, I got it. The name format is defined as ANON_AGGRNAME_FORMAT.
The function responsible for naming anonymous structs/unions is
make_anon_name().

Use TYPE_ANONYMOUS_P() to check for anonymous structs/unions:

#include "cp/cp-tree.h"

RECORD_OR_UNION_CODE_P(TREE_CODE(node)) && TYPE_ANONYMOUS_P(node))


I hope my monologues on the GCC lists are useful to someone ;-).

Peter



More information about the Gcc-help mailing list