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 {
8787 TrapLabelOf<E> fetchLabel (E* e) {
8888 // this is required so we avoid any recursive loop: a `fetchLabel` during the visit of `e` might
8989 // 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" );
9393 if (auto l = store.get (e)) {
9494 return *l;
9595 }
@@ -114,7 +114,7 @@ class SwiftDispatcher {
114114 auto label = getLabel<TrapTagOf<E>>();
115115 trap.assignStar (label);
116116 store.insert (e, label);
117- waitingForNewLabel = {};
117+ waitingForNewLabel = std::monostate {};
118118 return label;
119119 }
120120
@@ -177,7 +177,7 @@ class SwiftDispatcher {
177177 TrapArena& arena;
178178 TrapOutput& trap;
179179 Store store;
180- Store::Handle waitingForNewLabel{};
180+ Store::Handle waitingForNewLabel{std::monostate{} };
181181};
182182
183183} // namespace codeql
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ template <typename... Ts>
2121class TrapLabelStore {
2222 public:
2323 using Handle = std::variant<std::monostate, const Ts*...>;
24+
2425 template <typename T>
2526 std::optional<TrapLabelOf<T>> get (const T* e) {
2627 if (auto found = store_.find (e); found != store_.end ()) {
You can’t perform that action at this time.
0 commit comments