Skip to content

Commit

Permalink
rename StructTesting to StructConstant
Browse files Browse the repository at this point in the history
  • Loading branch information
blattm committed Jul 3, 2024
1 parent a921506 commit c3b91a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions decompiler/backend/variabledeclarations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from decompiler.structures.ast.syntaxtree import AbstractSyntaxTree
from decompiler.structures.pseudo import GlobalVariable, Integer, Variable
from decompiler.structures.pseudo.complextypes import Struct
from decompiler.structures.pseudo.expressions import StructTesting
from decompiler.structures.pseudo.expressions import StructConstant
from decompiler.structures.pseudo.typing import ArrayType, CustomType, Pointer
from decompiler.structures.visitors.ast_dataflowobjectvisitor import BaseAstDataflowObjectVisitor
from decompiler.task import DecompilerTask
Expand Down Expand Up @@ -105,6 +105,6 @@ def visit_global_variable(self, expr: GlobalVariable):
self._global_vars.add(expr.copy(ssa_label=0, ssa_name=None))
if not expr.is_constant or expr.type == Pointer(CustomType.void()):
self._global_vars.add(expr.copy(ssa_label=0, ssa_name=None))
if isinstance(expr.initial_value, StructTesting):
if isinstance(expr.initial_value, StructConstant):
for member_value in expr.initial_value.value.values():
self.visit(member_value)
6 changes: 3 additions & 3 deletions decompiler/frontend/binaryninja/handlers/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
OperationType,
Pointer,
Struct,
StructTesting,
StructConstant,
Symbol,
UnaryOperation,
)
Expand Down Expand Up @@ -267,7 +267,7 @@ def _lift_named_type_ref(self, variable: DataVariable, parent: Optional[MediumLe
values[member_type.offset] = lift.initial_value
types[member_type.offset] = s_type.get_member_by_offset(member_type.offset)
return self._build_global_variable(
variable.name, s_type, variable.address, StructTesting(values, s_type), parent.ssa_memory_version if parent else 0
variable.name, s_type, variable.address, StructConstant(values, s_type), parent.ssa_memory_version if parent else 0
)

case NamedTypeReferenceClass.EnumNamedTypeClass:
Expand Down Expand Up @@ -296,7 +296,7 @@ def _lift_structure_type(self, variable: DataVariable, parent: Optional[MediumLe
values[member_type.offset] = lift.initial_value
types[member_type.offset] = s_type.get_member_by_offset(member_type.offset)
return self._build_global_variable(
variable.name, s_type, variable.address, StructTesting(values, s_type), parent.ssa_memory_version if parent else 0
variable.name, s_type, variable.address, StructConstant(values, s_type), parent.ssa_memory_version if parent else 0
)

def _get_unknown_value(self, variable: DataVariable):
Expand Down
2 changes: 1 addition & 1 deletion decompiler/structures/pseudo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
IntrinsicSymbol,
NotUseableConstant,
RegisterPair,
StructTesting,
StructConstant,
Symbol,
Tag,
UnknownExpression,
Expand Down
6 changes: 3 additions & 3 deletions decompiler/structures/pseudo/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ def accept(self, visitor: DataflowObjectVisitorInterface[T]) -> T:
return visitor.visit_constant_composition(self)


class StructTesting(Constant):
class StructConstant(Constant):
def __init__(self, value: dict[int, Expression], vartype: Struct, tags: Optional[Tuple[Tag, ...]] = None):
super().__init__(
value,
Expand All @@ -536,6 +536,6 @@ def __str__(self) -> str:
def __iter__(self) -> Iterator[Expression]:
yield from self.value.values()

def copy(self) -> StructTesting:
def copy(self) -> StructConstant:
"""Generate a copy of the UnknownExpression with the same message."""
return StructTesting(self.value.copy(), self._type.copy()) # Deep copy needed for all Expr inside.
return StructConstant(self.value.copy(), self._type.copy()) # Deep copy needed for all Expr inside.

0 comments on commit c3b91a6

Please sign in to comment.