- Timestamp:
- Aug 13, 2021, 3:58:19 PM (4 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/AST
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
rc9f9d4f r6cebfef 606 606 } 607 607 608 const ast::Stmt * visit( const ast::MutexStmt * node ) override final { 609 if ( inCache( node ) ) return nullptr; 610 auto stmt = new MutexStmt( 611 get<Statement>().accept1( node->stmt ), 612 get<Expression>().acceptL( node->mutexObjs ) 613 ); 614 return stmtPostamble( stmt, node ); 615 } 616 608 617 TypeSubstitution * convertTypeSubstitution(const ast::TypeSubstitution * src) { 609 618 … … 2124 2133 } 2125 2134 2135 virtual void visit( const MutexStmt * old ) override final { 2136 if ( inCache( old ) ) return; 2137 this->node = new ast::MutexStmt( 2138 old->location, 2139 GET_ACCEPT_1(stmt, Stmt), 2140 GET_ACCEPT_V(mutexObjs, Expr) 2141 ); 2142 cache.emplace( old, this->node ); 2143 } 2144 2126 2145 // TypeSubstitution shouldn't exist yet in old. 2127 2146 ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) { -
src/AST/Fwd.hpp
rc9f9d4f r6cebfef 60 60 class NullStmt; 61 61 class ImplicitCtorDtorStmt; 62 class MutexStmt; 62 63 63 64 class Expr; -
src/AST/Node.cpp
rc9f9d4f r6cebfef 176 176 template class ast::ptr_base< ast::ImplicitCtorDtorStmt, ast::Node::ref_type::weak >; 177 177 template class ast::ptr_base< ast::ImplicitCtorDtorStmt, ast::Node::ref_type::strong >; 178 template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::weak >; 179 template class ast::ptr_base< ast::MutexStmt, ast::Node::ref_type::strong >; 178 180 template class ast::ptr_base< ast::Expr, ast::Node::ref_type::weak >; 179 181 template class ast::ptr_base< ast::Expr, ast::Node::ref_type::strong >; -
src/AST/Pass.hpp
rc9f9d4f r6cebfef 162 162 const ast::Stmt * visit( const ast::DeclStmt * ) override final; 163 163 const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * ) override final; 164 const ast::Stmt * visit( const ast::MutexStmt * ) override final; 164 165 const ast::Expr * visit( const ast::ApplicationExpr * ) override final; 165 166 const ast::Expr * visit( const ast::UntypedExpr * ) override final; -
src/AST/Pass.impl.hpp
rc9f9d4f r6cebfef 1039 1039 1040 1040 //-------------------------------------------------------------------------- 1041 // MutexStmt 1042 template< typename core_t > 1043 const ast::Stmt * ast::Pass< core_t >::visit( const ast::MutexStmt * node ) { 1044 VISIT_START( node ); 1045 1046 VISIT({ 1047 // mutex statements introduce a level of scope (for the initialization) 1048 guard_symtab guard { *this }; 1049 maybe_accept( node, &MutexStmt::stmt ); 1050 maybe_accept( node, &MutexStmt::mutexObjs ); 1051 }) 1052 1053 VISIT_END( Stmt, node ); 1054 } 1055 1056 //-------------------------------------------------------------------------- 1041 1057 // ApplicationExpr 1042 1058 template< typename core_t > -
src/AST/Print.cpp
rc9f9d4f r6cebfef 794 794 ++indent; 795 795 safe_print( node->callStmt ); 796 --indent; 797 os << endl; 798 799 return node; 800 } 801 802 virtual const ast::Stmt * visit( const ast::MutexStmt * node ) override final { 803 os << "Mutex Statement" << endl; 804 os << indent << "... with Mutex Parameters: "; 805 ++indent; 806 printAll( node->mutexObjs ); 807 --indent; 808 os << indent << "... with Statement: "; 809 ++indent; 810 safe_print( node->stmt ); 796 811 --indent; 797 812 os << endl; -
src/AST/Stmt.hpp
rc9f9d4f r6cebfef 426 426 }; 427 427 428 /// Mutex Statement 429 class MutexStmt final : public Stmt { 430 public: 431 ptr<Stmt> stmt; 432 std::vector<ptr<Expr>> mutexObjs; 433 434 MutexStmt( const CodeLocation & loc, const Stmt * stmt, 435 std::vector<ptr<Expr>> && mutexes, std::vector<Label> && labels = {} ) 436 : Stmt(loc, std::move(labels)), stmt(stmt), mutexObjs(std::move(mutexes)) {} 437 438 const Stmt * accept( Visitor & v ) const override { return v.visit( this ); } 439 private: 440 MutexStmt * clone() const override { return new MutexStmt{ *this }; } 441 MUTATE_FRIEND 442 }; 443 428 444 } 429 445 -
src/AST/Visitor.hpp
rc9f9d4f r6cebfef 54 54 virtual const ast::Stmt * visit( const ast::DeclStmt * ) = 0; 55 55 virtual const ast::Stmt * visit( const ast::ImplicitCtorDtorStmt * ) = 0; 56 virtual const ast::Stmt * visit( const ast::MutexStmt * ) = 0; 56 57 virtual const ast::Expr * visit( const ast::ApplicationExpr * ) = 0; 57 58 virtual const ast::Expr * visit( const ast::UntypedExpr * ) = 0;
Note:
See TracChangeset
for help on using the changeset viewer.