-
- Downloads
ada: Use inheritance in Gen_IL
In Gen_IL, detect cases where fields could be inherited from an abstract type instead of being defined in each of two or more descendants of that type. Raise Illegal when that is the case, except in specific cases called out as exceptions to this rule. For every such case, either update the types declared in Gen_Nodes and Gen_Entities to use inheritance, or add the case to the list of exceptions where we do not want to use inheritance. gcc/ada/ChangeLog: * gen_il-internals.ads: Split Fields field into two fields Imm_Fields and Fields. * gen_il-gen.adb: Modify the field-inheritance algorithm to inherit at each level of the type hierarchy, rather than just inheriting into concrete types. For example, if C is a concrete type derived from B, which is in turn derived from A, we now set the Fields of B to include those of A. (We had always set the Fields of C to include those of A and B, and we still do that.) (Compute_Fields_For_One_Type): Detect cases where a given field is declared for all descendants of a given abstract type, in which case we should consider declaring it in the abstract type, and inheriting it in those descendants. (Exception_To_Inheritance_Rule): These are the cases where we could inherit, but we don't want to. * gen_il-gen-gen_nodes.adb: Move fields up the type hierarchy, so they are inherited instead of being defined separately. * gen_il-gen-gen_entities.adb: Likewise.
Showing
- gcc/ada/gen_il-gen-gen_entities.adb 6 additions, 12 deletionsgcc/ada/gen_il-gen-gen_entities.adb
- gcc/ada/gen_il-gen-gen_nodes.adb 78 additions, 213 deletionsgcc/ada/gen_il-gen-gen_nodes.adb
- gcc/ada/gen_il-gen.adb 200 additions, 70 deletionsgcc/ada/gen_il-gen.adb
- gcc/ada/gen_il-internals.ads 5 additions, 1 deletiongcc/ada/gen_il-internals.ads
Loading
Please register or sign in to comment