source: src/GenPoly/ScrubTyVars.h @ 4389966

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 4389966 was 78dd0da, checked in by Aaron Moss <a3moss@…>, 9 years ago

Switched size/align parameters over to use SymTab::Mangler in preparation for addition of generic types

  • Property mode set to 100644
File size: 2.2 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
[78dd0da]19#include <string>
20
[51b7345]21#include "GenPoly.h"
22
23#include "SynTree/SynTree.h"
24#include "SynTree/Mutator.h"
25
26namespace GenPoly {
[01aeade]27        class ScrubTyVars : public Mutator {
28          public:
29                ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
[f8b961b]30
31                /// Like scrub( SynTreeClass* ), but only applies to type variables in `tyVars`
[01aeade]32                template< typename SynTreeClass >
33                static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
[f8b961b]34                /// Replaces dtypes and ftypes with the appropriate void type, and sizeof expressions of polymorphic types with the proper variable
[01aeade]35                template< typename SynTreeClass >
36                static SynTreeClass *scrub( SynTreeClass *target );
[51b7345]37 
[01aeade]38                virtual Type* mutate( TypeInstType *typeInst );
39                Expression* mutate( SizeofExpr *szeof );
[db0b3ce]40                Expression* mutate( AlignofExpr *algnof );
[01aeade]41                virtual Type* mutate( PointerType *pointer );
42          private:
43                bool doAll;
44                const TyVarMap &tyVars;
45        };
46
47        /* static class method */
[bdd516a]48        template< typename SynTreeClass >
[01aeade]49        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
50                ScrubTyVars scrubber( false, tyVars );
51                return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
52        }
53
54        /* static class method */
[bdd516a]55        template< typename SynTreeClass >
[01aeade]56        SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target ) {
57                TyVarMap tyVars;
58                ScrubTyVars scrubber( true, tyVars );
59                return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
60        }
[78dd0da]61
62        /// Gets the name of the sizeof parameter for the type
63        std::string sizeofName( Type *ty );
64
65        /// Gets the name of the alignof parameter for the type
66        std::string alignofName( Type *ty );
[51b7345]67} // namespace GenPoly
68
[01aeade]69#endif // _SCRUBTYVARS_H
70
[51587aa]71// Local Variables: //
72// tab-width: 4 //
73// mode: c++ //
74// compile-command: "make install" //
75// End: //
Note: See TracBrowser for help on using the repository browser.