diff mbox

[Ada] Pragma Constant_After_Elaboration

Message ID 20151020094538.GA110539@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 20, 2015, 9:45 a.m. UTC
This patch allows for external tools that utilize the front end abstract syntax
tree to querry for pragma Constant_After_Elaboration in the N_Contract node of
a variable. No change in behavior, no need for a test.

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

2015-10-20  Hristian Kirtchev  <kirtchev@adacore.com>

	* einfo.adb (Get_Pragma): Minor reformatting. Rename local constant
	Is_CDG to Is_CLS. Add pragma Constant_After_Elaboration to the list of
	classification pragmas.
diff mbox

Patch

Index: einfo.adb
===================================================================
--- einfo.adb	(revision 229023)
+++ einfo.adb	(working copy)
@@ -6980,30 +6980,40 @@ 
    ----------------
 
    function Get_Pragma (E : Entity_Id; Id : Pragma_Id) return Node_Id is
-      Is_CDG  : constant Boolean :=
-                  Id = Pragma_Abstract_State     or else
-                  Id = Pragma_Async_Readers      or else
-                  Id = Pragma_Async_Writers      or else
-                  Id = Pragma_Depends            or else
-                  Id = Pragma_Effective_Reads    or else
-                  Id = Pragma_Effective_Writes   or else
-                  Id = Pragma_Extensions_Visible or else
-                  Id = Pragma_Global             or else
-                  Id = Pragma_Initial_Condition  or else
-                  Id = Pragma_Initializes        or else
-                  Id = Pragma_Part_Of            or else
-                  Id = Pragma_Refined_Depends    or else
-                  Id = Pragma_Refined_Global     or else
-                  Id = Pragma_Refined_State;
+
+      --  Classification pragmas
+
+      Is_CLS : constant Boolean :=
+                 Id = Pragma_Abstract_State             or else
+                 Id = Pragma_Async_Readers              or else
+                 Id = Pragma_Async_Writers              or else
+                 Id = Pragma_Constant_After_Elaboration or else
+                 Id = Pragma_Depends                    or else
+                 Id = Pragma_Effective_Reads            or else
+                 Id = Pragma_Effective_Writes           or else
+                 Id = Pragma_Extensions_Visible         or else
+                 Id = Pragma_Global                     or else
+                 Id = Pragma_Initial_Condition          or else
+                 Id = Pragma_Initializes                or else
+                 Id = Pragma_Part_Of                    or else
+                 Id = Pragma_Refined_Depends            or else
+                 Id = Pragma_Refined_Global             or else
+                 Id = Pragma_Refined_State;
+
+      --  Contract / test case pragmas
+
       Is_CTC : constant Boolean :=
-                  Id = Pragma_Contract_Cases     or else
+                  Id = Pragma_Contract_Cases            or else
                   Id = Pragma_Test_Case;
+
+      --  Pre / postcondition pragmas
+
       Is_PPC : constant Boolean :=
-                  Id = Pragma_Precondition       or else
-                  Id = Pragma_Postcondition      or else
+                  Id = Pragma_Precondition              or else
+                  Id = Pragma_Postcondition             or else
                   Id = Pragma_Refined_Post;
 
-      In_Contract : constant Boolean := Is_CDG or Is_CTC or Is_PPC;
+      In_Contract : constant Boolean := Is_CLS or Is_CTC or Is_PPC;
 
       Item  : Node_Id;
       Items : Node_Id;
@@ -7018,7 +7028,7 @@ 
          if No (Items) then
             return Empty;
 
-         elsif Is_CDG then
+         elsif Is_CLS then
             Item := Classifications (Items);
 
          elsif Is_CTC then