/*
 * This file is part of the Cforall project
 *
 * $Id: RenameVars.h,v 1.2 2005/08/29 20:14:16 rcbilson Exp $
 *
 */

#ifndef RESOLVEXPR_RENAMEVARS_H
#define RESOLVEXPR_RENAMEVARS_H

#include <list>
#include <map>
#include <string>

#include "SynTree/SynTree.h"
#include "SynTree/Visitor.h"

namespace ResolvExpr {

class RenameVars : public Visitor
{
public:
  RenameVars();
  void reset();
  
private:
  virtual void visit( VoidType *basicType );
  virtual void visit( BasicType *basicType );
  virtual void visit( PointerType *pointerType );
  virtual void visit( ArrayType *arrayType );
  virtual void visit( FunctionType *functionType );
  virtual void visit( StructInstType *aggregateUseType );
  virtual void visit( UnionInstType *aggregateUseType );
  virtual void visit( EnumInstType *aggregateUseType );
  virtual void visit( ContextInstType *aggregateUseType );
  virtual void visit( TypeInstType *aggregateUseType );
  virtual void visit( TupleType *tupleType );
  
  void typeBefore( Type *type );
  void typeAfter( Type *type );
  int level;
  std::list< std::map< std::string, std::string > > mapStack;
};

extern RenameVars global_renamer;

} // namespace ResolvExpr

#endif /* #ifndef RESOLVEXPR_RENAMEVARS_H */
