diff options
author | Evan Martin <martine@danga.com> | 2011-09-14 15:57:36 (GMT) |
---|---|---|
committer | Evan Martin <martine@danga.com> | 2011-09-14 15:57:36 (GMT) |
commit | f47c158ba6c538e928005a49f05dbd9c23923c15 (patch) | |
tree | 345c4b342acaa03973bff43e7515fa4b4cdcfd27 /src/graph.cc | |
parent | 5d92beafdadc6c531fa1c4c000464dea3e4c046c (diff) | |
parent | 58fbb3c587117d798b368eec48a7d03f042961bb (diff) | |
download | Ninja-f47c158ba6c538e928005a49f05dbd9c23923c15.zip Ninja-f47c158ba6c538e928005a49f05dbd9c23923c15.tar.gz Ninja-f47c158ba6c538e928005a49f05dbd9c23923c15.tar.bz2 |
Merge pull request #106 from pcc/depfile-vector
Allocate space in the inputs vector for the depfile implicit deps
Diffstat (limited to 'src/graph.cc')
-rw-r--r-- | src/graph.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/graph.cc b/src/graph.cc index 9c99b3d..16299c0 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -169,23 +169,26 @@ bool Edge::LoadDepFile(State* state, DiskInterface* disk_interface, return false; } + inputs_.insert(inputs_.end() - order_only_deps_, makefile.ins_.size(), 0); + implicit_deps_ += makefile.ins_.size(); + vector<Node*>::iterator implicit_dep = + inputs_.end() - order_only_deps_ - makefile.ins_.size(); + // Add all its in-edges. for (vector<StringPiece>::iterator i = makefile.ins_.begin(); - i != makefile.ins_.end(); ++i) { + i != makefile.ins_.end(); ++i, ++implicit_dep) { string path(i->str_, i->len_); CanonicalizePath(&path); Node* node = state->GetNode(path); - inputs_.insert(inputs_.end() - order_only_deps_, node); + *implicit_dep = node; node->out_edges_.push_back(this); - ++implicit_deps_; // If we don't have a edge that generates this input already, // create one; this makes us not abort if the input is missing, // but instead will rebuild in that circumstance. if (!node->in_edge_) { Edge* phony_edge = state->AddEdge(&State::kPhonyRule); - phony_edge->order_only_deps_ = 1; node->in_edge_ = phony_edge; phony_edge->outputs_.push_back(node); } |