[llvm] r184412 - Convert a use of sys::Path.

Rafael Espindola rafael.espindola at gmail.com
Thu Jun 20 04:59:19 PDT 2013


Author: rafael
Date: Thu Jun 20 06:59:19 2013
New Revision: 184412

URL: http://llvm.org/viewvc/llvm-project?rev=184412&view=rev
Log:
Convert a use of sys::Path.

Modified:
    llvm/trunk/tools/llvm-ar/llvm-ar.cpp

Modified: llvm/trunk/tools/llvm-ar/llvm-ar.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-ar/llvm-ar.cpp?rev=184412&r1=184411&r2=184412&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-ar/llvm-ar.cpp (original)
+++ llvm/trunk/tools/llvm-ar/llvm-ar.cpp Thu Jun 20 06:59:19 2013
@@ -286,24 +286,18 @@ ArchiveOperation parseCommandLine() {
 // the operations that add/replace files to the archive ('q' and 'r')
 bool buildPaths(bool checkExistence, std::string* ErrMsg) {
   for (unsigned i = 0; i < Members.size(); i++) {
-    sys::Path aPath;
-    if (!aPath.set(Members[i]))
-      fail(std::string("File member name invalid: ") + Members[i]);
+    std::string aPath = Members[i];
     if (checkExistence) {
-      bool Exists;
-      if (sys::fs::exists(aPath.str(), Exists) || !Exists)
-        fail(std::string("File does not exist: ") + Members[i]);
-      std::string Err;
-      sys::PathWithStatus PwS(aPath);
-      const sys::FileStatus *si = PwS.getFileStatus(false, &Err);
-      if (!si)
-        fail(Err);
-      if (si->isDir)
-        fail(aPath.str() + " Is a directory");
+      bool IsDirectory;
+      error_code EC = sys::fs::is_directory(aPath, IsDirectory);
+      if (EC)
+        fail(aPath + ": " + EC.message());
+      if (IsDirectory)
+        fail(aPath + " Is a directory");
 
-      Paths.insert(aPath.str());
+      Paths.insert(aPath);
     } else {
-      Paths.insert(aPath.str());
+      Paths.insert(aPath);
     }
   }
   return false;





More information about the llvm-commits mailing list