Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Stmt.hpp

    r6180274 rb8ab91a  
    99// Author           : Aaron B. Moss
    1010// Created On       : Wed May  8 13:00:00 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Feb  2 20:06:41 2022
    13 // Update Count     : 34
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri May 17 12:45:00 2019
     13// Update Count     : 5
    1414//
    1515
     
    1717
    1818#include <list>
    19 #include <utility>                                                                              // for move
     19#include <utility>                // for move
    2020#include <vector>
    2121
    2222#include "Label.hpp"
    23 #include "Node.hpp"                                                                             // for node, ptr
     23#include "Node.hpp"               // for node, ptr
    2424#include "ParseNode.hpp"
    2525#include "Visitor.hpp"
     
    2727
    2828// Must be included in *all* AST classes; should be #undef'd at the end of the file
    29 #define MUTATE_FRIEND                                                                                                   \
     29#define MUTATE_FRIEND \
    3030    template<typename node_t> friend node_t * mutate(const node_t * node); \
    3131        template<typename node_t> friend node_t * shallowCopy(const node_t * node);
    3232
    3333namespace ast {
     34
    3435class Expr;
    3536
    36 // Base statement node
     37/// Base statement node
    3738class Stmt : public ParseNode {
    38   public:
     39public:
    3940        std::vector<Label> labels;
    4041
    41         Stmt( const CodeLocation & loc, const std::vector<Label> && labels = {} )
    42                 : ParseNode(loc), labels(std::move(labels)) {}
    43 
    44         Stmt(const Stmt & o) : ParseNode(o), labels(o.labels) {}
     42        Stmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
     43        : ParseNode(loc), labels(std::move(labels)) {}
     44
     45        Stmt(const Stmt& o) : ParseNode(o), labels(o.labels) {}
    4546
    4647        const Stmt * accept( Visitor & v ) const override = 0;
    47   private:
     48private:
    4849        Stmt * clone() const override = 0;
    4950        MUTATE_FRIEND
    5051};
    5152
    52 // Compound statement: { ... }
     53/// Compound statement `{ ... }`
    5354class CompoundStmt final : public Stmt {
    54   public:
     55public:
    5556        std::list<ptr<Stmt>> kids;
    5657
    57         CompoundStmt(const CodeLocation & loc, const std::list<ptr<Stmt>> && ks = {}, const std::vector<Label> && labels = {} )
    58                 : Stmt(loc, std::move(labels)), kids(std::move(ks)) {}
    59 
    60         CompoundStmt( const CompoundStmt & o );
    61         CompoundStmt( CompoundStmt && o ) = default;
     58        CompoundStmt(const CodeLocation & loc, std::list<ptr<Stmt>> && ks = {},
     59                std::vector<Label>&& labels = {} )
     60        : Stmt(loc, std::move(labels)), kids(std::move(ks)) {}
     61
     62        CompoundStmt( const CompoundStmt& o );
     63        CompoundStmt( CompoundStmt&& o ) = default;
    6264
    6365        void push_back( const Stmt * s ) { kids.emplace_back( s ); }
     
    6567
    6668        const CompoundStmt * accept( Visitor & v ) const override { return v.visit( this ); }
    67   private:
     69private:
    6870        CompoundStmt * clone() const override { return new CompoundStmt{ *this }; }
    6971        MUTATE_FRIEND
    7072};
    7173
    72 // Empty statment: ;
     74/// Empty statment `;`
    7375class NullStmt final : public Stmt {
    74   public:
    75         NullStmt( const CodeLocation & loc, const std::vector<Label> && labels = {} )
    76                 : Stmt(loc, std::move(labels)) {}
     76public:
     77        NullStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
     78        : Stmt(loc, std::move(labels)) {}
    7779
    7880        const NullStmt * accept( Visitor & v ) const override { return v.visit( this ); }
    79   private:
     81private:
    8082        NullStmt * clone() const override { return new NullStmt{ *this }; }
    8183        MUTATE_FRIEND
    8284};
    8385
    84 // Expression wrapped by statement
     86/// Expression wrapped by statement
    8587class ExprStmt final : public Stmt {
    86   public:
     88public:
    8789        ptr<Expr> expr;
    8890
    89         ExprStmt( const CodeLocation & loc, const Expr* e, const std::vector<Label> && labels = {} )
    90                 : Stmt(loc, std::move(labels)), expr(e) {}
    91 
    92         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    93   private:
     91        ExprStmt( const CodeLocation& loc, const Expr* e, std::vector<Label>&& labels = {} )
     92        : Stmt(loc, std::move(labels)), expr(e) {}
     93
     94        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     95private:
    9496        ExprStmt * clone() const override { return new ExprStmt{ *this }; }
    9597        MUTATE_FRIEND
    9698};
    9799
    98 // Assembly statement: asm ... ( "..." : ... )
     100/// Assembly statement `asm ... ( "..." : ... )`
    99101class AsmStmt final : public Stmt {
    100   public:
     102public:
    101103        bool isVolatile;
    102104        ptr<Expr> instruction;
     
    106108
    107109        AsmStmt( const CodeLocation & loc, bool isVolatile, const Expr * instruction,
    108                          const std::vector<ptr<Expr>> && output, const std::vector<ptr<Expr>> && input,
    109                          const std::vector<ptr<ConstantExpr>> && clobber, const std::vector<Label> && gotoLabels,
    110                          const std::vector<Label> && labels = {})
    111                 : Stmt(loc, std::move(labels)), isVolatile(isVolatile), instruction(instruction),
    112                   output(std::move(output)), input(std::move(input)), clobber(std::move(clobber)),
    113                   gotoLabels(std::move(gotoLabels)) {}
    114 
    115         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    116   private:
     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 = {})
     113        : Stmt(loc, std::move(labels)), isVolatile(isVolatile), instruction(instruction),
     114          output(std::move(output)), input(std::move(input)), clobber(std::move(clobber)),
     115          gotoLabels(std::move(gotoLabels)) {}
     116
     117        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     118private:
    117119        AsmStmt * clone() const override { return new AsmStmt{ *this }; }
    118120        MUTATE_FRIEND
    119121};
    120122
    121 // C-preprocessor directive: #...
     123/// C-preprocessor directive `#...`
    122124class DirectiveStmt final : public Stmt {
    123   public:
     125public:
    124126        std::string directive;
    125127
    126128        DirectiveStmt( const CodeLocation & loc, const std::string & directive,
    127                                    std::vector<Label> && labels = {} )
    128                 : Stmt(loc, std::move(labels)), directive(directive) {}
    129 
    130         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    131   private:
     129                std::vector<Label> && labels = {} )
     130        : Stmt(loc, std::move(labels)), directive(directive) {}
     131
     132        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     133private:
    132134        DirectiveStmt * clone() const override { return new DirectiveStmt{ *this }; }
    133135        MUTATE_FRIEND
    134136};
    135137
    136 // If statement: if (...) ... else ...
     138/// If conditional statement `if (...) ... else ...`
    137139class IfStmt final : public Stmt {
    138   public:
    139         ptr<Expr> cond;
    140         ptr<Stmt> then;
    141         ptr<Stmt> else_;
     140public:
     141        ptr<Expr> cond;
     142        ptr<Stmt> thenPart;
     143        ptr<Stmt> elsePart;
    142144        std::vector<ptr<Stmt>> inits;
    143145
    144         IfStmt( const CodeLocation & loc, const Expr * cond, const Stmt * then,
    145                         const Stmt * else_ = nullptr, const std::vector<ptr<Stmt>> && inits = {},
    146                         const std::vector<Label> && labels = {} )
    147                 : Stmt(loc, std::move(labels)), cond(cond), then(then), else_(else_),
    148                   inits(std::move(inits)) {}
    149 
    150         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    151   private:
     146        IfStmt( const CodeLocation & loc, const Expr * cond, const Stmt * thenPart,
     147                const Stmt * elsePart = nullptr, std::vector<ptr<Stmt>> && inits = {},
     148                std::vector<Label> && labels = {} )
     149        : Stmt(loc, std::move(labels)), cond(cond), thenPart(thenPart), elsePart(elsePart),
     150          inits(std::move(inits)) {}
     151
     152        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     153private:
    152154        IfStmt * clone() const override { return new IfStmt{ *this }; }
    153155        MUTATE_FRIEND
    154156};
    155157
    156 // Switch or choose statement: switch (...) { ... }
     158/// Switch or choose conditional statement `switch (...) { ... }`
    157159class SwitchStmt final : public Stmt {
    158   public:
     160public:
    159161        ptr<Expr> cond;
    160162        std::vector<ptr<Stmt>> stmts;
    161163
    162         SwitchStmt( const CodeLocation & loc, const Expr * cond, const std::vector<ptr<Stmt>> && stmts,
    163                                 const std::vector<Label> && labels = {} )
    164                 : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
    165 
    166         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    167   private:
     164        SwitchStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,
     165                std::vector<Label> && labels = {} )
     166        : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
     167
     168        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     169private:
    168170        SwitchStmt * clone() const override { return new SwitchStmt{ *this }; }
    169171        MUTATE_FRIEND
    170172};
    171173
    172 // Case label: case ...: or default:
     174/// Case label `case ...:` `default:`
    173175class CaseStmt final : public Stmt {
    174   public:
    175         // Null for the default label.
     176public:
     177        /// Null for the default label.
    176178        ptr<Expr> cond;
    177179        std::vector<ptr<Stmt>> stmts;
    178180
    179         CaseStmt( const CodeLocation & loc, const Expr * cond, const std::vector<ptr<Stmt>> && stmts,
    180                           const std::vector<Label> && labels = {} )
    181                 : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
     181        CaseStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,
     182                std::vector<Label> && labels = {} )
     183        : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
    182184
    183185        bool isDefault() const { return !cond; }
    184186
    185187        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    186   private:
     188private:
    187189        CaseStmt * clone() const override { return new CaseStmt{ *this }; }
    188190        MUTATE_FRIEND
    189191};
    190192
    191 // While loop: while (...) ... else ... or do ... while (...) else ...;
    192 class WhileDoStmt final : public Stmt {
    193   public:
     193/// While loop `while (...) ...` `do ... while (...);
     194class WhileStmt final : public Stmt {
     195public:
    194196        ptr<Expr> cond;
    195197        ptr<Stmt> body;
    196         ptr<Stmt> else_;
    197198        std::vector<ptr<Stmt>> inits;
    198199        bool isDoWhile;
    199200
    200         WhileDoStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body,
    201                                  const std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, const std::vector<Label> && labels = {} )
    202                 : Stmt(loc, std::move(labels)), cond(cond), body(body), else_(nullptr), inits(std::move(inits)), isDoWhile(isDoWhile) {}
    203 
    204         WhileDoStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body, const Stmt * else_,
    205                                  const std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, const std::vector<Label> && labels = {} )
    206                 : Stmt(loc, std::move(labels)), cond(cond), body(body), else_(else_), inits(std::move(inits)), isDoWhile(isDoWhile) {}
    207 
    208         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    209   private:
    210         WhileDoStmt * clone() const override { return new WhileDoStmt{ *this }; }
    211         MUTATE_FRIEND
    212 };
    213 
    214 // For loop: for (... ; ... ; ...) ... else ...
     201        WhileStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body,
     202                std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, std::vector<Label> && labels = {} )
     203        : Stmt(loc, std::move(labels)), cond(cond), body(body), inits(std::move(inits)),
     204          isDoWhile(isDoWhile) {}
     205
     206        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     207private:
     208        WhileStmt * clone() const override { return new WhileStmt{ *this }; }
     209        MUTATE_FRIEND
     210};
     211
     212/// For loop `for (... ; ... ; ...) ...`
    215213class ForStmt final : public Stmt {
    216   public:
     214public:
    217215        std::vector<ptr<Stmt>> inits;
    218216        ptr<Expr> cond;
    219217        ptr<Expr> inc;
    220218        ptr<Stmt> body;
    221         ptr<Stmt> else_;
    222 
    223         ForStmt( const CodeLocation & loc, const std::vector<ptr<Stmt>> && inits, const Expr * cond,
    224                          const Expr * inc, const Stmt * body, const std::vector<Label> && label = {} )
    225                 : Stmt(loc, std::move(label)), inits(std::move(inits)), cond(cond), inc(inc), body(body), else_(nullptr) {}
    226 
    227         ForStmt( const CodeLocation & loc, const std::vector<ptr<Stmt>> && inits, const Expr * cond,
    228                          const Expr * inc, const Stmt * body, const Stmt * else_, const std::vector<Label> && labels = {} )
    229                 : Stmt(loc, std::move(labels)), inits(std::move(inits)), cond(cond), inc(inc), body(body), else_(else_) {}
    230 
    231         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    232   private:
     219
     220        ForStmt( const CodeLocation & loc, std::vector<ptr<Stmt>> && inits, const Expr * cond,
     221                const Expr * inc, const Stmt * body, std::vector<Label> && labels = {} )
     222        : Stmt(loc, std::move(labels)), inits(std::move(inits)), cond(cond), inc(inc),
     223          body(body) {}
     224
     225        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     226private:
    233227        ForStmt * clone() const override { return new ForStmt{ *this }; }
    234228        MUTATE_FRIEND
    235229};
    236230
    237 // Branch control flow statement: goto ... or break or continue or fallthru
     231/// Branch control flow statement `goto ...` `break` `continue` `fallthru`
    238232class BranchStmt final : public Stmt {
    239   public:
     233public:
    240234        enum Kind { Goto, Break, Continue, FallThrough, FallThroughDefault };
    241235        static constexpr size_t kindEnd = 1 + (size_t)FallThroughDefault;
     
    246240        Kind kind;
    247241
    248         BranchStmt( const CodeLocation & loc, Kind kind, Label target, const std::vector<Label> && labels = {} );
    249         BranchStmt( const CodeLocation & loc, const Expr * computedTarget, const std::vector<Label> && labels = {} )
    250                 : Stmt(loc, std::move(labels)), originalTarget(loc), target(loc), computedTarget(computedTarget), kind(Goto) {}
     242        BranchStmt( const CodeLocation & loc, Kind kind, Label target,
     243                std::vector<Label> && labels = {} );
     244        BranchStmt( const CodeLocation & loc, const Expr * computedTarget,
     245                std::vector<Label> && labels = {} )
     246        : Stmt(loc, std::move(labels)), originalTarget(loc), target(loc),
     247          computedTarget(computedTarget), kind(Goto) {}
    251248
    252249        const char * kindName() const { return kindNames[kind]; }
    253250
    254251        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    255   private:
     252private:
    256253        BranchStmt * clone() const override { return new BranchStmt{ *this }; }
    257254        MUTATE_FRIEND
     
    260257};
    261258
    262 // Return statement: return ...
     259/// Return statement `return ...`
    263260class ReturnStmt final : public Stmt {
    264   public:
     261public:
    265262        ptr<Expr> expr;
    266263
    267         ReturnStmt( const CodeLocation & loc, const Expr * expr, const std::vector<Label> && labels = {} )
    268                 : Stmt(loc, std::move(labels)), expr(expr) {}
    269 
    270         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    271   private:
     264        ReturnStmt( const CodeLocation & loc, const Expr * expr, std::vector<Label> && labels = {} )
     265        : Stmt(loc, std::move(labels)), expr(expr) {}
     266
     267        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     268private:
    272269        ReturnStmt * clone() const override { return new ReturnStmt{ *this }; }
    273270        MUTATE_FRIEND
    274271};
    275272
    276 // Kind of exception
     273/// Kind of exception
    277274enum ExceptionKind { Terminate, Resume };
    278275
    279 // Throw statement: throw ...
     276/// Throw statement `throw ...`
    280277class ThrowStmt final : public Stmt {
    281   public:
     278public:
    282279        ptr<Expr> expr;
    283280        ptr<Expr> target;
    284281        ExceptionKind kind;
    285282
    286         ThrowStmt( const CodeLocation & loc, ExceptionKind kind, const Expr * expr,
    287                            const Expr * target, const std::vector<Label> && labels = {} )
    288                 : Stmt(loc, std::move(labels)), expr(expr), target(target), kind(kind) {}
    289 
    290         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    291   private:
     283        ThrowStmt(
     284                const CodeLocation & loc, ExceptionKind kind, const Expr * expr, const Expr * target,
     285                std::vector<Label> && labels = {} )
     286        : Stmt(loc, std::move(labels)), expr(expr), target(target), kind(kind) {}
     287
     288        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     289private:
    292290        ThrowStmt * clone() const override { return new ThrowStmt{ *this }; }
    293291        MUTATE_FRIEND
    294292};
    295293
    296 // Try statement: try { ... } ...
     294/// Try statement `try { ... } ...`
    297295class TryStmt final : public Stmt {
    298   public:
     296public:
    299297        ptr<CompoundStmt> body;
    300298        std::vector<ptr<CatchStmt>> handlers;
    301299        ptr<FinallyStmt> finally;
    302300
    303         TryStmt( const CodeLocation & loc, const CompoundStmt * body,
    304                          const std::vector<ptr<CatchStmt>> && handlers, const FinallyStmt * finally,
    305                          const std::vector<Label> && labels = {} )
    306                 : Stmt(loc, std::move(labels)), body(body), handlers(std::move(handlers)), finally(finally) {}
    307 
    308         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    309   private:
     301        TryStmt(
     302                const CodeLocation & loc, const CompoundStmt * body,
     303                std::vector<ptr<CatchStmt>> && handlers, const FinallyStmt * finally,
     304                std::vector<Label> && labels = {} )
     305        : Stmt(loc, std::move(labels)), body(body), handlers(std::move(handlers)), finally(finally) {}
     306
     307        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     308private:
    310309        TryStmt * clone() const override { return new TryStmt{ *this }; }
    311310        MUTATE_FRIEND
    312311};
    313312
    314 // Catch clause of try statement
     313/// Catch clause of try statement
    315314class CatchStmt final : public Stmt {
    316   public:
     315public:
    317316        ptr<Decl> decl;
    318317        ptr<Expr> cond;
     
    320319        ExceptionKind kind;
    321320
    322         CatchStmt( const CodeLocation & loc, ExceptionKind kind, const Decl * decl, const Expr * cond,
    323                            const Stmt * body, const std::vector<Label> && labels = {} )
    324                 : Stmt(loc, std::move(labels)), decl(decl), cond(cond), body(body), kind(kind) {}
    325 
    326         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    327   private:
     321        CatchStmt(
     322                const CodeLocation & loc, ExceptionKind kind, const Decl * decl, const Expr * cond,
     323                const Stmt * body, std::vector<Label> && labels = {} )
     324        : Stmt(loc, std::move(labels)), decl(decl), cond(cond), body(body), kind(kind) {}
     325
     326        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     327private:
    328328        CatchStmt * clone() const override { return new CatchStmt{ *this }; }
    329329        MUTATE_FRIEND
    330330};
    331331
    332 // Finally clause of try statement
     332/// Finally clause of try statement
    333333class FinallyStmt final : public Stmt {
    334   public:
     334public:
    335335        ptr<CompoundStmt> body;
    336336
    337337        FinallyStmt( const CodeLocation & loc, const CompoundStmt * body,
    338                                  std::vector<Label> && labels = {} )
    339                 : Stmt(loc, std::move(labels)), body(body) {}
    340 
    341         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    342   private:
     338                std::vector<Label> && labels = {} )
     339        : Stmt(loc, std::move(labels)), body(body) {}
     340
     341        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     342private:
    343343        FinallyStmt * clone() const override { return new FinallyStmt{ *this }; }
    344344        MUTATE_FRIEND
    345345};
    346346
    347 // Suspend statement
     347/// Suspend statement
    348348class SuspendStmt final : public Stmt {
    349   public:
     349public:
    350350        ptr<CompoundStmt> then;
    351351        enum Type { None, Coroutine, Generator } type = None;
    352352
    353         SuspendStmt( const CodeLocation & loc, const CompoundStmt * then, Type type, const std::vector<Label> && labels = {} )
    354                 : Stmt(loc, std::move(labels)), then(then), type(type) {}
    355 
    356         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    357   private:
     353        SuspendStmt( const CodeLocation & loc, const CompoundStmt * then, Type type, std::vector<Label> && labels = {} )
     354        : Stmt(loc, std::move(labels)), then(then), type(type) {}
     355
     356        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     357private:
    358358        SuspendStmt * clone() const override { return new SuspendStmt{ *this }; }
    359359        MUTATE_FRIEND
    360360};
    361361
    362 // Waitfor statement: when (...) waitfor (... , ...) ... timeout(...) ... else ...
     362/// Wait for concurrency statement `when (...) waitfor (... , ...) ... timeout(...) ... else ...`
    363363class WaitForStmt final : public Stmt {
    364   public:
     364public:
    365365        struct Target {
    366366                ptr<Expr> func;
     
    389389        OrElse orElse;
    390390
    391         WaitForStmt( const CodeLocation & loc, const std::vector<Label> && labels = {} )
    392                 : Stmt(loc, std::move(labels)) {}
    393 
    394         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    395   private:
     391        WaitForStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
     392        : Stmt(loc, std::move(labels)) {}
     393
     394        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     395private:
    396396        WaitForStmt * clone() const override { return new WaitForStmt{ *this }; }
    397397        MUTATE_FRIEND
    398398};
    399399
    400 // Any declaration in a (compound) statement.
     400/// Any declaration in a (compound) statement.
    401401class DeclStmt final : public Stmt {
    402   public:
     402public:
    403403        ptr<Decl> decl;
    404404
    405         DeclStmt( const CodeLocation & loc, const Decl * decl, const std::vector<Label> && labels = {} )
    406                 : Stmt(loc, std::move(labels)), decl(decl) {}
    407 
    408         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    409   private:
     405        DeclStmt( const CodeLocation & loc, const Decl * decl, std::vector<Label> && labels = {} )
     406        : Stmt(loc, std::move(labels)), decl(decl) {}
     407
     408        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     409private:
    410410        DeclStmt * clone() const override { return new DeclStmt{ *this }; }
    411411        MUTATE_FRIEND
    412412};
    413413
    414 // Represents an implicit application of a constructor or destructor.
     414/// Represents an implicit application of a constructor or destructor.
    415415class ImplicitCtorDtorStmt final : public Stmt {
    416   public:
     416public:
    417417        ptr<Stmt> callStmt;
    418418
    419419        ImplicitCtorDtorStmt( const CodeLocation & loc, const Stmt * callStmt,
    420                                                   std::vector<Label> && labels = {} )
    421                 : Stmt(loc, std::move(labels)), callStmt(callStmt) {}
    422 
    423         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    424   private:
     420                std::vector<Label> && labels = {} )
     421        : Stmt(loc, std::move(labels)), callStmt(callStmt) {}
     422
     423        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     424private:
    425425        ImplicitCtorDtorStmt * clone() const override { return new ImplicitCtorDtorStmt{ *this }; }
    426426        MUTATE_FRIEND
    427427};
    428428
    429 // Mutex Statement
     429/// Mutex Statement
    430430class MutexStmt final : public Stmt {
    431   public:
     431public:
    432432        ptr<Stmt> stmt;
    433433        std::vector<ptr<Expr>> mutexObjs;
    434434
    435435        MutexStmt( const CodeLocation & loc, const Stmt * stmt,
    436                            const std::vector<ptr<Expr>> && mutexes, const std::vector<Label> && labels = {} )
    437                 : Stmt(loc, std::move(labels)), stmt(stmt), mutexObjs(std::move(mutexes)) {}
    438 
    439         const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
    440   private:
     436                std::vector<ptr<Expr>> && mutexes, std::vector<Label> && labels = {} )
     437        : Stmt(loc, std::move(labels)), stmt(stmt), mutexObjs(std::move(mutexes)) {}
     438
     439        const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
     440private:
    441441        MutexStmt * clone() const override { return new MutexStmt{ *this }; }
    442442        MUTATE_FRIEND
    443443};
    444 } // namespace ast
     444
     445}
    445446
    446447#undef MUTATE_FRIEND
    447448
    448449// Local Variables: //
     450// tab-width: 4 //
    449451// mode: c++ //
     452// compile-command: "make install" //
    450453// End: //
Note: See TracChangeset for help on using the changeset viewer.