[cfe-dev] Finding a particular constructor

Gabor Kozar kozargabor at gmail.com
Mon Oct 14 08:53:03 PDT 2013


Woops, sorry, for some reason I missed that there already have been
plenty of answers.



--
Gábor Kozár -- ShdNx
kozargabor at gmail.com





On Mon, Oct 14, 2013, at 13:43, Gabor Kozar wrote:

The way I'd go would be to first locate the CXXConstructorDecl that is
being called, look through its parameter list, get the index of the
parameter named "x", and then find the expression on that index in the
argument list.



So as far as I know there is no more direct way of doing this.



--
Gábor Kozár -- ShdNx
kozargabor at gmail.com





On Wed, Oct 9, 2013, at 11:42, Jesper Eskilson wrote:

Hi,



I have a class with a large number of constructors which differ only

slightly. I'd like to be able to distinguish these by looking at the

names of the arguments, but I cannot seem to find them.



class A {

public:

      A(int x);

      A(int x, float y);

      A(double w, int x, char *z);

      ...

}



I'd like to be able to (for example) look at a particular

CXXConstructExpr and get the value of "x", whichever position "x" may

have.



Where should I be looking?



--

*Jesper Eskilson* /Development Engineer/

IAR Systems AB

Box 23051, Strandbodgatan 1

SE-750 23 Uppsala, SWEDEN

E-mail: [1]jesper.eskilson at iar.com <[2]mailto:jesper.eskilson at iar.com>

Website: www.iar.com

<[3]http://www.iar.com> Twitter: www.twitter.com/iarsystems

<[4]http://www.twitter.com/iarsystems>



_______________________________________________

cfe-dev mailing list

[5]cfe-dev at cs.uiuc.edu

[6]http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________

cfe-dev mailing list

[7]cfe-dev at cs.uiuc.edu

[8]http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

References

1. mailto:jesper.eskilson at iar.com
2. mailto:jesper.eskilson at iar.com
3. http://www.iar.com/
4. http://www.twitter.com/iarsystems
5. mailto:cfe-dev at cs.uiuc.edu
6. http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
7. mailto:cfe-dev at cs.uiuc.edu
8. 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/20131014/933c7138/attachment.html>


More information about the cfe-dev mailing list