diff options
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 14 | ||||
-rw-r--r-- | lldb/source/Core/FileSpecList.cpp | 44 | ||||
-rw-r--r-- | lldb/source/Core/Module.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Core/ModuleList.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Core/PluginManager.cpp | 13 |
5 files changed, 42 insertions, 36 deletions
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 8af2bad2255..7d4f94af68a 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -557,7 +557,7 @@ bool Debugger::LoadPlugin(const FileSpec &spec, Error &error) { } static FileSpec::EnumerateDirectoryResult -LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, +LoadPluginCallback(void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { Error error; @@ -569,13 +569,13 @@ LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, Debugger *debugger = (Debugger *)baton; - namespace fs = llvm::sys::fs; // If we have a regular file, a symbolic link or unknown file type, try // and process the file. We must handle unknown as sometimes the directory // enumeration might be enumerating a file system that doesn't have correct // file type information. - if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file || - ft == fs::file_type::type_unknown) { + if (file_type == FileSpec::eFileTypeRegular || + file_type == FileSpec::eFileTypeSymbolicLink || + file_type == FileSpec::eFileTypeUnknown) { FileSpec plugin_file_spec(file_spec); plugin_file_spec.ResolvePath(); @@ -588,9 +588,9 @@ LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, debugger->LoadPlugin(plugin_file_spec, plugin_load_error); return FileSpec::eEnumerateDirectoryResultNext; - } else if (ft == fs::file_type::directory_file || - ft == fs::file_type::symlink_file || - ft == fs::file_type::type_unknown) { + } else if (file_type == FileSpec::eFileTypeUnknown || + file_type == FileSpec::eFileTypeDirectory || + file_type == FileSpec::eFileTypeSymbolicLink) { // Try and recurse into anything that a directory or symbolic link. // We must also do this for unknown as sometimes the directory enumeration // might be enumerating a file system that doesn't have correct file type diff --git a/lldb/source/Core/FileSpecList.cpp b/lldb/source/Core/FileSpecList.cpp index 828aef9c6cd..2f2713af336 100644 --- a/lldb/source/Core/FileSpecList.cpp +++ b/lldb/source/Core/FileSpecList.cpp @@ -16,7 +16,6 @@ // Other libraries and framework includes // Project includes #include "lldb/Utility/Stream.h" -#include "llvm/Support/FileSystem.h" using namespace lldb_private; using namespace std; @@ -151,23 +150,32 @@ size_t FileSpecList::GetFilesMatchingPartialPath(const char *path, FileSpecList &matches) { #if 0 // FIXME: Just sketching... matches.Clear(); - using namespace llvm::sys::fs; - file_status stats; - if (status(path, stats)) - return 0; - if (exists(stats)) { - if (stats.type() == file_type::symlink_file) { - // 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 { + 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 + { ConstString dir_name = path_spec.GetDirectory(); ConstString file_name = GetFilename(); if (dir_name == nullptr) diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index d2034d6518d..c8afb61e37b 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -12,7 +12,6 @@ // C Includes // C++ Includes // Other libraries and framework includes -#include "llvm/Support/FileSystem.h" #include "llvm/Support/Signals.h" #include "llvm/Support/raw_os_ostream.h" @@ -1440,7 +1439,7 @@ void Module::SetSymbolFileFileSpec(const FileSpec &file) { // ("/tmp/a.out.dSYM/Contents/Resources/DWARF/a.out"). So we need to // check this - if (llvm::sys::fs::is_directory(file.GetPath())) { + if (file.IsDirectory()) { std::string new_path(file.GetPath()); std::string old_path(obj_file->GetFileSpec().GetPath()); if (old_path.find(new_path) == 0) { diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 0262185eed0..8ec3047dce8 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -26,7 +26,6 @@ #include "lldb/Symbol/VariableList.h" #include "lldb/Utility/Log.h" -#include "llvm/Support/FileSystem.h" #include "llvm/Support/Threading.h" using namespace lldb; @@ -767,8 +766,7 @@ Error ModuleList::GetSharedModule(const ModuleSpec &module_spec, auto search_path_spec = module_search_paths_ptr->GetFileSpecAtIndex(idx); if (!search_path_spec.ResolvePath()) continue; - namespace fs = llvm::sys::fs; - if (!fs::is_directory(search_path_spec.GetPath())) + if (!search_path_spec.Exists() || !search_path_spec.IsDirectory()) continue; search_path_spec.AppendPathComponent( module_spec.GetFileSpec().GetFilename().AsCString()); diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index 136d722e9bc..71a0f6eccea 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -79,18 +79,18 @@ template <typename FPtrTy> static FPtrTy CastToFPtr(void *VPtr) { } static FileSpec::EnumerateDirectoryResult -LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, +LoadPluginCallback(void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { // PluginManager *plugin_manager = (PluginManager *)baton; Error error; - namespace fs = llvm::sys::fs; // If we have a regular file, a symbolic link or unknown file type, try // and process the file. We must handle unknown as sometimes the directory // enumeration might be enumerating a file system that doesn't have correct // file type information. - if (ft == fs::file_type::regular_file || ft == fs::file_type::symlink_file || - ft == fs::file_type::type_unknown) { + if (file_type == FileSpec::eFileTypeRegular || + file_type == FileSpec::eFileTypeSymbolicLink || + file_type == FileSpec::eFileTypeUnknown) { FileSpec plugin_file_spec(file_spec); plugin_file_spec.ResolvePath(); @@ -135,8 +135,9 @@ LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft, } } - if (ft == fs::file_type::directory_file || - ft == fs::file_type::symlink_file || ft == fs::file_type::type_unknown) { + if (file_type == FileSpec::eFileTypeUnknown || + file_type == FileSpec::eFileTypeDirectory || + file_type == FileSpec::eFileTypeSymbolicLink) { // Try and recurse into anything that a directory or symbolic link. // We must also do this for unknown as sometimes the directory enumeration // might be enumerating a file system that doesn't have correct file type |