{
return d_expr->notExpr();
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
{
return d_expr->andExpr(*t.d_expr);
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
{
return d_expr->orExpr(*t.d_expr);
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
{
return d_expr->xorExpr(*t.d_expr);
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
{
return d_expr->eqExpr(*t.d_expr);
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
{
return d_expr->impExpr(*t.d_expr);
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
{
return d_expr->iteExpr(*then_t.d_expr, *else_t.d_expr);
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
Term Solver::mkPi() const
{
- return d_exprMgr->mkNullaryOperator(d_exprMgr->realType(), CVC4::kind::PI);
+ try
+ {
+ Term res =
+ d_exprMgr->mkNullaryOperator(d_exprMgr->realType(), CVC4::kind::PI);
+ (void)res.d_expr->getType(true); /* kick off type checking */
+ return res;
+ }
+ catch (const CVC4::TypeCheckingException& e)
+ {
+ throw CVC4ApiException(e.getMessage());
+ }
}
template <typename T>
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (CVC4::TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
/* Split out to avoid nested API calls (problematic with API tracing). */
Term Solver::mkRealFromStrHelper(std::string s) const
{
+ /* CLN and GMP handle this case differently, CLN interprets it as 0, GMP
+ * throws an std::invalid_argument exception. For consistency, we treat it
+ * as invalid. */
+ CVC4_API_ARG_CHECK_EXPECTED(s != ".", s)
+ << "a string representing an integer, real or rational value.";
try
{
- /* CLN and GMP handle this case differently, CLN interprets it as 0, GMP
- * throws an std::invalid_argument exception. For consistency, we treat it
- * as invalid. */
- CVC4_API_ARG_CHECK_EXPECTED(s != ".", s)
- << "a string representing an integer, real or rational value.";
CVC4::Rational r = s.find('/') != std::string::npos
? CVC4::Rational(s)
: CVC4::Rational::fromDecimal(s);
return mkConstHelper<CVC4::Rational>(r);
}
- catch (std::invalid_argument& e)
+ catch (const std::invalid_argument& e)
{
throw CVC4ApiException(e.what());
}
Term Solver::mkReal(int32_t val) const
{
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(val));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(val));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkReal(int64_t val) const
{
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(val));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(val));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkReal(uint32_t val) const
{
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(val));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(val));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkReal(uint64_t val) const
{
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(val));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(val));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkReal(int32_t num, int32_t den) const
{
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(num, den));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(num, den));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkReal(int64_t num, int64_t den) const
{
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(num, den));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(num, den));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkReal(uint32_t num, uint32_t den) const
{
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(num, den));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(num, den));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkReal(uint64_t num, uint64_t den) const
{
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(num, den));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(num, den));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkRegexpEmpty() const
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
// (void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
Term Solver::mkBVFromIntHelper(uint32_t size, uint64_t val) const
{
CVC4_API_ARG_CHECK_EXPECTED(size > 0, size) << "a bit-width > 0";
- return mkConstHelper<CVC4::BitVector>(CVC4::BitVector(size, val));
+ try
+ {
+ return mkConstHelper<CVC4::BitVector>(CVC4::BitVector(size, val));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkBitVector(uint32_t size, uint64_t val) const
/* Split out to avoid nested API calls (problematic with API tracing). */
Term Solver::mkBVFromStrHelper(std::string s, uint32_t base) const
{
+ CVC4_API_ARG_CHECK_EXPECTED(!s.empty(), s) << "a non-empty string";
+ CVC4_API_ARG_CHECK_EXPECTED(base == 2 || base == 10 || base == 16, s)
+ << "base 2, 10, or 16";
try
{
- CVC4_API_ARG_CHECK_EXPECTED(!s.empty(), s) << "a non-empty string";
- CVC4_API_ARG_CHECK_EXPECTED(base == 2 || base == 10 || base == 16, s)
- << "base 2, 10, or 16";
return mkConstHelper<CVC4::BitVector>(CVC4::BitVector(s, base));
}
- catch (std::invalid_argument& e)
+ catch (const std::invalid_argument& e)
{
throw CVC4ApiException(e.what());
}
std::string s,
uint32_t base) const
{
+ CVC4_API_ARG_CHECK_EXPECTED(!s.empty(), s) << "a non-empty string";
+ CVC4_API_ARG_CHECK_EXPECTED(base == 2 || base == 10 || base == 16, s)
+ << "base 2, 10, or 16";
try
{
- CVC4_API_ARG_CHECK_EXPECTED(!s.empty(), s) << "a non-empty string";
- CVC4_API_ARG_CHECK_EXPECTED(base == 2 || base == 10 || base == 16, s)
- << "base 2, 10, or 16";
-
Integer val(s, base);
CVC4_API_CHECK(val.modByPow2(size) == val)
<< "Overflow in bitvector construction (specified bitvector size "
<< size << " too small to hold value " << s << ")";
return mkConstHelper<CVC4::BitVector>(CVC4::BitVector(size, val));
}
- catch (std::invalid_argument& e)
+ catch (const std::invalid_argument& e)
{
throw CVC4ApiException(e.what());
}
Term Solver::mkConst(RoundingMode rm) const
{
- try
- {
- return mkConstHelper<CVC4::RoundingMode>(s_rmodes.at(rm));
- }
- catch (std::invalid_argument& e)
- {
- throw CVC4ApiException(e.what());
- }
+ return mkConstHelper<CVC4::RoundingMode>(s_rmodes.at(rm));
}
Term Solver::mkConst(Kind kind, Sort arg) const
return res;
}
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
// do not call getType(), for abstract values, type can not be computed
// until it is substituted away
}
- catch (std::invalid_argument& e)
+ catch (const std::invalid_argument& e)
{
throw CVC4ApiException(e.what());
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
// do not call getType(), for abstract values, type can not be computed
// until it is substituted away
}
- catch (TypeCheckingException& e)
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
}
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(a));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(a));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkConst(Kind kind, int32_t arg) const
{
return mkBVFromIntHelper(arg1, arg2);
}
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(arg1, arg2));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(arg1, arg2));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkConst(Kind kind, int32_t arg1, int32_t arg2) const
{
CVC4_API_KIND_CHECK_EXPECTED(kind == CONST_RATIONAL, kind)
<< "CONST_RATIONAL";
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(arg1, arg2));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(arg1, arg2));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkConst(Kind kind, int64_t arg1, int64_t arg2) const
{
CVC4_API_KIND_CHECK_EXPECTED(kind == CONST_RATIONAL, kind)
<< "CONST_RATIONAL";
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(arg1, arg2));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(arg1, arg2));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkConst(Kind kind, uint64_t arg1, uint64_t arg2) const
{
CVC4_API_KIND_CHECK_EXPECTED(kind == CONST_RATIONAL, kind)
<< "CONST_RATIONAL";
- return mkConstHelper<CVC4::Rational>(CVC4::Rational(arg1, arg2));
+ try
+ {
+ return mkConstHelper<CVC4::Rational>(CVC4::Rational(arg1, arg2));
+ }
+ catch (const std::invalid_argument& e)
+ {
+ throw CVC4ApiException(e.what());
+ }
}
Term Solver::mkConst(Kind kind, uint32_t arg1, uint64_t arg2) const
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}
(void)res.d_expr->getType(true); /* kick off type checking */
return res;
}
- catch (TypeCheckingException& e)
+ catch (const CVC4::TypeCheckingException& e)
{
throw CVC4ApiException(e.getMessage());
}