-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[DebugInfo] Fix handling of @_originallyDefinedIn types #77779
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
[DebugInfo] Fix handling of @_originallyDefinedIn types #77779
Conversation
d401976
to
98fb153
Compare
@swift-ci test |
98fb153
to
5ea0bec
Compare
@swift-ci test |
5ea0bec
to
e0ce718
Compare
/// Returns true if the type's mangled name is affected by an | ||
/// @_originallyDefinedIn annotation. This annotation can be on the type | ||
/// itself, one of its generic arguments, etc. | ||
bool containsOriginallyDefinedIn(Type 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.
@slavapestov I found the following situations where @_originallyDefinedIn could affect a type's mangled name:
- The type itself being annotated.
- The bound generic arguments being annotated.
- A typealias local to a function could be affected by the types in the function's generic signature.
- A metatype's type.
Do you know of any other ones?
Emit an imported declaration for @_originallyDefinedIn under the real module that these types live in. This patch also changes the mangling for the debugger to respect @_originallyDefinedIn, and fixes a bug where @_originallyDefinedIn that should be ignored was still being used when mangling. rdar://137146961
e0ce718
to
43c420e
Compare
swiftlang/llvm-project#9657 |
if (auto *MT = llvm::dyn_cast<MetatypeType>(T)) | ||
if (containsOriginallyDefinedIn(MT->getInstanceType())) | ||
return true; | ||
; |
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.
stray ;
|
||
// If the type is a bound generic, the type of the substituted generic | ||
// arguments might be annotated with @_originallyDefinedIn. | ||
if (auto *BGT = llvm::dyn_cast<BoundGenericType>(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.
I would have expected this function to be implemented in terms of a type visitor. For example, does this catch a a tuple containing an originallyDefinedIn type?
@swift-ci test source compatibility |
Closed in favor of #78104 |
Uh oh!
There was an error while loading. Please reload this page.