mirror of
https://github.com/Z3Prover/z3
synced 2026-06-15 05:15:41 +00:00
Harden scoped implicit-variable RAII in TPTP frontend
Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/38c3a47d-1e93-48d8-8fa4-1dfc724e76e5 Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
parent
31269243ae
commit
e50c22099d
1 changed files with 5 additions and 1 deletions
|
|
@ -414,7 +414,7 @@ class tptp_parser {
|
||||||
|
|
||||||
app* get_or_create_implicit_var(std::string const& n) {
|
app* get_or_create_implicit_var(std::string const& n) {
|
||||||
if (!m_implicit_scope)
|
if (!m_implicit_scope)
|
||||||
throw parse_error("internal parser error: implicit variable scope is missing");
|
throw parse_error("internal parser error: implicit variable scope is missing (unexpected parser state)");
|
||||||
auto it = m_implicit_scope->vars.find(n);
|
auto it = m_implicit_scope->vars.find(n);
|
||||||
if (it != m_implicit_scope->vars.end()) return it->second;
|
if (it != m_implicit_scope->vars.end()) return it->second;
|
||||||
app* c = m.mk_const(symbol(n), m_univ);
|
app* c = m.mk_const(symbol(n), m_univ);
|
||||||
|
|
@ -432,6 +432,10 @@ class tptp_parser {
|
||||||
m_prev_scope(p.m_implicit_scope) {
|
m_prev_scope(p.m_implicit_scope) {
|
||||||
m_p.m_implicit_scope = &scope;
|
m_p.m_implicit_scope = &scope;
|
||||||
}
|
}
|
||||||
|
scoped_implicit_vars(scoped_implicit_vars const&) = delete;
|
||||||
|
scoped_implicit_vars& operator=(scoped_implicit_vars const&) = delete;
|
||||||
|
scoped_implicit_vars(scoped_implicit_vars&&) = delete;
|
||||||
|
scoped_implicit_vars& operator=(scoped_implicit_vars&&) = delete;
|
||||||
~scoped_implicit_vars() {
|
~scoped_implicit_vars() {
|
||||||
m_p.m_implicit_scope = m_prev_scope;
|
m_p.m_implicit_scope = m_prev_scope;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue