-
Notifications
You must be signed in to change notification settings - Fork 13k
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
[NFC] Change FindDbgDeclareUsers interface to match findDbgUsers/values #73498
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgive me if I mentioned this in another patch (I couldn't find it), but why insist on using out parameters instead of returning a pair of vectors?
Out parameters made a lot of sense in old C++, but nowadays not so much. Out parameters just encourage variables with larger lifetimes and those interfaces create questions like "can this handle a pre-populated container? Will it erase the container?". It also makes callers need to know to about the input type of the container (note how previously the code did not need to know about the type of the container being returned).
I realize you will later have one of the out parameters be optional, but this could be accomplished with multiple functions. For example, we could minimize a lot of the diffs in this stack of patches by having differently named functions that share an implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out parameters also encourage non-constness of variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that avoiding out-parameters would be ideal.
I chose out-params here for consistency. findDbgValues has always had an out parameter and recent DPValue patches added a second one for DPValues. So it seemed better to follow suit with findDbgDeclares rather than have two different interfaces for similar functions.
IMO that would make it easier for the old and new debug modes to diverge - having a single "find all debug-things" function seemed to make sense from that point of view.
One final point - we're in a bit of a transitionary stage. We would like to be able to completely remove debug intrinsics soon, at which point these functions go back to having a single "return value". Perhaps worth refactoring at that point?
I don't have a really strong opinion on this - I just wanted to show my working so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI
It was in #74480, for a similar function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a transitionary state, this is probably fine. But you know how LLVM's transitionary states can usually last a few years...
Consistency is a good argument for sure. It is a bit unfortunate because we had the chance to modify the bad API and make it identical to the good API, instead of changing the good API to match the bad API. Now we have two extra steps before we can have good APIs all around
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ohh thank you! That reminds me I need to get back to that review. I keep clicking the "pull requests" view of Github hoping it will show all reviews I am involved in, but sadly it doesn't :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may well already be aware, but just in case it helps - If you go to to to
Notifications
(top right, second icon from the right), you can click the "Review Requested" option. I don't know if this shows you pull requests where you've commented but are not a reviewer though... I guess they probably just float around in the notification inbox.