Fix C include files not being in whole cache (#11365)

This commit is contained in:
Tom Read Cutting
2022-04-22 16:12:51 +01:00
committed by GitHub
parent 42e81cd81b
commit a430630002
4 changed files with 19 additions and 6 deletions

View File

@@ -3855,6 +3855,8 @@ pub fn semaFile(mod: *Module, file: *File) SemaError!void {
});
errdefer gpa.free(resolved_path);
mod.comp.whole_cache_manifest_mutex.lock();
defer mod.comp.whole_cache_manifest_mutex.unlock();
try man.addFilePostContents(resolved_path, source.bytes, source.stat);
}
} else {
@@ -4336,6 +4338,8 @@ pub fn embedFile(mod: *Module, cur_file: *File, rel_file_path: []const u8) !*Emb
if (mod.comp.whole_cache_manifest) |man| {
const copied_resolved_path = try gpa.dupe(u8, resolved_path);
errdefer gpa.free(copied_resolved_path);
mod.comp.whole_cache_manifest_mutex.lock();
defer mod.comp.whole_cache_manifest_mutex.unlock();
try man.addFilePostContents(copied_resolved_path, bytes, stat);
}