Ignore:
Timestamp:
Nov 30, 2017, 4:43:59 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
c50d54d
Parents:
4429b04
Message:

Remove label lists from various Statement constructors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Statement.cc

    r4429b04 rba3706f  
    3232using std::endl;
    3333
    34 Statement::Statement( std::list<Label> labels ) : labels( labels ) {}
     34Statement::Statement( const std::list<Label> & labels ) : labels( labels ) {}
    3535
    3636void Statement::print( std::ostream & os, Indenter ) const {
     
    4646Statement::~Statement() {}
    4747
    48 ExprStmt::ExprStmt( std::list<Label> labels, Expression *expr ) : Statement( labels ), expr( expr ) {}
     48ExprStmt::ExprStmt( Expression *expr ) : Statement(), expr( expr ) {}
    4949
    5050ExprStmt::ExprStmt( const ExprStmt &other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}
     
    6060
    6161
    62 AsmStmt::AsmStmt( std::list<Label> labels, bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ) : Statement( labels ), 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 ) {
     
    9696const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" };
    9797
    98 BranchStmt::BranchStmt( std::list<Label> labels, Label target, Type type ) throw ( SemanticError ) :
    99         Statement( labels ), originalTarget( target ), target( target ), computedTarget( nullptr ), type( type ) {
     98BranchStmt::BranchStmt( Label target, Type type ) throw ( SemanticError ) :
     99        Statement(), originalTarget( target ), target( target ), computedTarget( nullptr ), type( type ) {
    100100        //actually this is a syntactic error signaled by the parser
    101101        if ( type == BranchStmt::Goto && target.empty() ) {
     
    104104}
    105105
    106 BranchStmt::BranchStmt( std::list<Label> labels, Expression *computedTarget, Type type ) throw ( SemanticError ) :
    107         Statement( labels ), computedTarget( computedTarget ), type( type ) {
     106BranchStmt::BranchStmt( Expression *computedTarget, Type type ) throw ( SemanticError ) :
     107        Statement(), computedTarget( computedTarget ), type( type ) {
    108108        if ( type != BranchStmt::Goto || computedTarget == nullptr ) {
    109109                throw SemanticError("Computed target not valid in branch statement");
     
    118118}
    119119
    120 ReturnStmt::ReturnStmt( std::list<Label> labels, Expression *expr ) : Statement( labels ), expr( expr ) {}
     120ReturnStmt::ReturnStmt( Expression *expr ) : Statement(), expr( expr ) {}
    121121
    122122ReturnStmt::ReturnStmt( const ReturnStmt & other ) : Statement( other ), expr( maybeClone( other.expr ) ) {}
     
    135135}
    136136
    137 IfStmt::IfStmt( std::list<Label> labels, Expression *condition, Statement *thenPart, Statement *elsePart, std::list<Statement *> initialization ):
    138         Statement( labels ), condition( condition ), thenPart( thenPart ), elsePart( elsePart ), initialization( initialization ) {}
     137IfStmt::IfStmt( Expression *condition, Statement *thenPart, Statement *elsePart, std::list<Statement *> initialization ):
     138        Statement(), condition( condition ), thenPart( thenPart ), elsePart( elsePart ), initialization( initialization ) {}
    139139
    140140IfStmt::IfStmt( const IfStmt & other ) :
     
    176176}
    177177
    178 SwitchStmt::SwitchStmt( std::list<Label> labels, Expression * condition, const std::list<Statement *> &statements ):
    179         Statement( labels ), condition( condition ), statements( statements ) {
     178SwitchStmt::SwitchStmt( Expression * condition, const std::list<Statement *> &statements ):
     179        Statement(), condition( condition ), statements( statements ) {
    180180}
    181181
     
    201201}
    202202
    203 CaseStmt::CaseStmt( std::list<Label> labels, Expression *condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticError ) :
    204         Statement( labels ), condition( condition ), stmts( statements ), _isDefault( deflt ) {
     203CaseStmt::CaseStmt( Expression *condition, const std::list<Statement *> &statements, bool deflt ) throw ( SemanticError ) :
     204        Statement(), condition( condition ), stmts( statements ), _isDefault( deflt ) {
    205205        if ( isDefault() && condition != 0 ) throw SemanticError("default case with condition: ", condition);
    206206}
     
    216216}
    217217
    218 CaseStmt * CaseStmt::makeDefault( std::list<Label> labels, std::list<Statement *> stmts ) {
    219         return new CaseStmt( labels, 0, stmts, true );
     218CaseStmt * CaseStmt::makeDefault( const std::list<Label> & labels, std::list<Statement *> stmts ) {
     219        CaseStmt * stmt = new CaseStmt( nullptr, stmts, true );
     220        stmt->labels = labels;
     221        return stmt;
    220222}
    221223
     
    233235}
    234236
    235 WhileStmt::WhileStmt( std::list<Label> labels, Expression *condition, Statement *body, bool isDoWhile ):
    236         Statement( labels ), condition( condition), body( body), isDoWhile( isDoWhile) {
     237WhileStmt::WhileStmt( Expression *condition, Statement *body, bool isDoWhile ):
     238        Statement(), condition( condition), body( body), isDoWhile( isDoWhile) {
    237239}
    238240
     
    255257}
    256258
    257 ForStmt::ForStmt( std::list<Label> labels, std::list<Statement *> initialization, Expression *condition, Expression *increment, Statement *body ):
    258         Statement( labels ), initialization( initialization ), condition( condition ), increment( increment ), body( body ) {
     259ForStmt::ForStmt( std::list<Statement *> initialization, Expression *condition, Expression *increment, Statement *body ):
     260        Statement(), initialization( initialization ), condition( condition ), increment( increment ), body( body ) {
    259261}
    260262
     
    302304}
    303305
    304 ThrowStmt::ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target ) :
    305                 Statement( labels ), kind(kind), expr(expr), target(target)     {
     306ThrowStmt::ThrowStmt( Kind kind, Expression * expr, Expression * target ) :
     307                Statement(), kind(kind), expr(expr), target(target)     {
    306308        assertf(Resume == kind || nullptr == target, "Non-local termination throw is not accepted." );
    307309}
     
    326328}
    327329
    328 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock ) :
    329         Statement( labels ), block( tryBlock ),  handlers( handlers ), finallyBlock( finallyBlock ) {
     330TryStmt::TryStmt( CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock ) :
     331        Statement(), block( tryBlock ),  handlers( handlers ), finallyBlock( finallyBlock ) {
    330332}
    331333
     
    359361}
    360362
    361 CatchStmt::CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl, Expression *cond, Statement *body ) :
    362         Statement( labels ), kind ( kind ), decl ( decl ), cond ( cond ), body( body ) {
     363CatchStmt::CatchStmt( Kind kind, Declaration *decl, Expression *cond, Statement *body ) :
     364        Statement(), kind ( kind ), decl ( decl ), cond ( cond ), body( body ) {
    363365                assertf( decl, "Catch clause must have a declaration." );
    364366}
     
    391393
    392394
    393 FinallyStmt::FinallyStmt( std::list<Label> labels, CompoundStmt *block ) : Statement( labels ), block( block ) {
    394         assert( labels.empty() ); // finally statement cannot be labeled
     395FinallyStmt::FinallyStmt( CompoundStmt *block ) : Statement(), block( block ) {
    395396}
    396397
     
    408409}
    409410
    410 WaitForStmt::WaitForStmt( std::list<Label> labels ) : Statement( labels ) {
     411WaitForStmt::WaitForStmt() : Statement() {
    411412        timeout.time      = nullptr;
    412413        timeout.statement = nullptr;
     
    455456}
    456457
    457 NullStmt::NullStmt( std::list<Label> labels ) : Statement( labels ) {}
    458 NullStmt::NullStmt() : Statement( std::list<Label>() ) {}
     458NullStmt::NullStmt( const std::list<Label> & labels ) : Statement( labels ) {
     459}
    459460
    460461void NullStmt::print( std::ostream &os, Indenter ) const {
     
    462463}
    463464
    464 ImplicitCtorDtorStmt::ImplicitCtorDtorStmt( Statement * callStmt ) : Statement( std::list<Label>() ), callStmt( callStmt ) {
     465ImplicitCtorDtorStmt::ImplicitCtorDtorStmt( Statement * callStmt ) : Statement(), callStmt( callStmt ) {
    465466        assert( callStmt );
    466467}
Note: See TracChangeset for help on using the changeset viewer.