Skip to content

Commit 9de3db9

Browse files
authored
Merge pull request swiftlang#30377 from gribozavr/astvisitor
2 parents 1a32db9 + be80642 commit 9de3db9

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-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/AST/ASTDumper.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3003,6 +3003,31 @@ class PrintTypeRepr : public TypeReprVisitor<PrintTypeRepr> {
30033003
OS << " type="; Ty.dump(OS);
30043004
PrintWithColorRAII(OS, ParenthesisColor) << ')';
30053005
}
3006+
3007+
void visitSILBoxTypeRepr(SILBoxTypeRepr *T) {
3008+
printCommon("sil_box");
3009+
Indent += 2;
3010+
3011+
ArrayRef<SILBoxTypeReprField> Fields = T->getFields();
3012+
for (unsigned i = 0, end = Fields.size(); i != end; ++i) {
3013+
OS << '\n';
3014+
printCommon("sil_box_field");
3015+
if (Fields[i].isMutable()) {
3016+
OS << " mutable";
3017+
}
3018+
OS << '\n';
3019+
printRec(Fields[i].getFieldType());
3020+
PrintWithColorRAII(OS, ParenthesisColor) << ')';
3021+
}
3022+
3023+
for (auto genArg : T->getGenericArguments()) {
3024+
OS << '\n';
3025+
printRec(genArg);
3026+
}
3027+
3028+
PrintWithColorRAII(OS, ParenthesisColor) << ')';
3029+
Indent -= 2;
3030+
}
30063031
};
30073032

30083033
} // end anonymous namespace

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)