diff options
| author | Zachary Turner <zturner@google.com> | 2017-03-08 17:56:08 +0000 |
|---|---|---|
| committer | Zachary Turner <zturner@google.com> | 2017-03-08 17:56:08 +0000 |
| commit | 7d86ee5ab0ca98edff2f07c373967f34227c960e (patch) | |
| tree | 622b630eca7be4ea6b604c8eacc956031dbb8ee9 /lldb/source/Core/FileSpecList.cpp | |
| parent | 5c13623a69baed43b7f0cbf2912a3baa951285e2 (diff) | |
| download | bcm5719-llvm-7d86ee5ab0ca98edff2f07c373967f34227c960e.tar.gz bcm5719-llvm-7d86ee5ab0ca98edff2f07c373967f34227c960e.zip | |
Resubmit FileSystem changes.
This was originall reverted due to some test failures in
ModuleCache and TestCompDirSymlink. These issues have all
been resolved and the code now passes all tests.
Differential Revision: https://reviews.llvm.org/D30698
llvm-svn: 297300
Diffstat (limited to 'lldb/source/Core/FileSpecList.cpp')
| -rw-r--r-- | lldb/source/Core/FileSpecList.cpp | 44 |
1 files changed, 18 insertions, 26 deletions
diff --git a/lldb/source/Core/FileSpecList.cpp b/lldb/source/Core/FileSpecList.cpp index 2f2713af336..0f790279897 100644 --- a/lldb/source/Core/FileSpecList.cpp +++ b/lldb/source/Core/FileSpecList.cpp @@ -16,6 +16,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Utility/Stream.h" +#include "llvm/Support/FileSystem.h" using namespace lldb_private; using namespace std; @@ -150,32 +151,23 @@ size_t FileSpecList::GetFilesMatchingPartialPath(const char *path, FileSpecList &matches) { #if 0 // FIXME: Just sketching... matches.Clear(); - FileSpec path_spec = FileSpec (path); - if (path_spec.Exists ()) - { - FileSpec::FileType type = path_spec.GetFileType(); - if (type == FileSpec::eFileTypeSymbolicLink) - // Shouldn't there be a Resolve on a file spec that real-path's it? - { - } - - if (type == FileSpec::eFileTypeRegular - || (type == FileSpec::eFileTypeDirectory && dir_okay)) - { - matches.Append (path_spec); - return 1; - } - else if (type == FileSpec::eFileTypeDirectory) - { - // Fill the match list with all the files in the directory: - } - else - { - return 0; - } - } - else - { + using namespace llvm::sys::fs; + file_status stats; + if (status(path, stats, false)) + return 0; + if (exists(stats)) { + if (is_symlink_file(stats)) { + // Shouldn't there be a method that realpath's a file? + } + if (is_regular_file(stats) || (is_directory(stats) && dir_okay)) { + matches.Append(FileSpec(path)); + return 1; + } else if (is_directory(stats)) { + // Fill the match list with all the files in the directory: + } else { + return 0; + } + } else { ConstString dir_name = path_spec.GetDirectory(); ConstString file_name = GetFilename(); if (dir_name == nullptr) |

