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