We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents bf958ff + ea6a249 commit 63f5a86Copy full SHA for 63f5a86
1 file changed
swift/extractor/SwiftDispatcher.h
@@ -153,7 +153,11 @@ class SwiftDispatcher {
153
template <typename Tag, typename... Ts>
154
TrapLabel<Tag> fetchLabelFromUnion(const llvm::PointerUnion<Ts...> u) {
155
TrapLabel<Tag> ret{};
156
- assert((... || fetchLabelFromUnionCase<Tag, Ts>(u, ret)) && "llvm::PointerUnion not set");
+ // 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");
161
return ret;
162
}
163
0 commit comments