Changes in src/GenPoly/ScrubTyVars.h [ebe9b3a:ffad73a]
- File:
-
- 1 edited
-
src/GenPoly/ScrubTyVars.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/ScrubTyVars.h
rebe9b3a rffad73a 27 27 class ScrubTyVars : public Mutator { 28 28 public: 29 ScrubTyVars( const TyVarMap &tyVars ):tyVars( tyVars ) {}29 ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {} 30 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 31 /// Like scrub( SynTreeClass* ), but only applies to type variables in `tyVars` 33 32 template< typename SynTreeClass > 34 33 static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars ); 35 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 ); 37 36 38 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 ); 39 Expression* mutate( SizeofExpr *szeof ); 40 Expression* mutate( AlignofExpr *algnof ); 41 41 virtual Type* mutate( PointerType *pointer ); 42 43 42 private: 44 /// Mutates (possibly generic) aggregate types appropriately 45 Type* mutateAggregateType( Type *ty ); 46 43 bool doAll; 47 44 const TyVarMap &tyVars; 48 45 }; … … 51 48 template< typename SynTreeClass > 52 49 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) { 53 ScrubTyVars scrubber( tyVars );50 ScrubTyVars scrubber( false, tyVars ); 54 51 return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) ); 55 52 } 56 53 54 /* static class method */ 55 template< typename SynTreeClass > 56 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) { 57 TyVarMap tyVars; 58 ScrubTyVars scrubber( true, tyVars ); 59 return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) ); 60 } 57 61 } // namespace GenPoly 58 62
Note:
See TracChangeset
for help on using the changeset viewer.