Skip to content

Commit 016fa0e

Browse files
committed
Fix building with bitwuzla>=0.4.0 due to breaking API changes
1 parent 4f35e06 commit 016fa0e

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/netlist/boolean_function/solver.cpp

+8-9
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,11 @@ namespace hal
237237

238238
// First, create a Bitwuzla options instance.
239239
bitwuzla::Options options;
240+
bitwuzla::TermManager tm;
240241
// We will parse example file `smt2/quickstart.smt2`.
241242
// Create parser instance.
242243
// We expect no error to occur.
243-
const char* smt2_char_string = input.c_str();
244244

245-
auto in_stream = fmemopen((void*)smt2_char_string, strlen(smt2_char_string), "r");
246245
std::stringbuf result_string;
247246
std::ostream output_stream(&result_string);
248247

@@ -256,16 +255,16 @@ namespace hal
256255
// std::filesystem::path tmp_path = utils::get_unique_temp_directory().get();
257256
// std::string output_file = std::string(tmp_path) + "/out.smt2";
258257

259-
bitwuzla::parser::Parser parser(options, "VIRTUAL_FILE", in_stream, "smt2", &output_stream);
258+
bitwuzla::parser::Parser parser(tm, options, "smt2", &output_stream);
260259
// Now parse the input file.
261-
std::string err_msg = parser.parse(false);
262-
263-
if (!err_msg.empty())
260+
try
264261
{
265-
return ERR("failed to parse input file: " + err_msg);
262+
parser.parse(input, false, false);
263+
}
264+
catch (bitwuzla::Exception& e)
265+
{
266+
return ERR("failed to parse input file: " + e.msg());
266267
}
267-
268-
fclose(in_stream);
269268

270269
std::string output(result_string.str());
271270
// std::cout << "output" << std::endl;

0 commit comments

Comments
 (0)