Skip to content

Commit 51763d6

Browse files
committed
Swift: reshape a TODO into another
1 parent f461e71 commit 51763d6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

swift/extractor/infra/SwiftDispatcher.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,13 @@ class SwiftDispatcher {
170170
TrapLabel<TypeTag> fetchLabel(swift::Type t) { return fetchLabel(t.getPointer()); }
171171

172172
TrapLabel<AstNodeTag> fetchLabel(swift::ASTNode node) {
173-
return fetchLabelFromUnion<AstNodeTag>(node);
173+
auto ret = fetchLabelFromUnion<AstNodeTag>(node);
174+
if (!ret.valid()) {
175+
// TODO to be more useful, we need a generic way of attaching original source location info
176+
// to logs, this will come in upcoming work
177+
LOG_ERROR("Unable to fetch label for ASTNode");
178+
}
179+
return ret;
174180
}
175181

176182
template <typename E, std::enable_if_t<IsStorable<E*>>* = nullptr>
@@ -289,7 +295,6 @@ class SwiftDispatcher {
289295
// with logical op short-circuiting, this will stop trying on the first successful fetch
290296
bool unionCaseFound = (... || fetchLabelFromUnionCase<Tag, Ts>(u, ret));
291297
if (!unionCaseFound) {
292-
// TODO emit error/warning here
293298
return undefined_label;
294299
}
295300
return ret;

0 commit comments

Comments
 (0)