summaryrefslogtreecommitdiffstats
path: root/src/graph.cc
diff options
context:
space:
mode:
authorTomasz Śniatowski <tsniatowski@vewd.com>2021-02-15 12:06:30 (GMT)
committerTomasz Śniatowski <tsniatowski@vewd.com>2021-02-22 22:48:58 (GMT)
commitd0489c3863f6b2a0d0b0e15880217da3fd4e6d8f (patch)
treec06f68e990ecec121dcff0939287a0e8b1777858 /src/graph.cc
parentb0662970ba2cc69a64d7d2ebe3e07dcef948dabe (diff)
downloadNinja-d0489c3863f6b2a0d0b0e15880217da3fd4e6d8f.zip
Ninja-d0489c3863f6b2a0d0b0e15880217da3fd4e6d8f.tar.gz
Ninja-d0489c3863f6b2a0d0b0e15880217da3fd4e6d8f.tar.bz2
Refactor depfile loading in preparation for the missingdeps tool
Extract an usable helper to load depfile dependencies without adding them to the graph.
Diffstat (limited to 'src/graph.cc')
-rw-r--r--src/graph.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/graph.cc b/src/graph.cc
index 78d0d49..90e8d08 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -588,13 +588,18 @@ bool ImplicitDepLoader::LoadDepFile(Edge* edge, const string& path,
}
}
+ return ProcessDepfileDeps(edge, &depfile.ins_, err);
+}
+
+bool ImplicitDepLoader::ProcessDepfileDeps(
+ Edge* edge, std::vector<StringPiece>* depfile_ins, std::string* err) {
// Preallocate space in edge->inputs_ to be filled in below.
vector<Node*>::iterator implicit_dep =
- PreallocateSpace(edge, depfile.ins_.size());
+ PreallocateSpace(edge, depfile_ins->size());
// Add all its in-edges.
- for (vector<StringPiece>::iterator i = depfile.ins_.begin();
- i != depfile.ins_.end(); ++i, ++implicit_dep) {
+ for (std::vector<StringPiece>::iterator i = depfile_ins->begin();
+ i != depfile_ins->end(); ++i, ++implicit_dep) {
uint64_t slash_bits;
if (!CanonicalizePath(const_cast<char*>(i->str_), &i->len_, &slash_bits,
err))