[lld] r191069 - Generalize errStr() function so that it can handle any type of errors.

Rui Ueyama ruiu at google.com
Thu Sep 19 20:18:58 PDT 2013


Author: ruiu
Date: Thu Sep 19 22:18:58 2013
New Revision: 191069

URL: http://llvm.org/viewvc/llvm-project?rev=191069&view=rev
Log:
Generalize errStr() function so that it can handle any type of errors.

Modified:
    lld/trunk/include/lld/Driver/InputGraph.h

Modified: lld/trunk/include/lld/Driver/InputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/InputGraph.h?rev=191069&r1=191068&r2=191069&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/InputGraph.h (original)
+++ lld/trunk/include/lld/Driver/InputGraph.h Thu Sep 19 22:18:58 2013
@@ -227,9 +227,9 @@ public:
 
   /// \brief create an error string for printing purposes
   virtual std::string errStr(llvm::error_code errc) {
-    if (errc == llvm::errc::no_such_file_or_directory)
-      return (Twine("Cannot open ") + _path).str();
-    llvm_unreachable("not handling errors");
+    std::string msg = errc.message();
+    Twine twine = Twine("Cannot open ") + _path + ": " + msg;
+    return twine.str();
   }
 
   /// \brief Create a lld::File node from the FileNode





More information about the llvm-commits mailing list