[llvm] r192303 - Flip the ownership of MCStreamer and MCTargetStreamer.
Benjamin Kramer
benny.kra at googlemail.com
Wed Oct 9 10:23:41 PDT 2013
Author: d0k
Date: Wed Oct 9 12:23:41 2013
New Revision: 192303
URL: http://llvm.org/viewvc/llvm-project?rev=192303&view=rev
Log:
Flip the ownership of MCStreamer and MCTargetStreamer.
MCStreamer now owns the target streamer. This prevents leaking the target
streamer.
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=192303&r1=192302&r2=192303&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Wed Oct 9 12:23:41 2013
@@ -66,11 +66,11 @@ typedef std::pair<const MCSection *, con
/// be treated differently. Callers should always talk to a FooTargetStreamer.
class MCTargetStreamer {
protected:
- OwningPtr<MCStreamer> Streamer;
+ MCStreamer *Streamer;
public:
virtual ~MCTargetStreamer();
- void setStreamer(MCStreamer *S) { Streamer.reset(S); }
+ void setStreamer(MCStreamer *S) { Streamer = S; }
};
// FIXME: declared here because it is used from
@@ -100,7 +100,7 @@ public:
///
class MCStreamer {
MCContext &Context;
- MCTargetStreamer *TargetStreamer;
+ OwningPtr<MCTargetStreamer> TargetStreamer;
MCStreamer(const MCStreamer &) LLVM_DELETED_FUNCTION;
MCStreamer &operator=(const MCStreamer &) LLVM_DELETED_FUNCTION;
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp?rev=192303&r1=192302&r2=192303&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp Wed Oct 9 12:23:41 2013
@@ -305,7 +305,7 @@ private:
} // end anonymous namespace
ARMELFStreamer &ARMTargetELFStreamer::getStreamer() {
- ARMELFStreamer *S = static_cast<ARMELFStreamer *>(Streamer.get());
+ ARMELFStreamer *S = static_cast<ARMELFStreamer *>(Streamer);
return *S;
}
More information about the llvm-commits
mailing list