summaryrefslogtreecommitdiffstats
path: root/src/state.cc
diff options
context:
space:
mode:
authorJan Niklas Hasse <jhasse@bixense.com>2022-05-15 15:05:27 (GMT)
committerJan Niklas Hasse <jhasse@bixense.com>2022-05-15 15:08:10 (GMT)
commit51edeeb063a82693573db43782d9e3733b2840e4 (patch)
tree8c10c9376892e93762136985265ff8c9f51299b0 /src/state.cc
parente72d1d581c945c158ed68d9bc48911063022a2c6 (diff)
parentbb471e235a83fd2b146299cd7d4d3a95163de10a (diff)
downloadNinja-51edeeb063a82693573db43782d9e3733b2840e4.zip
Ninja-51edeeb063a82693573db43782d9e3733b2840e4.tar.gz
Ninja-51edeeb063a82693573db43782d9e3733b2840e4.tar.bz2
v1.11.0v1.11.0
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) {