Changeset d4f1521 for src/Concurrency/Keywords.cc
- Timestamp:
- Nov 27, 2019, 5:04:19 PM (2 years ago)
- Branches:
- arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
- Children:
- 0f9ceacb
- Parents:
- 30763fd (diff), 397c101 (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
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r30763fd rd4f1521 59 59 60 60 Declaration * postmutate( StructDecl * decl ); 61 DeclarationWithType * postmutate( FunctionDecl * decl ); 61 62 62 63 void handle( StructDecl * ); … … 77 78 KeywordCastExpr::Target cast_target; 78 79 79 StructDecl* type_decl = nullptr; 80 StructDecl * type_decl = nullptr; 81 FunctionDecl * dtor_decl = nullptr; 80 82 }; 81 83 … … 97 99 "__thrd", 98 100 "get_thread", 99 "thread keyword requires threads to be in scope, add #include <thread.hfa> ",101 "thread keyword requires threads to be in scope, add #include <thread.hfa>\n", 100 102 true, 101 103 KeywordCastExpr::Thread … … 129 131 "__cor", 130 132 "get_coroutine", 131 "coroutine keyword requires coroutines to be in scope, add #include <coroutine.hfa> ",133 "coroutine keyword requires coroutines to be in scope, add #include <coroutine.hfa>\n", 132 134 true, 133 135 KeywordCastExpr::Coroutine … … 161 163 "__mon", 162 164 "get_monitor", 163 "monitor keyword requires monitors to be in scope, add #include <monitor.hfa> ",165 "monitor keyword requires monitors to be in scope, add #include <monitor.hfa>\n", 164 166 false, 165 167 KeywordCastExpr::Monitor … … 284 286 } 285 287 288 DeclarationWithType * ConcurrentSueKeyword::postmutate( FunctionDecl * decl ) { 289 if( !type_decl ) return decl; 290 if( !CodeGen::isDestructor( decl->name ) ) return decl; 291 292 auto params = decl->type->parameters; 293 if( params.size() != 1 ) return decl; 294 295 auto type = dynamic_cast<ReferenceType*>( params.front()->get_type() ); 296 if( !type ) return decl; 297 298 auto stype = dynamic_cast<StructInstType*>( type->base ); 299 if( !stype ) return decl; 300 if( stype->baseStruct != type_decl ) return decl; 301 302 if( !dtor_decl ) dtor_decl = decl; 303 return decl; 304 } 305 286 306 Expression * ConcurrentSueKeyword::postmutate( KeywordCastExpr * cast ) { 287 307 if ( cast_target == cast->target ) { 288 308 // convert (thread &)t to (thread_desc &)*get_thread(t), etc. 289 309 if( !type_decl ) SemanticError( cast, context_error ); 310 if( !dtor_decl ) SemanticError( cast, context_error ); 290 311 Expression * arg = cast->arg; 291 312 cast->arg = nullptr; … … 308 329 309 330 if( !type_decl ) SemanticError( decl, context_error ); 331 if( !dtor_decl ) SemanticError( decl, context_error ); 310 332 311 333 FunctionDecl * func = forwardDeclare( decl );
Note: See TracChangeset
for help on using the changeset viewer.