================
@@ -256,14 +251,57 @@ Error BitstreamParserHelper::parseBlockInfoBlock() {
return Error::success();
}
-Error BitstreamParserHelper::advanceToMetaBlock() {
+Error BitstreamParserHelper::parseMeta() {
if (Error E = expectMagic())
return E;
if (Error E = parseBlockInfoBlock())
return E;
+
+ // Parse early meta block
+ if (Error E = MetaHelper.expectBlock())
+ return E;
+ if (Error E = MetaHelper.parseBlock())
+ return E;
+
+ // Skip all Remarks blocks
+ while (!Stream.AtEndOfStream()) {
+ auto MaybeBlockID = expectSubBlock(Stream);
+ if (!MaybeBlockID)
+ return MaybeBlockID.takeError();
+ if (*MaybeBlockID == META_BLOCK_ID)
+ break;
+ if (*MaybeBlockID != REMARK_BLOCK_ID)
+ return error("Unexpected block between meta blocks.");
+ // Remember first remark block
+ if (!RemarkStartBitPos)
+ RemarkStartBitPos = Stream.GetCurrentBitNo();
+ if (Error E = Stream.SkipBlock())
+ return E;
+ }
+
+ // Late meta block is optional if there are no remarks.
+ if (Stream.AtEndOfStream())
+ return Error::success();
+
+ // Parse late meta block
+ if (Error E = MetaHelper.parseBlock())
+ return E;
return Error::success();
}
+Error BitstreamParserHelper::parseRemark() {
+ if (RemarkStartBitPos) {
+ RemarkStartBitPos.reset();
+ } else {
----------------
tobias-stadler wrote:
If there are braces on the else, the if also should have braces.
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
https://github.com/llvm/llvm-project/pull/156715
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits