aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Host/common/HostInfoBase.cpp
diff options
context:
space:
mode:
authorChaoren Lin <chaorenl@google.com>2015-05-29 19:52:29 +0000
committerChaoren Lin <chaorenl@google.com>2015-05-29 19:52:29 +0000
commitd3173f34e8546a96b8d0df0d9de133f88f10c127 (patch)
tree5e778446085cbd4a4d43fc3b488b3ac6ff17f2b5 /lldb/source/Host/common/HostInfoBase.cpp
parent375432e4d8f50212bca3d9228e349b5a00f770d7 (diff)
downloadllvm-d3173f34e8546a96b8d0df0d9de133f88f10c127.zip
llvm-d3173f34e8546a96b8d0df0d9de133f88f10c127.tar.gz
llvm-d3173f34e8546a96b8d0df0d9de133f88f10c127.tar.bz2
Refactor many file functions to use FileSpec over strings.
Summary: This should solve the issue of sending denormalized paths over gdb-remote if we stick to GetPath(false) in GDBRemoteCommunicationClient, and let the server handle any denormalization. Reviewers: ovyalov, zturner, vharron, clayborg Reviewed By: clayborg Subscribers: tberghammer, emaste, lldb-commits Differential Revision: http://reviews.llvm.org/D9728 llvm-svn: 238604
Diffstat (limited to 'lldb/source/Host/common/HostInfoBase.cpp')
-rw-r--r--lldb/source/Host/common/HostInfoBase.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index f44ad96..cd4815a 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -40,7 +40,7 @@ namespace
// Remove the LLDB temporary directory if we have one. Set "recurse" to
// true to all files that were created for the LLDB process can be cleaned up.
- FileSystem::DeleteDirectory(tmpdir_file_spec.GetDirectory().GetCString(), true);
+ FileSystem::DeleteDirectory(tmpdir_file_spec, true);
}
//----------------------------------------------------------------------
@@ -326,18 +326,15 @@ HostInfoBase::ComputeProcessTempFileDirectory(FileSpec &file_spec)
if (!HostInfo::ComputeGlobalTempFileDirectory(temp_file_spec))
return false;
- std::string pid_str;
- llvm::raw_string_ostream pid_stream(pid_str);
- pid_stream << Host::GetCurrentProcessID();
- temp_file_spec.AppendPathComponent(pid_stream.str().c_str());
- std::string final_path = temp_file_spec.GetPath();
- if (!FileSystem::MakeDirectory(final_path.c_str(), eFilePermissionsDirectoryDefault).Success())
+ std::string pid_str{std::to_string(Host::GetCurrentProcessID())};
+ temp_file_spec.AppendPathComponent(pid_str);
+ if (!FileSystem::MakeDirectory(temp_file_spec, eFilePermissionsDirectoryDefault).Success())
return false;
// Make an atexit handler to clean up the process specify LLDB temp dir
// and all of its contents.
::atexit(CleanupProcessSpecificLLDBTempDir);
- file_spec.GetDirectory().SetCStringWithLength(final_path.c_str(), final_path.size());
+ file_spec = temp_file_spec;
return true;
}
@@ -370,7 +367,7 @@ HostInfoBase::ComputeGlobalTempFileDirectory(FileSpec &file_spec)
return false;
temp_file_spec.AppendPathComponent("lldb");
- if (!FileSystem::MakeDirectory(temp_file_spec.GetPath().c_str(), eFilePermissionsDirectoryDefault).Success())
+ if (!FileSystem::MakeDirectory(temp_file_spec, eFilePermissionsDirectoryDefault).Success())
return false;
file_spec = temp_file_spec;