aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-ar
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-08-01 18:09:46 +0000
committerChris Lattner <sabre@nondot.org>2006-08-01 18:09:46 +0000
commit8bdbb04f9b1b79a75677b1ff6217cadc3b660af9 (patch)
treee8e1e1cccc972de6f61fc89e46601ca451dabfec /tools/llvm-ar
parent0b32d8b764000198f0eeeec24de35249f7401f1e (diff)
Use Path::getFileStatus
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-ar')
-rw-r--r--tools/llvm-ar/llvm-ar.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/llvm-ar/llvm-ar.cpp b/tools/llvm-ar/llvm-ar.cpp
index 2ec431727a..d2d8c85e27 100644
--- a/tools/llvm-ar/llvm-ar.cpp
+++ b/tools/llvm-ar/llvm-ar.cpp
@@ -270,19 +270,22 @@ ArchiveOperation parseCommandLine() {
// finds with all the files in that directory (recursively). It uses the
// sys::Path::getDirectoryContent method to perform the actual directory scans.
std::set<sys::Path> recurseDirectories(const sys::Path& path) {
- assert(path.isDirectory() && "Oops, can't recurse a file");
std::set<sys::Path> result;
if (RecurseDirectories) {
std::set<sys::Path> content;
path.getDirectoryContents(content);
for (std::set<sys::Path>::iterator I = content.begin(), E = content.end();
I != E; ++I) {
- if (I->isDirectory()) {
- std::set<sys::Path> moreResults = recurseDirectories(*I);
- result.insert(moreResults.begin(), moreResults.end());
- } else {
- result.insert(*I);
- }
+ // Make sure it exists and is a directory
+ sys::FileStatus Status;
+ if (!I->getFileStatus(Status)) {
+ if (Status.isDir) {
+ std::set<sys::Path> moreResults = recurseDirectories(*I);
+ result.insert(moreResults.begin(), moreResults.end());
+ } else {
+ result.insert(*I);
+ }
+ }
}
}
return result;