mirror of
https://github.com/Z3Prover/z3
synced 2025-04-28 19:35:50 +00:00
Reorganizing code. Added script for generating VS project files
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
2c464d413d
commit
8a6997960a
68 changed files with 167 additions and 170 deletions
47
src/ast/recurse_expr.h
Normal file
47
src/ast/recurse_expr.h
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*++
|
||||
Copyright (c) 2006 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
recurse_expr.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Traverse an expression applying a visitor.
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2008-01-11.
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef _RECURSE_EXPR_H_
|
||||
#define _RECURSE_EXPR_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"obj_hashtable.h"
|
||||
|
||||
template<typename T, typename Visitor, bool IgnorePatterns=false, bool CallDestructors=true>
|
||||
class recurse_expr : public Visitor {
|
||||
obj_map<expr, T> m_cache;
|
||||
ptr_vector<expr> m_todo;
|
||||
vector<T, CallDestructors> m_results1;
|
||||
vector<T, CallDestructors> m_results2;
|
||||
|
||||
bool is_cached(expr * n) const { T c; return m_cache.find(n, c); }
|
||||
T get_cached(expr * n) const { T c; m_cache.find(n, c); return c; }
|
||||
void cache_result(expr * n, T c) { m_cache.insert(n, c); }
|
||||
|
||||
void visit(expr * n, bool & visited);
|
||||
bool visit_children(expr * n);
|
||||
void process(expr * n);
|
||||
|
||||
public:
|
||||
recurse_expr(Visitor const & v = Visitor()):Visitor(v) {}
|
||||
T operator()(expr * n);
|
||||
void reset() { m_cache.reset(); m_todo.reset(); }
|
||||
void finalize() { m_cache.finalize(); m_todo.finalize(); }
|
||||
};
|
||||
|
||||
#endif /* _RECURSE_EXPR_H_ */
|
Loading…
Add table
Add a link
Reference in a new issue