File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -87,9 +87,9 @@ class SwiftDispatcher {
87
87
TrapLabelOf<E> fetchLabel (E* e) {
88
88
// this is required so we avoid any recursive loop: a `fetchLabel` during the visit of `e` might
89
89
// end up calling `fetchLabel` on `e` itself, so we want the visit of `e` to call `fetchLabel`
90
- // only after having called `assignNewLabel` on `e`. `index() == 0` indicates the monostate of
91
- // `Store::Handle`, i.e. its default construction
92
- assert (waitingForNewLabel. index () == 0 && " fetchLabel called before assignNewLabel" );
90
+ // only after having called `assignNewLabel` on `e`.
91
+ assert (holds_alternative<std::monostate>(waitingForNewLabel) &&
92
+ " fetchLabel called before assignNewLabel" );
93
93
if (auto l = store.get (e)) {
94
94
return *l;
95
95
}
@@ -114,7 +114,7 @@ class SwiftDispatcher {
114
114
auto label = getLabel<TrapTagOf<E>>();
115
115
trap.assignStar (label);
116
116
store.insert (e, label);
117
- waitingForNewLabel = {};
117
+ waitingForNewLabel = std::monostate {};
118
118
return label;
119
119
}
120
120
@@ -177,7 +177,7 @@ class SwiftDispatcher {
177
177
TrapArena& arena;
178
178
TrapOutput& trap;
179
179
Store store;
180
- Store::Handle waitingForNewLabel{};
180
+ Store::Handle waitingForNewLabel{std::monostate{} };
181
181
};
182
182
183
183
} // namespace codeql
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ template <typename... Ts>
21
21
class TrapLabelStore {
22
22
public:
23
23
using Handle = std::variant<std::monostate, const Ts*...>;
24
+
24
25
template <typename T>
25
26
std::optional<TrapLabelOf<T>> get (const T* e) {
26
27
if (auto found = store_.find (e); found != store_.end ()) {
You can’t perform that action at this time.
0 commit comments