diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-04 12:27:40 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-04 12:27:40 +0000 |
commit | a273015dd168c683e5e1f0516889187d4c20ab0e (patch) | |
tree | a3bcc1e0922a6c48a52bb1cc07887f3708bf41c7 /gcc/ada/exp_util.adb | |
parent | 2b5e74b4420dc48d8967213e679b93736c76d41e (diff) | |
download | gcc-a273015dd168c683e5e1f0516889187d4c20ab0e.tar.gz |
2011-08-04 Yannick Moy <moy@adacore.com>
* par-ch4.adb (P_Primary): preferentially issue an error message about
a missing parenthesis arount a conditional or case expression in Ada
2012 mode, if we detect that the alignment is not correct for a
statement.
2011-08-04 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch7.adb (Process_Declarations): Do not consider the result of a
tag-to-class-wide conversion as needing finalization actions.
* exp_util.adb (Has_Controlled_Objects): Do not consider the result of
a tag-to-class-wide conversion as needing finalization actions.
(Is_Finalizable_Transient): The result of a tag-to-class-wide
conversion does not need finalization actions.
(Is_Tag_To_CW_Conversion): New routine.
* exp_util.ads (Is_Tag_To_CW_Conversion): New routine. Determines
whether an object is the result of a tag-to-class-wide conversion.
2011-08-04 Yannick Moy <moy@adacore.com>
* sem_ch13.adb (Analyze_Aspect_Specifications): correct order in which
the left-hand-side and right-hand-side of a conjunct are inserted when
translating a pre- or postcondition
* sem_ch6.adb: Correct typo in comment
2011-08-04 Ed Schonberg <schonberg@adacore.com>
* gnat_rm.texi: Ravenscar does not prohibit dependence on
Unchecked_Conversion and Unchecked_Deallocation.
2011-08-04 Thomas Quinot <quinot@adacore.com>
* make.adb: Minor reformatting.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177371 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_util.adb')
-rw-r--r-- | gcc/ada/exp_util.adb | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index aaf7e3ce6e2..83682e73652 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -2668,12 +2668,14 @@ package body Exp_Util is -- The object is of the form: -- Obj : Typ [:= Expr]; -- - -- Do not process the incomplete view of a deferred constant + -- Do not process the incomplete view of a deferred constant. Do + -- not consider tag-to-class-wide conversions. elsif not Is_Imported (Obj_Id) and then Needs_Finalization (Obj_Typ) and then not (Ekind (Obj_Id) = E_Constant and then not Has_Completion (Obj_Id)) + and then not Is_Tag_To_CW_Conversion (Obj_Id) then return True; @@ -2696,6 +2698,9 @@ package body Exp_Util is then return True; + -- Processing for "hook" objects generated for controlled + -- transients declared inside an Expression_With_Actions. + elsif Is_Access_Type (Obj_Typ) and then Present (Return_Flag_Or_Transient_Decl (Obj_Id)) and then Nkind (Return_Flag_Or_Transient_Decl (Obj_Id)) = @@ -3968,11 +3973,6 @@ package body Exp_Util is and then not Is_Allocated (Obj_Id) - -- Do not consider renamed transient objects because the act of - -- renaming extends the object's lifetime. - - and then not Is_Renamed (Obj_Id, Decl) - -- If the transient object is a pointer, check that it is not -- initialized by a function which returns a pointer or acts as a -- renaming of another pointer. @@ -3984,7 +3984,16 @@ package body Exp_Util is -- Do not consider transient objects which act as indirect aliases of -- build-in-place function results. - and then not Initialized_By_Aliased_BIP_Func_Call (Obj_Id); + and then not Initialized_By_Aliased_BIP_Func_Call (Obj_Id) + + -- Do not consider renamed transient objects because the act of + -- renaming extends the object's lifetime. + + and then not Is_Renamed (Obj_Id, Decl) + + -- Do not consider conversions of tags to class-wide types + + and then not Is_Tag_To_CW_Conversion (Obj_Id); end Is_Finalizable_Transient; --------------------------------- @@ -4502,6 +4511,21 @@ package body Exp_Util is end if; end Is_Renamed_Object; + ----------------------------- + -- Is_Tag_To_CW_Conversion -- + ----------------------------- + + function Is_Tag_To_CW_Conversion (Obj_Id : Entity_Id) return Boolean is + Expr : constant Node_Id := Expression (Parent (Obj_Id)); + + begin + return + Is_Class_Wide_Type (Etype (Obj_Id)) + and then Present (Expr) + and then Nkind (Expr) = N_Unchecked_Type_Conversion + and then Etype (Expression (Expr)) = RTE (RE_Tag); + end Is_Tag_To_CW_Conversion; + ---------------------------- -- Is_Untagged_Derivation -- ---------------------------- |