<< " unless immediately preceded by SAT/INVALID or UNKNOWN response.";
throw RecoverableModalException(ss.str().c_str());
}
+
if (!options::produceModels())
{
std::stringstream ss;
TheoryModel* m = d_theoryEngine->getBuiltModel();
+ if (m == nullptr)
+ {
+ std::stringstream ss;
+ ss << "Cannot " << c
+ << " since model is not available. Perhaps the most recent call to "
+ "check-sat was interupted?";
+ throw RecoverableModalException(ss.str().c_str());
+ }
+
return m;
}
Dump("benchmark") << GetValueCommand(ex);
}
- if(!options::produceModels()) {
- const char* msg =
- "Cannot get value when produce-models options is off.";
- throw ModalException(msg);
- }
- if (d_smtMode != SMT_MODE_SAT)
- {
- const char* msg =
- "Cannot get value unless immediately preceded by SAT/INVALID or UNKNOWN response.";
- throw RecoverableModalException(msg);
- }
-
// Substitute out any abstract values in ex.
Expr e = d_private->substituteAbstractValues(Node::fromExpr(ex)).toExpr();
}
Trace("smt") << "--- getting value of " << n << endl;
- TheoryModel* m = d_theoryEngine->getBuiltModel();
+ TheoryModel* m = getAvailableModel("get-value");
Node resultNode;
if(m != NULL) {
resultNode = m->getValue(n);
"produce-assignments option is off.";
throw ModalException(msg);
}
- if (d_smtMode != SMT_MODE_SAT)
- {
- const char* msg =
- "Cannot get the current assignment unless immediately "
- "preceded by SAT/INVALID or UNKNOWN response.";
- throw RecoverableModalException(msg);
- }
+
+ // Get the model here, regardless of whether d_assignments is null, since
+ // we should throw errors related to model availability whether or not
+ // assignments is null.
+ TheoryModel* m = getAvailableModel("get assignment");
vector<pair<Expr,Expr>> res;
if (d_assignments != nullptr)
{
TypeNode boolType = d_nodeManager->booleanType();
- TheoryModel* m = d_theoryEngine->getBuiltModel();
for (AssignmentSet::key_iterator i = d_assignments->key_begin(),
iend = d_assignments->key_end();
i != iend;
NodeManagerScope nms(d_nodeManager);
Expr heap;
Expr nil;
- Model* m = d_theoryEngine->getBuiltModel();
+ Model* m = getAvailableModel("get separation logic heap and nil");
if (m->getHeapModel(heap, nil))
{
return std::make_pair(heap, nil);
// and if Notice() is on, the user gave --verbose (or equivalent).
Notice() << "SmtEngine::checkModel(): generating model" << endl;
- TheoryModel* m = d_theoryEngine->getBuiltModel();
+ TheoryModel* m = getAvailableModel("check model");
// check-model is not guaranteed to succeed if approximate values were used
if (m->hasApproximations())