source: src/SynTree/Statement.h @ f1da02c

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since f1da02c was e67991f, checked in by Thierry Delisle <tdelisle@…>, 5 years ago

WithStmt? is now a Declaration

  • Property mode set to 100644
File size: 19.6 KB
RevLine 
[0dd3a2f]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//
[3be261a]7// Statement.h --
[0dd3a2f]8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
[936e9f4]11// Last Modified By : Peter A. Buhr
[35a2d47]12// Last Modified On : Tue Mar 12 09:01:53 2019
13// Update Count     : 83
[0dd3a2f]14//
15
[6b0b624]16#pragma once
[51b7345]17
[ea6332d]18#include <iosfwd>                  // for ostream
19#include <list>                    // for list
20#include <memory>                  // for allocator
[35a2d47]21#include <vector>                                  // for vector
[ea6332d]22
23#include "BaseSyntaxNode.h"        // for BaseSyntaxNode
24#include "Common/SemanticError.h"  // for SemanticError
25#include "Label.h"                 // for Label
26#include "Mutator.h"               // for Mutator
27#include "Visitor.h"               // for Visitor
28
29class CatchStmt;
30class ConstantExpr;
31class Declaration;
32class Expression;
33class FinallyStmt;
[51b7345]34
[294647b]35class Statement : public BaseSyntaxNode {
[0dd3a2f]36  public:
[65cdc1e]37        std::list<Label> labels;
38
[ba3706f]39        Statement( const std::list<Label> & labels = {} );
[0dd3a2f]40        virtual ~Statement();
[51b7345]41
[0dd3a2f]42        std::list<Label> & get_labels() { return labels; }
[de62360d]43        const std::list<Label> & get_labels() const { return labels; }
[51b7345]44
[35a2d47]45        virtual Statement * clone() const override = 0;
46        virtual void accept( Visitor & v ) override = 0;
[7870799]47        virtual void accept( Visitor & v ) const override = 0;
[35a2d47]48        virtual Statement * acceptMutator( Mutator & m ) override = 0;
49        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]50};
51
[0dd3a2f]52class CompoundStmt : public Statement {
53  public:
[65cdc1e]54        std::list<Statement*> kids;
55
[ba3706f]56        CompoundStmt();
[a2dbad10]57        CompoundStmt( std::list<Statement *> stmts );
[35a2d47]58        CompoundStmt( const CompoundStmt & other );
[0dd3a2f]59        virtual ~CompoundStmt();
[51b7345]60
[0dd3a2f]61        std::list<Statement*>& get_kids() { return kids; }
[c8dfcd3]62        void push_back( Statement * stmt ) { kids.push_back( stmt ); }
63        void push_front( Statement * stmt ) { kids.push_front( stmt ); }
[51b7345]64
[35a2d47]65        virtual CompoundStmt * clone() const override { return new CompoundStmt( *this ); }
66        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]67        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]68        virtual CompoundStmt * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
69        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]70};
71
[70d826cd]72class NullStmt : public Statement {
[daf1af8]73  public:
[ba3706f]74        NullStmt( const std::list<Label> & labels = {} );
[daf1af8]75
[35a2d47]76        virtual NullStmt * clone() const override { return new NullStmt( *this ); }
77        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]78        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]79        virtual NullStmt * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
80        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[daf1af8]81};
82
[0dd3a2f]83class ExprStmt : public Statement {
84  public:
[35a2d47]85        Expression * expr;
[65cdc1e]86
[35a2d47]87        ExprStmt( Expression * expr );
88        ExprStmt( const ExprStmt & other );
[0dd3a2f]89        virtual ~ExprStmt();
[51b7345]90
[35a2d47]91        Expression * get_expr() { return expr; }
92        void set_expr( Expression * newValue ) { expr = newValue; }
[51b7345]93
[35a2d47]94        virtual ExprStmt * clone() const override { return new ExprStmt( *this ); }
95        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]96        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]97        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
98        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[0dd3a2f]99};
[51b7345]100
[7f5566b]101class AsmStmt : public Statement {
102  public:
[65cdc1e]103        bool voltile;
[35a2d47]104        Expression * instruction;
[65cdc1e]105        std::list<Expression *> output, input;
106        std::list<ConstantExpr *> clobber;
107        std::list<Label> gotolabels;
108
[35a2d47]109        AsmStmt( bool voltile, Expression * instruction, std::list<Expression *> output, std::list<Expression *> input, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels );
110        AsmStmt( const AsmStmt & other );
[7f5566b]111        virtual ~AsmStmt();
112
113        bool get_voltile() { return voltile; }
114        void set_voltile( bool newValue ) { voltile = newValue; }
[e612146c]115        Expression * get_instruction() { return instruction; }
116        void set_instruction( Expression * newValue ) { instruction = newValue; }
117        std::list<Expression *> & get_output() { return output; }
118        void set_output( const std::list<Expression *> & newValue ) { output = newValue; }
119        std::list<Expression *> & get_input() { return input; }
[35a2d47]120        void set_input( const std::list<Expression *> & newValue ) { input = newValue; }
[e612146c]121        std::list<ConstantExpr *> & get_clobber() { return clobber; }
[35a2d47]122        void set_clobber( const std::list<ConstantExpr *> & newValue ) { clobber = newValue; }
[e612146c]123        std::list<Label> & get_gotolabels() { return gotolabels; }
[35a2d47]124        void set_gotolabels( const std::list<Label> & newValue ) { gotolabels = newValue; }
[7f5566b]125
[7870799]126        virtual AsmStmt * clone() const override { return new AsmStmt( *this ); }
127        virtual void accept( Visitor & v ) override { v.visit( this ); }
128        virtual void accept( Visitor & v ) const override { v.visit( this ); }
129        virtual Statement * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
130        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[7f5566b]131};
132
[cc32d83]133class DirectiveStmt : public Statement {
134        public:
135        std::string directive;
136
137        DirectiveStmt( const std::string & );
138        virtual ~DirectiveStmt(){}
139
[7870799]140        virtual DirectiveStmt * clone() const override { return new DirectiveStmt( *this ); }
141        virtual void accept( Visitor & v ) override { v.visit( this ); }
142        virtual void accept( Visitor & v ) const override { v.visit( this ); }
143        virtual Statement * acceptMutator( Mutator & m ) override { return m.mutate( this ); }
144        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[cc32d83]145};
146
[0dd3a2f]147class IfStmt : public Statement {
148  public:
[35a2d47]149        Expression * condition;
150        Statement * thenPart;
151        Statement * elsePart;
[6d49ea3]152        std::list<Statement *> initialization;
[65cdc1e]153
[35a2d47]154        IfStmt( Expression * condition, Statement * thenPart, Statement * elsePart,
[6d49ea3]155                        std::list<Statement *> initialization = std::list<Statement *>() );
[35a2d47]156        IfStmt( const IfStmt & other );
[0dd3a2f]157        virtual ~IfStmt();
158
[35a2d47]159        std::list<Statement *> & get_initialization() { return initialization; }
160        Expression * get_condition() { return condition; }
161        void set_condition( Expression * newValue ) { condition = newValue; }
162        Statement * get_thenPart() { return thenPart; }
163        void set_thenPart( Statement * newValue ) { thenPart = newValue; }
164        Statement * get_elsePart() { return elsePart; }
165        void set_elsePart( Statement * newValue ) { elsePart = newValue; }
166
167        virtual IfStmt * clone() const override { return new IfStmt( *this ); }
168        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]169        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]170        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
171        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]172};
173
[0dd3a2f]174class SwitchStmt : public Statement {
175  public:
[65cdc1e]176        Expression * condition;
[871cdb4]177        std::list<Statement *> statements;
[65cdc1e]178
[35a2d47]179        SwitchStmt( Expression * condition, const std::list<Statement *> & statements );
180        SwitchStmt( const SwitchStmt & other );
[0dd3a2f]181        virtual ~SwitchStmt();
[51b7345]182
[35a2d47]183        Expression * get_condition() { return condition; }
184        void set_condition( Expression * newValue ) { condition = newValue; }
[51b7345]185
[8688ce1]186        std::list<Statement *> & get_statements() { return statements; }
[51b7345]187
[35a2d47]188        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]189        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]190        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
[51b7345]191
[35a2d47]192        virtual SwitchStmt * clone() const override { return new SwitchStmt( *this ); }
193        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[871cdb4]194
[51b7345]195};
196
[0dd3a2f]197class CaseStmt : public Statement {
198  public:
[65cdc1e]199        Expression * condition;
200        std::list<Statement *> stmts;
201
[35a2d47]202        CaseStmt( Expression * conditions, const std::list<Statement *> & stmts, bool isdef = false ) throw (SemanticErrorException);
203        CaseStmt( const CaseStmt & other );
[0dd3a2f]204        virtual ~CaseStmt();
205
[ba3706f]206        static CaseStmt * makeDefault( const std::list<Label> & labels = {}, std::list<Statement *> stmts = std::list<Statement *>() );
[b2152e7a]207
[de62360d]208        bool isDefault() const { return _isDefault; }
[0dd3a2f]209        void set_default(bool b) { _isDefault = b; }
210
[35a2d47]211        Expression * & get_condition() { return condition; }
212        void set_condition( Expression * newValue ) { condition = newValue; }
[0dd3a2f]213
[35a2d47]214        std::list<Statement *> & get_statements() { return stmts; }
215        void set_statements( std::list<Statement *> & newValue ) { stmts = newValue; }
[3be261a]216
[35a2d47]217        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]218        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]219        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
[0dd3a2f]220
[35a2d47]221        virtual CaseStmt * clone() const override { return new CaseStmt( *this ); }
222        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[0dd3a2f]223  private:
224        bool _isDefault;
[51b7345]225};
226
[0dd3a2f]227class WhileStmt : public Statement {
228  public:
[35a2d47]229        Expression * condition;
230        Statement * body;
[ee3c93d]231        std::list<Statement *> initialization;
[65cdc1e]232        bool isDoWhile;
233
[35a2d47]234        WhileStmt( Expression * condition, Statement * body, std::list<Statement *> & initialization, bool isDoWhile = false );
235        WhileStmt( const WhileStmt & other );
[0dd3a2f]236        virtual ~WhileStmt();
237
[35a2d47]238        Expression * get_condition() { return condition; }
239        void set_condition( Expression * newValue ) { condition = newValue; }
240        Statement * get_body() { return body; }
241        void set_body( Statement * newValue ) { body = newValue; }
[0dd3a2f]242        bool get_isDoWhile() { return isDoWhile; }
243        void set_isDoWhile( bool newValue ) { isDoWhile = newValue; }
[3be261a]244
[35a2d47]245        virtual WhileStmt * clone() const override { return new WhileStmt( *this ); }
246        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]247        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]248        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
249        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]250};
251
[0dd3a2f]252class ForStmt : public Statement {
253  public:
[65cdc1e]254        std::list<Statement *> initialization;
[35a2d47]255        Expression * condition;
256        Expression * increment;
257        Statement * body;
[65cdc1e]258
[35a2d47]259        ForStmt( std::list<Statement *> initialization, Expression * condition = 0, Expression * increment = 0, Statement * body = 0 );
260        ForStmt( const ForStmt & other );
[0dd3a2f]261        virtual ~ForStmt();
262
[35a2d47]263        std::list<Statement *> & get_initialization() { return initialization; }
264        Expression * get_condition() { return condition; }
265        void set_condition( Expression * newValue ) { condition = newValue; }
266        Expression * get_increment() { return increment; }
267        void set_increment( Expression * newValue ) { increment = newValue; }
268        Statement * get_body() { return body; }
269        void set_body( Statement * newValue ) { body = newValue; }
270
271        virtual ForStmt * clone() const override { return new ForStmt( *this ); }
272        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]273        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]274        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
275        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]276};
277
[0dd3a2f]278class BranchStmt : public Statement {
279  public:
[6a276a0]280        enum Type { Goto = 0, Break, Continue, FallThrough, FallThroughDefault };
[0dd3a2f]281
[65cdc1e]282        // originalTarget kept for error messages.
283        const Label originalTarget;
284        Label target;
[35a2d47]285        Expression * computedTarget;
[65cdc1e]286        Type type;
287
[a16764a6]288        BranchStmt( Label target, Type ) throw (SemanticErrorException);
[35a2d47]289        BranchStmt( Expression * computedTarget, Type ) throw (SemanticErrorException);
[0dd3a2f]290
[be5aa1b]291        Label get_originalTarget() { return originalTarget; }
[0dd3a2f]292        Label get_target() { return target; }
293        void set_target( Label newValue ) { target = newValue; }
[3be261a]294
[35a2d47]295        Expression * get_computedTarget() { return computedTarget; }
[0dd3a2f]296        void set_target( Expression * newValue ) { computedTarget = newValue; }
297
298        Type get_type() { return type; }
[35a2d47]299        const char * get_typename() { return brType[ type ]; }
[0dd3a2f]300
[35a2d47]301        virtual BranchStmt * clone() const override { return new BranchStmt( *this ); }
302        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]303        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]304        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
305        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[0dd3a2f]306  private:
[35a2d47]307        static const char * brType[];
[51b7345]308};
309
[0dd3a2f]310class ReturnStmt : public Statement {
311  public:
[35a2d47]312        Expression * expr;
[65cdc1e]313
[35a2d47]314        ReturnStmt( Expression * expr );
315        ReturnStmt( const ReturnStmt & other );
[0dd3a2f]316        virtual ~ReturnStmt();
317
[35a2d47]318        Expression * get_expr() { return expr; }
319        void set_expr( Expression * newValue ) { expr = newValue; }
[3be261a]320
[35a2d47]321        virtual ReturnStmt * clone() const override { return new ReturnStmt( *this ); }
322        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]323        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]324        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
325        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]326};
327
[daf1af8]328class ThrowStmt : public Statement {
[0dd3a2f]329  public:
[daf1af8]330        enum Kind { Terminate, Resume };
[51b7345]331
[65cdc1e]332        const Kind kind;
333        Expression * expr;
334        Expression * target;
335
[ba3706f]336        ThrowStmt( Kind kind, Expression * expr, Expression * target = nullptr );
[35a2d47]337        ThrowStmt( const ThrowStmt & other );
[daf1af8]338        virtual ~ThrowStmt();
339
340        Kind get_kind() { return kind; }
341        Expression * get_expr() { return expr; }
342        void set_expr( Expression * newExpr ) { expr = newExpr; }
343        Expression * get_target() { return target; }
344        void set_target( Expression * newTarget ) { target = newTarget; }
345
[35a2d47]346        virtual ThrowStmt * clone() const override { return new ThrowStmt( *this ); }
347        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]348        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]349        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
350        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]351};
352
[3be261a]353class TryStmt : public Statement {
[0dd3a2f]354  public:
[871cdb4]355        CompoundStmt * block;
[65cdc1e]356        std::list<CatchStmt *> handlers;
[871cdb4]357        FinallyStmt * finallyBlock;
[65cdc1e]358
[35a2d47]359        TryStmt( CompoundStmt * tryBlock, std::list<CatchStmt *> & handlers, FinallyStmt * finallyBlock = 0 );
360        TryStmt( const TryStmt & other );
[0dd3a2f]361        virtual ~TryStmt();
362
[35a2d47]363        CompoundStmt * get_block() const { return block; }
364        void set_block( CompoundStmt * newValue ) { block = newValue; }
[046e04a]365        std::list<CatchStmt *>& get_catchers() { return handlers; }
[0dd3a2f]366
[35a2d47]367        FinallyStmt * get_finally() const { return finallyBlock; }
368        void set_finally( FinallyStmt * newValue ) { finallyBlock = newValue; }
[0dd3a2f]369
[35a2d47]370        virtual TryStmt * clone() const override { return new TryStmt( *this ); }
371        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]372        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]373        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
374        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[3be261a]375};
[51b7345]376
[0dd3a2f]377class CatchStmt : public Statement {
378  public:
[ca78437]379        enum Kind { Terminate, Resume };
380
[65cdc1e]381        const Kind kind;
[35a2d47]382        Declaration * decl;
383        Expression * cond;
384        Statement * body;
[65cdc1e]385
[35a2d47]386        CatchStmt( Kind kind, Declaration * decl,
387                   Expression * cond, Statement * body );
388        CatchStmt( const CatchStmt & other );
[0dd3a2f]389        virtual ~CatchStmt();
390
[ca78437]391        Kind get_kind() { return kind; }
[35a2d47]392        Declaration * get_decl() { return decl; }
393        void set_decl( Declaration * newValue ) { decl = newValue; }
394        Expression * get_cond() { return cond; }
395        void set_cond( Expression * newCond ) { cond = newCond; }
396        Statement * get_body() { return body; }
397        void set_body( Statement * newValue ) { body = newValue; }
398
399        virtual CatchStmt * clone() const override { return new CatchStmt( *this ); }
400        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]401        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]402        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
403        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]404};
405
[3be261a]406class FinallyStmt : public Statement {
[0dd3a2f]407  public:
[35a2d47]408        CompoundStmt * block;
[65cdc1e]409
[35a2d47]410        FinallyStmt( CompoundStmt * block );
411        FinallyStmt( const FinallyStmt & other );
[0dd3a2f]412        virtual ~FinallyStmt();
413
[35a2d47]414        CompoundStmt * get_block() const { return block; }
415        void set_block( CompoundStmt * newValue ) { block = newValue; }
[3be261a]416
[35a2d47]417        virtual FinallyStmt * clone() const override { return new FinallyStmt( *this ); }
418        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]419        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]420        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
421        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[3be261a]422};
[51b7345]423
[135b431]424class WaitForStmt : public Statement {
425  public:
426
427        struct Target {
428                Expression * function;
429                std::list<Expression * > arguments;
430        };
431
432        struct Clause {
433                Target       target;
434                Statement  * statement;
435                Expression * condition;
436        };
437
[ba3706f]438        WaitForStmt();
[135b431]439        WaitForStmt( const WaitForStmt & );
440        virtual ~WaitForStmt();
441
442        std::vector<Clause> clauses;
443
444        struct {
445                Expression * time;
446                Statement  * statement;
447                Expression * condition;
448        } timeout;
449
450        struct {
451                Statement  * statement;
452                Expression * condition;
453        } orelse;
454
[35a2d47]455        virtual WaitForStmt * clone() const override { return new WaitForStmt( *this ); }
456        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]457        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]458        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
459        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[135b431]460
461};
462
[e67991f]463// class WithStmt : public Statement {
464// public:
465//      std::list< Expression * > exprs;
466//      Statement * stmt;
467
468//      WithStmt( const std::list< Expression * > & exprs, Statement * stmt );
469//      WithStmt( const WithStmt & other );
470//      virtual ~WithStmt();
471
472//      virtual WithStmt * clone() const override { return new WithStmt( *this ); }
473//      virtual void accept( Visitor & v ) override { v.visit( this ); }
474//      virtual void accept( Visitor & v ) const 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// };
[61255ad]478
[51b7345]479
480// represents a declaration that occurs as part of a compound statement
[0dd3a2f]481class DeclStmt : public Statement {
482  public:
[35a2d47]483        Declaration * decl;
[65cdc1e]484
[35a2d47]485        DeclStmt( Declaration * decl );
486        DeclStmt( const DeclStmt & other );
[0dd3a2f]487        virtual ~DeclStmt();
488
[35a2d47]489        Declaration * get_decl() const { return decl; }
490        void set_decl( Declaration * newValue ) { decl = newValue; }
[0dd3a2f]491
[35a2d47]492        virtual DeclStmt * clone() const override { return new DeclStmt( *this ); }
493        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]494        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]495        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
496        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[51b7345]497};
498
[f1b1e4c]499
[35a2d47]500/// represents an implicit application of a constructor or destructor. Qualifiers are replaced immediately before and
501/// after the call so that qualified objects can be constructed with the same functions as unqualified objects.
[f1b1e4c]502class ImplicitCtorDtorStmt : public Statement {
503  public:
[65cdc1e]504        // Non-owned pointer to the constructor/destructor statement
505        Statement * callStmt;
506
[f1b1e4c]507        ImplicitCtorDtorStmt( Statement * callStmt );
508        ImplicitCtorDtorStmt( const ImplicitCtorDtorStmt & other );
509        virtual ~ImplicitCtorDtorStmt();
510
[35a2d47]511        Statement * get_callStmt() const { return callStmt; }
[f1b1e4c]512        void set_callStmt( Statement * newValue ) { callStmt = newValue; }
513
[35a2d47]514        virtual ImplicitCtorDtorStmt * clone() const override { return new ImplicitCtorDtorStmt( *this ); }
515        virtual void accept( Visitor & v ) override { v.visit( this ); }
[7870799]516        virtual void accept( Visitor & v ) const override { v.visit( this ); }
[35a2d47]517        virtual Statement * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
518        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
[f1b1e4c]519};
520
[0dd3a2f]521// Local Variables: //
522// tab-width: 4 //
523// mode: c++ //
524// compile-command: "make install" //
525// End: //
Note: See TracBrowser for help on using the repository browser.