ClaiR does not parse header files for function pointers in arguments
I am parsing a header file using Rascal ClaiR:
iFile = toLocation("file://D:/test.h");
ast = parseCpp(iFile);
iprint(ast);
The header file test.h looks as follows:
#ifndef TEST_H
#define TEST_H
/* Generic function */
result_t API get_data(query_h query, char **string, result_t *res);
result_t API set_data(node_h node, const char *string);
result_t API update_data(node_h node, char ***names, uint32_t *count);
#endif
As an outcome I get multiple errors like this:
decl=|cpp+parameter:///update_data(org.eclipse.cdt.internal.core.dom.parser.ProblemType@53e470da,char...,%3F.)/count|),
Hi Peter,
Thanks for the report, I'll look into it!
Hi @rodinaarssen ,
Do you already had a change to look at it?
Regards,
Peter
The fix seems clear, but we are stuck between Java 8 and Java 11 compatible releases of Rascal. Current progress is made by porting Clair to Java 11 and the latest Eclipse releases and adding GitHub actions for running the tests. After that we can fix this issue and test it, and then perhaps backport it to the older releases. So a small bug, with a lot of collatoral damage :-)
In short: function pointers are not the issue here. In fact, the ProblemTypes are expected. After all, declarations for result_t, API, node_h and uint32_t are missing. However, the toString of the ProblemType class should definitely not end up in the decl.
In short: function pointers are not the issue here. In fact, the
ProblemTypes are expected. After all, declarations forresult_t,API,node_handuint32_tare missing. However, thetoStringof theProblemTypeclass should definitely not end up in thedecl.
Does this mean that if a declaration is added for all the types it will work?
Hi Peter; Yes that would hide the current issue and it's a reasonable workaround, but we will also fix the bug :-)
@rodinaarssen let's have a look at this week, since we now are on Java 11 and all the latest dependencies.
See also #50