[AsmParser][SystemZ][z/OS] Fix hanging scenario in HLASMAsmParser class
authorAnirudh Prasad <anirudh_prasad@hotmail.com>
Mon, 28 Jun 2021 16:46:31 +0000 (12:46 -0400)
committerAnirudh Prasad <anirudh_prasad@hotmail.com>
Mon, 28 Jun 2021 16:47:08 +0000 (12:47 -0400)
commit2dca0b5a1ce431692136b293fd5f9ecadea31750
tree09793e6f9e9009bbc1e1a14fa2ff2ac97c088db7
parent3a7cea2858ff2665c5430ead186a45a7f7a2d112
[AsmParser][SystemZ][z/OS] Fix hanging scenario in HLASMAsmParser class

- In the caller of the overridden `parseStatement` function (i.e. the `AsmParser::Run()`) in the case of an error **and** if we're not at the start of the statement, we "eat" up until the end of the current statement, so we don't have to process it again.
- However, in the HLASMAsmParser class what's happening is that, if an error occurs at the very start of the statement (for example, you invoke the HLASMAsmParser to parse a gnu directive), we will error out, but we never really progress in terms of the next token in the statement to parse. We simply keep looping processing the same error over and over again (partly because we're at the start of the statement)
- To remedy this, when the `parseAsHLASMLabel` function fails, before returning, we "eat" until the end of the statement function, so we don't process it anymore.

Reviewed By: uweigand

Differential Revision: https://reviews.llvm.org/D104869
llvm/lib/MC/MCParser/AsmParser.cpp