Skip to content

Commit a6c99bd

Browse files
committed
AST: Print Pack{ ... } in more debugging contexts
1 parent 234e61b commit a6c99bd

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6560,7 +6560,10 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
65606560

65616561
auto *typeAliasDecl = T->getDecl();
65626562
if (typeAliasDecl->isGeneric()) {
6563-
printGenericArgs(T->getExpandedGenericArgs());
6563+
if (Options.PrintTypesForDebugging)
6564+
printGenericArgs(T->getDirectGenericArgs());
6565+
else
6566+
printGenericArgs(T->getExpandedGenericArgs());
65646567
}
65656568
}
65666569

@@ -6571,7 +6574,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
65716574
}
65726575

65736576
void visitPackType(PackType *T) {
6574-
if (Options.PrintExplicitPackTypes)
6577+
if (Options.PrintExplicitPackTypes || Options.PrintTypesForDebugging)
65756578
Printer << "Pack{";
65766579

65776580
auto Fields = T->getElementTypes();
@@ -6582,7 +6585,7 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
65826585
visit(EltType);
65836586
}
65846587

6585-
if (Options.PrintExplicitPackTypes)
6588+
if (Options.PrintExplicitPackTypes || Options.PrintTypesForDebugging)
65866589
Printer << "}";
65876590
}
65886591

@@ -6607,7 +6610,8 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
66076610

66086611
if (rootParameterPacks.empty() &&
66096612
(T->getCountType()->isParameterPack() ||
6610-
T->getCountType()->is<PackArchetypeType>())) {
6613+
T->getCountType()->is<PackArchetypeType>() ||
6614+
Options.PrintTypesForDebugging)) {
66116615
Printer << "/* shape: ";
66126616
visit(T->getCountType());
66136617
Printer << " */ ";
@@ -6682,7 +6686,10 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
66826686
}
66836687
printQualifiedType(T);
66846688

6685-
printGenericArgs(T->getExpandedGenericArgs());
6689+
if (Options.PrintTypesForDebugging)
6690+
printGenericArgs(T->getGenericArgs());
6691+
else
6692+
printGenericArgs(T->getExpandedGenericArgs());
66866693
}
66876694

66886695
void visitParentType(Type T) {

0 commit comments

Comments
 (0)