Skip to content

NFC: [MemAccessUtils] Tweaked API. #71157

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

Conversation

nate-chandler
Copy link
Contributor

Previously, visitProductLeafAccessPathNodes required its caller to provide both an AccessPath path and an SILValue address which satisfied path == AccessPath::compute(address) to force the caller to handle the case of an invalid AccessPath. Now, instead, it computes the value itself and returns false if it's invalid.

It could be tweaked to also return false if the provided lambda returned false but that would make the only currently extant callers less pleasant and also would not be sufficient in the case of caller who wanted to distinguish between an invalid AccessPath and a particular leaf visit returning false.

Previously, `visitProductLeafAccessPathNodes` required its caller to
provide both an `AccessPath` `path` and an `SILValue` `address` which
satisfied `path == AccessPath::compute(address)` to force the caller to
handle the case of an invalid `AccessPath`.  Now, instead, it computes
the value itself and returns false if it's invalid.

It could be tweaked to also return false if the provided lambda returned
false but that would make the only currently extant callers less
pleasant and also would not be sufficient in the case of caller who
wanted to distinguish between an invalid `AccessPath` and a particular
leaf visit returning false.
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

1 similar comment
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler merged commit 643fa6c into swiftlang:main Jan 31, 2024
@nate-chandler nate-chandler deleted the nfc/20240125/1/tweak-visit-product-leaves branch January 31, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant