Skip to content

Commit 28e022a

Browse files
committed
---
yaml --- r: 347600 b: refs/heads/master c: ecdd879 h: refs/heads/master
1 parent 7e7bc85 commit 28e022a

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 70f59f088b307b789fc1134e8bedaf2f97d679f1
2+
refs/heads/master: ecdd879d93698c1c1a63f8afa9feca1f4e7e52cf
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,12 @@ class ParseableInterfaceModuleLoaderImpl {
839839
return scratch.str();
840840
}
841841

842+
bool isInResourceDir(StringRef path) {
843+
StringRef resourceDir = ctx.SearchPathOpts.RuntimeLibraryPath;
844+
if (resourceDir.empty()) return false;
845+
return path.startswith(resourceDir);
846+
}
847+
842848
/// Finds the most appropriate .swiftmodule, whose dependencies are up to
843849
/// date, that we can load for the provided .swiftinterface file.
844850
llvm::ErrorOr<DiscoveredModule> discoverUpToDateModuleForInterface(
@@ -944,6 +950,21 @@ class ParseableInterfaceModuleLoaderImpl {
944950
<< modulePath
945951
<< "; deferring to serialized module loader\n");
946952
return std::make_error_code(std::errc::not_supported);
953+
} else if (isInResourceDir(modulePath) &&
954+
loadMode == ModuleLoadingMode::PreferSerialized) {
955+
// Special-case here: If we're loading a .swiftmodule from the resource
956+
// dir adjacent to the compiler, defer to the serialized loader instead
957+
// of falling back. This is mainly to support development of Swift,
958+
// where one might change the module format version but forget to
959+
// recompile the standard library. If that happens, don't fall back
960+
// and silently recompile the standard library -- instead, error like
961+
// we used to.
962+
LLVM_DEBUG(llvm::dbgs() << "Found out-of-date module in the "
963+
"resource-dir at "
964+
<< modulePath
965+
<< "; deferring to serialized module loader "
966+
"to diagnose\n");
967+
return std::make_error_code(std::errc::not_supported);
947968
} else {
948969
LLVM_DEBUG(llvm::dbgs() << "Found out-of-date module at "
949970
<< modulePath << "\n");

trunk/test/ParseableInterface/inherited-defaults-execution.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
//
3232
// RUN: %target-build-swift -I%t -L%t -lInherited -o %t/main %target-rpath(%t) %t/main.swift -swift-version 5
3333
// RUN: %target-codesign %t/main %t/%target-library-name(Inherited)
34-
// RUN: %target-run %t/main | %FileCheck --check-prefix=OUTPUT %s
34+
// RUN: %target-run %t/main %t/%target-library-name(Inherited) | %FileCheck --check-prefix=OUTPUT %s
3535
//
3636
// OUTPUT: 45
3737
// OUTPUT-NEXT: 98

0 commit comments

Comments
 (0)