Changeset db4d8e3 for src/Concurrency
- Timestamp:
- May 29, 2018, 11:51:04 AM (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, with_gc
- Children:
- 71e555c
- Parents:
- 1f81d61
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r1f81d61 rdb4d8e3 191 191 void postvisit( StructDecl * decl ); 192 192 193 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* );193 std::list<DeclarationWithType*> findMutexArgs( FunctionDecl*, bool & first ); 194 194 void validate( DeclarationWithType * ); 195 195 void addDtorStatments( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &); … … 441 441 void MutexKeyword::postvisit(FunctionDecl* decl) { 442 442 443 std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl ); 443 bool first = false; 444 std::list<DeclarationWithType*> mutexArgs = findMutexArgs( decl, first ); 444 445 if( mutexArgs.empty() ) return; 445 446 446 if( CodeGen::isConstructor(decl->name) ) SemanticError( decl, "constructors cannot have mutex parameters" );447 if( CodeGen::isConstructor(decl->name) && first ) SemanticError( decl, "constructors cannot have mutex parameters" ); 447 448 448 449 bool isDtor = CodeGen::isDestructor( decl->name ); … … 484 485 } 485 486 486 std::list<DeclarationWithType*> MutexKeyword::findMutexArgs( FunctionDecl* decl ) {487 std::list<DeclarationWithType*> MutexKeyword::findMutexArgs( FunctionDecl* decl, bool & first ) { 487 488 std::list<DeclarationWithType*> mutexArgs; 488 489 490 bool once = true; 489 491 for( auto arg : decl->get_functionType()->get_parameters()) { 490 492 //Find mutex arguments 491 493 Type* ty = arg->get_type(); 492 494 if( ! ty->get_mutex() ) continue; 495 496 if(once) {first = true;} 497 once = false; 493 498 494 499 //Append it to the list
Note: See TracChangeset
for help on using the changeset viewer.