Skip to content

Commit 4caf584

Browse files
authored
Merge pull request #28436 from mikeash/better-metadata-generic-args-dumping
2 parents 6a52b5d + 3912e7c commit 4caf584

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

stdlib/public/runtime/Metadata.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3952,6 +3952,18 @@ void Metadata::dump() const {
39523952
if (auto *contextDescriptor = getTypeContextDescriptor()) {
39533953
printf("Name: %s.\n", contextDescriptor->Name.get());
39543954
printf("Type Context Description: %p.\n", contextDescriptor);
3955+
3956+
if (contextDescriptor->isGeneric()) {
3957+
auto genericCount = contextDescriptor->getFullGenericContextHeader().Base.getNumArguments();
3958+
auto *args = getGenericArgs();
3959+
printf("Generic Args: %u: [", genericCount);
3960+
for (uint32_t i = 0; i < genericCount; i++) {
3961+
if (i > 0)
3962+
printf(", ");
3963+
printf("%p", args[i]);
3964+
}
3965+
printf("]\n");
3966+
}
39553967
}
39563968

39573969
if (auto *tuple = dyn_cast<TupleTypeMetadata>(this)) {
@@ -3976,8 +3988,6 @@ void Metadata::dump() const {
39763988
printf("\n");
39773989
}
39783990

3979-
printf("Generic Args: %p.\n", getGenericArgs());
3980-
39813991
#if SWIFT_OBJC_INTEROP
39823992
if (auto *classObject = getClassObject()) {
39833993
printf("ObjC Name: %s.\n", class_getName(

0 commit comments

Comments
 (0)