@@ -1493,6 +1493,28 @@ bool ConverterRefCount::VisitInitListExpr(clang::InitListExpr *expr) {
14931493 return false ;
14941494}
14951495
1496+ void ConverterRefCount::ConvertUnionMemberAccessor (clang::MemberExpr *expr) {
1497+ std::string str;
1498+ {
1499+ Buffer buf (*this );
1500+ PushExprKind push (*this , isLValue () ? ExprKind::LValue : ExprKind::RValue);
1501+ Converter::ConvertMemberExpr (expr);
1502+ str = std::move (buf).str ();
1503+ }
1504+ str += " ()" ;
1505+
1506+ if (isAddrOf ()) {
1507+ StrCat (str);
1508+ computed_expr_type_ = ComputedExprType::Pointer;
1509+ return ;
1510+ }
1511+ if (isLValue ()) {
1512+ pending_deref_.set (str);
1513+ return ;
1514+ }
1515+ StrCat (DerefPtrExpr (str, expr->getMemberDecl ()->getType ()));
1516+ }
1517+
14961518bool ConverterRefCount::VisitMemberExpr (clang::MemberExpr *expr) {
14971519 auto *member = expr->getMemberDecl ();
14981520 bool known = Mapper::Contains (expr);
@@ -1515,26 +1537,7 @@ bool ConverterRefCount::VisitMemberExpr(clang::MemberExpr *expr) {
15151537 if (auto *parent =
15161538 clang::dyn_cast<clang::RecordDecl>(member->getDeclContext ());
15171539 parent && parent->isUnion () && clang::isa<clang::FieldDecl>(member)) {
1518- std::string str;
1519- {
1520- Buffer buf (*this );
1521- PushExprKind push (*this ,
1522- isLValue () ? ExprKind::LValue : ExprKind::RValue);
1523- Converter::ConvertMemberExpr (expr);
1524- str = std::move (buf).str ();
1525- }
1526- str += " ()" ;
1527-
1528- if (isAddrOf ()) {
1529- StrCat (str);
1530- computed_expr_type_ = ComputedExprType::Pointer;
1531- return false ;
1532- }
1533- if (isLValue ()) {
1534- pending_deref_.set (str);
1535- return false ;
1536- }
1537- StrCat (DerefPtrExpr (str, member->getType ()));
1540+ ConvertUnionMemberAccessor (expr);
15381541 return false ;
15391542 }
15401543
0 commit comments