diff options
author | Greg Clayton <gclayton@apple.com> | 2013-04-18 18:10:51 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2013-04-18 18:10:51 +0000 |
commit | e01e07b6e76ad6f571cefe679d112fede88cf1db (patch) | |
tree | 20979ebc3dfe96a71174222e2fee18f30f772abf /lldb/source/Core | |
parent | 56f976f6bda043e5bdbd35e5d92968a112b74a10 (diff) | |
download | bcm5719-llvm-e01e07b6e76ad6f571cefe679d112fede88cf1db.tar.gz bcm5719-llvm-e01e07b6e76ad6f571cefe679d112fede88cf1db.zip |
Since we use C++11, we should switch over to using std::unique_ptr when C++11 is being used. To do this, we follow what we have done for shared pointers and we define a STD_UNIQUE_PTR macro that can be used and it will "do the right thing". Due to some API differences in std::unique_ptr and due to the fact that we need to be able to compile without C++11, we can't use move semantics so some code needed to change so that it can compile with either C++.
Anyone wanting to use a unique_ptr or auto_ptr should now use the "STD_UNIQUE_PTR(TYPE)" macro.
llvm-svn: 179779
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/Communication.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/Disassembler.cpp | 6 | ||||
-rw-r--r-- | lldb/source/Core/DynamicLoader.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Core/Module.cpp | 11 | ||||
-rw-r--r-- | lldb/source/Core/StreamAsynchronousIO.cpp | 2 |
5 files changed, 17 insertions, 8 deletions
diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index 51bf4c39706..6e1c545f066 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -108,7 +108,7 @@ Communication::Disconnect (Error *error_ptr) // don't want to pay for the overhead it might cause if every time we // access the connection we have to take a lock. // - // This auto_ptr will cleanup after itself when this object goes away, + // This unique pointer will cleanup after itself when this object goes away, // so there is no need to currently have it destroy itself immediately // upon disconnnect. //connection_sp.reset(); diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 2a67f1db165..f2782bc49ad 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -638,7 +638,7 @@ Instruction::Dump (lldb_private::Stream *s, bool Instruction::DumpEmulation (const ArchSpec &arch) { - std::auto_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL)); + STD_UNIQUE_PTR(EmulateInstruction) insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL)); if (insn_emulator_ap.get()) { insn_emulator_ap->SetInstruction (GetOpcode(), GetAddress(), NULL); @@ -904,7 +904,7 @@ Instruction::TestEmulation (Stream *out_stream, const char *file_name) arch.SetTriple (llvm::Triple (value_sp->GetStringValue())); bool success = false; - std::auto_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL)); + STD_UNIQUE_PTR(EmulateInstruction) insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL)); if (insn_emulator_ap.get()) success = insn_emulator_ap->TestEmulation (out_stream, arch, data_dictionary); @@ -925,7 +925,7 @@ Instruction::Emulate (const ArchSpec &arch, EmulateInstruction::ReadRegisterCallback read_reg_callback, EmulateInstruction::WriteRegisterCallback write_reg_callback) { - std::auto_ptr<EmulateInstruction> insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL)); + STD_UNIQUE_PTR(EmulateInstruction) insn_emulator_ap (EmulateInstruction::FindPlugin (arch, eInstructionTypeAny, NULL)); if (insn_emulator_ap.get()) { insn_emulator_ap->SetBaton (baton); diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp index 17a796fee9d..1e52acce38c 100644 --- a/lldb/source/Core/DynamicLoader.cpp +++ b/lldb/source/Core/DynamicLoader.cpp @@ -24,7 +24,7 @@ DynamicLoader::FindPlugin (Process *process, const char *plugin_name) create_callback = PluginManager::GetDynamicLoaderCreateCallbackForPluginName (plugin_name); if (create_callback) { - std::auto_ptr<DynamicLoader> instance_ap(create_callback(process, true)); + STD_UNIQUE_PTR(DynamicLoader) instance_ap(create_callback(process, true)); if (instance_ap.get()) return instance_ap.release(); } @@ -33,7 +33,7 @@ DynamicLoader::FindPlugin (Process *process, const char *plugin_name) { for (uint32_t idx = 0; (create_callback = PluginManager::GetDynamicLoaderCreateCallbackAtIndex(idx)) != NULL; ++idx) { - std::auto_ptr<DynamicLoader> instance_ap(create_callback(process, false)); + STD_UNIQUE_PTR(DynamicLoader) instance_ap(create_callback(process, false)); if (instance_ap.get()) return instance_ap.release(); } diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 151e611b71b..3c1dfbfb3c6 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -254,7 +254,7 @@ Module::GetMemoryObjectFile (const lldb::ProcessSP &process_sp, lldb::addr_t hea if (process_sp) { m_did_load_objfile = true; - std::auto_ptr<DataBufferHeap> data_ap (new DataBufferHeap (512, 0)); + STD_UNIQUE_PTR(DataBufferHeap) data_ap (new DataBufferHeap (512, 0)); Error readmem_error; const size_t bytes_read = process_sp->ReadMemory (header_addr, data_ap->GetBytes(), @@ -1185,6 +1185,15 @@ Module::GetModificationTime () const return m_mod_time; } +void +Module::SetSymbolFileFileSpec (const FileSpec &file) +{ + m_symfile_spec = file; + m_symfile_ap.reset(); + m_did_load_symbol_vendor = false; +} + + bool Module::IsExecutable () { diff --git a/lldb/source/Core/StreamAsynchronousIO.cpp b/lldb/source/Core/StreamAsynchronousIO.cpp index d6ab0d85725..5e14d13e9a6 100644 --- a/lldb/source/Core/StreamAsynchronousIO.cpp +++ b/lldb/source/Core/StreamAsynchronousIO.cpp @@ -35,7 +35,7 @@ StreamAsynchronousIO::Flush () { if (m_accumulated_data.GetSize() > 0) { - std::auto_ptr<EventDataBytes> data_bytes_ap (new EventDataBytes); + STD_UNIQUE_PTR(EventDataBytes) data_bytes_ap (new EventDataBytes); // Let's swap the bytes to avoid LARGE string copies. data_bytes_ap->SwapBytes (m_accumulated_data.GetString()); EventSP new_event_sp (new Event (m_broadcast_event_type, data_bytes_ap.release())); |