source: src/GenPoly/ScrubTyVars.h @ f5234f3

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 f5234f3 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 1.8 KB
Line 
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//
7// ScrubTyVars.h --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Tue May 19 07:48:14 2015
13// Update Count     : 1
14//
15
16#ifndef _SCRUBTYVARS_H
17#define _SCRUBTYVARS_H
18
19#include "GenPoly.h"
20
21#include "SynTree/SynTree.h"
22#include "SynTree/Mutator.h"
23
24namespace GenPoly {
25        class ScrubTyVars : public Mutator {
26          public:
27                ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
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 */
43        template< typename SynTreeClass >
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 */
50        template< typename SynTreeClass >
51        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) {
52                TyVarMap tyVars;
53                ScrubTyVars scrubber( true, tyVars );
54                return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
55        }
56} // namespace GenPoly
57
58#endif // _SCRUBTYVARS_H
59
60// Local Variables: //
61// tab-width: 4 //
62// mode: c++ //
63// compile-command: "make install" //
64// End: //
Note: See TracBrowser for help on using the repository browser.