Skip to content

[NFC][RemoteInspection] Subtracting remote addresses should return int #83040

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions include/swift/Remote/RemoteAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ class RemoteAddress {
return RemoteAddress(Data - rhs, getAddressSpace());
}

RemoteAddress operator-(const RemoteAddress &rhs) const {
if (AddressSpace != rhs.AddressSpace)
return RemoteAddress();
return RemoteAddress(Data - rhs.Data, getAddressSpace());
uint64_t operator-(const RemoteAddress &rhs) const {
assert(AddressSpace == rhs.AddressSpace &&
"Comparing remote addresses of different address spaces");
return Data - rhs.Data;
}

template <typename IntegerType>
Expand Down
2 changes: 1 addition & 1 deletion include/swift/RemoteInspection/TypeRefBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ReflectionSection {
RemoteRef<U> getRemoteRef(remote::RemoteAddress remoteAddr) const {
assert(containsRemoteAddress(remoteAddr, sizeof(U)));
auto localAddr = (uint64_t)(uintptr_t)Start.getLocalBuffer() +
(remoteAddr - Start.getRemoteAddress()).getRawAddress();
(remoteAddr - Start.getRemoteAddress());

return RemoteRef<U>(remoteAddr, (const U *)localAddr);
}
Expand Down