Skip to content

Commit e556959

Browse files
committed
Import error now mentions the target, not the arch
1 parent 31c9254 commit e556959

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,8 @@ ERROR(cannot_return_value_from_void_func,none,
590590

591591
ERROR(sema_no_import,Fatal,
592592
"no such module '%0'", (StringRef))
593-
ERROR(sema_no_import_arch,Fatal,
594-
"could not find module '%0' for architecture '%1'; "
593+
ERROR(sema_no_import_target,Fatal,
594+
"could not find module '%0' for target '%1'; "
595595
"found: %2", (StringRef, StringRef, StringRef))
596596
ERROR(sema_no_import_repl,none,
597597
"no such module '%0'", (StringRef))

include/swift/Serialization/SerializedModuleLoader.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ class SerializedModuleLoaderBase : public ModuleLoader {
6868
/// to list the architectures that \e are present.
6969
///
7070
/// \returns true if an error diagnostic was emitted
71-
virtual bool maybeDiagnoseArchitectureMismatch(SourceLoc sourceLocation,
72-
StringRef moduleName,
73-
StringRef archName,
74-
StringRef directoryPath) {
71+
virtual bool maybeDiagnoseTargetMismatch(SourceLoc sourceLocation,
72+
StringRef moduleName,
73+
StringRef archName,
74+
StringRef directoryPath) {
7575
return false;
7676
}
7777

@@ -139,10 +139,10 @@ class SerializedModuleLoader : public SerializedModuleLoaderBase {
139139
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
140140
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer) override;
141141

142-
bool maybeDiagnoseArchitectureMismatch(SourceLoc sourceLocation,
143-
StringRef moduleName,
144-
StringRef archName,
145-
StringRef directoryPath) override;
142+
bool maybeDiagnoseTargetMismatch(SourceLoc sourceLocation,
143+
StringRef moduleName,
144+
StringRef archName,
145+
StringRef directoryPath) override;
146146

147147
public:
148148
virtual ~SerializedModuleLoader();

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ std::error_code SerializedModuleLoader::findModuleFilesInDirectory(
109109
ModuleDocBuffer);
110110
}
111111

112-
bool SerializedModuleLoader::maybeDiagnoseArchitectureMismatch(
112+
bool SerializedModuleLoader::maybeDiagnoseTargetMismatch(
113113
SourceLoc sourceLocation, StringRef moduleName, StringRef archName,
114114
StringRef directoryPath) {
115115
llvm::vfs::FileSystem &fs = *Ctx.SourceMgr.getFileSystem();
@@ -139,7 +139,7 @@ bool SerializedModuleLoader::maybeDiagnoseArchitectureMismatch(
139139
return false;
140140
}
141141

142-
Ctx.Diags.diagnose(sourceLocation, diag::sema_no_import_arch, moduleName,
142+
Ctx.Diags.diagnose(sourceLocation, diag::sema_no_import_target, moduleName,
143143
archName, foundArchs);
144144
return true;
145145
}
@@ -208,8 +208,8 @@ SerializedModuleLoaderBase::findModule(AccessPathElem moduleID,
208208

209209
// We can only get here if all targetFileNamePairs failed with
210210
// 'std::errc::no_such_file_or_directory'.
211-
if (maybeDiagnoseArchitectureMismatch(moduleID.second,
212-
moduleName, normalizedTarget.str(), currPath)) {
211+
if (maybeDiagnoseTargetMismatch(moduleID.second, moduleName,
212+
normalizedTarget.str(), currPath)) {
213213
return false;
214214
} else {
215215
return None;

test/ParseableInterface/ModuleCache/force-module-loading-mode-archs.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
import Lib
8282
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
8383
// BAD-MODULE: [[@LINE-2]]:8: error: malformed module file: {{.*}}Lib.swiftmodule
84-
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for architecture '[[ARCH]]'; found: garbage
84+
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for target '[[ARCH]]'; found: garbage
8585

8686
struct X {}
8787
let _: X = Lib.testValue

test/ParseableInterface/ModuleCache/force-module-loading-mode-framework.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
import Lib
8282
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
8383
// BAD-MODULE: [[@LINE-2]]:8: error: malformed module file: {{.*}}Lib.swiftmodule
84-
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for architecture '[[ARCH]]'; found: garbage
84+
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for target '[[ARCH]]'; found: garbage
8585

8686
struct X {}
8787
let _: X = Lib.testValue

test/Serialization/load-invalid-arch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// RUN: not %target-swift-frontend %s -typecheck -I %t -show-diagnostics-after-fatal 2>&1 | %FileCheck %s -check-prefix=CHECK-EMPTY -check-prefix CHECK-ALL -DTARGET_ARCHITECTURE=%target
1919

2020
// CHECK-ALL-NOT: error:
21-
// CHECK: {{.*}} error: could not find module 'new_module' for architecture '[[TARGET_ARCHITECTURE]]'; found: {{ppc65, i387|i387, ppc65}}
21+
// CHECK: {{.*}} error: could not find module 'new_module' for target '[[TARGET_ARCHITECTURE]]'; found: {{ppc65, i387|i387, ppc65}}
2222
// CHECK-NEXT: import new_module
2323
// CHECK-NEXT: ^
2424
// CHECK-ALL: error: no such module 'new_module'

0 commit comments

Comments
 (0)