summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-03-08 17:56:08 +0000
committerZachary Turner <zturner@google.com>2017-03-08 17:56:08 +0000
commit7d86ee5ab0ca98edff2f07c373967f34227c960e (patch)
tree622b630eca7be4ea6b604c8eacc956031dbb8ee9 /lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
parent5c13623a69baed43b7f0cbf2912a3baa951285e2 (diff)
downloadbcm5719-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/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp')
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 0b4dd7d84c9..af54ab7202e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -36,6 +36,8 @@
#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"
@@ -381,7 +383,7 @@ void PlatformDarwinKernel::CollectKextAndKernelDirectories() {
// Add simple directory /Applications/Xcode.app/Contents/Developer/../Symbols
FileSpec possible_dir(developer_dir + "/../Symbols", true);
- if (possible_dir.Exists() && possible_dir.IsDirectory())
+ if (llvm::sys::fs::is_directory(possible_dir.GetPath()))
m_search_directories.push_back(possible_dir);
// Add simple directory of the current working directory
@@ -396,7 +398,7 @@ void PlatformDarwinKernel::GetUserSpecifiedDirectoriesToSearch() {
for (uint32_t i = 0; i < user_dirs_count; i++) {
FileSpec dir = user_dirs.GetFileSpecAtIndex(i);
dir.ResolvePath();
- if (dir.Exists() && dir.IsDirectory()) {
+ if (llvm::sys::fs::is_directory(dir.GetPath())) {
m_search_directories.push_back(dir);
}
}
@@ -412,7 +414,7 @@ void PlatformDarwinKernel::AddRootSubdirsToSearchPaths(
nullptr};
for (int i = 0; subdirs[i] != nullptr; i++) {
FileSpec testdir(dir + subdirs[i], true);
- if (testdir.Exists() && testdir.IsDirectory())
+ if (llvm::sys::fs::is_directory(testdir.GetPath()))
thisp->m_search_directories.push_back(testdir);
}
@@ -435,12 +437,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, FileSpec::FileType file_type, const FileSpec &file_spec) {
+ void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) {
static ConstString g_sdk_suffix = ConstString("sdk");
static ConstString g_kdk_suffix = ConstString("kdk");
PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton;
- if (file_type == FileSpec::eFileTypeDirectory &&
+ if (ft == llvm::sys::fs::file_type::directory_file &&
(file_spec.GetFileNameExtension() == g_sdk_suffix ||
file_spec.GetFileNameExtension() == g_kdk_suffix)) {
AddRootSubdirsToSearchPaths(thisp, file_spec.GetPath());
@@ -486,20 +488,19 @@ void PlatformDarwinKernel::SearchForKextsAndKernelsRecursively() {
FileSpec::EnumerateDirectoryResult
PlatformDarwinKernel::GetKernelsAndKextsInDirectoryWithRecursion(
- void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) {
- return GetKernelsAndKextsInDirectoryHelper(baton, file_type, file_spec, true);
+ void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) {
+ return GetKernelsAndKextsInDirectoryHelper(baton, ft, file_spec, true);
}
FileSpec::EnumerateDirectoryResult
PlatformDarwinKernel::GetKernelsAndKextsInDirectoryNoRecursion(
- void *baton, FileSpec::FileType file_type, const FileSpec &file_spec) {
- return GetKernelsAndKextsInDirectoryHelper(baton, file_type, file_spec,
- false);
+ void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec) {
+ return GetKernelsAndKextsInDirectoryHelper(baton, ft, file_spec, false);
}
FileSpec::EnumerateDirectoryResult
PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
- void *baton, FileSpec::FileType file_type, const FileSpec &file_spec,
+ void *baton, llvm::sys::fs::file_type ft, const FileSpec &file_spec,
bool recurse) {
static ConstString g_kext_suffix = ConstString("kext");
static ConstString g_dsym_suffix = ConstString("dSYM");
@@ -512,8 +513,8 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
file_spec.GetPath().c_str());
PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton;
- if (file_type == FileSpec::eFileTypeRegular ||
- file_type == FileSpec::eFileTypeSymbolicLink) {
+ if (ft == llvm::sys::fs::file_type::regular_file ||
+ ft == llvm::sys::fs::file_type::symlink_file) {
ConstString filename = file_spec.GetFilename();
if ((strncmp(filename.GetCString(), "kernel", 6) == 0 ||
strncmp(filename.GetCString(), "mach", 4) == 0) &&
@@ -524,17 +525,17 @@ PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
thisp->m_kernel_binaries_without_dsyms.push_back(file_spec);
return FileSpec::eEnumerateDirectoryResultNext;
}
- } else if (file_type == FileSpec::eFileTypeDirectory &&
+ } else if (ft == llvm::sys::fs::file_type::directory_file &&
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 (contents_plugins.Exists() && contents_plugins.IsDirectory()) {
+ if (llvm::sys::fs::is_directory(contents_plugins.GetPath())) {
search_here_too = contents_plugins.GetPath();
} else {
FileSpec plugins(file_spec.GetPath() + "/PlugIns", false);
- if (plugins.Exists() && plugins.IsDirectory()) {
+ if (llvm::sys::fs::is_directory(plugins.GetPath())) {
search_here_too = plugins.GetPath();
}
}
@@ -591,7 +592,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling(
std::string filename = dsym_fspec.GetFilename().AsCString();
filename += ".dSYM";
dsym_fspec.GetFilename() = ConstString(filename);
- if (dsym_fspec.Exists() && dsym_fspec.IsDirectory()) {
+ if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) {
return true;
}
// Should probably get the CFBundleExecutable here or call
@@ -605,7 +606,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling(
deep_bundle_str += executable_name.AsCString();
deep_bundle_str += ".dSYM";
dsym_fspec.SetFile(deep_bundle_str, true);
- if (dsym_fspec.Exists() && dsym_fspec.IsDirectory()) {
+ if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) {
return true;
}
@@ -615,7 +616,7 @@ bool PlatformDarwinKernel::KextHasdSYMSibling(
shallow_bundle_str += executable_name.AsCString();
shallow_bundle_str += ".dSYM";
dsym_fspec.SetFile(shallow_bundle_str, true);
- if (dsym_fspec.Exists() && dsym_fspec.IsDirectory()) {
+ if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) {
return true;
}
return false;
@@ -629,7 +630,7 @@ bool PlatformDarwinKernel::KernelHasdSYMSibling(const FileSpec &kernel_binary) {
std::string filename = kernel_binary.GetFilename().AsCString();
filename += ".dSYM";
kernel_dsym.GetFilename() = ConstString(filename);
- if (kernel_dsym.Exists() && kernel_dsym.IsDirectory()) {
+ if (llvm::sys::fs::is_directory(kernel_dsym.GetPath())) {
return true;
}
return false;
OpenPOWER on IntegriCloud