Skip to content

Commit dceb357

Browse files
committed
Improve the TypeAlias{Type|Decl} dump
Dump the underlying type by desugaring ourselves a little.
1 parent 278ead3 commit dceb357

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/AST/ASTDumper.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -616,9 +616,9 @@ namespace {
616616
void visitTypeAliasDecl(TypeAliasDecl *TAD) {
617617
printCommon(TAD, "typealias");
618618
PrintWithColorRAII(OS, TypeColor) << " type='";
619-
if (TAD->getUnderlyingTypeLoc().getType()) {
619+
if (auto underlying = TAD->getUnderlyingType()) {
620620
PrintWithColorRAII(OS, TypeColor)
621-
<< TAD->getUnderlyingTypeLoc().getType().getString();
621+
<< underlying.getString();
622622
} else {
623623
PrintWithColorRAII(OS, TypeColor) << "<<<unresolved>>>";
624624
}
@@ -3378,6 +3378,12 @@ namespace {
33783378
void visitTypeAliasType(TypeAliasType *T, StringRef label) {
33793379
printCommon(label, "type_alias_type");
33803380
printField("decl", T->getDecl()->printRef());
3381+
PrintWithColorRAII(OS, TypeColor) << " underlying='";
3382+
if (auto underlying = T->getSinglyDesugaredType()) {
3383+
PrintWithColorRAII(OS, TypeColor) << underlying->getString();
3384+
} else {
3385+
PrintWithColorRAII(OS, TypeColor) << "<<<unresolved>>>";
3386+
}
33813387
if (T->getParent())
33823388
printRec("parent", T->getParent());
33833389

0 commit comments

Comments
 (0)