source: translator/GenPoly/ScrubTyVars.h @ ad17ba6a

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 ad17ba6a was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: ScrubTyVars.h,v 1.4 2005/08/29 20:14:13 rcbilson Exp $
5 *
6 */
7
8#ifndef GENPOLY_SCRUBTYVARS_H
9#define GENPOLY_SCRUBTYVARS_H
10
11#include "GenPoly.h"
12
13#include "SynTree/SynTree.h"
14#include "SynTree/Mutator.h"
15
16namespace GenPoly {
17
18class ScrubTyVars : public Mutator
19{
20public:
21  ScrubTyVars( bool doAll, const TyVarMap &tyVars ): doAll( doAll ), tyVars( tyVars ) {}
22 
23  template< typename SynTreeClass >
24  static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
25  template< typename SynTreeClass >
26  static SynTreeClass *scrub( SynTreeClass *target );
27 
28  virtual Type* mutate( TypeInstType *typeInst );
29  virtual Type* mutate( PointerType *pointer );
30
31private:
32  bool doAll;
33  const TyVarMap &tyVars;
34};
35
36/* static class method */
37template< typename SynTreeClass >
38SynTreeClass *
39ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars )
40{
41  ScrubTyVars scrubber( false, tyVars );
42  return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
43}
44
45/* static class method */
46template< typename SynTreeClass >
47SynTreeClass *
48ScrubTyVars::scrub( SynTreeClass *target )
49{
50  TyVarMap tyVars;
51  ScrubTyVars scrubber( true, tyVars );
52  return static_cast< SynTreeClass* >( target->acceptMutator( scrubber ) );
53}
54
55} // namespace GenPoly
56
57#endif /* #ifndef GENPOLY_SCRUBTYVARS_H */
Note: See TracBrowser for help on using the repository browser.