================ @@ -24,100 +26,222 @@ RootSignatureParser::RootSignatureParser(SmallVector<RootElement> &Elements, bool RootSignatureParser::parse() { // Iterate as many RootElements as possible - while (tryConsumeExpectedToken(TokenKind::kw_DescriptorTable)) { - // Dispatch onto parser method. - // We guard against the unreachable here as we just ensured that CurToken - // will be one of the kinds in the while condition - switch (CurToken.TokKind) { - case TokenKind::kw_DescriptorTable: - if (parseDescriptorTable()) + do { + if (tryConsumeExpectedToken(TokenKind::kw_DescriptorTable)) { + auto Table = parseDescriptorTable(); + if (!Table.has_value()) return true; - break; - default: - llvm_unreachable("Switch for consumed token was not provided"); + Elements.push_back(*Table); } + } while (tryConsumeExpectedToken(TokenKind::pu_comma)); - if (!tryConsumeExpectedToken(TokenKind::pu_comma)) - break; - } - - if (!tryConsumeExpectedToken(TokenKind::end_of_stream)) { - getDiags().Report(CurToken.TokLoc, diag::err_hlsl_unexpected_end_of_params) - << /*expected=*/TokenKind::end_of_stream - << /*param of=*/TokenKind::kw_RootSignature; + if (consumeExpectedToken(TokenKind::end_of_stream, + diag::err_hlsl_unexpected_end_of_params, + /*param of=*/TokenKind::kw_RootSignature)) ---------------- damyanp wrote:
```suggestion return consumeExpectedToken(TokenKind::end_of_stream, diag::err_hlsl_unexpected_end_of_params, /*param of=*/TokenKind::kw_RootSignature); ``` https://github.com/llvm/llvm-project/pull/136747 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits