Changeset d60a4c2 for src/ControlStruct
- Timestamp:
- Jan 11, 2025, 5:48:46 PM (9 months ago)
- Branches:
- master
- Children:
- f886608
- Parents:
- 7d65715f (diff), 32a119e9 (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/ControlStruct/ExceptDecl.cpp
r7d65715f rd60a4c2 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ExceptDecl.cpp -- 7 // ExceptDecl.cpp -- Translate "exception" and exception related declarations. 8 8 // 9 9 // Author : Andrew Beach 10 10 // Created On : Tue Jul 12 15:50:00 2022 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Sep 7 12:05:55 202413 // Update Count : 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jan 10 15:35:55 2024 13 // Update Count : 2 14 14 // 15 15 … … 117 117 decl->body = true; 118 118 for ( ast::ptr<ast::TypeDecl> const & param : forallClause ) { 119 decl->params.push_back( ast::deepCopy( param ) ); 119 // Create an unsized and assertionless copy of the parameter. 120 decl->params.push_back( new ast::TypeDecl( 121 param->location, 122 param->name, 123 param->storage, 124 param->base ? ast::deepCopy( param->base ) : nullptr, 125 ast::TypeDecl::Dtype, 126 false, 127 nullptr 128 ) ); 120 129 } 121 130 return decl; … … 445 454 } 446 455 456 ast::NameExpr const * designatedName( ast::Designation const * des ) { 457 if ( des && 1 == des->designators.size() ) { 458 return des->designators.front().as<ast::NameExpr>(); 459 } 460 return nullptr; 461 } 462 447 463 ast::ObjectDecl const * ExceptDeclCore::transformVTable( 448 464 ast::ObjectDecl const * decl, ast::VTableType const * type ) { … … 467 483 createTypeIdValue( location, exceptionName, params ) ); 468 484 } 469 declsToAddBefore.push_back(470 createCopy( location, exceptionName, params ) );471 declsToAddBefore.push_back(472 createMsg( location, exceptionName, params ) );473 485 retDecl = createVirtualTable( 474 486 location, exceptionName, params, tableName ); 487 // There is quite a bit of work to pull over any initializers and 488 // decide if we want to insert the default functions. 489 bool foundCopy = false; 490 bool foundMsg = false; 491 ast::ListInit const * init = decl->init.as<ast::ListInit>(); 492 if ( init ) { 493 for ( size_t i = 0 ; i < init->initializers.size() ; ++i ) { 494 ast::Designation const * des = init->designations.at(i); 495 auto name = designatedName( des ); 496 if ( nullptr == name ) continue; 497 if ( "copy" == name->name ) { 498 foundCopy = true; 499 } else if ( "msg" == name->name ) { 500 foundMsg = true; 501 } 502 auto retInit = retDecl->init.as<ast::ListInit>(); 503 for ( size_t j = 0 ; j < retInit->initializers.size() ; ++j ) { 504 ast::Designation const * des = retInit->designations.at(j); 505 auto retName = designatedName( des ); 506 if ( retName && name->name == retName->name ) { 507 retInit = ast::mutate_field_index( retInit, 508 &ast::ListInit::initializers, j, 509 init->initializers.at(i) ); 510 } 511 } 512 retDecl->init = retInit; 513 } 514 } 515 if ( !foundCopy ) { 516 declsToAddBefore.push_back( 517 createCopy( location, exceptionName, params ) ); 518 } 519 if ( !foundMsg ) { 520 declsToAddBefore.push_back( 521 createMsg( location, exceptionName, params ) ); 522 } 475 523 } 476 524
Note:
See TracChangeset
for help on using the changeset viewer.