[2bb4a01] | 1 | //
|
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
|
---|
| 3 | //
|
---|
| 4 | // The contents of this file are covered under the licence agreement in the
|
---|
| 5 | // file "LICENCE" distributed with Cforall.
|
---|
| 6 | //
|
---|
| 7 | // Stmt.hpp --
|
---|
| 8 | //
|
---|
| 9 | // Author : Aaron B. Moss
|
---|
[1e97287] | 10 | // Created On : Wed May 8 13:00:00 2019
|
---|
| 11 | // Last Modified By : Andrew Beach
|
---|
[675d816] | 12 | // Last Modified On : Fri May 17 12:45:00 2019
|
---|
| 13 | // Update Count : 5
|
---|
[2bb4a01] | 14 | //
|
---|
| 15 |
|
---|
| 16 | #pragma once
|
---|
| 17 |
|
---|
| 18 | #include <list>
|
---|
| 19 | #include <utility> // for move
|
---|
| 20 | #include <vector>
|
---|
| 21 |
|
---|
| 22 | #include "Label.hpp"
|
---|
| 23 | #include "Node.hpp" // for node, ptr
|
---|
| 24 | #include "ParseNode.hpp"
|
---|
| 25 | #include "Visitor.hpp"
|
---|
| 26 | #include "Common/CodeLocation.h"
|
---|
| 27 |
|
---|
[f3cc5b6] | 28 | // Must be included in *all* AST classes; should be #undef'd at the end of the file
|
---|
[acd80b4] | 29 | #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node);
|
---|
[f3cc5b6] | 30 |
|
---|
[2bb4a01] | 31 | namespace ast {
|
---|
| 32 |
|
---|
| 33 | class Expr;
|
---|
| 34 |
|
---|
| 35 | /// Base statement node
|
---|
| 36 | class Stmt : public ParseNode {
|
---|
| 37 | public:
|
---|
| 38 | std::vector<Label> labels;
|
---|
| 39 |
|
---|
[f3cc5b6] | 40 | Stmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
|
---|
[2bb4a01] | 41 | : ParseNode(loc), labels(std::move(labels)) {}
|
---|
| 42 |
|
---|
| 43 | Stmt(const Stmt& o) : ParseNode(o), labels(o.labels) {}
|
---|
| 44 |
|
---|
[f3cc5b6] | 45 | const Stmt * accept( Visitor & v ) const override = 0;
|
---|
[2bb4a01] | 46 | private:
|
---|
[f3cc5b6] | 47 | Stmt * clone() const override = 0;
|
---|
| 48 | MUTATE_FRIEND
|
---|
[2bb4a01] | 49 | };
|
---|
| 50 |
|
---|
| 51 | /// Compound statement `{ ... }`
|
---|
| 52 | class CompoundStmt final : public Stmt {
|
---|
| 53 | public:
|
---|
| 54 | std::list<ptr<Stmt>> kids;
|
---|
| 55 |
|
---|
[d66e7b7] | 56 | CompoundStmt(const CodeLocation & loc, std::list<ptr<Stmt>> && ks = {},
|
---|
| 57 | std::vector<Label>&& labels = {} )
|
---|
| 58 | : Stmt(loc, std::move(labels)), kids(std::move(ks)) {}
|
---|
[2bb4a01] | 59 |
|
---|
| 60 | CompoundStmt( const CompoundStmt& o );
|
---|
| 61 | CompoundStmt( CompoundStmt&& o ) = default;
|
---|
| 62 |
|
---|
[f3cc5b6] | 63 | void push_back( Stmt * s ) { kids.emplace_back( s ); }
|
---|
| 64 | void push_front( Stmt * s ) { kids.emplace_front( s ); }
|
---|
[2bb4a01] | 65 |
|
---|
[f3cc5b6] | 66 | const CompoundStmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[2bb4a01] | 67 | private:
|
---|
[f3cc5b6] | 68 | CompoundStmt * clone() const override { return new CompoundStmt{ *this }; }
|
---|
| 69 | MUTATE_FRIEND
|
---|
[2bb4a01] | 70 | };
|
---|
| 71 |
|
---|
| 72 | /// Empty statment `;`
|
---|
| 73 | class NullStmt final : public Stmt {
|
---|
| 74 | public:
|
---|
[f3cc5b6] | 75 | NullStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
|
---|
[2bb4a01] | 76 | : Stmt(loc, std::move(labels)) {}
|
---|
| 77 |
|
---|
[f3cc5b6] | 78 | const NullStmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[2bb4a01] | 79 | private:
|
---|
[f3cc5b6] | 80 | NullStmt * clone() const override { return new NullStmt{ *this }; }
|
---|
| 81 | MUTATE_FRIEND
|
---|
[2bb4a01] | 82 | };
|
---|
| 83 |
|
---|
| 84 | /// Expression wrapped by statement
|
---|
| 85 | class ExprStmt final : public Stmt {
|
---|
| 86 | public:
|
---|
| 87 | ptr<Expr> expr;
|
---|
| 88 |
|
---|
[6f8e87d] | 89 | ExprStmt( const CodeLocation& loc, const Expr* e, std::vector<Label>&& labels = {} )
|
---|
| 90 | : Stmt(loc, std::move(labels)), expr(e) {}
|
---|
[2bb4a01] | 91 |
|
---|
[f3cc5b6] | 92 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[2bb4a01] | 93 | private:
|
---|
[23f99e1] | 94 | ExprStmt * clone() const override { return new ExprStmt{ *this }; }
|
---|
[f3cc5b6] | 95 | MUTATE_FRIEND
|
---|
[2bb4a01] | 96 | };
|
---|
| 97 |
|
---|
[1e97287] | 98 | class AsmStmt final : public Stmt {
|
---|
| 99 | public:
|
---|
| 100 | bool isVolatile;
|
---|
| 101 | ptr<Expr> instruction;
|
---|
| 102 | std::vector<ptr<Expr>> output, input;
|
---|
| 103 | std::vector<ptr<ConstantExpr>> clobber;
|
---|
| 104 | std::vector<Label> gotoLabels;
|
---|
| 105 |
|
---|
[f3cc5b6] | 106 | AsmStmt( const CodeLocation & loc, bool isVolatile, const Expr * instruction,
|
---|
| 107 | std::vector<ptr<Expr>> && output, std::vector<ptr<Expr>> && input,
|
---|
| 108 | std::vector<ptr<ConstantExpr>> && clobber, std::vector<Label> && gotoLabels,
|
---|
| 109 | std::vector<Label> && labels = {})
|
---|
[1e97287] | 110 | : Stmt(loc, std::move(labels)), isVolatile(isVolatile), instruction(instruction),
|
---|
| 111 | output(std::move(output)), input(std::move(input)), clobber(std::move(clobber)),
|
---|
| 112 | gotoLabels(std::move(gotoLabels)) {}
|
---|
| 113 |
|
---|
[f3cc5b6] | 114 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 115 | private:
|
---|
[f3cc5b6] | 116 | AsmStmt * clone() const override { return new AsmStmt{ *this }; }
|
---|
| 117 | MUTATE_FRIEND
|
---|
[1e97287] | 118 | };
|
---|
| 119 |
|
---|
| 120 | class DirectiveStmt final : public Stmt {
|
---|
| 121 | public:
|
---|
| 122 | std::string directive;
|
---|
| 123 |
|
---|
[f3cc5b6] | 124 | DirectiveStmt( const CodeLocation & loc, const std::string & directive,
|
---|
| 125 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 126 | : Stmt(loc, std::move(labels)), directive(directive) {}
|
---|
| 127 |
|
---|
[f3cc5b6] | 128 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 129 | private:
|
---|
[f3cc5b6] | 130 | DirectiveStmt * clone() const override { return new DirectiveStmt{ *this }; }
|
---|
| 131 | MUTATE_FRIEND
|
---|
[1e97287] | 132 | };
|
---|
| 133 |
|
---|
| 134 | class IfStmt final : public Stmt {
|
---|
| 135 | public:
|
---|
| 136 | ptr<Expr> cond;
|
---|
| 137 | ptr<Stmt> thenPart;
|
---|
| 138 | ptr<Stmt> elsePart;
|
---|
| 139 | std::vector<ptr<Stmt>> inits;
|
---|
| 140 |
|
---|
[f3cc5b6] | 141 | IfStmt( const CodeLocation & loc, const Expr * cond, const Stmt * thenPart,
|
---|
| 142 | Stmt * const elsePart, std::vector<ptr<Stmt>> && inits,
|
---|
| 143 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 144 | : Stmt(loc, std::move(labels)), cond(cond), thenPart(thenPart), elsePart(elsePart),
|
---|
| 145 | inits(std::move(inits)) {}
|
---|
| 146 |
|
---|
[f3cc5b6] | 147 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 148 | private:
|
---|
[f3cc5b6] | 149 | IfStmt * clone() const override { return new IfStmt{ *this }; }
|
---|
| 150 | MUTATE_FRIEND
|
---|
[1e97287] | 151 | };
|
---|
| 152 |
|
---|
| 153 | class SwitchStmt final : public Stmt {
|
---|
| 154 | public:
|
---|
| 155 | ptr<Expr> cond;
|
---|
| 156 | std::vector<ptr<Stmt>> stmts;
|
---|
| 157 |
|
---|
[f3cc5b6] | 158 | SwitchStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,
|
---|
| 159 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 160 | : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
|
---|
| 161 |
|
---|
[f3cc5b6] | 162 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 163 | private:
|
---|
[f3cc5b6] | 164 | SwitchStmt * clone() const override { return new SwitchStmt{ *this }; }
|
---|
| 165 | MUTATE_FRIEND
|
---|
[1e97287] | 166 | };
|
---|
| 167 |
|
---|
| 168 | class CaseStmt final : public Stmt {
|
---|
| 169 | public:
|
---|
| 170 | ptr<Expr> cond;
|
---|
| 171 | std::vector<ptr<Stmt>> stmts;
|
---|
| 172 |
|
---|
[f3cc5b6] | 173 | CaseStmt( const CodeLocation & loc, const Expr * cond, std::vector<ptr<Stmt>> && stmts,
|
---|
| 174 | std::vector<Label> && labels = {} )
|
---|
| 175 | : Stmt(loc, std::move(labels)), cond(cond), stmts(std::move(stmts)) {}
|
---|
[1e97287] | 176 |
|
---|
[675d816] | 177 | bool isDefault() const { return !cond; }
|
---|
[1e97287] | 178 |
|
---|
[f3cc5b6] | 179 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 180 | private:
|
---|
[f3cc5b6] | 181 | CaseStmt * clone() const override { return new CaseStmt{ *this }; }
|
---|
| 182 | MUTATE_FRIEND
|
---|
[1e97287] | 183 | };
|
---|
| 184 |
|
---|
| 185 | class WhileStmt final : public Stmt {
|
---|
| 186 | public:
|
---|
| 187 | ptr<Expr> cond;
|
---|
| 188 | ptr<Stmt> body;
|
---|
| 189 | std::vector<ptr<Stmt>> inits;
|
---|
| 190 | bool isDoWhile;
|
---|
| 191 |
|
---|
[f3cc5b6] | 192 | WhileStmt( const CodeLocation & loc, const Expr * cond, const Stmt * body,
|
---|
| 193 | std::vector<ptr<Stmt>> && inits, bool isDoWhile = false, std::vector<Label> && labels = {} )
|
---|
[1e97287] | 194 | : Stmt(loc, std::move(labels)), cond(cond), body(body), inits(std::move(inits)),
|
---|
| 195 | isDoWhile(isDoWhile) {}
|
---|
| 196 |
|
---|
[f3cc5b6] | 197 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 198 | private:
|
---|
[f3cc5b6] | 199 | WhileStmt * clone() const override { return new WhileStmt{ *this }; }
|
---|
| 200 | MUTATE_FRIEND
|
---|
[1e97287] | 201 | };
|
---|
| 202 |
|
---|
| 203 | class ForStmt final : public Stmt {
|
---|
| 204 | public:
|
---|
| 205 | std::vector<ptr<Stmt>> inits;
|
---|
| 206 | ptr<Expr> cond;
|
---|
[8a5530c] | 207 | ptr<Expr> inc;
|
---|
[1e97287] | 208 | ptr<Stmt> body;
|
---|
| 209 |
|
---|
[f3cc5b6] | 210 | ForStmt( const CodeLocation & loc, std::vector<ptr<Stmt>> && inits, const Expr * cond,
|
---|
| 211 | const Expr * inc, const Stmt * body, std::vector<Label> && labels = {} )
|
---|
[8a5530c] | 212 | : Stmt(loc, std::move(labels)), inits(std::move(inits)), cond(cond), inc(inc),
|
---|
[1e97287] | 213 | body(body) {}
|
---|
| 214 |
|
---|
[f3cc5b6] | 215 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 216 | private:
|
---|
[f3cc5b6] | 217 | ForStmt * clone() const override { return new ForStmt{ *this }; }
|
---|
| 218 | MUTATE_FRIEND
|
---|
[1e97287] | 219 | };
|
---|
| 220 |
|
---|
| 221 | class BranchStmt final : public Stmt {
|
---|
| 222 | public:
|
---|
| 223 | enum Kind { Goto, Break, Continue, FallThrough, FallThroughDefault };
|
---|
| 224 | static constexpr size_t kindEnd = 1 + (size_t)FallThroughDefault;
|
---|
| 225 |
|
---|
| 226 | const Label originalTarget;
|
---|
| 227 | Label target;
|
---|
| 228 | ptr<Expr> computedTarget;
|
---|
| 229 | Kind kind;
|
---|
| 230 |
|
---|
[f3cc5b6] | 231 | BranchStmt( const CodeLocation & loc, Kind kind, Label target,
|
---|
| 232 | std::vector<Label> && labels = {} );
|
---|
| 233 | BranchStmt( const CodeLocation & loc, const Expr * computedTarget,
|
---|
| 234 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 235 | : Stmt(loc, std::move(labels)), originalTarget(loc), target(loc),
|
---|
| 236 | computedTarget(computedTarget), kind(Goto) {}
|
---|
| 237 |
|
---|
| 238 | const char * kindName() { return kindNames[kind]; }
|
---|
| 239 |
|
---|
[f3cc5b6] | 240 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 241 | private:
|
---|
[f3cc5b6] | 242 | BranchStmt * clone() const override { return new BranchStmt{ *this }; }
|
---|
| 243 | MUTATE_FRIEND
|
---|
[8a5530c] | 244 |
|
---|
[1e97287] | 245 | static const char * kindNames[kindEnd];
|
---|
| 246 | };
|
---|
| 247 |
|
---|
| 248 | class ReturnStmt final : public Stmt {
|
---|
| 249 | public:
|
---|
| 250 | ptr<Expr> expr;
|
---|
| 251 |
|
---|
[f3cc5b6] | 252 | ReturnStmt( const CodeLocation & loc, const Expr * expr, std::vector<Label> && labels = {} )
|
---|
[1e97287] | 253 | : Stmt(loc, std::move(labels)), expr(expr) {}
|
---|
| 254 |
|
---|
[f3cc5b6] | 255 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 256 | private:
|
---|
[f3cc5b6] | 257 | ReturnStmt * clone() const override { return new ReturnStmt{ *this }; }
|
---|
| 258 | MUTATE_FRIEND
|
---|
[1e97287] | 259 | };
|
---|
| 260 |
|
---|
| 261 | class ThrowStmt final : public Stmt {
|
---|
| 262 | public:
|
---|
| 263 | enum Kind { Terminate, Resume };
|
---|
| 264 |
|
---|
| 265 | ptr<Expr> expr;
|
---|
| 266 | ptr<Expr> target;
|
---|
| 267 | Kind kind;
|
---|
| 268 |
|
---|
[f3cc5b6] | 269 | ThrowStmt( const CodeLocation & loc, Kind kind, const Expr * expr, const Expr * target,
|
---|
| 270 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 271 | : Stmt(loc, std::move(labels)), expr(expr), target(target), kind(kind) {}
|
---|
| 272 |
|
---|
[f3cc5b6] | 273 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 274 | private:
|
---|
[f3cc5b6] | 275 | ThrowStmt * clone() const override { return new ThrowStmt{ *this }; }
|
---|
| 276 | MUTATE_FRIEND
|
---|
[1e97287] | 277 | };
|
---|
| 278 |
|
---|
| 279 | class TryStmt final : public Stmt {
|
---|
| 280 | public:
|
---|
| 281 | ptr<CompoundStmt> body;
|
---|
| 282 | std::vector<ptr<CatchStmt>> handlers;
|
---|
| 283 | ptr<FinallyStmt> finally;
|
---|
| 284 |
|
---|
[f3cc5b6] | 285 | TryStmt( const CodeLocation & loc, const CompoundStmt * body,
|
---|
| 286 | std::vector<ptr<CatchStmt>> && handlers, const FinallyStmt * finally,
|
---|
| 287 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 288 | : Stmt(loc, std::move(labels)), body(body), handlers(std::move(handlers)), finally(finally) {}
|
---|
| 289 |
|
---|
[f3cc5b6] | 290 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 291 | private:
|
---|
[f3cc5b6] | 292 | TryStmt * clone() const override { return new TryStmt{ *this }; }
|
---|
| 293 | MUTATE_FRIEND
|
---|
[1e97287] | 294 | };
|
---|
| 295 |
|
---|
| 296 | class CatchStmt final : public Stmt {
|
---|
| 297 | public:
|
---|
| 298 | enum Kind { Terminate, Resume };
|
---|
| 299 |
|
---|
| 300 | ptr<Decl> decl;
|
---|
| 301 | ptr<Expr> cond;
|
---|
| 302 | ptr<Stmt> body;
|
---|
| 303 | Kind kind;
|
---|
| 304 |
|
---|
[f3cc5b6] | 305 | CatchStmt( const CodeLocation & loc, Kind kind, const Decl * decl, const Expr * cond,
|
---|
| 306 | const Stmt * body, std::vector<Label> && labels = {} )
|
---|
[1e97287] | 307 | : Stmt(loc, std::move(labels)), decl(decl), cond(cond), body(body), kind(kind) {}
|
---|
| 308 |
|
---|
[f3cc5b6] | 309 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 310 | private:
|
---|
[f3cc5b6] | 311 | CatchStmt * clone() const override { return new CatchStmt{ *this }; }
|
---|
| 312 | MUTATE_FRIEND
|
---|
[1e97287] | 313 | };
|
---|
| 314 |
|
---|
| 315 | class FinallyStmt final : public Stmt {
|
---|
| 316 | public:
|
---|
| 317 | ptr<CompoundStmt> body;
|
---|
| 318 |
|
---|
[f3cc5b6] | 319 | FinallyStmt( const CodeLocation & loc, const CompoundStmt * body,
|
---|
| 320 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 321 | : Stmt(loc, std::move(labels)), body(body) {}
|
---|
| 322 |
|
---|
[f3cc5b6] | 323 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 324 | private:
|
---|
[f3cc5b6] | 325 | FinallyStmt * clone() const override { return new FinallyStmt{ *this }; }
|
---|
| 326 | MUTATE_FRIEND
|
---|
[1e97287] | 327 | };
|
---|
[2bb4a01] | 328 |
|
---|
[1e97287] | 329 | class WaitForStmt final : public Stmt {
|
---|
| 330 | public:
|
---|
| 331 | struct Target {
|
---|
[e0016a5] | 332 | ptr<Expr> func;
|
---|
| 333 | std::vector<ptr<Expr>> args;
|
---|
[1e97287] | 334 | };
|
---|
| 335 |
|
---|
| 336 | struct Clause {
|
---|
| 337 | Target target;
|
---|
| 338 | ptr<Stmt> stmt;
|
---|
| 339 | ptr<Expr> cond;
|
---|
| 340 | };
|
---|
| 341 |
|
---|
| 342 | struct Timeout {
|
---|
| 343 | ptr<Expr> time;
|
---|
| 344 | ptr<Stmt> stmt;
|
---|
| 345 | ptr<Expr> cond;
|
---|
| 346 | };
|
---|
| 347 |
|
---|
| 348 | struct OrElse {
|
---|
| 349 | ptr<Stmt> stmt;
|
---|
| 350 | ptr<Expr> cond;
|
---|
| 351 | };
|
---|
| 352 |
|
---|
| 353 | std::vector<Clause> clauses;
|
---|
| 354 | Timeout timeout;
|
---|
| 355 | OrElse orElse;
|
---|
| 356 |
|
---|
[f3cc5b6] | 357 | WaitForStmt( const CodeLocation & loc, std::vector<Label> && labels = {} )
|
---|
[1e97287] | 358 | : Stmt(loc, std::move(labels)) {}
|
---|
| 359 |
|
---|
[f3cc5b6] | 360 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 361 | private:
|
---|
[f3cc5b6] | 362 | WaitForStmt * clone() const override { return new WaitForStmt{ *this }; }
|
---|
| 363 | MUTATE_FRIEND
|
---|
[1e97287] | 364 | };
|
---|
| 365 |
|
---|
| 366 | class WithStmt final : public Stmt {
|
---|
| 367 | public:
|
---|
| 368 | std::vector<ptr<Expr>> exprs;
|
---|
| 369 | ptr<Stmt> stmt;
|
---|
| 370 |
|
---|
[f3cc5b6] | 371 | WithStmt( const CodeLocation & loc, std::vector<ptr<Expr>> && exprs, const Stmt * stmt,
|
---|
| 372 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 373 | : Stmt(loc, std::move(labels)), exprs(std::move(exprs)), stmt(stmt) {}
|
---|
| 374 |
|
---|
[f3cc5b6] | 375 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 376 | private:
|
---|
[f3cc5b6] | 377 | WithStmt * clone() const override { return new WithStmt{ *this }; }
|
---|
| 378 | MUTATE_FRIEND
|
---|
[1e97287] | 379 | };
|
---|
| 380 |
|
---|
| 381 | class DeclStmt final : public Stmt {
|
---|
| 382 | public:
|
---|
| 383 | ptr<Decl> decl;
|
---|
| 384 |
|
---|
[f3cc5b6] | 385 | DeclStmt( const CodeLocation & loc, const Decl * decl, std::vector<Label> && labels = {} )
|
---|
[1e97287] | 386 | : Stmt(loc, std::move(labels)), decl(decl) {}
|
---|
| 387 |
|
---|
[f3cc5b6] | 388 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 389 | private:
|
---|
[f3cc5b6] | 390 | DeclStmt * clone() const override { return new DeclStmt{ *this }; }
|
---|
| 391 | MUTATE_FRIEND
|
---|
[1e97287] | 392 | };
|
---|
| 393 |
|
---|
| 394 | class ImplicitCtorDtorStmt final : public Stmt {
|
---|
| 395 | public:
|
---|
| 396 | readonly<Stmt> callStmt;
|
---|
| 397 |
|
---|
[f3cc5b6] | 398 | ImplicitCtorDtorStmt( const CodeLocation & loc, const Stmt * callStmt,
|
---|
| 399 | std::vector<Label> && labels = {} )
|
---|
[1e97287] | 400 | : Stmt(loc, std::move(labels)), callStmt(callStmt) {}
|
---|
| 401 |
|
---|
[f3cc5b6] | 402 | const Stmt * accept( Visitor & v ) const override { return v.visit( this ); }
|
---|
[1e97287] | 403 | private:
|
---|
[f3cc5b6] | 404 | ImplicitCtorDtorStmt * clone() const override { return new ImplicitCtorDtorStmt{ *this }; }
|
---|
| 405 | MUTATE_FRIEND
|
---|
[1e97287] | 406 | };
|
---|
[2bb4a01] | 407 |
|
---|
| 408 | }
|
---|
| 409 |
|
---|
[f3cc5b6] | 410 | #undef MUTATE_FRIEND
|
---|
| 411 |
|
---|
[2bb4a01] | 412 | // Local Variables: //
|
---|
| 413 | // tab-width: 4 //
|
---|
| 414 | // mode: c++ //
|
---|
| 415 | // compile-command: "make install" //
|
---|
[1e97287] | 416 | // End: //
|
---|