[Ada] Improve the function that computes a unique name for Entities

Arnaud Charlet charlet@adacore.com
Fri Sep 2 09:54:00 GMT 2011


The function Unique_Name did not actually compute a unique name for
enumeration literals, because the type to which the literal belongs was not
taken into account. This patch fixes the issue.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-09-02  Johannes Kanig  <kanig@adacore.com>

	* sem_util.adb (Unique_Name): To obtain a unique name for enumeration
	literals, take into account the type name; the type is *not*
	the scope for an enumeration literal.

-------------- next part --------------
Index: sem_util.adb
===================================================================
--- sem_util.adb	(revision 178440)
+++ sem_util.adb	(working copy)
@@ -12747,6 +12747,8 @@
       then
          return Get_Name_String (Name_Standard) & "__" &
            Get_Name_String (Chars (E));
+      elsif Ekind (E) = E_Enumeration_Literal then
+         return Unique_Name (Etype (E)) & "__" & Get_Name_String (Chars (E));
 
       else
          return Get_Scoped_Name (E);


More information about the Gcc-patches mailing list