Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.cc

    radc6781 r3bb195cb  
    4545
    4646        Type * ScrubTyVars::mutateAggregateType( Type *ty ) {
    47                 if ( isPolyType( ty, tyVars ) ) {
     47                if ( shouldScrub( ty ) ) {
    4848                        PointerType *ret = new PointerType( Type::Qualifiers(), new VoidType( ty->get_qualifiers() ) );
    4949                        delete ty;
     
    6363        Expression * ScrubTyVars::mutate( SizeofExpr *szeof ) {
    6464                // sizeof( T ) => _sizeof_T parameter, which is the size of T
    65                 if ( Type *polyType = isPolyType( szeof->get_type() ) ) {
    66                         Expression *expr = new NameExpr( sizeofName( mangleType( polyType ) ) );
     65                if ( Type *dynType = shouldScrub( szeof->get_type() ) ) {
     66                        Expression *expr = new NameExpr( sizeofName( mangleType( dynType ) ) );
    6767                        return expr;
    6868                } else {
     
    7373        Expression * ScrubTyVars::mutate( AlignofExpr *algnof ) {
    7474                // alignof( T ) => _alignof_T parameter, which is the alignment of T
    75                 if ( Type *polyType = isPolyType( algnof->get_type() ) ) {
    76                         Expression *expr = new NameExpr( alignofName( mangleType( polyType ) ) );
     75                if ( Type *dynType = shouldScrub( algnof->get_type() ) ) {
     76                        Expression *expr = new NameExpr( alignofName( mangleType( dynType ) ) );
    7777                        return expr;
    7878                } else {
     
    8282
    8383        Type * ScrubTyVars::mutate( PointerType *pointer ) {
    84                 if ( Type *polyType = isPolyType( pointer->get_base(), tyVars ) ) {
    85                         Type *ret = polyType->acceptMutator( *this );
     84//              // special case of shouldScrub that takes all TypeInstType pointer bases, even if they're not dynamic
     85//              Type *base = pointer->get_base();
     86//              Type *dynType = 0;
     87//              if ( dynamicOnly ) {
     88//                      if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( base ) ) {
     89//                              if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) { dynType = typeInst; }
     90//                      } else {
     91//                              dynType = isDynType( base, tyVars );
     92//                      }
     93//              } else {
     94//                      dynType = isPolyType( base, tyVars );
     95//              }
     96//              if ( dynType ) {
     97                if ( Type *dynType = shouldScrub( pointer->get_base() ) ) {
     98                        Type *ret = dynType->acceptMutator( *this );
    8699                        ret->get_qualifiers() += pointer->get_qualifiers();
    87100                        pointer->set_base( 0 );
Note: See TracChangeset for help on using the changeset viewer.