Check the error code and save a call to sys::fs::exists.
authorRafael Espindola <rafael.espindola@gmail.com>
Wed, 15 Jan 2014 04:49:50 +0000 (04:49 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Wed, 15 Jan 2014 04:49:50 +0000 (04:49 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199293 91177308-0d34-0410-b5e6-96231b3b80d8

tools/llvm-symbolizer/LLVMSymbolize.cpp

index 0e6e80a21beffff9f71e613447e259ba0b079b18..751453c27fbe7b85f8cb7d5e305afd28b002fc5f 100644 (file)
@@ -312,10 +312,8 @@ LLVMSymbolizer::getOrCreateBinary(const std::string &Path) {
       // 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);
       }