forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 345
[lldb] Fix infinite recursion in ReconstructType #7023
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
Merged
JDevlieghere
merged 1 commit into
swiftlang:swift/release/5.9
from
augusto2112:stop-reconstruct-typeref-disabled
Jun 23, 2023
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 hidden or 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.
Instead of relying on that implicit contract, would it be possible to make that explicit? For example by marking the type as already having gone through this?
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.
#7020 implements the fix by keeping a set of types currently being processed, is that what you mean?
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 think Jonas is suggesting something like a wrapper type instead of having all these functions deal in a currency of strings. I like your point Jonas, but the way I picture it, it would be "messy".
For alternatives, I also suggested the following:
TypeSystemSwiftTypeRef::IsImportedType
ignore thesymbols.use-swift-typeref-typesystem
settingsymbols.use-swift-typeref-typesystem
altogether, I am not aware of the who uses it, I think it was a to disable TypeSystemSwiftTypeRef during initial transition – but I don't know if it's still neededto the latter point, the existence of this infinite recursion could indicate nobody is using this setting.
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.
Yeah, basically what Dave is describing. The most naive implementation being something like:
and then you set
seen
totrue
after you've seen the type the first time to avoid the recursion.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.
@JDevlieghere if you mean changing the argument from a string to something like
TypeName
, I think that'd be a lot of work to support something that can be solved cleanly inside this function. We'd need to change the opaque type ofTypeSystemSwiftTypeRef
from a string to the new type (since the recursion path back to this function goes throughTypeSystemSwiftTypeRef
), and I don't think that's worth doing, especially because we have 2 solutions that are less invasive.Personally I'm not in favor of this because the user explicitly turned on the setting (it's defaulted to off, so if they turned it on they probably have a good reason for it), and it's possible this would change the answer for some types (like the ones the compiler special cases, or types we have shims for).
I think this has some issues too:
1 - we just don't know how many people are relying on this setting (I agree with you that's probably a very small minority, but we shouldn't break them if we don't have to).
2 - it's a useful setting for us, to validate if there's a bug in the typeref typesystem or not (I use it every so often when investigating bugs which I think might be typesystem related).
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.
Thanks for the explanation. Sounds like something we want to keep in mind in case we need to make changes here in the future, but well beyond the scope of this patch.