diff options
Diffstat (limited to 'src/state.cc')
-rw-r--r-- | src/state.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/state.cc b/src/state.cc index 7e3aae8..9f38fe9 100644 --- a/src/state.cc +++ b/src/state.cc @@ -19,6 +19,7 @@ #include "edit_distance.h" #include "graph.h" +#include "metrics.h" #include "util.h" const Rule State::kPhonyRule("phony"); @@ -57,6 +58,7 @@ Node* State::GetNode(StringPiece path) { } Node* State::LookupNode(StringPiece path) { + METRIC_RECORD("lookup node"); Paths::iterator i = paths_.find(path); if (i != paths_.end()) return i->second; @@ -80,26 +82,27 @@ Node* State::SpellcheckNode(const string& path) { return result; } -void State::AddIn(Edge* edge, const string& path) { +void State::AddIn(Edge* edge, StringPiece path) { Node* node = GetNode(path); edge->inputs_.push_back(node); node->AddOutEdge(edge); } -void State::AddOut(Edge* edge, const string& path) { +void State::AddOut(Edge* edge, StringPiece path) { Node* node = GetNode(path); edge->outputs_.push_back(node); if (node->in_edge()) { Warning("multiple rules generate %s. " - "build will not be correct; continuing anyway", path.c_str()); + "build will not be correct; continuing anyway", + path.AsString().c_str()); } node->set_in_edge(edge); } -bool State::AddDefault(const string& path, string* err) { +bool State::AddDefault(StringPiece path, string* err) { Node* node = LookupNode(path); if (!node) { - *err = "unknown target '" + path + "'"; + *err = "unknown target '" + path.AsString() + "'"; return false; } defaults_.push_back(node); |