mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ModuleLoader] Emit a better diagnostic for swiftinterfaces with wrong arch.
Before this change, we would emit the warning only for swiftmodules; however, it may be the case that only a swiftinterface (of a different arch) is present but no swiftmodule is present. Fixes rdar://problem/50905075.
This commit is contained in:
@@ -405,8 +405,12 @@ bool SerializedModuleLoader::maybeDiagnoseTargetMismatch(
|
||||
return false;
|
||||
StringRef filePath = directoryIterator->path();
|
||||
StringRef extension = llvm::sys::path::extension(filePath);
|
||||
if (file_types::lookupTypeForExtension(extension) ==
|
||||
file_types::TY_SwiftModuleFile) {
|
||||
auto fileType = file_types::lookupTypeForExtension(extension);
|
||||
// We also check for interfaces here, because the SerializedModuleLoader
|
||||
// is invoked after the ModuleInterfaceLoader; if the ModuleInterfaceLoader
|
||||
// handled interfaces separately, we could get duplicate diagnostics.
|
||||
if (fileType == file_types::TY_SwiftModuleFile
|
||||
|| fileType == file_types::TY_SwiftModuleInterfaceFile) {
|
||||
if (!foundArchs.empty())
|
||||
foundArchs += ", ";
|
||||
foundArchs += llvm::sys::path::stem(filePath).str();
|
||||
@@ -414,7 +418,7 @@ bool SerializedModuleLoader::maybeDiagnoseTargetMismatch(
|
||||
}
|
||||
|
||||
if (foundArchs.empty()) {
|
||||
// Maybe this swiftmodule directory only contains swiftinterfaces, or
|
||||
// It is strange that there were no swiftmodules or swiftinterfaces here;
|
||||
// maybe something else is going on. Regardless, we shouldn't emit a
|
||||
// possibly incorrect diagnostic.
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user