diff options
author | Brad King <brad.king@kitware.com> | 2015-08-06 17:30:09 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-04-18 12:21:44 (GMT) |
commit | 64acb1a22b1001df96a4dfb7f36c16d7f56df392 (patch) | |
tree | 0716b7870e2e271822fdd84504e04ac99a8ad9e0 | |
parent | 70d356218beff99ddaa048ff357f2d2692a32b7a (diff) | |
download | Ninja-64acb1a22b1001df96a4dfb7f36c16d7f56df392.zip Ninja-64acb1a22b1001df96a4dfb7f36c16d7f56df392.tar.gz Ninja-64acb1a22b1001df96a4dfb7f36c16d7f56df392.tar.bz2 |
Factor out edge marking logic from Plan::AddSubTarget
Move the logic to mark edges as wanted over to a Plan::EdgeWanted method
so it can be re-used elsewhere later.
-rw-r--r-- | src/build.cc | 10 | ||||
-rw-r--r-- | src/build.h | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/src/build.cc b/src/build.cc index d76d7f2..7b53a5d 100644 --- a/src/build.cc +++ b/src/build.cc @@ -327,11 +327,9 @@ bool Plan::AddSubTarget(Node* node, Node* dependent, string* err) { // mark it now. if (node->dirty() && want == kWantNothing) { want = kWantToStart; - ++wanted_edges_; + EdgeWanted(edge); if (edge->AllInputsReady()) ScheduleWork(want_ins.first); - if (!edge->is_phony()) - ++command_edges_; } if (!want_ins.second) @@ -346,6 +344,12 @@ bool Plan::AddSubTarget(Node* node, Node* dependent, string* err) { return true; } +void Plan::EdgeWanted(Edge* edge) { + ++wanted_edges_; + if (!edge->is_phony()) + ++command_edges_; +} + Edge* Plan::FindWork() { if (ready_.empty()) return NULL; diff --git a/src/build.h b/src/build.h index fdd9891..1473f11 100644 --- a/src/build.h +++ b/src/build.h @@ -96,6 +96,8 @@ private: kWantToFinish }; + void EdgeWanted(Edge* edge); + /// Submits a ready edge as a candidate for execution. /// The edge may be delayed from running, for example if it's a member of a /// currently-full pool. |