diff options
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 2adc112..61db4e3 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -472,11 +472,11 @@ gfc_reset_len (stmtblock_t *block, gfc_expr *expr) } -/* Obtain the vptr of the last class reference in an expression. +/* Obtain the last class reference in an expression. Return NULL_TREE if no class reference is found. */ tree -gfc_get_vptr_from_expr (tree expr) +gfc_get_class_from_expr (tree expr) { tree tmp; tree type; @@ -487,7 +487,7 @@ gfc_get_vptr_from_expr (tree expr) while (type) { if (GFC_CLASS_TYPE_P (type)) - return gfc_class_vptr_get (tmp); + return tmp; if (type != TYPE_CANONICAL (type)) type = TYPE_CANONICAL (type); else @@ -501,6 +501,23 @@ gfc_get_vptr_from_expr (tree expr) tmp = build_fold_indirect_ref_loc (input_location, tmp); if (GFC_CLASS_TYPE_P (TREE_TYPE (tmp))) + return tmp; + + return NULL_TREE; +} + + +/* Obtain the vptr of the last class reference in an expression. + Return NULL_TREE if no class reference is found. */ + +tree +gfc_get_vptr_from_expr (tree expr) +{ + tree tmp; + + tmp = gfc_get_class_from_expr (expr); + + if (tmp != NULL_TREE) return gfc_class_vptr_get (tmp); return NULL_TREE; |