class aclass{
public:
int num;
};
int main()
{
aclass *ok;
ok->num = 4;
return 0;
}
now when I do clang_getCursorDefinition(cur_cursor); on the cursor right at the beginning of the o at ok->num = 4; it gives the cursor for int num; inside aclass. I want it to give me the cursor for the aclass *ok; declaration inside main. Calling clang_getCursorSemanticParent(cur_cursor) seems wrong as if I put the declaration inside or outside the main() func it still returns main() as the semantic parent.
Is there a way to efficiently do this, without iterating every single possible cursor?
EDIT: Clang counts tabs as 1 character which is correct. The editor I was testing with was automatically counting tabs as size 4, so what clang expected as column 2, my editor was sending as column 5. Now the getCursorDefinition is working as expected, and is taking me to the scoped definition.