Skip to content

Add self-containment link probe for CppInterOpTypes.h. - #1075

Open
vgvassilev wants to merge 1 commit into
compiler-research:mainfrom
vgvassilev:cppinterop-types-test-infra
Open

Add self-containment link probe for CppInterOpTypes.h.#1075
vgvassilev wants to merge 1 commit into
compiler-research:mainfrom
vgvassilev:cppinterop-types-test-infra

Conversation

@vgvassilev

Copy link
Copy Markdown
Contributor

CppInterOpTypes.h's helpers must stay either inline in the header or implemented in a form that does not require linking libclangCppInterOp -- Dispatch consumers (cppyy-backend, xeus-cpp) do not link the full library, they only dlopen it lazily via LoadDispatchAPI. A helper whose implementation drifts into a .cpp file inside libclangCppInterOp would silently force those consumers into a DT_NEEDED against the whole library or a new dispatch-table entry -- the exact class of hazard we hit with Cpp::ResultAbort_UncheckedOnDtor.

The probe is a tiny executable that includes only CppInterOpTypes.h, exercises the header's helpers, and deliberately does not link libclangCppInterOp or any LLVM library. If any future header addition needs an out-of-line symbol, the link fails with undefined reference to <symbol>. ctest just launches the built binary; the load-bearing signal is the successful link at build time.

Also renames HandleTypesTest.cpp to CppInterOpTypesTest.cpp so all tests for types declared in CppInterOpTypes.h share the naming convention already used for CppInterOpThunksTest (test file named after the header it covers). Follow-up commits extend the probe body and CppInterOpTypesTest.cpp coverage as new helpers land.

Description

Please include a summary of changes, motivation and context for this PR.

Fixes # (issue)

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Requires documentation updates

Testing

Please describe the test(s) that you added and ran to verify your changes.

Checklist

  • I have read the contribution guide recently

CppInterOpTypes.h's helpers must stay either inline in the header or
implemented in a form that does not require linking libclangCppInterOp
-- Dispatch consumers (cppyy-backend, xeus-cpp) do not link the full
library, they only dlopen it lazily via LoadDispatchAPI. A helper
whose implementation drifts into a .cpp file inside libclangCppInterOp
would silently force those consumers into a DT_NEEDED against the
whole library or a new dispatch-table entry -- the exact class of
hazard we hit with Cpp::ResultAbort_UncheckedOnDtor.

The probe is a tiny executable that includes only CppInterOpTypes.h,
exercises the header's helpers, and deliberately does not link
libclangCppInterOp or any LLVM library. If any future header addition
needs an out-of-line symbol, the link fails with `undefined reference
to <symbol>`. ctest just launches the built binary; the load-bearing
signal is the successful link at build time.

Also renames HandleTypesTest.cpp to CppInterOpTypesTest.cpp so all
tests for types declared in CppInterOpTypes.h share the naming
convention already used for CppInterOpThunksTest (test file named
after the header it covers). Follow-up commits extend the probe body
and CppInterOpTypesTest.cpp coverage as new helpers land.
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.07%. Comparing base (321657d) to head (fd1ac3e).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1075   +/-   ##
=======================================
  Coverage   87.07%   87.07%           
=======================================
  Files          23       23           
  Lines        6073     6073           
=======================================
  Hits         5288     5288           
  Misses        785      785           
🚀 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


#include <cstddef>

// Force ODR-use of every currently-provided CppInterOpTypes.h helper

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: included header cstddef is not used directly [misc-include-cleaner]

Suggested change
// Force ODR-use of every currently-provided CppInterOpTypes.h helper
s.h"
d

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