Index: lldb/trunk/include/lldb/Host/FileSystem.h =================================================================== --- lldb/trunk/include/lldb/Host/FileSystem.h +++ lldb/trunk/include/lldb/Host/FileSystem.h @@ -88,6 +88,12 @@ bool Readable(const llvm::Twine &path) const; /// @} + /// Returns whether the given path is a directory. + /// @{ + bool IsDirectory(const FileSpec &file_spec) const; + bool IsDirectory(const llvm::Twine &path) const; + /// @} + /// Make the given file path absolute. /// @{ std::error_code MakeAbsolute(llvm::SmallVectorImpl &path) const; Index: lldb/trunk/source/API/SBPlatform.cpp =================================================================== --- lldb/trunk/source/API/SBPlatform.cpp +++ lldb/trunk/source/API/SBPlatform.cpp @@ -366,7 +366,7 @@ if (src.Exists()) { uint32_t permissions = FileSystem::Instance().GetPermissions(src.ref()); if (permissions == 0) { - if (llvm::sys::fs::is_directory(src.ref().GetPath())) + if (FileSystem::Instance().IsDirectory(src.ref())) permissions = eFilePermissionsDirectoryDefault; else permissions = eFilePermissionsFileDefault; Index: lldb/trunk/source/Core/Module.cpp =================================================================== --- lldb/trunk/source/Core/Module.cpp +++ lldb/trunk/source/Core/Module.cpp @@ -1448,7 +1448,7 @@ // ("/tmp/a.out.dSYM/Contents/Resources/DWARF/a.out"). So we need to // check this - if (llvm::sys::fs::is_directory(file.GetPath())) { + if (FileSystem::Instance().IsDirectory(file)) { std::string new_path(file.GetPath()); std::string old_path(obj_file->GetFileSpec().GetPath()); if (old_path.find(new_path) == 0) { Index: lldb/trunk/source/Core/ModuleList.cpp =================================================================== --- lldb/trunk/source/Core/ModuleList.cpp +++ lldb/trunk/source/Core/ModuleList.cpp @@ -859,7 +859,7 @@ auto search_path_spec = module_search_paths_ptr->GetFileSpecAtIndex(idx); FileSystem::Instance().Resolve(search_path_spec); namespace fs = llvm::sys::fs; - if (!fs::is_directory(search_path_spec.GetPath())) + if (!FileSystem::Instance().IsDirectory(search_path_spec)) continue; search_path_spec.AppendPathComponent( module_spec.GetFileSpec().GetFilename().AsCString()); Index: lldb/trunk/source/Host/common/FileSystem.cpp =================================================================== --- lldb/trunk/source/Host/common/FileSystem.cpp +++ lldb/trunk/source/Host/common/FileSystem.cpp @@ -124,6 +124,17 @@ return Readable(file_spec.GetPath()); } +bool FileSystem::IsDirectory(const Twine &path) const { + ErrorOr status = m_fs->status(path); + if (!status) + return false; + return status->isDirectory(); +} + +bool FileSystem::IsDirectory(const FileSpec &file_spec) const { + return IsDirectory(file_spec.GetPath()); +} + void FileSystem::EnumerateDirectory(Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, Index: lldb/trunk/source/Host/common/Symbols.cpp =================================================================== --- lldb/trunk/source/Host/common/Symbols.cpp +++ lldb/trunk/source/Host/common/Symbols.cpp @@ -311,7 +311,7 @@ for (size_t idx = 0; idx < num_directories; ++idx) { FileSpec dirspec = debug_file_search_paths.GetFileSpecAtIndex(idx); FileSystem::Instance().Resolve(dirspec); - if (!llvm::sys::fs::is_directory(dirspec.GetPath())) + if (!FileSystem::Instance().IsDirectory(dirspec)) continue; std::vector files; Index: lldb/trunk/source/Host/macosx/Symbols.cpp =================================================================== --- lldb/trunk/source/Host/macosx/Symbols.cpp +++ lldb/trunk/source/Host/macosx/Symbols.cpp @@ -109,7 +109,7 @@ if (path[0] == '~') FileSystem::Instance().Resolve(dsym_filespec); - if (llvm::sys::fs::is_directory(dsym_filespec.GetPath())) { + if (FileSystem::Instance().IsDirectory(dsym_filespec)) { dsym_filespec = Symbols::FindSymbolFileInBundle(dsym_filespec, uuid, arch); ++items_found; Index: lldb/trunk/source/Host/macosx/objcxx/Host.mm =================================================================== --- lldb/trunk/source/Host/macosx/objcxx/Host.mm +++ lldb/trunk/source/Host/macosx/objcxx/Host.mm @@ -101,7 +101,7 @@ bool Host::GetBundleDirectory(const FileSpec &file, FileSpec &bundle_directory) { #if defined(__APPLE__) - if (llvm::sys::fs::is_directory(file.GetPath())) { + if (FileSystem::Instance().IsDirectory(file)) { char path[PATH_MAX]; if (file.GetPath(path, sizeof(path))) { CFCBundle bundle(path); @@ -118,7 +118,7 @@ bool Host::ResolveExecutableInBundle(FileSpec &file) { #if defined(__APPLE__) - if (llvm::sys::fs::is_directory(file.GetPath())) { + if (FileSystem::Instance().IsDirectory(file)) { char path[PATH_MAX]; if (file.GetPath(path, sizeof(path))) { CFCBundle bundle(path); Index: lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm =================================================================== --- lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm +++ lldb/trunk/source/Host/macosx/objcxx/HostInfoMacOSX.mm @@ -141,7 +141,7 @@ raw_path.append("/../bin"); FileSpec support_dir_spec(raw_path); FileSystem::Instance().Resolve(support_dir_spec); - if (!llvm::sys::fs::is_directory(support_dir_spec.GetPath())) { + if (!FileSystem::Instance().IsDirectory(support_dir_spec)) { Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (log) log->Printf("HostInfoMacOSX::%s(): failed to find support directory", Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangHost.cpp @@ -43,7 +43,7 @@ #if defined(__APPLE__) static bool VerifyClangPath(const llvm::Twine &clang_path) { - if (llvm::sys::fs::is_directory(clang_path)) + if (FileSystem::Instance().IsDirectory(clang_path)) return true; Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_HOST); if (log) Index: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp =================================================================== --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp @@ -601,7 +601,7 @@ { FileSpec clang_resource_dir = GetClangResourceDir(); - if (llvm::sys::fs::is_directory(clang_resource_dir.GetPath())) { + if (FileSystem::Instance().IsDirectory(clang_resource_dir.GetPath())) { compiler_invocation_arguments.push_back("-resource-dir"); compiler_invocation_arguments.push_back(clang_resource_dir.GetPath()); } Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -1208,7 +1208,7 @@ developer_dir_path[i] = '\0'; FileSpec devel_dir(developer_dir_path); - if (llvm::sys::fs::is_directory(devel_dir.GetPath())) { + if (FileSystem::Instance().IsDirectory(devel_dir)) { developer_dir_path_valid = true; } } @@ -1435,7 +1435,7 @@ const FileSpec &sdks_spec) { // Look inside Xcode for the required installed iOS SDK version - if (!llvm::sys::fs::is_directory(sdks_spec.GetPath())) { + if (!FileSystem::Instance().IsDirectory(sdks_spec)) { return FileSpec(); } @@ -1451,7 +1451,7 @@ sdks_spec.GetPath(), find_directories, find_files, find_other, DirectoryEnumerator, &enumerator_info); - if (llvm::sys::fs::is_directory(enumerator_info.found_path.GetPath())) + if (FileSystem::Instance().IsDirectory(enumerator_info.found_path)) return enumerator_info.found_path; else return FileSpec(); @@ -1596,7 +1596,7 @@ sysroot_spec = GetSDKDirectoryForModules(sdk_type); } - if (llvm::sys::fs::is_directory(sysroot_spec.GetPath())) { + if (FileSystem::Instance().IsDirectory(sysroot_spec.GetPath())) { options.push_back("-isysroot"); options.push_back(sysroot_spec.GetPath()); } Index: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp =================================================================== --- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -379,7 +379,7 @@ // Add simple directory /Applications/Xcode.app/Contents/Developer/../Symbols FileSpec possible_dir(developer_dir + "/../Symbols"); FileSystem::Instance().Resolve(possible_dir); - if (llvm::sys::fs::is_directory(possible_dir.GetPath())) + if (FileSystem::Instance().IsDirectory(possible_dir)) m_search_directories.push_back(possible_dir); // Add simple directory of the current working directory @@ -396,7 +396,7 @@ for (uint32_t i = 0; i < user_dirs_count; i++) { FileSpec dir = user_dirs.GetFileSpecAtIndex(i); FileSystem::Instance().Resolve(dir); - if (llvm::sys::fs::is_directory(dir.GetPath())) { + if (FileSystem::Instance().IsDirectory(dir)) { m_search_directories.push_back(dir); } } @@ -413,7 +413,7 @@ for (int i = 0; subdirs[i] != nullptr; i++) { FileSpec testdir(dir + subdirs[i]); FileSystem::Instance().Resolve(testdir); - if (llvm::sys::fs::is_directory(testdir.GetPath())) + if (FileSystem::Instance().IsDirectory(testdir)) thisp->m_search_directories.push_back(testdir); } @@ -542,11 +542,11 @@ // Look to see if there is a PlugIns subdir with more kexts FileSpec contents_plugins(file_spec.GetPath() + "/Contents/PlugIns"); std::string search_here_too; - if (llvm::sys::fs::is_directory(contents_plugins.GetPath())) { + if (FileSystem::Instance().IsDirectory(contents_plugins)) { search_here_too = contents_plugins.GetPath(); } else { FileSpec plugins(file_spec.GetPath() + "/PlugIns"); - if (llvm::sys::fs::is_directory(plugins.GetPath())) { + if (FileSystem::Instance().IsDirectory(plugins)) { search_here_too = plugins.GetPath(); } } @@ -618,7 +618,7 @@ std::string filename = dsym_fspec.GetFilename().AsCString(); filename += ".dSYM"; dsym_fspec.GetFilename() = ConstString(filename); - if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { + if (FileSystem::Instance().IsDirectory(dsym_fspec)) { return true; } // Should probably get the CFBundleExecutable here or call @@ -633,7 +633,7 @@ deep_bundle_str += ".dSYM"; dsym_fspec.SetFile(deep_bundle_str, FileSpec::Style::native); FileSystem::Instance().Resolve(dsym_fspec); - if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { + if (FileSystem::Instance().IsDirectory(dsym_fspec)) { return true; } @@ -644,7 +644,7 @@ shallow_bundle_str += ".dSYM"; dsym_fspec.SetFile(shallow_bundle_str, FileSpec::Style::native); FileSystem::Instance().Resolve(dsym_fspec); - if (llvm::sys::fs::is_directory(dsym_fspec.GetPath())) { + if (FileSystem::Instance().IsDirectory(dsym_fspec)) { return true; } return false; @@ -658,7 +658,7 @@ std::string filename = kernel_binary.GetFilename().AsCString(); filename += ".dSYM"; kernel_dsym.GetFilename() = ConstString(filename); - if (llvm::sys::fs::is_directory(kernel_dsym.GetPath())) { + if (FileSystem::Instance().IsDirectory(kernel_dsym)) { return true; } return false; Index: lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp +++ lldb/trunk/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp @@ -65,7 +65,7 @@ FileSpec working_dir(launch_info.GetWorkingDirectory()); if (working_dir) { FileInstance::Instance().Resolve(working_dir); - if (!llvm::sys::fs::is_directory(working_dir.GetPath())) { + if (!FileSystem::Instance().IsDirectory(working_dir)) { error.SetErrorStringWithFormat("No such file or directory: %s", working_dir.GetCString()); return error; Index: lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp +++ lldb/trunk/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp @@ -374,10 +374,9 @@ assert(m_monitor == NULL); FileSpec working_dir = launch_info.GetWorkingDirectory(); - namespace fs = llvm::sys::fs; if (working_dir) { FileSystem::Instance().Resolve(working_dir); - if (!fs::is_directory(working_dir.GetPath())) { + if (!FileSystem::Instance().IsDirectory(working_dir.GetPath())) { error.SetErrorStringWithFormat("No such file or directory: %s", working_dir.GetCString()); return error; Index: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp =================================================================== --- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp +++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp @@ -254,7 +254,7 @@ namespace fs = llvm::sys::fs; if (working_dir) { FileSystem::Instance().Resolve(working_dir); - if (!fs::is_directory(working_dir.GetPath())) { + if (!FileSystem::Instance().IsDirectory(working_dir)) { result.SetErrorStringWithFormat("No such file or directory: %s", working_dir.GetCString()); return result; Index: lldb/trunk/source/Target/TargetList.cpp =================================================================== --- lldb/trunk/source/Target/TargetList.cpp +++ lldb/trunk/source/Target/TargetList.cpp @@ -364,7 +364,7 @@ char resolved_bundle_exe_path[PATH_MAX]; resolved_bundle_exe_path[0] = '\0'; if (file) { - if (llvm::sys::fs::is_directory(file.GetPath())) + if (FileSystem::Instance().IsDirectory(file)) user_exe_path_is_bundle = true; if (file.IsRelative() && !user_exe_path.empty()) {