Skip to content

Commit b15f77d

Browse files
authored
Merge pull request #36820 from artemcm/BetterModuleArchNotFoundMsg
Add location to the `sema_no_import_target` diagnostic
2 parents c754929 + 0445336 commit b15f77d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,7 @@ ERROR(sema_no_import,Fatal,
704704
"no such module '%0'", (StringRef))
705705
ERROR(sema_no_import_target,Fatal,
706706
"could not find module '%0' for target '%1'; "
707-
"found: %2", (StringRef, StringRef, StringRef))
707+
"found: %2, at: %3", (StringRef, StringRef, StringRef, StringRef))
708708
ERROR(sema_no_import_repl,none,
709709
"no such module '%0'", (StringRef))
710710
NOTE(sema_no_import_no_sdk,none,

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ bool ImplicitSerializedModuleLoader::maybeDiagnoseTargetMismatch(
496496
}
497497

498498
Ctx.Diags.diagnose(sourceLocation, diag::sema_no_import_target, moduleName,
499-
target, foundArchs);
499+
target, foundArchs, dir);
500500
return true;
501501
}
502502

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-ALL -DTARGET_ARCHITECTURE=%target
1919

2020
// CHECK-ALL-NOT: error:
21-
// CHECK: {{.*}} error: could not find module 'new_module' for target '[[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}}, at: {{.*}}new_module.swiftmodule
2222
// CHECK-NEXT: import new_module
2323
// CHECK-NEXT: ^
2424
// CHECK-ALL: error: no such module 'new_module'

test/Serialization/runtime-import-from-sdk.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@
5353
// RUN: %empty-directory(%t/mcp)
5454
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-sdk) -resource-dir %t/empty-toolchain/usr/lib/swift -module-cache-path %t/mcp -typecheck %s -dump-clang-diagnostics 2>&1 | %FileCheck --check-prefix CHECK-EMPTY %s
5555
// CHECK-EMPTY-NOT: '-isystem' '{{.*}}/bad-sdk/usr/lib/swift/shims'
56-
// CHECK-EMPTY: error: could not find module 'Swift' for target '{{.*}}'; found: garbage-garbage-garbage
56+
// CHECK-EMPTY: error: could not find module 'Swift' for target '{{.*}}'; found: garbage-garbage-garbage, at: {{.*}}/Swift.swiftmodule
5757

5858
// Check that, when the toolchain *doesn't* have SwiftShims in it, ClagImporter
5959
// *does* add a -I flag to look in the SDK.
6060

6161
// RUN: %empty-directory(%t/mcp)
6262
// RUN: not %target-swift-frontend(mock-sdk: -sdk %t/bad-sdk) -resource-dir %t/really-empty-toolchain/usr/lib/swift -module-cache-path %t/mcp -typecheck %s -dump-clang-diagnostics 2>&1 | %FileCheck --check-prefix CHECK-REALLY-EMPTY %s
6363
// CHECK-REALLY-EMPTY: '-isystem' '{{.*}}/bad-sdk/usr/lib/swift/shims'
64-
// CHECK-REALLY-EMPTY: error: could not find module 'Swift' for target '{{.*}}'; found: garbage-garbage-garbage
64+
// CHECK-REALLY-EMPTY: error: could not find module 'Swift' for target '{{.*}}'; found: garbage-garbage-garbage, at: {{.*}}/Swift.swiftmodule
6565

6666
let x: Int = 1

0 commit comments

Comments
 (0)