summaryrefslogtreecommitdiff
path: root/src/state.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/state.cc')
-rw-r--r--src/state.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/state.cc b/src/state.cc
index d3a9e29..556b0d8 100644
--- a/src/state.cc
+++ b/src/state.cc
@@ -19,7 +19,6 @@
#include "edit_distance.h"
#include "graph.h"
-#include "metrics.h"
#include "util.h"
using namespace std;
@@ -39,7 +38,7 @@ void Pool::DelayEdge(Edge* edge) {
delayed_.insert(edge);
}
-void Pool::RetrieveReadyEdges(set<Edge*>* ready_queue) {
+void Pool::RetrieveReadyEdges(EdgeSet* ready_queue) {
DelayedEdges::iterator it = delayed_.begin();
while (it != delayed_.end()) {
Edge* edge = *it;
@@ -62,14 +61,6 @@ void Pool::Dump() const {
}
}
-// static
-bool Pool::WeightedEdgeCmp(const Edge* a, const Edge* b) {
- if (!a) return b;
- if (!b) return false;
- int weight_diff = a->weight() - b->weight();
- return ((weight_diff < 0) || (weight_diff == 0 && a < b));
-}
-
Pool State::kDefaultPool("", 0);
Pool State::kConsolePool("console", 1);
const Rule State::kPhonyRule("phony");
@@ -97,6 +88,7 @@ Edge* State::AddEdge(const Rule* rule) {
edge->rule_ = rule;
edge->pool_ = &State::kDefaultPool;
edge->env_ = &bindings_;
+ edge->id_ = edges_.size();
edges_.push_back(edge);
return edge;
}
@@ -111,7 +103,6 @@ Node* State::GetNode(StringPiece path, uint64_t slash_bits) {
}
Node* State::LookupNode(StringPiece path) const {
- METRIC_RECORD("lookup node");
Paths::const_iterator i = paths_.find(path);
if (i != paths_.end())
return i->second;
@@ -150,6 +141,12 @@ bool State::AddOut(Edge* edge, StringPiece path, uint64_t slash_bits) {
return true;
}
+void State::AddValidation(Edge* edge, StringPiece path, uint64_t slash_bits) {
+ Node* node = GetNode(path, slash_bits);
+ edge->validations_.push_back(node);
+ node->AddValidationOutEdge(edge);
+}
+
bool State::AddDefault(StringPiece path, string* err) {
Node* node = LookupNode(path);
if (!node) {