Changes in src/SynTree/Initializer.h [05d47278:db4ecc5]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Initializer.h
r05d47278 rdb4ecc5 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Initializer.h -- 7 // Initializer.h -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon May 18 09:03:48 201513 // Update Count : 1 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Apr 12 13:49:13 2016 13 // Update Count : 19 14 14 // 15 15 … … 27 27 public: 28 28 // Initializer( std::string _name = std::string(""), int _pos = 0 ); 29 Initializer( );29 Initializer( bool maybeConstructed ); 30 30 virtual ~Initializer(); 31 31 … … 43 43 } 44 44 45 bool get_maybeConstructed() { return maybeConstructed; } 46 45 47 virtual Initializer *clone() const = 0; 46 48 virtual void accept( Visitor &v ) = 0; … … 50 52 // std::string name; 51 53 // int pos; 54 bool maybeConstructed; 52 55 }; 53 56 … … 55 58 class SingleInit : public Initializer { 56 59 public: 57 SingleInit( Expression *value, std::list< Expression *> &designators = *(new std::list<Expression *>()));60 SingleInit( Expression *value, const std::list< Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false ); 58 61 SingleInit( const SingleInit &other ); 59 62 virtual ~SingleInit(); 60 63 61 64 Expression *get_value() { return value; } 62 65 void set_value( Expression *newValue ) { value = newValue; } … … 79 82 class ListInit : public Initializer { 80 83 public: 81 ListInit( std::list<Initializer*> &,82 std::list<Expression *> &designators = *(new std::list<Expression *>()));84 ListInit( const std::list<Initializer*> &initializers, 85 const std::list<Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false ); 83 86 virtual ~ListInit(); 84 87 … … 100 103 }; 101 104 105 // ConstructorInit represents an initializer that is either a constructor expression or 106 // a C-style initializer. 107 class ConstructorInit : public Initializer { 108 public: 109 ConstructorInit( Statement * ctor, Statement * dtor, Initializer * init ); 110 virtual ~ConstructorInit(); 111 112 void set_ctor( Statement * newValue ) { ctor = newValue; } 113 Statement * get_ctor() const { return ctor; } 114 void set_dtor( Statement * newValue ) { dtor = newValue; } 115 Statement * get_dtor() const { return dtor; } 116 void set_init( Initializer * newValue ) { init = newValue; } 117 Initializer * get_init() const { return init; } 118 119 virtual ConstructorInit *clone() const; 120 virtual void accept( Visitor &v ) { v.visit( this ); } 121 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); } 122 virtual void print( std::ostream &os, int indent = 0 ); 123 124 private: 125 Statement * ctor; 126 Statement * dtor; 127 // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback 128 // if an appropriate constructor definition is not found by the resolver 129 Initializer * init; 130 }; 131 132 std::ostream & operator<<( std::ostream & out, Initializer * init ); 133 102 134 #endif // INITIALIZER_H 103 135
Note: See TracChangeset
for help on using the changeset viewer.