File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,11 @@ class SwiftDispatcher {
153
153
template <typename Tag, typename ... Ts>
154
154
TrapLabel<Tag> fetchLabelFromUnion (const llvm::PointerUnion<Ts...> u) {
155
155
TrapLabel<Tag> ret{};
156
- assert ((... || fetchLabelFromUnionCase<Tag, Ts>(u, ret)) && " llvm::PointerUnion not set" );
156
+ // with logical op short-circuiting, this will stop trying on the first successful fetch
157
+ // don't feel tempted to replace the variable with the expression inside the `assert`, or
158
+ // building with `NDEBUG` will not trigger the fetching
159
+ bool unionCaseFound = (... || fetchLabelFromUnionCase<Tag, Ts>(u, ret));
160
+ assert (unionCaseFound && " llvm::PointerUnion not set to a known case" );
157
161
return ret;
158
162
}
159
163
You can’t perform that action at this time.
0 commit comments