summaryrefslogtreecommitdiffstats
path: root/src/graph.cc
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2016-02-03 18:20:00 (GMT)
committerBrad King <brad.king@kitware.com>2016-02-03 18:42:18 (GMT)
commit858386d8415d2ee932fe3c01ebfbe5e0737f94a3 (patch)
tree794bd049a0217fda35c9dd3be483cca03cd3367b /src/graph.cc
parentf9487ac7971a668ddf142d5adc741f789c7bbb68 (diff)
downloadNinja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.zip
Ninja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.tar.gz
Ninja-858386d8415d2ee932fe3c01ebfbe5e0737f94a3.tar.bz2
Expose more details in FileReader::ReadFile signature
Return a status so callers can distinguish a missing file from an empty file. This allows our VirtualFileSystem test infrastructure to report as missing any file for which it has no entry.
Diffstat (limited to 'src/graph.cc')
-rw-r--r--src/graph.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/graph.cc b/src/graph.cc
index 9e65675..98f1461 100644
--- a/src/graph.cc
+++ b/src/graph.cc
@@ -395,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;
}