summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-ar/llvm-ar.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-20 11:59:19 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-20 11:59:19 +0000
commitf4bd44fca35755a3b57ff0c659eccfac63d05ad0 (patch)
treee0870f41fde91b41b5030b8c7f93f3f6698965b3 /llvm/tools/llvm-ar/llvm-ar.cpp
parent8cd1710e509d46d197e0cb3cc36a64fafb11ae3c (diff)
downloadbcm5719-llvm-f4bd44fca35755a3b57ff0c659eccfac63d05ad0.tar.gz
bcm5719-llvm-f4bd44fca35755a3b57ff0c659eccfac63d05ad0.zip
Convert a use of sys::Path.
llvm-svn: 184412
Diffstat (limited to 'llvm/tools/llvm-ar/llvm-ar.cpp')
-rw-r--r--llvm/tools/llvm-ar/llvm-ar.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/llvm/tools/llvm-ar/llvm-ar.cpp b/llvm/tools/llvm-ar/llvm-ar.cpp
index 85f3517b58a..fa07b9a9ab8 100644
--- a/llvm/tools/llvm-ar/llvm-ar.cpp
+++ b/llvm/tools/llvm-ar/llvm-ar.cpp
@@ -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");
-
- Paths.insert(aPath.str());
+ 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);
} else {
- Paths.insert(aPath.str());
+ Paths.insert(aPath);
}
}
return false;
OpenPOWER on IntegriCloud