source: src/GenPoly/ScrubTyVars.h@ baba5d8

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string with_gc
Last change on this file since baba5d8 was ebe9b3a, checked in by Aaron Moss <a3moss@…>, 10 years ago

Stripped unused and potentially buggy 'doAll' flag from ScrubTyVars

  • 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 <string>
20
21#include "GenPoly.h"
22
23#include "SynTree/SynTree.h"
24#include "SynTree/Mutator.h"
25
26namespace GenPoly {
27 class ScrubTyVars : public Mutator {
28 public:
29 ScrubTyVars( const TyVarMap &tyVars ): tyVars( tyVars ) {}
30
31 /// For all polymorphic types with type variables in `tyVars`, replaces generic types, dtypes, and ftypes with the appropriate void type,
32 /// and sizeof/alignof expressions with the proper variable
33 template< typename SynTreeClass >
34 static SynTreeClass *scrub( SynTreeClass *target, const TyVarMap &tyVars );
35
36 virtual Type* mutate( TypeInstType *typeInst );
37 virtual Type* mutate( StructInstType *structInst );
38 virtual Type* mutate( UnionInstType *unionInst );
39 virtual Expression* mutate( SizeofExpr *szeof );
40 virtual Expression* mutate( AlignofExpr *algnof );
41 virtual Type* mutate( PointerType *pointer );
42
43 private:
44 /// Mutates (possibly generic) aggregate types appropriately
45 Type* mutateAggregateType( Type *ty );
46
47 const TyVarMap &tyVars;
48 };
49
50 /* static class method */
51 template< typename SynTreeClass >
52 SynTreeClass * ScrubTyVars::scrub( SynTreeClass *target, const TyVarMap &tyVars ) {
53 ScrubTyVars scrubber( tyVars );
54 return static_cast< SynTreeClass * >( target->acceptMutator( scrubber ) );
55 }
56
57} // namespace GenPoly
58
59#endif // _SCRUBTYVARS_H
60
61// Local Variables: //
62// tab-width: 4 //
63// mode: c++ //
64// compile-command: "make install" //
65// End: //
Note: See TracBrowser for help on using the repository browser.