Check the error code and save a call to sys::fs::exists.
llvm-svn: 199293
diff --git a/llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp b/llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp
index 0e6e80a..751453c 100644
--- a/llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp
+++ b/llvm/tools/llvm-symbolizer/LLVMSymbolize.cpp
@@ -312,10 +312,8 @@
// resource directory.
const std::string &ResourcePath =
getDarwinDWARFResourceForPath(Path);
- bool ResourceFileExists = false;
- if (!sys::fs::exists(ResourcePath, ResourceFileExists) &&
- ResourceFileExists &&
- !error(createBinary(ResourcePath, ParsedDbgBinary))) {
+ error_code EC = createBinary(ResourcePath, ParsedDbgBinary);
+ if (EC != errc::no_such_file_or_directory && !error(EC)) {
DbgBin = ParsedDbgBinary.take();
ParsedBinariesAndObjects.push_back(DbgBin);
}