parse.y (dump_java_tree): New function.
authorTom Tromey <tromey@redhat.com>
Tue, 1 Jan 2002 01:42:15 +0000 (01:42 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Tue, 1 Jan 2002 01:42:15 +0000 (01:42 +0000)
* parse.y (dump_java_tree): New function.
(source_end_java_method): Call it.
(end_class_declaration): Likewise.
* lang.c (java_decode_option): Call dump_switch_p.

From-SVN: r48439

gcc/java/ChangeLog
gcc/java/lang.c
gcc/java/parse.y

index 74bffb6e6ac2de9be233b5771e4c516a5bcd4ea6..e3ba451ad4a7e10dd3855fa8326afc41d1b0acd3 100644 (file)
@@ -1,3 +1,10 @@
+2001-12-31  Tom Tromey  <tromey@redhat.com>
+
+       * parse.y (dump_java_tree): New function.
+       (source_end_java_method): Call it.
+       (end_class_declaration): Likewise.
+       * lang.c (java_decode_option): Call dump_switch_p.
+
 2001-12-28  Tom Tromey  <tromey@redhat.com>
 
        * gen-table.pl: Don't process characters after \uffff.  Added
index 0486abd08f0c67da266a8606d751e6a27aec5026..0f62594baa5049cb2e67b815024a2892a0b2a410 100644 (file)
@@ -340,8 +340,10 @@ java_decode_option (argc, argv)
         P's value is the option sans `-f'.
         Search for it in the table of options.  */
       p += 2;
-      return process_option_with_no (p, lang_f_options,
-                                    ARRAY_SIZE (lang_f_options));
+      if (process_option_with_no (p, lang_f_options,
+                                 ARRAY_SIZE (lang_f_options)))
+       return 1;
+      return dump_switch_p (p);
     }
 
   if (strcmp (p, "-Wall") == 0)
index acf00d9f8d56c4bfe64fb1a0f10e8f9edbbcc617..e1981431fd5e0cfb640026c6b0ad4858db432d59 100644 (file)
@@ -108,6 +108,7 @@ static tree resolve_package PARAMS ((tree, tree *));
 static tree lookup_package_type PARAMS ((const char *, int));
 static tree resolve_class PARAMS ((tree, tree, tree, tree));
 static void declare_local_variables PARAMS ((int, tree, tree));
+static void dump_java_tree PARAMS ((enum tree_dump_index, tree));
 static void source_start_java_method PARAMS ((tree));
 static void source_end_java_method PARAMS ((void));
 static tree find_name_in_single_imports PARAMS ((tree));
@@ -4060,6 +4061,9 @@ end_class_declaration (resume)
      popped by a resume. */
   int no_error_occurred = ctxp->next && GET_CPC () != error_mark_node;
 
+  if (GET_CPC () != error_mark_node)
+    dump_java_tree (TDI_class, GET_CPC ());
+
   java_parser_context_pop_initialized_field ();
   POP_CPC ();
   if (resume && no_error_occurred)
@@ -7391,6 +7395,24 @@ end_artificial_method_body (mdecl)
   exit_block ();
 }
 
+/* Dump a tree of some kind.  This is a convenience wrapper for the
+   dump_* functions in tree-dump.c.  */
+static void
+dump_java_tree (phase, t)
+     enum tree_dump_index phase;
+     tree t;
+{
+  FILE *stream;
+  int flags;
+
+  stream = dump_begin (phase, &flags);
+  if (stream)
+    {
+      dump_node (t, flags, stream);
+      dump_end (phase, stream);
+    }
+}
+
 /* Terminate a function and expand its body.  */
 
 static void
@@ -7410,6 +7432,10 @@ source_end_java_method ()
   if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) == empty_stmt_node)
     BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl)) = NULL_TREE;
 
+  /* We've generated all the trees for this function, and it has been
+     patched.  Dump it to a file if the user requested it.  */
+  dump_java_tree (TDI_original, fndecl);
+
   /* Generate function's code */
   if (BLOCK_EXPR_BODY (DECL_FUNCTION_BODY (fndecl))
       && ! flag_emit_class_files