@@ -39,11 +39,14 @@ namespace swift {
39
39
// / appropriate strategy for how to verify if it's up-to-date.
40
40
class FileDependency {
41
41
// / The size of the file on disk, in bytes.
42
- uint64_t Size : 63 ;
42
+ uint64_t Size : 62 ;
43
43
44
44
// / A dependency can be either hash-based or modification-time-based.
45
45
bool IsHashBased : 1 ;
46
46
47
+ // / The dependency path can be absolute or relative to the SDK
48
+ bool IsSDKRelative : 1 ;
49
+
47
50
union {
48
51
// / The last modification time of the file.
49
52
uint64_t ModificationTime;
@@ -56,22 +59,22 @@ namespace swift {
56
59
std::string Path;
57
60
58
61
FileDependency (uint64_t size, bool isHash, uint64_t hashOrModTime,
59
- StringRef path):
60
- Size (size), IsHashBased(isHash), ModificationTime(hashOrModTime ),
61
- Path (path) {}
62
+ StringRef path, bool isSDKRelative ):
63
+ Size (size), IsHashBased(isHash), IsSDKRelative(isSDKRelative ),
64
+ ModificationTime (hashOrModTime), Path(path) {}
62
65
public:
63
66
FileDependency () = delete ;
64
67
65
68
// / Creates a new hash-based file dependency.
66
69
static FileDependency
67
- hashBased (StringRef path, uint64_t size, uint64_t hash) {
68
- return FileDependency (size, /* isHash*/ true , hash, path);
70
+ hashBased (StringRef path, bool isSDKRelative, uint64_t size, uint64_t hash) {
71
+ return FileDependency (size, /* isHash*/ true , hash, path, isSDKRelative );
69
72
}
70
73
71
74
// / Creates a new modification time-based file dependency.
72
75
static FileDependency
73
- modTimeBased (StringRef path, uint64_t size, uint64_t mtime) {
74
- return FileDependency (size, /* isHash*/ false , mtime, path);
76
+ modTimeBased (StringRef path, bool isSDKRelative, uint64_t size, uint64_t mtime) {
77
+ return FileDependency (size, /* isHash*/ false , mtime, path, isSDKRelative );
75
78
}
76
79
77
80
// / Updates the last-modified time of this dependency.
@@ -94,6 +97,9 @@ namespace swift {
94
97
// / based on content hash.
95
98
bool isHashBased () const { return IsHashBased; }
96
99
100
+ // / Determines if this dependency is absolute or relative to the SDK.
101
+ bool isSDKRelative () const { return IsSDKRelative; }
102
+
97
103
// / Determines if this dependency is hash-based and should be validated
98
104
// / based on modification time.
99
105
bool isModificationTimeBased () const { return !IsHashBased; }
0 commit comments