aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-06-13 19:31:46 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-06-13 19:37:19 +0000
commite8d8bef961a50d4dc22501cde4fb9fb0be1b2532 (patch)
tree94f04805f47bb7c59ae29690d8952b6074fff602 /contrib/llvm-project/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
parentbb130ff39747b94592cb26d71b7cb097b9a4ea6b (diff)
parentb60736ec1405bb0a8dd40989f67ef4c93da068ab (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Bitstream/Reader/BitstreamReader.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Bitstream/Reader/BitstreamReader.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/contrib/llvm-project/llvm/lib/Bitstream/Reader/BitstreamReader.cpp b/contrib/llvm-project/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
index 2739137c1e44..28adfe6268f9 100644
--- a/contrib/llvm-project/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
+++ b/contrib/llvm-project/llvm/lib/Bitstream/Reader/BitstreamReader.cpp
@@ -27,8 +27,7 @@ Error BitstreamCursor::EnterSubBlock(unsigned BlockID, unsigned *NumWordsP) {
if (BlockInfo) {
if (const BitstreamBlockInfo::BlockInfo *Info =
BlockInfo->getBlockInfo(BlockID)) {
- CurAbbrevs.insert(CurAbbrevs.end(), Info->Abbrevs.begin(),
- Info->Abbrevs.end());
+ llvm::append_range(CurAbbrevs, Info->Abbrevs);
}
}
@@ -156,8 +155,9 @@ Expected<unsigned> BitstreamCursor::skipRecord(unsigned AbbrevID) {
report_fatal_error("Array element type can't be an Array or a Blob");
case BitCodeAbbrevOp::Fixed:
assert((unsigned)EltEnc.getEncodingData() <= MaxChunkSize);
- if (Error Err = JumpToBit(GetCurrentBitNo() +
- NumElts * EltEnc.getEncodingData()))
+ if (Error Err =
+ JumpToBit(GetCurrentBitNo() + static_cast<uint64_t>(NumElts) *
+ EltEnc.getEncodingData()))
return std::move(Err);
break;
case BitCodeAbbrevOp::VBR:
@@ -186,7 +186,7 @@ Expected<unsigned> BitstreamCursor::skipRecord(unsigned AbbrevID) {
SkipToFourByteBoundary(); // 32-bit alignment
// Figure out where the end of this blob will be including tail padding.
- size_t NewEnd = GetCurrentBitNo()+((NumElts+3)&~3)*8;
+ const size_t NewEnd = GetCurrentBitNo() + alignTo(NumElts, 4) * 8;
// If this would read off the end of the bitcode file, just set the
// record to empty and return.
@@ -314,7 +314,7 @@ Expected<unsigned> BitstreamCursor::readRecord(unsigned AbbrevID,
// Figure out where the end of this blob will be including tail padding.
size_t CurBitPos = GetCurrentBitNo();
- size_t NewEnd = CurBitPos+((NumElts+3)&~3)*8;
+ const size_t NewEnd = CurBitPos + alignTo(NumElts, 4) * 8;
// If this would read off the end of the bitcode file, just set the
// record to empty and return.