Changeset 89231bc


Ignore:
Timestamp:
Apr 26, 2016, 12:55:40 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
60089f4, 668edd6b
Parents:
dc5376a
Message:

fix printing for various AST nodes, including ObjectDecl?, ExprStmt?, etc. - assume preceding indentation printed by parent

Location:
src/SynTree
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AddressExpr.cc

    rdc5376a r89231bc  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // AddressExpr.cc -- 
     7// AddressExpr.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 23:54:44 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue May 19 16:52:51 2015
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Apr 26 12:35:13 2016
    1313// Update Count     : 6
    1414//
     
    3232
    3333void AddressExpr::print( std::ostream &os, int indent ) const {
    34         os << std::string( indent, ' ' ) << "Address of:" << std::endl;
     34        os << "Address of:" << std::endl;
    3535        if ( arg ) {
    36                 arg->print( os, indent+2 );
     36                os << std::string( indent+2, ' ' );
     37    arg->print( os, indent+2 );
    3738        } // if
    3839}
  • src/SynTree/ApplicationExpr.cc

    rdc5376a r89231bc  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ApplicationExpr.cc.cc -- 
     7// ApplicationExpr.cc.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon May 18 07:54:17 2015
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Apr 26 12:41:06 2016
    1313// Update Count     : 4
    1414//
     
    4747        FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
    4848        assert( function );
    49        
     49
    5050        for ( std::list< DeclarationWithType* >::const_iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
    5151                get_results().push_back( (*i)->get_type()->clone() );
     
    6464
    6565void ApplicationExpr::print( std::ostream &os, int indent ) const {
    66         os << std::string( indent, ' ' ) << "Application of" << std::endl;
     66        os << "Application of" << std::endl << std::string(indent, ' ');
    6767        function->print( os, indent+2 );
    6868        if ( ! args.empty() ) {
  • src/SynTree/Expression.cc

    rdc5376a r89231bc  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Apr  8 17:16:23 2016
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Apr 26 12:52:40 2016
    1313// Update Count     : 40
    1414//
     
    9393
    9494void VariableExpr::print( std::ostream &os, int indent ) const {
    95         os << std::string( indent, ' ' ) << "Variable Expression: ";
     95        os << "Variable Expression: ";
    9696
    9797        Declaration *decl = get_var();
     
    122122
    123123void SizeofExpr::print( std::ostream &os, int indent) const {
    124         os << std::string( indent, ' ' ) << "Sizeof Expression on: ";
     124        os << "Sizeof Expression on: ";
    125125
    126126        if (isType)
     
    295295
    296296void CastExpr::print( std::ostream &os, int indent ) const {
    297         os << std::string( indent, ' ' ) << "Cast of:" << std::endl;
     297        os << "Cast of:" << std::endl << std::string( indent+2, ' ' );
    298298        arg->print(os, indent+2);
    299299        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
     
    318318
    319319void UntypedMemberExpr::print( std::ostream &os, int indent ) const {
    320         os << std::string( indent, ' ' ) << "Member Expression, with field: " << get_member();
     320        os << "Untyped Member Expression, with field: " << get_member();
    321321
    322322        Expression *agg = get_aggregate();
    323323        os << std::string( indent, ' ' ) << "from aggregate: ";
    324         if (agg != 0) agg->print(os, indent + 2);
     324        if (agg != 0) {
     325                os << std::string( indent+2, ' ' );
     326                agg->print(os, indent + 2);
     327        }
     328        os << std::string( indent+2, ' ' );
    325329        Expression::print( os, indent );
    326330}
     
    345349
    346350void MemberExpr::print( std::ostream &os, int indent ) const {
    347         os << std::string( indent, ' ' ) << "Member Expression, with field: " << std::endl;
     351        os << "Member Expression, with field: " << std::endl;
    348352
    349353        assert( member );
     
    354358        Expression *agg = get_aggregate();
    355359        os << std::string( indent, ' ' ) << "from aggregate: " << std::endl;
    356         if (agg != 0) agg->print(os, indent + 2);
     360        if (agg != 0) {
     361                os << std::string( indent+2, ' ' );
     362                agg->print(os, indent + 2);
     363        }
     364        os << std::string( indent+2, ' ' );
    357365        Expression::print( os, indent );
    358366}
     
    372380
    373381void UntypedExpr::print( std::ostream &os, int indent ) const {
    374         os << std::string( indent, ' ' ) << "Applying untyped: " << std::endl;
     382        os << "Applying untyped: " << std::endl;
     383        os << std::string( indent, ' ' );
    375384        function->print(os, indent + 4);
    376385        os << std::string( indent, ' ' ) << "...to: " << std::endl;
     386        os << std::string( indent, ' ' );
    377387        printArgs(os, indent + 4);
    378388        Expression::print( os, indent );
     
    393403
    394404void NameExpr::print( std::ostream &os, int indent ) const {
    395         os << std::string( indent, ' ' ) << "Name: " << get_name() << std::endl;
     405        os << "Name: " << get_name() << std::endl;
    396406        Expression::print( os, indent );
    397407}
  • src/SynTree/Initializer.cc

    rdc5376a r89231bc  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Initializer.cc -- 
     7// Initializer.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Aug 12 14:05:25 2015
    13 // Update Count     : 14
     12// Last Modified On : Tue Apr 26 12:50:47 2016
     13// Update Count     : 28
    1414//
    1515
     
    3131void Initializer::print( std::ostream &os, int indent ) {}
    3232
    33 SingleInit::SingleInit( Expression *v, std::list< Expression *> &_designators ) : value ( v ), designators( _designators ) { 
     33SingleInit::SingleInit( Expression *v, std::list< Expression *> &_designators ) : value ( v ), designators( _designators ) {
    3434}
    3535
     
    6565
    6666void ListInit::print( std::ostream &os, int indent ) {
    67         os << std::endl << std::string(indent, ' ') << "Compound initializer:  "; 
     67        os << std::endl << std::string(indent, ' ') << "Compound initializer:  ";
    6868        if ( ! designators.empty() ) {
    6969                os << std::string(indent + 2, ' ' ) << "designated by: [";
    7070                for ( std::list < Expression * >::iterator i = designators.begin();
    7171                          i != designators.end(); i++ ) {
    72                         ( *i )->print(os, indent + 4 ); 
     72                        ( *i )->print(os, indent + 4 );
    7373                } // for
    74        
     74
    7575                os << std::string(indent + 2, ' ' ) << "]";
    7676        } // if
    7777
    78         for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ ) 
     78        for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ )
    7979                (*i)->print( os, indent + 2 );
    8080}
  • src/SynTree/ObjectDecl.cc

    rdc5376a r89231bc  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ObjectDecl.cc -- 
     7// ObjectDecl.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Sep 29 14:13:01 2015
    13 // Update Count     : 18
     12// Last Modified On : Tue Apr 26 12:53:13 2016
     13// Update Count     : 30
    1414//
    1515
     
    6969#if 0
    7070        if ( get_mangleName() != "") {
    71                 os << get_mangleName() << ": "; 
    72         } else 
     71                os << get_mangleName() << ": ";
     72        } else
    7373#endif
    7474        if ( get_name() != "" ) {
  • src/SynTree/Statement.cc

    rdc5376a r89231bc  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Dec 09 14:09:34 2015
     12// Last Modified On : Tue Apr 26 12:33:33 2016
    1313// Update Count     : 54
    1414//
     
    4343
    4444void ExprStmt::print( std::ostream &os, int indent ) const {
    45         os << string( indent, ' ' ) << "Expression Statement:" << endl;
     45        os << "Expression Statement:" << endl << std::string( indent, ' ' );
    4646        expr->print( os, indent + 2 );
    4747}
     
    110110
    111111void ReturnStmt::print( std::ostream &os, int indent ) const {
    112         os << std::string( indent, ' ' ) << string ( isThrow? "Throw":"Return" ) << " Statement, returning: ";
    113         if ( expr != 0 ) expr->print( os );
     112        os << string ( isThrow? "Throw":"Return" ) << " Statement, returning: ";
     113        if ( expr != 0 ) {
     114                os << endl << string( indent+2, ' ' );
     115                expr->print( os, indent + 2 );
     116        }
    114117        os << endl;
    115118}
     
    124127
    125128void IfStmt::print( std::ostream &os, int indent ) const {
    126         os << string( indent, ' ' ) << "If on condition: " << endl ;
     129        os << "If on condition: " << endl ;
    127130        condition->print( os, indent + 4 );
    128131
     
    153156
    154157void SwitchStmt::print( std::ostream &os, int indent ) const {
    155         os << string( indent, ' ' ) << "Switch on condition: ";
     158        os << "Switch on condition: ";
    156159        condition->print( os );
    157160        os << endl;
     
    218221
    219222void ChooseStmt::print( std::ostream &os, int indent ) const {
    220         os << string( indent, ' ' ) << "Choose on condition: ";
     223        os << "Choose on condition: ";
    221224        condition->print( os );
    222225        os << endl;
     
    247250
    248251void WhileStmt::print( std::ostream &os, int indent ) const {
    249         os << string( indent, ' ' ) << "While on condition: " << endl ;
     252        os << "While on condition: " << endl ;
    250253        condition->print( os, indent + 4 );
    251254
     
    273276
    274277void ForStmt::print( std::ostream &os, int indent ) const {
    275         os << string( indent, ' ' ) << "Labels: {";
     278        os << "Labels: {";
    276279        for ( std::list<Label>::const_iterator it = get_labels().begin(); it != get_labels().end(); ++it) {
    277280                os << *it << ",";
     
    314317
    315318void TryStmt::print( std::ostream &os, int indent ) const {
    316         os << string( indent, ' ' ) << "Try Statement" << endl;
     319        os << "Try Statement" << endl;
    317320        os << string( indent + 2, ' ' ) << "with block: " << endl;
    318321        block->print( os, indent + 4 );
     
    378381
    379382void NullStmt::print( std::ostream &os, int indent ) const {
    380         os << string( indent, ' ' ) << "Null Statement" << endl ;
     383        os << "Null Statement" << endl ;
    381384}
    382385
Note: See TracChangeset for help on using the changeset viewer.