Skip to content

Commit 5d39779

Browse files
committed
review: simplify overloaded notation
1 parent a16dde1 commit 5d39779

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

llvm/lib/Frontend/HLSL/HLSLRootSignature.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,25 +144,26 @@ void DescriptorTableClause::dump(raw_ostream &OS) const {
144144
OS << ", flags = " << Flags << ")";
145145
}
146146

147-
// Helper struct so that we can use the overloaded notation of std::visit
148-
template <class... Ts> struct OverloadMethods : Ts... {
149-
using Ts::operator()...;
147+
// Helper callable so that we can use the overloaded notation of std::visit
148+
namespace {
149+
struct ElementDumper {
150+
raw_ostream &OS;
151+
template <typename T> void operator()(const T &Element) const {
152+
Element.dump(OS);
153+
}
150154
};
151-
152-
template <class... Ts> OverloadMethods(Ts...) -> OverloadMethods<Ts...>;
155+
} // namespace
153156

154157
void dumpRootElements(raw_ostream &OS, ArrayRef<RootElement> Elements) {
158+
ElementDumper Dumper{OS};
155159
OS << "RootElements{";
156160
bool First = true;
157161
for (const RootElement &Element : Elements) {
158162
if (!First)
159163
OS << ",";
160164
OS << " ";
161165
First = false;
162-
std::visit(OverloadMethods{
163-
[&OS](DescriptorTable Table) { Table.dump(OS); },
164-
[&OS](DescriptorTableClause Clause) { Clause.dump(OS); }},
165-
Element);
166+
std::visit(Dumper, Element);
166167
}
167168
OS << "}";
168169
}

0 commit comments

Comments
 (0)