Changeset 8a1d95af for src/SynTree


Ignore:
Timestamp:
Aug 14, 2021, 8:48:49 AM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
Children:
f79ee0d
Parents:
c99a0d1 (diff), 6d63c14 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Mutator.h

    rc99a0d1 r8a1d95af  
    5858        virtual Statement * mutate( DeclStmt * declStmt ) = 0;
    5959        virtual Statement * mutate( ImplicitCtorDtorStmt * impCtorDtorStmt ) = 0;
     60        virtual Statement * mutate( MutexStmt * mutexStmt ) = 0;
    6061
    6162        virtual Expression * mutate( ApplicationExpr * applicationExpr ) = 0;
  • src/SynTree/Statement.cc

    rc99a0d1 r8a1d95af  
    565565}
    566566
     567MutexStmt::MutexStmt( Statement * stmt, std::list<Expression *> mutexObjs )
     568        : Statement(), stmt( stmt ), mutexObjs( mutexObjs ) { }
     569
     570MutexStmt::MutexStmt( const MutexStmt & other ) : Statement( other ), stmt( maybeClone( other.stmt ) ) {
     571        cloneAll( other.mutexObjs, mutexObjs );
     572}
     573
     574MutexStmt::~MutexStmt() {
     575        deleteAll( mutexObjs );
     576        delete stmt;
     577}
     578
     579void 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
    567591// Local Variables: //
    568592// tab-width: 4 //
  • src/SynTree/Statement.h

    rc99a0d1 r8a1d95af  
    535535};
    536536
     537class 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
    537553// Local Variables: //
    538554// tab-width: 4 //
  • src/SynTree/SynTree.h

    rc99a0d1 r8a1d95af  
    6262class NullStmt;
    6363class ImplicitCtorDtorStmt;
     64class MutexStmt;
    6465
    6566class Expression;
  • src/SynTree/Visitor.h

    rc99a0d1 r8a1d95af  
    9292        virtual void visit( ImplicitCtorDtorStmt * node ) { visit( const_cast<const ImplicitCtorDtorStmt *>(node) ); }
    9393        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;
    9496
    9597        virtual void visit( ApplicationExpr * node ) { visit( const_cast<const ApplicationExpr *>(node) ); }
Note: See TracChangeset for help on using the changeset viewer.