Changeset 01aeade for translator/GenPoly/ScrubTyVars.h
- Timestamp:
- May 19, 2015, 7:57:09 AM (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:
- a08ba92
- Parents:
- 51587aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/GenPoly/ScrubTyVars.h
r51587aa r01aeade 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // XXX.cc--7 // ScrubTyVars.h -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : 12 // Last Modified On : 13 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 07:48:14 2015 13 // Update Count : 1 14 14 // 15 #ifndef GENPOLY_SCRUBTYVARS_H 16 #define GENPOLY_SCRUBTYVARS_H 15 16 #ifndef _SCRUBTYVARS_H 17 #define _SCRUBTYVARS_H 17 18 18 19 #include "GenPoly.h" … … 22 23 23 24 namespace GenPoly { 24 25 26 ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}25 class ScrubTyVars : public Mutator { 26 public: 27 ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {} 27 28 29 template< typename SynTreeClass > 30 static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars ); 31 template< typename SynTreeClass > 32 static SynTreeClass *scrub( SynTreeClass *target ); 33 34 virtual Type* mutate( TypeInstType *typeInst ); 35 Expression* mutate( SizeofExpr *szeof ); 36 virtual Type* mutate( PointerType *pointer ); 37 private: 38 bool doAll; 39 const TyVarMap &tyVars; 40 }; 41 42 /* static class method */ 28 43 template< typename SynTreeClass > 29 static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars ); 44 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) { 45 ScrubTyVars scrubber( false, tyVars ); 46 return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) ); 47 } 48 49 /* static class method */ 30 50 template< typename SynTreeClass > 31 static SynTreeClass *scrub( SynTreeClass *target ); 32 33 virtual Type* mutate( TypeInstType *typeInst ); 34 Expression* mutate( SizeofExpr *szeof ); 35 virtual Type* mutate( PointerType *pointer ); 36 private: 37 bool doAll; 38 const TyVarMap &tyVars; 39 }; 40 41 /* static class method */ 42 template< typename SynTreeClass > 43 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) { 44 ScrubTyVars scrubber( false, tyVars ); 45 return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) ); 46 } 47 48 /* static class method */ 49 template< typename SynTreeClass > 50 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) { 51 TyVarMap tyVars; 52 ScrubTyVars scrubber( true, tyVars ); 53 return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) ); 54 } 51 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) { 52 TyVarMap tyVars; 53 ScrubTyVars scrubber( true, tyVars ); 54 return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) ); 55 } 55 56 } // namespace GenPoly 56 57 57 #endif // GENPOLY_SCRUBTYVARS_H 58 #endif // _SCRUBTYVARS_H 59 58 60 // Local Variables: // 59 61 // tab-width: 4 //
Note: See TracChangeset
for help on using the changeset viewer.