diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-04-02 11:28:52 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-04-02 11:28:52 +0200 |
commit | 804670f120cd78a0304b630e7e53b1e13c9f5bfb (patch) | |
tree | 73b0c5e92f353bdabf9f5aa631a04ff869eba933 /gcc/ada/sem_util.adb | |
parent | a7942a0ee03599421323a893bfd9d868aa6ed3a6 (diff) | |
download | gcc-804670f120cd78a0304b630e7e53b1e13c9f5bfb.zip gcc-804670f120cd78a0304b630e7e53b1e13c9f5bfb.tar.gz gcc-804670f120cd78a0304b630e7e53b1e13c9f5bfb.tar.bz2 |
[multiple changes]
2012-04-02 Emmanuel Briot <briot@adacore.com>
* g-expect.adb (Expect_Internal): Fix leak of the input file descriptor.
2012-04-02 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Expand_N_Quantified_Expression): Reimplemented.
The expansion no longer uses the copy of the original QE created
during analysis.
* sem.adb (Analyze): Add processing for loop parameter specifications.
* sem_ch4.adb (Analyze_Quantified_Expression): Reimplemented. The
routine no longer creates a copy of the original QE. All
constituents of a QE are now preanalyzed and resolved.
* sem_ch5.adb (Analyze_Iteration_Scheme): Remove the guard which
bypasses all processing when the iteration scheme is related to a
QE. Relovate the code which analyzes loop parameter specifications
to a separate routine. (Analyze_Iterator_Specification):
Preanalyze the iterator name. This action was originally
done in Analyze_Iteration_Scheme. Update the check which
detects an iterator specification in the context of a QE.
(Analyze_Loop_Parameter_Specification): New routine. This
procedure allows for a stand-alone analysis of a loop parameter
specification without the need of a parent iteration scheme. Add
code to update the type of the loop variable when the range
generates an itype and the context is a QE.
(Pre_Analyze_Range): Renamed to Preanalyze_Range. Update all references
to the routine.
* sem_ch5.ads: Code reformatting.
(Analyze_Loop_Parameter_Specification): New routine.
* sem_ch6.adb (Fully_Conformant_Expressions): Detect a case
when establishing conformance between two QEs utilizing different
specifications.
* sem_res.adb (Proper_Current_Scope): New routine.
(Resolve): Do not resolve a QE as there is nothing to be done now.
Ignore any loop scopes generated for QEs when detecting an expression
function as the scopes are cosmetic and do not appear in the tree.
(Resolve_Quantified_Expression): Removed. All resolution of
QE constituents is now performed during analysis. This ensures
that loop variables appearing in array aggregates are properly
resolved.
2012-04-02 Ed Schonberg <schonberg@adacore.com>
* sem_util.adb (Build_Default_Subtype): If the base type is
private and its full view is available, use the full view in
the subtype declaration.
From-SVN: r186074
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r-- | gcc/ada/sem_util.adb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index e07d5bb..e7958058 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -740,12 +740,28 @@ package body Sem_Util is N : Node_Id) return Entity_Id is Loc : constant Source_Ptr := Sloc (N); + Bas : Entity_Id; + -- The base type that is to be constrained by the defaults. + Disc : Entity_Id; begin if not Has_Discriminants (T) or else Is_Constrained (T) then return T; end if; + Bas := Base_Type (T); + + -- If T is non-private but its base type is private, this is + -- the completion of a subtype declaration whose parent type + -- is private (see Complete_Private_Subtype in sem_ch3). The + -- proper discriminants are to be found in the full view of + -- the base. + + if Is_Private_Type (Bas) + and then Present (Full_View (Bas)) + then + Bas := Full_View (Bas); + end if; Disc := First_Discriminant (T); @@ -770,7 +786,7 @@ package body Sem_Util is Defining_Identifier => Act, Subtype_Indication => Make_Subtype_Indication (Loc, - Subtype_Mark => New_Occurrence_Of (T, Loc), + Subtype_Mark => New_Occurrence_Of (Bas, Loc), Constraint => Make_Index_Or_Discriminant_Constraint (Loc, Constraints => Constraints))); |