Skip to content

Commit a3e8b8f

Browse files
committed
Rename arguments to and from
1 parent 3e385d4 commit a3e8b8f

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

‎cpp2rust/converter/converter.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,22 +1584,22 @@ bool Converter::Convert(clang::Expr *expr,
15841584
}
15851585

15861586
std::string Converter::ConvertPointeeCast(std::string str,
1587-
clang::QualType pointee,
1588-
clang::QualType slot) {
1589-
if (slot->isFunctionPointerType()) {
1587+
clang::QualType from,
1588+
clang::QualType to) {
1589+
if (to->isFunctionPointerType()) {
15901590
return std::format("std::mem::transmute::<{}, {}>({})",
1591-
ToString(ctx_.getPointerType(pointee)), ToString(slot),
1591+
ToString(ctx_.getPointerType(from)), ToString(to),
15921592
str);
15931593
}
1594-
auto target = GetUnsafeTypeAsString(slot->getPointeeType());
1595-
if (slot->isReferenceType() && !isAddrOf()) {
1594+
auto target = GetUnsafeTypeAsString(to->getPointeeType());
1595+
if (to->isReferenceType() && !isAddrOf()) {
15961596
return std::format("*(&raw {} {}).cast::<{}>()",
1597-
pointee.isConstQualified() ? "const" : "mut", str,
1597+
from.isConstQualified() ? "const" : "mut", str,
15981598
target);
15991599
}
16001600
computed_expr_type_ = ComputedExprType::FreshPointer;
16011601
return std::format("({} as {}).cast::<{}>()", str,
1602-
GetUnsafeTypeAsString(ctx_.getPointerType(pointee)),
1602+
GetUnsafeTypeAsString(ctx_.getPointerType(from)),
16031603
target);
16041604
}
16051605

‎cpp2rust/converter/converter.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ class Converter : public clang::RecursiveASTVisitor<Converter> {
313313
clang::Expr *expr);
314314

315315
virtual std::string ConvertPointeeCast(std::string str,
316-
clang::QualType pointee,
317-
clang::QualType slot);
316+
clang::QualType from,
317+
clang::QualType to);
318318

319319
void ConvertFunctionPointerTransmute(clang::Expr *expr, clang::QualType type);
320320

‎cpp2rust/converter/models/converter_refcount.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,19 +409,19 @@ std::string ConverterRefCount::ConvertFreshPointer(
409409

410410
std::string ConverterRefCount::ConvertPointeeCast(std::string str,
411411
clang::QualType,
412-
clang::QualType slot) {
413-
if (slot->isFunctionPointerType()) {
412+
clang::QualType to) {
413+
if (to->isFunctionPointerType()) {
414414
computed_expr_type_ = ComputedExprType::FreshPointer;
415415
return std::format(
416416
"({}).cast::<{}>()", str,
417417
ConvertFunctionPointerType(
418-
slot->getPointeeType()->getAs<clang::FunctionProtoType>()));
418+
to->getPointeeType()->getAs<clang::FunctionProtoType>()));
419419
}
420-
if (slot->isReferenceType() && !isAddrOf()) {
420+
if (to->isReferenceType() && !isAddrOf()) {
421421
return str;
422422
}
423423
PushConversionKind push(*this, ConversionKind::Unboxed);
424-
auto element = ctx_.getBaseElementType(slot->getPointeeType());
424+
auto element = ctx_.getBaseElementType(to->getPointeeType());
425425
computed_expr_type_ = ComputedExprType::FreshPointer;
426426
return std::format("({}).reinterpret_cast::<{}>()", str,
427427
ToString(element.getUnqualifiedType()));

‎cpp2rust/converter/models/converter_refcount.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ class ConverterRefCount final : public Converter {
377377

378378
void ConvertParamTyConstCast(clang::QualType, clang::Expr *) override {}
379379

380-
std::string ConvertPointeeCast(std::string str, clang::QualType pointee,
381-
clang::QualType slot) override;
380+
std::string ConvertPointeeCast(std::string str, clang::QualType from,
381+
clang::QualType to) override;
382382

383383
std::string ConvertSubscriptIndex(clang::Expr *idx);
384384

0 commit comments

Comments
 (0)