PATCH to add a `back_end_hook' for C++

Mark Mitchell mark@codesourcery.com
Tue Aug 17 16:09:00 GMT 1999


This patch provides a hook that back-ends (i.e, source browsers,
debuggers, etc.) can use.  After the translation unit is processed,
the hook gets called, allowing it to process the tree structure as it
sees fit.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

1999-08-17  Mark Mitchell  <mark@codesourcery.com>

	* cp-tree.h (back_end_hook): New variable.
	* decl2.c (back_end_hook): Define it.
	(finish_file): If it's non-NULL, call it.

Index: cp-tree.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/cp-tree.h,v
retrieving revision 1.267
diff -c -p -r1.267 cp-tree.h
*** cp-tree.h	1999/08/17 07:20:21	1.267
--- cp-tree.h	1999/08/17 23:05:28
*************** extern int flag_permissive;
*** 613,618 ****
--- 613,624 ----
  
  extern int flag_access_control;
  
+ /* If this variable is defined to a non-NULL value, it will be called
+    after the file has been completely parsed.  The argument will be
+    the GLOBAL_NAMESPACE.  */
+ 
+ extern void (*back_end_hook) PROTO((tree));
+ 
  
  /* C++ language-specific tree codes.  */
  #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) SYM,
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.237
diff -c -p -r1.237 decl2.c
*** decl2.c	1999/08/17 07:20:22	1.237
--- decl2.c	1999/08/17 23:05:31
*************** int flag_vtable_gc;
*** 476,481 ****
--- 476,486 ----
  
  int flag_permissive;
  
+ /* If this variable is defined to a non-NULL value, it will be called
+    after the file has been completely parsed.  */
+ 
+ void (*back_end_hook) PROTO((tree));
+ 
  /* Table of language-dependent -f options.
     STRING is the option name.  VARIABLE is the address of the variable.
     ON_VALUE is the value to store in VARIABLE
*************** finish_file ()
*** 3674,3679 ****
--- 3679,3689 ----
       file.   */
    if (flag_dump_translation_unit)
      dump_node_to_file (global_namespace, flag_dump_translation_unit);
+ 
+   /* If there's some tool that wants to examine the entire translation
+      unit, let it do so now.  */
+   if (back_end_hook)
+     (*back_end_hook) (global_namespace);
  
    this_time = get_run_time ();
    parse_time -= this_time - start_time;


More information about the Gcc-patches mailing list