[COMMITED] ada: Make Original_Aspect_Pragma_Name more precise

Message ID 20220926091511.273296-1-poulhies@adacore.com
State New, archived
Headers
Series [COMMITED] ada: Make Original_Aspect_Pragma_Name more precise |

Commit Message

Marc Poulhiès Sept. 26, 2022, 9:15 a.m. UTC
  From: Tucker Taft <taft@adacore.com>

This commit makes Original_Aspect_Pragma_Name more precise in cases
where there is a second level of indirection caused by pragmas being
turned into Check pragmas.

gcc/ada/

	* sem_util.adb (Original_Aspect_Pragma_Name): Check for Check
	pragmas.
---
 gcc/ada/sem_util.adb | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Patch

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index c43a008ae5d..9ae082ca2e1 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -26559,6 +26559,14 @@  package body Sem_Util is
          Item_Nam :=
            Chars (Original_Node (Pragma_Identifier (Original_Node (Item))));
 
+         if Item_Nam = Name_Check then
+            --  Pragma "Check" preserves the original pragma name as its first
+            --  argument.
+            Item_Nam :=
+              Chars (Expression (First (Pragma_Argument_Associations
+                (Original_Node (Item)))));
+         end if;
+
       else
          pragma Assert (Nkind (Item) = N_Aspect_Specification);
          Item_Nam := Chars (Identifier (Item));