================
@@ -711,6 +734,35 @@ std::optional<Register>
RootSignatureParser::parseRegister() {
return Reg;
}
+std::optional<float> RootSignatureParser::parseFloatParam() {
+ assert(CurToken.TokKind == TokenKind::pu_equal &&
+ "Expects to only be invoked starting at given keyword");
+ // Consume sign modifier
+ bool Signed =
+ tryConsumeExpectedToken({TokenKind::pu_plus, TokenKind::pu_minus});
+ bool Negated = Signed && CurToken.TokKind == TokenKind::pu_minus;
+
+ // DXC will treat a postive signed integer as unsigned
+ if (!Negated && tryConsumeExpectedToken(TokenKind::int_literal)) {
+ auto UInt = handleUIntLiteral();
+ if (!UInt.has_value())
+ return std::nullopt;
+ return (float)UInt.value();
----------------
bogner wrote:
Better to use a function-style cast (that is, `float(UInt.value())`) rather
than a C-style cast here (and later in this function). In general it's better
to use C++'s casts over C-style casts, as they're a lot more specific about
what types of conversion are expected.
https://github.com/llvm/llvm-project/pull/140181
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits