summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2013-12-03 19:23:54 +0000
committeremaste <emaste@FreeBSD.org>2013-12-03 19:23:54 +0000
commite75cbd9d8d61004a7f53a7bc08490fa932daa589 (patch)
treeba627d06612b80ba6e3256d311edf689335b6603 /contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp
parent6221ad905044551fac57fb9353660c4e20e86c1d (diff)
parent0f31a1ef7ecf609d469ee5b34b3f0cb24ae3492d (diff)
downloadFreeBSD-src-e75cbd9d8d61004a7f53a7bc08490fa932daa589.zip
FreeBSD-src-e75cbd9d8d61004a7f53a7bc08490fa932daa589.tar.gz
Update LLDB to upstream r196259 snapshot
Sponsored by: DARPA, AFRL
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp b/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp
index da6547b..fc41f06 100644
--- a/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp
+++ b/contrib/llvm/tools/lldb/source/Host/common/FileSpec.cpp
@@ -34,6 +34,7 @@
#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"
@@ -647,6 +648,15 @@ FileSpec::GetFileType () const
return eFileTypeInvalid;
}
+uint32_t
+FileSpec::GetPermissions () const
+{
+ uint32_t file_permissions = 0;
+ if (*this)
+ Host::GetFilePermissions(GetPath().c_str(), file_permissions);
+ return file_permissions;
+}
+
TimeValue
FileSpec::GetModificationTime () const
{
@@ -1162,26 +1172,26 @@ FileSpec::CopyByRemovingLastPathComponent () const
return FileSpec(m_directory.GetCString(),resolve);
}
-const char*
+ConstString
FileSpec::GetLastPathComponent () const
{
- if (m_filename.IsEmpty() && m_directory.IsEmpty())
- return NULL;
- if (m_filename.IsEmpty())
+ if (m_filename)
+ return m_filename;
+ if (m_directory)
{
const char* dir_cstr = m_directory.GetCString();
const char* last_slash_ptr = ::strrchr(dir_cstr, '/');
if (last_slash_ptr == NULL)
- return m_directory.GetCString();
+ return m_directory;
if (last_slash_ptr == dir_cstr)
{
if (last_slash_ptr[1] == 0)
- return last_slash_ptr;
+ return ConstString(last_slash_ptr);
else
- return last_slash_ptr+1;
+ return ConstString(last_slash_ptr+1);
}
if (last_slash_ptr[1] != 0)
- return last_slash_ptr+1;
+ return ConstString(last_slash_ptr+1);
const char* penultimate_slash_ptr = last_slash_ptr;
while (*penultimate_slash_ptr)
{
@@ -1191,10 +1201,10 @@ FileSpec::GetLastPathComponent () const
if (*penultimate_slash_ptr == '/')
break;
}
- ConstString new_path(penultimate_slash_ptr+1,last_slash_ptr-penultimate_slash_ptr);
- return new_path.AsCString();
+ ConstString result(penultimate_slash_ptr+1,last_slash_ptr-penultimate_slash_ptr);
+ return result;
}
- return m_filename.GetCString();
+ return ConstString();
}
void
OpenPOWER on IntegriCloud