[clang] [llvm] [HLSL][RootSignature] Add parsing for empty RootParams (PR #140147)
Alex Sepkowski via cfe-commits
cfe-commits at lists.llvm.org
Thu May 15 17:18:07 PDT 2025
================
@@ -155,6 +163,41 @@ std::optional<RootConstants> RootSignatureParser::parseRootConstants() {
return Constants;
}
+std::optional<RootParam> RootSignatureParser::parseRootParam() {
+ assert((CurToken.TokKind == TokenKind::kw_CBV ||
+ CurToken.TokKind == TokenKind::kw_SRV ||
+ CurToken.TokKind == TokenKind::kw_UAV) &&
+ "Expects to only be invoked starting at given keyword");
+
+ TokenKind ParamKind = CurToken.TokKind;
+
+ if (consumeExpectedToken(TokenKind::pu_l_paren, diag::err_expected_after,
+ CurToken.TokKind))
+ return std::nullopt;
+
+ RootParam Param;
+ switch (ParamKind) {
+ default:
----------------
alsepkow wrote:
nit: Is there a reason the default case comes first? Just looks weird to me. Also why do we need to add llvm_unreachable? The llvm coding standards say "-Wswitch " should be enabled. Do we disable it for some reason?
https://github.com/llvm/llvm-project/pull/140147
More information about the cfe-commits
mailing list