Changeset 27aca84


Ignore:
Timestamp:
Apr 17, 2018, 4:25:10 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
70a5acf
Parents:
c0bf94e
Message:

Mark dtype-static casts as non-generated so they persist until Box

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/InstantiateGeneric.cc

    rc0bf94e r27aca84  
    496496        Expression * FixDtypeStatic::fixMemberExpr( AggrInst * inst, MemberExpr * memberExpr ) {
    497497                // need to cast dtype-static member expressions to their actual type before that type is erased.
     498                // NOTE: the casts here have the third argument (isGenerated) set to false so that these casts persist until Box, where they are needed.
    498499                auto & baseParams = *inst->get_baseParameters();
    499500                if ( isDtypeStatic( baseParams ) ) {
     
    515516                                        // Note: this currently creates more temporaries than is strictly necessary, since it does not check for duplicate uses of the same member expression.
    516517                                        static UniqueName tmpNamer( "_dtype_static_member_" );
    517                                         Expression * init = new CastExpr( new AddressExpr( memberExpr ), new PointerType( Type::Qualifiers(), concType->clone() ) );
     518                                        Expression * init = new CastExpr( new AddressExpr( memberExpr ), new PointerType( Type::Qualifiers(), concType->clone() ), false );
    518519                                        ObjectDecl * tmp = ObjectDecl::newObject( tmpNamer.newName(), new ReferenceType( Type::Qualifiers(), concType ), new SingleInit( init ) );
    519520                                        stmtsToAddBefore.push_back( new DeclStmt( tmp ) );
     
    521522                                } else {
    522523                                        // can simply add a cast to actual type
    523                                         return new CastExpr( memberExpr, concType );
     524                                        return new CastExpr( memberExpr, concType, false );
    524525                                }
    525526                        }
Note: See TracChangeset for help on using the changeset viewer.