Changeset 501b08a


Ignore:
Timestamp:
Mar 15, 2019, 11:17:16 AM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3f8ec70
Parents:
6dbeef7 (diff), 35a2d47 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • doc/bibliography/pl.bib

    r6dbeef7 r501b08a  
    23002300}
    23012301
     2302@article{Ritchie93,
     2303    keywords    = {C, history},
     2304    contributer = {pabuhr@plg},
     2305    author      = {Ritchie, Dennis M.},
     2306    title       = {The Development of the {C} Language},
     2307    journal     = sigplan,
     2308    volume      = 28,
     2309    number      = 3,
     2310    month       = mar,
     2311    year        = 1993,
     2312    pages       = {201--208},
     2313    url         = {http://doi.acm.org/10.1145/155360.155580},
     2314    publisher   = {ACM},
     2315    address     = {New York, NY, USA},
     2316}
     2317
    23022318@article{design,
    23032319    keywords    = {Smalltalk, designing classes},
     
    23072323    journal     = joop,
    23082324    year        = 1988,
    2309     volume      = 1, number = 2, pages = {22-35},
     2325    volume      = 1,
     2326    number      = 2,
     2327    pages       = {22-35},
    23102328    comment     = {
    23112329        Abstract classes represent standard protocols.  ``It is better to
  • src/ControlStruct/ForExprMutator.cc

    r6dbeef7 r501b08a  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Aug 18 10:22:00 2017
    13 // Update Count     : 12
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Mar 11 22:26:52 2019
     13// Update Count     : 14
    1414//
    1515
     
    2121
    2222namespace ControlStruct {
    23         Statement *hoist( Statement *originalStmt, std::list<Statement *> &init ) {
     23        Statement * hoist( Statement * originalStmt, std::list<Statement *> & init ) {
    2424                // If no hoisting is needed, skip:
    2525                if ( 0 == init.size() ) {
     
    2929                // Create compound statement, move initializers outside,
    3030                // the resut of the original stays as is.
    31                 CompoundStmt *block = new CompoundStmt();
    32                 std::list<Statement *> &stmts = block->get_kids();
     31                CompoundStmt * block = new CompoundStmt();
     32                std::list<Statement *> & stmts = block->get_kids();
    3333                stmts.splice( stmts.end(), init );
    3434
     
    3838        }
    3939
    40         Statement *ForExprMutator::postmutate( IfStmt *ifStmt ) {
     40        Statement * ForExprMutator::postmutate( IfStmt * ifStmt ) {
    4141                return hoist( ifStmt, ifStmt->initialization );
    4242        }
    43         Statement *ForExprMutator::postmutate( ForStmt *forStmt ) {
     43        Statement * ForExprMutator::postmutate( ForStmt * forStmt ) {
    4444                // hoist any initializer declarations to make them C89 (rather than C99)
    4545                return hoist( forStmt, forStmt->initialization );
    4646        }
    47         Statement *ForExprMutator::postmutate( WhileStmt *whileStmt ) {
     47        Statement * ForExprMutator::postmutate( WhileStmt * whileStmt ) {
    4848                return hoist( whileStmt, whileStmt->initialization );
    4949        }
  • src/ControlStruct/LabelFixer.cc

    r6dbeef7 r501b08a  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Jul 28 13:32:43 2015
    13 // Update Count     : 156
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Mar 11 22:26:02 2019
     13// Update Count     : 159
    1414//
    1515
     
    3232        }
    3333
    34         LabelFixer::LabelFixer( LabelGenerator *gen ) : generator ( gen ) {
     34        LabelFixer::LabelFixer( LabelGenerator * gen ) : generator ( gen ) {
    3535                if ( generator == 0 )
    3636                        generator = LabelGenerator::getGenerator();
     
    4949
    5050        // prune to at most one label definition for each statement
    51         void LabelFixer::previsit( Statement *stmt ) {
     51        void LabelFixer::previsit( Statement * stmt ) {
    5252                std::list< Label > &labels = stmt->get_labels();
    5353
     
    5858        }
    5959
    60         void LabelFixer::previsit( BranchStmt *branchStmt ) {
     60        void LabelFixer::previsit( BranchStmt * branchStmt ) {
    6161                previsit( ( Statement *)branchStmt );
    6262
     
    7575
    7676
    77         // sets the definition of the labelTable entry to be the provided
    78         // statement for every label in the list parameter. Happens for every kind of statement
    79         Label LabelFixer::setLabelsDef( std::list< Label > &llabel, Statement *definition ) {
     77        // sets the definition of the labelTable entry to be the provided statement for every label in the list
     78        // parameter. Happens for every kind of statement
     79        Label LabelFixer::setLabelsDef( std::list< Label > & llabel, Statement * definition ) {
    8080                assert( definition != 0 );
    8181                assert( llabel.size() > 0 );
     
    100100                } // for
    101101
    102                 // produce one of the labels attached to this statement to be
    103                 // temporarily used as the canonical label
     102                // produce one of the labels attached to this statement to be temporarily used as the canonical label
    104103                return labelTable[ llabel.front() ]->get_label();
    105104        }
     
    117116
    118117        // Builds a table that maps a label to its defining statement.
    119         std::map<Label, Statement * > *LabelFixer::resolveJumps() throw ( SemanticErrorException ) {
     118        std::map<Label, Statement * > * LabelFixer::resolveJumps() throw ( SemanticErrorException ) {
    120119                std::map< Label, Statement * > *ret = new std::map< Label, Statement * >();
    121120                for ( std::map< Label, Entry * >::iterator i = labelTable.begin(); i != labelTable.end(); ++i ) {
  • src/ControlStruct/LabelGenerator.cc

    r6dbeef7 r501b08a  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 14 14:14:00 2015
    13 // Update Count     : 14
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Mar 11 22:23:20 2019
     13// Update Count     : 15
    1414//
    1515
     
    2424
    2525namespace ControlStruct {
    26         LabelGenerator *LabelGenerator::labelGenerator = 0;
     26        LabelGenerator * LabelGenerator::labelGenerator = 0;
    2727
    28         LabelGenerator *LabelGenerator::getGenerator() {
     28        LabelGenerator * LabelGenerator::getGenerator() {
    2929                if ( LabelGenerator::labelGenerator == 0 )
    3030                        LabelGenerator::labelGenerator = new LabelGenerator();
    31 
    3231                return labelGenerator;
    3332        }
     
    3837                if ( stmt && ! stmt->get_labels().empty() ) {
    3938                        os << "_" << stmt->get_labels().front() << "__";
    40                 }
     39                } // if
    4140                std::string ret = os.str();
    4241                Label l( ret );
  • src/SynTree/Statement.h

    r6dbeef7 r501b08a  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar  8 14:53:02 2018
    13 // Update Count     : 78
     12// Last Modified On : Tue Mar 12 09:01:53 2019
     13// Update Count     : 83
    1414//
    1515
     
    1919#include <list>                    // for list
    2020#include <memory>                  // for allocator
    21 #include <vector>                        // for vector
     21#include <vector>                                  // for vector
    2222
    2323#include "BaseSyntaxNode.h"        // for BaseSyntaxNode
     
    4343        const std::list<Label> & get_labels() const { return labels; }
    4444
    45         virtual Statement *clone() const override = 0;
    46         virtual void accept( Visitor &v ) override = 0;
    47         virtual Statement *acceptMutator( Mutator &m ) override = 0;
    48         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     45        virtual Statement * clone() const override = 0;
     46        virtual void accept( Visitor & v ) override = 0;
     47        virtual Statement * acceptMutator( Mutator & m ) override = 0;
     48        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    4949};
    5050
     
    5555        CompoundStmt();
    5656        CompoundStmt( std::list<Statement *> stmts );
    57         CompoundStmt( const CompoundStmt &other );
     57        CompoundStmt( const CompoundStmt & other );
    5858        virtual ~CompoundStmt();
    5959
     
    6262        void push_front( Statement * stmt ) { kids.push_front( stmt ); }
    6363
    64         virtual CompoundStmt *clone() const override { return new CompoundStmt( *this ); }
    65         virtual void accept( Visitor &v ) override { v.visit( this ); }
    66         virtual CompoundStmt *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    67         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     64        virtual CompoundStmt * clone() const override { return new CompoundStmt( *this ); }
     65        virtual void accept( Visitor & v ) override { v.visit( this ); }
     66        virtual CompoundStmt * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     67        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    6868};
    6969
     
    7272        NullStmt( const std::list<Label> & labels = {} );
    7373
    74         virtual NullStmt *clone() const override { return new NullStmt( *this ); }
    75         virtual void accept( Visitor &v ) override { v.visit( this ); }
    76         virtual NullStmt *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    77         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     74        virtual NullStmt * clone() const override { return new NullStmt( *this ); }
     75        virtual void accept( Visitor & v ) override { v.visit( this ); }
     76        virtual NullStmt * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     77        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    7878};
    7979
    8080class ExprStmt : public Statement {
    8181  public:
    82         Expression *expr;
    83 
    84         ExprStmt( Expression *expr );
    85         ExprStmt( const ExprStmt &other );
     82        Expression * expr;
     83
     84        ExprStmt( Expression * expr );
     85        ExprStmt( const ExprStmt & other );
    8686        virtual ~ExprStmt();
    8787
    88         Expression *get_expr() { return expr; }
    89         void set_expr( Expression *newValue ) { expr = newValue; }
    90 
    91         virtual ExprStmt *clone() const override { return new ExprStmt( *this ); }
    92         virtual void accept( Visitor &v ) override { v.visit( this ); }
    93         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    94         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     88        Expression * get_expr() { return expr; }
     89        void set_expr( Expression * newValue ) { expr = newValue; }
     90
     91        virtual ExprStmt * clone() const override { return new ExprStmt( *this ); }
     92        virtual void accept( Visitor & v ) override { v.visit( this ); }
     93        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     94        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    9595};
    9696
     
    9898  public:
    9999        bool voltile;
    100         Expression *instruction;
     100        Expression * instruction;
    101101        std::list<Expression *> output, input;
    102102        std::list<ConstantExpr *> clobber;
    103103        std::list<Label> gotolabels;
    104104
    105         AsmStmt( bool voltile, Expression *instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
    106         AsmStmt( const AsmStmt &other );
     105        AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
     106        AsmStmt( const AsmStmt & other );
    107107        virtual ~AsmStmt();
    108108
     
    114114        void set_output( const std::list<Expression *> & newValue ) { output = newValue; }
    115115        std::list<Expression *> & get_input() { return input; }
    116         void set_input( const std::list<Expression *> &newValue ) { input = newValue; }
     116        void set_input( const std::list<Expression *> & newValue ) { input = newValue; }
    117117        std::list<ConstantExpr *> & get_clobber() { return clobber; }
    118         void set_clobber( const std::list<ConstantExpr *> &newValue ) { clobber = newValue; }
     118        void set_clobber( const std::list<ConstantExpr *> & newValue ) { clobber = newValue; }
    119119        std::list<Label> & get_gotolabels() { return gotolabels; }
    120         void set_gotolabels( const std::list<Label> &newValue ) { gotolabels = newValue; }
     120        void set_gotolabels( const std::list<Label> & newValue ) { gotolabels = newValue; }
    121121
    122122        virtual AsmStmt * clone() const { return new AsmStmt( *this ); }
     
    141141class IfStmt : public Statement {
    142142  public:
    143         Expression *condition;
    144         Statement *thenPart;
    145         Statement *elsePart;
     143        Expression * condition;
     144        Statement * thenPart;
     145        Statement * elsePart;
    146146        std::list<Statement *> initialization;
    147147
    148         IfStmt( Expression *condition, Statement *thenPart, Statement *elsePart,
     148        IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart,
    149149                        std::list<Statement *> initialization = std::list<Statement *>() );
    150         IfStmt( const IfStmt &other );
     150        IfStmt( const IfStmt & other );
    151151        virtual ~IfStmt();
    152152
    153         std::list<Statement *> &get_initialization() { return initialization; }
    154         Expression *get_condition() { return condition; }
    155         void set_condition( Expression *newValue ) { condition = newValue; }
    156         Statement *get_thenPart() { return thenPart; }
    157         void set_thenPart( Statement *newValue ) { thenPart = newValue; }
    158         Statement *get_elsePart() { return elsePart; }
    159         void set_elsePart( Statement *newValue ) { elsePart = newValue; }
    160 
    161         virtual IfStmt *clone() const override { return new IfStmt( *this ); }
    162         virtual void accept( Visitor &v ) override { v.visit( this ); }
    163         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    164         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     153        std::list<Statement *> & get_initialization() { return initialization; }
     154        Expression * get_condition() { return condition; }
     155        void set_condition( Expression * newValue ) { condition = newValue; }
     156        Statement * get_thenPart() { return thenPart; }
     157        void set_thenPart( Statement * newValue ) { thenPart = newValue; }
     158        Statement * get_elsePart() { return elsePart; }
     159        void set_elsePart( Statement * newValue ) { elsePart = newValue; }
     160
     161        virtual IfStmt * clone() const override { return new IfStmt( *this ); }
     162        virtual void accept( Visitor & v ) override { v.visit( this ); }
     163        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     164        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    165165};
    166166
     
    170170        std::list<Statement *> statements;
    171171
    172         SwitchStmt( Expression *condition, const std::list<Statement *> &statements );
    173         SwitchStmt( const SwitchStmt &other );
     172        SwitchStmt( Expression * condition, const std::list<Statement *> & statements );
     173        SwitchStmt( const SwitchStmt & other );
    174174        virtual ~SwitchStmt();
    175175
    176         Expression *get_condition() { return condition; }
    177         void set_condition( Expression *newValue ) { condition = newValue; }
     176        Expression * get_condition() { return condition; }
     177        void set_condition( Expression * newValue ) { condition = newValue; }
    178178
    179179        std::list<Statement *> & get_statements() { return statements; }
    180180
    181         virtual void accept( Visitor &v ) override { v.visit( this ); }
    182         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    183 
    184         virtual SwitchStmt *clone() const override { return new SwitchStmt( *this ); }
    185         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     181        virtual void accept( Visitor & v ) override { v.visit( this ); }
     182        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     183
     184        virtual SwitchStmt * clone() const override { return new SwitchStmt( *this ); }
     185        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    186186
    187187};
     
    192192        std::list<Statement *> stmts;
    193193
    194         CaseStmt( Expression *conditions, const std::list<Statement *> &stmts, bool isdef = false ) throw (SemanticErrorException);
    195         CaseStmt( const CaseStmt &other );
     194        CaseStmt( Expression * conditions, const std::list<Statement *> & stmts, bool isdef = false ) throw (SemanticErrorException);
     195        CaseStmt( const CaseStmt & other );
    196196        virtual ~CaseStmt();
    197197
     
    201201        void set_default(bool b) { _isDefault = b; }
    202202
    203         Expression * &get_condition() { return condition; }
    204         void set_condition( Expression *newValue ) { condition = newValue; }
    205 
    206         std::list<Statement *> &get_statements() { return stmts; }
    207         void set_statements( std::list<Statement *> &newValue ) { stmts = newValue; }
    208 
    209         virtual void accept( Visitor &v ) override { v.visit( this ); }
    210         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    211 
    212         virtual CaseStmt *clone() const override { return new CaseStmt( *this ); }
    213         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     203        Expression * & get_condition() { return condition; }
     204        void set_condition( Expression * newValue ) { condition = newValue; }
     205
     206        std::list<Statement *> & get_statements() { return stmts; }
     207        void set_statements( std::list<Statement *> & newValue ) { stmts = newValue; }
     208
     209        virtual void accept( Visitor & v ) override { v.visit( this ); }
     210        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     211
     212        virtual CaseStmt * clone() const override { return new CaseStmt( *this ); }
     213        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    214214  private:
    215215        bool _isDefault;
     
    218218class WhileStmt : public Statement {
    219219  public:
    220         Expression *condition;
    221         Statement *body;
     220        Expression * condition;
     221        Statement * body;
    222222        std::list<Statement *> initialization;
    223223        bool isDoWhile;
    224224
    225         WhileStmt( Expression *condition,
    226                Statement *body, std::list<Statement *> & initialization, bool isDoWhile = false );
    227         WhileStmt( const WhileStmt &other );
     225        WhileStmt( Expression * condition, Statement * body, std::list<Statement *> & initialization, bool isDoWhile = false );
     226        WhileStmt( const WhileStmt & other );
    228227        virtual ~WhileStmt();
    229228
    230         Expression *get_condition() { return condition; }
    231         void set_condition( Expression *newValue ) { condition = newValue; }
    232         Statement *get_body() { return body; }
    233         void set_body( Statement *newValue ) { body = newValue; }
     229        Expression * get_condition() { return condition; }
     230        void set_condition( Expression * newValue ) { condition = newValue; }
     231        Statement * get_body() { return body; }
     232        void set_body( Statement * newValue ) { body = newValue; }
    234233        bool get_isDoWhile() { return isDoWhile; }
    235234        void set_isDoWhile( bool newValue ) { isDoWhile = newValue; }
    236235
    237         virtual WhileStmt *clone() const override { return new WhileStmt( *this ); }
    238         virtual void accept( Visitor &v ) override { v.visit( this ); }
    239         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    240         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     236        virtual WhileStmt * clone() const override { return new WhileStmt( *this ); }
     237        virtual void accept( Visitor & v ) override { v.visit( this ); }
     238        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     239        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    241240};
    242241
     
    244243  public:
    245244        std::list<Statement *> initialization;
    246         Expression *condition;
    247         Expression *increment;
    248         Statement *body;
    249 
    250         ForStmt( std::list<Statement *> initialization,
    251              Expression *condition = 0, Expression *increment = 0, Statement *body = 0 );
    252         ForStmt( const ForStmt &other );
     245        Expression * condition;
     246        Expression * increment;
     247        Statement * body;
     248
     249        ForStmt( std::list<Statement *> initialization, Expression * condition = 0, Expression * increment = 0, Statement * body = 0 );
     250        ForStmt( const ForStmt & other );
    253251        virtual ~ForStmt();
    254252
    255         std::list<Statement *> &get_initialization() { return initialization; }
    256         Expression *get_condition() { return condition; }
    257         void set_condition( Expression *newValue ) { condition = newValue; }
    258         Expression *get_increment() { return increment; }
    259         void set_increment( Expression *newValue ) { increment = newValue; }
    260         Statement *get_body() { return body; }
    261         void set_body( Statement *newValue ) { body = newValue; }
    262 
    263         virtual ForStmt *clone() const override { return new ForStmt( *this ); }
    264         virtual void accept( Visitor &v ) override { v.visit( this ); }
    265         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    266         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     253        std::list<Statement *> & get_initialization() { return initialization; }
     254        Expression * get_condition() { return condition; }
     255        void set_condition( Expression * newValue ) { condition = newValue; }
     256        Expression * get_increment() { return increment; }
     257        void set_increment( Expression * newValue ) { increment = newValue; }
     258        Statement * get_body() { return body; }
     259        void set_body( Statement * newValue ) { body = newValue; }
     260
     261        virtual ForStmt * clone() const override { return new ForStmt( *this ); }
     262        virtual void accept( Visitor & v ) override { v.visit( this ); }
     263        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     264        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    267265};
    268266
     
    274272        const Label originalTarget;
    275273        Label target;
    276         Expression *computedTarget;
     274        Expression * computedTarget;
    277275        Type type;
    278276
    279277        BranchStmt( Label target, Type ) throw (SemanticErrorException);
    280         BranchStmt( Expression *computedTarget, Type ) throw (SemanticErrorException);
     278        BranchStmt( Expression * computedTarget, Type ) throw (SemanticErrorException);
    281279
    282280        Label get_originalTarget() { return originalTarget; }
     
    284282        void set_target( Label newValue ) { target = newValue; }
    285283
    286         Expression *get_computedTarget() { return computedTarget; }
     284        Expression * get_computedTarget() { return computedTarget; }
    287285        void set_target( Expression * newValue ) { computedTarget = newValue; }
    288286
    289287        Type get_type() { return type; }
    290         const char *get_typename() { return brType[ type ]; }
    291 
    292         virtual BranchStmt *clone() const override { return new BranchStmt( *this ); }
    293         virtual void accept( Visitor &v ) override { v.visit( this ); }
    294         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    295         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     288        const char * get_typename() { return brType[ type ]; }
     289
     290        virtual BranchStmt * clone() const override { return new BranchStmt( *this ); }
     291        virtual void accept( Visitor & v ) override { v.visit( this ); }
     292        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     293        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    296294  private:
    297         static const char *brType[];
     295        static const char * brType[];
    298296};
    299297
    300298class ReturnStmt : public Statement {
    301299  public:
    302         Expression *expr;
    303 
    304         ReturnStmt( Expression *expr );
    305         ReturnStmt( const ReturnStmt &other );
     300        Expression * expr;
     301
     302        ReturnStmt( Expression * expr );
     303        ReturnStmt( const ReturnStmt & other );
    306304        virtual ~ReturnStmt();
    307305
    308         Expression *get_expr() { return expr; }
    309         void set_expr( Expression *newValue ) { expr = newValue; }
    310 
    311         virtual ReturnStmt *clone() const override { return new ReturnStmt( *this ); }
    312         virtual void accept( Visitor &v ) override { v.visit( this ); }
    313         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    314         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     306        Expression * get_expr() { return expr; }
     307        void set_expr( Expression * newValue ) { expr = newValue; }
     308
     309        virtual ReturnStmt * clone() const override { return new ReturnStmt( *this ); }
     310        virtual void accept( Visitor & v ) override { v.visit( this ); }
     311        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     312        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    315313};
    316314
     
    324322
    325323        ThrowStmt( Kind kind, Expression * expr, Expression * target = nullptr );
    326         ThrowStmt( const ThrowStmt &other );
     324        ThrowStmt( const ThrowStmt & other );
    327325        virtual ~ThrowStmt();
    328326
     
    333331        void set_target( Expression * newTarget ) { target = newTarget; }
    334332
    335         virtual ThrowStmt *clone() const override { return new ThrowStmt( *this ); }
    336         virtual void accept( Visitor &v ) override { v.visit( this ); }
    337         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    338         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     333        virtual ThrowStmt * clone() const override { return new ThrowStmt( *this ); }
     334        virtual void accept( Visitor & v ) override { v.visit( this ); }
     335        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     336        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    339337};
    340338
     
    345343        FinallyStmt * finallyBlock;
    346344
    347         TryStmt( CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
    348         TryStmt( const TryStmt &other );
     345        TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = 0 );
     346        TryStmt( const TryStmt & other );
    349347        virtual ~TryStmt();
    350348
    351         CompoundStmt *get_block() const { return block; }
    352         void set_block( CompoundStmt *newValue ) { block = newValue; }
     349        CompoundStmt * get_block() const { return block; }
     350        void set_block( CompoundStmt * newValue ) { block = newValue; }
    353351        std::list<CatchStmt *>& get_catchers() { return handlers; }
    354352
    355         FinallyStmt *get_finally() const { return finallyBlock; }
    356         void set_finally( FinallyStmt *newValue ) { finallyBlock = newValue; }
    357 
    358         virtual TryStmt *clone() const override { return new TryStmt( *this ); }
    359         virtual void accept( Visitor &v ) override { v.visit( this ); }
    360         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    361         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     353        FinallyStmt * get_finally() const { return finallyBlock; }
     354        void set_finally( FinallyStmt * newValue ) { finallyBlock = newValue; }
     355
     356        virtual TryStmt * clone() const override { return new TryStmt( *this ); }
     357        virtual void accept( Visitor & v ) override { v.visit( this ); }
     358        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     359        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    362360};
    363361
     
    367365
    368366        const Kind kind;
    369         Declaration *decl;
    370         Expression *cond;
    371         Statement *body;
    372 
    373         CatchStmt( Kind kind, Declaration *decl,
    374                    Expression *cond, Statement *body );
    375         CatchStmt( const CatchStmt &other );
     367        Declaration * decl;
     368        Expression * cond;
     369        Statement * body;
     370
     371        CatchStmt( Kind kind, Declaration * decl,
     372                   Expression * cond, Statement * body );
     373        CatchStmt( const CatchStmt & other );
    376374        virtual ~CatchStmt();
    377375
    378376        Kind get_kind() { return kind; }
    379         Declaration *get_decl() { return decl; }
    380         void set_decl( Declaration *newValue ) { decl = newValue; }
    381         Expression *get_cond() { return cond; }
    382         void set_cond( Expression *newCond ) { cond = newCond; }
    383         Statement *get_body() { return body; }
    384         void set_body( Statement *newValue ) { body = newValue; }
    385 
    386         virtual CatchStmt *clone() const override { return new CatchStmt( *this ); }
    387         virtual void accept( Visitor &v ) override { v.visit( this ); }
    388         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    389         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     377        Declaration * get_decl() { return decl; }
     378        void set_decl( Declaration * newValue ) { decl = newValue; }
     379        Expression * get_cond() { return cond; }
     380        void set_cond( Expression * newCond ) { cond = newCond; }
     381        Statement * get_body() { return body; }
     382        void set_body( Statement * newValue ) { body = newValue; }
     383
     384        virtual CatchStmt * clone() const override { return new CatchStmt( *this ); }
     385        virtual void accept( Visitor & v ) override { v.visit( this ); }
     386        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     387        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    390388};
    391389
    392390class FinallyStmt : public Statement {
    393391  public:
    394         CompoundStmt *block;
    395 
    396         FinallyStmt( CompoundStmt *block );
    397         FinallyStmt( const FinallyStmt &other );
     392        CompoundStmt * block;
     393
     394        FinallyStmt( CompoundStmt * block );
     395        FinallyStmt( const FinallyStmt & other );
    398396        virtual ~FinallyStmt();
    399397
    400         CompoundStmt *get_block() const { return block; }
    401         void set_block( CompoundStmt *newValue ) { block = newValue; }
    402 
    403         virtual FinallyStmt *clone() const override { return new FinallyStmt( *this ); }
    404         virtual void accept( Visitor &v ) override { v.visit( this ); }
    405         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    406         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     398        CompoundStmt * get_block() const { return block; }
     399        void set_block( CompoundStmt * newValue ) { block = newValue; }
     400
     401        virtual FinallyStmt * clone() const override { return new FinallyStmt( *this ); }
     402        virtual void accept( Visitor & v ) override { v.visit( this ); }
     403        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     404        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    407405};
    408406
     
    438436        } orelse;
    439437
    440         virtual WaitForStmt *clone() const override { return new WaitForStmt( *this ); }
    441         virtual void accept( Visitor &v ) override { v.visit( this ); }
    442         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    443         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     438        virtual WaitForStmt * clone() const override { return new WaitForStmt( *this ); }
     439        virtual void accept( Visitor & v ) override { v.visit( this ); }
     440        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     441        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    444442
    445443};
     
    464462class DeclStmt : public Statement {
    465463  public:
    466         Declaration *decl;
    467 
    468         DeclStmt( Declaration *decl );
    469         DeclStmt( const DeclStmt &other );
     464        Declaration * decl;
     465
     466        DeclStmt( Declaration * decl );
     467        DeclStmt( const DeclStmt & other );
    470468        virtual ~DeclStmt();
    471469
    472         Declaration *get_decl() const { return decl; }
    473         void set_decl( Declaration *newValue ) { decl = newValue; }
    474 
    475         virtual DeclStmt *clone() const override { return new DeclStmt( *this ); }
    476         virtual void accept( Visitor &v ) override { v.visit( this ); }
    477         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    478         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
    479 };
    480 
    481 
    482 /// represents an implicit application of a constructor or destructor. Qualifiers are replaced
    483 /// immediately before and after the call so that qualified objects can be constructed
    484 /// with the same functions as unqualified objects.
     470        Declaration * get_decl() const { return decl; }
     471        void set_decl( Declaration * newValue ) { decl = newValue; }
     472
     473        virtual DeclStmt * clone() const override { return new DeclStmt( *this ); }
     474        virtual void accept( Visitor & v ) override { v.visit( this ); }
     475        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     476        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     477};
     478
     479
     480/// represents an implicit application of a constructor or destructor. Qualifiers are replaced immediately before and
     481/// after the call so that qualified objects can be constructed with the same functions as unqualified objects.
    485482class ImplicitCtorDtorStmt : public Statement {
    486483  public:
     
    492489        virtual ~ImplicitCtorDtorStmt();
    493490
    494         Statement *get_callStmt() const { return callStmt; }
     491        Statement * get_callStmt() const { return callStmt; }
    495492        void set_callStmt( Statement * newValue ) { callStmt = newValue; }
    496493
    497         virtual ImplicitCtorDtorStmt *clone() const override { return new ImplicitCtorDtorStmt( *this ); }
    498         virtual void accept( Visitor &v ) override { v.visit( this ); }
    499         virtual Statement *acceptMutator( Mutator &m )  override { return m.mutate( this ); }
    500         virtual void print( std::ostream &os, Indenter indent = {} ) const override;
     494        virtual ImplicitCtorDtorStmt * clone() const override { return new ImplicitCtorDtorStmt( *this ); }
     495        virtual void accept( Visitor & v ) override { v.visit( this ); }
     496        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     497        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    501498};
    502499
Note: See TracChangeset for help on using the changeset viewer.