cpg
cpg copied to clipboard
Add support for function pointer factories
While trying to make the dummy creation behavior more consistent, I stumbled over the following situation:
void target(int param) {}
void (*getTarget(int))(int) {
return ⌖
}
void main() {
void (*fptr)(int) = getTarget(0);
}
The function pointer resolving process now correctly supports these situations, as previously it would have thought that getTarget is the target of fptr. Anyway, this only works in theory, as the broader issue currently is that we can't find out that getTarget returns something of type void (*)(int) but rather void* is used. Thus, we need to improve the type parser to support the weird syntax of function pointer "factories" as I would name these methods.
Good catch :) A function returning a function pointer is... interesting...