[cfe-dev] 回复: how to know if a function name is used to call or onlya reference ?

kevinlynx kevinlynx at gmail.com
Sat Jan 5 00:52:53 PST 2013


but `the other AST nodes` will lead me to handle too many situations!  If I can get a node's parent node, that will be better. 




------------------ 原始邮件 ------------------
发件人: "Chandler Carruth"<chandlerc at google.com>;
发送时间: 2013年1月5日(星期六) 下午4:49
收件人: "kevinlynx"<kevinlynx at gmail.com>; 
抄送: "cfe-dev"<cfe-dev at cs.uiuc.edu>; 
主题: Re: [cfe-dev] how to know if a function name is used to call or onlya reference ?



Look at the outer expression? You should see the DeclRefExpr inside of a CallExpr or one of the other call AST nodes for actual calls.


 
On Sat, Jan 5, 2013 at 12:26 AM, kevinlynx <kevinlynx at gmail.com> wrote:
 say I have the codes below:

    void func() {}
    void test() {
        func();  // function call
        if (func) {  // only reference the function 
        }
    }

when I get a DeclRefExpr from RecursiveASTVisitor::VisitDeclRefExpr, and I know `func` is a function type, But how can i know it's used as a normal function call, or a reference only ? 
 
Thanks.

_______________________________________________
 cfe-dev mailing list
 cfe-dev at cs.uiuc.edu
 http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130105/9e846d86/attachment.html>


More information about the cfe-dev mailing list