Hi,

dwarf2out.c has this trick:

/* Define a macro which returns nonzero for a TYPE_DECL which was
   implicitly generated for a tagged type.

   Note that unlike the gcc front end (which generates a NULL named
   TYPE_DECL node for each complete tagged type, each array type, and
   each function type node created) the g++ front end generates a
   _named_ TYPE_DECL node for each tagged type node created.
   These TYPE_DECLs have DECL_ARTIFICIAL set, so we know not to
   generate a DW_TAG_typedef DIE for them.  */

#define TYPE_DECL_IS_STUB(decl)                         \
  (DECL_NAME (decl) == NULL_TREE                        \
   || (DECL_ARTIFICIAL (decl)                           \
       && is_tagged_type (TREE_TYPE (decl))             \
       && ((decl == TYPE_STUB_DECL (TREE_TYPE (decl)))  \
           /* This is necessary for stub decls that     \
              appear in nested inline functions.  */    \
           || (DECL_ABSTRACT_ORIGIN (decl) != NULL_TREE \
               && (decl_ultimate_origin (decl)          \
                   == TYPE_STUB_DECL (TREE_TYPE (decl)))))))


The Ada compiler behaves like the C++ compiler: it creates a named TYPE_DECL 
and sets DECL_ARTIFICIAL when there is no declaration in the source code.

The difference is that there are no "tagged" types in Ada, at least in the C 
sense; (essentially) all types are equal.  So we would need to extend the 
trick to all types in Ada, i.e. remove the is_tagged_type condition.  Would 
that work for other languages as well, in particular C++?

-- 
Eric Botcazou

Reply via email to