Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use AST factory methods in BackendZ3._abstract_internal #563

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions claripy/backends/backend_z3.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,25 +474,14 @@ def _abstract_internal(self, ctx, ast, split_on=None):
if symbol_ty == z3.Z3_BV_SORT:
bv_size = z3.Z3_get_bv_sort_size(ctx, z3_sort)
annots = self.bvs_annotations.get(symbol_name, ())

return BV(
"BVS",
(symbol_str, bv_size),
length=bv_size,
variables=frozenset((symbol_str,)),
symbolic=True,
encoded_name=symbol_name,
annotations=annots,
)
return claripy.BVS(symbol_str, bv_size, explicit_name=True, annotations=annots)
if symbol_ty == z3.Z3_BOOL_SORT:
return Bool("BoolS", (symbol_str,), variables=frozenset((symbol_str,)), symbolic=True)
return claripy.BoolS(symbol_str, explicit_name=True)
if symbol_ty == z3.Z3_FLOATING_POINT_SORT:
ebits = z3.Z3_fpa_get_ebits(ctx, z3_sort)
sbits = z3.Z3_fpa_get_sbits(ctx, z3_sort)
sort = FSort.from_params(ebits, sbits)
return FP(
"FPS", (symbol_str, sort), variables=frozenset((symbol_str,)), symbolic=True, length=sort.length
)
return claripy.FPS(symbol_str, sort, explicit_name=True)
if z3.Z3_is_string_sort(ctx, z3_sort):
raise BackendError("Z3 backend does not support string symbols")
raise BackendError("Unknown z3 term type %d...?" % symbol_ty)
Expand Down