Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Finding ICPPClassType for this from the AST

Is there a way to find the ICPPClassType of this from the AST in all of the following cases?

class T
{
    void callee();
    void caller()
    {
        this->callee(); // case 1
        callee();       // case 2
        T::callee();    // case 3
    }
};

I have the ICPPASTFunctionCallExpression and I’m trying to get the ICPPClassType of this to implement a Content Assistant and a Codan checker.

For case 1, the name of the function call is an ICPPASTFieldReference, so I can use the result of getFieldOwner to get T.

For cases 2 and 3, if the node is a valid function call then I can use ICPPASTExpression.getEvaluation() to get an EvalMemberAccess and then use the owner type to get T.

However, I want to use this code as part of a Content Assistant and if the complete function call has not yet been entered, then getEvaluation returns a Problem instead of the EvalMemberAccess. For the same reason, I can’t get the IBinding from the index.

-Andrew


Back to the top