Reputation: 75
Is there a way to uniquely identify function definition nodes in CDT AST?
void g() { ... }
void f() {
g();
}
I need to store the function definition nodes for f
and g
in some structure and then, when I come to the function call node for g
, I need to check if that node corresponds to the function definition node for g
.
Right now I'm doing that by storing function's name. The problem is that I cannot correctly handle the following case:
void f() {}
class F {
void f() {}
};
Upvotes: 2
Views: 99
Reputation: 52779
I would suggest the following:
IASTName.resolveBinding()
ICPPFunction
, which extends ICPPBinding
. (I'm assuming this is C++ code as you mention a class
.)ICPPBinding.getQualifiedName()
as the unique identifier for the function. In your example, the two functions would have different qualified names, f
vs. F::f
.Upvotes: 2