Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CXXTarget does not have _create_target #129

Open
ryanmrichard opened this issue Oct 26, 2023 · 0 comments
Open

CXXTarget does not have _create_target #129

ryanmrichard opened this issue Oct 26, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@ryanmrichard
Copy link
Collaborator

Describe the bug
Classes which derive from CXXTarget are expected to override a virtual function _create_target; however, CXXTarget does not actually declare a virtual _create_target. The code still works as is because CMakePPLang classes behave like Python classes, i.e., method resolution is done at runtime and can see all methods available to the object, including those from the derived classes.

We may want to take a page from C++'s playbook and have developers mark functions intended to override functions in some manner. Perhaps instead of:

cpp_member(_create_target CXXExecutable)
function("${_create_target}" self)
# implementation
endfunction()

it becomes:

cpp_override(_create_target CXXExecutable)
function("${_create_target}" self)
# implementation
endfunction()

where cpp_override wraps cpp_member, but additionally checks that one of the base classes declares a virtual function with the same signature (may need some type gymnastics for the self object).

To Reproduce
Look at the CXXTarget class's source code

Expected behavior
CXXTarget should declare the virtual function.

Additional context
N/A

@ryanmrichard ryanmrichard added the bug Something isn't working label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant