Skip to content

Commit be80642

Browse files
committed
Removed a catch-all default implementation of ASTVisitor::visitTypeRepr
Other AST nodes don't have such functionality now, and it was removed from them previously. Not having a default implementation means that users of ASTVisitor have to either explicitly write a catch-all default, or handle all cases. Making this decision consciously is a good practice.
1 parent a058d99 commit be80642

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/swift/AST/ASTVisitor.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,6 @@ class ASTVisitor {
127127
llvm_unreachable("Not reachable, all cases handled");
128128
}
129129

130-
TypeReprRetTy visitTypeRepr(TypeRepr *T, Args... AA) {
131-
return TypeReprRetTy();
132-
}
133-
134130
#define TYPEREPR(CLASS, PARENT) \
135131
TypeReprRetTy visit##CLASS##TypeRepr(CLASS##TypeRepr *T, Args... AA) {\
136132
return static_cast<ImplClass*>(this)->visit##PARENT(T, \

lib/Sema/TypeCheckType.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3674,6 +3674,10 @@ class UnsupportedProtocolVisitor
36743674
return !checkStatements;
36753675
}
36763676

3677+
void visitTypeRepr(TypeRepr *T) {
3678+
// Do nothing for all TypeReprs except the ones listed below.
3679+
}
3680+
36773681
void visitIdentTypeRepr(IdentTypeRepr *T) {
36783682
if (T->isInvalid())
36793683
return;

0 commit comments

Comments
 (0)