Changeset ef42b143 for src/Concurrency
- Timestamp:
- Mar 16, 2017, 5:20:16 PM (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, with_gc
- Children:
- 3743983
- Parents:
- 1fbab5a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r1fbab5a ref42b143 111 111 private: 112 112 StructDecl* monitor_decl = nullptr; 113 StructDecl* guard_decl = nullptr; 113 114 }; 114 115 … … 137 138 if( ! body ) return; 138 139 139 assert(monitor_decl);140 140 addStatments( body, mutexArgs ); 141 141 } … … 146 146 monitor_decl = decl; 147 147 } 148 else if( decl->get_name() == "monitor_guard_t" ) { 149 assert( !guard_decl ); 150 guard_decl = decl; 151 } 148 152 } 149 153 … … 175 179 176 180 //Make sure that typed isn't mutex 177 if( !base->get_qualifiers().isMutex ) throw SemanticError( "mutex keyword may only appear once per argument ", arg );181 if( base->get_qualifiers().isMutex ) throw SemanticError( "mutex keyword may only appear once per argument ", arg ); 178 182 } 179 183 180 184 void MutexKeyword::addStatments( CompoundStmt * body, const std::list<DeclarationWithType * > & args ) { 185 assert(monitor_decl); 186 assert(guard_decl); 181 187 182 188 ObjectDecl * monitors = new ObjectDecl( … … 218 224 new StructInstType( 219 225 noQualifiers, 220 "monitor_guard_t"226 guard_decl 221 227 ), 222 228 new ListInit( … … 224 230 new SingleInit( new VariableExpr( monitors ) ), 225 231 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) ) 226 } 232 }, 233 noDesignators, 234 true 227 235 ) 228 236 )) 229 237 ); 230 238 231 //monitor_desc * __monitors[] = { a, b};239 //monitor_desc * __monitors[] = { get_monitor(a), get_monitor(b) }; 232 240 body->push_front( new DeclStmt( noLabels, monitors) ); 233 241 }
Note: See TracChangeset
for help on using the changeset viewer.