Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] how do I know where a call will link?

If I'm at a IASTFunctionCallExpression in an ASTVisitor, how do I determine the function it will be linked to?
//-----
file:main.c // the file being ASTvisited
#include "a.h"
#include "b.h"
void main() {
    foo();    // IASTFunctionCallExpression, (that should be linked to foo() in a.c)
}
//-----
file:a.c
void foo() { // link here...
}
//-----
file:b.c
static void foo() { // do not link here... as it is static (which means invisible..)
}
//-----
The natural way would of course be to check all included files (in the c file being visited) and their counterpart .c file for a matching function. But I suspect that CDT already have the information available somewhere near the IASTFunctionCallExpression? can I somehow use the IASTName below a IASTFunctionCallExpression name.resolveBinding(); name.getBinding(); or the getScope() ? .. or how do I know where the call will link?

/Jimmie

Back to the top