[llvm-branch-commits] [llvm] [DirectX] Removing dxbc StaticSampler from mcbxdc (PR #154631)
Justin Bogner via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 28 13:18:43 PDT 2025
================
@@ -51,13 +51,13 @@ static std::optional<StringRef> extractMdStringValue(MDNode *Node,
return NodeText->getString();
}
-static Expected<dxbc::ShaderVisibility>
-extractShaderVisibility(MDNode *Node, unsigned int OpId) {
+template <typename T, std::enable_if_t<std::is_enum_v<T>, int> = 0>
----------------
bogner wrote:
You can simplify this slightly by just using a type for the second template parameter:
```c++
template <typename T, typename = std::enable_if_t<std::is_enum_v<T>>>
```
This is example #5 in https://en.cppreference.com/w/cpp/types/enable_if.html, and note that it does not run afoul of the warning in the notes there, since we're not trying to overload this template.
That said, I think we should also constrain this a bit more tightly since we're hardcoding that we read a `uint32_t` here - we can make the condition check that the underlying type is indeed `uint32_t`:
```c++
template <typename T, typename = std::enable_if_t<
std::is_enum_v<T> &&
std::is_same_v<std::underlying_type_t<T>, uint32_t>>>
```
https://github.com/llvm/llvm-project/pull/154631
More information about the llvm-branch-commits
mailing list