-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Module aliasing] Serialize SIL and binaries with module real names #39705
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
Resolves rdar://83632529
Rename test
@swift-ci smoke test |
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.
This looks good functionally, but I'd like to see more testing.
(Many of the comments I put in one particular test file are also applicable to some of the others—in particular, the request for negative tests and module interface tests. Please use your best judgment here. 🙂)
/// substituting another name instead. | ||
virtual StringRef getExportedModuleName() const { | ||
return getParentModule()->getName().str(); | ||
return getParentModule()->getRealName().str(); |
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.
tl;dr: Looks good.
I checked the use sites of getExportedModuleName()
and there's one—TypePrinter::printModuleContext()
—that looked iffy. It's part of ASTPrinter, which means it serves multiple masters. However, it looks like the exported module name is only used there when we're generating a swiftinterface file, where we really would want the real name, so I think this is okay.
ac0eb8e
to
e1dfdba
Compare
ef54b76
to
7a3a032
Compare
@swift-ci smoke test |
@swift-ci smoke test |
Identifier Name = Mod->getName(); | ||
// Should use the module real (binary) name here and everywhere else the | ||
// module is printed in case module aliasing is used (see -module-alias) | ||
Identifier Name = Mod->getRealName(); |
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.
Huh. These ASTPrinter cases are interesting, because I think some clients (like .swiftinterface printing) will want the real name and some (diagnostics, possibly some SourceKit clients) will want the alias name.
It might make sense to base this decision on the PrintOptions
—either by putting a bool flag there, or by actually putting a map of aliases there.
(It’s probably okay to merge this as-is for now and come back to it 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.
Sounds good; will create a separate PR to address that.
Use module real names for containing modules and imported modules when serializing.
Resolves rdar://83632529