Changeset bee0694 for src/SynTree


Ignore:
Timestamp:
Jan 29, 2019, 4:15:27 PM (7 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
no_list
Children:
bbbc067
Parents:
70a1c3ae
Message:

Changed std::list<Label> to vector

Location:
src/SynTree
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Label.h

    r70a1c3ae rbee0694  
    4949inline std::ostream & operator<<( std::ostream & out, const Label & l ) { return out << l.get_name(); }
    5050
    51 static const std::list< Label > noLabels;
     51static const std::vector< Label > noLabels;
    5252
    5353// Local Variables: //
  • src/SynTree/Statement.cc

    r70a1c3ae rbee0694  
    3232using std::endl;
    3333
    34 Statement::Statement( const std::list<Label> & labels ) : labels( labels ) {}
     34Statement::Statement( const std::vector< Label > & labels ) : labels( labels ) {}
    3535
    3636void Statement::print( std::ostream & os, Indenter indent ) const {
     
    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::vector< 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 ) {
     
    223223}
    224224
    225 CaseStmt * CaseStmt::makeDefault( const std::list<Label> & labels, std::list<Statement *> stmts ) {
     225CaseStmt * CaseStmt::makeDefault( const std::vector< Label > & labels, std::list<Statement *> stmts ) {
    226226        CaseStmt * stmt = new CaseStmt( nullptr, stmts, true );
    227227        stmt->labels = labels;
     
    511511
    512512
    513 NullStmt::NullStmt( const std::list<Label> & labels ) : Statement( labels ) {
     513NullStmt::NullStmt( const std::vector< Label > & labels ) : Statement( labels ) {
    514514}
    515515
  • src/SynTree/Statement.h

    r70a1c3ae rbee0694  
    3535class Statement : public BaseSyntaxNode {
    3636  public:
    37         std::list<Label> labels;
    38 
    39         Statement( const std::list<Label> & labels = {} );
     37        std::vector< Label > labels;
     38
     39        Statement( const std::vector< Label > & labels = {} );
    4040        virtual ~Statement();
    4141
    42         std::list<Label> & get_labels() { return labels; }
    43         const std::list<Label> & get_labels() const { return labels; }
     42        std::vector< Label > & get_labels() { return labels; }
     43        const std::vector< Label > & get_labels() const { return labels; }
    4444
    4545        virtual Statement *clone() const override = 0;
     
    7070class NullStmt : public Statement {
    7171  public:
    72         NullStmt( const std::list<Label> & labels = {} );
     72        NullStmt( const std::vector< Label > & labels = {} );
    7373
    7474        virtual NullStmt *clone() const override { return new NullStmt( *this ); }
     
    101101        std::list<Expression *> output, input;
    102102        std::list<ConstantExpr *> clobber;
    103         std::list<Label> gotolabels;
    104 
    105         AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
     103        std::vector< Label > gotolabels;
     104
     105        AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::vector< Label > gotolabels );
    106106        AsmStmt( const AsmStmt &other );
    107107        virtual ~AsmStmt();
     
    117117        std::list<ConstantExpr *> & get_clobber() { return clobber; }
    118118        void set_clobber( const std::list<ConstantExpr *> &newValue ) { clobber = newValue; }
    119         std::list<Label> & get_gotolabels() { return gotolabels; }
    120         void set_gotolabels( const std::list<Label> &newValue ) { gotolabels = newValue; }
     119        std::vector< Label > & get_gotolabels() { return gotolabels; }
     120        void set_gotolabels( const std::vector< Label > &newValue ) { gotolabels = newValue; }
    121121
    122122        virtual AsmStmt * clone() const { return new AsmStmt( *this ); }
     
    196196        virtual ~CaseStmt();
    197197
    198         static CaseStmt * makeDefault( const std::list<Label> & labels = {}, std::list<Statement *> stmts = std::list<Statement *>() );
     198        static CaseStmt * makeDefault( const std::vector< Label > & labels = {}, std::list<Statement *> stmts = std::list<Statement *>() );
    199199
    200200        bool isDefault() const { return _isDefault; }
Note: See TracChangeset for help on using the changeset viewer.