diff options
author | Chaoren Lin <chaorenl@google.com> | 2015-05-09 01:21:32 +0000 |
---|---|---|
committer | Chaoren Lin <chaorenl@google.com> | 2015-05-09 01:21:32 +0000 |
commit | f34f410e0aa9bbcd6917ef12bcda3f4ea2ec38dd (patch) | |
tree | 2d28377c4d2e4c7d91ff9403a397cce0e08b720f /lldb/source/Host/common/FileSpec.cpp | |
parent | f5132e70cc0516c5729476f323c014d394de365f (diff) | |
download | bcm5719-llvm-f34f410e0aa9bbcd6917ef12bcda3f4ea2ec38dd.tar.gz bcm5719-llvm-f34f410e0aa9bbcd6917ef12bcda3f4ea2ec38dd.zip |
Set path syntax for remote executable FileSpec.
Reviewers: ovyalov, zturner
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D9579
llvm-svn: 236925
Diffstat (limited to 'lldb/source/Host/common/FileSpec.cpp')
-rw-r--r-- | lldb/source/Host/common/FileSpec.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp index 36fddc170fe..062cdcd98b4 100644 --- a/lldb/source/Host/common/FileSpec.cpp +++ b/lldb/source/Host/common/FileSpec.cpp @@ -27,6 +27,7 @@ #include <pwd.h> #endif +#include "lldb/Core/ArchSpec.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/DataBufferMemoryMap.h" #include "lldb/Core/RegularExpression.h" @@ -201,6 +202,11 @@ FileSpec::FileSpec(const char *pathname, bool resolve_path, PathSyntax syntax) : SetFile(pathname, resolve_path, syntax); } +FileSpec::FileSpec(const char *pathname, bool resolve_path, ArchSpec arch) : + FileSpec(pathname, resolve_path, arch.GetTriple().isOSWindows() ? ePathSyntaxWindows : ePathSyntaxPosix) +{ +} + //------------------------------------------------------------------ // Copy constructor //------------------------------------------------------------------ @@ -605,11 +611,10 @@ FileSpec::RemoveBackupDots (const ConstString &input_const_str, ConstString &res void FileSpec::Dump(Stream *s) const { - static ConstString g_slash_only ("/"); if (s) { m_directory.Dump(s); - if (m_directory && m_directory != g_slash_only) + if (m_directory && m_directory.GetStringRef().back() != '/') s->PutChar('/'); m_filename.Dump(s); } @@ -810,10 +815,9 @@ FileSpec::GetPath(bool denormalize) const void FileSpec::GetPath(llvm::SmallVectorImpl<char> &path, bool denormalize) const { - if (m_directory) - path.append(m_directory.GetCString(), m_directory.GetCString() + m_directory.GetLength()); - if (m_filename) - llvm::sys::path::append(path, m_filename.GetCString()); + StreamString stream; + Dump(&stream); + path.append(stream.GetString().begin(), stream.GetString().end()); Normalize(path, m_syntax); if (denormalize && !path.empty()) DeNormalize(path, m_syntax); |