Changes in src/GenPoly/ScrubTyVars.h [ebe9b3a:843054c2]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/ScrubTyVars.h
rebe9b3a r843054c2 17 17 #define _SCRUBTYVARS_H 18 18 19 #include <string>20 21 19 #include "GenPoly.h" 22 20 … … 27 25 class ScrubTyVars : public Mutator { 28 26 public: 29 ScrubTyVars( const TyVarMap &tyVars ): tyVars( tyVars ) {} 30 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 27 ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {} 28 33 29 template< typename SynTreeClass > 34 30 static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars ); 35 31 template< typename SynTreeClass > 32 static SynTreeClass *scrub( SynTreeClass *target ); 33 36 34 virtual Type* mutate( TypeInstType *typeInst ); 37 virtual Type* mutate( StructInstType *structInst ); 38 virtual Type* mutate( UnionInstType *unionInst ); 39 virtual Expression* mutate( SizeofExpr *szeof ); 40 virtual Expression* mutate( AlignofExpr *algnof ); 35 Expression* mutate( SizeofExpr *szeof ); 41 36 virtual Type* mutate( PointerType *pointer ); 42 43 37 private: 44 /// Mutates (possibly generic) aggregate types appropriately 45 Type* mutateAggregateType( Type *ty ); 46 38 bool doAll; 47 39 const TyVarMap &tyVars; 48 40 }; … … 51 43 template< typename SynTreeClass > 52 44 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) { 53 ScrubTyVars scrubber( tyVars );45 ScrubTyVars scrubber( false, tyVars ); 54 46 return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) ); 55 47 } 56 48 49 /* static class method */ 50 template< typename SynTreeClass > 51 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) { 52 TyVarMap tyVars; 53 ScrubTyVars scrubber( true, tyVars ); 54 return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) ); 55 } 57 56 } // namespace GenPoly 58 57
Note:
See TracChangeset
for help on using the changeset viewer.