Add explicit "empty path" errors before calling CanonicalizePath

Update call sites that might have empty paths to explicitly check for
them before calling CanonicalizePath.  Note that the depfile parser
ensures all parsed outs and deps are non-empty.
diff --git a/src/clean.cc b/src/clean.cc
index 3e57437..1e97182 100644
--- a/src/clean.cc
+++ b/src/clean.cc
@@ -189,6 +189,11 @@
   LoadDyndeps();
   for (int i = 0; i < target_count; ++i) {
     string target_name = targets[i];
+    if (target_name.empty()) {
+      Error("failed to canonicalize '': empty path");
+      status_ = 1;
+      continue;
+    }
     uint64_t slash_bits;
     string err;
     if (!CanonicalizePath(&target_name, &slash_bits, &err)) {
diff --git a/src/dyndep_parser.cc b/src/dyndep_parser.cc
index 56da16f..45d1c31 100644
--- a/src/dyndep_parser.cc
+++ b/src/dyndep_parser.cc
@@ -115,6 +115,8 @@
       return lexer_.Error("expected path", err);
 
     string path = out0.Evaluate(&env_);
+    if (path.empty())
+      return lexer_.Error("empty path", err);
     string path_err;
     uint64_t slash_bits;
     if (!CanonicalizePath(&path, &slash_bits, &path_err))
@@ -202,6 +204,8 @@
   dyndeps->implicit_inputs_.reserve(ins.size());
   for (vector<EvalString>::iterator i = ins.begin(); i != ins.end(); ++i) {
     string path = i->Evaluate(&env_);
+    if (path.empty())
+      return lexer_.Error("empty path", err);
     string path_err;
     uint64_t slash_bits;
     if (!CanonicalizePath(&path, &slash_bits, &path_err))
@@ -213,6 +217,8 @@
   dyndeps->implicit_outputs_.reserve(outs.size());
   for (vector<EvalString>::iterator i = outs.begin(); i != outs.end(); ++i) {
     string path = i->Evaluate(&env_);
+    if (path.empty())
+      return lexer_.Error("empty path", err);
     string path_err;
     uint64_t slash_bits;
     if (!CanonicalizePath(&path, &slash_bits, &path_err))
diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc
index f77109f..8f0528a 100644
--- a/src/manifest_parser.cc
+++ b/src/manifest_parser.cc
@@ -190,6 +190,8 @@
 
   do {
     string path = eval.Evaluate(env_);
+    if (path.empty())
+      return lexer_.Error("empty path", err);
     string path_err;
     uint64_t slash_bits;  // Unused because this only does lookup.
     if (!CanonicalizePath(&path, &slash_bits, &path_err))
@@ -317,6 +319,8 @@
   edge->outputs_.reserve(outs.size());
   for (size_t i = 0, e = outs.size(); i != e; ++i) {
     string path = outs[i].Evaluate(env);
+    if (path.empty())
+      return lexer_.Error("empty path", err);
     string path_err;
     uint64_t slash_bits;
     if (!CanonicalizePath(&path, &slash_bits, &path_err))
@@ -349,6 +353,8 @@
   edge->inputs_.reserve(ins.size());
   for (vector<EvalString>::iterator i = ins.begin(); i != ins.end(); ++i) {
     string path = i->Evaluate(env);
+    if (path.empty())
+      return lexer_.Error("empty path", err);
     string path_err;
     uint64_t slash_bits;
     if (!CanonicalizePath(&path, &slash_bits, &path_err))
diff --git a/src/ninja.cc b/src/ninja.cc
index c7182df..d55290c 100644
--- a/src/ninja.cc
+++ b/src/ninja.cc
@@ -252,6 +252,10 @@
 bool NinjaMain::RebuildManifest(const char* input_file, string* err,
                                 Status* status) {
   string path = input_file;
+  if (path.empty()) {
+    *err = "empty path";
+    return false;
+  }
   uint64_t slash_bits;  // Unused because this path is only used for lookup.
   if (!CanonicalizePath(&path, &slash_bits, err))
     return false;
@@ -284,6 +288,10 @@
 
 Node* NinjaMain::CollectTarget(const char* cpath, string* err) {
   string path = cpath;
+  if (path.empty()) {
+    *err = "empty path";
+    return NULL;
+  }
   uint64_t slash_bits;
   if (!CanonicalizePath(&path, &slash_bits, err))
     return NULL;