<div dir="ltr">On Fri, Oct 11, 2013 at 5:37 AM, Jesper Eskilson <span dir="ltr"><<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">On 10/10/2013 11:38 PM, Richard Trieu wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Call getConstructor() on your CXXConstructExpr to get the<br>
CXXConstructorDecl that matches your function. Then iterate over the<br>
parameters till you find the one called "x". Get the index of the<br>
parameter and use getArg(index) on CXXConstructExpr to get the argument<br>
corresponding to "x".<br>
</blockquote>
<br></div>
How do I get the name of the parameter? I tried doing<br>
<br>
for (auto it = ctorExpr->getConstructor()-><u></u>param_begin();<br>
it != ctorExpr->getConstructor()-><u></u>param_end(); ++it)<br>
{<br>
cerr << (*it)->getDeclName().<u></u>getNameAsString() << endl;<br>
}<br>
<br>
but all I get are empty strings.<br></blockquote><div><br></div><div>That code doesn't compile for me. getDeclName() returns a DeclarationName which doesn't have a getNameAsString() function. I think either:</div>
<div><br></div><div>(*it)->getDeclName().<u></u>getAsString()<br></div><div><br></div><div>or:</div><div><br></div><div>(*it)->getNameAsString()<br></div><div><br></div><div>should work better.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="im">
<br>
On Wed, Oct 9, 2013 at 2:42 AM, Jesper Eskilson <<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.com</a><br></div><div class="im">
<mailto:<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.<u></u>com</a>>> wrote:<br>
<br>
Hi,<br>
<br>
I have a class with a large number of constructors which differ only<br>
slightly. I'd like to be able to distinguish these by looking at the<br>
names of the arguments, but I cannot seem to find them.<br>
<br>
class A {<br>
public:<br>
A(int x);<br>
A(int x, float y);<br>
A(double w, int x, char *z);<br>
...<br>
}<br>
<br>
I'd like to be able to (for example) look at a particular<br>
CXXConstructExpr and get the value of "x", whichever position "x"<br>
may have.<br>
<br>
Where should I be looking?<br>
<br>
--<br>
*Jesper Eskilson* /Development Engineer/<br>
IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br>
E-mail: <a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.com</a> <mailto:<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.<u></u>com</a>><br></div>
<mailto:<a href="mailto:jesper.eskilson@iar." target="_blank">jesper.eskilson@iar.</a>__<u></u>com <mailto:<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.<u></u>com</a>>><div class="im">
<br>
Website: <a href="http://www.iar.com" target="_blank">www.iar.com</a> <<a href="http://www.iar.com" target="_blank">http://www.iar.com</a>><br>
<<a href="http://www.iar.com" target="_blank">http://www.iar.com</a>> Twitter: <a href="http://www.twitter.com/iarsystems" target="_blank">www.twitter.com/iarsystems</a><br>
<<a href="http://www.twitter.com/iarsystems" target="_blank">http://www.twitter.com/<u></u>iarsystems</a>><br></div>
<<a href="http://www.twitter.com/__iarsystems" target="_blank">http://www.twitter.com/__<u></u>iarsystems</a><br>
<<a href="http://www.twitter.com/iarsystems" target="_blank">http://www.twitter.com/<u></u>iarsystems</a>>><br>
<br>
______________________________<u></u>___________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a> <mailto:<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">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/__<u></u>mailman/listinfo/cfe-dev</a><br>
<<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/cfe-dev</a>><br>
<br>
<br>
</blockquote><div class=""><div class="h5">
<br>
<br>
-- <br>
*Jesper Eskilson* /Development Engineer/<br>
IAR Systems AB<br>
Box 23051, Strandbodgatan 1<br>
SE-750 23 Uppsala, SWEDEN<br>
E-mail: <a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.com</a> <mailto:<a href="mailto:jesper.eskilson@iar.com" target="_blank">jesper.eskilson@iar.<u></u>com</a>><br>
Website: <a href="http://www.iar.com" target="_blank">www.iar.com</a><br>
<<a href="http://www.iar.com" target="_blank">http://www.iar.com</a>> Twitter: <a href="http://www.twitter.com/iarsystems" target="_blank">www.twitter.com/iarsystems</a><br>
<<a href="http://www.twitter.com/iarsystems" target="_blank">http://www.twitter.com/<u></u>iarsystems</a>><br>
</div></div></blockquote></div><br></div></div>