source: translator/GenPoly/ScrubTyVars.h @ 51587aa

aaron-thesisarm-ehcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 51587aa was 51587aa, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

licencing: fourth 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// XXX.cc --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By :
12// Last Modified On :
13// Update Count     : 0
14//
15#ifndef GENPOLY_SCRUBTYVARS_H
16#define GENPOLY_SCRUBTYVARS_H
17
18#include "GenPoly.h"
19
20#include "SynTree/SynTree.h"
21#include "SynTree/Mutator.h"
22
23namespace GenPoly {
24    class ScrubTyVars : public Mutator {
25      public:
26        ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
27 
28        template< typename SynTreeClass >
29        static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
30        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    }
55} // namespace GenPoly
56
57#endif // GENPOLY_SCRUBTYVARS_H
58// Local Variables: //
59// tab-width: 4 //
60// mode: c++ //
61// compile-command: "make install" //
62// End: //
Note: See TracBrowser for help on using the repository browser.