Bake the _Concurrency -> Swift ABI module name into the compiler.

Using `-module-abi-name` for the `_Concurrency` module breaks older
Swift compilers. Instead, hard-code that "Swift" is the ABI name of the
"_Concurrency" module in the compiler to dodge the problem.
This commit is contained in:
Doug Gregor
2021-03-11 14:59:11 -08:00
parent eeffb0785f
commit 6ed794d188
4 changed files with 24 additions and 10 deletions

View File

@@ -1356,6 +1356,22 @@ ImportedModule::removeDuplicates(SmallVectorImpl<ImportedModule> &imports) {
imports.erase(last, imports.end());
}
Identifier ModuleDecl::getABIName() const {
if (!ModuleABIName.empty())
return ModuleABIName;
// Hard code that the _Concurrency module has Swift as its ABI name.
// FIXME: This works around a backward-compatibility issue where
// -module-abi-name is not supported on existing Swift compilers. Remove
// this hack later and pass -module-abi-name when building the _Concurrency
// module.
if (getName().str() == SWIFT_CONCURRENCY_NAME) {
ModuleABIName = getASTContext().getIdentifier(STDLIB_NAME);
return ModuleABIName;
}
return getName();
}
StringRef ModuleDecl::getModuleFilename() const {
// FIXME: Audit uses of this function and figure out how to migrate them to