diff options
author | Zachary Turner <zturner@google.com> | 2014-08-15 22:04:21 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2014-08-15 22:04:21 +0000 |
commit | c00cf4a0688ea62229a5d44d5f000bc62c172263 (patch) | |
tree | 3c9aad742b18c8fe789c3f96b2291d4a3cdfb92f /lldb/source/Host/common/FileSpec.cpp | |
parent | 5d62c26fa01c0ff7915fe8f8bb779ce2a8a2d8a7 (diff) | |
download | bcm5719-llvm-c00cf4a0688ea62229a5d44d5f000bc62c172263.tar.gz bcm5719-llvm-c00cf4a0688ea62229a5d44d5f000bc62c172263.zip |
Move FileSystem functions out of Host and into their own classes.
More specifically, this change can be summarized as follows:
1) Makes an lldbHostPosix library which contains code common to
all posix platforms.
2) Creates Host/FileSystem.h which defines a common FileSystem
interface.
3) Implements FileSystem.h in Host/windows and Host/posix.
4) Creates Host/FileCache.h, implemented in Host/common, which
defines a class useful for storing handles to open files needed
by the debugger.
Differential Revision: http://reviews.llvm.org/D4889
llvm-svn: 215775
Diffstat (limited to 'lldb/source/Host/common/FileSpec.cpp')
-rw-r--r-- | lldb/source/Host/common/FileSpec.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp index 56179a38f36..8c4014c074f 100644 --- a/lldb/source/Host/common/FileSpec.cpp +++ b/lldb/source/Host/common/FileSpec.cpp @@ -27,22 +27,22 @@ #include <pwd.h> #endif -#include "llvm/ADT/StringRef.h" -#include "llvm/Support/FileSystem.h" -#include "llvm/Support/Path.h" -#include "llvm/Support/Program.h" - -#include "lldb/Core/StreamString.h" -#include "lldb/Host/File.h" -#include "lldb/Host/FileSpec.h" -#include "lldb/Host/Host.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataBufferMemoryMap.h" #include "lldb/Core/RegularExpression.h" +#include "lldb/Core/StreamString.h" #include "lldb/Core/Stream.h" +#include "lldb/Host/File.h" +#include "lldb/Host/FileSpec.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Utility/CleanUp.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/FileSystem.h" +#include "llvm/Support/Path.h" +#include "llvm/Support/Program.h" + using namespace lldb; using namespace lldb_private; @@ -166,10 +166,10 @@ FileSpec::Resolve (llvm::SmallVectorImpl<char> &path) llvm::sys::fs::make_absolute(path); } -FileSpec::FileSpec() : - m_directory(), - m_filename(), - m_syntax(Host::GetHostPathSyntax()) +FileSpec::FileSpec() + : m_directory() + , m_filename() + , m_syntax(FileSystem::GetNativePathSyntax()) { } @@ -233,7 +233,8 @@ FileSpec::operator= (const FileSpec& rhs) void FileSpec::Normalize(llvm::SmallVectorImpl<char> &path, PathSyntax syntax) { - if (syntax == ePathSyntaxPosix || (syntax == ePathSyntaxHostNative && Host::GetHostPathSyntax() == ePathSyntaxPosix)) + if (syntax == ePathSyntaxPosix || + (syntax == ePathSyntaxHostNative && FileSystem::GetNativePathSyntax() == ePathSyntaxPosix)) return; std::replace(path.begin(), path.end(), '\\', '/'); @@ -241,7 +242,8 @@ void FileSpec::Normalize(llvm::SmallVectorImpl<char> &path, PathSyntax syntax) void FileSpec::DeNormalize(llvm::SmallVectorImpl<char> &path, PathSyntax syntax) { - if (syntax == ePathSyntaxPosix || (syntax == ePathSyntaxHostNative && Host::GetHostPathSyntax() == ePathSyntaxPosix)) + if (syntax == ePathSyntaxPosix || + (syntax == ePathSyntaxHostNative && FileSystem::GetNativePathSyntax() == ePathSyntaxPosix)) return; std::replace(path.begin(), path.end(), '/', '\\'); @@ -258,7 +260,7 @@ FileSpec::SetFile (const char *pathname, bool resolve, PathSyntax syntax) m_filename.Clear(); m_directory.Clear(); m_is_resolved = false; - m_syntax = (syntax == ePathSyntaxHostNative) ? Host::GetHostPathSyntax() : syntax; + m_syntax = (syntax == ePathSyntaxHostNative) ? FileSystem::GetNativePathSyntax() : syntax; if (pathname == NULL || pathname[0] == '\0') return; @@ -587,7 +589,7 @@ FileSpec::GetPermissions () const { uint32_t file_permissions = 0; if (*this) - Host::GetFilePermissions(GetPath().c_str(), file_permissions); + FileSystem::GetFilePermissions(GetPath().c_str(), file_permissions); return file_permissions; } |