[cfe-dev] DeclRefExpr - function call arguments

Vladimir Oster vladimir.oster at gmail.com
Thu May 30 03:20:06 PDT 2013


Hi,
I'm fairly new in this so I might be mistaken, but looking at the AST of a
sample code I wrote, I can see that the DeclRefExpr that represents the
function, is a child of a CallExpr. The other child of that same CallExpr
is a DeclRefExpr that represents the function call argument:
(CallExpr 0x484fd00 <col:12, col:28> 'char *'
        (ImplicitCastExpr 0x484fce8 <col:12> 'char *(*)(char *)'
<FunctionToPointerDecay>
          (DeclRefExpr 0x484fc68 <col:12> 'char *(char *)' Function
0x484f100 'copy_buffer' 'char *(char *)'))
        (ImplicitCastExpr 0x484fd30 <col:24> 'char *' <ArrayToPointerDecay>
          (DeclRefExpr 0x484fc90 <col:24> 'char [100]' lvalue Var 0x484f960
'buf1' 'char [100]')))"))
You can use that to acquire the function call argument.

Hope it helps,
Vladimir



On Fri, May 24, 2013 at 9:09 AM, yjninja <mailme.yjoshi at rediffmail.com>wrote:

> Hi All,I have a got declrefexpr of the form 'change_value(x)', where I find
> the references to 'x'I am writing a tool to change 'x' to 'y'.But, I am not
> able to find a way to identify 'x' field in the DeclRefExpr, which only
> shows 'change_value' when I print the characters within the sourcerange of
> the DeclRefexpr.Can anyone help me with this asap ? I only need the 'x'
> portion of 'change_value(x)'.Much Appreciated,..Yogi.
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/DeclRefExpr-function-call-arguments-tp4032294.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> 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/20130530/3aa6ad5d/attachment.html>


More information about the cfe-dev mailing list