Changeset b18b0b5 for src


Ignore:
Timestamp:
Jan 12, 2016, 3:36:16 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, 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:
36874e4
Parents:
1cced28
Message:

Replace generic type function parameters with void*

Location:
src/GenPoly
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r1cced28 rb18b0b5  
    492492                        assert( arg );
    493493                        if ( isPolyType( realParam->get_type(), tyVars ) ) {
    494 //     if ( dynamic_cast< PointerType *>( arg->get_type() ) ) {
    495 //       return new CastExpr( new VariableExpr( param ), arg->get_type()->clone() );
    496 //     } else {
    497494                                if ( dynamic_cast<TypeInstType *>(arg->get_type()) == NULL ) {
    498495                                        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
     
    501498                                        return deref;
    502499                                } // if
    503 //     }
    504500                        } // if
    505501                        return new VariableExpr( param );
     
    10361032
    10371033                        // add size/align for generic types to parameter list
    1038                         std::set< std::string > seenTypes; //< sizeofName for generic types we've seen
     1034                        std::set< std::string > seenTypes; // sizeofName for generic types we've seen
    10391035                        for ( std::list< DeclarationWithType* >::const_iterator fnParm = last; fnParm != funcType->get_parameters().end(); ++fnParm ) {
    10401036                                Type *parmType = (*fnParm)->get_type();
  • src/GenPoly/ScrubTyVars.cc

    r1cced28 rb18b0b5  
    4444        }
    4545
     46        Type * ScrubTyVars::mutateAggregateType( Type *ty ) {
     47                if ( doAll ? isPolyType( ty ) : isPolyType( ty, tyVars ) ) {
     48                        PointerType *ret = new PointerType( Type::Qualifiers(), new VoidType( ty->get_qualifiers() ) );
     49                        delete ty;
     50                        return ret;
     51                }
     52                return ty;
     53        }
     54       
     55        Type * ScrubTyVars::mutate( StructInstType *structInst ) {
     56                return mutateAggregateType( structInst );
     57        }
     58
     59        Type * ScrubTyVars::mutate( UnionInstType *unionInst ) {
     60                return mutateAggregateType( unionInst );
     61        }
     62
    4663        Expression * ScrubTyVars::mutate( SizeofExpr *szeof ) {
    4764                // sizeof( T ) => _sizeof_T parameter, which is the size of T
  • src/GenPoly/ScrubTyVars.h

    r1cced28 rb18b0b5  
    3535                template< typename SynTreeClass >
    3636                static SynTreeClass *scrub( SynTreeClass *target );
    37  
     37
    3838                virtual Type* mutate( TypeInstType *typeInst );
    39                 Expression* mutate( SizeofExpr *szeof );
    40                 Expression* mutate( AlignofExpr *algnof );
     39                virtual Type* mutate( StructInstType *structInst );
     40                virtual Type* mutate( UnionInstType *unionInst );
     41                virtual Expression* mutate( SizeofExpr *szeof );
     42                virtual Expression* mutate( AlignofExpr *algnof );
    4143                virtual Type* mutate( PointerType *pointer );
     44
    4245          private:
     46                /// Mutates (possibly generic) aggregate types appropriately
     47                Type* mutateAggregateType( Type *ty );
     48               
    4349                bool doAll;
    4450                const TyVarMap &tyVars;
Note: See TracChangeset for help on using the changeset viewer.