Skip to content

Commit 3bc0b4c

Browse files
committed
Fix is_libc_passthrough condition
1 parent 70f5880 commit 3bc0b4c

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

cpp2rust/converter/converter.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,8 +1554,12 @@ Converter::CallInfo Converter::CollectCallInfo(clang::CallExpr *expr) {
15541554
function ? function->getNumParams() : proto->getNumParams();
15551555
info.is_variadic = function ? function->isVariadic() : proto->isVariadic();
15561556
info.is_fn_ptr_call = !function;
1557-
info.is_libc_passthrough =
1558-
decl && ctx_.getSourceManager().isInSystemHeader(decl->getLocation());
1557+
info.is_libc_passthrough = false;
1558+
if (auto tgt_ir = Mapper::GetExprRule(GetCalleeOrExpr(expr))) {
1559+
if (tgt_ir->body.empty() && tgt_ir->is_variadic) {
1560+
info.is_libc_passthrough = true;
1561+
}
1562+
}
15591563

15601564
for (unsigned i = 0; i < num_named_params && i < num_args; ++i) {
15611565
auto *arg = expr->getArg(i + arg_begin);

0 commit comments

Comments
 (0)