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

ClassTemplateSpecialization missing Parameters property #1801

Closed
deadlocklogic opened this issue Nov 29, 2023 · 6 comments · Fixed by #1809
Closed

ClassTemplateSpecialization missing Parameters property #1801

deadlocklogic opened this issue Nov 29, 2023 · 6 comments · Fixed by #1809

Comments

@deadlocklogic
Copy link
Contributor

Consider:

template<typename T1, typename T2>
struct Test {
};
template<typename T1>
struct Test<T1, int> {
};

Now How to enumerate the template Parameters of the ClassTemplateSpecialization Test<T1, int>? (Should be T1).
This is particularly needed for class template partial specialization as function templates can't be partially specialized.

@deadlocklogic
Copy link
Contributor Author

deadlocklogic commented Nov 29, 2023

I can create a PR showing a possible hierarchy, improving on the current implementation.

Question:

does the current implemented generators try to bind templates? If not the migration could be easy as no substantial part in the library will be affected. In my observation, I found that the template usage is minimal which is expected after all.
I can see that the implementation is based on this: ClassTemplateSpecializationDecl. but still not sure how to get the template parameters.

I found in clang docs:

CppSharp is only using getTemplateArgs.

@tritao
Copy link
Collaborator

tritao commented Dec 12, 2023

I am not so sure about these, guess the only way to know is to make some tests around what Clang returns.

@deadlocklogic
Copy link
Contributor Author

Now we have native debugging on Windows, I can tinker around and see how to achieve this.

@deadlocklogic
Copy link
Contributor Author

deadlocklogic commented Dec 16, 2023

Ok so basically these are missing: ClassTemplatePartialSpecializationDecl
TemplateParameterList* clang::ClassTemplatePartialSpecializationDecl::getTemplateParameters() const
This is why I asked you about why not binding the clang API directly, there are lot of missing metadata which are vital for binding generation. I will try patching myself and see what I can do.

@deadlocklogic
Copy link
Contributor Author

@tritao I did modify Decl.h and AST.cpp and rebuild the project but bindings aren't getting generated.
What am I missing?

@tritao
Copy link
Collaborator

tritao commented Dec 16, 2023

You have to run the Parser.Gen project to re-generate the parser bindings.

You will also need to extract this archive in the build folder IIRC: https://github.com/mono/CppSharp/releases/download/CppSharp/headers.zip

That will allow cross-generation of parser bindings for all our supported targets.

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 a pull request may close this issue.

2 participants