Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into junghee/soname
Browse files Browse the repository at this point in the history
  • Loading branch information
junghee committed Feb 20, 2024
2 parents a3b2f6e + 2619217 commit 3c16547
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Stop generating debian metapackages and packages with the version attached
to the package name. Updates in the apt-repository now support multiple
package versions and upgrading `gtirb` with `apt-get upgrade`.
* Fix performance issue when checking references of ProxyBlocks in Python API.
* Add elfSoname AuxData definition

# 2.0.0
Expand Down
28 changes: 12 additions & 16 deletions python/gtirb/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,22 @@ class Block(Node):
of Block.
"""

@property
def module(self) -> typing.Optional["Module"]:
"""Get the module this node ultimately belongs to."""

raise NotImplementedError # pragma: no cover

@property
def references(self) -> typing.Iterator["Symbol"]:
"""Get all the symbols that refer to this block."""

raise NotImplementedError # pragma: no cover
if not self.module:
return

symbol_set = self.module._symbol_referent_index.get(self)
if symbol_set:
yield from symbol_set

def _add_to_uuid_cache(self, cache: typing.Dict[UUID, Node]) -> None:
"""Update the UUID cache when this node is added."""
Expand Down Expand Up @@ -117,15 +128,6 @@ def address(self) -> typing.Optional[int]:
return None
return self.byte_interval.address + self.offset

@property
def references(self) -> typing.Iterator["Symbol"]:
if not self.module:
return

symbol_set = self.module._symbol_referent_index.get(self)
if symbol_set:
yield from symbol_set

@property
def section(self) -> typing.Optional["Section"]:
"""Get the section this node ultimately belongs to."""
Expand Down Expand Up @@ -403,12 +405,6 @@ def module(self, value: typing.Optional["Module"]) -> None:
if value is not None:
value.proxies.add(self)

@property
def references(self) -> typing.Iterator["Symbol"]:
if self.module is None:
return iter(())
return (s for s in self.module.symbols if s.referent == self)

@property
def incoming_edges(self) -> typing.Iterator["Edge"]:
if self.ir is None:
Expand Down

0 comments on commit 3c16547

Please sign in to comment.