diff options
author | David Blaikie <dblaikie@gmail.com> | 2017-01-04 21:13:35 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2017-01-04 21:13:35 +0000 |
commit | daff78cd87aad9d9103c52fc5fc2ec6088e1f24d (patch) | |
tree | e2a36f1a98e7136c3c381bebd9c92a5da97b9f10 /llvm/unittests/Bitcode | |
parent | 2ff18584a9d3ce07b9fdf4aa24540a5b4b9d5f34 (diff) | |
download | bcm5719-llvm-daff78cd87aad9d9103c52fc5fc2ec6088e1f24d.tar.gz bcm5719-llvm-daff78cd87aad9d9103c52fc5fc2ec6088e1f24d.zip |
Make BitCodeAbbrev ownership explicit using shared_ptr rather than IntrusiveRefCntPtr
If this is a problem for anyone (shared_ptr is two pointers in size,
whereas IntrusiveRefCntPtr is 1 - and the ref count control block that
make_shared adds is probably larger than the one int in RefCountedBase)
I'd prefer to address this by adding a lower-overhead version of
shared_ptr (possibly refactoring IntrusiveRefCntPtr into such a thing)
to avoid the intrusiveness - this allows memory ownership to remain
orthogonal to types and at least to me, seems to make code easier to
understand (since no implicit ownership acquisition can happen).
llvm-svn: 291006
Diffstat (limited to 'llvm/unittests/Bitcode')
-rw-r--r-- | llvm/unittests/Bitcode/BitstreamReaderTest.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/unittests/Bitcode/BitstreamReaderTest.cpp b/llvm/unittests/Bitcode/BitstreamReaderTest.cpp index 704eb803f9c..935ef4bcffc 100644 --- a/llvm/unittests/Bitcode/BitstreamReaderTest.cpp +++ b/llvm/unittests/Bitcode/BitstreamReaderTest.cpp @@ -101,10 +101,10 @@ TEST(BitstreamReaderTest, readRecordWithBlobWhileStreaming) { Stream.Emit(Magic, 32); Stream.EnterSubblock(BlockID, 3); - BitCodeAbbrev *Abbrev = new BitCodeAbbrev(); + auto Abbrev = std::make_shared<BitCodeAbbrev>(); Abbrev->Add(BitCodeAbbrevOp(RecordID)); Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); - AbbrevID = Stream.EmitAbbrev(Abbrev); + AbbrevID = Stream.EmitAbbrev(std::move(Abbrev)); unsigned Record[] = {RecordID}; Stream.EmitRecordWithBlob(AbbrevID, makeArrayRef(Record), BlobIn); |