https://gcc.gnu.org/g:c895db1080349d230a2c23f544905b4c703a5ee4

commit r15-4654-gc895db1080349d230a2c23f544905b4c703a5ee4
Author: Tom Tromey <tro...@adacore.com>
Date:   Wed Jul 10 11:29:11 2024 -0600

    ada: Standard types are not artificial
    
    This changes gigi so that standard types are no longer marked
    artificial.  This change is needed to prevent subsequent patches from
    causing standard types to have their names elided.  Also, although
    DWARF says that DW_AT_artificial is used for "the declaration of an
    object or type artificially generated by a compiler and not explicitly
    declared by the source program", it seems to me that types provided by
    the language should not be marked as such; and this is what the C and
    C++ compilers do.
    
    gcc/ada/ChangeLog:
    
            * gcc-interface/decl.cc (is_artificial): New function.
            (gnat_to_gnu_entity): Use it.

Diff:
---
 gcc/ada/gcc-interface/decl.cc | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index f22dea0d2cfe..aa22c495a169 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -259,6 +259,18 @@ typedef struct {
 
 static bool intrin_profiles_compatible_p (const intrin_binding_t *);
 
+/* Return true if GNAT_ENTITY is artificial, false otherwise.  */
+
+static bool
+is_artificial (Entity_Id gnat_entity)
+{
+  if (Comes_From_Source (gnat_entity))
+    return false;
+  if (Sloc (gnat_entity) == Standard_Location)
+    return false;
+  return true;
+}
+
 /* Given GNAT_ENTITY, a GNAT defining identifier node, which denotes some Ada
    entity, return the equivalent GCC tree for that entity (a ..._DECL node)
    and associate the ..._DECL node with the input GNAT defining identifier.
@@ -284,7 +296,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, 
bool definition)
   /* True if this is a type.  */
   const bool is_type = IN (kind, Type_Kind);
   /* True if this is an artificial entity.  */
-  const bool artificial_p = !Comes_From_Source (gnat_entity);
+  const bool artificial_p = is_artificial (gnat_entity);
   /* True if debug info is requested for this entity.  */
   const bool debug_info_p = Needs_Debug_Info (gnat_entity);
   /* True if this entity is to be considered as imported.  */
@@ -3006,7 +3018,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, 
bool definition)
                 in order to decode the packed array type.  */
              tree gnu_tmp_decl
                = create_type_decl (gnu_entity_name, gnu_type,
-                                   !Comes_From_Source (Etype (gnat_entity))
+                                   is_artificial (Etype (gnat_entity))
                                    && artificial_p, debug_info_p,
                                    gnat_entity);
              /* Save it as our equivalent in case the call below elaborates

Reply via email to