Changeset 310e5b7 for src/Concurrency
- Timestamp:
- Sep 14, 2017, 4:26:54 PM (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, resolv-new, with_gc
- Children:
- e149f77
- Parents:
- 1dcd9554
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Waitfor.cc
r1dcd9554 r310e5b7 204 204 return new ConstantExpr( Constant::from_bool( ifnull ) ); 205 205 } 206 207 VariableExpr * extractVariable( Expression * func ) { 208 if( VariableExpr * var = dynamic_cast< VariableExpr * >( func ) ) { 209 return var; 210 } 211 212 CastExpr * cast = strict_dynamic_cast< CastExpr * >( func ); 213 return strict_dynamic_cast< VariableExpr * >( cast->arg ); 214 } 215 216 Expression * betterIsDtor( Expression * func ) { 217 VariableExpr * typed_func = extractVariable( func ); 218 bool is_dtor = InitTweak::isDestructor( typed_func->var ); 219 return new ConstantExpr( Constant::from_bool( is_dtor ) ); 220 } 206 221 }; 207 222 … … 212 227 213 228 void GenerateWaitForPass::premutate( FunctionDecl * decl) { 214 if( decl->name != "__ accept_internal" ) return;229 if( decl->name != "__waitfor_internal" ) return; 215 230 216 231 decl_waitfor = decl; … … 313 328 Type * fptr_t = new PointerType( noQualifiers, new FunctionType( noQualifiers, true ) ); 314 329 330 Expression * is_dtor = betterIsDtor( clause.target.function ); 315 331 CompoundStmt * compound = new CompoundStmt( noLabels ); 316 332 compound->push_back( makeAccStatement( acceptables, index, "func" , new CastExpr( clause.target.function, fptr_t ) , indexer ) ); 317 333 compound->push_back( makeAccStatement( acceptables, index, "count" , new ConstantExpr( Constant::from_ulong( clause.target.arguments.size() ) ), indexer ) ); 318 334 compound->push_back( makeAccStatement( acceptables, index, "monitors", new VariableExpr( monitors ) , indexer ) ); 319 compound->push_back( makeAccStatement( acceptables, index, "is_dtor" , new ConstantExpr( Constant::from_bool( true ) ), indexer ) );335 compound->push_back( makeAccStatement( acceptables, index, "is_dtor" , is_dtor , indexer ) ); 320 336 321 337 stmt->push_back( new IfStmt(
Note: See TracChangeset
for help on using the changeset viewer.