}
Expr::~Expr() {
+ ExprManagerScope ems(*this);
delete d_node;
}
Expr& Expr::operator=(const Expr& e) {
if(this != &e) {
+ ExprManagerScope ems(*this);
delete d_node;
d_node = new Node(*e.d_node);
d_em = e.d_em;
size_t Expr::hash() const {
Assert(d_node != NULL, "Unexpected NULL expression pointer!");
- return (d_node->isNull());
+ return (d_node->hash());
}
Kind Expr::getKind() const {
}
std::string Expr::toString() const {
+ ExprManagerScope ems(*this);
Assert(d_node != NULL, "Unexpected NULL expression pointer!");
return d_node->toString();
}
}
void Expr::toStream(std::ostream& out) const {
+ ExprManagerScope ems(*this);
d_node->toStream(out);
}
** Public-facing expression interface.
**/
+// circular dependency: force expr_manager.h first
+#include "expr/expr_manager.h"
+
#ifndef __CVC4__EXPR_H
#define __CVC4__EXPR_H
#include "cvc4_config.h"
-#include "expr/expr_manager.h"
#include <string>
#include <iostream>
#include "cvc4_config.h"
#include "expr/kind.h"
+#include "expr/node_manager.h"
#include <vector>
namespace CVC4 {
class BooleanType;
class FunctionType;
class KindType;
-class NodeManager;
class SmtEngine;
class CVC4_PUBLIC ExprManager {
/** SmtEngine will use all the internals, so it will grab the node manager */
friend class SmtEngine;
+
+ /** ExprManagerScope reaches in to get the NodeManager */
+ friend class ExprManagerScope;
};
-}
+}/* CVC4 namespace */
+
+#include "expr/expr.h"
+
+namespace CVC4 {
+
+/**
+ * A wrapper (essentially) for NodeManagerScope. Without this, we'd
+ * need Expr to be a friend of ExprManager.
+ */
+class ExprManagerScope {
+ NodeManagerScope d_nms;
+public:
+ inline ExprManagerScope(const Expr& e) :
+ d_nms(e.getExprManager() == NULL ?
+ NodeManager::currentNM() : e.getExprManager()->getNodeManager()) {
+ }
+};
+
+}/* CVC4 namespace */
#endif /* __CVC4__EXPR_MANAGER_H */
+
** A manager for Nodes.
**/
+/* circular dependency; force node.h first */
+#include "expr/node.h"
+
#ifndef __CVC4__NODE_MANAGER_H
#define __CVC4__NODE_MANAGER_H
#include <string>
#include <ext/hash_set>
-#include "expr/node.h"
#include "expr/kind.h"
namespace __gnu_cxx {
SUBDIRS = precedence
TESTS_ENVIRONMENT = @srcdir@/../run_regression @top_builddir@/../../bin/cvc4
-TESTS = hole6.cvc \
+TESTS = bug32.cvc \
+ hole6.cvc \
logops.01.cvc \
logops.02.cvc \
logops.03.cvc \
--- /dev/null
+% EXPECT: VALID
+a:BOOLEAN;
+b:BOOLEAN;
+ASSERT(a);
+QUERY(a OR b);
+