Skip to content

Commit f716bd5

Browse files
author
Harlan Haskins
authored
---
yaml --- r: 294335 b: refs/heads/tensorflow c: 5cb98bf h: refs/heads/master i: 294333: cc614c4 294331: e4bea9a 294327: 7847c08 294319: 48a4a91 294303: 28d06ba 294271: 6cb8350
1 parent 4a3386d commit f716bd5

File tree

5 files changed

+42
-7
lines changed

5 files changed

+42
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: cfc2dda69a7afe819ae245fbbd8f4501424c0644
819+
refs/heads/tensorflow: 5cb98bfe80c82eadcee61b5376aa38d75ceacc4f
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/include/swift/Frontend/ParseableInterfaceModuleLoader.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ class ParseableInterfaceModuleLoader : public SerializedModuleLoaderBase {
167167
static bool buildSwiftModuleFromSwiftInterface(
168168
ASTContext &Ctx, StringRef CacheDir, StringRef PrebuiltCacheDir,
169169
StringRef ModuleName, StringRef InPath, StringRef OutPath,
170-
bool SerializeDependencyHashes, bool TrackSystemDependencies);
170+
bool SerializeDependencyHashes, bool TrackSystemDependencies,
171+
bool RemarkOnRebuildFromInterface);
171172
};
172173

173174
/// Extract the specified-or-defaulted -module-cache-path that winds up in

