summaryrefslogtreecommitdiffstats
path: root/src/clean.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/clean.cc')
-rw-r--r--src/clean.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/clean.cc b/src/clean.cc
index 72dee1f..575bf6b 100644
--- a/src/clean.cc
+++ b/src/clean.cc
@@ -129,7 +129,16 @@ int Cleaner::CleanDead(const BuildLog::Entries& entries) {
PrintHeader();
for (BuildLog::Entries::const_iterator i = entries.begin(); i != entries.end(); ++i) {
Node* n = state_->LookupNode(i->first);
- if (!n || !n->in_edge()) {
+ // Detecting stale outputs works as follows:
+ //
+ // - If it has no Node, it is not in the build graph, or the deps log
+ // anymore, hence is stale.
+ //
+ // - If it isn't an output or input for any edge, it comes from a stale
+ // entry in the deps log, but no longer referenced from the build
+ // graph.
+ //
+ if (!n || (!n->in_edge() && n->out_edges().empty())) {
Remove(i->first.AsString());
}
}