mirror of
				https://github.com/Z3Prover/z3
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	separate out, add copy constructor
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
		
							parent
							
								
									2955b0c2ef
								
							
						
					
					
						commit
						0d5cfe9292
					
				
					 5 changed files with 56 additions and 35 deletions
				
			
		| 
						 | 
				
			
			@ -2470,41 +2470,6 @@ public:
 | 
			
		|||
    void operator()(AST * n) { m_manager.inc_ref(n); }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class justified_expr {
 | 
			
		||||
    ast_manager& m;
 | 
			
		||||
    expr*        m_fml;
 | 
			
		||||
    proof*       m_proof;
 | 
			
		||||
public:
 | 
			
		||||
    justified_expr(ast_manager& m, expr* fml, proof* p):
 | 
			
		||||
        m(m),
 | 
			
		||||
        m_fml(fml),
 | 
			
		||||
        m_proof(p) {
 | 
			
		||||
        m.inc_ref(fml);
 | 
			
		||||
        m.inc_ref(p);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    justified_expr& operator=(justified_expr& other) {
 | 
			
		||||
        SASSERT(&m == &other.m);
 | 
			
		||||
        if (this != &other) {
 | 
			
		||||
            m.dec_ref(m_fml);
 | 
			
		||||
            m.dec_ref(m_proof);
 | 
			
		||||
            m_fml = other.get_fml();
 | 
			
		||||
            m_proof = other.get_proof();
 | 
			
		||||
            m.inc_ref(m_fml);
 | 
			
		||||
            m.inc_ref(m_proof);
 | 
			
		||||
        }
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    ~justified_expr() {
 | 
			
		||||
        m.dec_ref(m_fml);
 | 
			
		||||
        m.dec_ref(m_proof);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    expr* get_fml() const { return m_fml; }
 | 
			
		||||
    proof* get_proof() const { return m_proof; }        
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#endif /* AST_H_ */
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										52
									
								
								src/ast/justified_expr.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/ast/justified_expr.h
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
 | 
			
		||||
#ifndef JUSTIFIED_EXPR_H_
 | 
			
		||||
#define JUSTIFIED_EXPR_H_
 | 
			
		||||
 | 
			
		||||
#include "ast/ast.h"
 | 
			
		||||
 | 
			
		||||
class justified_expr {
 | 
			
		||||
    ast_manager& m;
 | 
			
		||||
    expr*        m_fml;
 | 
			
		||||
    proof*       m_proof;
 | 
			
		||||
public:
 | 
			
		||||
    justified_expr(ast_manager& m, expr* fml, proof* p):
 | 
			
		||||
        m(m),
 | 
			
		||||
        m_fml(fml),
 | 
			
		||||
        m_proof(p) {
 | 
			
		||||
        SASSERT(fml);
 | 
			
		||||
        m.inc_ref(fml);
 | 
			
		||||
        m.inc_ref(p);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    justified_expr& operator=(justified_expr const& other) {
 | 
			
		||||
        SASSERT(&m == &other.m);
 | 
			
		||||
        if (this != &other) {
 | 
			
		||||
            m.dec_ref(m_fml);
 | 
			
		||||
            m.dec_ref(m_proof);
 | 
			
		||||
            m_fml = other.get_fml();
 | 
			
		||||
            m_proof = other.get_proof();
 | 
			
		||||
            m.inc_ref(m_fml);
 | 
			
		||||
            m.inc_ref(m_proof);
 | 
			
		||||
        }
 | 
			
		||||
        return *this;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    justified_expr(justified_expr const& other):
 | 
			
		||||
        m(other.m),
 | 
			
		||||
        m_fml(other.m_fml),
 | 
			
		||||
        m_proof(other.m_proof)
 | 
			
		||||
    {
 | 
			
		||||
        m.inc_ref(m_fml);
 | 
			
		||||
        m.inc_ref(m_proof);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ~justified_expr() {
 | 
			
		||||
        m.dec_ref(m_fml);
 | 
			
		||||
        m.dec_ref(m_proof);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    expr* get_fml() const { return m_fml; }
 | 
			
		||||
    proof* get_proof() const { return m_proof; }        
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -21,6 +21,7 @@ Revision History:
 | 
			
		|||
 | 
			
		||||
#include "util/obj_hashtable.h"
 | 
			
		||||
#include "ast/ast_util.h"
 | 
			
		||||
#include "ast/justified_expr.h"
 | 
			
		||||
#include "ast/recurse_expr.h"
 | 
			
		||||
#include "ast/func_decl_dependencies.h"
 | 
			
		||||
#include "ast/macros/macro_util.h"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,7 @@ Revision History:
 | 
			
		|||
#define QUASI_MACROS_H_
 | 
			
		||||
 | 
			
		||||
#include<sstream>
 | 
			
		||||
#include "ast/justified_expr.h"
 | 
			
		||||
#include "ast/macros/macro_manager.h"
 | 
			
		||||
#include "ast/rewriter/th_rewriter.h"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,6 +22,8 @@ Revision History:
 | 
			
		|||
#include "ast/normal_forms/defined_names.h"
 | 
			
		||||
#include "ast/rewriter/rewriter.h"
 | 
			
		||||
#include "ast/simplifier/simplifier.h"
 | 
			
		||||
#include "ast/justified_expr.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class elim_term_ite : public simplifier {
 | 
			
		||||
    defined_names &    m_defined_names;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue