summaryrefslogtreecommitdiffstats
path: root/src/state.cc
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2012-01-09 21:35:16 (GMT)
committerEvan Martin <martine@danga.com>2012-01-09 21:35:16 (GMT)
commit5aa69297e47109bd5d2cc8db6907af56ff100d6d (patch)
treedece8061a67308ea9da132dfe4f48a48335fa7dd /src/state.cc
parenta844fba695d4a62d4ae5bf98c6df3b0677df18b2 (diff)
downloadNinja-5aa69297e47109bd5d2cc8db6907af56ff100d6d.zip
Ninja-5aa69297e47109bd5d2cc8db6907af56ff100d6d.tar.gz
Ninja-5aa69297e47109bd5d2cc8db6907af56ff100d6d.tar.bz2
more stringpiece
Diffstat (limited to 'src/state.cc')
-rw-r--r--src/state.cc13
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);