Changeset db4ecc5 for src/SynTree
- Timestamp:
- Apr 14, 2016, 3:22:42 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:
- 70a06f6
- Parents:
- 7eabc25
- Location:
- src/SynTree
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r7eabc25 rdb4ecc5 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:10:29 201512 // Last Modified On : Thu Apr 14 13:02:28 2016 13 13 // Update Count : 34 14 14 // … … 78 78 79 79 VariableExpr::VariableExpr( DeclarationWithType *_var, Expression *_aname ) : Expression( _aname ), var( _var ) { 80 assert( var ); 81 assert( var->get_type() ); 80 82 add_result( var->get_type()->clone() ); 81 83 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { … … 432 434 } 433 435 436 437 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) { 438 assert( callExpr ); 439 cloneAll( callExpr->get_results(), results ); 440 } 441 442 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ) : Expression( other ), callExpr( maybeClone( other.callExpr ) ) { 443 cloneAll( other.results, results ); 444 cloneAll( other.copyCtors, copyCtors ); 445 cloneAll( other.tempDecls, tempDecls ); 446 cloneAll( other.returnDecls, returnDecls ); 447 cloneAll( other.dtors, dtors ); 448 } 449 450 ImplicitCopyCtorExpr::~ImplicitCopyCtorExpr() { 451 delete callExpr; 452 deleteAll( copyCtors ); 453 deleteAll( tempDecls ); 454 deleteAll( returnDecls ); 455 deleteAll( dtors ); 456 } 457 458 void ImplicitCopyCtorExpr::print( std::ostream &os, int indent ) const { 459 os << std::string( indent, ' ' ) << "Implicit Copy Constructor Expression: " << std::endl; 460 assert( callExpr ); 461 callExpr->print( os, indent + 2 ); 462 os << std::endl << std::string( indent, ' ' ) << "with temporaries:" << std::endl; 463 printAll(tempDecls, os, indent+2); 464 os << std::endl << std::string( indent, ' ' ) << "with copyCtors:" << std::endl; 465 printAll(copyCtors, os, indent+2); 466 Expression::print( os, indent ); 467 } 468 434 469 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 435 470 -
src/SynTree/Expression.h
r7eabc25 rdb4ecc5 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:10:21 201512 // Last Modified On : Thu Apr 14 12:04:58 2016 13 13 // Update Count : 19 14 14 // … … 22 22 #include "Mutator.h" 23 23 #include "Constant.h" 24 #include "Common/UniqueName.h" 24 25 25 26 /// Expression is the root type for all expressions … … 539 540 }; 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. 544 class ImplicitCopyCtorExpr : public Expression { 545 public: 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 541 577 /// ValofExpr represents a GCC 'lambda expression' 542 578 class UntypedValofExpr : public Expression { -
src/SynTree/Initializer.h
r7eabc25 rdb4ecc5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Apr 11 17:35:30201612 // Last Modified On : Tue Apr 12 13:49:13 2016 13 13 // Update Count : 19 14 14 // … … 58 58 class SingleInit : public Initializer { 59 59 public: 60 SingleInit( Expression *value, const std::list< Expression *> &designators , bool maybeConstructed = false );60 SingleInit( Expression *value, const std::list< Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false ); 61 61 SingleInit( const SingleInit &other ); 62 62 virtual ~SingleInit(); … … 83 83 public: 84 84 ListInit( const std::list<Initializer*> &initializers, 85 const std::list<Expression *> &designators , bool maybeConstructed = false );85 const std::list<Expression *> &designators = std::list< Expression * >(), bool maybeConstructed = false ); 86 86 virtual ~ListInit(); 87 87 -
src/SynTree/Mutator.cc
r7eabc25 rdb4ecc5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Apr 04 17:14:20201612 // Last Modified On : Fri Apr 08 14:01:47 2016 13 13 // Update Count : 15 14 14 // … … 331 331 } 332 332 333 Expression* Mutator::mutate( ImplicitCopyCtorExpr *impCpCtorExpr ) { 334 impCpCtorExpr->set_callExpr( maybeMutate( impCpCtorExpr->get_callExpr(), *this ) ); 335 mutateAll( impCpCtorExpr->get_copyCtors(), *this ); 336 mutateAll( impCpCtorExpr->get_tempDecls(), *this ); 337 return impCpCtorExpr; 338 } 339 333 340 Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) { 334 341 mutateAll( valofExpr->get_results(), *this ); -
src/SynTree/Mutator.h
r7eabc25 rdb4ecc5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Apr 04 17:14:44 201612 // Last Modified On : Fri Apr 08 13:22:04 2016 13 13 // Update Count : 9 14 14 // … … 75 75 virtual Expression* mutate( TypeExpr *typeExpr ); 76 76 virtual Expression* mutate( AsmExpr *asmExpr ); 77 virtual Expression* mutate( ImplicitCopyCtorExpr *impCpCtorExpr ); 77 78 virtual Expression* mutate( UntypedValofExpr *valofExpr ); 78 79 -
src/SynTree/SynTree.h
r7eabc25 rdb4ecc5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Apr 04 17:16:09201612 // Last Modified On : Fri Apr 08 13:49:47 2016 13 13 // Update Count : 4 14 14 // … … 80 80 class TypeExpr; 81 81 class AsmExpr; 82 class ImplicitCopyCtorExpr; 82 83 class UntypedValofExpr; 83 84 -
src/SynTree/Visitor.cc
r7eabc25 rdb4ecc5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Apr 04 17:16:25201612 // Last Modified On : Fri Apr 08 13:53:21 2016 13 13 // Update Count : 18 14 14 // … … 279 279 } 280 280 281 void Visitor::visit( ImplicitCopyCtorExpr *impCpCtorExpr ) { 282 maybeAccept( impCpCtorExpr->get_callExpr(), *this ); 283 acceptAll( impCpCtorExpr->get_copyCtors(), *this ); 284 acceptAll( impCpCtorExpr->get_tempDecls(), *this ); 285 } 286 281 287 void Visitor::visit( UntypedValofExpr *valofExpr ) { 282 288 acceptAll( valofExpr->get_results(), *this ); -
src/SynTree/Visitor.h
r7eabc25 rdb4ecc5 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Mon Apr 04 17:16:36201612 // Last Modified On : Fri Apr 08 13:26:31 2016 13 13 // Update Count : 6 14 14 // … … 75 75 virtual void visit( TypeExpr *typeExpr ); 76 76 virtual void visit( AsmExpr *asmExpr ); 77 virtual void visit( ImplicitCopyCtorExpr *impCpCtorExpr ); 77 78 virtual void visit( UntypedValofExpr *valofExpr ); 78 79
Note: See TracChangeset
for help on using the changeset viewer.