summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Bell <peterbell10@live.co.uk>2022-03-08 05:04:43 (GMT)
committerPeter Bell <peterbell10@live.co.uk>2022-03-08 05:07:28 (GMT)
commit09d4faa0119a5d45911fd5a5b1703e152b040d9a (patch)
tree0074a8be9212187d510539219b6c1fea8ab10514
parentf2333b706a080389583e5e355fd339a37089fe2c (diff)
downloadNinja-09d4faa0119a5d45911fd5a5b1703e152b040d9a.zip
Ninja-09d4faa0119a5d45911fd5a5b1703e152b040d9a.tar.gz
Ninja-09d4faa0119a5d45911fd5a5b1703e152b040d9a.tar.bz2
Clarify the purpose of active_edges in back-propagation
-rw-r--r--src/build.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/build.cc b/src/build.cc
index 04be16c..9c0dbc2 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -553,9 +553,9 @@ void Plan::ComputeCriticalTime(BuildLog* build_log) {
// from the destination nodes.
// XXX: ignores pools
std::queue<Edge*> work_queue; // Queue, for breadth-first traversal
- std::set<const Edge*> active_edges; // Set of edges in work_queue
- SeenBefore<Edge> seen_edge(
- &active_edges); // Test for uniqueness in work_queue
+ // The set of edges currently in work_queue, to avoid duplicates.
+ std::set<const Edge*> active_edges;
+ SeenBefore<Edge> seen_edge(&active_edges);
for (size_t i = 0; i < targets_.size(); ++i) {
const Node* target = targets_[i];
@@ -575,6 +575,8 @@ void Plan::ComputeCriticalTime(BuildLog* build_log) {
while (!work_queue.empty()) {
Edge* e = work_queue.front();
work_queue.pop();
+ // If the critical time of any dependent edges is updated, this
+ // edge may need to be processed again. So re-allow insertion.
active_edges.erase(e);
for (std::vector<Node*>::iterator it = e->inputs_.begin(),