mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Import error now mentions the target, not the arch
This commit is contained in:
@@ -590,8 +590,8 @@ ERROR(cannot_return_value_from_void_func,none,
|
|||||||
|
|
||||||
ERROR(sema_no_import,Fatal,
|
ERROR(sema_no_import,Fatal,
|
||||||
"no such module '%0'", (StringRef))
|
"no such module '%0'", (StringRef))
|
||||||
ERROR(sema_no_import_arch,Fatal,
|
ERROR(sema_no_import_target,Fatal,
|
||||||
"could not find module '%0' for architecture '%1'; "
|
"could not find module '%0' for target '%1'; "
|
||||||
"found: %2", (StringRef, StringRef, StringRef))
|
"found: %2", (StringRef, StringRef, StringRef))
|
||||||
ERROR(sema_no_import_repl,none,
|
ERROR(sema_no_import_repl,none,
|
||||||
"no such module '%0'", (StringRef))
|
"no such module '%0'", (StringRef))
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ protected:
|
|||||||
/// to list the architectures that \e are present.
|
/// to list the architectures that \e are present.
|
||||||
///
|
///
|
||||||
/// \returns true if an error diagnostic was emitted
|
/// \returns true if an error diagnostic was emitted
|
||||||
virtual bool maybeDiagnoseArchitectureMismatch(SourceLoc sourceLocation,
|
virtual bool maybeDiagnoseTargetMismatch(SourceLoc sourceLocation,
|
||||||
StringRef moduleName,
|
StringRef moduleName,
|
||||||
StringRef archName,
|
StringRef archName,
|
||||||
StringRef directoryPath) {
|
StringRef directoryPath) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,10 +139,10 @@ class SerializedModuleLoader : public SerializedModuleLoaderBase {
|
|||||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
|
||||||
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer) override;
|
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer) override;
|
||||||
|
|
||||||
bool maybeDiagnoseArchitectureMismatch(SourceLoc sourceLocation,
|
bool maybeDiagnoseTargetMismatch(SourceLoc sourceLocation,
|
||||||
StringRef moduleName,
|
StringRef moduleName,
|
||||||
StringRef archName,
|
StringRef archName,
|
||||||
StringRef directoryPath) override;
|
StringRef directoryPath) override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~SerializedModuleLoader();
|
virtual ~SerializedModuleLoader();
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ std::error_code SerializedModuleLoader::findModuleFilesInDirectory(
|
|||||||
ModuleDocBuffer);
|
ModuleDocBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SerializedModuleLoader::maybeDiagnoseArchitectureMismatch(
|
bool SerializedModuleLoader::maybeDiagnoseTargetMismatch(
|
||||||
SourceLoc sourceLocation, StringRef moduleName, StringRef archName,
|
SourceLoc sourceLocation, StringRef moduleName, StringRef archName,
|
||||||
StringRef directoryPath) {
|
StringRef directoryPath) {
|
||||||
llvm::vfs::FileSystem &fs = *Ctx.SourceMgr.getFileSystem();
|
llvm::vfs::FileSystem &fs = *Ctx.SourceMgr.getFileSystem();
|
||||||
@@ -139,7 +139,7 @@ bool SerializedModuleLoader::maybeDiagnoseArchitectureMismatch(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ctx.Diags.diagnose(sourceLocation, diag::sema_no_import_arch, moduleName,
|
Ctx.Diags.diagnose(sourceLocation, diag::sema_no_import_target, moduleName,
|
||||||
archName, foundArchs);
|
archName, foundArchs);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -208,8 +208,8 @@ SerializedModuleLoaderBase::findModule(AccessPathElem moduleID,
|
|||||||
|
|
||||||
// We can only get here if all targetFileNamePairs failed with
|
// We can only get here if all targetFileNamePairs failed with
|
||||||
// 'std::errc::no_such_file_or_directory'.
|
// 'std::errc::no_such_file_or_directory'.
|
||||||
if (maybeDiagnoseArchitectureMismatch(moduleID.second,
|
if (maybeDiagnoseTargetMismatch(moduleID.second, moduleName,
|
||||||
moduleName, normalizedTarget.str(), currPath)) {
|
normalizedTarget.str(), currPath)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return None;
|
return None;
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
import Lib
|
import Lib
|
||||||
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
|
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
|
||||||
// BAD-MODULE: [[@LINE-2]]:8: error: malformed module file: {{.*}}Lib.swiftmodule
|
// BAD-MODULE: [[@LINE-2]]:8: error: malformed module file: {{.*}}Lib.swiftmodule
|
||||||
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for architecture '[[ARCH]]'; found: garbage
|
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for target '[[ARCH]]'; found: garbage
|
||||||
|
|
||||||
struct X {}
|
struct X {}
|
||||||
let _: X = Lib.testValue
|
let _: X = Lib.testValue
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
import Lib
|
import Lib
|
||||||
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
|
// NO-SUCH-MODULE: [[@LINE-1]]:8: error: no such module 'Lib'
|
||||||
// BAD-MODULE: [[@LINE-2]]:8: error: malformed module file: {{.*}}Lib.swiftmodule
|
// BAD-MODULE: [[@LINE-2]]:8: error: malformed module file: {{.*}}Lib.swiftmodule
|
||||||
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for architecture '[[ARCH]]'; found: garbage
|
// WRONG-ARCH: [[@LINE-3]]:8: error: could not find module 'Lib' for target '[[ARCH]]'; found: garbage
|
||||||
|
|
||||||
struct X {}
|
struct X {}
|
||||||
let _: X = Lib.testValue
|
let _: X = Lib.testValue
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
// 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
|
// 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
|
||||||
|
|
||||||
// CHECK-ALL-NOT: error:
|
// CHECK-ALL-NOT: error:
|
||||||
// CHECK: {{.*}} error: could not find module 'new_module' for architecture '[[TARGET_ARCHITECTURE]]'; found: {{ppc65, i387|i387, ppc65}}
|
// CHECK: {{.*}} error: could not find module 'new_module' for target '[[TARGET_ARCHITECTURE]]'; found: {{ppc65, i387|i387, ppc65}}
|
||||||
// CHECK-NEXT: import new_module
|
// CHECK-NEXT: import new_module
|
||||||
// CHECK-NEXT: ^
|
// CHECK-NEXT: ^
|
||||||
// CHECK-ALL: error: no such module 'new_module'
|
// CHECK-ALL: error: no such module 'new_module'
|
||||||
|
|||||||
Reference in New Issue
Block a user