diff options
author | Bob Duff <duff@adacore.com> | 2015-05-22 10:36:56 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2015-05-22 12:36:56 +0200 |
commit | ca811241793e95b1c7be841dda57e459dd03b2eb (patch) | |
tree | 649f3ba91b6b3b3ce8a2e5c37a6b94d090f1caf1 /gcc/ada/exp_util.ads | |
parent | a95f708ec32470ae773950928c3fb1962d0ec86e (diff) | |
download | gcc-ca811241793e95b1c7be841dda57e459dd03b2eb.zip gcc-ca811241793e95b1c7be841dda57e459dd03b2eb.tar.gz gcc-ca811241793e95b1c7be841dda57e459dd03b2eb.tar.bz2 |
exp_utils.ads, [...] (Find_Optional_Prim_Op): New interface to return Empty when not found...
2015-05-22 Bob Duff <duff@adacore.com>
* exp_utils.ads, exp_utils.adb (Find_Optional_Prim_Op): New
interface to return Empty when not found, so we can avoid handling
Program_Error in that case.
(Find_Prim_Op): Fix latent bug: raise Program_Error when there are no
primitives.
* exp_ch7.adb, sem_util.adb: Use Find_Optional_Prim_Op when the
code is expecting Empty.
* sem_ch8.adb: Use Find_Optional_Prim_Op to avoid handling
Program_Error.
From-SVN: r223541
Diffstat (limited to 'gcc/ada/exp_util.ads')
-rw-r--r-- | gcc/ada/exp_util.ads | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index a7d8f4c..01f4377 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -471,9 +471,8 @@ package Exp_Util is -- Find the first primitive operation of a tagged type T with name Name. -- This function allows the use of a primitive operation which is not -- directly visible. If T is a class wide type, then the reference is to an - -- operation of the corresponding root type. Raises Program_Error exception - -- if no primitive operation is found. This is normally an internal error, - -- but in some cases is an expected consequence of illegalities elsewhere. + -- operation of the corresponding root type. It is an error if no primitive + -- operation with the given name is found. function Find_Prim_Op (T : Entity_Id; @@ -483,16 +482,19 @@ package Exp_Util is -- with the indicated suffix). This function allows use of a primitive -- operation which is not directly visible. If T is a class wide type, -- then the reference is to an operation of the corresponding root type. - -- Raises Program_Error exception if no primitive operation is found. - -- This is normally an internal error, but in some cases is an expected - -- consequence of illegalities elsewhere. + + function Find_Optional_Prim_Op + (T : Entity_Id; Name : Name_Id) return Entity_Id; + function Find_Optional_Prim_Op + (T : Entity_Id; + Name : TSS_Name_Type) return Entity_Id; + -- Same as Find_Prim_Op, except returns Empty if not found function Find_Protection_Object (Scop : Entity_Id) return Entity_Id; - -- Traverse the scope stack starting from Scop and look for an entry, - -- entry family, or a subprogram that has a Protection_Object and return - -- it. Raises Program_Error if no such entity is found since the context - -- in which this routine is invoked should always have a protection - -- object. + -- Traverse the scope stack starting from Scop and look for an entry, entry + -- family, or a subprogram that has a Protection_Object and return it. Must + -- always return a value since the context in which this routine is invoked + -- should always have a protection object. function Find_Protection_Type (Conc_Typ : Entity_Id) return Entity_Id; -- Given a protected type or its corresponding record, find the type of |