3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-25 11:26:21 +00:00

Finish TPTP review cleanups

Agent-Logs-Url: https://github.com/Z3Prover/z3/sessions/ca1df142-d992-4e45-a8b3-859fa70a5222

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-05-23 23:16:39 +00:00 committed by GitHub
parent 61c37b8640
commit 2bfb8d80db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -1660,7 +1660,7 @@ class tptp_parser {
std::string role = to_lower(parse_name());
expect(token_kind::comma, "','");
if (!m_name_filters.empty() && !m_name_filters.back().contains(formula_name)) {
if (!m_name_filters.empty() && m_name_filters.back().find(formula_name) == m_name_filters.back().end()) {
skip_annotations_until_rparen();
expect(token_kind::rparen, "')'");
expect(token_kind::dot, "'.'");

View file

@ -49,16 +49,22 @@ static void write_file(char const* path, char const* contents) {
class scoped_temp_file {
std::string m_path;
public:
scoped_temp_file(scoped_temp_file const&) = delete;
scoped_temp_file& operator=(scoped_temp_file const&) = delete;
scoped_temp_file(scoped_temp_file&&) = delete;
scoped_temp_file& operator=(scoped_temp_file&&) = delete;
scoped_temp_file(char const* contents) {
static std::atomic<unsigned> counter(0);
auto stamp = std::chrono::steady_clock::now().time_since_epoch().count();
auto stamp = std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::steady_clock::now().time_since_epoch()).count();
m_path = (std::filesystem::temp_directory_path() /
("z3-tptp-" + std::to_string(stamp) + "-" + std::to_string(counter.fetch_add(1)) + ".p")).string();
write_file(m_path.c_str(), contents);
}
~scoped_temp_file() {
if (!m_path.empty())
std::remove(m_path.c_str());
if (!m_path.empty() && std::remove(m_path.c_str()) != 0)
std::cerr << "failed to remove temporary file: " << m_path << "\n";
}
std::string const& path() const { return m_path; }
};