mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Allow either hash-based or mtime-based deps
Add a bit to the module to determine whether the dependency’s stored bit pattern is a hash or an mtime. Prebuilt modules store a hash of their dependencies because we can’t be sure their dependencies will have the same modtime as when they were built.
This commit is contained in:
@@ -252,10 +252,19 @@ static bool validateInputBlock(
|
||||
StringRef blobData;
|
||||
unsigned kind = cursor.readRecord(entry.ID, scratch, &blobData);
|
||||
switch (kind) {
|
||||
case input_block::FILE_DEPENDENCY:
|
||||
dependencies.push_back(SerializationOptions::FileDependency{
|
||||
scratch[0], scratch[1], blobData});
|
||||
case input_block::FILE_DEPENDENCY: {
|
||||
bool isHashBased = scratch[2] != 0;
|
||||
if (isHashBased) {
|
||||
dependencies.push_back(
|
||||
SerializationOptions::FileDependency::hashBased(
|
||||
blobData, scratch[0], scratch[1]));
|
||||
} else {
|
||||
dependencies.push_back(
|
||||
SerializationOptions::FileDependency::modTimeBased(
|
||||
blobData, scratch[0], scratch[1]));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Unknown metadata record, possibly for use by a future version of the
|
||||
// module format.
|
||||
|
||||
Reference in New Issue
Block a user