Skip to content

Commit 57a0c9f

Browse files
authored
[Runtime] Fix some type mismatch errors (swiftlang#25790)
Harmless in practice, but still good hygiene.
1 parent 149080c commit 57a0c9f

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

include/swift/ABI/Metadata.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3358,6 +3358,11 @@ class MetadataAccessFunction {
33583358
explicit operator bool() const {
33593359
return Function != nullptr;
33603360
}
3361+
3362+
/// For debugging purposes only.
3363+
explicit operator void*() const {
3364+
return reinterpret_cast<void *>(Function);
3365+
}
33613366

33623367
/// Invoke with an array of arguments of dynamic size.
33633368
MetadataResponse operator()(MetadataRequest request,

stdlib/public/runtime/Metadata.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3954,24 +3954,24 @@ template <>
39543954
LLVM_ATTRIBUTE_USED
39553955
void TypeContextDescriptor::dump() const {
39563956
printf("TargetTypeContextDescriptor.\n");
3957-
printf("Flags: 0x%x.\n", this->Flags);
3957+
printf("Flags: 0x%x.\n", this->Flags.getIntValue());
39583958
printf("Parent: %p.\n", this->Parent.get());
39593959
printf("Name: %s.\n", Name.get());
3960-
printf("Access function: %p.\n", getAccessFunction());
3960+
printf("Access function: %p.\n", static_cast<void *>(getAccessFunction()));
39613961
printf("Fields: %p.\n", Fields.get());
39623962
}
39633963

39643964
template<>
39653965
LLVM_ATTRIBUTE_USED
39663966
void EnumDescriptor::dump() const {
39673967
printf("TargetEnumDescriptor.\n");
3968-
printf("Flags: 0x%x.\n", this->Flags);
3968+
printf("Flags: 0x%x.\n", this->Flags.getIntValue());
39693969
printf("Parent: %p.\n", this->Parent.get());
39703970
printf("Name: %s.\n", Name.get());
3971-
printf("Access function: %p.\n", getAccessFunction());
3971+
printf("Access function: %p.\n", static_cast<void *>(getAccessFunction()));
39723972
printf("Fields: %p.\n", Fields.get());
39733973
printf("NumPayloadCasesAndPayloadSizeOffset: 0x%08x "
3974-
"(payload cases: %u - payload size offset: %u).\n",
3974+
"(payload cases: %u - payload size offset: %zu).\n",
39753975
NumPayloadCasesAndPayloadSizeOffset,
39763976
getNumPayloadCases(), getPayloadSizeOffset());
39773977
printf("NumEmptyCases: %u\n", NumEmptyCases);

stdlib/public/runtime/ReflectionMirror.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static bool _shouldReportMissingReflectionMetadataWarnings() {
328328
const FieldDescriptor &descriptor = *fields;
329329
auto &field = descriptor.getFields()[index];
330330
// Bounds are always valid as the offset is constant.
331-
auto name = field.getFieldName(0, 0, std::numeric_limits<uint64_t>::max());
331+
auto name = field.getFieldName(0, 0, std::numeric_limits<uintptr_t>::max());
332332

333333
// Enum cases don't always have types.
334334
if (!field.hasMangledTypeName())

0 commit comments

Comments
 (0)