Changeset afce1cf
- Timestamp:
- Aug 28, 2017, 3:44:55 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 39c7fd0
- Parents:
- 193bba0 (diff), 26238c1 (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. - Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.h
r193bba0 rafce1cf 75 75 virtual void visit( CatchStmt *catchStmt ) override final; 76 76 virtual void visit( FinallyStmt *finallyStmt ) override final; 77 virtual void visit( WaitForStmt *waitforStmt ) override final; 77 78 virtual void visit( NullStmt *nullStmt ) override final; 78 79 virtual void visit( DeclStmt *declStmt ) override final; … … 159 160 virtual Statement* mutate( ReturnStmt *returnStmt ) override final; 160 161 virtual Statement* mutate( ThrowStmt *throwStmt ) override final; 161 virtual Statement* mutate( TryStmt * returnStmt ) override final;162 virtual Statement* mutate( TryStmt *tryStmt ) override final; 162 163 virtual Statement* mutate( CatchStmt *catchStmt ) override final; 163 virtual Statement* mutate( FinallyStmt *catchStmt ) override final; 164 virtual Statement* mutate( FinallyStmt *finallyStmt ) override final; 165 virtual Statement* mutate( WaitForStmt *waitforStmt ) override final; 164 166 virtual NullStmt* mutate( NullStmt *nullStmt ) override final; 165 167 virtual Statement* mutate( DeclStmt *declStmt ) override final; -
src/Common/PassVisitor.impl.h
r193bba0 rafce1cf 541 541 } 542 542 543 //-------------------------------------------------------------------------- 544 // FinallyStmt 543 545 template< typename pass_type > 544 546 void PassVisitor< pass_type >::visit( FinallyStmt * node ) { … … 547 549 548 550 template< typename pass_type > 551 Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) { 552 MUTATE_BODY( Statement, node ); 553 } 554 555 //-------------------------------------------------------------------------- 556 // WaitForStmt 557 template< typename pass_type > 558 void PassVisitor< pass_type >::visit( WaitForStmt * node ) { 559 VISIT_BODY( node ); 560 } 561 562 template< typename pass_type > 563 Statement * PassVisitor< pass_type >::mutate( WaitForStmt * node ) { 564 MUTATE_BODY( Statement, node ); 565 } 566 567 //-------------------------------------------------------------------------- 568 // NullStmt 569 template< typename pass_type > 549 570 void PassVisitor< pass_type >::visit( NullStmt * node ) { 550 571 VISIT_BODY( node ); … … 552 573 553 574 template< typename pass_type > 575 NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) { 576 MUTATE_BODY( NullStmt, node ); 577 } 578 579 //-------------------------------------------------------------------------- 580 // DeclStmt 581 template< typename pass_type > 554 582 void PassVisitor< pass_type >::visit( DeclStmt * node ) { 555 583 VISIT_BODY( node ); … … 557 585 558 586 template< typename pass_type > 587 Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) { 588 MUTATE_BODY( Statement, node ); 589 } 590 591 //-------------------------------------------------------------------------- 592 // ImplicitCtorDtorStmt 593 template< typename pass_type > 559 594 void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) { 560 595 VISIT_BODY( node ); … … 562 597 563 598 template< typename pass_type > 599 Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) { 600 MUTATE_BODY( Statement, node ); 601 } 602 603 //-------------------------------------------------------------------------- 604 // ApplicationExpr 605 template< typename pass_type > 564 606 void PassVisitor< pass_type >::visit( ApplicationExpr * node ) { 565 607 VISIT_BODY( node ); 608 } 609 610 template< typename pass_type > 611 Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) { 612 MUTATE_BODY( Expression, node ); 566 613 } 567 614 … … 944 991 945 992 template< typename pass_type > 946 Statement * PassVisitor< pass_type >::mutate( FinallyStmt * node ) {947 MUTATE_BODY( Statement, node );948 }949 950 template< typename pass_type >951 NullStmt * PassVisitor< pass_type >::mutate( NullStmt * node ) {952 MUTATE_BODY( NullStmt, node );953 }954 955 template< typename pass_type >956 Statement * PassVisitor< pass_type >::mutate( DeclStmt * node ) {957 MUTATE_BODY( Statement, node );958 }959 960 template< typename pass_type >961 Statement * PassVisitor< pass_type >::mutate( ImplicitCtorDtorStmt * node ) {962 MUTATE_BODY( Statement, node );963 }964 965 template< typename pass_type >966 Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) {967 MUTATE_BODY( Expression, node );968 }969 970 template< typename pass_type >971 993 Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) { 972 994 MUTATE_BODY( Expression, node ); -
src/Concurrency/Keywords.cc
r193bba0 rafce1cf 19 19 #include <string> // for string, operator== 20 20 21 #include "Common/PassVisitor.h" // for PassVisitor 21 22 #include "Common/SemanticError.h" // for SemanticError 22 23 #include "Common/utility.h" // for deleteAll, map_range … … 46 47 47 48 //============================================================================================= 48 // Visitors declaration49 // Pass declarations 49 50 //============================================================================================= 50 51 … … 58 59 // static inline NewField_t * getter_name( MyType * this ) { return &this->newField; } 59 60 // 60 class ConcurrentSueKeyword : public Visitor { 61 protected: 62 template< typename Visitor > 63 friend void SymTab::acceptAndAdd( std::list< Declaration * > &translationUnit, Visitor &visitor ); 61 class ConcurrentSueKeyword : public WithDeclsToAdd { 64 62 public: 65 63 … … 69 67 virtual ~ConcurrentSueKeyword() {} 70 68 71 using Visitor::visit; 72 virtual void visit( StructDecl * decl ) override final; 69 void postvisit( StructDecl * decl ); 73 70 74 71 void handle( StructDecl * ); … … 86 83 bool needs_main; 87 84 88 std::list< Declaration * > declsToAdd, declsToAddAfter;89 85 StructDecl* type_decl = nullptr; 90 86 }; … … 117 113 118 114 static void implement( std::list< Declaration * > & translationUnit ) { 119 ThreadKeywordimpl;120 SymTab::acceptAndAdd( translationUnit, impl );115 PassVisitor< ThreadKeyword > impl; 116 acceptAll( translationUnit, impl ); 121 117 } 122 118 }; … … 148 144 149 145 static void implement( std::list< Declaration * > & translationUnit ) { 150 CoroutineKeywordimpl;151 SymTab::acceptAndAdd( translationUnit, impl );146 PassVisitor< CoroutineKeyword > impl; 147 acceptAll( translationUnit, impl ); 152 148 } 153 149 }; … … 179 175 180 176 static void implement( std::list< Declaration * > & translationUnit ) { 181 MonitorKeywordimpl;182 SymTab::acceptAndAdd( translationUnit, impl );177 PassVisitor< MonitorKeyword > impl; 178 acceptAll( translationUnit, impl ); 183 179 } 184 180 }; … … 192 188 // } } 193 189 // 194 class MutexKeyword final : public Visitor{190 class MutexKeyword final { 195 191 public: 196 192 197 using Visitor::visit; 198 virtual void visit( FunctionDecl * decl ) override final; 199 virtual void visit( StructDecl * decl ) override final; 193 void postvisit( FunctionDecl * decl ); 194 void postvisit( StructDecl * decl ); 200 195 201 196 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* ); … … 204 199 205 200 static void implement( std::list< Declaration * > & translationUnit ) { 206 MutexKeywordimpl;201 PassVisitor< MutexKeyword > impl; 207 202 acceptAll( translationUnit, impl ); 208 203 } … … 230 225 // } } 231 226 // 232 class ThreadStarter final : public Visitor{227 class ThreadStarter final { 233 228 public: 234 229 235 using Visitor::visit; 236 virtual void visit( FunctionDecl * decl ) override final; 230 void postvisit( FunctionDecl * decl ); 237 231 238 232 void addStartStatement( FunctionDecl * decl, DeclarationWithType * param ); 239 233 240 234 static void implement( std::list< Declaration * > & translationUnit ) { 241 ThreadStarterimpl;235 PassVisitor< ThreadStarter > impl; 242 236 acceptAll( translationUnit, impl ); 243 237 } … … 264 258 // Generic keyword implementation 265 259 //============================================================================================= 266 void ConcurrentSueKeyword::visit(StructDecl * decl) { 267 Visitor::visit(decl); 260 void ConcurrentSueKeyword::postvisit(StructDecl * decl) { 268 261 if( decl->get_name() == type_name && decl->has_body() ) { 269 262 assert( !type_decl ); … … 353 346 } 354 347 355 declsToAdd .push_back( forward );356 if( needs_main ) declsToAdd .push_back( main_decl );357 declsToAdd .push_back( get_decl );348 declsToAddBefore.push_back( forward ); 349 if( needs_main ) declsToAddBefore.push_back( main_decl ); 350 declsToAddBefore.push_back( get_decl ); 358 351 359 352 return get_decl; … … 405 398 //============================================================================================= 406 399 407 void MutexKeyword::visit(FunctionDecl* decl) { 408 Visitor::visit(decl); 400 void MutexKeyword::postvisit(FunctionDecl* decl) { 409 401 410 402 std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl ); … … 424 416 } 425 417 426 void MutexKeyword::visit(StructDecl* decl) { 427 Visitor::visit(decl); 418 void MutexKeyword::postvisit(StructDecl* decl) { 428 419 429 420 if( decl->get_name() == "monitor_desc" ) { … … 532 523 // General entry routine 533 524 //============================================================================================= 534 void ThreadStarter::visit(FunctionDecl * decl) { 535 Visitor::visit(decl); 536 525 void ThreadStarter::postvisit(FunctionDecl * decl) { 537 526 if( ! CodeGen::isConstructor(decl->get_name()) ) return; 538 527 -
src/Parser/StatementNode.cc
r193bba0 rafce1cf 212 212 WaitForStmt::Target target; 213 213 target.function = maybeBuild<Expression>( targetExpr ); 214 buildMoveList< Expression >( targetExpr, target.arguments ); 214 215 ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() ); 216 targetExpr->set_next( nullptr ); 217 buildMoveList< Expression >( next, target.arguments ); 218 215 219 delete targetExpr; 216 220 … … 226 230 WaitForStmt * build_waitfor( ExpressionNode * targetExpr, StatementNode * stmt, ExpressionNode * when, WaitForStmt * node ) { 227 231 WaitForStmt::Target target; 228 229 232 target.function = maybeBuild<Expression>( targetExpr ); 230 buildMoveList< Expression >( targetExpr, target.arguments ); 233 234 ExpressionNode * next = dynamic_cast<ExpressionNode *>( targetExpr->get_next() ); 235 targetExpr->set_next( nullptr ); 236 buildMoveList< Expression >( next, target.arguments ); 237 231 238 delete targetExpr; 232 239
Note: See TracChangeset
for help on using the changeset viewer.