aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2010-09-19 13:12:13 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2010-09-19 13:12:13 +0000
commit50a6af053af7a89702c7093eec85b717257e88bc (patch)
tree32a41fb13fdcec0a8ebbccafdb8ca11ceb9759ca /gcc/ada/gcc-interface/utils2.c
parentb146446c53f525ad953fc7a886baceca17c74e9a (diff)
downloadgcc-50a6af053af7a89702c7093eec85b717257e88bc.zip
gcc-50a6af053af7a89702c7093eec85b717257e88bc.tar.gz
gcc-50a6af053af7a89702c7093eec85b717257e88bc.tar.bz2
decl.c (gnat_to_gnu_entity): Look into expressions for external constants that are aggregates.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Constant>: Look into expressions for external constants that are aggregates. * gcc-interface/utils2.c (build_simple_component_ref): If the field is an inherited component in an extension, look through the extension. From-SVN: r164414
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r--gcc/ada/gcc-interface/utils2.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index bd78686..c40223f 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -1603,10 +1603,9 @@ build_simple_component_ref (tree record_variable, tree component,
if (!field)
return NULL_TREE;
- /* If this field is not in the specified record, see if we can find
- something in the record whose original field is the same as this one. */
+ /* If this field is not in the specified record, see if we can find a field
+ in the specified record whose original field is the same as this one. */
if (DECL_CONTEXT (field) != record_type)
- /* Check if there is a field with name COMPONENT in the record. */
{
tree new_field;
@@ -1616,6 +1615,21 @@ build_simple_component_ref (tree record_variable, tree component,
if (SAME_FIELD_P (field, new_field))
break;
+ /* Next, see if we're looking for an inherited component in an extension.
+ If so, look thru the extension directly. */
+ if (!new_field
+ && TREE_CODE (record_variable) == VIEW_CONVERT_EXPR
+ && TYPE_ALIGN_OK (record_type)
+ && TREE_CODE (TREE_TYPE (TREE_OPERAND (record_variable, 0)))
+ == RECORD_TYPE
+ && TYPE_ALIGN_OK (TREE_TYPE (TREE_OPERAND (record_variable, 0))))
+ {
+ ref = build_simple_component_ref (TREE_OPERAND (record_variable, 0),
+ NULL_TREE, field, no_fold_p);
+ if (ref)
+ return ref;
+ }
+
/* Next, loop thru DECL_INTERNAL_P components if we haven't found
the component in the first search. Doing this search in 2 steps
is required to avoiding hidden homonymous fields in the