Changeset 0608e007


Ignore:
Timestamp:
Jan 10, 2020, 3:15:10 PM (21 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
a21dec4
Parents:
4737d8e
Message:

formatting, change 0 to nullptr

Location:
src/SynTree
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.cc

    r4737d8e r0608e007  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Sep  3 20:46:44 2017
    13 // Update Count     : 68
     12// Last Modified On : Fri Jan 10 14:20:47 2020
     13// Update Count     : 70
    1414//
    1515
     
    4646Statement::~Statement() {}
    4747
    48 ExprStmt::ExprStmt( Expression *expr ) : Statement(), expr( expr ) {}
    49 
    50 ExprStmt::ExprStmt( const ExprStmt &other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}
     48ExprStmt::ExprStmt( Expression * expr ) : Statement(), expr( expr ) {}
     49
     50ExprStmt::ExprStmt( const ExprStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}
    5151
    5252ExprStmt::~ExprStmt() {
     
    5454}
    5555
    56 void ExprStmt::print( std::ostream &os, Indenter indent ) const {
     56void ExprStmt::print( std::ostream & os, Indenter indent ) const {
    5757        os << "Expression Statement:" << endl << indent+1;
    5858        expr->print( os, indent+1 );
     
    6060
    6161
    62 AsmStmt::AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {}
     62AsmStmt::AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ) : Statement(), voltile( voltile ), instruction( instruction ), output( output ), input( input ), clobber( clobber ), gotolabels( gotolabels ) {}
    6363
    6464AsmStmt::AsmStmt( const AsmStmt & other ) : Statement( other ), voltile( other.voltile ), instruction( maybeClone( other.instruction ) ), gotolabels( other.gotolabels ) {
     
    7575}
    7676
    77 void AsmStmt::print( std::ostream &os, Indenter indent ) const {
     77void AsmStmt::print( std::ostream & os, Indenter indent ) const {
    7878        os << "Assembler Statement:" << endl;
    7979        os << indent+1 << "instruction: " << endl << indent;
     
    9696DirectiveStmt::DirectiveStmt( const std::string & directive ) : Statement(), directive( directive ) {}
    9797
    98 void DirectiveStmt::print( std::ostream &os, Indenter ) const {
     98void DirectiveStmt::print( std::ostream & os, Indenter ) const {
    9999        os << "GCC Directive:" << directive << endl;
    100100}
    101101
    102102
    103 const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" };
     103const char * BranchStmt::brType[] = { "Goto", "Break", "Continue" };
    104104
    105105BranchStmt::BranchStmt( Label target, Type type ) throw ( SemanticErrorException ) :
     
    111111}
    112112
    113 BranchStmt::BranchStmt( Expression *computedTarget, Type type ) throw ( SemanticErrorException ) :
     113BranchStmt::BranchStmt( Expression * computedTarget, Type type ) throw ( SemanticErrorException ) :
    114114        Statement(), computedTarget( computedTarget ), type( type ) {
    115115        if ( type != BranchStmt::Goto || computedTarget == nullptr ) {
     
    118118}
    119119
    120 void BranchStmt::print( std::ostream &os, Indenter indent ) const {
     120void BranchStmt::print( std::ostream & os, Indenter indent ) const {
    121121        os << "Branch (" << brType[type] << ")" << endl ;
    122122        if ( target != "" ) os << indent+1 << "with target: " << target << endl;
     
    125125}
    126126
    127 ReturnStmt::ReturnStmt( Expression *expr ) : Statement(), expr( expr ) {}
     127ReturnStmt::ReturnStmt( Expression * expr ) : Statement(), expr( expr ) {}
    128128
    129129ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}
     
    133133}
    134134
    135 void ReturnStmt::print( std::ostream &os, Indenter indent ) const {
     135void ReturnStmt::print( std::ostream & os, Indenter indent ) const {
    136136        os << "Return Statement, returning: ";
    137137        if ( expr != nullptr ) {
     
    142142}
    143143
    144 IfStmt::IfStmt( Expression *condition, Statement *thenPart, Statement *elsePart, std::list<Statement *> initialization ):
     144IfStmt::IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart, std::list<Statement *> initialization ):
    145145        Statement(), condition( condition ), thenPart( thenPart ), elsePart( elsePart ), initialization( initialization ) {}
    146146
     
    157157}
    158158
    159 void IfStmt::print( std::ostream &os, Indenter indent ) const {
     159void IfStmt::print( std::ostream & os, Indenter indent ) const {
    160160        os << "If on condition: " << endl;
    161161        os << indent+1;
     
    176176        thenPart->print( os, indent+1 );
    177177
    178         if ( elsePart != 0 ) {
     178        if ( elsePart != nullptr ) {
    179179                os << indent << "... else: " << endl;
    180180                os << indent+1;
     
    183183}
    184184
    185 SwitchStmt::SwitchStmt( Expression * condition, const std::list<Statement *> &statements ):
     185SwitchStmt::SwitchStmt( Expression * condition, const std::list<Statement *> & statements ):
    186186        Statement(), condition( condition ), statements( statements ) {
    187187}
     
    198198}
    199199
    200 void SwitchStmt::print( std::ostream &os, Indenter indent ) const {
     200void SwitchStmt::print( std::ostream & os, Indenter indent ) const {
    201201        os << "Switch on condition: ";
    202202        condition->print( os );
     
    208208}
    209209
    210 CaseStmt::CaseStmt( Expression *condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticErrorException ) :
     210CaseStmt::CaseStmt( Expression * condition, const std::list<Statement *> & statements, bool deflt ) throw ( SemanticErrorException ) :
    211211        Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) {
    212         if ( isDefault() && condition != 0 ) SemanticError( condition, "default case with condition: " );
     212        if ( isDefault() && condition != nullptr ) SemanticError( condition, "default case with condition: " );
    213213}
    214214
     
    229229}
    230230
    231 void CaseStmt::print( std::ostream &os, Indenter indent ) const {
     231void CaseStmt::print( std::ostream & os, Indenter indent ) const {
    232232        if ( isDefault() ) os << indent << "Default ";
    233233        else {
     
    243243}
    244244
    245 WhileStmt::WhileStmt( Expression *condition, Statement *body, std::list< Statement * > & initialization, bool isDoWhile ):
     245WhileStmt::WhileStmt( Expression * condition, Statement * body, std::list< Statement * > & initialization, bool isDoWhile ):
    246246        Statement(), condition( condition), body( body), initialization( initialization ), isDoWhile( isDoWhile) {
    247247}
     
    256256}
    257257
    258 void WhileStmt::print( std::ostream &os, Indenter indent ) const {
     258void WhileStmt::print( std::ostream & os, Indenter indent ) const {
    259259        os << "While on condition: " << endl ;
    260260        condition->print( os, indent+1 );
     
    262262        os << indent << "... with body: " << endl;
    263263
    264         if ( body != 0 ) body->print( os, indent+1 );
    265 }
    266 
    267 ForStmt::ForStmt( std::list<Statement *> initialization, Expression *condition, Expression *increment, Statement *body ):
     264        if ( body != nullptr ) body->print( os, indent+1 );
     265}
     266
     267ForStmt::ForStmt( std::list<Statement *> initialization, Expression * condition, Expression * increment, Statement * body ):
    268268        Statement(), initialization( initialization ), condition( condition ), increment( increment ), body( body ) {
    269269}
     
    282282}
    283283
    284 void ForStmt::print( std::ostream &os, Indenter indent ) const {
     284void ForStmt::print( std::ostream & os, Indenter indent ) const {
    285285        Statement::print( os, indent ); // print labels
    286286
     
    305305        }
    306306
    307         if ( body != 0 ) {
     307        if ( body != nullptr ) {
    308308                os << "\n" << indent << "... with body: \n" << indent+1;
    309309                body->print( os, indent+1 );
     
    317317}
    318318
    319 ThrowStmt::ThrowStmt( const ThrowStmt &other ) :
     319ThrowStmt::ThrowStmt( const ThrowStmt & other ) :
    320320        Statement ( other ), kind( other.kind ), expr( maybeClone( other.expr ) ), target( maybeClone( other.target ) ) {
    321321}
     
    326326}
    327327
    328 void ThrowStmt::print( std::ostream &os, Indenter indent) const {
     328void ThrowStmt::print( std::ostream & os, Indenter indent) const {
    329329        if ( target ) os << "Non-Local ";
    330330        os << "Throw Statement, raising: ";
     
    336336}
    337337
    338 TryStmt::TryStmt( CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock ) :
     338TryStmt::TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock ) :
    339339        Statement(), block( tryBlock ),  handlers( handlers ), finallyBlock( finallyBlock ) {
    340340}
    341341
    342 TryStmt::TryStmt( const TryStmt &other ) : Statement( other ), block( maybeClone( other.block ) ), finallyBlock( maybeClone( other.finallyBlock ) ) {
     342TryStmt::TryStmt( const TryStmt & other ) : Statement( other ), block( maybeClone( other.block ) ), finallyBlock( maybeClone( other.finallyBlock ) ) {
    343343        cloneAll( other.handlers, handlers );
    344344}
     
    350350}
    351351
    352 void TryStmt::print( std::ostream &os, Indenter indent ) const {
     352void TryStmt::print( std::ostream & os, Indenter indent ) const {
    353353        os << "Try Statement" << endl;
    354354        os << indent << "... with block:" << endl << indent+1;
     
    363363
    364364        // finally block
    365         if ( finallyBlock != 0 ) {
     365        if ( finallyBlock != nullptr ) {
    366366                os << indent << "... and finally:" << endl << indent+1;
    367367                finallyBlock->print( os, indent+1 );
     
    369369}
    370370
    371 CatchStmt::CatchStmt( Kind kind, Declaration *decl, Expression *cond, Statement *body ) :
     371CatchStmt::CatchStmt( Kind kind, Declaration * decl, Expression * cond, Statement * body ) :
    372372        Statement(), kind ( kind ), decl ( decl ), cond ( cond ), body( body ) {
    373373                assertf( decl, "Catch clause must have a declaration." );
     
    383383}
    384384
    385 void CatchStmt::print( std::ostream &os, Indenter indent ) const {
     385void CatchStmt::print( std::ostream & os, Indenter indent ) const {
    386386        os << "Catch " << ((Terminate == kind) ? "Terminate" : "Resume") << " Statement" << endl;
    387387
     
    401401
    402402
    403 FinallyStmt::FinallyStmt( CompoundStmt *block ) : Statement(), block( block ) {
     403FinallyStmt::FinallyStmt( CompoundStmt * block ) : Statement(), block( block ) {
    404404}
    405405
     
    411411}
    412412
    413 void FinallyStmt::print( std::ostream &os, Indenter indent ) const {
     413void FinallyStmt::print( std::ostream & os, Indenter indent ) const {
    414414        os << "Finally Statement" << endl;
    415415        os << indent << "... with block:" << endl << indent+1;
     
    458458}
    459459
    460 void WaitForStmt::print( std::ostream &os, Indenter indent ) const {
     460void WaitForStmt::print( std::ostream & os, Indenter indent ) const {
    461461        os << "Waitfor Statement" << endl;
    462462        indent += 1;
     
    514514}
    515515
    516 void NullStmt::print( std::ostream &os, Indenter indent ) const {
     516void NullStmt::print( std::ostream & os, Indenter indent ) const {
    517517        os << "Null Statement" << endl;
    518518        Statement::print( os, indent );
     
    530530}
    531531
    532 void ImplicitCtorDtorStmt::print( std::ostream &os, Indenter indent ) const {
     532void ImplicitCtorDtorStmt::print( std::ostream & os, Indenter indent ) const {
    533533        os << "Implicit Ctor Dtor Statement" << endl;
    534534        os << indent << "... with Ctor/Dtor: ";
  • src/SynTree/Statement.h

    r4737d8e r0608e007  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Mar 12 09:01:53 2019
    13 // Update Count     : 83
     12// Last Modified On : Fri Jan 10 14:13:24 2020
     13// Update Count     : 85
    1414//
    1515
     
    257257        Statement * body;
    258258
    259         ForStmt( std::list<Statement *> initialization, Expression * condition = 0, Expression * increment = 0, Statement * body = 0 );
     259        ForStmt( std::list<Statement *> initialization, Expression * condition = nullptr, Expression * increment = nullptr, Statement * body = nullptr );
    260260        ForStmt( const ForStmt & other );
    261261        virtual ~ForStmt();
     
    357357        FinallyStmt * finallyBlock;
    358358
    359         TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = 0 );
     359        TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = nullptr );
    360360        TryStmt( const TryStmt & other );
    361361        virtual ~TryStmt();
Note: See TracChangeset for help on using the changeset viewer.