[ModuleInterface] Don't alias the stdlib or builtin module

Not aliasing the stdlib should allows it to be used in inlinable code.
Since builtin isn't imported explicitly, references to it shouldn't use
the alias.

rdar://104582241
This commit is contained in:
Alexis Laferrière
2023-01-23 15:58:40 -08:00
parent 32d4edad22
commit c8ca517e56
3 changed files with 15 additions and 1 deletions

View File

@@ -81,6 +81,12 @@ static void printToolVersionAndFlagsComment(raw_ostream &out,
for (ImportedModule import: imports) {
StringRef importedName = import.importedModule->getNameStr();
// Skip Swift as it's commonly used in inlinable code,
// and Builtin as it's imported implicitly by name.
if (importedName == STDLIB_NAME ||
importedName == BUILTIN_NAME)
continue;
if (AliasModuleNamesTargets.insert(importedName).second) {
out << " -module-alias " << MODULE_DISAMBIGUATING_PREFIX <<
importedName << "=" << importedName;