summaryrefslogtreecommitdiffstats
path: root/src/graph.cc
diff options
context:
space:
mode:
authorMaxim Kalaev <maximus.ka@gmail.com>2013-09-02 22:32:19 (GMT)
committerNico Weber <nicolasweber@gmx.de>2013-09-02 22:32:19 (GMT)
commit41c6258ec1928cbcfc5642504cb9c2b3659fa897 (patch)
tree5c13188a748ee68f36165e937d1e8675850af852 /src/graph.cc
parentd7a46654a7be1a46a777a8d8a51f065ac98ce05d (diff)
downloadNinja-41c6258ec1928cbcfc5642504cb9c2b3659fa897.zip
Ninja-41c6258ec1928cbcfc5642504cb9c2b3659fa897.tar.gz
Ninja-41c6258ec1928cbcfc5642504cb9c2b3659fa897.tar.bz2
Share more code between CleanNode() and RecomputeDirty().
Move a common loop into the new function RecomputeOutputsDirty(). Simplifies things a bit, and makes it harder for the restat path to have different behavior from the regular path. No dramatic behavior change (the restat path now also calls RestatIfNecessary()).
Diffstat (limited to 'src/graph.cc')
-rw-r--r--src/graph.cc26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/graph.cc b/src/graph.cc
index b58e17f..eeb3db1 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -106,18 +106,8 @@ bool DependencyScan::RecomputeDirty(Edge* edge, string* err) {
// We may also be dirty due to output state: missing outputs, out of
// date outputs, etc. Visit all outputs and determine whether they're dirty.
- if (!dirty) {
- string command = edge->EvaluateCommand(true);
-
- for (vector<Node*>::iterator i = edge->outputs_.begin();
- i != edge->outputs_.end(); ++i) {
- (*i)->StatIfNecessary(disk_interface_);
- if (RecomputeOutputDirty(edge, most_recent_input, command, *i)) {
- dirty = true;
- break;
- }
- }
- }
+ if (!dirty)
+ dirty = RecomputeOutputsDirty(edge, most_recent_input);
// Finally, visit each output to mark off that we've visited it, and update
// their dirty state if necessary.
@@ -139,6 +129,18 @@ bool DependencyScan::RecomputeDirty(Edge* edge, string* err) {
return true;
}
+bool DependencyScan::RecomputeOutputsDirty(Edge* edge,
+ Node* most_recent_input) {
+ string command = edge->EvaluateCommand(true);
+ for (vector<Node*>::iterator i = edge->outputs_.begin();
+ i != edge->outputs_.end(); ++i) {
+ (*i)->StatIfNecessary(disk_interface_);
+ if (RecomputeOutputDirty(edge, most_recent_input, command, *i))
+ return true;
+ }
+ return false;
+}
+
bool DependencyScan::RecomputeOutputDirty(Edge* edge,
Node* most_recent_input,
const string& command,