-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Account for multiple modules when looking up the DeclContext of a type #76065
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
Account for multiple modules when looking up the DeclContext of a type #76065
Conversation
@swift-ci test |
@swift-ci smoke test |
7583e25
to
799bab0
Compare
@swift-ci test |
@swift-ci smoke test |
799bab0
to
862a6ac
Compare
@swift-ci smoke test |
@swift-ci test |
862a6ac
to
31a4839
Compare
@swift-ci test |
@swift-ci smoke test |
@slavapestov ping :) |
if (!decl) return nullptr; | ||
for (auto *module : *potentialModules) | ||
if (auto *decl = module->lookupLocalType(mangledName)) | ||
return dyn_cast<DeclContext>(decl); |
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.
Could this be a findModuleContaining(mangledName) helper function that is reused?
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 could put this in a helper but besides iterating over the modules there's nothing in common I could reuse between callers of findPotentialModules
.
When looking up the decl context of a type, ASTDemangler has to take into account that there are multiple different modules where that type could've come from. This is due to two facts: - Thanks to the `-module-abi-name` flag, multiple modules can share the same ABI name (which is the module name that is usually used when mangling a type). - In some situations mangling can use the module's real name, for example, when mangling for the debugger or USRs coupled with @_originallyDefinedIn. rdar://134095412
31a4839
to
141c96f
Compare
@swift-ci test |
@swift-ci smoke test |
When looking up the decl context of a type, ASTDemangler has to take into account that there are multiple different modules where that type could've come from. This is due to two facts:
-module-abi-name
flag, multiple modules can share the same ABI name (which is the module name that is usually used when mangling a type).rdar://134095412