Changeset 1cb758f2 for src/Concurrency
- Timestamp:
- Aug 27, 2017, 11:26:26 AM (8 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, stuck-waitfor-destruct, with_gc
- Children:
- 111a8af8, 26238c1, 7ee1e2f6
- Parents:
- 0c6596f (diff), eca3d10a (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. - File:
-
- 1 edited
-
src/Concurrency/Keywords.cc (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r0c6596f r1cb758f2 201 201 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* ); 202 202 void validate( DeclarationWithType * ); 203 void addStatments( CompoundStmt *, const std::list<DeclarationWithType * > &);203 void addStatments( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &); 204 204 205 205 static void implement( std::list< Declaration * > & translationUnit ) { … … 211 211 StructDecl* monitor_decl = nullptr; 212 212 StructDecl* guard_decl = nullptr; 213 214 static std::unique_ptr< Type > generic_func; 213 215 }; 216 217 std::unique_ptr< Type > MutexKeyword::generic_func = std::unique_ptr< Type >( 218 new FunctionType( 219 noQualifiers, 220 true 221 ) 222 ); 214 223 215 224 //----------------------------------------------------------------------------- … … 395 404 // Mutex keyword implementation 396 405 //============================================================================================= 406 397 407 void MutexKeyword::visit(FunctionDecl* decl) { 398 408 Visitor::visit(decl); … … 411 421 if( !guard_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl ); 412 422 413 addStatments( body, mutexArgs );423 addStatments( decl, body, mutexArgs ); 414 424 } 415 425 … … 458 468 } 459 469 460 void MutexKeyword::addStatments( CompoundStmt * body, const std::list<DeclarationWithType * > & args ) {470 void MutexKeyword::addStatments( FunctionDecl* func, CompoundStmt * body, const std::list<DeclarationWithType * > & args ) { 461 471 ObjectDecl * monitors = new ObjectDecl( 462 472 "__monitors", … … 489 499 ); 490 500 501 assert(generic_func); 502 491 503 //in reverse order : 492 // monitor_guard_t __guard = { __monitors, # };504 // monitor_guard_t __guard = { __monitors, #, func }; 493 505 body->push_front( 494 506 new DeclStmt( noLabels, new ObjectDecl( … … 504 516 { 505 517 new SingleInit( new VariableExpr( monitors ) ), 506 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) ) 518 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) ), 519 new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone() ) ) 507 520 }, 508 521 noDesignators,
Note:
See TracChangeset
for help on using the changeset viewer.