Changeset ba3706f


Ignore:
Timestamp:
Nov 30, 2017, 4:43:59 PM (6 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

Location:
src
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/FixNames.cc

    r4429b04 rba3706f  
    121121                                throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl);
    122122                        }
    123                         functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant::from_int( 0 ) ) ) );
     123                        functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( new ConstantExpr( Constant::from_int( 0 ) ) ) );
    124124                        CodeGen::FixMain::registerMain( functionDecl );
    125125                }
  • src/Common/PassVisitor.impl.h

    r4429b04 rba3706f  
    5555                it,
    5656                [](Declaration * decl) -> auto {
    57                         return new DeclStmt( noLabels, decl );
     57                        return new DeclStmt( decl );
    5858                }
    5959        );
     
    251251            || ( empty( beforeDecls ) && empty( afterDecls )) );
    252252
    253         CompoundStmt *compound = new CompoundStmt( noLabels );
     253        CompoundStmt *compound = new CompoundStmt();
    254254        if( !empty(beforeDecls) ) { splice( std::back_inserter( compound->get_kids() ), beforeDecls ); }
    255255        if( !empty(beforeStmts) ) { compound->get_kids().splice( compound->get_kids().end(), *beforeStmts ); }
  • src/Concurrency/Keywords.cc

    r4429b04 rba3706f  
    3838
    3939namespace Concurrency {
    40 
    41         namespace {
    42                 const std::list<Label> noLabels;
    43                 const std::list< Attribute * > noAttributes;
    44                 Type::StorageClasses noStorage;
    45                 Type::Qualifiers noQualifiers;
    46         }
    47 
    4840        //=============================================================================================
    4941        // Pass declarations
     
    296288                ObjectDecl * this_decl = new ObjectDecl(
    297289                        "this",
    298                         noStorage,
     290                        noStorageClasses,
    299291                        LinkageSpec::Cforall,
    300292                        nullptr,
     
    313305                        new ObjectDecl(
    314306                                "ret",
    315                                 noStorage,
     307                                noStorageClasses,
    316308                                LinkageSpec::Cforall,
    317309                                nullptr,
     
    346338                        main_decl = new FunctionDecl(
    347339                                "main",
    348                                 noStorage,
     340                                noStorageClasses,
    349341                                LinkageSpec::Cforall,
    350342                                main_type,
     
    363355                ObjectDecl * field = new ObjectDecl(
    364356                        field_name,
    365                         noStorage,
     357                        noStorageClasses,
    366358                        LinkageSpec::Cforall,
    367359                        nullptr,
     
    379371
    380372        void ConcurrentSueKeyword::addRoutines( ObjectDecl * field, FunctionDecl * func ) {
    381                 CompoundStmt * statement = new CompoundStmt( noLabels );
     373                CompoundStmt * statement = new CompoundStmt();
    382374                statement->push_back(
    383375                        new ReturnStmt(
    384                                 noLabels,
    385376                                new AddressExpr(
    386377                                        new MemberExpr(
     
    488479                ObjectDecl * monitors = new ObjectDecl(
    489480                        "__monitor",
    490                         noStorage,
     481                        noStorageClasses,
    491482                        LinkageSpec::Cforall,
    492483                        nullptr,
     
    509500                // monitor_guard_t __guard = { __monitors, #, func };
    510501                body->push_front(
    511                         new DeclStmt( noLabels, new ObjectDecl(
     502                        new DeclStmt( new ObjectDecl(
    512503                                "__guard",
    513                                 noStorage,
     504                                noStorageClasses,
    514505                                LinkageSpec::Cforall,
    515506                                nullptr,
     
    530521
    531522                //monitor_desc * __monitors[] = { get_monitor(a), get_monitor(b) };
    532                 body->push_front( new DeclStmt( noLabels, monitors) );
     523                body->push_front( new DeclStmt( monitors) );
    533524        }
    534525
     
    536527                ObjectDecl * monitors = new ObjectDecl(
    537528                        "__monitors",
    538                         noStorage,
     529                        noStorageClasses,
    539530                        LinkageSpec::Cforall,
    540531                        nullptr,
     
    569560                // monitor_guard_t __guard = { __monitors, #, func };
    570561                body->push_front(
    571                         new DeclStmt( noLabels, new ObjectDecl(
     562                        new DeclStmt( new ObjectDecl(
    572563                                "__guard",
    573                                 noStorage,
     564                                noStorageClasses,
    574565                                LinkageSpec::Cforall,
    575566                                nullptr,
     
    591582
    592583                //monitor_desc * __monitors[] = { get_monitor(a), get_monitor(b) };
    593                 body->push_front( new DeclStmt( noLabels, monitors) );
     584                body->push_front( new DeclStmt( monitors) );
    594585        }
    595586
     
    631622                stmt->push_back(
    632623                        new ExprStmt(
    633                                 noLabels,
    634624                                new UntypedExpr(
    635625                                        new NameExpr( "__thrd_start" ),
  • src/Concurrency/Waitfor.cc

    r4429b04 rba3706f  
    100100
    101101namespace Concurrency {
    102 
    103         namespace {
    104                 const std::list<Label> noLabels;
    105                 const std::list< Attribute * > noAttributes;
    106                 Type::StorageClasses noStorage;
    107                 Type::Qualifiers noQualifiers;
    108         }
    109 
    110102        //=============================================================================================
    111103        // Pass declarations
     
    203195                        ResolvExpr::findVoidExpression( expr, indexer );
    204196
    205                         return new ExprStmt( noLabels, expr );
     197                        return new ExprStmt( expr );
    206198                }
    207199
     
    259251                if( !decl_monitor || !decl_acceptable || !decl_mask ) throw SemanticError( "waitfor keyword requires monitors to be in scope, add #include <monitor>", waitfor );
    260252
    261                 CompoundStmt * stmt = new CompoundStmt( noLabels );
     253                CompoundStmt * stmt = new CompoundStmt();
    262254
    263255                ObjectDecl * acceptables = declare( waitfor->clauses.size(), stmt );
     
    281273                );
    282274
    283                 CompoundStmt * compound = new CompoundStmt( noLabels );
     275                CompoundStmt * compound = new CompoundStmt();
    284276                stmt->push_back( new IfStmt(
    285                         noLabels,
    286277                        safeCond( new VariableExpr( flag ) ),
    287278                        compound,
     
    313304                );
    314305
    315                 stmt->push_back( new DeclStmt( noLabels, acceptables) );
     306                stmt->push_back( new DeclStmt( acceptables) );
    316307
    317308                Expression * set = new UntypedExpr(
     
    326317                ResolvExpr::findVoidExpression( set, indexer );
    327318
    328                 stmt->push_back( new ExprStmt( noLabels, set ) );
     319                stmt->push_back( new ExprStmt( set ) );
    329320
    330321                return acceptables;
     
    341332                );
    342333
    343                 stmt->push_back( new DeclStmt( noLabels, flag) );
     334                stmt->push_back( new DeclStmt( flag) );
    344335
    345336                return flag;
     
    357348                ResolvExpr::findVoidExpression( expr, indexer );
    358349
    359                 return new ExprStmt( noLabels, expr );
     350                return new ExprStmt( expr );
    360351        }
    361352
     
    399390                );
    400391
    401                 stmt->push_back( new DeclStmt( noLabels, mon) );
     392                stmt->push_back( new DeclStmt( mon) );
    402393
    403394                return mon;
     
    411402
    412403                stmt->push_back( new IfStmt(
    413                         noLabels,
    414404                        safeCond( clause.condition ),
    415405                        new CompoundStmt({
     
    447437                );
    448438
    449                 stmt->push_back( new DeclStmt( noLabels, timeout ) );
     439                stmt->push_back( new DeclStmt( timeout ) );
    450440
    451441                if( time ) {
    452442                        stmt->push_back( new IfStmt(
    453                                 noLabels,
    454443                                safeCond( time_cond ),
    455444                                new CompoundStmt({
    456445                                        new ExprStmt(
    457                                                 noLabels,
    458446                                                makeOpAssign(
    459447                                                        new VariableExpr( timeout ),
     
    471459                if( has_else ) {
    472460                        stmt->push_back( new IfStmt(
    473                                 noLabels,
    474461                                safeCond( else_cond ),
    475462                                new CompoundStmt({
    476463                                        new ExprStmt(
    477                                                 noLabels,
    478464                                                makeOpAssign(
    479465                                                        new VariableExpr( timeout ),
     
    511497                );
    512498
    513                 stmt->push_back( new DeclStmt( noLabels, index ) );
     499                stmt->push_back( new DeclStmt( index ) );
    514500
    515501                ObjectDecl * mask = ObjectDecl::newObject(
     
    526512                );
    527513
    528                 stmt->push_back( new DeclStmt( noLabels, mask ) );
     514                stmt->push_back( new DeclStmt( mask ) );
    529515
    530516                stmt->push_back( new ExprStmt(
    531                         noLabels,
    532517                        new ApplicationExpr(
    533518                                VariableExpr::functionPointer( decl_waitfor ),
     
    557542        ) {
    558543                SwitchStmt * swtch = new SwitchStmt(
    559                         noLabels,
    560544                        result,
    561545                        std::list<Statement *>()
     
    566550                        swtch->statements.push_back(
    567551                                new CaseStmt(
    568                                         noLabels,
    569552                                        new ConstantExpr( Constant::from_ulong( i++ ) ),
    570553                                        {
    571554                                                clause.statement,
    572555                                                new BranchStmt(
    573                                                         noLabels,
    574556                                                        "",
    575557                                                        BranchStmt::Break
     
    583565                        swtch->statements.push_back(
    584566                                new CaseStmt(
    585                                         noLabels,
    586567                                        new ConstantExpr( Constant::from_int( -2 ) ),
    587568                                        {
    588569                                                waitfor->timeout.statement,
    589570                                                new BranchStmt(
    590                                                         noLabels,
    591571                                                        "",
    592572                                                        BranchStmt::Break
     
    600580                        swtch->statements.push_back(
    601581                                new CaseStmt(
    602                                         noLabels,
    603582                                        new ConstantExpr( Constant::from_int( -1 ) ),
    604583                                        {
    605584                                                waitfor->orelse.statement,
    606585                                                new BranchStmt(
    607                                                         noLabels,
    608586                                                        "",
    609587                                                        BranchStmt::Break
  • src/ControlStruct/ExceptTranslate.cc

    r4429b04 rba3706f  
    3030#include "SynTree/Expression.h"       // for UntypedExpr, ConstantExpr, Name...
    3131#include "SynTree/Initializer.h"      // for SingleInit, ListInit
    32 #include "SynTree/Label.h"            // for Label, noLabels
     32#include "SynTree/Label.h"            // for Label
    3333#include "SynTree/Mutator.h"          // for mutateAll
    3434#include "SynTree/Statement.h"        // for CompoundStmt, CatchStmt, ThrowStmt
     
    5757
    5858        void appendDeclStmt( CompoundStmt * block, Declaration * item ) {
    59                 block->push_back(new DeclStmt(noLabels, item));
     59                block->push_back(new DeclStmt(item));
    6060        }
    6161
     
    205205                throwStmt->set_expr( nullptr );
    206206                delete throwStmt;
    207                 return new ExprStmt( noLabels, call );
     207                return new ExprStmt( call );
    208208        }
    209209
     
    220220                assert( handler_except_decl );
    221221
    222                 CompoundStmt * result = new CompoundStmt( throwStmt->get_labels() );
    223                 result->push_back( new ExprStmt( noLabels, UntypedExpr::createAssign(
     222                CompoundStmt * result = new CompoundStmt();
     223                result->labels =  throwStmt->labels;
     224                result->push_back( new ExprStmt( UntypedExpr::createAssign(
    224225                        nameOf( handler_except_decl ),
    225226                        new ConstantExpr( Constant::null(
     
    231232                        ) ) );
    232233                result->push_back( new ExprStmt(
    233                         noLabels,
    234234                        new UntypedExpr( new NameExpr( "__cfaehm__rethrow_terminate" ) )
    235235                        ) );
     
    248248                // return false;
    249249                Statement * result = new ReturnStmt(
    250                         throwStmt->get_labels(),
    251250                        new ConstantExpr( Constant::from_bool( false ) )
    252251                        );
     252                result->labels = throwStmt->labels;
    253253                delete throwStmt;
    254254                return result;
     
    291291                        // }
    292292                        // return;
    293                         CompoundStmt * block = new CompoundStmt( noLabels );
     293                        CompoundStmt * block = new CompoundStmt();
    294294
    295295                        // Just copy the exception value. (Post Validation)
     
    304304                                        ) })
    305305                                );
    306                         block->push_back( new DeclStmt( noLabels, local_except ) );
     306                        block->push_back( new DeclStmt( local_except ) );
    307307
    308308                        // Add the cleanup attribute.
     
    324324
    325325                        std::list<Statement *> caseBody
    326                                         { block, new ReturnStmt( noLabels, nullptr ) };
     326                                        { block, new ReturnStmt( nullptr ) };
    327327                        handler_wrappers.push_back( new CaseStmt(
    328                                 noLabels,
    329328                                new ConstantExpr( Constant::from_int( index ) ),
    330329                                caseBody
     
    340339
    341340                SwitchStmt * handler_lookup = new SwitchStmt(
    342                         noLabels,
    343341                        nameOf( index_obj ),
    344342                        stmt_handlers
    345343                        );
    346                 CompoundStmt * body = new CompoundStmt( noLabels );
     344                CompoundStmt * body = new CompoundStmt();
    347345                body->push_back( handler_lookup );
    348346
     
    363361                // }
    364362
    365                 CompoundStmt * block = new CompoundStmt( noLabels );
     363                CompoundStmt * block = new CompoundStmt();
    366364
    367365                // Local Declaration
     
    369367                        dynamic_cast<ObjectDecl *>( modded_handler->get_decl() );
    370368                assert( local_except );
    371                 block->push_back( new DeclStmt( noLabels, local_except ) );
     369                block->push_back( new DeclStmt( local_except ) );
    372370
    373371                // Check for type match.
     
    381379                }
    382380                // Construct the match condition.
    383                 block->push_back( new IfStmt( noLabels,
     381                block->push_back( new IfStmt(
    384382                        cond, modded_handler->get_body(), nullptr ) );
    385383
     
    397395                // }
    398396
    399                 CompoundStmt * body = new CompoundStmt( noLabels );
     397                CompoundStmt * body = new CompoundStmt();
    400398
    401399                FunctionType * func_type = match_func_t.clone();
     
    413411
    414412                        // Create new body.
    415                         handler->set_body( new ReturnStmt( noLabels,
     413                        handler->set_body( new ReturnStmt(
    416414                                new ConstantExpr( Constant::from_int( index ) ) ) );
    417415
     
    421419                }
    422420
    423                 body->push_back( new ReturnStmt( noLabels,
     421                body->push_back( new ReturnStmt(
    424422                        new ConstantExpr( Constant::from_int( 0 ) ) ) );
    425423
     
    441439                args.push_back( nameOf( terminate_match ) );
    442440
    443                 CompoundStmt * callStmt = new CompoundStmt( noLabels );
    444                 callStmt->push_back( new ExprStmt( noLabels, caller ) );
     441                CompoundStmt * callStmt = new CompoundStmt();
     442                callStmt->push_back( new ExprStmt( caller ) );
    445443                return callStmt;
    446444        }
     
    451449                //     HANDLER WRAPPERS { `hander->body`; return true; }
    452450                // }
    453                 CompoundStmt * body = new CompoundStmt( noLabels );
     451                CompoundStmt * body = new CompoundStmt();
    454452
    455453                FunctionType * func_type = handle_func_t.clone();
     
    464462                                dynamic_cast<CompoundStmt*>( handler->get_body() );
    465463                        if ( ! handling_code ) {
    466                                 handling_code = new CompoundStmt( noLabels );
     464                                handling_code = new CompoundStmt();
    467465                                handling_code->push_back( handler->get_body() );
    468466                        }
    469                         handling_code->push_back( new ReturnStmt( noLabels,
     467                        handling_code->push_back( new ReturnStmt(
    470468                                new ConstantExpr( Constant::from_bool( true ) ) ) );
    471469                        handler->set_body( handling_code );
     
    476474                }
    477475
    478                 body->push_back( new ReturnStmt( noLabels,
     476                body->push_back( new ReturnStmt(
    479477                        new ConstantExpr( Constant::from_bool( false ) ) ) );
    480478
     
    486484                        Statement * wraps,
    487485                        FunctionDecl * resume_handler ) {
    488                 CompoundStmt * body = new CompoundStmt( noLabels );
     486                CompoundStmt * body = new CompoundStmt();
    489487
    490488                // struct __try_resume_node __resume_node
     
    521519                setup->get_args().push_back( nameOf( resume_handler ) );
    522520
    523                 body->push_back( new ExprStmt( noLabels, setup ) );
     521                body->push_back( new ExprStmt( setup ) );
    524522
    525523                body->push_back( wraps );
     
    646644                // Generate a prefix for the function names?
    647645
    648                 CompoundStmt * block = new CompoundStmt( noLabels );
     646                CompoundStmt * block = new CompoundStmt();
    649647                CompoundStmt * inner = take_try_block( tryStmt );
    650648
  • src/ControlStruct/ForExprMutator.cc

    r4429b04 rba3706f  
    2929                // Create compound statement, move initializers outside,
    3030                // the resut of the original stays as is.
    31                 CompoundStmt *block = new CompoundStmt( std::list< Label >() );
     31                CompoundStmt *block = new CompoundStmt();
    3232                std::list<Statement *> &stmts = block->get_kids();
    3333                stmts.splice( stmts.end(), init );
  • src/ControlStruct/MLEMutator.cc

    r4429b04 rba3706f  
    149149
    150150                        if ( CaseStmt * c = dynamic_cast< CaseStmt * >( statements.back() ) ) {
    151                                 std::list<Label> temp; temp.push_back( brkLabel );
    152                                 c->get_statements().push_back( new BranchStmt( temp, Label("brkLabel"), BranchStmt::Break ) );
     151                                Statement * stmt = new BranchStmt( Label("brkLabel"), BranchStmt::Break );
     152                                stmt->labels.push_back( brkLabel );
     153                                c->get_statements().push_back( stmt );
    153154                        } else assert(0); // as of this point, all statements of a switch are still CaseStmts
    154155                } // if
     
    232233                // transform break/continue statements into goto to simplify later handling of branches
    233234                delete branchStmt;
    234                 return new BranchStmt( std::list<Label>(), exitLabel, BranchStmt::Goto );
     235                return new BranchStmt( exitLabel, BranchStmt::Goto );
    235236        }
    236237
     
    239240                CompoundStmt *newBody;
    240241                if ( ! (newBody = dynamic_cast<CompoundStmt *>( bodyLoop )) ) {
    241                         newBody = new CompoundStmt( std::list< Label >() );
     242                        newBody = new CompoundStmt();
    242243                        newBody->get_kids().push_back( bodyLoop );
    243244                } // if
  • src/GenPoly/Box.cc

    r4429b04 rba3706f  
    4949#include "SynTree/Expression.h"          // for ApplicationExpr, UntypedExpr
    5050#include "SynTree/Initializer.h"         // for SingleInit, Initializer, Lis...
    51 #include "SynTree/Label.h"               // for Label, noLabels
     51#include "SynTree/Label.h"               // for Label
    5252#include "SynTree/Mutator.h"             // for maybeMutate, Mutator, mutateAll
    5353#include "SynTree/Statement.h"           // for ExprStmt, DeclStmt, ReturnStmt
     
    293293                FunctionDecl *layoutDecl = new FunctionDecl( layoutofName( typeDecl ),
    294294                                                                                                         functionNesting > 0 ? Type::StorageClasses() : Type::StorageClasses( Type::Static ),
    295                                                                                                          LinkageSpec::AutoGen, layoutFnType, new CompoundStmt( noLabels ),
     295                                                                                                         LinkageSpec::AutoGen, layoutFnType, new CompoundStmt(),
    296296                                                                                                         std::list< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) );
    297297                layoutDecl->fixUniqueId();
     
    321321        /// makes an if-statement with a single-expression if-block and no then block
    322322        Statement *makeCond( Expression *cond, Expression *ifPart ) {
    323                 return new IfStmt( noLabels, cond, new ExprStmt( noLabels, ifPart ), 0 );
     323                return new IfStmt( cond, new ExprStmt( ifPart ), 0 );
    324324        }
    325325
     
    340340        /// adds an expression to a compound statement
    341341        void addExpr( CompoundStmt *stmts, Expression *expr ) {
    342                 stmts->get_kids().push_back( new ExprStmt( noLabels, expr ) );
     342                stmts->get_kids().push_back( new ExprStmt( expr ) );
    343343        }
    344344
     
    629629                ObjectDecl *Pass1::makeTemporary( Type *type ) {
    630630                        ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), Type::StorageClasses(), LinkageSpec::C, 0, type, 0 );
    631                         stmtsToAddBefore.push_back( new DeclStmt( noLabels, newObj ) );
     631                        stmtsToAddBefore.push_back( new DeclStmt( newObj ) );
    632632                        return newObj;
    633633                }
     
    740740                                ObjectDecl *newObj = ObjectDecl::newObject( tempNamer.newName(), newType, nullptr );
    741741                                newObj->get_type()->get_qualifiers() = Type::Qualifiers(); // TODO: is this right???
    742                                 stmtsToAddBefore.push_back( new DeclStmt( noLabels, newObj ) );
     742                                stmtsToAddBefore.push_back( new DeclStmt( newObj ) );
    743743                                UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); // TODO: why doesn't this just use initialization syntax?
    744744                                assign->get_args().push_back( new VariableExpr( newObj ) );
    745745                                assign->get_args().push_back( arg );
    746                                 stmtsToAddBefore.push_back( new ExprStmt( noLabels, assign ) );
     746                                stmtsToAddBefore.push_back( new ExprStmt( assign ) );
    747747                                arg = new AddressExpr( new VariableExpr( newObj ) );
    748748                        } // if
     
    888888                                // void return
    889889                                addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
    890                                 bodyStmt = new ExprStmt( noLabels, adapteeApp );
     890                                bodyStmt = new ExprStmt( adapteeApp );
    891891                        } else if ( isDynType( adaptee->get_returnVals().front()->get_type(), tyVars ) ) {
    892892                                // return type T
     
    900900                                addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
    901901                                assign->get_args().push_back( adapteeApp );
    902                                 bodyStmt = new ExprStmt( noLabels, assign );
     902                                bodyStmt = new ExprStmt( assign );
    903903                        } else {
    904904                                // adapter for a function that returns a monomorphic value
    905905                                addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars );
    906                                 bodyStmt = new ReturnStmt( noLabels, adapteeApp );
     906                                bodyStmt = new ReturnStmt( adapteeApp );
    907907                        } // if
    908                         CompoundStmt *adapterBody = new CompoundStmt( noLabels );
     908                        CompoundStmt *adapterBody = new CompoundStmt();
    909909                        adapterBody->get_kids().push_back( bodyStmt );
    910910                        std::string adapterName = makeAdapterName( mangleName );
     
    952952                                                std::pair< AdapterIter, bool > answer = adapters.insert( std::pair< std::string, DeclarationWithType *>( mangleName, newAdapter ) );
    953953                                                adapter = answer.first;
    954                                                 stmtsToAddBefore.push_back( new DeclStmt( noLabels, newAdapter ) );
     954                                                stmtsToAddBefore.push_back( new DeclStmt( newAdapter ) );
    955955                                        } // if
    956956                                        assert( adapter != adapters.end() );
     
    12791279                                                retval->set_name( "_retval" );
    12801280                                        }
    1281                                         functionDecl->get_statements()->get_kids().push_front( new DeclStmt( noLabels, retval ) );
     1281                                        functionDecl->get_statements()->get_kids().push_front( new DeclStmt( retval ) );
    12821282                                        DeclarationWithType * newRet = retval->clone(); // for ownership purposes
    12831283                                        ftype->get_returnVals().front() = newRet;
     
    15191519                                        // (alloca was previously used, but can't be safely used in loops)
    15201520                                        ObjectDecl *newBuf = ObjectDecl::newObject( bufNamer.newName(), polyToMonoType( objectDecl->type ), nullptr );
    1521                                         stmtsToAddBefore.push_back( new DeclStmt( noLabels, newBuf ) );
     1521                                        stmtsToAddBefore.push_back( new DeclStmt( newBuf ) );
    15221522
    15231523                                        delete objectDecl->get_init();
     
    15981598                ObjectDecl *PolyGenericCalculator::makeVar( const std::string &name, Type *type, Initializer *init ) {
    15991599                        ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init );
    1600                         stmtsToAddBefore.push_back( new DeclStmt( noLabels, newObj ) );
     1600                        stmtsToAddBefore.push_back( new DeclStmt( newObj ) );
    16011601                        return newObj;
    16021602                }
     
    16771677                                        addOtypeParamsToLayoutCall( layoutCall, otypeParams );
    16781678
    1679                                         stmtsToAddBefore.push_back( new ExprStmt( noLabels, layoutCall ) );
     1679                                        stmtsToAddBefore.push_back( new ExprStmt( layoutCall ) );
    16801680                                }
    16811681
     
    17031703                                addOtypeParamsToLayoutCall( layoutCall, otypeParams );
    17041704
    1705                                 stmtsToAddBefore.push_back( new ExprStmt( noLabels, layoutCall ) );
     1705                                stmtsToAddBefore.push_back( new ExprStmt( layoutCall ) );
    17061706
    17071707                                return true;
  • src/GenPoly/InstantiateGeneric.cc

    r4429b04 rba3706f  
    526526                                        Expression * init = new CastExpr( new AddressExpr( memberExpr ), new PointerType( Type::Qualifiers(), concType->clone() ) );
    527527                                        ObjectDecl * tmp = ObjectDecl::newObject( tmpNamer.newName(), new ReferenceType( Type::Qualifiers(), concType ), new SingleInit( init ) );
    528                                         stmtsToAddBefore.push_back( new DeclStmt( noLabels, tmp ) );
     528                                        stmtsToAddBefore.push_back( new DeclStmt( tmp ) );
    529529                                        return new VariableExpr( tmp );
    530530                                } else {
  • src/GenPoly/Specialize.cc

    r4429b04 rba3706f  
    3535#include "SynTree/Declaration.h"         // for FunctionDecl, DeclarationWit...
    3636#include "SynTree/Expression.h"          // for ApplicationExpr, Expression
    37 #include "SynTree/Label.h"               // for Label, noLabels
     37#include "SynTree/Label.h"               // for Label
    3838#include "SynTree/Mutator.h"             // for mutateAll
    3939#include "SynTree/Statement.h"           // for CompoundStmt, DeclStmt, Expr...
     
    234234                } // if
    235235                // create new thunk with same signature as formal type (C linkage, empty body)
    236                 FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), Type::StorageClasses(), LinkageSpec::C, newType, new CompoundStmt( noLabels ) );
     236                FunctionDecl *thunkFunc = new FunctionDecl( thunkNamer.newName(), Type::StorageClasses(), LinkageSpec::C, newType, new CompoundStmt() );
    237237                thunkFunc->fixUniqueId();
    238238
     
    287287                Statement *appStmt;
    288288                if ( funType->returnVals.empty() ) {
    289                         appStmt = new ExprStmt( noLabels, appExpr );
    290                 } else {
    291                         appStmt = new ReturnStmt( noLabels, appExpr );
     289                        appStmt = new ExprStmt( appExpr );
     290                } else {
     291                        appStmt = new ReturnStmt( appExpr );
    292292                } // if
    293293                thunkFunc->statements->kids.push_back( appStmt );
    294294
    295295                // add thunk definition to queue of statements to add
    296                 stmtsToAddBefore.push_back( new DeclStmt( noLabels, thunkFunc ) );
     296                stmtsToAddBefore.push_back( new DeclStmt( thunkFunc ) );
    297297                // return address of thunk function as replacement expression
    298298                return new AddressExpr( new VariableExpr( thunkFunc ) );
  • src/InitTweak/FixGlobalInit.cc

    r4429b04 rba3706f  
    2929#include "SynTree/Expression.h"    // for ConstantExpr, Expression (ptr only)
    3030#include "SynTree/Initializer.h"   // for ConstructorInit, Initializer
    31 #include "SynTree/Label.h"         // for Label, noLabels
     31#include "SynTree/Label.h"         // for Label
    3232#include "SynTree/Statement.h"     // for CompoundStmt, Statement (ptr only)
    3333#include "SynTree/Type.h"          // for Type, Type::StorageClasses, Functi...
     
    9292                        dtorParameters.push_back( new ConstantExpr( Constant::from_int( 102 ) ) );
    9393                }
    94                 initFunction = new FunctionDecl( "_init_" + fixedName, Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     94                initFunction = new FunctionDecl( "_init_" + fixedName, Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt() );
    9595                initFunction->get_attributes().push_back( new Attribute( "constructor", ctorParameters ) );
    96                 destroyFunction = new FunctionDecl( "_destroy_" + fixedName, Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     96                destroyFunction = new FunctionDecl( "_destroy_" + fixedName, Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt() );
    9797                destroyFunction->get_attributes().push_back( new Attribute( "destructor", dtorParameters ) );
    9898        }
  • src/InitTweak/FixInit.cc

    r4429b04 rba3706f  
    4949#include "SynTree/Expression.h"        // for UniqueExpr, VariableExpr, Unty...
    5050#include "SynTree/Initializer.h"       // for ConstructorInit, SingleInit
    51 #include "SynTree/Label.h"             // for Label, noLabels, operator<
     51#include "SynTree/Label.h"             // for Label, operator<
    5252#include "SynTree/Mutator.h"           // for mutateAll, Mutator, maybeMutate
    5353#include "SynTree/Statement.h"         // for ExprStmt, CompoundStmt, Branch...
     
    544544                        // add all temporary declarations and their constructors
    545545                        for ( ObjectDecl * obj : tempDecls ) {
    546                                 stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
     546                                stmtsToAddBefore.push_back( new DeclStmt( obj ) );
    547547                        } // for
    548548                        for ( ObjectDecl * obj : returnDecls ) {
    549                                 stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
     549                                stmtsToAddBefore.push_back( new DeclStmt( obj ) );
    550550                        } // for
    551551
    552552                        // add destructors after current statement
    553553                        for ( Expression * dtor : dtors ) {
    554                                 stmtsToAddAfter.push_back( new ExprStmt( noLabels, dtor ) );
     554                                stmtsToAddAfter.push_back( new ExprStmt( dtor ) );
    555555                        } // for
    556556
     
    598598                        if ( ! result->isVoid() ) {
    599599                                for ( ObjectDecl * obj : stmtExpr->get_returnDecls() ) {
    600                                         stmtsToAddBefore.push_back( new DeclStmt( noLabels, obj ) );
     600                                        stmtsToAddBefore.push_back( new DeclStmt( obj ) );
    601601                                } // for
    602602                                // add destructors after current statement
    603603                                for ( Expression * dtor : stmtExpr->get_dtors() ) {
    604                                         stmtsToAddAfter.push_back( new ExprStmt( noLabels, dtor ) );
     604                                        stmtsToAddAfter.push_back( new ExprStmt( dtor ) );
    605605                                } // for
    606606                                // must have a non-empty body, otherwise it wouldn't have a result
    607607                                assert( ! stmts.empty() );
    608608                                assert( ! stmtExpr->get_returnDecls().empty() );
    609                                 stmts.push_back( new ExprStmt( noLabels, new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
     609                                stmts.push_back( new ExprStmt( new VariableExpr( stmtExpr->get_returnDecls().front() ) ) );
    610610                                stmtExpr->get_returnDecls().clear();
    611611                                stmtExpr->get_dtors().clear();
     
    685685
    686686                                                // generate body of if
    687                                                 CompoundStmt * initStmts = new CompoundStmt( noLabels );
     687                                                CompoundStmt * initStmts = new CompoundStmt();
    688688                                                std::list< Statement * > & body = initStmts->get_kids();
    689689                                                body.push_back( ctor );
    690                                                 body.push_back( new ExprStmt( noLabels, setTrue ) );
     690                                                body.push_back( new ExprStmt( setTrue ) );
    691691
    692692                                                // put it all together
    693                                                 IfStmt * ifStmt = new IfStmt( noLabels, new VariableExpr( isUninitializedVar ), initStmts, 0 );
    694                                                 stmtsToAddAfter.push_back( new DeclStmt( noLabels, isUninitializedVar ) );
     693                                                IfStmt * ifStmt = new IfStmt( new VariableExpr( isUninitializedVar ), initStmts, 0 );
     694                                                stmtsToAddAfter.push_back( new DeclStmt( isUninitializedVar ) );
    695695                                                stmtsToAddAfter.push_back( ifStmt );
    696696
     
    707707
    708708                                                        // void __objName_dtor_atexitN(...) {...}
    709                                                         FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ) );
     709                                                        FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), Type::StorageClasses( Type::Static ), LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt() );
    710710                                                        dtorCaller->fixUniqueId();
    711711                                                        dtorCaller->get_statements()->push_back( dtorStmt );
     
    715715                                                        callAtexit->get_args().push_back( new VariableExpr( dtorCaller ) );
    716716
    717                                                         body.push_back( new ExprStmt( noLabels, callAtexit ) );
     717                                                        body.push_back( new ExprStmt( callAtexit ) );
    718718
    719719                                                        // hoist variable and dtor caller decls to list of decls that will be added into global scope
  • src/InitTweak/InitTweak.cc

    r4429b04 rba3706f  
    1919#include "SynTree/Expression.h"    // for Expression, UntypedExpr, Applicati...
    2020#include "SynTree/Initializer.h"   // for Initializer, ListInit, Designation
    21 #include "SynTree/Label.h"         // for Label, noLabels
     21#include "SynTree/Label.h"         // for Label
    2222#include "SynTree/Statement.h"     // for CompoundStmt, ExprStmt, BranchStmt
    2323#include "SynTree/Type.h"          // for FunctionType, ArrayType, PointerType
     
    195195                        callExpr->get_args().splice( callExpr->get_args().end(), args );
    196196
    197                         *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), nullptr );
     197                        *out++ = new IfStmt( cond, new ExprStmt( callExpr ), nullptr );
    198198
    199199                        UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) );
    200200                        increment->get_args().push_back( index->clone() );
    201                         *out++ = new ExprStmt( noLabels, increment );
     201                        *out++ = new ExprStmt( increment );
    202202                }
    203203
     
    244244                                        std::list< Statement * > stmts;
    245245                                        build( callExpr, idx, idxEnd, init, back_inserter( stmts ) );
    246                                         stmts.push_back( new BranchStmt( noLabels, switchLabel, BranchStmt::Break ) );
    247                                         CaseStmt * caseStmt = new CaseStmt( noLabels, condition, stmts );
     246                                        stmts.push_back( new BranchStmt( switchLabel, BranchStmt::Break ) );
     247                                        CaseStmt * caseStmt = new CaseStmt( condition, stmts );
    248248                                        branches.push_back( caseStmt );
    249249                                }
    250                                 *out++ = new SwitchStmt( noLabels, index->clone(), branches );
    251                                 *out++ = new NullStmt( std::list<Label>{ switchLabel } );
     250                                *out++ = new SwitchStmt( index->clone(), branches );
     251                                *out++ = new NullStmt( { switchLabel } );
    252252                        }
    253253                }
     
    262262        Statement * InitImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {
    263263                if ( ! init ) return nullptr;
    264                 CompoundStmt * block = new CompoundStmt( noLabels );
     264                CompoundStmt * block = new CompoundStmt();
    265265                build( dst, indices.begin(), indices.end(), init, back_inserter( block->get_kids() ) );
    266266                if ( block->get_kids().empty() ) {
  • src/MakeLibCfa.cc

    r4429b04 rba3706f  
    116116                        } // for
    117117
    118                         funcDecl->set_statements( new CompoundStmt( std::list< Label >() ) );
     118                        funcDecl->set_statements( new CompoundStmt() );
    119119                        newDecls.push_back( funcDecl );
    120120
     
    130130                          case CodeGen::OT_INFIXASSIGN:
    131131                                        // return the recursive call
    132                                         stmt = new ReturnStmt( noLabels, newExpr );
     132                                        stmt = new ReturnStmt( newExpr );
    133133                                        break;
    134134                          case CodeGen::OT_CTOR:
    135135                          case CodeGen::OT_DTOR:
    136136                                        // execute the recursive call
    137                                         stmt = new ExprStmt( noLabels, newExpr );
     137                                        stmt = new ExprStmt( newExpr );
    138138                                        break;
    139139                          case CodeGen::OT_CONSTANT:
  • src/Parser/StatementNode.cc

    r4429b04 rba3706f  
    3737        DeclarationNode *agg = decl->extractAggregate();
    3838        if ( agg ) {
    39                 StatementNode *nextStmt = new StatementNode( new DeclStmt( noLabels, maybeBuild< Declaration >( decl ) ) );
     39                StatementNode *nextStmt = new StatementNode( new DeclStmt( maybeBuild< Declaration >( decl ) ) );
    4040                set_next( nextStmt );
    4141                if ( decl->get_next() ) {
     
    5050                agg = decl;
    5151        } // if
    52         stmt.reset( new DeclStmt( noLabels, maybeMoveBuild< Declaration >(agg) ) );
     52        stmt.reset( new DeclStmt( maybeMoveBuild< Declaration >(agg) ) );
    5353} // StatementNode::StatementNode
    5454
     
    7575
    7676        if ( e )
    77                 return new ExprStmt( noLabels, e );
     77                return new ExprStmt( e );
    7878        else
    79                 return new NullStmt( noLabels );
     79                return new NullStmt();
    8080}
    8181
     
    113113        }
    114114        delete ctl;
    115         return new IfStmt( noLabels, cond, thenb, elseb, init );
     115        return new IfStmt( cond, thenb, elseb, init );
    116116}
    117117
     
    120120        buildMoveList< Statement, StatementNode >( stmt, branches );
    121121        // branches.size() == 0 for switch (...) {}, i.e., no declaration or statements
    122         return new SwitchStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches );
     122        return new SwitchStmt( maybeMoveBuild< Expression >(ctl), branches );
    123123}
    124124Statement *build_case( ExpressionNode *ctl ) {
    125125        std::list< Statement * > branches;
    126         return new CaseStmt( noLabels, maybeMoveBuild< Expression >(ctl), branches );
     126        return new CaseStmt( maybeMoveBuild< Expression >(ctl), branches );
    127127}
    128128Statement *build_default() {
    129129        std::list< Statement * > branches;
    130         return new CaseStmt( noLabels, nullptr, branches, true );
     130        return new CaseStmt( nullptr, branches, true );
    131131}
    132132
     
    135135        buildMoveList< Statement, StatementNode >( stmt, branches );
    136136        assert( branches.size() == 1 );
    137         return new WhileStmt( noLabels, notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), kind );
     137        return new WhileStmt( notZeroExpr( maybeMoveBuild< Expression >(ctl) ), branches.front(), kind );
    138138}
    139139
     
    157157
    158158        delete forctl;
    159         return new ForStmt( noLabels, init, cond, incr, branches.front() );
     159        return new ForStmt( init, cond, incr, branches.front() );
    160160}
    161161
    162162Statement *build_branch( BranchStmt::Type kind ) {
    163         Statement * ret = new BranchStmt( noLabels, "", kind );
     163        Statement * ret = new BranchStmt( "", kind );
    164164        return ret;
    165165}
    166166Statement *build_branch( std::string *identifier, BranchStmt::Type kind ) {
    167         Statement * ret = new BranchStmt( noLabels, *identifier, kind );
     167        Statement * ret = new BranchStmt( *identifier, kind );
    168168        delete identifier;                                                                      // allocated by lexer
    169169        return ret;
    170170}
    171171Statement *build_computedgoto( ExpressionNode *ctl ) {
    172         return new BranchStmt( noLabels, maybeMoveBuild< Expression >(ctl), BranchStmt::Goto );
     172        return new BranchStmt( maybeMoveBuild< Expression >(ctl), BranchStmt::Goto );
    173173}
    174174
     
    176176        std::list< Expression * > exps;
    177177        buildMoveList( ctl, exps );
    178         return new ReturnStmt( noLabels, exps.size() > 0 ? exps.back() : nullptr );
     178        return new ReturnStmt( exps.size() > 0 ? exps.back() : nullptr );
    179179}
    180180
     
    183183        buildMoveList( ctl, exps );
    184184        assertf( exps.size() < 2, "This means we are leaking memory");
    185         return new ThrowStmt( noLabels, ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr );
     185        return new ThrowStmt( ThrowStmt::Terminate, !exps.empty() ? exps.back() : nullptr );
    186186}
    187187
     
    190190        buildMoveList( ctl, exps );
    191191        assertf( exps.size() < 2, "This means we are leaking memory");
    192         return new ThrowStmt( noLabels, ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr );
     192        return new ThrowStmt( ThrowStmt::Resume, !exps.empty() ? exps.back() : nullptr );
    193193}
    194194
     
    204204        CompoundStmt *tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    205205        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    206         return new TryStmt( noLabels, tryBlock, branches, finallyBlock );
     206        return new TryStmt( tryBlock, branches, finallyBlock );
    207207}
    208208Statement *build_catch( CatchStmt::Kind kind, DeclarationNode *decl, ExpressionNode *cond, StatementNode *body ) {
     
    210210        buildMoveList< Statement, StatementNode >( body, branches );
    211211        assert( branches.size() == 1 );
    212         return new CatchStmt( noLabels, kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() );
     212        return new CatchStmt( kind, maybeMoveBuild< Declaration >(decl), maybeMoveBuild< Expression >(cond), branches.front() );
    213213}
    214214Statement *build_finally( StatementNode *stmt ) {
     
    216216        buildMoveList< Statement, StatementNode >( stmt, branches );
    217217        assert( branches.size() == 1 );
    218         return new FinallyStmt( noLabels, dynamic_cast< CompoundStmt * >( branches.front() ) );
     218        return new FinallyStmt( dynamic_cast< CompoundStmt * >( branches.front() ) );
    219219}
    220220
     
    289289
    290290Statement *build_compound( StatementNode *first ) {
    291         CompoundStmt *cs = new CompoundStmt( noLabels );
     291        CompoundStmt *cs = new CompoundStmt();
    292292        buildMoveList( first, cs->get_kids() );
    293293        return cs;
     
    301301        buildMoveList( input, in );
    302302        buildMoveList( clobber, clob );
    303         return new AsmStmt( noLabels, voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels );
     303        return new AsmStmt( voltile, instruction, out, in, clob, gotolabels ? gotolabels->labels : noLabels );
    304304}
    305305
  • src/SymTab/AddVisit.h

    r4429b04 rba3706f  
    2424                        // add any new declarations after the previous statement
    2525                        for ( std::list< Declaration* >::iterator decl = visitor.declsToAddAfter.begin(); decl != visitor.declsToAddAfter.end(); ++decl ) {
    26                                 DeclStmt *declStmt = new DeclStmt( noLabels, *decl );
     26                                DeclStmt *declStmt = new DeclStmt( *decl );
    2727                                stmts.insert( stmt, declStmt );
    2828                        }
     
    3636                        // add any new declarations before the statement
    3737                        for ( std::list< Declaration* >::iterator decl = visitor.declsToAdd.begin(); decl != visitor.declsToAdd.end(); ++decl ) {
    38                                 DeclStmt *declStmt = new DeclStmt( noLabels, *decl );
     38                                DeclStmt *declStmt = new DeclStmt( *decl );
    3939                                stmts.insert( stmt, declStmt );
    4040                        }
  • src/SymTab/Autogen.cc

    r4429b04 rba3706f  
    264264                Type::StorageClasses scs = functionNesting > 0 ? Type::StorageClasses() : Type::StorageClasses( Type::Static );
    265265                LinkageSpec::Spec spec = isIntrinsic ? LinkageSpec::Intrinsic : LinkageSpec::AutoGen;
    266                 FunctionDecl * decl = new FunctionDecl( fname, scs, spec, ftype, new CompoundStmt( noLabels ),
     266                FunctionDecl * decl = new FunctionDecl( fname, scs, spec, ftype, new CompoundStmt(),
    267267                                                                                                std::list< Attribute * >(), Type::FuncSpecifiers( Type::Inline ) );
    268268                decl->fixUniqueId();
     
    299299                                assert( assignType->returnVals.size() == 1 );
    300300                                ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( assignType->parameters.front() );
    301                                 dcl->statements->push_back( new ReturnStmt( noLabels, new VariableExpr( dstParam ) ) );
     301                                dcl->statements->push_back( new ReturnStmt( new VariableExpr( dstParam ) ) );
    302302                        }
    303303                        resolve( dcl );
     
    468468                copy->args.push_back( new AddressExpr( new VariableExpr( srcParam ) ) );
    469469                copy->args.push_back( new SizeofExpr( srcParam->get_type()->clone() ) );
    470                 *out++ = new ExprStmt( noLabels, copy );
     470                *out++ = new ExprStmt( copy );
    471471        }
    472472
     
    544544                        callExpr->get_args().push_back( new VariableExpr( dstParam ) );
    545545                        callExpr->get_args().push_back( new VariableExpr( srcParam ) );
    546                         funcDecl->statements->push_back( new ExprStmt( noLabels, callExpr ) );
     546                        funcDecl->statements->push_back( new ExprStmt( callExpr ) );
    547547                } else {
    548548                        // default ctor/dtor body is empty - add unused attribute to parameter to silence warnings
     
    569569                expr->args.push_back( new CastExpr( new VariableExpr( dst ), new ReferenceType( Type::Qualifiers(), typeDecl->base->clone() ) ) );
    570570                if ( src ) expr->args.push_back( new CastExpr( new VariableExpr( src ), typeDecl->base->clone() ) );
    571                 dcl->statements->kids.push_back( new ExprStmt( noLabels, expr ) );
     571                dcl->statements->kids.push_back( new ExprStmt( expr ) );
    572572        };
    573573
     
    664664                        untyped->get_args().push_back( new VariableExpr( ftype->get_parameters().back() ) );
    665665                }
    666                 function->get_statements()->get_kids().push_back( new ExprStmt( noLabels, untyped ) );
    667                 function->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, UntypedExpr::createDeref( new VariableExpr( ftype->get_parameters().front() ) ) ) );
     666                function->get_statements()->get_kids().push_back( new ExprStmt( untyped ) );
     667                function->get_statements()->get_kids().push_back( new ReturnStmt( UntypedExpr::createDeref( new VariableExpr( ftype->get_parameters().front() ) ) ) );
    668668        }
    669669
  • src/SymTab/Autogen.h

    r4429b04 rba3706f  
    104104                fExpr->args.splice( fExpr->args.end(), args );
    105105
    106                 *out++ = new ExprStmt( noLabels, fExpr );
     106                *out++ = new ExprStmt( fExpr );
    107107
    108108                srcParam.clearArrayIndices();
     
    162162
    163163                // for stmt's body, eventually containing call
    164                 CompoundStmt * body = new CompoundStmt( noLabels );
     164                CompoundStmt * body = new CompoundStmt();
    165165                Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->kids ), array->base, addCast, forward );
    166166
    167167                // block containing for stmt and index variable
    168168                std::list<Statement *> initList;
    169                 CompoundStmt * block = new CompoundStmt( noLabels );
    170                 block->push_back( new DeclStmt( noLabels, index ) );
     169                CompoundStmt * block = new CompoundStmt();
     170                block->push_back( new DeclStmt( index ) );
    171171                if ( listInit ) block->get_kids().push_back( listInit );
    172                 block->push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
     172                block->push_back( new ForStmt( initList, cond, inc, body ) );
    173173
    174174                *out++ = block;
  • src/SynTree/CompoundStmt.cc

    r4429b04 rba3706f  
    2828using std::endl;
    2929
    30 CompoundStmt::CompoundStmt( std::list<Label> labels ) : Statement( labels ) {
     30CompoundStmt::CompoundStmt() : Statement() {
    3131}
    3232
    33 CompoundStmt::CompoundStmt( std::list<Statement *> stmts ) : Statement( noLabels ), kids( stmts ) {
     33CompoundStmt::CompoundStmt( std::list<Statement *> stmts ) : Statement(), kids( stmts ) {
    3434}
    3535
  • src/SynTree/DeclStmt.cc

    r4429b04 rba3706f  
    2323#include "SynTree/Label.h"   // for Label
    2424
    25 DeclStmt::DeclStmt( std::list<Label> labels, Declaration *decl ) : Statement( labels ), decl( decl ) {
     25DeclStmt::DeclStmt( Declaration *decl ) : Statement(), decl( decl ) {
    2626}
    2727
  • 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}
  • src/SynTree/Statement.h

    r4429b04 rba3706f  
    3737        std::list<Label> labels;
    3838
    39         Statement( std::list<Label> labels );
     39        Statement( const std::list<Label> & labels = {} );
    4040        virtual ~Statement();
    4141
     
    5353        std::list<Statement*> kids;
    5454
    55         CompoundStmt( std::list<Label> labels );
     55        CompoundStmt();
    5656        CompoundStmt( std::list<Statement *> stmts );
    5757        CompoundStmt( const CompoundStmt &other );
     
    7070class NullStmt : public Statement {
    7171  public:
    72         NullStmt();
    73         NullStmt( std::list<Label> labels );
     72        NullStmt( const std::list<Label> & labels = {} );
    7473
    7574        virtual NullStmt *clone() const override { return new NullStmt( *this ); }
     
    8382        Expression *expr;
    8483
    85         ExprStmt( std::list<Label> labels, Expression *expr );
     84        ExprStmt( Expression *expr );
    8685        ExprStmt( const ExprStmt &other );
    8786        virtual ~ExprStmt();
     
    104103        std::list<Label> gotolabels;
    105104
    106         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 );
     105        AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
    107106        AsmStmt( const AsmStmt &other );
    108107        virtual ~AsmStmt();
     
    134133        std::list<Statement *> initialization;
    135134
    136         IfStmt( std::list<Label> labels, Expression *condition, Statement *thenPart, Statement *elsePart,
     135        IfStmt( Expression *condition, Statement *thenPart, Statement *elsePart,
    137136                        std::list<Statement *> initialization = std::list<Statement *>() );
    138137        IfStmt( const IfStmt &other );
     
    158157        std::list<Statement *> statements;
    159158
    160         SwitchStmt( std::list<Label> labels, Expression *condition, const std::list<Statement *> &statements );
     159        SwitchStmt( Expression *condition, const std::list<Statement *> &statements );
    161160        SwitchStmt( const SwitchStmt &other );
    162161        virtual ~SwitchStmt();
     
    180179        std::list<Statement *> stmts;
    181180
    182         CaseStmt( std::list<Label> labels, Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
     181        CaseStmt( Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
    183182        CaseStmt( const CaseStmt &other );
    184183        virtual ~CaseStmt();
    185184
    186         static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(), std::list<Statement *> stmts = std::list<Statement *>() );
     185        static CaseStmt * makeDefault( const std::list<Label> & labels = {}, std::list<Statement *> stmts = std::list<Statement *>() );
    187186
    188187        bool isDefault() const { return _isDefault; }
     
    210209        bool isDoWhile;
    211210
    212         WhileStmt( std::list<Label> labels, Expression *condition,
     211        WhileStmt( Expression *condition,
    213212               Statement *body, bool isDoWhile = false );
    214213        WhileStmt( const WhileStmt &other );
     
    235234        Statement *body;
    236235
    237         ForStmt( std::list<Label> labels, std::list<Statement *> initialization,
     236        ForStmt( std::list<Statement *> initialization,
    238237             Expression *condition = 0, Expression *increment = 0, Statement *body = 0 );
    239238        ForStmt( const ForStmt &other );
     
    264263        Type type;
    265264
    266         BranchStmt( std::list<Label> labels, Label target, Type ) throw (SemanticError);
    267         BranchStmt( std::list<Label> labels, Expression *computedTarget, Type ) throw (SemanticError);
     265        BranchStmt( Label target, Type ) throw (SemanticError);
     266        BranchStmt( Expression *computedTarget, Type ) throw (SemanticError);
    268267
    269268        Label get_originalTarget() { return originalTarget; }
     
    289288        Expression *expr;
    290289
    291         ReturnStmt( std::list<Label> labels, Expression *expr );
     290        ReturnStmt( Expression *expr );
    292291        ReturnStmt( const ReturnStmt &other );
    293292        virtual ~ReturnStmt();
     
    310309        Expression * target;
    311310
    312         ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target = nullptr );
     311        ThrowStmt( Kind kind, Expression * expr, Expression * target = nullptr );
    313312        ThrowStmt( const ThrowStmt &other );
    314313        virtual ~ThrowStmt();
     
    332331        FinallyStmt * finallyBlock;
    333332
    334         TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
     333        TryStmt( CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
    335334        TryStmt( const TryStmt &other );
    336335        virtual ~TryStmt();
     
    358357        Statement *body;
    359358
    360         CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl,
     359        CatchStmt( Kind kind, Declaration *decl,
    361360                   Expression *cond, Statement *body );
    362361        CatchStmt( const CatchStmt &other );
     
    381380        CompoundStmt *block;
    382381
    383         FinallyStmt( std::list<Label> labels, CompoundStmt *block );
     382        FinallyStmt( CompoundStmt *block );
    384383        FinallyStmt( const FinallyStmt &other );
    385384        virtual ~FinallyStmt();
     
    408407        };
    409408
    410         WaitForStmt( std::list<Label> labels = noLabels );
     409        WaitForStmt();
    411410        WaitForStmt( const WaitForStmt & );
    412411        virtual ~WaitForStmt();
     
    438437        Declaration *decl;
    439438
    440         DeclStmt( std::list<Label> labels, Declaration *decl );
     439        DeclStmt( Declaration *decl );
    441440        DeclStmt( const DeclStmt &other );
    442441        virtual ~DeclStmt();
  • src/SynTree/TupleExpr.cc

    r4429b04 rba3706f  
    2323#include "Declaration.h"        // for ObjectDecl
    2424#include "Expression.h"         // for Expression, TupleExpr, TupleIndexExpr
    25 #include "SynTree/Label.h"      // for Label, noLabels
     25#include "SynTree/Label.h"      // for Label
    2626#include "SynTree/Statement.h"  // for CompoundStmt, DeclStmt, ExprStmt, Sta...
    2727#include "Tuples/Tuples.h"      // for makeTupleType
     
    8989        // convert internally into a StmtExpr which contains the declarations and produces the tuple of the assignments
    9090        set_result( Tuples::makeTupleType( assigns ) );
    91         CompoundStmt * compoundStmt = new CompoundStmt( noLabels );
     91        CompoundStmt * compoundStmt = new CompoundStmt();
    9292        std::list< Statement * > & stmts = compoundStmt->get_kids();
    9393        for ( ObjectDecl * obj : tempDecls ) {
    94                 stmts.push_back( new DeclStmt( noLabels, obj ) );
     94                stmts.push_back( new DeclStmt( obj ) );
    9595        }
    9696        TupleExpr * tupleExpr = new TupleExpr( assigns );
    9797        assert( tupleExpr->get_result() );
    98         stmts.push_back( new ExprStmt( noLabels, tupleExpr ) );
     98        stmts.push_back( new ExprStmt( tupleExpr ) );
    9999        stmtExpr = new StmtExpr( compoundStmt );
    100100}
Note: See TracChangeset for help on using the changeset viewer.