[llvm] [Draft] Remove to_underlying from root parameter header (PR #154249)

Justin Bogner via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 19 09:05:53 PDT 2025


================
@@ -51,6 +51,17 @@ static std::optional<StringRef> extractMdStringValue(MDNode *Node,
   return NodeText->getString();
 }
 
+static Expected<dxbc::ShaderVisibility>
+extractShaderVisibility(MDNode *Node, unsigned int OpId) {
+  if (std::optional<uint32_t> Val = extractMdIntValue(Node, OpId)) {
+    if (!dxbc::isValidShaderVisibility(*Val))
+      return make_error<RootSignatureValidationError<uint32_t>>(
+          "ShaderVisibility", *Val);
+    return static_cast<dxbc::ShaderVisibility>(*Val);
----------------
bogner wrote:

I think constructor syntax is more usual for creating an enum from an underlying value than static cast:
```suggestion
    return dxbc::ShaderVisibility(*Val);
```

https://github.com/llvm/llvm-project/pull/154249


More information about the llvm-commits mailing list