ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 0dd3a2f was
bdd516a,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
fixed sizeof type variable, find lowest cost alternative for sizeof expression, removed unused classes, added compiler flag, remove temporary file for -CFA, formatting
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Rev | Line | |
---|
[51b7345] | 1 | #ifndef GENPOLY_SCRUBTYVARS_H |
---|
| 2 | #define GENPOLY_SCRUBTYVARS_H |
---|
| 3 | |
---|
| 4 | #include "GenPoly.h" |
---|
| 5 | |
---|
| 6 | #include "SynTree/SynTree.h" |
---|
| 7 | #include "SynTree/Mutator.h" |
---|
| 8 | |
---|
| 9 | namespace GenPoly { |
---|
[bdd516a] | 10 | class ScrubTyVars : public Mutator { |
---|
| 11 | public: |
---|
| 12 | ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {} |
---|
[51b7345] | 13 | |
---|
[bdd516a] | 14 | template< typename SynTreeClass > |
---|
| 15 | static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars ); |
---|
| 16 | template< typename SynTreeClass > |
---|
| 17 | static SynTreeClass *scrub( SynTreeClass *target ); |
---|
[51b7345] | 18 | |
---|
[bdd516a] | 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 | }; |
---|
| 26 | |
---|
| 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 | } |
---|
| 33 | |
---|
| 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 | } |
---|
[51b7345] | 41 | } // namespace GenPoly |
---|
| 42 | |
---|
[bdd516a] | 43 | #endif // GENPOLY_SCRUBTYVARS_H |
---|
Note: See
TracBrowser
for help on using the repository browser.