Changeset 71f4e4f for src/SynTree
- Timestamp:
- Jan 13, 2016, 5:19:47 PM (8 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:
- f1e012b
- Parents:
- 02c7d04
- Location:
- src/SynTree
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.h
r02c7d04 r71f4e4f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Jan 07 14:48:44201613 // Update Count : 3 412 // Last Modified On : Wed Jan 13 16:11:49 2016 13 // Update Count : 36 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; }95 93 96 94 virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); } … … 103 101 Initializer *init; 104 102 Expression *bitfieldWidth; 105 ExprStmt * ctor;106 103 }; 107 104 -
src/SynTree/Initializer.cc
r02c7d04 r71f4e4f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Jan 07 15:00:18201613 // Update Count : 2 312 // Last Modified On : Wed Jan 13 15:31:45 2016 13 // Update Count : 28 14 14 // 15 15 … … 79 79 (*i)->print( os, indent + 2 ); 80 80 } 81 82 83 ConstructorInit::ConstructorInit( Expression * ctor, Initializer * init ) : Initializer( true ), ctor( ctor ), init( init ) {} 84 ConstructorInit::~ConstructorInit() { 85 delete ctor; 86 delete init; 87 } 88 89 ConstructorInit *ConstructorInit::clone() const { 90 return new ConstructorInit( *this ); 91 } 92 93 void ConstructorInit::print( std::ostream &os, int indent ) { 94 os << std::endl << std::string(indent, ' ') << "Constructor initializer: "; 95 if ( ctor ) { 96 os << " initially constructed with "; 97 ctor->print( os, indent+2 ); 98 } // if 99 100 if ( init ) { 101 os << " with fallback C-style initializer: "; 102 init->print( os, indent+2 ); 103 } 104 } 105 106 81 107 // Local Variables: // 82 108 // tab-width: 4 // -
src/SynTree/Initializer.h
r02c7d04 r71f4e4f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Jan 07 13:33:20201613 // Update Count : 512 // Last Modified On : Wed Jan 13 15:29:53 2016 13 // Update Count : 17 14 14 // 15 15 … … 103 103 }; 104 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( Expression * ctor, Initializer * init ); 110 virtual ~ConstructorInit(); 111 112 void set_ctor( Expression * newValue ) { ctor = newValue; } 113 Expression * get_ctor() const { return ctor; } 114 void set_init( Initializer * newValue ) { init = newValue; } 115 Initializer * get_init() const { return init; } 116 117 virtual ConstructorInit *clone() const; 118 virtual void accept( Visitor &v ) { v.visit( this ); } 119 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); } 120 virtual void print( std::ostream &os, int indent = 0 ); 121 122 private: 123 Expression * ctor; 124 // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback 125 // if an appropriate constructor definition is not found by the resolver 126 Initializer * init; 127 }; 128 105 129 #endif // INITIALIZER_H 106 130 -
src/SynTree/Mutator.cc
r02c7d04 r71f4e4f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Mutator.cc -- 7 // Mutator.cc -- 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 : Sat Jul 25 19:21:33 201513 // Update Count : 1 111 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 13 15:32:29 2016 13 // Update Count : 15 14 14 // 15 15 … … 419 419 } 420 420 421 Initializer *Mutator::mutate( ConstructorInit *ctorInit ) { 422 ctorInit->set_ctor( maybeMutate( ctorInit->get_ctor(), *this ) ); 423 ctorInit->set_init( maybeMutate( ctorInit->get_init(), *this ) ); 424 return ctorInit; 425 } 426 421 427 Subrange *Mutator::mutate( Subrange *subrange ) { 422 428 return subrange; -
src/SynTree/Mutator.h
r02c7d04 r71f4e4f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Mutator.h -- 7 // Mutator.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 : Thu Nov 19 22:26:16 201513 // Update Count : 811 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 13 15:24:26 2016 13 // Update Count : 9 14 14 // 15 15 #include <cassert> … … 62 62 virtual Expression* mutate( MemberExpr *memberExpr ); 63 63 virtual Expression* mutate( VariableExpr *variableExpr ); 64 virtual Expression* mutate( ConstantExpr *constantExpr ); 64 virtual Expression* mutate( ConstantExpr *constantExpr ); 65 65 virtual Expression* mutate( SizeofExpr *sizeofExpr ); 66 66 virtual Expression* mutate( AlignofExpr *alignofExpr ); … … 91 91 virtual Initializer* mutate( SingleInit *singleInit ); 92 92 virtual Initializer* mutate( ListInit *listInit ); 93 virtual Initializer* mutate( ConstructorInit *ctorInit ); 93 94 94 95 virtual Subrange *mutate( Subrange *subrange ); -
src/SynTree/ObjectDecl.cc
r02c7d04 r71f4e4f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Fri Jan 08 15:29:10201613 // Update Count : 2 712 // Last Modified On : Wed Jan 13 16:11:19 2016 13 // Update Count : 29 14 14 // 15 15 … … 25 25 set_isInline( isInline ); 26 26 set_isNoreturn( isNoreturn ); 27 set_ctor( NULL );28 27 } 29 28 30 29 ObjectDecl::ObjectDecl( const ObjectDecl &other ) 31 : Parent( other ), type( maybeClone( other.type ) ), init( maybeClone( other.init ) ), bitfieldWidth( maybeClone( other.bitfieldWidth ) ) , ctor( maybeClone( other.ctor ) ){30 : Parent( other ), type( maybeClone( other.type ) ), init( maybeClone( other.init ) ), bitfieldWidth( maybeClone( other.bitfieldWidth ) ) { 32 31 } 33 32 … … 36 35 delete init; 37 36 delete bitfieldWidth; 38 delete ctor;39 37 } 40 38 … … 67 65 os << " with bitfield width "; 68 66 bitfieldWidth->print( os ); 69 } // if70 71 if ( ctor ) {72 os << " initially constructed with ";73 ctor->print( os, indent );74 67 } // if 75 68 } -
src/SynTree/SynTree.h
r02c7d04 r71f4e4f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // SynTree.h -- 7 // SynTree.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 : Thu Jul 23 23:25:04 201513 // Update Count : 311 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 13 15:28:41 2016 13 // Update Count : 4 14 14 // 15 15 … … 99 99 class SingleInit; 100 100 class ListInit; 101 class ConstructorInit; 101 102 102 103 class Subrange; -
src/SynTree/Visitor.cc
r02c7d04 r71f4e4f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Visitor.cc -- 7 // Visitor.cc -- 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 : Fri Jul 24 16:11:05 201513 // Update Count : 1 511 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 13 15:27:23 2016 13 // Update Count : 18 14 14 // 15 15 … … 353 353 } 354 354 355 void Visitor::visit( ConstructorInit *ctorInit ) { 356 maybeAccept( ctorInit->get_ctor(), *this ); 357 maybeAccept( ctorInit->get_init(), *this ); 358 } 359 355 360 void Visitor::visit( Subrange *subrange ) {} 356 361 -
src/SynTree/Visitor.h
r02c7d04 r71f4e4f 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Visitor.h -- 7 // Visitor.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 : Thu Jul 23 23:22:23 201513 // Update Count : 411 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 13 15:24:05 2016 13 // Update Count : 5 14 14 // 15 15 … … 62 62 virtual void visit( MemberExpr *memberExpr ); 63 63 virtual void visit( VariableExpr *variableExpr ); 64 virtual void visit( ConstantExpr *constantExpr ); 64 virtual void visit( ConstantExpr *constantExpr ); 65 65 virtual void visit( SizeofExpr *sizeofExpr ); 66 66 virtual void visit( AlignofExpr *alignofExpr ); … … 91 91 virtual void visit( SingleInit *singleInit ); 92 92 virtual void visit( ListInit *listInit ); 93 virtual void visit( ConstructorInit *ctorInit ); 93 94 94 95 virtual void visit( Subrange *subrange );
Note: See TracChangeset
for help on using the changeset viewer.