Changeset ebe9b3a


Ignore:
Timestamp:
Jan 12, 2016, 3:56:30 PM (6 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, resolv-new, string, with_gc
Children:
aadc9a4
Parents:
36874e4
Message:

Stripped unused and potentially buggy 'doAll' flag from ScrubTyVars?

Location:
src/GenPoly
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/ScrubTyVars.cc

    r36874e4 rebe9b3a  
    2727        Type * ScrubTyVars::mutate( TypeInstType *typeInst ) {
    2828                TyVarMap::const_iterator tyVar = tyVars.find( typeInst->get_name() );
    29                 if ( doAll || tyVar != tyVars.end() ) {
     29                if ( tyVar != tyVars.end() ) {
    3030                        switch ( tyVar->second ) {
    3131                          case TypeDecl::Any:
     
    4545
    4646        Type * ScrubTyVars::mutateAggregateType( Type *ty ) {
    47                 if ( doAll ? isPolyType( ty ) : isPolyType( ty, tyVars ) ) {
     47                if ( isPolyType( ty, tyVars ) ) {
    4848                        PointerType *ret = new PointerType( Type::Qualifiers(), new VoidType( ty->get_qualifiers() ) );
    4949                        delete ty;
     
    8383        Type * ScrubTyVars::mutate( PointerType *pointer ) {
    8484                if ( TypeInstType *typeInst = dynamic_cast< TypeInstType * >( pointer->get_base() ) ) {
    85                         if ( doAll || tyVars.find( typeInst->get_name() ) != tyVars.end() ) {
     85                        if ( tyVars.find( typeInst->get_name() ) != tyVars.end() ) {
    8686                                Type *ret = mutate( typeInst );
    8787                                ret->get_qualifiers() += pointer->get_qualifiers();
  • src/GenPoly/ScrubTyVars.h

    r36874e4 rebe9b3a  
    2727        class ScrubTyVars : public Mutator {
    2828          public:
    29                 ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
     29                ScrubTyVars( const TyVarMap &tyVars ): tyVars( tyVars ) {}
    3030
    31                 /// Like scrub( SynTreeClass* ), but only applies to type variables in `tyVars`
     31                /// For all polymorphic types with type variables in `tyVars`, replaces generic types, dtypes, and ftypes with the appropriate void type,
     32                /// and sizeof/alignof expressions with the proper variable
    3233                template< typename SynTreeClass >
    3334                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
    34                 /// Replaces dtypes and ftypes with the appropriate void type, and sizeof expressions of polymorphic types with the proper variable
    35                 template< typename SynTreeClass >
    36                 static SynTreeClass *scrub( SynTreeClass *target );
    3735
    3836                virtual Type* mutate( TypeInstType *typeInst );
     
    4745                Type* mutateAggregateType( Type *ty );
    4846               
    49                 bool doAll;
    5047                const TyVarMap &tyVars;
    5148        };
     
    5451        template< typename SynTreeClass >
    5552        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
    56                 ScrubTyVars scrubber( false, tyVars );
     53                ScrubTyVars scrubber( tyVars );
    5754                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
    5855        }
    5956
    60         /* static class method */
    61         template< typename SynTreeClass >
    62         SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) {
    63                 TyVarMap tyVars;
    64                 ScrubTyVars scrubber( true, tyVars );
    65                 return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
    66         }
    6757} // namespace GenPoly
    6858
Note: See TracChangeset for help on using the changeset viewer.