Skip to content

Commit acf1063

Browse files
committed
[ast-dumper] If an existential metatype type has a metatype representation, print it when dumping.
This makes it easy when debugging to tell the difference in between metatypes with differing representations. rdar://28536812
1 parent 37ee4ee commit acf1063

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2753,29 +2753,34 @@ namespace {
27532753
OS << ")";
27542754
}
27552755

2756+
void printMetatypeRepresentation(MetatypeRepresentation representation) {
2757+
OS << " ";
2758+
switch (representation) {
2759+
case MetatypeRepresentation::Thin:
2760+
OS << "@thin";
2761+
break;
2762+
case MetatypeRepresentation::Thick:
2763+
OS << "@thick";
2764+
break;
2765+
case MetatypeRepresentation::ObjC:
2766+
OS << "@objc";
2767+
break;
2768+
}
2769+
}
2770+
27562771
void visitMetatypeType(MetatypeType *T, StringRef label) {
27572772
printCommon(T, label, "metatype_type");
2758-
if (T->hasRepresentation()) {
2759-
OS << " ";
2760-
switch (T->getRepresentation()) {
2761-
case MetatypeRepresentation::Thin:
2762-
OS << "@thin";
2763-
break;
2764-
case MetatypeRepresentation::Thick:
2765-
OS << "@thick";
2766-
break;
2767-
case MetatypeRepresentation::ObjC:
2768-
OS << "@objc";
2769-
break;
2770-
}
2771-
}
2773+
if (T->hasRepresentation())
2774+
printMetatypeRepresentation(T->getRepresentation());
27722775
printRec(T->getInstanceType());
27732776
OS << ")";
27742777
}
27752778

27762779
void visitExistentialMetatypeType(ExistentialMetatypeType *T,
27772780
StringRef label) {
27782781
printCommon(T, label, "existential_metatype_type");
2782+
if (T->hasRepresentation())
2783+
printMetatypeRepresentation(T->getRepresentation());
27792784
printRec(T->getInstanceType());
27802785
OS << ")";
27812786
}

0 commit comments

Comments
 (0)