clair icon indicating copy to clipboard operation
clair copied to clipboard

ClaiR does not parse header files for function pointers in arguments

Open pvstralen opened this issue 3 years ago • 8 comments

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|),

pvstralen avatar Apr 08 '22 10:04 pvstralen

Hi Peter,

Thanks for the report, I'll look into it!

rodinaarssen avatar Apr 08 '22 11:04 rodinaarssen

Hi @rodinaarssen ,

Do you already had a change to look at it?

Regards,

Peter

pvstralen avatar May 03 '22 07:05 pvstralen

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 :-)

jurgenvinju avatar Jun 14 '22 09:06 jurgenvinju

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.

rodinaarssen avatar Jun 14 '22 09:06 rodinaarssen

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.

Does this mean that if a declaration is added for all the types it will work?

pvstralen avatar Jun 15 '22 06:06 pvstralen

Hi Peter; Yes that would hide the current issue and it's a reasonable workaround, but we will also fix the bug :-)

jurgenvinju avatar Jun 15 '22 06:06 jurgenvinju

@rodinaarssen let's have a look at this week, since we now are on Java 11 and all the latest dependencies.

jurgenvinju avatar Jul 02 '22 12:07 jurgenvinju

See also #50

jurgenvinju avatar Apr 27 '23 17:04 jurgenvinju