summaryrefslogtreecommitdiffstats
path: root/src/build.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/build.h')
-rw-r--r--src/build.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/build.h b/src/build.h
index 66ce607..9b90e8a 100644
--- a/src/build.h
+++ b/src/build.h
@@ -71,23 +71,36 @@ struct Plan {
/// Number of edges with commands to run.
int command_edge_count() const { return command_edges_; }
+ /// Reset state. Clears want and ready sets.
+ void Reset();
+
private:
- bool AddSubTarget(Node* node, vector<Node*>* stack, string* err);
- bool CheckDependencyCycle(Node* node, const vector<Node*>& stack,
- string* err);
+ bool AddSubTarget(Node* node, Node* dependent, string* err);
void NodeFinished(Node* node);
+ /// Enumerate possible steps we want for an edge.
+ enum Want
+ {
+ /// We do not want to build the edge, but we might want to build one of
+ /// its dependents.
+ kWantNothing,
+ /// We want to build the edge, but have not yet scheduled it.
+ kWantToStart,
+ /// We want to build the edge, have scheduled it, and are waiting
+ /// for it to complete.
+ kWantToFinish
+ };
+
/// 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.
- void ScheduleWork(Edge* edge);
+ void ScheduleWork(map<Edge*, Want>::iterator want_e);
/// Keep track of which edges we want to build in this plan. If this map does
/// not contain an entry for an edge, we do not want to build the entry or its
- /// dependents. If an entry maps to false, we do not want to build it, but we
- /// might want to build one of its dependents. If the entry maps to true, we
- /// want to build it.
- map<Edge*, bool> want_;
+ /// dependents. If it does contain an entry, the enumeration indicates what
+ /// we want for the edge.
+ map<Edge*, Want> want_;
set<Edge*> ready_;
@@ -177,7 +190,11 @@ struct Builder {
State* state_;
const BuildConfig& config_;
Plan plan_;
+#if __cplusplus < 201703L
auto_ptr<CommandRunner> command_runner_;
+#else
+ unique_ptr<CommandRunner> command_runner_; // auto_ptr was removed in C++17.
+#endif
BuildStatus* status_;
private: