Changeset 2f42718 for src/InitTweak


Ignore:
Timestamp:
Feb 22, 2019, 10:43:29 AM (7 years ago)
Author:
tdelisle <tdelisle@…>
Branches:
no_list
Parents:
43e0949
Message:

Parameters and return value of functions are now vectors (and some related clean-up)

Location:
src/InitTweak
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r43e0949 r2f42718  
    10421042                        if ( checkWarnings( function ) ) {
    10431043                                FunctionType * type = function->get_functionType();
    1044                                 assert( ! type->get_parameters().empty() );
    1045                                 thisParam = strict_dynamic_cast< ObjectDecl * >( type->get_parameters().front() );
     1044                                assert( ! type->parameters.empty() );
     1045                                thisParam = strict_dynamic_cast< ObjectDecl * >( type->parameters.front() );
    10461046                                Type * thisType = getPointerBase( thisParam->get_type() );
    10471047                                StructInstType * structType = dynamic_cast< StructInstType * >( thisType );
     
    10991099                                        if ( isCopyConstructor( function ) ) {
    11001100                                                // if copy ctor, need to pass second-param-of-this-function.field
    1101                                                 std::list< DeclarationWithType * > & params = function->get_functionType()->get_parameters();
     1101                                                auto & params = function->get_functionType()->parameters;
    11021102                                                assert( params.size() == 2 );
    11031103                                                arg2 = new MemberExpr( field, new VariableExpr( params.back() ) );
  • src/InitTweak/GenInit.cc

    r43e0949 r2f42718  
    127127
    128128        void ReturnFixer::premutate( ReturnStmt *returnStmt ) {
    129                 std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals();
     129                auto & returnVals = ftype->returnVals;
    130130                assert( returnVals.size() == 0 || returnVals.size() == 1 );
    131131                // hands off if the function returns a reference - we don't want to allocate a temporary if a variable's address
     
    242242                // if this function is a user-defined constructor or destructor, mark down the type as "managed"
    243243                if ( ! LinkageSpec::isOverridable( dwt->get_linkage() ) && CodeGen::isCtorDtor( dwt->get_name() ) ) {
    244                         std::list< DeclarationWithType * > & params = GenPoly::getFunctionType( dwt->get_type() )->get_parameters();
     244                        auto & params = GenPoly::getFunctionType( dwt->get_type() )->parameters;
    245245                        assert( ! params.empty() );
    246246                        Type * type = InitTweak::getPointerBase( params.front()->get_type() );
     
    335335                // go through assertions and recursively add seen ctor/dtors
    336336                for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) {
    337                         for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) {
     337                        for ( DeclarationWithType *& assertion : tyDecl->assertions ) {
    338338                                managedTypes.handleDWT( assertion );
    339339                        }
  • src/InitTweak/InitTweak.cc

    r43e0949 r2f42718  
    410410                                FunctionType *funcType = GenPoly::getFunctionType( appExpr->function->result );
    411411                                assert( funcType );
    412                                 return funcType->get_parameters().size() == 1;
     412                                return funcType->parameters.size() == 1;
    413413                        }
    414414                        return false;
     
    616616                if ( ftype->parameters.size() != 2 ) return nullptr;
    617617
    618                 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
     618                Type * t1 = getPointerBase( ftype->parameters.front()->get_type() );
    619619                Type * t2 = ftype->parameters.back()->get_type();
    620620                assert( t1 );
Note: See TracChangeset for help on using the changeset viewer.