Skip to content

Commit 071090f

Browse files
committed
[AST] Don't crash when dumping a function type that doesn't have extInfo
1 parent 67c097a commit 071090f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3825,17 +3825,20 @@ namespace {
38253825
void printAnyFunctionTypeCommon(AnyFunctionType *T, StringRef label,
38263826
StringRef name) {
38273827
printCommon(label, name);
3828-
SILFunctionType::Representation representation =
3829-
T->getExtInfo().getSILRepresentation();
38303828

3831-
if (representation != SILFunctionType::Representation::Thick)
3832-
printField("representation",
3833-
getSILFunctionTypeRepresentationString(representation));
3829+
if (T->hasExtInfo()) {
3830+
SILFunctionType::Representation representation =
3831+
T->getExtInfo().getSILRepresentation();
38343832

3835-
printFlag(!T->isNoEscape(), "escaping");
3836-
printFlag(T->isSendable(), "Sendable");
3837-
printFlag(T->isAsync(), "async");
3838-
printFlag(T->isThrowing(), "throws");
3833+
if (representation != SILFunctionType::Representation::Thick) {
3834+
printField("representation",
3835+
getSILFunctionTypeRepresentationString(representation));
3836+
}
3837+
printFlag(!T->isNoEscape(), "escaping");
3838+
printFlag(T->isSendable(), "Sendable");
3839+
printFlag(T->isAsync(), "async");
3840+
printFlag(T->isThrowing(), "throws");
3841+
}
38393842

38403843
if (Type globalActor = T->getGlobalActor()) {
38413844
printField("global_actor", globalActor.getString());

0 commit comments

Comments
 (0)