summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2017-01-04 22:36:33 +0000
committerDavid Blaikie <dblaikie@gmail.com>2017-01-04 22:36:33 +0000
commit7ad9dc11db44028b4f57343f07280560cf415f8a (patch)
tree74874af139ba988bf1cbd941be319db040b7db01 /llvm/lib/Bitcode/Reader/BitstreamReader.cpp
parent5480eb8445856a059f57bb9c6c54dc3afbbbc4ff (diff)
downloadbcm5719-llvm-7ad9dc11db44028b4f57343f07280560cf415f8a.tar.gz
bcm5719-llvm-7ad9dc11db44028b4f57343f07280560cf415f8a.zip
Reapply "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). This recommits 291006, reverted in r291007. llvm-svn: 291016
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitstreamReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitstreamReader.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitstreamReader.cpp b/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
index 43c9aebd79e..0c45b4b4cde 100644
--- a/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitstreamReader.cpp
@@ -273,7 +273,7 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
}
void BitstreamCursor::ReadAbbrevRecord() {
- BitCodeAbbrev *Abbv = new BitCodeAbbrev();
+ auto Abbv = std::make_shared<BitCodeAbbrev>();
unsigned NumOpInfo = ReadVBR(5);
for (unsigned i = 0; i != NumOpInfo; ++i) {
bool IsLiteral = Read(1);
@@ -307,7 +307,7 @@ void BitstreamCursor::ReadAbbrevRecord() {
if (Abbv->getNumOperandInfos() == 0)
report_fatal_error("Abbrev record with no operands");
- CurAbbrevs.push_back(Abbv);
+ CurAbbrevs.push_back(std::move(Abbv));
}
Optional<BitstreamBlockInfo>
OpenPOWER on IntegriCloud