Skip to content

Commit 67a447f

Browse files
author
Harlan Haskins
committed
[Frontend] Add flag to use hash-based dependencies
Since prebuilt modules are going to use hashes for their dependencies, we need a flag to turn that behavior on. By default, we use modification times.
1 parent 7d71579 commit 67a447f

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

include/swift/Frontend/FrontendOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ class FrontendOptions {
267267
/// dependencies as well.
268268
bool TrackSystemDeps = false;
269269

270+
/// Should we serialize the hashes of dependencies (vs. the modification
271+
/// times) when compiling a parseable module interface?
272+
bool SerializeParseableModuleInterfaceDependencyHashes = false;
273+
270274
/// The different modes for validating TBD against the LLVM IR.
271275
enum class TBDValidationMode {
272276
Default, ///< Do the default validation for the current platform.

include/swift/Option/FrontendOptions.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def emit_interface_path
6464
: Separate<["-"], "emit-interface-path">,
6565
Alias<emit_parseable_module_interface_path>;
6666

67+
def serialize_parseable_module_interface_dependency_hashes
68+
: Flag<["-"], "serialize-parseable-module-interface-dependency-hashes">,
69+
Flags<[HelpHidden]>;
70+
6771
def tbd_install_name
6872
: Separate<["-"], "tbd-install_name">, MetaVarName<"<path>">,
6973
HelpText<"The install_name to use in an emitted TBD file">;

lib/Frontend/ArgsToFrontendOptionsConverter.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ bool ArgsToFrontendOptionsConverter::convert(
7676

7777
Opts.TrackSystemDeps |= Args.hasArg(OPT_track_system_dependencies);
7878

79+
Opts.SerializeParseableModuleInterfaceDependencyHashes |=
80+
Args.hasArg(OPT_serialize_parseable_module_interface_dependency_hashes);
81+
7982
computePrintStatsOptions();
8083
computeDebugTimeOptions();
8184
computeTBDOptions();

lib/Frontend/ParseableInterfaceSupport.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,10 @@ bool ParseableInterfaceModuleLoader::buildSwiftModuleFromSwiftInterface(
480480
SerializationOpts.OutputPath = OutPathStr.c_str();
481481
SerializationOpts.ModuleLinkName = FEOpts.ModuleLinkName;
482482
SmallVector<FileDependency, 16> Deps;
483-
if (collectDepsForSerialization(FS, SubInstance, InPath, ModuleCachePath,
484-
Deps, Diags, DiagLoc, OuterTracker)) {
483+
if (collectDepsForSerialization(
484+
FS, SubInstance, InPath, ModuleCachePath, Deps,
485+
FEOpts.SerializeParseableModuleInterfaceDependencyHashes,
486+
Diags, DiagLoc, OuterTracker)) {
485487
SubError = true;
486488
return;
487489
}

0 commit comments

Comments
 (0)