Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/ExceptTranslate.cc

    r8f6dfe7 rcbce272  
    1010// Created On       : Wed Jun 14 16:49:00 2017
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Aug 17 17:19:00 2017
    13 // Update Count     : 9
     12// Last Modified On : Tus Aug  8 16:54:00 2017
     13// Update Count     : 7
    1414//
    1515
    1616#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"
    3824
    3925namespace ControlStruct {
     
    166152                        /*bitfieldWidth*/ NULL,
    167153                        new BasicType( noQualifiers, BasicType::Bool ),
    168                         /*init*/ NULL,
    169                         std::list<Attribute *>{ new Attribute( "unused" ) }
     154                        /*init*/ NULL
    170155                        );
    171156                ObjectDecl voidptr_obj(
     
    184169                        );
    185170
    186                 ObjectDecl * unused_index_obj = index_obj.clone();
    187                 unused_index_obj->attributes.push_back( new Attribute( "unused" ) );
    188 
    189171                catch_func_t.get_parameters().push_back( index_obj.clone() );
    190172                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() );
    192174                match_func_t.get_parameters().push_back( exception_obj.clone() );
    193175                handle_func_t.get_returnVals().push_back( bool_obj.clone() );
     
    421403                }
    422404
    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 ) ) ) );
    425407
    426408                return new FunctionDecl("match", Type::StorageClasses(),
     
    453435                CompoundStmt * body = new CompoundStmt( noLabels );
    454436
    455                 FunctionType * func_type = handle_func_t.clone();
     437                FunctionType * func_type = match_func_t.clone();
    456438                DeclarationWithType * except_obj = func_type->get_parameters().back();
    457439
     
    476458                }
    477459
    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 ) ) ) );
    480462
    481463                return new FunctionDecl("handle", Type::StorageClasses(),
Note: See TracChangeset for help on using the changeset viewer.