[a32b204] | 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 | //
|
---|
[ea6332d] | 7 | // RenameVars.h --
|
---|
[a32b204] | 8 | //
|
---|
| 9 | // Author : Richard C. Bilson
|
---|
| 10 | // Created On : Sun May 17 12:10:28 2015
|
---|
| 11 | // Last Modified By : Peter A. Buhr
|
---|
[6b0b624] | 12 | // Last Modified On : Sat Jul 22 09:33:54 2017
|
---|
| 13 | // Update Count : 4
|
---|
[a32b204] | 14 | //
|
---|
[51b73452] | 15 |
|
---|
[6b0b624] | 16 | #pragma once
|
---|
[51b73452] | 17 |
|
---|
[ea6332d] | 18 | #include <list> // for list
|
---|
| 19 | #include <map> // for map
|
---|
| 20 | #include <string> // for string
|
---|
[51b73452] | 21 |
|
---|
[ea6332d] | 22 | #include "SynTree/SynTree.h" // for Visitor Nodes
|
---|
| 23 | #include "SynTree/Visitor.h" // for Visitor
|
---|
[51b73452] | 24 |
|
---|
| 25 | namespace ResolvExpr {
|
---|
[0f19d763] | 26 |
|
---|
| 27 | /// Provides a consistent renaming of forall type names in a hierarchy by prefixing them with a unique "level" ID
|
---|
[a32b204] | 28 | class RenameVars : public Visitor {
|
---|
| 29 | public:
|
---|
| 30 | RenameVars();
|
---|
| 31 | void reset();
|
---|
| 32 | private:
|
---|
| 33 | virtual void visit( VoidType *basicType );
|
---|
| 34 | virtual void visit( BasicType *basicType );
|
---|
| 35 | virtual void visit( PointerType *pointerType );
|
---|
| 36 | virtual void visit( ArrayType *arrayType );
|
---|
| 37 | virtual void visit( FunctionType *functionType );
|
---|
| 38 | virtual void visit( StructInstType *aggregateUseType );
|
---|
| 39 | virtual void visit( UnionInstType *aggregateUseType );
|
---|
| 40 | virtual void visit( EnumInstType *aggregateUseType );
|
---|
[4040425] | 41 | virtual void visit( TraitInstType *aggregateUseType );
|
---|
[a32b204] | 42 | virtual void visit( TypeInstType *aggregateUseType );
|
---|
| 43 | virtual void visit( TupleType *tupleType );
|
---|
[44b7088] | 44 | virtual void visit( VarArgsType *varArgsType );
|
---|
[89e6ffc] | 45 | virtual void visit( ZeroType *zeroType );
|
---|
| 46 | virtual void visit( OneType *oneType );
|
---|
[a32b204] | 47 |
|
---|
| 48 | void typeBefore( Type *type );
|
---|
| 49 | void typeAfter( Type *type );
|
---|
| 50 | int level;
|
---|
| 51 | std::list< std::map< std::string, std::string > > mapStack;
|
---|
| 52 | };
|
---|
| 53 |
|
---|
| 54 | extern RenameVars global_renamer;
|
---|
[51b73452] | 55 | } // namespace ResolvExpr
|
---|
| 56 |
|
---|
[a32b204] | 57 | // Local Variables: //
|
---|
| 58 | // tab-width: 4 //
|
---|
| 59 | // mode: c++ //
|
---|
| 60 | // compile-command: "make install" //
|
---|
| 61 | // End: //
|
---|