Changeset 8f6dfe7
- Timestamp:
- Aug 17, 2017, 5:22:30 PM (8 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:
- 274ce8c
- Parents:
- e9145a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/ExceptTranslate.cc
re9145a3 r8f6dfe7 10 10 // Created On : Wed Jun 14 16:49:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Aug 17 1 5:48:00 201713 // Update Count : 812 // Last Modified On : Thr Aug 17 17:19:00 2017 13 // Update Count : 9 14 14 // 15 15 … … 166 166 /*bitfieldWidth*/ NULL, 167 167 new BasicType( noQualifiers, BasicType::Bool ), 168 /*init*/ NULL 168 /*init*/ NULL, 169 std::list<Attribute *>{ new Attribute( "unused" ) } 169 170 ); 170 171 ObjectDecl voidptr_obj( … … 183 184 ); 184 185 186 ObjectDecl * unused_index_obj = index_obj.clone(); 187 unused_index_obj->attributes.push_back( new Attribute( "unused" ) ); 188 185 189 catch_func_t.get_parameters().push_back( index_obj.clone() ); 186 190 catch_func_t.get_parameters().push_back( exception_obj.clone() ); 187 match_func_t.get_returnVals().push_back( index_obj.clone());191 match_func_t.get_returnVals().push_back( unused_index_obj ); 188 192 match_func_t.get_parameters().push_back( exception_obj.clone() ); 189 193 handle_func_t.get_returnVals().push_back( bool_obj.clone() ); … … 387 391 } 388 392 389 // TODO: Stoping the function from generating the 'return variable'390 // entirely would be cleaner. But this does get ride of warnings.391 CompoundStmt * set_and_ret(DeclarationWithType * var, Expression * val) {392 CompoundStmt * block = new CompoundStmt( noLabels );393 block->push_back( new ExprStmt( noLabels,394 UntypedExpr::createAssign( new VariableExpr( var ), val )395 ) );396 block->push_back( new ReturnStmt( noLabels,397 new VariableExpr( var )398 ) );399 return block;400 }401 402 393 FunctionDecl * ExceptionMutatorCore::create_terminate_match( 403 394 CatchList &handlers ) { … … 410 401 FunctionType * func_type = match_func_t.clone(); 411 402 DeclarationWithType * except_obj = func_type->get_parameters().back(); 412 DeclarationWithType * index_obj = func_type->get_returnVals().front();413 403 414 404 // Index 1..{number of handlers} … … 423 413 424 414 // Create new body. 425 handler->set_body( set_and_ret( index_obj,415 handler->set_body( new ReturnStmt( noLabels, 426 416 new ConstantExpr( Constant::from_int( index ) ) ) ); 427 417 … … 431 421 } 432 422 433 body->push_back( set_and_ret( index_obj,423 body->push_back( new ReturnStmt( noLabels, 434 424 new ConstantExpr( Constant::from_int( 0 ) ) ) ); 435 425 … … 465 455 FunctionType * func_type = handle_func_t.clone(); 466 456 DeclarationWithType * except_obj = func_type->get_parameters().back(); 467 DeclarationWithType * bool_obj = func_type->get_returnVals().front();468 457 469 458 CatchList::iterator it; … … 478 467 handling_code->push_back( handler->get_body() ); 479 468 } 480 handling_code->push_back( set_and_ret( bool_obj,469 handling_code->push_back( new ReturnStmt( noLabels, 481 470 new ConstantExpr( Constant::from_bool( true ) ) ) ); 482 471 handler->set_body( handling_code ); … … 487 476 } 488 477 489 body->push_back( set_and_ret( bool_obj,478 body->push_back( new ReturnStmt( noLabels, 490 479 new ConstantExpr( Constant::from_bool( false ) ) ) ); 491 480
Note: See TracChangeset
for help on using the changeset viewer.