@@ -5609,7 +5609,8 @@ std::string Converter::GetMappedAsString(clang::Expr *expr, clang::Expr **args,
56095609 // The rule takes the value of a transparent union.
56105610 auto *arg = IgnoreTransparentUnion (all_args[i]);
56115611 auto type = arg->getType ();
5612- bool by_value = arg->isPRValue () && !tgt_ir->takesAddress (ctx_, i, arg);
5612+ bool by_value =
5613+ arg->isPRValue () && !tgt_ir->takesAddress (ctx_, expr, i, arg);
56135614 if (!by_value && arg->isPRValue ()) {
56145615 arg = new (ctx_) clang::MaterializeTemporaryExpr (type, arg, false );
56155616 }
@@ -5704,7 +5705,9 @@ std::string Converter::ConvertIRFragment(
57045705 assert (arg_idx < all_args.size ());
57055706 auto *arg = all_args[arg_idx];
57065707 bool is_receiver = HasReceiver (expr) && arg_idx == 0 ;
5707- bool is_cpp_ptr = arg->getType ()->isPointerType ();
5708+ bool cpp_ptr = arg->getType ()->isPointerType ();
5709+ bool is_cpp_ptr =
5710+ cpp_ptr && RuleRegistry::ParamTakesPointerValue (expr, arg_idx);
57085711
57095712 PlaceholderCtx ph_ctx{
57105713 .arg_idx = arg_idx,
@@ -5717,9 +5720,8 @@ std::string Converter::ConvertIRFragment(
57175720 .is_cpp_ptr = is_cpp_ptr,
57185721 // Whatever its spelling, a pointer in C++ is converted as one.
57195722 .maps_to_rust_ptr =
5720- !is_cpp_ptr &&
5721- RuleRegistry::MapsToPointer (
5722- ctx_, arg->IgnoreParenNoopCasts (ctx_)->getType ()),
5723+ !cpp_ptr && RuleRegistry::MapsToPointer (
5724+ ctx_, arg->IgnoreParenNoopCasts (ctx_)->getType ()),
57235725 .declared_in_rule_as_rust_ptr =
57245726 RuleRegistry::ParamIsPointer (ctx_, expr, arg_idx),
57255727 .is_index_base = ph->is_index_base ,
0 commit comments