<div dir="ltr">Hi,<div>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:</div>
<div><div style="font-family:arial,sans-serif;font-size:13px">(CallExpr 0x484fd00 <col:12, col:28> 'char *'</div><div style="font-family:arial,sans-serif;font-size:13px"> (ImplicitCastExpr 0x484fce8 <col:12> 'char *(*)(char *)' <FunctionToPointerDecay></div>
<div style="font-family:arial,sans-serif;font-size:13px"> (DeclRefExpr 0x484fc68 <col:12> 'char *(char *)' Function 0x484f100 'copy_buffer' 'char *(char *)'))</div><div style="font-family:arial,sans-serif;font-size:13px">
(ImplicitCastExpr 0x484fd30 <col:24> 'char *' <ArrayToPointerDecay></div><div style="font-family:arial,sans-serif;font-size:13px"> (DeclRefExpr 0x484fc90 <col:24> 'char [100]' lvalue Var 0x484f960 'buf1' 'char [100]')))"))</div>
</div><div style="font-family:arial,sans-serif;font-size:13px">You can use that to acquire the function call argument.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
Hope it helps,</div><div style="font-family:arial,sans-serif;font-size:13px">Vladimir</div>
<div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, May 24, 2013 at 9:09 AM, yjninja <span dir="ltr"><<a href="mailto:mailme.yjoshi@rediffmail.com" target="_blank">mailme.yjoshi@rediffmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,I have a got declrefexpr of the form 'change_value(x)', where I find<br>
the references to 'x'I am writing a tool to change 'x' to 'y'.But, I am not<br>
able to find a way to identify 'x' field in the DeclRefExpr, which only<br>
shows 'change_value' when I print the characters within the sourcerange of<br>
the DeclRefexpr.Can anyone help me with this asap ? I only need the 'x'<br>
portion of 'change_value(x)'.Much Appreciated,..Yogi.<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://clang-developers.42468.n3.nabble.com/DeclRefExpr-function-call-arguments-tp4032294.html" target="_blank">http://clang-developers.42468.n3.nabble.com/DeclRefExpr-function-call-arguments-tp4032294.html</a><br>
Sent from the Clang Developers mailing list archive at Nabble.com.<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>