| ... | @@ -1242,7 +1242,16 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult { | ... | @@ -1242,7 +1242,16 @@ pub fn cImport(comp: *Compilation, c_src: []const u8) !CImportResult { |
| 1242 | | 1242 | |
| 1243 | // If the previous invocation resulted in clang errors, we will see a hit | 1243 | // If the previous invocation resulted in clang errors, we will see a hit |
| 1244 | // here with 0 files in the manifest, in which case it is actually a miss. | 1244 | // here with 0 files in the manifest, in which case it is actually a miss. |
| 1245 | const actual_hit = (try man.hit()) and man.files.items.len != 0; | 1245 | // We need to "unhit" in this case, to keep the digests matching. |
| | 1246 | const prev_hash_state = man.hash.peekBin(); |
| | 1247 | const actual_hit = hit: { |
| | 1248 | const is_hit = try man.hit(); |
| | 1249 | if (man.files.items.len == 0) { |
| | 1250 | man.unhit(prev_hash_state, 0); |
| | 1251 | break :hit false; |
| | 1252 | } |
| | 1253 | break :hit true; |
| | 1254 | }; |
| 1246 | const digest = if (!actual_hit) digest: { | 1255 | const digest = if (!actual_hit) digest: { |
| 1247 | var arena_allocator = std.heap.ArenaAllocator.init(comp.gpa); | 1256 | var arena_allocator = std.heap.ArenaAllocator.init(comp.gpa); |
| 1248 | defer arena_allocator.deinit(); | 1257 | defer arena_allocator.deinit(); |
| ... | @@ -1396,7 +1405,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject) !void { | ... | @@ -1396,7 +1405,7 @@ fn updateCObject(comp: *Compilation, c_object: *CObject) !void { |
| 1396 | mem.split(c_source_basename, ".").next().?; | 1405 | mem.split(c_source_basename, ".").next().?; |
| 1397 | const o_basename = try std.fmt.allocPrint(arena, "{}{}", .{ o_basename_noext, comp.getTarget().oFileExt() }); | 1406 | const o_basename = try std.fmt.allocPrint(arena, "{}{}", .{ o_basename_noext, comp.getTarget().oFileExt() }); |
| 1398 | | 1407 | |
| 1399 | const digest = if ((try man.hit()) and !comp.disable_c_depfile) man.final() else blk: { | 1408 | const digest = if (!comp.disable_c_depfile and try man.hit()) man.final() else blk: { |
| 1400 | var argv = std.ArrayList([]const u8).init(comp.gpa); | 1409 | var argv = std.ArrayList([]const u8).init(comp.gpa); |
| 1401 | defer argv.deinit(); | 1410 | defer argv.deinit(); |
| 1402 | | 1411 | |