Changeset 974906e2 for src/SynTree
- Timestamp:
- Jan 11, 2016, 2:48:05 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- a56767c
- Parents:
- 1e9d87b
- Location:
- src/SynTree
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.h
r1e9d87b r974906e2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Declaration.h -- 7 // Declaration.h -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Dec 09 14:08:22 201513 // Update Count : 3 212 // Last Modified On : Thu Jan 07 14:48:44 2016 13 // Update Count : 34 14 14 // 15 15 … … 91 91 Expression *get_bitfieldWidth() const { return bitfieldWidth; } 92 92 void set_bitfieldWidth( Expression *newValue ) { bitfieldWidth = newValue; } 93 ExprStmt * get_ctor() const { return ctor; } 94 void set_ctor( ExprStmt * newValue ) { ctor = newValue; } 93 95 94 96 virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); } … … 101 103 Initializer *init; 102 104 Expression *bitfieldWidth; 105 ExprStmt * ctor; 103 106 }; 104 107 -
src/SynTree/Initializer.cc
r1e9d87b r974906e2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Initializer.cc -- 7 // Initializer.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Aug 12 14:05:25 201513 // Update Count : 1412 // Last Modified On : Thu Jan 07 15:00:18 2016 13 // Update Count : 23 14 14 // 15 15 … … 18 18 #include "utility.h" 19 19 20 Initializer::Initializer( ) {}20 Initializer::Initializer( bool maybeConstructed ) : maybeConstructed( maybeConstructed ) {} 21 21 22 22 Initializer::~Initializer() {} … … 31 31 void Initializer::print( std::ostream &os, int indent ) {} 32 32 33 SingleInit::SingleInit( Expression *v, std::list< Expression *> &_designators ) : value ( v ), designators( _designators ) {33 SingleInit::SingleInit( Expression *v, std::list< Expression *> &_designators, bool maybeConstructed ) : Initializer( maybeConstructed ), value ( v ), designators( _designators ) { 34 34 } 35 35 36 SingleInit::SingleInit( const SingleInit &other ) : value ( other.value ) {36 SingleInit::SingleInit( const SingleInit &other ) : Initializer(other), value ( other.value ) { 37 37 cloneAll(other.designators, designators ); 38 38 } … … 54 54 } 55 55 56 ListInit::ListInit( std::list<Initializer*> &_initializers, std::list<Expression *> &_designators )57 : initializers( _initializers ), designators( _designators ) {56 ListInit::ListInit( std::list<Initializer*> &_initializers, std::list<Expression *> &_designators, bool maybeConstructed ) 57 : Initializer( maybeConstructed), initializers( _initializers ), designators( _designators ) { 58 58 } 59 59 … … 65 65 66 66 void ListInit::print( std::ostream &os, int indent ) { 67 os << std::endl << std::string(indent, ' ') << "Compound initializer: "; 67 os << std::endl << std::string(indent, ' ') << "Compound initializer: "; 68 68 if ( ! designators.empty() ) { 69 69 os << std::string(indent + 2, ' ' ) << "designated by: ["; 70 70 for ( std::list < Expression * >::iterator i = designators.begin(); 71 71 i != designators.end(); i++ ) { 72 ( *i )->print(os, indent + 4 ); 72 ( *i )->print(os, indent + 4 ); 73 73 } // for 74 74 75 75 os << std::string(indent + 2, ' ' ) << "]"; 76 76 } // if 77 77 78 for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ ) 78 for ( std::list<Initializer *>::iterator i = initializers.begin(); i != initializers.end(); i++ ) 79 79 (*i)->print( os, indent + 2 ); 80 80 } -
src/SynTree/Initializer.h
r1e9d87b r974906e2 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 : 111 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Jan 07 13:33:20 2016 13 // Update Count : 5 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 );60 SingleInit( Expression *value, std::list< Expression *> &designators, bool maybeConstructed ); 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( std::list<Initializer*> &, 85 std::list<Expression *> &designators, bool maybeConstructed ); 83 86 virtual ~ListInit(); 84 87 -
src/SynTree/ObjectDecl.cc
r1e9d87b r974906e2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ObjectDecl.cc -- 7 // ObjectDecl.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Tue Sep 29 14:13:01 201513 // Update Count : 1812 // Last Modified On : Fri Jan 08 15:29:10 2016 13 // Update Count : 27 14 14 // 15 15 … … 19 19 #include "Expression.h" 20 20 #include "utility.h" 21 #include "Statement.h" 21 22 22 23 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline, bool isNoreturn ) … … 24 25 set_isInline( isInline ); 25 26 set_isNoreturn( isNoreturn ); 27 set_ctor( NULL ); 26 28 } 27 29 28 30 ObjectDecl::ObjectDecl( const ObjectDecl &other ) 29 : Parent( other ), type( maybeClone( other.type ) ), init( maybeClone( other.init ) ), bitfieldWidth( maybeClone( other.bitfieldWidth ) ) {31 : Parent( other ), type( maybeClone( other.type ) ), init( maybeClone( other.init ) ), bitfieldWidth( maybeClone( other.bitfieldWidth ) ), ctor( maybeClone( other.ctor ) ) { 30 32 } 31 33 … … 34 36 delete init; 35 37 delete bitfieldWidth; 38 delete ctor; 36 39 } 37 40 … … 58 61 os << " with initializer "; 59 62 init->print( os, indent ); 63 os << std::string(indent, ' ') << "maybeConstructed? " << init->get_maybeConstructed(); 60 64 } // if 61 65 … … 64 68 bitfieldWidth->print( os ); 65 69 } // if 70 71 if ( ctor ) { 72 os << " initially constructed with "; 73 ctor->print( os, indent ); 74 } // if 66 75 } 67 76 … … 69 78 #if 0 70 79 if ( get_mangleName() != "") { 71 os << get_mangleName() << ": "; 72 } else 80 os << get_mangleName() << ": "; 81 } else 73 82 #endif 74 83 if ( get_name() != "" ) {
Note:
See TracChangeset
for help on using the changeset viewer.