Skip to content

Commit da766e2

Browse files
committed
Use ConvertPointeeType instead of GetUnsafeTypeAsString
1 parent db1b393 commit da766e2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cpp2rust/converter/models/converter_refcount.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,8 +1635,8 @@ std::string ConverterRefCount::GetDefaultAsString(clang::QualType qual_type) {
16351635
if (pointee_type->isVoidType()) {
16361636
ret = "AnyPtr::default()";
16371637
} else {
1638-
ret = std::format("Ptr::<{}>::null()",
1639-
GetUnsafeTypeAsString(pointee_type));
1638+
PushConversionKind push(*this, ConversionKind::Unboxed);
1639+
ret = std::format("Ptr::<{}>::null()", ConvertPointeeType(qual_type));
16401640
}
16411641
}
16421642
} else if (auto *array_type =
@@ -2240,14 +2240,14 @@ std::string ConverterRefCount::ConvertMappedMethodCall(
22402240
}
22412241

22422242
std::string ConverterRefCount::ConvertPointeeType(clang::QualType ptr_type) {
2243+
assert(!ptr_type.isNull() && ptr_type->isPointerType());
22432244
if (ptr_type->getPointeeType()->isIntegerType()) {
22442245
return ToString(ptr_type->getPointeeType());
22452246
}
22462247

22472248
// Pointee of a pointer to incomplete type is an incomplete type that does
22482249
// not have a translation rule. Hence ToString(ptr_type->getPointeeType()) is
22492250
// not enough
2250-
assert(ptr_type->isPointerType());
22512251
auto str = ToString(ptr_type);
22522252
Unwrap(str, "Ptr<", ">");
22532253
return str;

0 commit comments

Comments
 (0)