summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/common/HostInfoBase.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-02-19 19:20:44 +0000
committerZachary Turner <zturner@google.com>2016-02-19 19:20:44 +0000
commit41331afaef7d4211b8d3ade96b562f1a106773b9 (patch)
treeb89b655d99a9354a55e8b4bdf3c70e10a89bcf03 /lldb/source/Host/common/HostInfoBase.cpp
parent731942565b3a0f4221a863699dc1108d7fa2a08a (diff)
downloadbcm5719-llvm-41331afaef7d4211b8d3ade96b562f1a106773b9.tar.gz
bcm5719-llvm-41331afaef7d4211b8d3ade96b562f1a106773b9.zip
Don't use an atexit handler for cleaning up the temp directory.
Differential Revision: http://reviews.llvm.org/D17420 llvm-svn: 261353
Diffstat (limited to 'lldb/source/Host/common/HostInfoBase.cpp')
-rw-r--r--lldb/source/Host/common/HostInfoBase.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index f7ba755b5ba..1d5cd5dfca4 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -31,19 +31,6 @@ using namespace lldb_private;
namespace
{
- void
- CleanupProcessSpecificLLDBTempDir()
- {
- // Get the process specific LLDB temporary directory and delete it.
- FileSpec tmpdir_file_spec;
- if (!HostInfo::GetLLDBPath(ePathTypeLLDBTempSystemDir, tmpdir_file_spec))
- return;
-
- // 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, true);
- }
-
//----------------------------------------------------------------------
// The HostInfoBaseFields is a work around for windows not supporting
// static variables correctly in a thread safe way. Really each of the
@@ -54,6 +41,16 @@ namespace
struct HostInfoBaseFields
{
+ ~HostInfoBaseFields()
+ {
+ if (m_lldb_process_tmp_dir.Exists())
+ {
+ // 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(m_lldb_process_tmp_dir, true);
+ }
+ }
+
uint32_t m_number_cpus;
std::string m_vendor_string;
std::string m_os_string;
@@ -82,6 +79,13 @@ HostInfoBase::Initialize()
g_fields = new HostInfoBaseFields();
}
+void
+HostInfoBase::Terminate()
+{
+ delete g_fields;
+ g_fields = nullptr;
+}
+
uint32_t
HostInfoBase::GetNumberCPUS()
{
@@ -335,9 +339,6 @@ HostInfoBase::ComputeProcessTempFileDirectory(FileSpec &file_spec)
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().SetCString(temp_file_spec.GetCString());
return true;
}
OpenPOWER on IntegriCloud