diff options
author | Nico Weber <thakis@chromium.org> | 2014-11-24 17:37:47 (GMT) |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2014-11-24 17:37:47 (GMT) |
commit | 3309498174411e02e7680ea8b470bb7d1d70bdb8 (patch) | |
tree | 2c84adc7263350e6929dca36d778ea7e29fe5cc5 /src/graph.cc | |
parent | 85e13c163d0129216fb382df6a53d11393c4c0c2 (diff) | |
parent | b532cab080bbde2068ab49aba814c7176111681f (diff) | |
download | Ninja-3309498174411e02e7680ea8b470bb7d1d70bdb8.zip Ninja-3309498174411e02e7680ea8b470bb7d1d70bdb8.tar.gz Ninja-3309498174411e02e7680ea8b470bb7d1d70bdb8.tar.bz2 |
v1.5.3v1.5.3
Diffstat (limited to 'src/graph.cc')
-rw-r--r-- | src/graph.cc | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/src/graph.cc b/src/graph.cc index aa9c0e8..2829669 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -131,7 +131,7 @@ bool DependencyScan::RecomputeDirty(Edge* edge, string* err) { } bool DependencyScan::RecomputeOutputsDirty(Edge* edge, - Node* most_recent_input) { + Node* most_recent_input) { string command = edge->EvaluateCommand(true); for (vector<Node*>::iterator i = edge->outputs_.begin(); i != edge->outputs_.end(); ++i) { @@ -256,7 +256,7 @@ string EdgeEnv::MakePathList(vector<Node*>::iterator begin, for (vector<Node*>::iterator i = begin; i != end; ++i) { if (!result.empty()) result.push_back(sep); - const string& path = (*i)->path(); + const string& path = (*i)->PathDecanonicalized(); if (escape_in_out_ == kShellEscape) { #if _WIN32 GetWin32EscapedString(path, &result); @@ -328,6 +328,20 @@ bool Edge::use_console() const { return pool() == &State::kConsolePool; } +string Node::PathDecanonicalized() const { + string result = path_; +#ifdef _WIN32 + unsigned int mask = 1; + for (char* c = &result[0]; (c = strchr(c, '/')) != NULL;) { + if (slash_bits_ & mask) + *c = '\\'; + c++; + mask <<= 1; + } +#endif + return result; +} + void Node::Dump(const char* prefix) const { printf("%s <%s 0x%p> mtime: %d%s, (:%s), ", prefix, path().c_str(), this, @@ -379,6 +393,11 @@ bool ImplicitDepLoader::LoadDepFile(Edge* edge, const string& path, return false; } + unsigned int unused; + if (!CanonicalizePath(const_cast<char*>(depfile.out_.str_), + &depfile.out_.len_, &unused, err)) + return false; + // Check that this depfile matches the edge's output. Node* first_output = edge->outputs_[0]; StringPiece opath = StringPiece(first_output->path()); @@ -395,10 +414,12 @@ bool ImplicitDepLoader::LoadDepFile(Edge* edge, const string& path, // Add all its in-edges. for (vector<StringPiece>::iterator i = depfile.ins_.begin(); i != depfile.ins_.end(); ++i, ++implicit_dep) { - if (!CanonicalizePath(const_cast<char*>(i->str_), &i->len_, err)) + unsigned int slash_bits; + if (!CanonicalizePath(const_cast<char*>(i->str_), &i->len_, &slash_bits, + err)) return false; - Node* node = state_->GetNode(*i); + Node* node = state_->GetNode(*i, slash_bits); *implicit_dep = node; node->AddOutEdge(edge); CreatePhonyInEdge(node); |