Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    rd7dc824 rd56e5bc  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 13 09:26:38 2017
    13 // Update Count     : 341
     12// Last Modified On : Wed Jun 21 15:49:59 2017
     13// Update Count     : 346
    1414//
    1515
     
    6262namespace GenPoly {
    6363        namespace {
    64                 const std::list<Label> noLabels;
    65 
    6664                FunctionType *makeAdapterType( FunctionType *adaptee, const TyVarMap &tyVars );
    6765
     
    343341        Statement *makeAlignTo( Expression *lhs, Expression *rhs ) {
    344342                // check that the lhs is zeroed out to the level of rhs
    345                 Expression *ifCond = makeOp( "?&?", lhs, makeOp( "?-?", rhs, new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "1" ) ) ) );
     343                Expression *ifCond = makeOp( "?&?", lhs, makeOp( "?-?", rhs, new ConstantExpr( Constant::from_ulong( 1 ) ) ) );
    346344                // if not aligned, increment to alignment
    347345                Expression *ifExpr = makeOp( "?+=?", lhs->clone(), makeOp( "?-?", rhs->clone(), ifCond->clone() ) );
     
    386384
    387385                // initialize size and alignment to 0 and 1 (will have at least one member to re-edit size)
    388                 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "0" ) ) ) );
    389                 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "1" ) ) ) );
     386                addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant::from_ulong( 0 ) ) ) );
     387                addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) );
    390388                unsigned long n_members = 0;
    391389                bool firstMember = true;
     
    443441
    444442                // calculate union layout in function body
    445                 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "1" ) ) ) );
    446                 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "1" ) ) ) );
     443                addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) );
     444                addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant::from_ulong( 1 ) ) ) );
    447445                for ( std::list< Declaration* >::const_iterator member = unionDecl->get_members().begin(); member != unionDecl->get_members().end(); ++member ) {
    448446                        DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member );
     
    15661564                /// Returns an index expression into the offset array for a type
    15671565                Expression *makeOffsetIndex( Type *objectType, long i ) {
    1568                         std::stringstream offset_namer;
    1569                         offset_namer << i;
    1570                         ConstantExpr *fieldIndex = new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), offset_namer.str() ) );
     1566                        ConstantExpr *fieldIndex = new ConstantExpr( Constant::from_ulong( i ) );
    15711567                        UntypedExpr *fieldOffset = new UntypedExpr( new NameExpr( "?[?]" ) );
    15721568                        fieldOffset->get_args().push_back( new NameExpr( offsetofName( mangleType( objectType ) ) ) );
     
    17811777                                // all union members are at offset zero
    17821778                                delete offsetofExpr;
    1783                                 return new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "0" ) );
     1779                                return new ConstantExpr( Constant::from_ulong( 0 ) );
    17841780                        } else return offsetofExpr;
    17851781                }
Note: See TracChangeset for help on using the changeset viewer.