Changeset 4a79e3c


Ignore:
Timestamp:
Jan 22, 2016, 11:42:32 AM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
32805db
Parents:
4ef7506
Message:

Fix offset temporary array generation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r4ef7506 r4a79e3c  
    370370
    371371                Expression *Pass1::makeOffsetArray( StructInstType *ty ) {
     372                        std::list< Declaration* > &baseMembers = ty->get_baseStruct()->get_members();
     373                       
    372374                        // make a new temporary array
    373375                        Type *offsetType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
    374                         ObjectDecl *arrayTemp = makeTemporary( new PointerType( Type::Qualifiers(), offsetType ) );
     376                        std::stringstream lenGen;
     377                        lenGen << baseMembers.size();
     378                        ConstantExpr *lenExpr = new ConstantExpr( Constant( offsetType->clone(), lenGen.str() ) );
     379                        ObjectDecl *arrayTemp = makeTemporary( new ArrayType( Type::Qualifiers(), offsetType, lenExpr, false, false ) );
    375380
    376381                        // build initializer list for temporary
    377382                        std::list< Initializer* > inits;
    378                         StructDecl *tyBase = ty->get_baseStruct();
    379                         for ( std::list< Declaration* >::const_iterator member = tyBase->get_members().begin(); member != tyBase->get_members().end(); ++member ) {
     383                        for ( std::list< Declaration* >::const_iterator member = baseMembers.begin(); member != baseMembers.end(); ++member ) {
    380384                                DeclarationWithType *memberDecl;
    381385                                if ( DeclarationWithType *origMember = dynamic_cast< DeclarationWithType* >( *member ) ) {
Note: See TracChangeset for help on using the changeset viewer.