source: src/GenPoly/ScrubTyVars.h @ f8b961b

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 f8b961b was f8b961b, checked in by Aaron Moss <a3moss@…>, 8 years ago

Documentation improvements

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[51587aa]1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
[01aeade]7// ScrubTyVars.h --
[51587aa]8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
[01aeade]11// Last Modified By : Peter A. Buhr
12// Last Modified On : Tue May 19 07:48:14 2015
13// Update Count     : 1
[51587aa]14//
[01aeade]15
16#ifndef _SCRUBTYVARS_H
17#define _SCRUBTYVARS_H
[51b7345]18
19#include "GenPoly.h"
20
21#include "SynTree/SynTree.h"
22#include "SynTree/Mutator.h"
23
24namespace GenPoly {
[01aeade]25        class ScrubTyVars : public Mutator {
26          public:
27                ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
[f8b961b]28
29                /// Like scrub( SynTreeClass* ), but only applies to type variables in `tyVars`
[01aeade]30                template< typename SynTreeClass >
31                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
[f8b961b]32                /// Replaces dtypes and ftypes with the appropriate void type, and sizeof expressions of polymorphic types with the proper variable
[01aeade]33                template< typename SynTreeClass >
34                static SynTreeClass *scrub( SynTreeClass *target );
[51b7345]35 
[01aeade]36                virtual Type* mutate( TypeInstType *typeInst );
37                Expression* mutate( SizeofExpr *szeof );
38                virtual Type* mutate( PointerType *pointer );
39          private:
40                bool doAll;
41                const TyVarMap &tyVars;
42        };
43
44        /* static class method */
[bdd516a]45        template< typename SynTreeClass >
[01aeade]46        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
47                ScrubTyVars scrubber( false, tyVars );
48                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
49        }
50
51        /* static class method */
[bdd516a]52        template< typename SynTreeClass >
[01aeade]53        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) {
54                TyVarMap tyVars;
55                ScrubTyVars scrubber( true, tyVars );
56                return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
57        }
[51b7345]58} // namespace GenPoly
59
[01aeade]60#endif // _SCRUBTYVARS_H
61
[51587aa]62// Local Variables: //
63// tab-width: 4 //
64// mode: c++ //
65// compile-command: "make install" //
66// End: //
Note: See TracBrowser for help on using the repository browser.