// // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // VarExprReplacer.h -- // // Author : Rob Schluntz // Created On : Wed Jan 13 16:29:30 2016 // Last Modified By : Peter A. Buhr // Last Modified On : Sat Jul 22 09:53:41 2017 // Update Count : 6 // #pragma once #include // for map, map<>::value_compare #include "SynTree/Visitor.h" // for Visitor class DeclarationWithType; class VariableExpr; /// Visitor that replaces the declarations that VariableExprs refer to, according to the supplied mapping class VarExprReplacer : public Visitor { public: typedef std::map< DeclarationWithType *, DeclarationWithType * > DeclMap; private: const DeclMap & declMap; bool debug; public: VarExprReplacer( const DeclMap & declMap, bool debug = false ); // replace variable with new node from decl map virtual void visit( VariableExpr * varExpr ); static void replace( BaseSyntaxNode * node, const DeclMap & declMap, bool debug = false ) { VarExprReplacer replacer( declMap, debug ); maybeAccept( node, replacer ); } }; // Local Variables: // // tab-width: 4 // // mode: c++ // // compile-command: "make install" // // End: //