From a51368fad9985f84e3215cf9897f389698fbbba5 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 23 Jan 2017 13:04:16 +0100 Subject: [multiple changes] 2017-01-23 Pascal Obry * s-taprop-mingw.adb (Enter_Task): Initialize the Thread handle which is needed when a foreign thread call a Win32 API using a thread handle like GetThreadTimes() for example. 2017-01-23 Hristian Kirtchev * sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not allow an 'Address clause to be specified on a prefix of a class-wide type. 2017-01-23 Hristian Kirtchev * checks.adb (Insert_Valid_Check): Ensure that the prefix of attribute 'Valid is a renaming of the original expression when the expression denotes a name. For all other kinds of expression, use a constant to capture the value. * exp_util.adb (Is_Name_Reference): Moved to Sem_Util. * sem_util.ads, sem_util.adb (Is_Name_Reference): Moved from Exp_Util. 2017-01-23 Justin Squirek * sem_eval.adb (Eval_Integer_Literal): Add special case to avoid optimizing out check if the literal appears in an if-expression. From-SVN: r244792 --- gcc/ada/sem_util.adb | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'gcc/ada/sem_util.adb') diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 752a69b..fd45a38 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -13405,6 +13405,60 @@ package body Sem_Util is end if; end Is_Local_Variable_Reference; + ----------------------- + -- Is_Name_Reference -- + ----------------------- + + function Is_Name_Reference (N : Node_Id) return Boolean is + begin + if Is_Entity_Name (N) then + return Present (Entity (N)) and then Is_Object (Entity (N)); + end if; + + case Nkind (N) is + when N_Indexed_Component + | N_Slice + => + return + Is_Name_Reference (Prefix (N)) + or else Is_Access_Type (Etype (Prefix (N))); + + -- Attributes 'Input, 'Old and 'Result produce objects + + when N_Attribute_Reference => + return + Nam_In (Attribute_Name (N), Name_Input, Name_Old, Name_Result); + + when N_Selected_Component => + return + Is_Name_Reference (Selector_Name (N)) + and then + (Is_Name_Reference (Prefix (N)) + or else Is_Access_Type (Etype (Prefix (N)))); + + when N_Explicit_Dereference => + return True; + + -- A view conversion of a tagged name is a name reference + + when N_Type_Conversion => + return + Is_Tagged_Type (Etype (Subtype_Mark (N))) + and then Is_Tagged_Type (Etype (Expression (N))) + and then Is_Name_Reference (Expression (N)); + + -- An unchecked type conversion is considered to be a name if the + -- operand is a name (this construction arises only as a result of + -- expansion activities). + + when N_Unchecked_Type_Conversion => + return Is_Name_Reference (Expression (N)); + + when others => + return False; + end case; + end Is_Name_Reference; + --------------------------------- -- Is_Nontrivial_DIC_Procedure -- --------------------------------- -- cgit v1.1