diff options
author | Daniel Kraft <d@domob.eu> | 2008-09-01 12:55:50 +0200 |
---|---|---|
committer | Daniel Kraft <domob@gcc.gnu.org> | 2008-09-01 12:55:50 +0200 |
commit | a64a8f2f267e1151d2c873aa3e02c7abe4fd4990 (patch) | |
tree | 66c5e272b10868f7048d89734fa754d3d8f51f9d /gcc/fortran/dump-parse-tree.c | |
parent | f69bbb461b3a00afe8156ae949fb7014332bb3a1 (diff) | |
download | gcc-a64a8f2f267e1151d2c873aa3e02c7abe4fd4990.zip gcc-a64a8f2f267e1151d2c873aa3e02c7abe4fd4990.tar.gz gcc-a64a8f2f267e1151d2c873aa3e02c7abe4fd4990.tar.bz2 |
gfc-internals.texi (F2003 OOP), [...]): New chapter and section to document the internals of type-bound procedures.
2008-09-01 Daniel Kraft <d@domob.eu>
* gfc-internals.texi (F2003 OOP), (Type-bound Procedures): New chapter
and section to document the internals of type-bound procedures.
(gfc_expr): Document EXPR_COMPCALL.
* gfortran.h (struct gfc_expr): Remove unused `derived' from compcall.
* dump-parse-tree.c (show_compcall): New method.
(show_expr): Call it for EXPR_COMPCALL.
(show_typebound), (show_f2k_derived): New methods.
(show_symbol): Call show_f2k_derived.
(show_code_node): Handle EXEC_COMPCALL.
* primary.c (gfc_match_varspec): Don't initialize removed `derived' in
primary->value.compcall.
From-SVN: r139857
Diffstat (limited to 'gcc/fortran/dump-parse-tree.c')
-rw-r--r-- | gcc/fortran/dump-parse-tree.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index c829ebd..05d32c2 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -316,6 +316,22 @@ show_char_const (const gfc_char_t *c, int length) fputc ('\'', dumpfile); } + +/* Show a component-call expression. */ + +static void +show_compcall (gfc_expr* p) +{ + gcc_assert (p->expr_type == EXPR_COMPCALL); + + fprintf (dumpfile, "%s", p->symtree->n.sym->name); + show_ref (p->ref); + fprintf (dumpfile, "%s", p->value.compcall.name); + + show_actual_arglist (p->value.compcall.actual); +} + + /* Show an expression. */ static void @@ -539,6 +555,10 @@ show_expr (gfc_expr *p) break; + case EXPR_COMPCALL: + show_compcall (p); + break; + default: gfc_internal_error ("show_expr(): Don't know how to show expr"); } @@ -646,6 +666,76 @@ show_components (gfc_symbol *sym) } +/* Show the f2k_derived namespace with procedure bindings. */ + +static void +show_typebound (gfc_symtree* st) +{ + if (!st->typebound) + return; + + show_indent (); + + if (st->typebound->is_generic) + fputs ("GENERIC", dumpfile); + else + { + fputs ("PROCEDURE, ", dumpfile); + if (st->typebound->nopass) + fputs ("NOPASS", dumpfile); + else + { + if (st->typebound->pass_arg) + fprintf (dumpfile, "PASS(%s)", st->typebound->pass_arg); + else + fputs ("PASS", dumpfile); + } + if (st->typebound->non_overridable) + fputs (", NON_OVERRIDABLE", dumpfile); + } + + if (st->typebound->access == ACCESS_PUBLIC) + fputs (", PUBLIC", dumpfile); + else + fputs (", PRIVATE", dumpfile); + + fprintf (dumpfile, " :: %s => ", st->n.sym->name); + + if (st->typebound->is_generic) + { + gfc_tbp_generic* g; + for (g = st->typebound->u.generic; g; g = g->next) + { + fputs (g->specific_st->name, dumpfile); + if (g->next) + fputs (", ", dumpfile); + } + } + else + fputs (st->typebound->u.specific->n.sym->name, dumpfile); +} + +static void +show_f2k_derived (gfc_namespace* f2k) +{ + gfc_finalizer* f; + + ++show_level; + + /* Finalizer bindings. */ + for (f = f2k->finalizers; f; f = f->next) + { + show_indent (); + fprintf (dumpfile, "FINAL %s", f->proc_sym->name); + } + + /* Type-bound procedures. */ + gfc_traverse_symtree (f2k->sym_root, &show_typebound); + + --show_level; +} + + /* Show a symbol. If a symbol is an ENTRY, SUBROUTINE or FUNCTION, we show the interface. Information needed to reconstruct the list of specific interfaces associated with a generic symbol is done within @@ -701,6 +791,13 @@ show_symbol (gfc_symbol *sym) show_components (sym); } + if (sym->f2k_derived) + { + show_indent (); + fputs ("Procedure bindings:\n", dumpfile); + show_f2k_derived (sym->f2k_derived); + } + if (sym->formal) { show_indent (); @@ -1110,6 +1207,11 @@ show_code_node (int level, gfc_code *c) show_actual_arglist (c->ext.actual); break; + case EXEC_COMPCALL: + fputs ("CALL ", dumpfile); + show_compcall (c->expr); + break; + case EXEC_RETURN: fputs ("RETURN ", dumpfile); if (c->expr) |