[Ada] Revise Storage_Model_Support operations to do checks and take objects and types
commit21f8b410511d1ee9a46b7a902a368762f6256ea0
authorGary Dismukes <dismukes@adacore.com>
Tue, 8 Mar 2022 23:21:48 +0000 (8 18:21 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Mon, 16 May 2022 08:42:04 +0000 (16 08:42 +0000)
tree02d1a1c310fd0467e88c1ca9cb1735d09e0674bb
parentae745a0de34892d0d1e7157292628c375a94221f
[Ada] Revise Storage_Model_Support operations to do checks and take objects and types

The functions in subpackage Storage_Model_Support (apart from the
Has_*_Aspect functions) are revised to have assertions that will fail
when passed a parameter that doesn't specify the appropriate aspect
(either aspect Storage_Model_Type or Designated_Storage_Model), instead
of returning Empty for bad arguments. Also, various of the functions now
allow either a type with aspect Storage_Model_Type or an object of such
a type.

gcc/ada/

* sem_util.ads (Storage_Model_Support): Revise comments on most
operations within this nested package to reflect that they can
now be passed either a type that has aspect Storage_Model_Type
or an object of such a type.  Change the names of the relevant
formals to SM_Obj_Or_Type. Also, add more precise semantic
descriptions in some cases, and declare the subprograms in a
more logical order.
* sem_util.adb (Storage_Model_Support.Storage_Model_Object): Add
an assertion that the type must specify aspect
Designated_Storage_Model, rather than returning Empty when it
doesn't specify that aspect.
(Storage_Model_Support.Storage_Model_Type): Add an assertion
that formal must be an object whose type specifies aspect
Storage_Model_Type, rather than returning Empty for when it
doesn't have such a type (and test Has_Storage_Model_Type_Aspect
rather than Find_Value_Of_Aspect).
(Storage_Model_Support.Get_Storage_Model_Type_Entity): Allow
both objects and types, and add an assertion that the type (or
the type of the object) has a value for aspect
Storage_Model_Type.
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads