diff options
author | Evan Martin <martine@danga.com> | 2011-12-07 01:32:25 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-12-07 01:32:25 (GMT) |
commit | b6b33fd295b2ed892f2d31a7d1b82dd21d7cf3bd (patch) | |
tree | 0c5f3f8b28dfab75b9a8b3b94cebdff516bd2885 | |
parent | 51cab0b9dbbee5dc6a656a8f4ce15330f36a7a2c (diff) | |
download | Ninja-b6b33fd295b2ed892f2d31a7d1b82dd21d7cf3bd.zip Ninja-b6b33fd295b2ed892f2d31a7d1b82dd21d7cf3bd.tar.gz Ninja-b6b33fd295b2ed892f2d31a7d1b82dd21d7cf3bd.tar.bz2 |
add and use getter for Edge::rule_
-rw-r--r-- | src/build.cc | 4 | ||||
-rw-r--r-- | src/build_test.cc | 10 | ||||
-rw-r--r-- | src/clean.cc | 6 | ||||
-rw-r--r-- | src/graph.h | 1 |
4 files changed, 11 insertions, 10 deletions
diff --git a/src/build.cc b/src/build.cc index f3d7d9b..d074d2b 100644 --- a/src/build.cc +++ b/src/build.cc @@ -575,7 +575,7 @@ void Builder::FinishEdge(Edge* edge, bool success, const string& output) { time_t restat_mtime = 0; if (success) { - if (edge->rule_->restat_) { + if (edge->rule().restat_) { bool node_cleaned = false; for (vector<Node*>::iterator i = edge->outputs_.begin(); @@ -605,7 +605,7 @@ void Builder::FinishEdge(Edge* edge, bool success, const string& output) { restat_mtime = input_mtime; } - if (restat_mtime != 0 && !edge->rule_->depfile_.empty()) { + if (restat_mtime != 0 && !edge->rule().depfile_.empty()) { time_t depfile_mtime = disk_interface_->Stat(edge->EvaluateDepFile()); if (depfile_mtime == 0) restat_mtime = 0; diff --git a/src/build_test.cc b/src/build_test.cc index 0d4dce6..b1879ff 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -233,14 +233,14 @@ bool BuildTest::CanRunMore() { bool BuildTest::StartCommand(Edge* edge) { assert(!last_command_); commands_ran_.push_back(edge->EvaluateCommand()); - if (edge->rule_->name_ == "cat" || edge->rule_->name_ == "cc" || - edge->rule_->name_ == "touch") { + if (edge->rule().name_ == "cat" || edge->rule_->name_ == "cc" || + edge->rule().name_ == "touch") { for (vector<Node*>::iterator out = edge->outputs_.begin(); out != edge->outputs_.end(); ++out) { fs_.Create((*out)->file_->path_, now_, ""); } - } else if (edge->rule_->name_ == "true" || - edge->rule_->name_ == "fail") { + } else if (edge->rule().name_ == "true" || + edge->rule().name_ == "fail") { // Don't do anything. } else { printf("unknown command\n"); @@ -253,7 +253,7 @@ bool BuildTest::StartCommand(Edge* edge) { Edge* BuildTest::WaitForCommand(bool* success, string* output) { if (Edge* edge = last_command_) { - if (edge->rule_->name_ == "fail") + if (edge->rule().name_ == "fail") *success = false; else *success = true; diff --git a/src/clean.cc b/src/clean.cc index a89e1f5..8ae4385 100644 --- a/src/clean.cc +++ b/src/clean.cc @@ -105,13 +105,13 @@ int Cleaner::CleanAll(bool generator) { if ((*e)->rule_ == &State::kPhonyRule) continue; // Do not remove generator's files unless generator specified. - if (!generator && (*e)->rule_->generator_) + if (!generator && (*e)->rule().generator_) continue; for (vector<Node*>::iterator out_node = (*e)->outputs_.begin(); out_node != (*e)->outputs_.end(); ++out_node) { Remove((*out_node)->file_->path_); } - if (!(*e)->rule_->depfile_.empty()) + if (!(*e)->rule().depfile_.empty()) Remove((*e)->EvaluateDepFile()); } PrintFooter(); @@ -178,7 +178,7 @@ void Cleaner::DoCleanRule(const Rule* rule) { for (vector<Edge*>::iterator e = state_->edges_.begin(); e != state_->edges_.end(); ++e) - if ((*e)->rule_->name_ == rule->name_) + if ((*e)->rule().name_ == rule->name_) for (vector<Node*>::iterator out_node = (*e)->outputs_.begin(); out_node != (*e)->outputs_.end(); ++out_node) diff --git a/src/graph.h b/src/graph.h index 67f7b10..1a0b624 100644 --- a/src/graph.h +++ b/src/graph.h @@ -104,6 +104,7 @@ struct Edge { Env* env_; bool outputs_ready_; + const Rule& rule() const { return *rule_; } bool outputs_ready() const { return outputs_ready_; } // XXX There are three types of inputs. |