On Thu, May 21, 2009 at 9:45 PM, manivannan_pk
<manivannanp_k@xxxxxxxxxxx> wrote:
Suppose I have an IBinding which is an instance of IVariable. How do I find
which entity declares it ?
IVariable.getOwner() returns the binding containing the variable.
Examples:
- For a local variable or a formal parameter, the declaring parent is an
IASTFunctionDefinition.
- For a global variable, the declaring parent is an IASTTranslationUnit
- For an IField, the declaring parent is an IASTCompositeTypeSpecifier
The most important thing to understand is relationship between IName and IBinding. IName represents a particular occurrence of a symbol. IBinding represents the underlying entity behind the symbol. For example:
class A {
void m(); // m is an IName
};
void A::m() { // m is another IName
}
Both, declaration and definition of method m belong to a single binding. The owner of m is the binding that represents class A.
Thanks,
mani
-sergey
--
View this message in context: http://www.nabble.com/How-to-find-the-declaring-parent-of-an-IVariable---tp23636846p23636846.html
Sent from the Eclipse CDT - Development mailing list archive at Nabble.com.
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev