Changeset 7f9968a for src/ControlStruct
- Timestamp:
- Jun 24, 2020, 12:30:42 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 8b58bae
- Parents:
- a8a3485
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/ExceptTranslate.cc
ra8a3485 r7f9968a 10 10 // Created On : Wed Jun 14 16:49:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue May 26 10:56:00 202013 // Update Count : 1 612 // Last Modified On : Wed Jun 24 11:18:00 2020 13 // Update Count : 17 14 14 // 15 15 … … 72 72 ThrowStmt * throwStmt, const char * throwFunc ); 73 73 Statement * create_terminate_rethrow( ThrowStmt * throwStmt ); 74 Statement * create_resume_rethrow( ThrowStmt * throwStmt );75 74 76 75 public: … … 113 112 new UntypedExpr( new NameExpr( "__cfaehm_rethrow_terminate" ) ) 114 113 ) ); 115 delete throwStmt;116 return result;117 }118 119 Statement * ThrowMutatorCore::create_resume_rethrow(120 ThrowStmt *throwStmt ) {121 // return false;122 Statement * result = new ReturnStmt(123 new ConstantExpr( Constant::from_bool( false ) )124 );125 result->labels = throwStmt->labels;126 114 delete throwStmt; 127 115 return result; … … 167 155 return create_either_throw( throwStmt, "$throwResume" ); 168 156 } else if ( ResHandler == cur_context ) { 169 return create_resume_rethrow( throwStmt ); 157 // This has to be handled later. 158 return throwStmt; 170 159 } else { 171 160 abort("Invalid throwResume in %s at %i\n", … … 196 185 FunctionDecl * create_finally_wrapper( TryStmt * tryStmt ); 197 186 ObjectDecl * create_finally_hook( FunctionDecl * finally_wrapper ); 187 Statement * create_resume_rethrow( ThrowStmt * throwStmt ); 198 188 199 189 // Types used in translation, make sure to use clone. … … 227 217 void premutate( StructDecl *structDecl ); 228 218 Statement * postmutate( TryStmt *tryStmt ); 219 Statement * postmutate( ThrowStmt *throwStmt ); 229 220 }; 230 221 … … 594 585 attributes 595 586 ); 587 } 588 589 Statement * TryMutatorCore::create_resume_rethrow( ThrowStmt *throwStmt ) { 590 // return false; 591 Statement * result = new ReturnStmt( 592 new ConstantExpr( Constant::from_bool( false ) ) 593 ); 594 result->labels = throwStmt->labels; 595 delete throwStmt; 596 return result; 596 597 } 597 598 … … 668 669 } 669 670 671 Statement * TryMutatorCore::postmutate( ThrowStmt *throwStmt ) { 672 // Only valid `throwResume;` statements should remain. (2/3 checks) 673 assert( ThrowStmt::Resume == throwStmt->kind && ! throwStmt->expr ); 674 return create_resume_rethrow( throwStmt ); 675 } 676 670 677 void translateThrows( std::list< Declaration *> & translationUnit ) { 671 678 PassVisitor<ThrowMutatorCore> translator;
Note: See TracChangeset
for help on using the changeset viewer.