Skip to content

Commit 2dbda16

Browse files
committed
fix
1 parent 44a9617 commit 2dbda16

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎cpp2rust/converter/models/converter_refcount.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ static bool IsValueField(clang::ASTContext &ctx,
7979
static bool IsArrayFieldPtr(clang::ASTContext &ctx, const clang::Expr *expr) {
8080
auto *member =
8181
clang::dyn_cast<clang::MemberExpr>(expr->IgnoreParenImpCasts());
82-
auto *field =
83-
member ? clang::dyn_cast<clang::FieldDecl>(member->getMemberDecl())
84-
: nullptr;
82+
auto *field = member
83+
? clang::dyn_cast<clang::FieldDecl>(member->getMemberDecl())
84+
: nullptr;
8585
if (!field || field->getParent()->isUnion() ||
8686
Mapper::Contains(ctx, member)) {
8787
return false;
@@ -1567,8 +1567,8 @@ bool ConverterRefCount::VisitExplicitCastExpr(clang::ExplicitCastExpr *expr) {
15671567
PushConversionKind push(*this, ConversionKind::Unboxed);
15681568
StrCat(std::format("({} as Ptr<{}>)", ToString(sub_expr),
15691569
ToString(element_type)));
1570-
if (!ctx_.hasSameUnqualifiedType(
1571-
element_type, expr->getType()->getPointeeType())) {
1570+
if (!ctx_.hasSameUnqualifiedType(element_type,
1571+
expr->getType()->getPointeeType())) {
15721572
StrCat(std::format(".reinterpret_cast::<{}>()",
15731573
ConvertPointeeType(expr->getType())));
15741574
}

‎docs/src/runtime/rc.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ single object, which is why it needs no element index.
129129

130130
`array_field_ptr!(p, arr)` is a pointer to element 0 of the array field `arr`,
131131
and is how the elements of an array field are accessed. It is an ordinary array
132-
pointer into the array's `Value`, except when `p` is a reinterpreted pointer: the
133-
array then lives in the bytes of the original allocation, so the result is a
132+
pointer into the array's `Value`, except when `p` is a reinterpreted pointer:
133+
the array then lives in the bytes of the original allocation, so the result is a
134134
reinterpreted pointer to those bytes, at the offset of the field. Writes to the
135135
elements hence reach the original allocation, and the pointer can go past the
136136
end of the struct, as C code does with a trailing `char name[1]` in an

0 commit comments

Comments
 (0)