Add self-containment link probe for CppInterOpTypes.h. - #1075
Open
vgvassilev wants to merge 1 commit into
Open
Conversation
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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:
|
|
|
||
| #include <cstddef> | ||
|
|
||
| // Force ODR-use of every currently-provided CppInterOpTypes.h helper |
Contributor
There was a problem hiding this comment.
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
Testing
Please describe the test(s) that you added and ran to verify your changes.
Checklist