Changeset bdd516a for translator/GenPoly/ScrubTyVars.h
- Timestamp:
- Apr 28, 2015, 4:21:36 PM (9 years ago)
- 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:
- 42e2ad7
- Parents:
- ad17ba6a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/GenPoly/ScrubTyVars.h
rad17ba6a rbdd516a 1 /*2 * This file is part of the Cforall project3 *4 * $Id: ScrubTyVars.h,v 1.4 2005/08/29 20:14:13 rcbilson Exp $5 *6 */7 8 1 #ifndef GENPOLY_SCRUBTYVARS_H 9 2 #define GENPOLY_SCRUBTYVARS_H … … 15 8 16 9 namespace GenPoly { 10 class ScrubTyVars : public Mutator { 11 public: 12 ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {} 13 14 template< typename SynTreeClass > 15 static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars ); 16 template< typename SynTreeClass > 17 static SynTreeClass *scrub( SynTreeClass *target ); 18 19 virtual Type* mutate( TypeInstType *typeInst ); 20 Expression* mutate( SizeofExpr *szeof ); 21 virtual Type* mutate( PointerType *pointer ); 22 private: 23 bool doAll; 24 const TyVarMap &tyVars; 25 }; 17 26 18 class ScrubTyVars : public Mutator 19 { 20 public: 21 ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {} 22 23 template< typename SynTreeClass > 24 static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars ); 25 template< typename SynTreeClass > 26 static SynTreeClass *scrub( SynTreeClass *target ); 27 28 virtual Type* mutate( TypeInstType *typeInst ); 29 virtual Type* mutate( PointerType *pointer ); 27 /* static class method */ 28 template< typename SynTreeClass > 29 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) { 30 ScrubTyVars scrubber( false, tyVars ); 31 return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) ); 32 } 30 33 31 private: 32 bool doAll; 33 const TyVarMap &tyVars; 34 }; 35 36 /* static class method */ 37 template< typename SynTreeClass > 38 SynTreeClass * 39 ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) 40 { 41 ScrubTyVars scrubber( false, tyVars ); 42 return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) ); 43 } 44 45 /* static class method */ 46 template< typename SynTreeClass > 47 SynTreeClass * 48 ScrubTyVars::scrub( SynTreeClass *target ) 49 { 50 TyVarMap tyVars; 51 ScrubTyVars scrubber( true, tyVars ); 52 return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) ); 53 } 54 34 /* static class method */ 35 template< typename SynTreeClass > 36 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) { 37 TyVarMap tyVars; 38 ScrubTyVars scrubber( true, tyVars ); 39 return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) ); 40 } 55 41 } // namespace GenPoly 56 42 57 #endif / * #ifndef GENPOLY_SCRUBTYVARS_H */43 #endif // GENPOLY_SCRUBTYVARS_H
Note: See TracChangeset
for help on using the changeset viewer.