@@ -152,8 +152,7 @@ ParseableInterfaceModuleLoader::configureSubInvocationAndOutputPaths(
152
152
// Check that the output .swiftmodule file is at least as new as all the
153
153
// dependencies it read when it was built last time.
154
154
static bool
155
- swiftModuleIsUpToDate (clang::vfs::FileSystem &FS,
156
- StringRef InPath, StringRef OutPath) {
155
+ swiftModuleIsUpToDate (clang::vfs::FileSystem &FS, StringRef OutPath) {
157
156
158
157
if (!FS.exists (OutPath))
159
158
return false ;
@@ -180,8 +179,20 @@ swiftModuleIsUpToDate(clang::vfs::FileSystem &FS,
180
179
if (!InStatus ||
181
180
(InStatus.get ().getSize () != In.Size ) ||
182
181
(InStatus.get ().getLastModificationTime () != In.LastModTime )) {
182
+ LLVM_DEBUG (llvm::dbgs () << " Dep " << In.Path
183
+ << " is directly out of date\n " );
183
184
return false ;
184
185
}
186
+ // Recursively probe any .swiftmodules for up-to-date-ness.
187
+ auto Ext = llvm::sys::path::extension (In.Path );
188
+ auto Ty = file_types::lookupTypeForExtension (Ext);
189
+ if (Ty == file_types::TY_SwiftModuleFile &&
190
+ !swiftModuleIsUpToDate (FS, In.Path )) {
191
+ LLVM_DEBUG (llvm::dbgs () << " Dep " << In.Path
192
+ << " is indirectly out of date\n " );
193
+ return false ;
194
+ }
195
+ LLVM_DEBUG (llvm::dbgs () << " Dep " << In.Path << " is up to date\n " );
185
196
}
186
197
return true ;
187
198
}
@@ -301,7 +312,7 @@ std::error_code ParseableInterfaceModuleLoader::openModuleFiles(
301
312
configureSubInvocationAndOutputPaths (SubInvocation, InPath, OutPath);
302
313
303
314
// Evaluate if we need to run this sub-invocation, and if so run it.
304
- if (!swiftModuleIsUpToDate (FS, InPath, OutPath)) {
315
+ if (!swiftModuleIsUpToDate (FS, OutPath)) {
305
316
if (buildSwiftModuleFromSwiftInterface (FS, Diags, SubInvocation, InPath,
306
317
OutPath))
307
318
return std::make_error_code (std::errc::invalid_argument);
0 commit comments