@@ -1484,6 +1484,28 @@ bool ConverterRefCount::VisitInitListExpr(clang::InitListExpr *expr) {
14841484 return false ;
14851485}
14861486
1487+ void ConverterRefCount::ConvertUnionMemberAccessor (clang::MemberExpr *expr) {
1488+ std::string str;
1489+ {
1490+ Buffer buf (*this );
1491+ PushExprKind push (*this , isLValue () ? ExprKind::LValue : ExprKind::RValue);
1492+ Converter::ConvertMemberExpr (expr);
1493+ str = std::move (buf).str ();
1494+ }
1495+ str += " ()" ;
1496+
1497+ if (isAddrOf ()) {
1498+ StrCat (str);
1499+ computed_expr_type_ = ComputedExprType::Pointer;
1500+ return ;
1501+ }
1502+ if (isLValue ()) {
1503+ pending_deref_.set (str);
1504+ return ;
1505+ }
1506+ StrCat (DerefPtrExpr (str, expr->getMemberDecl ()->getType ()));
1507+ }
1508+
14871509bool ConverterRefCount::VisitMemberExpr (clang::MemberExpr *expr) {
14881510 auto *member = expr->getMemberDecl ();
14891511 bool known = Mapper::Contains (expr);
@@ -1506,26 +1528,7 @@ bool ConverterRefCount::VisitMemberExpr(clang::MemberExpr *expr) {
15061528 if (auto *parent =
15071529 clang::dyn_cast<clang::RecordDecl>(member->getDeclContext ());
15081530 parent && parent->isUnion () && clang::isa<clang::FieldDecl>(member)) {
1509- std::string str;
1510- {
1511- Buffer buf (*this );
1512- PushExprKind push (*this ,
1513- isLValue () ? ExprKind::LValue : ExprKind::RValue);
1514- Converter::ConvertMemberExpr (expr);
1515- str = std::move (buf).str ();
1516- }
1517- str += " ()" ;
1518-
1519- if (isAddrOf ()) {
1520- StrCat (str);
1521- computed_expr_type_ = ComputedExprType::Pointer;
1522- return false ;
1523- }
1524- if (isLValue ()) {
1525- pending_deref_.set (str);
1526- return false ;
1527- }
1528- StrCat (DerefPtrExpr (str, member->getType ()));
1531+ ConvertUnionMemberAccessor (expr);
15291532 return false ;
15301533 }
15311534
0 commit comments