Skip to content

Fix JitCall codegen for move-only by-value arguments - #1105

Open
aaronj0 wants to merge 1 commit into
compiler-research:mainfrom
aaronj0:moveonly-byvalue-args
Open

Fix JitCall codegen for move-only by-value arguments#1105
aaronj0 wants to merge 1 commit into
compiler-research:mainfrom
aaronj0:moveonly-byvalue-args

Conversation

@aaronj0

@aaronj0 aaronj0 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Based on TClingCallFunc. make_narg_ctor never moved by-value arguments, and make_narg_call used a heuristic with triviality bits which is not comparable across standard libraries. Check the actual copy constructor at both sites, as TClingCallFunc does, completing the parameter type through GetOrForceDefinition first; a type with no reachable definition is assumed copyable and the wrapper compile reports otherwise.

Supersedes #971 (also addresses the review comments) as this PR is a superset of that one:
MSVC's std::unique_ptr has a non-trivial deleted copy constructor, so check assumes "don't move", passes lvalues, and fails compilation on Windows (RNTupleWriter::Append(std::unique_ptr)). #971 alone would not have fixed it.

Fixes failures in the ROOT migration.

@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 87.78%. Comparing base (9bbdbb2) to head (e1352ec).

Files with missing lines Patch % Lines
lib/CppInterOp/CppInterOp.cpp 95.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1105      +/-   ##
==========================================
+ Coverage   87.74%   87.78%   +0.04%     
==========================================
  Files          23       23              
  Lines        6429     6445      +16     
==========================================
+ Hits         5641     5658      +17     
+ Misses        788      787       -1     
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 90.62% <95.00%> (+0.07%) ⬆️
Files with missing lines Coverage Δ
lib/CppInterOp/CppInterOp.cpp 90.62% <95.00%> (+0.07%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread lib/CppInterOp/CppInterOp.cpp Outdated
get_type_as_string(QT, type_name, C, Policy);
}

static bool IsCopyConstructorDeleted(QualType QT) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'IsCopyConstructorDeleted' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace]

Suggested change
static bool IsCopyConstructorDeleted(QualType QT) {
type_name, C, Policy);

@aaronj0
aaronj0 force-pushed the moveonly-byvalue-args branch from 2d48ed5 to 8de4f61 Compare September 2, 2026 16:59
make_narg_ctor never moved by-value arguments, and make_narg_call
guessed with triviality bits that are not comparable across standard
libraries: MSVC's std::unique_ptr has a non-trivial deleted copy
constructor, so its wrappers passed lvalues and failed to compile.
Check the actual copy constructor at both sites, as TClingCallFunc
does, completing the parameter type through GetOrForceDefinition
first; a type with no reachable definition is assumed copyable and
the wrapper compile reports otherwise.
@aaronj0
aaronj0 force-pushed the moveonly-byvalue-args branch from 8de4f61 to e1352ec Compare September 3, 2026 12:43
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant