Index: include/llvm/Support/FileSystem.h =================================================================== --- include/llvm/Support/FileSystem.h +++ include/llvm/Support/FileSystem.h @@ -1031,8 +1031,10 @@ State->HasNoPushRequest = false; else { ErrorOr st = State->Stack.top()->status(); - if (!st) return *this; - if (is_directory(*st)) { + if (!st) { + ec = st.getError(); + return *this; + } else if (is_directory(*st)) { State->Stack.push(directory_iterator(*State->Stack.top(), ec, Follow)); if (ec) return *this; if (State->Stack.top() != end_itr) { Index: tools/llvm-cov/CodeCoverage.cpp =================================================================== --- tools/llvm-cov/CodeCoverage.cpp +++ tools/llvm-cov/CodeCoverage.cpp @@ -199,7 +199,7 @@ if (PathRemapping) addCollectedPath(Path); else - error("Missing source file", Path); + warning("source file doesn't exit, proceeded by ignoring it.", Path); return; } @@ -210,13 +210,17 @@ if (llvm::sys::fs::is_directory(Status)) { std::error_code EC; + std::string path_before_error_occurs; for (llvm::sys::fs::recursive_directory_iterator F(Path, EC), E; F != E && !EC; F.increment(EC)) { + path_before_error_occurs = F->path(); if (llvm::sys::fs::is_regular_file(F->path())) addCollectedPath(F->path()); } - if (EC) - warning(EC.message(), Path); + if (EC) { + warning(EC.message(), path_before_error_occurs); + warning("code coverage results may be incomplete."); + } } }