[ast-optimizer-branch] langhooks for pretty printer

Gabriel Dos Reis gdr@codesourcery.com
Sun Jun 9 14:18:00 GMT 2002


Sebastian Pop <m1sp@csc.liv.ac.uk> writes:

| On Sun, Jun 09, 2002 at 08:43:20PM +0200, Gabriel Dos Reis wrote:
| > 
| > First, we should work to incorporate recent changes from mainline.
| Ok.
| 
| > Second, we should use a single code to hanlde the intersection of C
| > and C++ pretty-printing.  
| That's a little bit more difficult since (for the moment) nodes 
| defined in cp-tree.def are not accessible from the c front-end.

Right.  But I think we can make C++ pretty-printer a subclass of C's.
That will handle most of concerns you outlined later in your message.

As a concrete start, let's say we have


    typedef struct
    {
       output_buffer buffer;
       tree scope;                    /* mostly a DECL_CONTEXT  */
       pp_formating_flags_t flags;    /* this one may be better passed
                                         as an explicit argument.  */
      void *x_data;                   /* front-end specific data.  */
    } pretty_printing_info;
   
Then use language hooks to print specific declarations and such; but
factor out commonalities.  I hope to be able to send a preliminary
patch (based on Jason's) late this night.


| A possible solution is to merge all nodes from c-tree.def and from 
| cp-tree.def in a single file.

I'm not sure we want to go that far before the two front-ends got
merged. 

-- Gaby



More information about the Gcc-patches mailing list