@@ -123,8 +123,7 @@ struct InfoTreeNode {
123
123
static constexpr uint64_t IndentSize = 4 ;
124
124
125
125
std::string Key;
126
- struct None {};
127
- using VariantType = std::variant<uint64_t , std::string, bool , None>;
126
+ using VariantType = std::variant<uint64_t , std::string, bool , std::monostate>;
128
127
VariantType Value;
129
128
std::string Units;
130
129
// Need to specify a default value number of elements here as `InfoTreeNode`'s
@@ -134,15 +133,15 @@ struct InfoTreeNode {
134
133
// * The same key can appear multiple times
135
134
std::unique_ptr<llvm::SmallVector<InfoTreeNode, 8 >> Children;
136
135
137
- InfoTreeNode () : InfoTreeNode(" " , None {}, " " ) {}
136
+ InfoTreeNode () : InfoTreeNode(" " , std::monostate {}, " " ) {}
138
137
InfoTreeNode (std::string Key, VariantType Value, std::string Units)
139
138
: Key(Key), Value(Value), Units(Units) {}
140
139
141
140
// / Add a new info entry as a child of this node. The entry requires at least
142
141
// / a key string in \p Key. The value in \p Value is optional and can be any
143
142
// / type that is representable as a string. The units in \p Units is optional
144
143
// / and must be a string.
145
- template <typename T = None >
144
+ template <typename T = std::monostate >
146
145
InfoTreeNode *add (std::string Key, T Value = T(),
147
146
const std::string &Units = std::string()) {
148
147
assert (!Key.empty () && " Invalid info key" );
@@ -151,7 +150,7 @@ struct InfoTreeNode {
151
150
Children = std::make_unique<llvm::SmallVector<InfoTreeNode, 8 >>();
152
151
153
152
VariantType ValueVariant;
154
- if constexpr (std::is_same_v<T, bool > || std::is_same_v<T, None >)
153
+ if constexpr (std::is_same_v<T, bool > || std::is_same_v<T, std::monostate >)
155
154
ValueVariant = Value;
156
155
else if constexpr (std::is_arithmetic_v<T>)
157
156
ValueVariant = static_cast <uint64_t >(Value);
@@ -197,7 +196,7 @@ struct InfoTreeNode {
197
196
llvm::outs () << (V ? " Yes" : " No" );
198
197
else if constexpr (std::is_same_v<T, uint64_t >)
199
198
llvm::outs () << V;
200
- else if constexpr (std::is_same_v<T, None >) {
199
+ else if constexpr (std::is_same_v<T, std::monostate >) {
201
200
// Do nothing
202
201
} else
203
202
static_assert (false , " doPrint visit not exhaustive" );
0 commit comments