summaryrefslogtreecommitdiffstats
path: root/src/build.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/build.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/build.cc')
-rw-r--r--src/build.cc12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/build.cc b/src/build.cc
index 73dc1ff..76d317f 100644
--- a/src/build.cc
+++ b/src/build.cc
@@ -414,25 +414,17 @@ void Plan::CleanNode(DependencyScan* scan, Node* node) {
begin = (*ei)->inputs_.begin(),
end = (*ei)->inputs_.end() - (*ei)->order_only_deps_;
if (find_if(begin, end, mem_fun(&Node::dirty)) == end) {
- // Recompute most_recent_input and command.
+ // Recompute most_recent_input.
Node* most_recent_input = NULL;
for (vector<Node*>::iterator ni = begin; ni != end; ++ni) {
if (!most_recent_input || (*ni)->mtime() > most_recent_input->mtime())
most_recent_input = *ni;
}
- string command = (*ei)->EvaluateCommand(true);
// Now, this edge is dirty if any of the outputs are dirty.
- bool dirty = false;
- for (vector<Node*>::iterator ni = (*ei)->outputs_.begin();
- !dirty && ni != (*ei)->outputs_.end(); ++ni) {
- dirty = scan->RecomputeOutputDirty(*ei, most_recent_input,
- command, *ni);
- }
-
// If the edge isn't dirty, clean the outputs and mark the edge as not
// wanted.
- if (!dirty) {
+ if (!scan->RecomputeOutputsDirty(*ei, most_recent_input)) {
for (vector<Node*>::iterator ni = (*ei)->outputs_.begin();
ni != (*ei)->outputs_.end(); ++ni) {
CleanNode(scan, *ni);