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

Add support variadic templates #81

Open
ashleyj opened this issue Feb 28, 2016 · 4 comments
Open

Add support variadic templates #81

ashleyj opened this issue Feb 28, 2016 · 4 comments

Comments

@ashleyj
Copy link
Contributor

ashleyj commented Feb 28, 2016

Add support for variadic templates

eg.

template <typename... Arguments> returntype functionname(Arguments... args);

or

template<typename ...Arguments> class classname;

Currently this throws an NPE:

Caused by: java.lang.NullPointerException
    at org.bytedeco.javacpp.tools.Parser.parameters(Parser.java:1366)
    at org.bytedeco.javacpp.tools.Parser.declarator(Parser.java:845)
    at org.bytedeco.javacpp.tools.Parser.function(Parser.java:1457)
    at org.bytedeco.javacpp.tools.Parser.declarations(Parser.java:2639)
    at org.bytedeco.javacpp.tools.Parser.group(Parser.java:2214)
    at org.bytedeco.javacpp.tools.Parser.declarations(Parser.java:2638)
    at org.bytedeco.javacpp.tools.Parser.namespace(Parser.java:2544)
    at org.bytedeco.javacpp.tools.Parser.declarations(Parser.java:2637)
    at org.bytedeco.javacpp.tools.Parser.parse(Parser.java:2713)
    at org.bytedeco.javacpp.tools.Parser.parse(Parser.java:2806)
    at org.bytedeco.javacpp.tools.Builder.parse(Builder.java:69)
    at org.bytedeco.javacpp.tools.Builder.build(Builder.java:625)
    at org.bytedeco.javacpp.tools.BuildMojo.execute(BuildMojo.java:226)```
@saudet
Copy link
Member

saudet commented Mar 1, 2016

That's quite a complicated feature, but fortunately it doesn't look like even LLVM makes heavy use of it. Implementing something that assumes that only the last argument can be variadic should be good enough?

@ashleyj
Copy link
Contributor Author

ashleyj commented Mar 1, 2016

I feel like I've created a lot of work for you over the last two weeks. I apologise, but appreciate the work you've done :)

I think that will work -- only having the last argument as variadic...

@saudet
Copy link
Member

saudet commented Mar 1, 2016

No problem, the other things didn't take long to fix. This might take a bit more time though... Anyway, I'm glad to have someone looking at the C++ API of LLVM :) Thank you for that!

@saudet
Copy link
Member

saudet commented Apr 17, 2016

It just clicked today, but I figured we might not really need to support variadic templates for the current parser. The next big thing I'd like to try is to use Clang as parser and see how far we can go with this, see #51. To get there though, we first need access to the C++ API of Clang, so I've fixed the crash you found in the current parser. It's basically ignoring the templates, but it's also ignoring normal variadic functions, so nothing new here. Anyway, please let me know if you encounter any more crashes or problems with LLVM. We might not need the whole API for the portion of it that could be useful as a better parser for JavaCPP. :)

And thanks for having reported the issues you found up until now!

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

No branches or pull requests

2 participants