Changes in src/Concurrency/Keywords.cc [97e3296:be9288a]
- File:
-
- 1 edited
-
src/Concurrency/Keywords.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r97e3296 rbe9288a 200 200 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* ); 201 201 void validate( DeclarationWithType * ); 202 void addStatments( FunctionDecl* func,CompoundStmt *, const std::list<DeclarationWithType * > &);202 void addStatments( CompoundStmt *, const std::list<DeclarationWithType * > &); 203 203 204 204 static void implement( std::list< Declaration * > & translationUnit ) { … … 210 210 StructDecl* monitor_decl = nullptr; 211 211 StructDecl* guard_decl = nullptr; 212 213 static std::unique_ptr< Type > generic_func;214 212 }; 215 216 std::unique_ptr< Type > MutexKeyword::generic_func = std::unique_ptr< Type >(217 new FunctionType(218 noQualifiers,219 true220 )221 );222 213 223 214 //----------------------------------------------------------------------------- … … 403 394 // Mutex keyword implementation 404 395 //============================================================================================= 405 406 396 void MutexKeyword::visit(FunctionDecl* decl) { 407 397 Visitor::visit(decl); … … 420 410 if( !guard_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl ); 421 411 422 addStatments( decl,body, mutexArgs );412 addStatments( body, mutexArgs ); 423 413 } 424 414 … … 466 456 } 467 457 468 void MutexKeyword::addStatments( FunctionDecl* func,CompoundStmt * body, const std::list<DeclarationWithType * > & args ) {458 void MutexKeyword::addStatments( CompoundStmt * body, const std::list<DeclarationWithType * > & args ) { 469 459 ObjectDecl * monitors = new ObjectDecl( 470 460 "__monitors", … … 497 487 ); 498 488 499 assert(generic_func);500 501 489 //in reverse order : 502 // monitor_guard_t __guard = { __monitors, # , func};490 // monitor_guard_t __guard = { __monitors, # }; 503 491 body->push_front( 504 492 new DeclStmt( noLabels, new ObjectDecl( … … 514 502 { 515 503 new SingleInit( new VariableExpr( monitors ) ), 516 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) ), 517 new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone() ) ) 504 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) ) 518 505 }, 519 506 noDesignators,
Note:
See TracChangeset
for help on using the changeset viewer.