@@ -325,18 +325,8 @@ bool DepsLog::Recompact(const string& path, string* err) {
325
325
Deps* deps = deps_[old_id];
326
326
if (!deps) continue ; // If nodes_[old_id] is a leaf, it has no deps.
327
327
328
- Node* n = nodes_[old_id];
329
- Edge* e = n->in_edge ();
330
- // FIXME: move this condition to a helper: (also used in src/ninja.cc)
331
- if (!e || e->GetBinding (" deps" ).empty ()) {
332
- // Skip entries that don't have in-edges or whose edges don't have a
333
- // "deps" attribute. They were in the deps log from previous builds, but
334
- // the the files they were for were removed from the build and their deps
335
- // entries are no longer needed.
336
- // (Without the check for "deps", a chain of two or more nodes that each
337
- // had deps wouldn't be collected in a single recompaction.)
328
+ if (!IsDepsEntryLiveFor (nodes_[old_id]))
338
329
continue ;
339
- }
340
330
341
331
if (!new_log.RecordDeps (nodes_[old_id], deps->mtime ,
342
332
deps->node_count , deps->nodes )) {
@@ -364,6 +354,16 @@ bool DepsLog::Recompact(const string& path, string* err) {
364
354
return true ;
365
355
}
366
356
357
+ bool DepsLog::IsDepsEntryLiveFor (Node* node) {
358
+ // Skip entries that don't have in-edges or whose edges don't have a
359
+ // "deps" attribute. They were in the deps log from previous builds, but
360
+ // the the files they were for were removed from the build and their deps
361
+ // entries are no longer needed.
362
+ // (Without the check for "deps", a chain of two or more nodes that each
363
+ // had deps wouldn't be collected in a single recompaction.)
364
+ return node->in_edge () && !node->in_edge ()->GetBinding (" deps" ).empty ();
365
+ }
366
+
367
367
bool DepsLog::UpdateDeps (int out_id, Deps* deps) {
368
368
if (out_id >= (int )deps_.size ())
369
369
deps_.resize (out_id + 1 );
0 commit comments