-
Notifications
You must be signed in to change notification settings - Fork 14.9k
[Remarks] BitstreamRemarkParser: Refactor error handling #156511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Remarks] BitstreamRemarkParser: Refactor error handling #156511
Conversation
Created using spr 1.3.7-wip [skip ci]
Created using spr 1.3.7-wip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NFCI (except for error messages on invalid bitstream files).
Would it be possible to add a test for the new error messages w/o too much effort?
Error BitstreamRemarkParser::parseMeta() { | ||
// Advance and to the meta block. | ||
if (Error E = advanceToMetaBlock(ParserHelper)) | ||
if (Error E = ParserHelper.advanceToMetaBlock()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (Error E = ParserHelper.advanceToMetaBlock()) | |
// Advance and to the meta block. | |
if (Error E = ParserHelper.advanceToMetaBlock()) |
can keep comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a typo, the comment doesn't really say more than the function name and advanceToMetaBlock will be removed by the follow-up patch anyways.
Is the main goal to unify the API for the standalone/separate parsers under |
Created using spr 1.3.7-wip [skip ci]
Created using spr 1.3.7-wip
Unfortunately, there is no good way to create malformed bitstream files for testing, which is why there are no tests for this in the first place. We could delete bytes from valid files to trigger the errors and commit them as binary blobs. But this is manual work and difficult to update, so it would be better to do this once all the format changes are in. The most important error is "Unsupported remark container version", which is tested by the follow-up patch that bumps the remark version. |
The main goal is to remove the separate mode, and add more features to the bitstream remark format. This patch primarily moves shared helper methods into |
Committing more binary blobs is not a great idea given the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with some nits. Tests would be good, but I don't think we should block this on improving things there.
Created using spr 1.3.7-wip [skip ci]
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/10/builds/13493 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/117/builds/13369 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/35442 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/140/builds/30734 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/116/builds/18343 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/123/builds/27173 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/88/builds/16086 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/181/builds/27874 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/205/builds/22021 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/204/builds/22044 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/23232 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/33/builds/23034 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/160/builds/24881 Here is the relevant piece of the build log for the reference
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/180/builds/25021 Here is the relevant piece of the build log for the reference
|
…#156511) In preparation of larger changes to the bitstream remark format, refactor the error handling code in the BitstreamRemarkParser. Main change: move the various static helper methods into the parser helper classes, so we don't need to pass around as many args. Calling `error(...)` inside the helper classes now automatically prepends the current block being parsed to the error message. NFCI (except for error messages on invalid bitstream files). Pull Request: llvm/llvm-project#156511
…ndling" (#158647) Reverts llvm/llvm-project#156511. Build failure not caught by pre-commit CI.
…58667) Reland #156511 after fixing a build failure not caught by clang. The default implementation of `parseRecord` is currently unused. Apparently, clang doesn't type check uninstantiated methods in class templates. To avoid this footgun, we `= delete` the impl for now. Original message: In preparation of larger changes to the bitstream remark format, refactor the error handling code in the BitstreamRemarkParser. Main change: move the various static helper methods into the parser helper classes, so we don't need to pass around as many args. Calling `error(...)` inside the helper classes now automatically prepends the current block being parsed to the error message. NFCI (except for error messages on invalid bitstream files). Pull Request: #158667
In preparation of larger changes to the bitstream remark format,
refactor the error handling code in the BitstreamRemarkParser.
Main change: move the various static helper methods into the parser
helper classes, so we don't need to pass around as many args. Calling
error(...)
inside the helper classes now automatically prepends thecurrent block being parsed to the error message.
NFCI (except for error messages on invalid bitstream files).