diff options
author | Nico Weber <nicolasweber@gmx.de> | 2014-01-02 04:31:34 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2014-01-02 04:31:34 (GMT) |
commit | b2e6fcf7031cfaf995c65820d14d4aa390daf9fb (patch) | |
tree | febb947ed184e0bff21fa0556adc941c2dca4c82 /src/deps_log.cc | |
parent | 38db96cba7886aeaec7f9af7f5f2eb960d3e1175 (diff) | |
download | Ninja-b2e6fcf7031cfaf995c65820d14d4aa390daf9fb.zip Ninja-b2e6fcf7031cfaf995c65820d14d4aa390daf9fb.tar.gz Ninja-b2e6fcf7031cfaf995c65820d14d4aa390daf9fb.tar.bz2 |
Remove dead entries in .ninja_log and .ninja_deps while recompacting.
For .ninja_deps, remove objects that have no in-edges or whose in-edges
do not have a "deps" attribute. (This matches the behaviour of `-t
deps`).
BuildLog doesn't know about state, so let its recompact method take
delegate that decides is a path is life or not, and implement it in
NinjaMain.
Diffstat (limited to 'src/deps_log.cc')
-rw-r--r-- | src/deps_log.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/deps_log.cc b/src/deps_log.cc index 4f1214a..0a3f7e5 100644 --- a/src/deps_log.cc +++ b/src/deps_log.cc @@ -325,6 +325,13 @@ bool DepsLog::Recompact(const string& path, string* err) { Deps* deps = deps_[old_id]; if (!deps) continue; // If nodes_[old_id] is a leaf, it has no deps. + Node* n = nodes_[old_id]; + Edge* e = n->in_edge(); + // FIXME: move this condition to a helper: (also used in src/ninja.cc) + if (!e || e->GetBinding("deps").empty()) { + continue; + } + if (!new_log.RecordDeps(nodes_[old_id], deps->mtime, deps->node_count, deps->nodes)) { new_log.Close(); |