[llvm] r315225 - [MC] Use a unique_ptr<MCAssembler> for MCObjectStreamer's Assembler member.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 9 11:11:04 PDT 2017
Author: lhames
Date: Mon Oct 9 11:11:04 2017
New Revision: 315225
URL: http://llvm.org/viewvc/llvm-project?rev=315225&view=rev
Log:
[MC] Use a unique_ptr<MCAssembler> for MCObjectStreamer's Assembler member.
Removes manual new/delete.
Modified:
llvm/trunk/include/llvm/MC/MCObjectStreamer.h
llvm/trunk/lib/MC/MCObjectStreamer.cpp
Modified: llvm/trunk/include/llvm/MC/MCObjectStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCObjectStreamer.h?rev=315225&r1=315224&r2=315225&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCObjectStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCObjectStreamer.h Mon Oct 9 11:11:04 2017
@@ -34,7 +34,7 @@ class raw_pwrite_stream;
/// to that file format or custom semantics expected by the object writer
/// implementation.
class MCObjectStreamer : public MCStreamer {
- MCAssembler *Assembler;
+ std::unique_ptr<MCAssembler> Assembler;
MCSection::iterator CurInsertionPoint;
bool EmitEHFrame;
bool EmitDebugFrame;
Modified: llvm/trunk/lib/MC/MCObjectStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectStreamer.cpp?rev=315225&r1=315224&r2=315225&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectStreamer.cpp Mon Oct 9 11:11:04 2017
@@ -29,15 +29,14 @@ MCObjectStreamer::MCObjectStreamer(MCCon
raw_pwrite_stream &OS,
MCCodeEmitter *Emitter_)
: MCStreamer(Context),
- Assembler(new MCAssembler(Context, TAB, *Emitter_,
- *TAB.createObjectWriter(OS))),
+ Assembler(llvm::make_unique<MCAssembler>(Context, TAB, *Emitter_,
+ *TAB.createObjectWriter(OS))),
EmitEHFrame(true), EmitDebugFrame(false) {}
MCObjectStreamer::~MCObjectStreamer() {
delete &Assembler->getBackend();
delete &Assembler->getEmitter();
delete &Assembler->getWriter();
- delete Assembler;
}
void MCObjectStreamer::flushPendingLabels(MCFragment *F, uint64_t FOffset) {
More information about the llvm-commits
mailing list