Skip to content

Commit 750735b

Browse files
committed
ASTDumper: Add a couple of hacks to avoid crashes in -dump-parse
1 parent 6651f6e commit 750735b

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
@@ -631,7 +631,10 @@ namespace {
631631
void visitExtensionDecl(ExtensionDecl *ED) {
632632
printCommon(ED, "extension_decl", ExtensionColor);
633633
OS << ' ';
634-
ED->getExtendedType().print(OS);
634+
if (ED->hasBeenBound())
635+
ED->getExtendedType().print(OS);
636+
else
637+
ED->getExtendedTypeRepr()->print(OS);
635638
printCommonPost(ED);
636639
}
637640

@@ -854,20 +857,22 @@ namespace {
854857
if (D->isStatic())
855858
PrintWithColorRAII(OS, DeclModifierColor) << " type";
856859

857-
auto impl = D->getImplInfo();
858-
PrintWithColorRAII(OS, DeclModifierColor)
859-
<< " readImpl="
860-
<< getReadImplKindName(impl.getReadImpl());
861-
if (!impl.supportsMutation()) {
862-
PrintWithColorRAII(OS, DeclModifierColor)
863-
<< " immutable";
864-
} else {
860+
if (D->hasInterfaceType()) {
861+
auto impl = D->getImplInfo();
865862
PrintWithColorRAII(OS, DeclModifierColor)
866-
<< " writeImpl="
867-
<< getWriteImplKindName(impl.getWriteImpl());
868-
PrintWithColorRAII(OS, DeclModifierColor)
869-
<< " readWriteImpl="
870-
<< getReadWriteImplKindName(impl.getReadWriteImpl());
863+
<< " readImpl="
864+
<< getReadImplKindName(impl.getReadImpl());
865+
if (!impl.supportsMutation()) {
866+
PrintWithColorRAII(OS, DeclModifierColor)
867+
<< " immutable";
868+
} else {
869+
PrintWithColorRAII(OS, DeclModifierColor)
870+
<< " writeImpl="
871+
<< getWriteImplKindName(impl.getWriteImpl());
872+
PrintWithColorRAII(OS, DeclModifierColor)
873+
<< " readWriteImpl="
874+
<< getReadWriteImplKindName(impl.getReadWriteImpl());
875+
}
871876
}
872877
}
873878

0 commit comments

Comments
 (0)