Changeset 69c5c00 for src/Concurrency/Keywords.cc
- Timestamp:
- Oct 7, 2020, 6:08:35 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 6fbe9a5
- Parents:
- 41b8ea4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Concurrency/Keywords.cc
r41b8ea4 r69c5c00 66 66 bool needs_main, AggregateDecl::Aggregate cast_target ) : 67 67 type_name( type_name ), field_name( field_name ), getter_name( getter_name ), 68 context_error( context_error ), vtable_name( getVTableName( exception_name ) ), 68 context_error( context_error ), exception_name( exception_name ), 69 vtable_name( getVTableName( exception_name ) ), 69 70 needs_main( needs_main ), cast_target( cast_target ) {} 70 71 … … 89 90 const std::string getter_name; 90 91 const std::string context_error; 92 const std::string exception_name; 91 93 const std::string vtable_name; 92 94 bool needs_main; … … 95 97 StructDecl * type_decl = nullptr; 96 98 FunctionDecl * dtor_decl = nullptr; 99 StructDecl * except_decl = nullptr; 97 100 StructDecl * vtable_decl = nullptr; 98 101 }; … … 376 379 else if ( is_target(decl) ) { 377 380 handle( decl ); 381 } 382 else if ( !except_decl && exception_name == decl->name && decl->body ) { 383 except_decl = decl; 378 384 } 379 385 else if ( !vtable_decl && vtable_name == decl->name && decl->body ) { … … 398 404 assert( struct_type ); 399 405 400 declsToAddAfter.push_back( Virtual::makeVtableInstance( vtable_decl, { 401 new TypeExpr( struct_type->clone() ), 402 }, struct_type, nullptr ) ); 406 std::list< Expression * > poly_args = { new TypeExpr( struct_type->clone() ) }; 407 ObjectDecl * vtable_object = Virtual::makeVtableInstance( 408 vtable_decl->makeInst( poly_args ), struct_type, nullptr ); 409 declsToAddAfter.push_back( vtable_object ); 410 declsToAddAfter.push_back( Virtual::makeGetExceptionFunction( 411 vtable_object, except_decl->makeInst( std::move( poly_args ) ) 412 ) ); 403 413 } 404 414 … … 434 444 void ConcurrentSueKeyword::addVtableForward( StructDecl * decl ) { 435 445 if ( vtable_decl ) { 436 declsToAddBefore.push_back( Virtual::makeVtableForward( vtable_decl,{446 std::list< Expression * > poly_args = { 437 447 new TypeExpr( new StructInstType( noQualifiers, decl ) ), 438 } ) ); 448 }; 449 declsToAddBefore.push_back( Virtual::makeGetExceptionForward( 450 vtable_decl->makeInst( poly_args ), 451 except_decl->makeInst( poly_args ) 452 ) ); 453 declsToAddBefore.push_back( Virtual::makeVtableForward( 454 vtable_decl->makeInst( move( poly_args ) ) ) ); 439 455 // Its only an error if we want a vtable and don't have one. 440 456 } else if ( ! vtable_name.empty() ) {
Note: See TracChangeset
for help on using the changeset viewer.