branches/tensorflow/lib/Frontend/ParseableInterfaceModuleLoader.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ class swift::ParseableInterfaceBuilder {
289289
const StringRef prebuiltCachePath;
290290
const bool serializeDependencyHashes;
291291
const bool trackSystemDependencies;
292+
const bool remarkOnRebuildFromInterface;
292293
const SourceLoc diagnosticLoc;
293294
DependencyTracker *const dependencyTracker;
294295
CompilerInvocation subInvocation;
@@ -350,7 +351,12 @@ class swift::ParseableInterfaceBuilder {
350351
// Tell the subinvocation to serialize dependency hashes if asked to do so.
351352
auto &frontendOpts = subInvocation.getFrontendOptions();
352353
frontendOpts.SerializeModuleInterfaceDependencyHashes =
353-
serializeDependencyHashes;
354+
serializeDependencyHashes;
355+
356+
// Tell the subinvocation to remark on rebuilds from an interface if asked
357+
// to do so.
358+
frontendOpts.RemarkOnRebuildFromModuleInterface =
359+
remarkOnRebuildFromInterface;
354360
}
355361

356362
bool extractSwiftInterfaceVersionAndArgs(
@@ -473,13 +479,15 @@ class swift::ParseableInterfaceBuilder {
473479
StringRef prebuiltCachePath,
474480
bool serializeDependencyHashes = false,
475481
bool trackSystemDependencies = false,
482+
bool remarkOnRebuildFromInterface = false,
476483
SourceLoc diagnosticLoc = SourceLoc(),
477484
DependencyTracker *tracker = nullptr)
478485
: ctx(ctx), fs(*ctx.SourceMgr.getFileSystem()), diags(ctx.Diags),
479486
interfacePath(interfacePath), moduleName(moduleName),
480487
moduleCachePath(moduleCachePath), prebuiltCachePath(prebuiltCachePath),
481488
serializeDependencyHashes(serializeDependencyHashes),
482489
trackSystemDependencies(trackSystemDependencies),
490+
remarkOnRebuildFromInterface(remarkOnRebuildFromInterface),
483491
diagnosticLoc(diagnosticLoc), dependencyTracker(tracker) {
484492
configureSubInvocation();
485493
}
@@ -1230,7 +1238,7 @@ class ParseableInterfaceModuleLoaderImpl {
12301238
ParseableInterfaceBuilder builder(
12311239
ctx, interfacePath, moduleName, cacheDir, prebuiltCacheDir,
12321240
/*serializeDependencyHashes*/false, trackSystemDependencies,
1233-
diagnosticLoc, dependencyTracker);
1241+
remarkOnRebuildFromInterface, diagnosticLoc, dependencyTracker);
12341242
auto &subInvocation = builder.getSubInvocation();
12351243

12361244
// Compute the output path if we're loading or emitting a cached module.
@@ -1367,11 +1375,13 @@ std::error_code ParseableInterfaceModuleLoader::findModuleFilesInDirectory(
13671375
bool ParseableInterfaceModuleLoader::buildSwiftModuleFromSwiftInterface(
13681376
ASTContext &Ctx, StringRef CacheDir, StringRef PrebuiltCacheDir,
13691377
StringRef ModuleName, StringRef InPath, StringRef OutPath,
1370-
bool SerializeDependencyHashes, bool TrackSystemDependencies) {
1378+
bool SerializeDependencyHashes, bool TrackSystemDependencies,
1379+
bool RemarkOnRebuildFromInterface) {
13711380
ParseableInterfaceBuilder builder(Ctx, InPath, ModuleName,
13721381
CacheDir, PrebuiltCacheDir,
13731382
SerializeDependencyHashes,
1374-
TrackSystemDependencies);
1383+
TrackSystemDependencies,
1384+
RemarkOnRebuildFromInterface);
13751385
// FIXME: We really only want to serialize 'important' dependencies here, if
13761386
// we want to ship the built swiftmodules to another machine.
13771387
return builder.buildSwiftModule(OutPath, /*shouldSerializeDeps*/true,

branches/tensorflow/lib/FrontendTool/FrontendTool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ static bool buildModuleFromParseableInterface(CompilerInvocation &Invocation,
602602
PrebuiltCachePath, Invocation.getModuleName(), InputPath,
603603
Invocation.getOutputFilename(),
604604
FEOpts.SerializeModuleInterfaceDependencyHashes,
605-
FEOpts.TrackSystemDeps);
605+
FEOpts.TrackSystemDeps, FEOpts.RemarkOnRebuildFromModuleInterface);
606606
}
607607

608608
static bool compileLLVMIR(CompilerInvocation &Invocation,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %empty-directory(%t/Build)
3+
// RUN: %empty-directory(%t/ModuleCache)
4+
5+
// 1. Create a module called InnerModule, and put its interface into the build dir.
6+
// RUN: echo 'public func inInnerModule() {}' | %target-swift-frontend - -typecheck -emit-module-interface-path %t/Build/InnerModule.swiftinterface -enable-library-evolution -swift-version 5 -module-name InnerModule
7+
8+
// 2. Build the .swiftinterface to a .swiftmodule, which will have a dependency on the interface
9+
// RUN: %target-swift-frontend -compile-module-from-interface -o %t/Build/InnerModule.swiftmodule %t/Build/InnerModule.swiftinterface
10+
11+
// 3. Touch the interface so the module becomes out of date.
12+
// RUN: touch %t/Build/InnerModule.swiftinterface
13+
14+
// 4. Create a module called OuterModule that imports InnerModule, and put its interface into the build dir.
15+
// RUN: echo 'import InnerModule' | %target-swift-frontend - -emit-module -o %t/Build/OuterModule.swiftmodule -module-name OuterModule -I %t/Build
16+
17+
// 5. Build this file, and expect that InnerModule is out of date
18+
// RUN: %target-swift-frontend -typecheck %s -I %t/Build -Rmodule-interface-rebuild -module-cache-path %t/ModuleCache 2>&1 | %FileCheck %s
19+
20+
import OuterModule
21+
22+
// CHECK: rebuilding module 'InnerModule' from interface '{{.*}}/Build/InnerModule.swiftinterface'
23+
// CHECK: compiled module is out of date: '{{.*}}/Build/InnerModule.swiftmodule'
24+
// CHECK: dependency is out of date: '{{.*}}/Build/InnerModule.swiftinterface'

0 commit comments

Comments
 (0)