Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Stmt.hpp

    rf3cc5b6 r87701b6  
    2626#include "Common/CodeLocation.h"
    2727
    28 // Must be included in *all* AST classes; should be #undef'd at the end of the file
    29 #define MUTATE_FRIEND template<typename node_t> friend auto mutate(const node_t * node);
    30 
    3128namespace ast {
    3229
     
    3835        std::vector<Label> labels;
    3936
    40         Stmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
     37        Stmt( const CodeLocation& loc, std::vector<Label>&& labels = {} )
    4138        : ParseNode(loc), labels(std::move(labels)) {}
    4239
    4340        Stmt(const Stmt& o) : ParseNode(o), labels(o.labels) {}
    4441
    45         const Stmt * accept( Visitor & v ) const override = 0;
    46 private:
    47         Stmt * clone() const override = 0;
    48         MUTATE_FRIEND
     42        const Stmt* accept( Visitor& v ) const override = 0;
     43private:
     44        Stmt* clone() const override = 0;
    4945};
    5046
     
    5450        std::list<ptr<Stmt>> kids;
    5551
    56         CompoundStmt(const CodeLocation & loc, std::list<ptr<Stmt>> && ks = {} )
     52        CompoundStmt(const CodeLocation& loc, std::list<ptr<Stmt>>&& ks = {} )
    5753        : Stmt(loc), kids(std::move(ks)) {}
    5854
     
    6056        CompoundStmt( CompoundStmt&& o ) = default;
    6157
    62         void push_back( Stmt * s ) { kids.emplace_back( s ); }
    63         void push_front( Stmt * s ) { kids.emplace_front( s ); }
    64 
    65         const CompoundStmt * accept( Visitor & v ) const override { return v.visit( this ); }
    66 private:
    67         CompoundStmt * clone() const override { return new CompoundStmt{ *this }; }
    68         MUTATE_FRIEND
     58        void push_back( Stmt* s ) { kids.emplace_back( s ); }
     59        void push_front( Stmt* s ) { kids.emplace_front( s ); }
     60
     61        const CompoundStmt* accept( Visitor& v ) const override { return v.visit( this ); }
     62private:
     63        CompoundStmt* clone() const override { return new CompoundStmt{ *this }; }
     64
     65        /// Must be copied in ALL derived classes
     66        template<typename node_t>
     67        friend node_t * mutate(const node_t * node);
    6968};
    7069
     
    7271class NullStmt final : public Stmt {
    7372public:
    74         NullStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
     73        NullStmt( const CodeLocation& loc, std::vector<Label>&& labels = {} )
    7574        : Stmt(loc, std::move(labels)) {}
    7675
    77         const NullStmt * accept( Visitor & v ) const override { return v.visit( this ); }
    78 private:
    79         NullStmt * clone() const override { return new NullStmt{ *this }; }
    80         MUTATE_FRIEND
     76        const NullStmt* accept( Visitor& v ) const override { return v.visit( this ); }
     77private:
     78        NullStmt* clone() const override { return new NullStmt{ *this }; }
     79
     80        /// Must be copied in ALL derived classes
     81        template<typename node_t>
     82        friend node_t * mutate(const node_t * node);
    8183};
    8284
     
    8890        ExprStmt( const CodeLocation & loc, const Expr * e ) : Stmt(loc), expr(e) {}
    8991
    90         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     92        const Stmt * accept( Visitor& v ) const override { return v.visit( this ); }
    9193private:
    9294        ExprStmt * clone() const override { return new ExprStmt{ *this }; }
    93         MUTATE_FRIEND
     95
     96        /// Must be copied in ALL derived classes
     97        template<typename node_t>
     98        friend node_t * mutate(const node_t * node);
    9499};
    95100
     
    102107        std::vector<Label> gotoLabels;
    103108
    104         AsmStmt( const CodeLocation & loc, bool isVolatile, const Expr * instruction,
    105                 std::vector<ptr<Expr>> && output, std::vector<ptr<Expr>> && input,
    106                 std::vector<ptr<ConstantExpr>> && clobber, std::vector<Label> && gotoLabels,
    107                 std::vector<Label> && labels = {})
     109        AsmStmt( const CodeLocation& loc, bool isVolatile, const Expr * instruction,
     110                std::vector<ptr<Expr>>&& output, std::vector<ptr<Expr>>&& input,
     111                std::vector<ptr<ConstantExpr>>&& clobber, std::vector<Label>&& gotoLabels,
     112                std::vector<Label>&& labels = {})
    108113        : Stmt(loc, std::move(labels)), isVolatile(isVolatile), instruction(instruction),
    109114          output(std::move(output)), input(std::move(input)), clobber(std::move(clobber)),
    110115          gotoLabels(std::move(gotoLabels)) {}
    111116
    112         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    113 private:
    114         AsmStmt * clone() const override { return new AsmStmt{ *this }; }
    115         MUTATE_FRIEND
     117        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     118private:
     119        AsmStmt* clone() const override { return new AsmStmt{ *this }; }
     120
     121        /// Must be copied in ALL derived classes
     122        template<typename node_t>
     123        friend node_t * mutate(const node_t * node);
    116124};
    117125
     
    120128        std::string directive;
    121129
    122         DirectiveStmt( const CodeLocation & loc, const std::string & directive,
    123                 std::vector<Label> && labels = {} )
     130        DirectiveStmt( const CodeLocation& loc, const std::string & directive,
     131                std::vector<Label>&& labels = {} )
    124132        : Stmt(loc, std::move(labels)), directive(directive) {}
    125133
    126         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    127 private:
    128         DirectiveStmt * clone() const override { return new DirectiveStmt{ *this }; }
    129         MUTATE_FRIEND
     134        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     135private:
     136        DirectiveStmt* clone() const override { return new DirectiveStmt{ *this }; }
     137
     138        /// Must be copied in ALL derived classes
     139        template<typename node_t>
     140        friend node_t * mutate(const node_t * node);
    130141};
    131142
     
    137148        std::vector<ptr<Stmt>> inits;
    138149
    139         IfStmt( const CodeLocation & loc, const Expr * cond, const Stmt * thenPart,
    140                 Stmt * const elsePart, std::vector<ptr<Stmt>> && inits,
    141                 std::vector<Label> && labels = {} )
     150        IfStmt( const CodeLocation& loc, const Expr* cond, const Stmt* thenPart,
     151                Stmt * const elsePart, std::vector<ptr<Stmt>>&& inits,
     152                std::vector<Label>&& labels = {} )
    142153        : Stmt(loc, std::move(labels)), cond(cond), thenPart(thenPart), elsePart(elsePart),
    143154          inits(std::move(inits)) {}
    144155
    145         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    146 private:
    147         IfStmt * clone() const override { return new IfStmt{ *this }; }
    148         MUTATE_FRIEND
     156        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     157private:
     158        IfStmt* clone() const override { return new IfStmt{ *this }; }
     159
     160        /// Must be copied in ALL derived classes
     161        template<typename node_t>
     162        friend node_t * mutate(const node_t * node);
    149163};
    150164
     
    154168        std::vector<ptr<Stmt>> stmts;
    155169
    156         SwitchStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,
    157                 std::vector<Label> && labels = {} )
     170        SwitchStmt( const CodeLocation& loc, const Expr* cond, std::vector<ptr<Stmt>>&& stmts,
     171                std::vector<Label>&& labels = {} )
    158172        : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
    159173
    160         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    161 private:
    162         SwitchStmt * clone() const override { return new SwitchStmt{ *this }; }
    163         MUTATE_FRIEND
     174        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     175private:
     176        SwitchStmt* clone() const override { return new SwitchStmt{ *this }; }
     177
     178        /// Must be copied in ALL derived classes
     179        template<typename node_t>
     180        friend node_t * mutate(const node_t * node);
    164181};
    165182
     
    169186        std::vector<ptr<Stmt>> stmts;
    170187
    171         CaseStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,
    172                 std::vector<Label> && labels = {} )
    173         : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
     188    CaseStmt( const CodeLocation& loc, const Expr* cond, std::vector<ptr<Stmt>>&& stmts,
     189        std::vector<Label>&& labels = {} )
     190    : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
    174191
    175192        bool isDefault() { return !cond; }
    176193
    177         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    178 private:
    179         CaseStmt * clone() const override { return new CaseStmt{ *this }; }
    180         MUTATE_FRIEND
     194        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     195private:
     196        CaseStmt* clone() const override { return new CaseStmt{ *this }; }
     197
     198        /// Must be copied in ALL derived classes
     199        template<typename node_t>
     200        friend node_t * mutate(const node_t * node);
    181201};
    182202
     
    188208        bool isDoWhile;
    189209
    190         WhileStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body,
    191                 std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, std::vector<Label> && labels = {} )
     210        WhileStmt( const CodeLocation& loc, const Expr* cond, const Stmt* body,
     211                std::vector<ptr<Stmt>>&& inits, bool isDoWhile = false, std::vector<Label>&& labels = {} )
    192212        : Stmt(loc, std::move(labels)), cond(cond), body(body), inits(std::move(inits)),
    193213          isDoWhile(isDoWhile) {}
    194214
    195         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    196 private:
    197         WhileStmt * clone() const override { return new WhileStmt{ *this }; }
    198         MUTATE_FRIEND
     215        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     216private:
     217        WhileStmt* clone() const override { return new WhileStmt{ *this }; }
     218
     219        /// Must be copied in ALL derived classes
     220        template<typename node_t>
     221        friend node_t * mutate(const node_t * node);
    199222};
    200223
     
    206229        ptr<Stmt> body;
    207230
    208         ForStmt( const CodeLocation & loc, std::vector<ptr<Stmt>> && inits, const Expr * cond,
    209                 const Expr * inc, const Stmt * body, std::vector<Label> && labels = {} )
     231        ForStmt( const CodeLocation& loc, std::vector<ptr<Stmt>>&& inits, const Expr* cond,
     232                const Expr* inc, const Stmt* body, std::vector<Label>&& labels = {} )
    210233        : Stmt(loc, std::move(labels)), inits(std::move(inits)), cond(cond), inc(inc),
    211234          body(body) {}
    212235
    213         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    214 private:
    215         ForStmt * clone() const override { return new ForStmt{ *this }; }
    216         MUTATE_FRIEND
     236        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     237private:
     238        ForStmt* clone() const override { return new ForStmt{ *this }; }
     239
     240        /// Must be copied in ALL derived classes
     241        template<typename node_t>
     242        friend node_t * mutate(const node_t * node);
    217243};
    218244
     
    227253        Kind kind;
    228254
    229         BranchStmt( const CodeLocation & loc, Kind kind, Label target,
    230                 std::vector<Label> && labels = {} );
    231         BranchStmt( const CodeLocation & loc, const Expr * computedTarget,
    232                 std::vector<Label> && labels = {} )
     255        BranchStmt( const CodeLocation& loc, Kind kind, Label target,
     256                std::vector<Label>&& labels = {} );
     257        BranchStmt( const CodeLocation& loc, const Expr* computedTarget,
     258                std::vector<Label>&& labels = {} )
    233259        : Stmt(loc, std::move(labels)), originalTarget(loc), target(loc),
    234260          computedTarget(computedTarget), kind(Goto) {}
     
    236262        const char * kindName() { return kindNames[kind]; }
    237263
    238         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    239 private:
    240         BranchStmt * clone() const override { return new BranchStmt{ *this }; }
    241         MUTATE_FRIEND
     264        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     265private:
     266        BranchStmt* clone() const override { return new BranchStmt{ *this }; }
     267
     268        /// Must be copied in ALL derived classes
     269        template<typename node_t>
     270        friend node_t * mutate(const node_t * node);
    242271
    243272        static const char * kindNames[kindEnd];
     
    248277        ptr<Expr> expr;
    249278
    250         ReturnStmt( const CodeLocation & loc, const Expr * expr, std::vector<Label> && labels = {} )
     279        ReturnStmt( const CodeLocation& loc, const Expr* expr, std::vector<Label>&& labels = {} )
    251280        : Stmt(loc, std::move(labels)), expr(expr) {}
    252281
    253         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    254 private:
    255         ReturnStmt * clone() const override { return new ReturnStmt{ *this }; }
    256         MUTATE_FRIEND
     282        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     283private:
     284        ReturnStmt* clone() const override { return new ReturnStmt{ *this }; }
     285
     286        /// Must be copied in ALL derived classes
     287        template<typename node_t>
     288        friend node_t * mutate(const node_t * node);
    257289};
    258290
     
    265297        Kind kind;
    266298
    267         ThrowStmt( const CodeLocation & loc, Kind kind, const Expr * expr, const Expr * target,
    268                 std::vector<Label> && labels = {} )
     299        ThrowStmt( const CodeLocation& loc, Kind kind, const Expr* expr, const Expr* target,
     300                std::vector<Label>&& labels = {} )
    269301        : Stmt(loc, std::move(labels)), expr(expr), target(target), kind(kind) {}
    270302
    271         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    272 private:
    273         ThrowStmt * clone() const override { return new ThrowStmt{ *this }; }
    274         MUTATE_FRIEND
     303        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     304private:
     305        ThrowStmt* clone() const override { return new ThrowStmt{ *this }; }
     306
     307        /// Must be copied in ALL derived classes
     308        template<typename node_t>
     309        friend node_t * mutate(const node_t * node);
    275310};
    276311
     
    281316        ptr<FinallyStmt> finally;
    282317
    283         TryStmt( const CodeLocation & loc, const CompoundStmt * body,
    284                 std::vector<ptr<CatchStmt>> && handlers, const FinallyStmt * finally,
    285                 std::vector<Label> && labels = {} )
     318        TryStmt( const CodeLocation& loc, const CompoundStmt* body,
     319                std::vector<ptr<CatchStmt>>&& handlers, const FinallyStmt* finally,
     320                std::vector<Label>&& labels = {} )
    286321        : Stmt(loc, std::move(labels)), body(body), handlers(std::move(handlers)), finally(finally) {}
    287322
    288         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    289 private:
    290         TryStmt * clone() const override { return new TryStmt{ *this }; }
    291         MUTATE_FRIEND
     323        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     324private:
     325        TryStmt* clone() const override { return new TryStmt{ *this }; }
     326
     327        /// Must be copied in ALL derived classes
     328        template<typename node_t>
     329        friend node_t * mutate(const node_t * node);
    292330};
    293331
     
    301339        Kind kind;
    302340
    303         CatchStmt( const CodeLocation & loc, Kind kind, const Decl * decl, const Expr * cond,
    304                 const Stmt * body, std::vector<Label> && labels = {} )
     341        CatchStmt( const CodeLocation& loc, Kind kind, const Decl* decl, const Expr* cond,
     342                const Stmt* body, std::vector<Label>&& labels = {} )
    305343        : Stmt(loc, std::move(labels)), decl(decl), cond(cond), body(body), kind(kind) {}
    306344
    307         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    308 private:
    309         CatchStmt * clone() const override { return new CatchStmt{ *this }; }
    310         MUTATE_FRIEND
     345        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     346private:
     347        CatchStmt* clone() const override { return new CatchStmt{ *this }; }
     348
     349        /// Must be copied in ALL derived classes
     350        template<typename node_t>
     351        friend node_t * mutate(const node_t * node);
    311352};
    312353
     
    315356        ptr<CompoundStmt> body;
    316357
    317         FinallyStmt( const CodeLocation & loc, const CompoundStmt * body,
    318                 std::vector<Label> && labels = {} )
     358        FinallyStmt( const CodeLocation& loc, const CompoundStmt* body,
     359                std::vector<Label>&& labels = {} )
    319360        : Stmt(loc, std::move(labels)), body(body) {}
    320361
    321         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    322 private:
    323         FinallyStmt * clone() const override { return new FinallyStmt{ *this }; }
    324         MUTATE_FRIEND
     362        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     363private:
     364        FinallyStmt* clone() const override { return new FinallyStmt{ *this }; }
     365
     366        /// Must be copied in ALL derived classes
     367        template<typename node_t>
     368        friend node_t * mutate(const node_t * node);
    325369};
    326370
     
    353397        OrElse orElse;
    354398
    355         WaitForStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
     399        WaitForStmt( const CodeLocation& loc, std::vector<Label>&& labels = {} )
    356400        : Stmt(loc, std::move(labels)) {}
    357401
    358         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    359 private:
    360         WaitForStmt * clone() const override { return new WaitForStmt{ *this }; }
    361         MUTATE_FRIEND
     402        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     403private:
     404        WaitForStmt* clone() const override { return new WaitForStmt{ *this }; }
     405
     406        /// Must be copied in ALL derived classes
     407        template<typename node_t>
     408        friend node_t * mutate(const node_t * node);
    362409};
    363410
     
    367414        ptr<Stmt> stmt;
    368415
    369         WithStmt( const CodeLocation & loc, std::vector<ptr<Expr>> && exprs, const Stmt * stmt,
    370                 std::vector<Label> && labels = {} )
     416        WithStmt( const CodeLocation& loc, std::vector<ptr<Expr>>&& exprs, const Stmt* stmt,
     417                std::vector<Label>&& labels = {} )
    371418        : Stmt(loc, std::move(labels)), exprs(std::move(exprs)), stmt(stmt) {}
    372419
    373         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    374 private:
    375         WithStmt * clone() const override { return new WithStmt{ *this }; }
    376         MUTATE_FRIEND
     420        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     421private:
     422        WithStmt* clone() const override { return new WithStmt{ *this }; }
     423
     424        /// Must be copied in ALL derived classes
     425        template<typename node_t>
     426        friend node_t * mutate(const node_t * node);
    377427};
    378428
     
    381431        ptr<Decl> decl;
    382432
    383         DeclStmt( const CodeLocation & loc, const Decl * decl, std::vector<Label> && labels = {} )
     433        DeclStmt( const CodeLocation& loc, const Decl* decl, std::vector<Label>&& labels = {} )
    384434        : Stmt(loc, std::move(labels)), decl(decl) {}
    385435
    386         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    387 private:
    388         DeclStmt * clone() const override { return new DeclStmt{ *this }; }
    389         MUTATE_FRIEND
     436        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     437private:
     438        DeclStmt* clone() const override { return new DeclStmt{ *this }; }
     439
     440        /// Must be copied in ALL derived classes
     441        template<typename node_t>
     442        friend node_t * mutate(const node_t * node);
    390443};
    391444
     
    394447        readonly<Stmt> callStmt;
    395448
    396         ImplicitCtorDtorStmt( const CodeLocation & loc, const Stmt * callStmt,
    397                 std::vector<Label> && labels = {} )
     449        ImplicitCtorDtorStmt( const CodeLocation& loc, const Stmt* callStmt,
     450                std::vector<Label>&& labels = {} )
    398451        : Stmt(loc, std::move(labels)), callStmt(callStmt) {}
    399452
    400         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    401 private:
    402         ImplicitCtorDtorStmt * clone() const override { return new ImplicitCtorDtorStmt{ *this }; }
    403         MUTATE_FRIEND
    404 };
    405 
    406 //=================================================================================================
    407 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
    408 /// remove only if there is a better solution
    409 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
    410 /// forward declarations
    411 inline void increment( const class Stmt * node, Node::ref_type ref ) { node->increment( ref ); }
    412 inline void decrement( const class Stmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    413 inline void increment( const class CompoundStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    414 inline void decrement( const class CompoundStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    415 inline void increment( const class ExprStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    416 inline void decrement( const class ExprStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    417 inline void increment( const class AsmStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    418 inline void decrement( const class AsmStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    419 inline void increment( const class DirectiveStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    420 inline void decrement( const class DirectiveStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    421 inline void increment( const class IfStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    422 inline void decrement( const class IfStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    423 inline void increment( const class WhileStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    424 inline void decrement( const class WhileStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    425 inline void increment( const class ForStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    426 inline void decrement( const class ForStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    427 inline void increment( const class SwitchStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    428 inline void decrement( const class SwitchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    429 inline void increment( const class CaseStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    430 inline void decrement( const class CaseStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    431 inline void increment( const class BranchStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    432 inline void decrement( const class BranchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    433 inline void increment( const class ReturnStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    434 inline void decrement( const class ReturnStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    435 inline void increment( const class ThrowStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    436 inline void decrement( const class ThrowStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    437 inline void increment( const class TryStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    438 inline void decrement( const class TryStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    439 inline void increment( const class CatchStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    440 inline void decrement( const class CatchStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    441 inline void increment( const class FinallyStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    442 inline void decrement( const class FinallyStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    443 inline void increment( const class WaitForStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    444 inline void decrement( const class WaitForStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    445 inline void increment( const class WithStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    446 inline void decrement( const class WithStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    447 inline void increment( const class DeclStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    448 inline void decrement( const class DeclStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    449 inline void increment( const class NullStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    450 inline void decrement( const class NullStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
    451 inline void increment( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->increment( ref ); }
    452 inline void decrement( const class ImplicitCtorDtorStmt * node, Node::ref_type ref ) { node->decrement( ref ); }
     453        const Stmt* accept( Visitor& v ) const override { return v.visit( this ); }
     454private:
     455        ImplicitCtorDtorStmt* clone() const override { return new ImplicitCtorDtorStmt{ *this }; }
     456
     457        /// Must be copied in ALL derived classes
     458        template<typename node_t>
     459        friend node_t * mutate(const node_t * node);
     460};
    453461
    454462}
    455 
    456 #undef MUTATE_FRIEND
    457463
    458464// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.