Changeset 6cebfef for src/SynTree
- Timestamp:
- Aug 13, 2021, 3:58:19 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- de52331
- Parents:
- c9f9d4f
- Location:
- src/SynTree
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Mutator.h
rc9f9d4f r6cebfef 58 58 virtual Statement * mutate( DeclStmt * declStmt ) = 0; 59 59 virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0; 60 virtual Statement * mutate( MutexStmt * mutexStmt ) = 0; 60 61 61 62 virtual Expression * mutate( ApplicationExpr * applicationExpr ) = 0; -
src/SynTree/Statement.cc
rc9f9d4f r6cebfef 565 565 } 566 566 567 MutexStmt::MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs ) 568 : Statement(), stmt( stmt ), mutexObjs( mutexObjs ) { } 569 570 MutexStmt::MutexStmt( const MutexStmt & other ) : Statement( other ), stmt( maybeClone( other.stmt ) ) { 571 cloneAll( other.mutexObjs, mutexObjs ); 572 } 573 574 MutexStmt::~MutexStmt() { 575 deleteAll( mutexObjs ); 576 delete stmt; 577 } 578 579 void MutexStmt::print( std::ostream & os, Indenter indent ) const { 580 os << "Mutex Statement" << endl; 581 os << indent << "... with Expressions: " << endl; 582 for (auto * obj : mutexObjs) { 583 os << indent+1; 584 obj->print( os, indent+1); 585 os << endl; 586 } 587 os << indent << "... with Statement: " << endl << indent+1; 588 stmt->print( os, indent+1 ); 589 } 590 567 591 // Local Variables: // 568 592 // tab-width: 4 // -
src/SynTree/Statement.h
rc9f9d4f r6cebfef 535 535 }; 536 536 537 class MutexStmt : public Statement { 538 public: 539 Statement * stmt; 540 std::list<Expression *> mutexObjs; // list of mutex objects to acquire 541 542 MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs ); 543 MutexStmt( const MutexStmt & other ); 544 virtual ~MutexStmt(); 545 546 virtual MutexStmt * clone() const override { return new MutexStmt( *this ); } 547 virtual void accept( Visitor & v ) override { v.visit( this ); } 548 virtual void accept( Visitor & v ) const override { v.visit( this ); } 549 virtual Statement * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 550 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 551 }; 552 537 553 // Local Variables: // 538 554 // tab-width: 4 // -
src/SynTree/SynTree.h
rc9f9d4f r6cebfef 62 62 class NullStmt; 63 63 class ImplicitCtorDtorStmt; 64 class MutexStmt; 64 65 65 66 class Expression; -
src/SynTree/Visitor.h
rc9f9d4f r6cebfef 92 92 virtual void visit( ImplicitCtorDtorStmt * node ) { visit( const_cast<const ImplicitCtorDtorStmt *>(node) ); } 93 93 virtual void visit( const ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0; 94 virtual void visit( MutexStmt * node ) { visit( const_cast<const MutexStmt *>(node) ); } 95 virtual void visit( const MutexStmt * mutexStmt ) = 0; 94 96 95 97 virtual void visit( ApplicationExpr * node ) { visit( const_cast<const ApplicationExpr *>(node) ); }
Note: See TracChangeset
for help on using the changeset viewer.