source: src/SynTree/Expression.h @ db4ecc5

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since db4ecc5 was db4ecc5, checked in by Rob Schluntz <rschlunt@…>, 8 years ago

add ImplicitCopyCtorExpr? node, implicit copy constructors are inserted into the right places (but there is room for elision)

  • Property mode set to 100644
File size: 22.9 KB
Line 
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// Expression.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Rob Schluntz
12// Last Modified On : Thu Apr 14 12:04:58 2016
13// Update Count     : 19
14//
15
16#ifndef EXPRESSION_H
17#define EXPRESSION_H
18
19#include <map>
20#include "SynTree.h"
21#include "Visitor.h"
22#include "Mutator.h"
23#include "Constant.h"
24#include "Common/UniqueName.h"
25
26/// Expression is the root type for all expressions
27class Expression {
28  public:
29        Expression(Expression *_aname = 0 );
30        Expression( const Expression &other );
31        virtual ~Expression();
32
33        std::list<Type *>& get_results() { return results; }
34        void add_result( Type *t );
35
36        TypeSubstitution *get_env() const { return env; }
37        void set_env( TypeSubstitution *newValue ) { env = newValue; }
38        Expression *get_argName() const { return argName; }
39        void set_argName( Expression *name ) { argName = name; }
40
41        virtual Expression *clone() const = 0;
42        virtual void accept( Visitor &v ) = 0;
43        virtual Expression *acceptMutator( Mutator &m ) = 0;
44        virtual void print( std::ostream &os, int indent = 0 ) const;
45  protected:
46        std::list<Type *> results;
47        TypeSubstitution *env;
48        Expression* argName; // if expression is used as an argument, it can be "designated" by this name
49};
50
51/// ParamEntry contains the i.d. of a declaration and a type that is derived from that declaration,
52/// but subject to decay-to-pointer and type parameter renaming
53struct ParamEntry {
54        ParamEntry(): decl( 0 ), actualType( 0 ), formalType( 0 ), expr( 0 ) {}
55        ParamEntry( UniqueId decl, Type *actualType, Type *formalType, Expression* expr ): decl( decl ), actualType( actualType ), formalType( formalType ), expr( expr ) {}
56        ParamEntry( const ParamEntry &other );
57        ~ParamEntry();
58        ParamEntry &operator=( const ParamEntry &other );
59
60        UniqueId decl;
61        Type *actualType;
62        Type *formalType;
63        Expression* expr;
64};
65
66typedef std::map< UniqueId, ParamEntry > InferredParams;
67
68/// ApplicationExpr represents the application of a function to a set of parameters.  This is the
69/// result of running an UntypedExpr through the expression analyzer.
70class ApplicationExpr : public Expression {
71  public:
72        ApplicationExpr( Expression *function );
73        ApplicationExpr( const ApplicationExpr &other );
74        virtual ~ApplicationExpr();
75
76        Expression *get_function() const { return function; }
77        void set_function( Expression *newValue ) { function = newValue; }
78        std::list<Expression *>& get_args() { return args; }
79        InferredParams &get_inferParams() { return inferParams; }
80
81        virtual ApplicationExpr *clone() const { return new ApplicationExpr( *this ); }
82        virtual void accept( Visitor &v ) { v.visit( this ); }
83        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
84        virtual void print( std::ostream &os, int indent = 0 ) const;
85  private:
86        Expression *function;
87        std::list<Expression *> args;
88        InferredParams inferParams;
89};
90
91/// UntypedExpr represents the application of a function to a set of parameters, but where the
92/// particular overload for the function name has not yet been determined.  Most operators are
93/// converted into functional form automatically, to permit operator overloading.
94class UntypedExpr : public Expression {
95  public:
96        UntypedExpr( Expression *function, Expression *_aname = 0 );
97        UntypedExpr( const UntypedExpr &other );
98        UntypedExpr( Expression *function, std::list<Expression *> &args, Expression *_aname = 0 );
99        virtual ~UntypedExpr();
100
101        Expression *get_function() const { return function; }
102        void set_function( Expression *newValue ) { function = newValue; }
103
104        void set_args( std::list<Expression *> &listArgs ) { args = listArgs; }
105        std::list<Expression*>::iterator begin_args() { return args.begin(); }
106        std::list<Expression*>::iterator end_args() { return args.end(); }
107        std::list<Expression*>& get_args() { return args; }
108
109        virtual UntypedExpr *clone() const { return new UntypedExpr( *this ); }
110        virtual void accept( Visitor &v ) { v.visit( this ); }
111        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
112        virtual void print( std::ostream &os, int indent = 0 ) const;
113        virtual void printArgs(std::ostream &os, int indent = 0) const;
114  private:
115        Expression *function;
116        std::list<Expression*> args;
117};
118
119/// NameExpr contains a name whose meaning is still not determined
120class NameExpr : public Expression {
121  public:
122        NameExpr( std::string name, Expression *_aname = 0 );
123        NameExpr( const NameExpr &other );
124        virtual ~NameExpr();
125
126        const std::string &get_name() const { return name; }
127        void set_name( std::string newValue ) { name = newValue; }
128
129        virtual NameExpr *clone() const { return new NameExpr( *this ); }
130        virtual void accept( Visitor &v ) { v.visit( this ); }
131        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
132        virtual void print( std::ostream &os, int indent = 0 ) const;
133  private:
134        std::string name;
135};
136
137// The following classes are used to represent expression types that cannot be converted into
138// function-call format.
139
140/// AddressExpr represents a address-of expression, e.g. &e
141class AddressExpr : public Expression {
142  public:
143        AddressExpr( Expression *arg, Expression *_aname = 0 );
144        AddressExpr( const AddressExpr &other );
145        virtual ~AddressExpr();
146
147        Expression *get_arg() const { return arg; }
148        void set_arg(Expression *newValue ) { arg = newValue; }
149
150        virtual AddressExpr *clone() const { return new AddressExpr( *this ); }
151        virtual void accept( Visitor &v ) { v.visit( this ); }
152        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
153        virtual void print( std::ostream &os, int indent = 0 ) const;
154  private:
155        Expression *arg;
156};
157
158// xxx - this doesn't appear to actually be hooked in anywhere. We should use this instead of the "&&"" UntypedExpr hack
159class LabelAddressExpr : public Expression {
160  public:
161        LabelAddressExpr( Expression *arg );
162        LabelAddressExpr( const LabelAddressExpr &other );
163        virtual ~LabelAddressExpr();
164
165        Expression *get_arg() const { return arg; }
166        void set_arg(Expression *newValue ) { arg = newValue; }
167
168        virtual LabelAddressExpr *clone() const { return new LabelAddressExpr( *this ); }
169        virtual void accept( Visitor &v ) { v.visit( this ); }
170        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
171        virtual void print( std::ostream &os, int indent = 0 ) const;
172  private:
173        Expression *arg;
174};
175
176/// CastExpr represents a type cast expression, e.g. (int)e
177class CastExpr : public Expression {
178  public:
179        CastExpr( Expression *arg, Expression *_aname = 0 );
180        CastExpr( Expression *arg, Type *toType, Expression *_aname = 0 );
181        CastExpr( const CastExpr &other );
182        virtual ~CastExpr();
183
184        Expression *get_arg() const { return arg; }
185        void set_arg(Expression *newValue ) { arg = newValue; }
186
187        virtual CastExpr *clone() const { return new CastExpr( *this ); }
188        virtual void accept( Visitor &v ) { v.visit( this ); }
189        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
190        virtual void print( std::ostream &os, int indent = 0 ) const;
191  private:
192        Expression *arg;
193};
194
195/// UntypedMemberExpr represents a member selection operation, e.g. q.p before processing by the expression analyzer
196class UntypedMemberExpr : public Expression {
197  public:
198        UntypedMemberExpr( std::string member, Expression *aggregate, Expression *_aname = 0 );
199        UntypedMemberExpr( const UntypedMemberExpr &other );
200        virtual ~UntypedMemberExpr();
201
202        std::string get_member() const { return member; }
203        void set_member( const std::string &newValue ) { member = newValue; }
204        Expression *get_aggregate() const { return aggregate; }
205        void set_aggregate( Expression *newValue ) { aggregate = newValue; }
206
207        virtual UntypedMemberExpr *clone() const { return new UntypedMemberExpr( *this ); }
208        virtual void accept( Visitor &v ) { v.visit( this ); }
209        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
210        virtual void print( std::ostream &os, int indent = 0 ) const;
211  private:
212        std::string member;
213        Expression *aggregate;
214};
215
216/// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer
217class MemberExpr : public Expression {
218  public:
219        MemberExpr( DeclarationWithType *member, Expression *aggregate, Expression *_aname = 0 );
220        MemberExpr( const MemberExpr &other );
221        virtual ~MemberExpr();
222
223        DeclarationWithType *get_member() const { return member; }
224        void set_member( DeclarationWithType *newValue ) { member = newValue; }
225        Expression *get_aggregate() const { return aggregate; }
226        void set_aggregate( Expression *newValue ) { aggregate = newValue; }
227
228        virtual MemberExpr *clone() const { return new MemberExpr( *this ); }
229        virtual void accept( Visitor &v ) { v.visit( this ); }
230        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
231        virtual void print( std::ostream &os, int indent = 0 ) const;
232  private:
233        DeclarationWithType *member;
234        Expression *aggregate;
235};
236
237/// VariableExpr represents an expression that simply refers to the value of a named variable
238class VariableExpr : public Expression {
239  public:
240        VariableExpr( DeclarationWithType *var, Expression *_aname = 0 );
241        VariableExpr( const VariableExpr &other );
242        virtual ~VariableExpr();
243
244        DeclarationWithType *get_var() const { return var; }
245        void set_var( DeclarationWithType *newValue ) { var = newValue; }
246
247        virtual VariableExpr *clone() const { return new VariableExpr( *this ); }
248        virtual void accept( Visitor &v ) { v.visit( this ); }
249        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
250        virtual void print( std::ostream &os, int indent = 0 ) const;
251  private:
252        DeclarationWithType *var;
253};
254
255/// ConstantExpr represents an expression that simply refers to the value of a constant
256class ConstantExpr : public Expression {
257  public:
258        ConstantExpr( Constant constant, Expression *_aname = 0 );
259        ConstantExpr( const ConstantExpr &other );
260        virtual ~ConstantExpr();
261
262        Constant *get_constant() { return &constant; }
263        void set_constant( const Constant &newValue ) { constant = newValue; }
264
265        virtual ConstantExpr *clone() const { return new ConstantExpr( *this ); }
266        virtual void accept( Visitor &v ) { v.visit( this ); }
267        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
268        virtual void print( std::ostream &os, int indent = 0 ) const;
269  private:
270        Constant constant;
271};
272
273/// SizeofExpr represents a sizeof expression (could be sizeof(int) or sizeof 3+4)
274class SizeofExpr : public Expression {
275  public:
276        SizeofExpr( Expression *expr, Expression *_aname = 0 );
277        SizeofExpr( const SizeofExpr &other );
278        SizeofExpr( Type *type, Expression *_aname = 0 );
279        virtual ~SizeofExpr();
280
281        Expression *get_expr() const { return expr; }
282        void set_expr( Expression *newValue ) { expr = newValue; }
283        Type *get_type() const { return type; }
284        void set_type( Type *newValue ) { type = newValue; }
285        bool get_isType() const { return isType; }
286        void set_isType( bool newValue ) { isType = newValue; }
287
288        virtual SizeofExpr *clone() const { return new SizeofExpr( *this ); }
289        virtual void accept( Visitor &v ) { v.visit( this ); }
290        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
291        virtual void print( std::ostream &os, int indent = 0 ) const;
292  private:
293        Expression *expr;
294        Type *type;
295        bool isType;
296};
297
298/// AlignofExpr represents an alignof expression
299class AlignofExpr : public Expression {
300  public:
301        AlignofExpr( Expression *expr, Expression *_aname = 0 );
302        AlignofExpr( const AlignofExpr &other );
303        AlignofExpr( Type *type, Expression *_aname = 0 );
304        virtual ~AlignofExpr();
305
306        Expression *get_expr() const { return expr; }
307        void set_expr( Expression *newValue ) { expr = newValue; }
308        Type *get_type() const { return type; }
309        void set_type( Type *newValue ) { type = newValue; }
310        bool get_isType() const { return isType; }
311        void set_isType( bool newValue ) { isType = newValue; }
312
313        virtual AlignofExpr *clone() const { return new AlignofExpr( *this ); }
314        virtual void accept( Visitor &v ) { v.visit( this ); }
315        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
316        virtual void print( std::ostream &os, int indent = 0 ) const;
317  private:
318        Expression *expr;
319        Type *type;
320        bool isType;
321};
322
323/// UntypedOffsetofExpr represents an offsetof expression before resolution
324class UntypedOffsetofExpr : public Expression {
325  public:
326        UntypedOffsetofExpr( Type *type, const std::string &member, Expression *_aname = 0 );
327        UntypedOffsetofExpr( const UntypedOffsetofExpr &other );
328        virtual ~UntypedOffsetofExpr();
329
330        std::string get_member() const { return member; }
331        void set_member( const std::string &newValue ) { member = newValue; }
332        Type *get_type() const { return type; }
333        void set_type( Type *newValue ) { type = newValue; }
334
335        virtual UntypedOffsetofExpr *clone() const { return new UntypedOffsetofExpr( *this ); }
336        virtual void accept( Visitor &v ) { v.visit( this ); }
337        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
338        virtual void print( std::ostream &os, int indent = 0 ) const;
339  private:
340        Type *type;
341        std::string member;
342};
343
344/// OffsetofExpr represents an offsetof expression
345class OffsetofExpr : public Expression {
346  public:
347        OffsetofExpr( Type *type, DeclarationWithType *member, Expression *_aname = 0 );
348        OffsetofExpr( const OffsetofExpr &other );
349        virtual ~OffsetofExpr();
350
351        Type *get_type() const { return type; }
352        void set_type( Type *newValue ) { type = newValue; }
353        DeclarationWithType *get_member() const { return member; }
354        void set_member( DeclarationWithType *newValue ) { member = newValue; }
355
356        virtual OffsetofExpr *clone() const { return new OffsetofExpr( *this ); }
357        virtual void accept( Visitor &v ) { v.visit( this ); }
358        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
359        virtual void print( std::ostream &os, int indent = 0 ) const;
360  private:
361        Type *type;
362        DeclarationWithType *member;
363};
364
365/// AttrExpr represents an @attribute expression (like sizeof, but user-defined)
366class AttrExpr : public Expression {
367  public:
368        AttrExpr(Expression *attr, Expression *expr, Expression *_aname = 0 );
369        AttrExpr( const AttrExpr &other );
370        AttrExpr( Expression *attr, Type *type, Expression *_aname = 0 );
371        virtual ~AttrExpr();
372
373        Expression *get_attr() const { return attr; }
374        void set_attr( Expression *newValue ) { attr = newValue; }
375        Expression *get_expr() const { return expr; }
376        void set_expr( Expression *newValue ) { expr = newValue; }
377        Type *get_type() const { return type; }
378        void set_type( Type *newValue ) { type = newValue; }
379        bool get_isType() const { return isType; }
380        void set_isType( bool newValue ) { isType = newValue; }
381
382        virtual AttrExpr *clone() const { return new AttrExpr( *this ); }
383        virtual void accept( Visitor &v ) { v.visit( this ); }
384        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
385        virtual void print( std::ostream &os, int indent = 0 ) const;
386  private:
387        Expression *attr;
388        Expression *expr;
389        Type *type;
390        bool isType;
391};
392
393/// LogicalExpr represents a short-circuit boolean expression (&& or ||)
394class LogicalExpr : public Expression {
395  public:
396        LogicalExpr( Expression *arg1, Expression *arg2, bool andp = true, Expression *_aname = 0 );
397        LogicalExpr( const LogicalExpr &other );
398        virtual ~LogicalExpr();
399
400        bool get_isAnd() const { return isAnd; }
401        Expression *get_arg1() { return arg1; }
402        void set_arg1( Expression *newValue ) { arg1 = newValue; }
403        Expression *get_arg2() const { return arg2; }
404        void set_arg2( Expression *newValue ) { arg2 = newValue; }
405
406        virtual LogicalExpr *clone() const { return new LogicalExpr( *this ); }
407        virtual void accept( Visitor &v ) { v.visit( this ); }
408        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
409        virtual void print( std::ostream &os, int indent = 0 ) const;
410  private:
411        Expression *arg1;
412        Expression *arg2;
413        bool isAnd;
414};
415
416/// ConditionalExpr represents the three-argument conditional ( p ? a : b )
417class ConditionalExpr : public Expression {
418  public:
419        ConditionalExpr( Expression *arg1, Expression *arg2, Expression *arg3, Expression *_aname = 0 );
420        ConditionalExpr( const ConditionalExpr &other );
421        virtual ~ConditionalExpr();
422
423        Expression *get_arg1() const { return arg1; }
424        void set_arg1( Expression *newValue ) { arg1 = newValue; }
425        Expression *get_arg2() const { return arg2; }
426        void set_arg2( Expression *newValue ) { arg2 = newValue; }
427        Expression *get_arg3() const { return arg3; }
428        void set_arg3( Expression *newValue ) { arg3 = newValue; }
429
430        virtual ConditionalExpr *clone() const { return new ConditionalExpr( *this ); }
431        virtual void accept( Visitor &v ) { v.visit( this ); }
432        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
433        virtual void print( std::ostream &os, int indent = 0 ) const;
434  private:
435        Expression *arg1;
436        Expression *arg2;
437        Expression *arg3;
438};
439
440/// CommaExpr represents the sequence operator ( a, b )
441class CommaExpr : public Expression {
442  public:
443        CommaExpr( Expression *arg1, Expression *arg2, Expression *_aname = 0 );
444        CommaExpr( const CommaExpr &other );
445        virtual ~CommaExpr();
446
447        Expression *get_arg1() const { return arg1; }
448        void set_arg1( Expression *newValue ) { arg1 = newValue; }
449        Expression *get_arg2() const { return arg2; }
450        void set_arg2( Expression *newValue ) { arg2 = newValue; }
451
452        virtual CommaExpr *clone() const { return new CommaExpr( *this ); }
453        virtual void accept( Visitor &v ) { v.visit( this ); }
454        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
455        virtual void print( std::ostream &os, int indent = 0 ) const;
456  private:
457        Expression *arg1;
458        Expression *arg2;
459};
460
461/// TupleExpr represents a tuple expression ( [a, b, c] )
462class TupleExpr : public Expression {
463  public:
464        TupleExpr( Expression *_aname = 0 );
465        TupleExpr( const TupleExpr &other );
466        virtual ~TupleExpr();
467
468        void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }
469        std::list<Expression*>& get_exprs() { return exprs; }
470
471        virtual TupleExpr *clone() const { return new TupleExpr( *this ); }
472        virtual void accept( Visitor &v ) { v.visit( this ); }
473        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
474        virtual void print( std::ostream &os, int indent = 0 ) const;
475  private:
476        std::list<Expression*> exprs;
477};
478
479/// SolvedTupleExpr represents a TupleExpr whose components have been type-resolved. It is effectively a shell for the code generator to work on
480class SolvedTupleExpr : public Expression {
481  public:
482        SolvedTupleExpr( Expression *_aname = 0 ) : Expression( _aname ) {}
483        SolvedTupleExpr( std::list<Expression *> &, Expression *_aname = 0 );
484        SolvedTupleExpr( const SolvedTupleExpr &other );
485        virtual ~SolvedTupleExpr() {}
486
487        std::list<Expression*> &get_exprs() { return exprs; }
488
489        virtual SolvedTupleExpr *clone() const { return new SolvedTupleExpr( *this ); }
490        virtual void accept( Visitor &v ) { v.visit( this ); }
491        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
492        virtual void print( std::ostream &os, int indent = 0 ) const;
493  private:
494        std::list<Expression*> exprs;
495};
496
497/// TypeExpr represents a type used in an expression (e.g. as a type generator parameter)
498class TypeExpr : public Expression {
499  public:
500        TypeExpr( Type *type );
501        TypeExpr( const TypeExpr &other );
502        virtual ~TypeExpr();
503
504        Type *get_type() const { return type; }
505        void set_type( Type *newValue ) { type = newValue; }
506
507        virtual TypeExpr *clone() const { return new TypeExpr( *this ); }
508        virtual void accept( Visitor &v ) { v.visit( this ); }
509        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
510        virtual void print( std::ostream &os, int indent = 0 ) const;
511  private:
512        Type *type;
513};
514
515/// AsmExpr represents a GCC 'asm constraint operand' used in an asm statement: [output] "=f" (result)
516class AsmExpr : public Expression {
517  public:
518        AsmExpr( Expression *inout, ConstantExpr *constraint, Expression *operand ) : inout( inout ), constraint( constraint ), operand( operand ) {}
519        AsmExpr( const AsmExpr & other );
520        virtual ~AsmExpr() { delete inout; delete constraint; delete operand; };
521
522        Expression *get_inout() const { return inout; }
523        void set_inout( Expression *newValue ) { inout = newValue; }
524
525        ConstantExpr *get_constraint() const { return constraint; }
526        void set_constraint( ConstantExpr *newValue ) { constraint = newValue; }
527
528        Expression *get_operand() const { return operand; }
529        void set_operand( Expression *newValue ) { operand = newValue; }
530
531        virtual AsmExpr *clone() const { return new AsmExpr( *this ); }
532        virtual void accept( Visitor &v ) { v.visit( this ); }
533        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
534        virtual void print( std::ostream &os, int indent = 0 ) const;
535  private:
536        // https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Machine-Constraints.html#Machine-Constraints
537        Expression *inout;
538        ConstantExpr *constraint;
539        Expression *operand;
540};
541
542/// ImplicitCopyCtorExpr represents the application of a function to a set of parameters,
543/// along with a set of copy constructor calls, one for each argument.
544class ImplicitCopyCtorExpr : public Expression {
545public:
546        ImplicitCopyCtorExpr( ApplicationExpr * callExpr );
547        ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );
548        virtual ~ImplicitCopyCtorExpr();
549
550        ApplicationExpr *get_callExpr() const { return callExpr; }
551        void set_callExpr( ApplicationExpr *newValue ) { callExpr = newValue; }
552
553        std::list< Expression * > & get_copyCtors() { return copyCtors; }
554        void set_copyCtors( std::list< Expression * > newValue ) { copyCtors = newValue; }
555
556        std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
557        void set_tempDecls( std::list< ObjectDecl * > newValue ) { tempDecls = newValue; }
558
559        std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
560        void set_returnDecls( std::list< ObjectDecl * > newValue ) { returnDecls = newValue; }
561
562        std::list< Expression * > & get_dtors() { return dtors; }
563        void set_dtors( std::list< Expression * > newValue ) { dtors = newValue; }
564
565        virtual ImplicitCopyCtorExpr *clone() const { return new ImplicitCopyCtorExpr( *this ); }
566        virtual void accept( Visitor &v ) { v.visit( this ); }
567        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
568        virtual void print( std::ostream &os, int indent = 0 ) const;
569  private:
570        ApplicationExpr * callExpr;
571        std::list< Expression * > copyCtors;
572        std::list< ObjectDecl * > tempDecls;
573        std::list< ObjectDecl * > returnDecls;
574        std::list< Expression * > dtors;
575};
576
577/// ValofExpr represents a GCC 'lambda expression'
578class UntypedValofExpr : public Expression {
579  public:
580        UntypedValofExpr( Statement *_body, Expression *_aname = 0 ) : Expression( _aname ), body ( _body ) {}
581        UntypedValofExpr( const UntypedValofExpr & other );
582        virtual ~UntypedValofExpr();
583
584        Expression *get_value();
585        Statement *get_body() const { return body; }
586
587        virtual UntypedValofExpr *clone() const { return new UntypedValofExpr( *this ); }
588        virtual void accept( Visitor &v ) { v.visit( this ); }
589        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
590        virtual void print( std::ostream &os, int indent = 0 ) const;
591  private:
592        Statement *body;
593};
594
595std::ostream & operator<<( std::ostream & out, Expression * expr );
596
597#endif // EXPRESSION_H
598
599// Local Variables: //
600// tab-width: 4 //
601// mode: c++ //
602// compile-command: "make install" //
603// End: //
Note: See TracBrowser for help on using the repository browser.