Skip to content

Commit bda516e

Browse files
committed
C++: tweak dispatcher clauses
1 parent b78f124 commit bda516e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

swift/extractor/infra/SwiftDispatcher.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ class SwiftDispatcher {
129129
// This method gives a TRAP label for already emitted AST node.
130130
// If the AST node was not emitted yet, then the emission is dispatched to a corresponding
131131
// visitor (see `visit(T *)` methods below).
132+
// clang-format off
132133
template <typename E>
133-
requires std::constructible_from<Handle, E> TrapLabelOf<E> fetchLabel(const E& e,
134-
swift::Type type = {}) {
135-
if constexpr (std::constructible_from<bool, const E&>) {
136-
if (!e) {
137-
// this will be treated on emission
138-
return undefined_label;
139-
}
134+
requires std::constructible_from<Handle, E*>
135+
TrapLabelOf<E> fetchLabel(const E* e, swift::Type type = {}) {
136+
// clang-format on
137+
if (!e) {
138+
// this will be treated on emission
139+
return undefined_label;
140140
}
141141
auto& stored = store[e];
142142
if (!stored.valid()) {
@@ -162,8 +162,11 @@ class SwiftDispatcher {
162162
return ret;
163163
}
164164

165+
// clang-format off
165166
template <typename E>
166-
requires std::constructible_from<Handle, E*> TrapLabelOf<E> fetchLabel(const E& e) {
167+
requires std::constructible_from<Handle, E*>
168+
TrapLabelOf<E> fetchLabel(const E& e) {
169+
// clang-format on
167170
return fetchLabel(&e);
168171
}
169172

0 commit comments

Comments
 (0)