summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Martin <martine@danga.com>2011-12-07 17:51:14 (GMT)
committerEvan Martin <martine@danga.com>2011-12-07 17:51:14 (GMT)
commit20b3e6ba2161b42f5fec72ac5adda424f4b68f34 (patch)
tree3bee841de2548230c90310c4fa6d389a238e0f8e
parent2863acbe2a3ab11c0a6d5efa93c0491cac63d72a (diff)
downloadNinja-20b3e6ba2161b42f5fec72ac5adda424f4b68f34.zip
Ninja-20b3e6ba2161b42f5fec72ac5adda424f4b68f34.tar.gz
Ninja-20b3e6ba2161b42f5fec72ac5adda424f4b68f34.tar.bz2
make Rule::generator_ and restat_ private
-rw-r--r--src/build.cc2
-rw-r--r--src/clean.cc2
-rw-r--r--src/graph.cc4
-rw-r--r--src/graph.h12
4 files changed, 14 insertions, 6 deletions
diff --git a/src/build.cc b/src/build.cc
index a6d8bf1..c69c967 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -572,7 +572,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();
diff --git a/src/clean.cc b/src/clean.cc
index 9a39ec9..e8405f5 100644
--- a/src/clean.cc
+++ b/src/clean.cc
@@ -105,7 +105,7 @@ 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) {
diff --git a/src/graph.cc b/src/graph.cc
index dcfa622..90e730c 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -122,7 +122,7 @@ bool Edge::RecomputeOutputDirty(BuildLog* build_log, time_t most_recent_input,
// rule in a previous run and stored the most recent input mtime in the
// build log. Use that mtime instead, so that the file will only be
// considered dirty if an input was modified since the previous run.
- if (rule_->restat_ && build_log &&
+ if (rule_->restat() && build_log &&
(entry = build_log->LookupByOutput(output->path()))) {
if (entry->restat_mtime < most_recent_input)
return true;
@@ -134,7 +134,7 @@ bool Edge::RecomputeOutputDirty(BuildLog* build_log, time_t most_recent_input,
// May also be dirty due to the command changing since the last build.
// But if this is a generator rule, the command changing does not make us
// dirty.
- if (!rule_->generator_ && build_log &&
+ if (!rule_->generator() && build_log &&
(entry || (entry = build_log->LookupByOutput(output->path())))) {
if (command != entry->command)
return true;
diff --git a/src/graph.h b/src/graph.h
index e8c6c57..067d90e 100644
--- a/src/graph.h
+++ b/src/graph.h
@@ -101,16 +101,24 @@ struct Rule {
const string& name() const { return name_; }
+ bool generator() const { return generator_; }
+ bool restat() const { return restat_; }
+
private:
string name_;
- // TODO: make these private. But adding set/getters for each is so boring
- // and doesn't really contribute to the readability of the code...
+ // TODO: make these private. But various tests want to reach into them...
public:
EvalString command_;
EvalString description_;
EvalString depfile_;
+
+private:
bool generator_, restat_;
+
+ // Allow the parsers to reach into this object and fill out its fields.
+ friend class ManifestParser;
+ friend class ParserTest;
};
struct BuildLog;