summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-19 10:30:33 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-02-19 10:30:33 +0000
commitb3f8228ae2a5201ee6c7670d5673c4c28723e043 (patch)
treea47b8f73a25d9edbde9b11b8b6ba4b1774d438f4 /gcc/ada/sem_util.ads
parent389062c95789bc6f7cec1b5d92b7bd233377003d (diff)
downloadgcc-b3f8228ae2a5201ee6c7670d5673c4c28723e043.tar.gz
2014-02-19 Ed Schonberg <schonberg@adacore.com>
* style.adb (Missing_Overriding): Warning does not apply in language versions prior to Ada 2005. * snames.ads-tmpl: Add Name_Iterable and Attribute_Iterable. * sem_attr.adb: Add Attribute_Iterable where needed. * exp_attr.adb: ditto. * exp_ch5.adb (Expand_Formal_Container_Loop): New procedure to handle loops and quantified expressions over types that have an iterable aspect. Called from Expand_Iterator_Loop. * sem_ch5.adb (Analyze_Iterator_Specification): Recognize types with Iterable aspect. * sem_ch13.adb (Validate_Iterable_Aspect): Verify that the subprograms specified in the Iterable aspect have the proper signature involving container and cursor. (Check_Aspect_At_Freeze_Point): Analyze value of iterable aspect. * sem_ch13.ads (Validate_Iterable_Aspect): New subprogram. * sem_util.ads, sem_util.adb (Get_Iterable_Type_Primitive): New procedure to retrieve one of the primitives First, Last, or Has_Element, from the value of the iterable aspect of a formal container. (Is_Container_Element): Predicate to recognize expressions that denote an element of one of the predefined containers, for possible optimization. This subprogram is not currently used, pending ARG discussions on the legality of the proposed optimization. Worth preserving for eventual use. (Is_Iterator): Recognize formal container types. * aspects.ads, aspects.adb: Add Aspect_Iterable where needed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207881 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_util.ads')
-rw-r--r--gcc/ada/sem_util.ads17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index d8dfaaaeb5d..e06c1572c48 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -818,6 +818,12 @@ package Sem_Util is
-- The third argument supplies a source location for constructed nodes
-- returned by this function.
+ function Get_Iterable_Type_Primitive
+ (Typ : Entity_Id;
+ Nam : Name_Id) return Entity_Id;
+ -- Retrieve one of the primitives First, Next, Has_Element, Element from
+ -- the value of the Iterable aspect of a formal type.
+
procedure Get_Library_Unit_Name_String (Decl_Node : Node_Id);
-- Retrieve the fully expanded name of the library unit declared by
-- Decl_Node into the name buffer.
@@ -1102,6 +1108,17 @@ package Sem_Util is
-- enumeration literal, or an expression composed of constant-bound
-- subexpressions which are evaluated by means of standard operators.
+ function Is_Container_Element (Exp : Node_Id) return Boolean;
+ -- This routine recognizes expressions that denote an element of one of
+ -- the predefined containers, when the source only contains an indexing
+ -- operation and an implicit dereference is inserted by the compiler. In
+ -- the absence of this optimization, the indexing creates a temporary
+ -- controlled cursor that sets the tampering bit of the container, and
+ -- restricts the use of the convenient notation C (X) to contexts that
+ -- do not check the tampering bit (e.g. C.Include (X, C (Y)).
+ -- Exp is an explicit dereference. The transformation applies when it
+ -- has the form F (X).Discr.all.
+
function Is_Controlling_Limited_Procedure
(Proc_Nam : Entity_Id) return Boolean;
-- Ada 2005 (AI-345): Determine whether Proc_Nam is a primitive procedure