diff options
author | Pavel Labath <labath@google.com> | 2017-03-07 13:19:15 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-03-07 13:19:15 +0000 |
commit | 30e6cbfcfca4836c2b3497d84ffc2043b548b2a6 (patch) | |
tree | 3b24106c96c514a5490b04bfe541e2e6a2ac5518 /lldb/source/Plugins | |
parent | 3d0af578ccc071dc1f9fc1672af55a969e0beb5a (diff) | |
download | bcm5719-llvm-30e6cbfcfca4836c2b3497d84ffc2043b548b2a6.tar.gz bcm5719-llvm-30e6cbfcfca4836c2b3497d84ffc2043b548b2a6.zip |
Revert "Use LLVM for all stat-related functionality."
this reverts r297116 because it breaks the unittests and
TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but
the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat
functionality is not a drop-in replacement for lldb's. The former is
based on stat(2) (which does symlink resolution), while the latter is
based on lstat(2) (which does not).
This also reverts subsequent build fixes (r297128, r297120, 297117) and
r297119 (Remove FileSpec dependency on FileSystem) which builds on top
of this.
llvm-svn: 297139
Diffstat (limited to 'lldb/source/Plugins')
19 files changed, 64 insertions, 97 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp index 135c1ac9446..3f450b79126 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -20,7 +20,6 @@ #include "clang/Parse/Parser.h" #include "clang/Sema/Lookup.h" #include "clang/Serialization/ASTReader.h" -#include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Threading.h" @@ -607,7 +606,7 @@ ClangModulesDeclVendor::Create(Target &target) { { FileSpec clang_resource_dir = GetResourceDir(); - if (llvm::sys::fs::is_directory(clang_resource_dir.GetPath())) { + if (clang_resource_dir.IsDirectory()) { compiler_invocation_arguments.push_back("-resource-dir"); compiler_invocation_arguments.push_back(clang_resource_dir.GetPath()); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp index 23e836430eb..645952fadb2 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -28,8 +28,6 @@ #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" -#include "llvm/Support/FileSystem.h" - using namespace lldb; using namespace lldb_private; @@ -248,9 +246,9 @@ Error PlatformAppleTVSimulator::ResolveExecutable( } static FileSpec::EnumerateDirectoryResult -EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft, +EnumerateDirectoryCallback(void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { - if (ft == llvm::sys::fs::file_type::directory_file) { + if (file_type == FileSpec::eFileTypeDirectory) { const char *filename = file_spec.GetFilename().GetCString(); if (filename && strncmp(filename, "AppleTVSimulator", strlen("AppleTVSimulator")) == diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp index 944e55d9e52..7063cf86e21 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -248,9 +248,9 @@ Error PlatformAppleWatchSimulator::ResolveExecutable( } static FileSpec::EnumerateDirectoryResult -EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft, +EnumerateDirectoryCallback(void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { - if (ft == llvm::sys::fs::file_type::directory_file) { + if (file_type == FileSpec::eFileTypeDirectory) { const char *filename = file_spec.GetFilename().GetCString(); if (filename && strncmp(filename, "AppleWatchSimulator", diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index bb6d9c697f1..75311078f74 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -41,7 +41,6 @@ #include "lldb/Utility/Error.h" #include "lldb/Utility/Log.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/Support/FileSystem.h" #include "llvm/Support/Threading.h" #if defined(__APPLE__) @@ -202,15 +201,8 @@ Error PlatformDarwin::ResolveSymbolFile(Target &target, FileSpec &sym_file) { Error error; sym_file = sym_spec.GetSymbolFileSpec(); - - llvm::sys::fs::file_status st; - if (status(sym_file.GetPath(), st)) { - error.SetErrorString("Could not stat file!"); - return error; - } - - if (exists(st)) { - if (is_directory(st)) { + if (sym_file.Exists()) { + if (sym_file.GetFileType() == FileSpec::eFileTypeDirectory) { sym_file = Symbols::FindSymbolFileInBundle( sym_file, sym_spec.GetUUIDPtr(), sym_spec.GetArchitecturePtr()); } @@ -1202,7 +1194,7 @@ const char *PlatformDarwin::GetDeveloperDirectory() { developer_dir_path[i] = '\0'; FileSpec devel_dir(developer_dir_path, false); - if (llvm::sys::fs::is_directory(devel_dir.GetPath())) { + if (devel_dir.Exists() && devel_dir.IsDirectory()) { developer_dir_path_valid = true; } } @@ -1447,8 +1439,9 @@ bool PlatformDarwin::SDKSupportsModules(SDKType desired_type, return false; } -FileSpec::EnumerateDirectoryResult PlatformDarwin::DirectoryEnumerator( - void *baton, llvm::sys::fs::file_type file_type, const FileSpec &spec) { +FileSpec::EnumerateDirectoryResult +PlatformDarwin::DirectoryEnumerator(void *baton, FileSpec::FileType file_type, + const FileSpec &spec) { SDKEnumeratorInfo *enumerator_info = static_cast<SDKEnumeratorInfo *>(baton); if (SDKSupportsModules(enumerator_info->sdk_type, spec)) { @@ -1463,9 +1456,8 @@ FileSpec PlatformDarwin::FindSDKInXcodeForModules(SDKType sdk_type, const FileSpec &sdks_spec) { // Look inside Xcode for the required installed iOS SDK version - if (!llvm::sys::fs::is_directory(sdks_spec.GetPath())) { + if (!sdks_spec.IsDirectory()) return FileSpec(); - } const bool find_directories = true; const bool find_files = false; @@ -1479,7 +1471,7 @@ FileSpec PlatformDarwin::FindSDKInXcodeForModules(SDKType sdk_type, find_files, find_other, DirectoryEnumerator, &enumerator_info); - if (llvm::sys::fs::is_directory(enumerator_info.found_path.GetPath())) + if (enumerator_info.found_path.IsDirectory()) return enumerator_info.found_path; else return FileSpec(); @@ -1638,7 +1630,7 @@ void PlatformDarwin::AddClangModuleCompilationOptionsForSDKType( sysroot_spec = GetSDKDirectoryForModules(sdk_type); } - if (llvm::sys::fs::is_directory(sysroot_spec.GetPath())) { + if (sysroot_spec.IsDirectory()) { options.push_back("-isysroot"); options.push_back(sysroot_spec.GetPath()); } diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h index 1d9025d1b6c..ffc8194f713 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h @@ -18,7 +18,6 @@ #include "Plugins/Platform/POSIX/PlatformPOSIX.h" #include "lldb/Host/FileSpec.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/FileSystem.h" #include <string> #include <tuple> @@ -113,7 +112,7 @@ protected: }; static lldb_private::FileSpec::EnumerateDirectoryResult - DirectoryEnumerator(void *baton, llvm::sys::fs::file_type file_type, + DirectoryEnumerator(void *baton, lldb_private::FileSpec::FileType file_type, const lldb_private::FileSpec &spec); static lldb_private::FileSpec diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index af54ab7202e..0b4dd7d84c9 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -36,8 +36,6 @@ #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" -#include "llvm/Support/FileSystem.h" - #include <CoreFoundation/CoreFoundation.h> #include "Host/macosx/cfcpp/CFCBundle.h" @@ -383,7 +381,7 @@ void PlatformDarwinKernel::CollectKextAndKernelDirectories() { // Add simple directory /Applications/Xcode.app/Contents/Developer/../Symbols FileSpec possible_dir(developer_dir + "/../Symbols", true); - if (llvm::sys::fs::is_directory(possible_dir.GetPath())) + if (possible_dir.Exists() && possible_dir.IsDirectory()) m_search_directories.push_back(possible_dir); // Add simple directory of the current working directory @@ -398,7 +396,7 @@ void PlatformDarwinKernel::GetUserSpecifiedDirectoriesToSearch() { for (uint32_t i = 0; i < user_dirs_count; i++) { FileSpec dir = user_dirs.GetFileSpecAtIndex(i); dir.ResolvePath(); - if (llvm::sys::fs::is_directory(dir.GetPath())) { + if (dir.Exists() && dir.IsDirectory()) { m_search_directories.push_back(dir); } } @@ -414,7 +412,7 @@ void PlatformDarwinKernel::AddRootSubdirsToSearchPaths( nullptr}; for (int i = 0; subdirs[i] != nullptr; i++) { FileSpec testdir(dir + subdirs[i], true); - if (llvm::sys::fs::is_directory(testdir.GetPath())) + if (testdir.Exists() && testdir.IsDirectory()) thisp->m_search_directories.push_back(testdir); } @@ -437,12 +435,12 @@ void PlatformDarwinKernel::AddSDKSubdirsToSearchPaths(const std::string &dir) { // Helper function to find *.sdk and *.kdk directories in a given directory. FileSpec::EnumerateDirectoryResult PlatformDarwinKernel::FindKDKandSDKDirectoriesInDirectory( - void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { + void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { static ConstString g_sdk_suffix = ConstString("sdk"); static ConstString g_kdk_suffix = ConstString("kdk"); PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton; - if (ft == llvm::sys::fs::file_type::directory_file && + if (file_type == FileSpec::eFileTypeDirectory && (file_spec.GetFileNameExtension() == g_sdk_suffix || file_spec.GetFileNameExtension() == g_kdk_suffix)) { AddRootSubdirsToSearchPaths(thisp, file_spec.GetPath()); @@ -488,19 +486,20 @@ void PlatformDarwinKernel::SearchForKextsAndKernelsRecursively() { FileSpec::EnumerateDirectoryResult PlatformDarwinKernel::GetKernelsAndKextsInDirectoryWithRecursion( - void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { - return GetKernelsAndKextsInDirectoryHelper(baton, ft, file_spec, true); + void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { + return GetKernelsAndKextsInDirectoryHelper(baton, file_type, file_spec, true); } FileSpec::EnumerateDirectoryResult PlatformDarwinKernel::GetKernelsAndKextsInDirectoryNoRecursion( - void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { - return GetKernelsAndKextsInDirectoryHelper(baton, ft, file_spec, false); + void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { + return GetKernelsAndKextsInDirectoryHelper(baton, file_type, file_spec, + false); } FileSpec::EnumerateDirectoryResult PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper( - void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec, + void *baton, FileSpec::FileType file_type, const FileSpec &file_spec, bool recurse) { static ConstString g_kext_suffix = ConstString("kext"); static ConstString g_dsym_suffix = ConstString("dSYM"); @@ -513,8 +512,8 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper( file_spec.GetPath().c_str()); PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton; - if (ft == llvm::sys::fs::file_type::regular_file || - ft == llvm::sys::fs::file_type::symlink_file) { + if (file_type == FileSpec::eFileTypeRegular || + file_type == FileSpec::eFileTypeSymbolicLink) { ConstString filename = file_spec.GetFilename(); if ((strncmp(filename.GetCString(), "kernel", 6) == 0 || strncmp(filename.GetCString(), "mach", 4) == 0) && @@ -525,17 +524,17 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper( thisp->m_kernel_binaries_without_dsyms.push_back(file_spec); return FileSpec::eEnumerateDirectoryResultNext; } - } else if (ft == llvm::sys::fs::file_type::directory_file && + } else if (file_type == FileSpec::eFileTypeDirectory && file_spec_extension == g_kext_suffix) { AddKextToMap(thisp, file_spec); // Look to see if there is a PlugIns subdir with more kexts FileSpec contents_plugins(file_spec.GetPath() + "/Contents/PlugIns", false); std::string search_here_too; - if (llvm::sys::fs::is_directory(contents_plugins.GetPath())) { + if (contents_plugins.Exists() && contents_plugins.IsDirectory()) { search_here_too = contents_plugins.GetPath(); } else { FileSpec plugins(file_spec.GetPath() + "/PlugIns", false); - if (llvm::sys::fs::is_directory(plugins.GetPath())) { + if (plugins.Exists() && plugins.IsDirectory()) { search_here_too = plugins.GetPath(); } } @@ -592,7 +591,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling( std::string filename = dsym_fspec.GetFilename().AsCString(); filename += ".dSYM"; dsym_fspec.GetFilename() = ConstString(filename); - if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { + if (dsym_fspec.Exists() && dsym_fspec.IsDirectory()) { return true; } // Should probably get the CFBundleExecutable here or call @@ -606,7 +605,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling( deep_bundle_str += executable_name.AsCString(); deep_bundle_str += ".dSYM"; dsym_fspec.SetFile(deep_bundle_str, true); - if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { + if (dsym_fspec.Exists() && dsym_fspec.IsDirectory()) { return true; } @@ -616,7 +615,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling( shallow_bundle_str += executable_name.AsCString(); shallow_bundle_str += ".dSYM"; dsym_fspec.SetFile(shallow_bundle_str, true); - if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { + if (dsym_fspec.Exists() && dsym_fspec.IsDirectory()) { return true; } return false; @@ -630,7 +629,7 @@ bool PlatformDarwinKernel::KernelHasdSYMSibling(const FileSpec &kernel_binary) { std::string filename = kernel_binary.GetFilename().AsCString(); filename += ".dSYM"; kernel_dsym.GetFilename() = ConstString(filename); - if (llvm::sys::fs::is_directory(kernel_dsym.GetPath())) { + if (kernel_dsym.Exists() && kernel_dsym.IsDirectory()) { return true; } return false; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h index e5ac2606b5b..f1ecc162fdc 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -20,8 +20,6 @@ // Other libraries and framework includes #include "lldb/Host/FileSpec.h" -#include "llvm/Support/FileSystem.h" - // Project includes #include "PlatformDarwin.h" @@ -107,25 +105,26 @@ protected: void AddSDKSubdirsToSearchPaths(const std::string &dir); static lldb_private::FileSpec::EnumerateDirectoryResult - FindKDKandSDKDirectoriesInDirectory(void *baton, llvm::sys::fs::file_type ft, - const lldb_private::FileSpec &file_spec); + FindKDKandSDKDirectoriesInDirectory( + void *baton, lldb_private::FileSpec::FileType file_type, + const lldb_private::FileSpec &file_spec); void SearchForKextsAndKernelsRecursively(); static lldb_private::FileSpec::EnumerateDirectoryResult GetKernelsAndKextsInDirectoryWithRecursion( - void *baton, llvm::sys::fs::file_type ft, + void *baton, lldb_private::FileSpec::FileType file_type, const lldb_private::FileSpec &file_spec); static lldb_private::FileSpec::EnumerateDirectoryResult GetKernelsAndKextsInDirectoryNoRecursion( - void *baton, llvm::sys::fs::file_type ft, + void *baton, lldb_private::FileSpec::FileType file_type, const lldb_private::FileSpec &file_spec); static lldb_private::FileSpec::EnumerateDirectoryResult - GetKernelsAndKextsInDirectoryHelper(void *baton, llvm::sys::fs::file_type ft, - const lldb_private::FileSpec &file_spec, - bool recurse); + GetKernelsAndKextsInDirectoryHelper( + void *baton, lldb_private::FileSpec::FileType file_type, + const lldb_private::FileSpec &file_spec, bool recurse); static void AddKextToMap(PlatformDarwinKernel *thisp, const lldb_private::FileSpec &file_spec); diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp index 972fd8d1b26..9e0352a4f3c 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.cpp @@ -250,7 +250,7 @@ Error PlatformRemoteAppleTV::ResolveExecutable( FileSpec::EnumerateDirectoryResult PlatformRemoteAppleTV::GetContainedFilesIntoVectorOfStringsCallback( - void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { + void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { ((PlatformRemoteAppleTV::SDKDirectoryInfoCollection *)baton) ->push_back(PlatformRemoteAppleTV::SDKDirectoryInfo(file_spec)); return FileSpec::eEnumerateDirectoryResultNext; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h index 3ff4b0bd284..388ea578d06 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleTV.h @@ -18,8 +18,6 @@ // Project includes #include "lldb/Host/FileSpec.h" -#include "llvm/Support/FileSystem.h" - #include "PlatformDarwin.h" class PlatformRemoteAppleTV : public PlatformDarwin { @@ -118,7 +116,7 @@ protected: static lldb_private::FileSpec::EnumerateDirectoryResult GetContainedFilesIntoVectorOfStringsCallback( - void *baton, llvm::sys::fs::file_type ft, + void *baton, lldb_private::FileSpec::FileType file_type, const lldb_private::FileSpec &file_spec); uint32_t FindFileInAllSDKs(const char *platform_file_path, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp index e957188d35c..2f7da298390 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.cpp @@ -260,7 +260,7 @@ Error PlatformRemoteAppleWatch::ResolveExecutable( FileSpec::EnumerateDirectoryResult PlatformRemoteAppleWatch::GetContainedFilesIntoVectorOfStringsCallback( - void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { + void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { ((PlatformRemoteAppleWatch::SDKDirectoryInfoCollection *)baton) ->push_back(PlatformRemoteAppleWatch::SDKDirectoryInfo(file_spec)); return FileSpec::eEnumerateDirectoryResultNext; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h index 4b585dc2d58..0b388af329a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteAppleWatch.h @@ -21,8 +21,6 @@ #include "PlatformDarwin.h" -#include "llvm/Support/FileSystem.h" - class PlatformRemoteAppleWatch : public PlatformDarwin { public: PlatformRemoteAppleWatch(); @@ -120,7 +118,7 @@ protected: static lldb_private::FileSpec::EnumerateDirectoryResult GetContainedFilesIntoVectorOfStringsCallback( - void *baton, llvm::sys::fs::file_type ft, + void *baton, lldb_private::FileSpec::FileType file_type, const lldb_private::FileSpec &file_spec); uint32_t FindFileInAllSDKs(const char *platform_file_path, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index 6c6485e539d..b4b20a00098 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -255,7 +255,7 @@ Error PlatformRemoteiOS::ResolveExecutable( FileSpec::EnumerateDirectoryResult PlatformRemoteiOS::GetContainedFilesIntoVectorOfStringsCallback( - void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) { + void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { ((PlatformRemoteiOS::SDKDirectoryInfoCollection *)baton) ->push_back(PlatformRemoteiOS::SDKDirectoryInfo(file_spec)); return FileSpec::eEnumerateDirectoryResultNext; diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h index 88cf6a54c12..4d88a9e4103 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.h @@ -19,8 +19,6 @@ #include "PlatformDarwin.h" #include "lldb/Host/FileSpec.h" -#include "llvm/Support/FileSystem.h" - class PlatformRemoteiOS : public PlatformDarwin { public: PlatformRemoteiOS(); @@ -116,7 +114,7 @@ protected: static lldb_private::FileSpec::EnumerateDirectoryResult GetContainedFilesIntoVectorOfStringsCallback( - void *baton, llvm::sys::fs::file_type ft, + void *baton, lldb_private::FileSpec::FileType file_type, const lldb_private::FileSpec &file_spec); uint32_t FindFileInAllSDKs(const char *platform_file_path, diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index 8e922b4d8fd..c1fd08c3c46 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -29,8 +29,6 @@ #include "lldb/Utility/Log.h" #include "lldb/Utility/StreamString.h" -#include "llvm/Support/FileSystem.h" - using namespace lldb; using namespace lldb_private; @@ -254,9 +252,9 @@ Error PlatformiOSSimulator::ResolveExecutable( } static FileSpec::EnumerateDirectoryResult -EnumerateDirectoryCallback(void *baton, llvm::sys::fs::file_type ft, +EnumerateDirectoryCallback(void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) { - if (ft == llvm::sys::fs::file_type::directory_file) { + if (file_type == FileSpec::eFileTypeDirectory) { const char *filename = file_spec.GetFilename().GetCString(); if (filename && strncmp(filename, "iPhoneSimulator", strlen("iPhoneSimulator")) == 0) { diff --git a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp index 65ab12fe1ad..b231f259208 100644 --- a/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp +++ b/lldb/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp @@ -31,8 +31,6 @@ #include "MachException.h" -#include "llvm/Support/FileSystem.h" - using namespace lldb; using namespace lldb_private; using namespace lldb_private::process_darwin; @@ -65,7 +63,7 @@ Error NativeProcessProtocol::Launch( FileSpec working_dir(launch_info.GetWorkingDirectory()); if (working_dir && (!working_dir.ResolvePath() || - !llvm::sys::fs::is_directory(working_dir.GetPath())) { + working_dir.GetFileType() != FileSpec::eFileTypeDirectory)) { error.SetErrorStringWithFormat("No such file or directory: %s", working_dir.GetCString()); return error; diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp index 1f02385d50d..f0a62e85458 100644 --- a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -46,7 +46,6 @@ #include "lldb/Host/posix/Fcntl.h" -#include "llvm/Support/FileSystem.h" #include "llvm/Support/Threading.h" using namespace lldb; @@ -362,9 +361,9 @@ Error ProcessFreeBSD::DoLaunch(Module *module, ProcessLaunchInfo &launch_info) { assert(m_monitor == NULL); FileSpec working_dir = launch_info.GetWorkingDirectory(); - namespace fs = llvm::sys::fs; - if (working_dir && (!working_dir.ResolvePath() || - !fs::is_directory(working_dir.GetPath()))) { + if (working_dir && + (!working_dir.ResolvePath() || + working_dir.GetFileType() != FileSpec::eFileTypeDirectory)) { error.SetErrorStringWithFormat("No such file or directory: %s", working_dir.GetCString()); return error; diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index a3df09cdc4f..05276294f0e 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -49,7 +49,6 @@ #include "ProcFileReader.h" #include "Procfs.h" -#include "llvm/Support/FileSystem.h" #include "llvm/Support/Threading.h" #include <linux/unistd.h> @@ -225,8 +224,9 @@ Error NativeProcessProtocol::Launch( // Verify the working directory is valid if one was specified. FileSpec working_dir{launch_info.GetWorkingDirectory()}; - if (working_dir && (!working_dir.ResolvePath() || - !llvm::sys::fs::is_directory(working_dir.GetPath()))) { + if (working_dir && + (!working_dir.ResolvePath() || + working_dir.GetFileType() != FileSpec::eFileTypeDirectory)) { error.SetErrorStringWithFormat("No such file or directory: %s", working_dir.GetCString()); return error; diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index a34c9b89227..fdc13fbc8ac 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -51,7 +51,6 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/StringRef.h" -#include "llvm/Support/FileSystem.h" using namespace lldb; using namespace lldb_private; @@ -2576,13 +2575,9 @@ bool ScriptInterpreterPython::LoadScriptingModule( Locker::NoSTDIN, Locker::FreeAcquiredLock | (init_session ? Locker::TearDownSession : 0)); - namespace fs = llvm::sys::fs; - fs::file_status st; - std::error_code ec = status(target_file.GetPath(), st); - if (ec || st.type() == fs::file_type::status_error || - st.type() == fs::file_type::type_unknown || - st.type() == fs::file_type::file_not_found) { + if (target_file.GetFileType() == FileSpec::eFileTypeInvalid || + target_file.GetFileType() == FileSpec::eFileTypeUnknown) { // if not a valid file of any sort, check if it might be a filename still // dot can't be used but / and \ can, and if either is found, reject if (strchr(pathname, '\\') || strchr(pathname, '/')) { @@ -2591,8 +2586,9 @@ bool ScriptInterpreterPython::LoadScriptingModule( } basename = pathname; // not a filename, probably a package of some sort, // let it go through - } else if (is_directory(st) || fs::is_regular_file(st) || - st.type() == fs::file_type::symlink_file) { + } else if (target_file.GetFileType() == FileSpec::eFileTypeDirectory || + target_file.GetFileType() == FileSpec::eFileTypeRegular || + target_file.GetFileType() == FileSpec::eFileTypeSymbolicLink) { std::string directory = target_file.GetDirectory().GetCString(); replace_all(directory, "\\", "\\\\"); replace_all(directory, "'", "\\'"); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 937831d2b6e..860956a1ad6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -72,8 +72,6 @@ #include "SymbolFileDWARFDebugMap.h" #include "SymbolFileDWARFDwo.h" -#include "llvm/Support/FileSystem.h" - #include <map> #include <ctype.h> @@ -193,9 +191,7 @@ static const char *resolveCompDir(const char *path_from_dwarf) { if (!is_symlink) return local_path; - namespace fs = llvm::sys::fs; - if (fs::get_file_type(local_path_spec.GetPath()) != - fs::file_type::symlink_file) + if (!local_path_spec.IsSymbolicLink()) return local_path; FileSpec resolved_local_path_spec; |