Changeset 56f519b for src/Concurrency
- Timestamp:
- Dec 1, 2021, 11:48:34 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 1894e03
- Parents:
- f27331c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/KeywordsNew.cpp
rf27331c r56f519b 10 10 // Created On : Tue Nov 16 9:53:00 2021 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Nov 30 11:04:00 202113 // Update Count : 012 // Last Modified On : Wed Dec 1 11:24:00 2021 13 // Update Count : 1 14 14 // 15 15 … … 42 42 const ast::Stmt * postvisit( const ast::MutexStmt * stmt ); 43 43 44 st d::vector<const ast::DeclWithType *> findMutexArgs(44 static std::vector<const ast::DeclWithType *> findMutexArgs( 45 45 const ast::FunctionDecl * decl, bool & first ); 46 void validate( const ast::DeclWithType * decl ); 46 static void validate( const ast::DeclWithType * decl ); 47 47 48 ast::CompoundStmt * addDtorStatements( const ast::FunctionDecl* func, const ast::CompoundStmt *, const std::vector<const ast::DeclWithType *> &); 48 49 ast::CompoundStmt * addStatements( const ast::FunctionDecl* func, const ast::CompoundStmt *, const std::vector<const ast::DeclWithType *> &); … … 50 51 ast::CompoundStmt * addThreadDtorStatements( const ast::FunctionDecl* func, const ast::CompoundStmt * body, const std::vector<const ast::DeclWithType *> & args ); 51 52 52 p ublic:53 private: 53 54 const ast::StructDecl * monitor_decl = nullptr; 54 55 const ast::StructDecl * guard_decl = nullptr; … … 98 99 99 100 // Monitors can't be constructed with mutual exclusion. 100 if ( CodeGen::isConstructor( decl->name ) && !is_first_argument_mutex ) {101 SemanticError( decl, "constructors cannot have mutex parameters " );101 if ( CodeGen::isConstructor( decl->name ) && is_first_argument_mutex ) { 102 SemanticError( decl, "constructors cannot have mutex parameters\n" ); 102 103 } 103 104 104 105 // It makes no sense to have multiple mutex parameters for the destructor. 105 106 if ( isDtor && mutexArgs.size() != 1 ) { 106 SemanticError( decl, "destructors can only have 1 mutex argument " );107 SemanticError( decl, "destructors can only have 1 mutex argument\n" ); 107 108 } 108 109 … … 172 173 for ( auto arg : decl->params ) { 173 174 const ast::Type * type = arg->get_type(); 174 if ( !type->is_mutex() ) continue; 175 176 if ( once ) { 177 first = true; 178 once = false; 175 if ( type->is_mutex() ) { 176 if ( once ) first = true; 177 mutexArgs.push_back( arg.get() ); 179 178 } 180 181 mutexArgs.push_back( arg.get() ); 179 once = false; 182 180 } 183 181 return mutexArgs;
Note: See TracChangeset
for help on using the changeset viewer.