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