- File:
-
- 1 edited
-
src/ControlStruct/ExceptTranslate.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/ExceptTranslate.cc
r8f6dfe7 rcbce272 10 10 // Created On : Wed Jun 14 16:49:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : T hr Aug 17 17:19:00 201713 // Update Count : 912 // Last Modified On : Tus Aug 8 16:54:00 2017 13 // Update Count : 7 14 14 // 15 15 16 16 #include "ExceptTranslate.h" 17 18 #include <stddef.h> // for NULL 19 #include <cassert> // for assert, assertf 20 #include <iterator> // for back_inserter, inserter 21 #include <string> // for string, operator== 22 23 #include "Common/PassVisitor.h" // for PassVisitor, WithGuards 24 #include "Common/SemanticError.h" // for SemanticError 25 #include "Common/utility.h" // for CodeLocation 26 #include "Parser/LinkageSpec.h" // for Cforall 27 #include "SynTree/Attribute.h" // for Attribute 28 #include "SynTree/Constant.h" // for Constant 29 #include "SynTree/Declaration.h" // for ObjectDecl, FunctionDecl, Struc... 30 #include "SynTree/Expression.h" // for UntypedExpr, ConstantExpr, Name... 31 #include "SynTree/Initializer.h" // for SingleInit, ListInit 32 #include "SynTree/Label.h" // for Label, noLabels 33 #include "SynTree/Mutator.h" // for mutateAll 34 #include "SynTree/Statement.h" // for CompoundStmt, CatchStmt, ThrowStmt 35 #include "SynTree/Type.h" // for FunctionType, Type, noQualifiers 36 #include "SynTree/VarExprReplacer.h" // for VarExprReplacer, VarExprReplace... 37 #include "SynTree/Visitor.h" // for acceptAll 17 #include "Common/PassVisitor.h" 18 #include "SynTree/Statement.h" 19 #include "SynTree/Declaration.h" 20 #include "SynTree/Expression.h" 21 #include "SynTree/Type.h" 22 #include "SynTree/Attribute.h" 23 #include "SynTree/VarExprReplacer.h" 38 24 39 25 namespace ControlStruct { … … 166 152 /*bitfieldWidth*/ NULL, 167 153 new BasicType( noQualifiers, BasicType::Bool ), 168 /*init*/ NULL, 169 std::list<Attribute *>{ new Attribute( "unused" ) } 154 /*init*/ NULL 170 155 ); 171 156 ObjectDecl voidptr_obj( … … 184 169 ); 185 170 186 ObjectDecl * unused_index_obj = index_obj.clone();187 unused_index_obj->attributes.push_back( new Attribute( "unused" ) );188 189 171 catch_func_t.get_parameters().push_back( index_obj.clone() ); 190 172 catch_func_t.get_parameters().push_back( exception_obj.clone() ); 191 match_func_t.get_returnVals().push_back( unused_index_obj);173 match_func_t.get_returnVals().push_back( index_obj.clone() ); 192 174 match_func_t.get_parameters().push_back( exception_obj.clone() ); 193 175 handle_func_t.get_returnVals().push_back( bool_obj.clone() ); … … 421 403 } 422 404 423 body->push_back( new ReturnStmt( noLabels, 424 new ConstantExpr(Constant::from_int( 0 ) ) ) );405 body->push_back( new ReturnStmt( noLabels, new ConstantExpr( 406 Constant::from_int( 0 ) ) ) ); 425 407 426 408 return new FunctionDecl("match", Type::StorageClasses(), … … 453 435 CompoundStmt * body = new CompoundStmt( noLabels ); 454 436 455 FunctionType * func_type = handle_func_t.clone();437 FunctionType * func_type = match_func_t.clone(); 456 438 DeclarationWithType * except_obj = func_type->get_parameters().back(); 457 439 … … 476 458 } 477 459 478 body->push_back( new ReturnStmt( noLabels, 479 new ConstantExpr(Constant::from_bool( false ) ) ) );460 body->push_back( new ReturnStmt( noLabels, new ConstantExpr( 461 Constant::from_bool( false ) ) ) ); 480 462 481 463 return new FunctionDecl("handle", Type::StorageClasses(),
Note:
See TracChangeset
for help on using the changeset viewer.