@@ -1528,20 +1528,20 @@ Converter::CallInfo Converter::CollectCallInfo(clang::CallExpr *expr) {
15281528 using Kind = CallArg::Kind;
15291529
15301530 CallInfo info;
1531- info.callee = expr->getCallee ();
1531+ info.expr = expr;
1532+ auto callee = GetCallee (expr);
15321533 unsigned arg_begin = 0 ;
15331534 if (auto op_call = llvm::dyn_cast<clang::CXXOperatorCallExpr>(expr)) {
15341535 if (op_call->getOperator () == clang::OO_Call) {
1535- info.callee = op_call->getArg (0 );
15361536 arg_begin = 1 ;
15371537 }
15381538 }
15391539
1540- const auto *function =
1541- expr-> getCalleeDecl () ? expr-> getCalleeDecl () ->getAsFunction () : nullptr ;
1540+ auto decl = expr-> getCalleeDecl ();
1541+ const auto *function = decl ? decl ->getAsFunction () : nullptr ;
15421542 const clang::FunctionProtoType *proto = nullptr ;
15431543 if (!function) {
1544- auto callee_ty = info. callee ->getType ().getDesugaredType (ctx_);
1544+ auto callee_ty = callee->getType ().getDesugaredType (ctx_);
15451545 if (auto ptr_ty = callee_ty->getAs <clang::PointerType>()) {
15461546 proto = ptr_ty->getPointeeType ()->getAs <clang::FunctionProtoType>();
15471547 }
@@ -1658,10 +1658,14 @@ void Converter::EmitCall(CallInfo &&info) {
16581658 EmitHoistedArgs (info);
16591659
16601660 if (info.is_fn_ptr_call ) {
1661- EmitFnPtrCall (info.callee );
1661+ EmitFnPtrCall (GetCallee (info.expr ));
1662+ } else if (info.is_libc_passthrough ) {
1663+ auto *direct_callee = info.expr ->getDirectCallee ();
1664+ assert (direct_callee);
1665+ StrCat (" libc::" , direct_callee->getName ());
16621666 } else {
16631667 PushExprKind push (*this , ExprKind::Callee);
1664- Convert (info.callee );
1668+ Convert (GetCallee ( info.expr ) );
16651669 }
16661670
16671671 EmitArgList (info);
0 commit comments