[llvm-branch-commits] [clang] [llvm] [HLSL][RootSignature] Define and integrate rootsig clang attr and decl (PR #137690)
Justin Bogner via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 8 16:14:09 PDT 2025
================
@@ -149,6 +149,29 @@ void DescriptorTableClause::dump(raw_ostream &OS) const {
OS << ")";
}
+// Helper struct so that we can use the overloaded notation of std::visit
+template <class... Ts> struct OverloadMethods : Ts... {
+ using Ts::operator()...;
+};
+
+template <class... Ts> OverloadMethods(Ts...) -> OverloadMethods<Ts...>;
----------------
bogner wrote:
I feel like it'd be simpler to just define a callable with a templated `operator()`:
```c++
namespace {
struct ElementDumper {
raw_ostream &OS;
template <typename T> void operator()(const T &Element) const {
Element.dump(OS);
}
};
}
```
Then we just need `std::visit(ElementDumper{OS}, Element)` later.
https://github.com/llvm/llvm-project/pull/137690
More information about the llvm-branch-commits
mailing list