Changeset 9b9d3f9


Ignore:
Timestamp:
Jan 13, 2025, 1:02:41 PM (8 months ago)
Author:
Michael Brooks <mlbrooks@…>
Branches:
master
Children:
267b543
Parents:
37c3db8
Message:

Offer CodeGen::generate overloads that simplify calling from gdb.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/Generate.cpp

    r37c3db8 r9b9d3f9  
    6767}
    6868
     69// to be invoked manually from GDB
     70void generate( const ast::Node * node, std::ostream & os,
     71                bool pretty, bool generateC, bool lineMarks, bool printExprTypes ) {
     72        ast::Pass<CodeGenerator> cgv( os,
     73                        Options( pretty, generateC, lineMarks, printExprTypes ) );
     74        node->accept( cgv );
     75        if ( auto decl = dynamic_cast<const ast::Decl *>( node ) ) {
     76                if ( doSemicolon( decl ) ) {
     77                        os << ";";
     78                }
     79        }
     80        os << cgv.core.endl;
     81}
     82void generate( const ast::Node * node, std::ostream & os ) {
     83        generate( node, os, true, false, false, false );
     84}
     85
    6986} // namespace CodeGen
    7087
Note: See TracChangeset for help on using the changeset viewer.