diff options
Diffstat (limited to 'src/graph.cc')
-rw-r--r-- | src/graph.cc | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/graph.cc b/src/graph.cc index 355285c..f1d9ca2 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -37,6 +37,7 @@ bool DependencyScan::RecomputeDirty(Edge* edge, string* err) { edge->outputs_ready_ = true; edge->deps_missing_ = false; + // Load output mtimes so we can compare them to the most recent input below. // RecomputeDirty() recursively walks the graph following the input nodes // of |edge| and the in_edges of these nodes. It uses the stat state of each // node to mark nodes as visited and doesn't traverse across nodes that have @@ -126,8 +127,6 @@ bool DependencyScan::RecomputeOutputsDirty(Edge* edge, Node* most_recent_input, string command = edge->EvaluateCommand(/*incl_rsp_file=*/true); for (vector<Node*>::iterator o = edge->outputs_.begin(); o != edge->outputs_.end(); ++o) { - if (!(*o)->StatIfNecessary(disk_interface_, err)) - return false; if (RecomputeOutputDirty(edge, most_recent_input, command, *o)) { *outputs_dirty = true; return true; @@ -241,8 +240,9 @@ string EdgeEnv::LookupVariable(const string& var) { edge_->inputs_.begin() + explicit_deps_count, var == "in" ? ' ' : '\n'); } else if (var == "out") { + int explicit_outs_count = edge_->outputs_.size() - edge_->implicit_outs_; return MakePathList(edge_->outputs_.begin(), - edge_->outputs_.end(), + edge_->outputs_.begin() + explicit_outs_count, ' '); } @@ -347,12 +347,13 @@ bool Edge::use_console() const { return pool() == &State::kConsolePool; } -string Node::PathDecanonicalized() const { - string result = path_; +// static +string Node::PathDecanonicalized(const string& path, unsigned int slash_bits) { + string result = path; #ifdef _WIN32 unsigned int mask = 1; for (char* c = &result[0]; (c = strchr(c, '/')) != NULL;) { - if (slash_bits_ & mask) + if (slash_bits & mask) *c = '\\'; c++; mask <<= 1; @@ -394,8 +395,15 @@ bool ImplicitDepLoader::LoadDeps(Edge* edge, string* err) { bool ImplicitDepLoader::LoadDepFile(Edge* edge, const string& path, string* err) { METRIC_RECORD("depfile load"); - string content = disk_interface_->ReadFile(path, err); - if (!err->empty()) { + // Read depfile content. Treat a missing depfile as empty. + string content; + switch (disk_interface_->ReadFile(path, &content, err)) { + case DiskInterface::Okay: + break; + case DiskInterface::NotFound: + err->clear(); + break; + case DiskInterface::OtherError: *err = "loading '" + path + "': " + *err; return false; } |