[cfe-dev] Question about finding underlying type for auto vardecls using public C api

Anders Bakken agbakken at gmail.com
Fri Apr 10 23:23:34 PDT 2015


Thanks for the link.

On Friday, April 10, 2015, Kevin Funk <kfunk at kde.org> wrote:

> On Wednesday, April 08, 2015 14:37:35 Anders Bakken wrote:
> > Is there an example showing how to do this? I've tried to piece something
> > together to do it but it doesn't work correctly and is a terrible hack.
> >
> > E.g.
> >
> > struct A
> > {
> > };
> > A getA() { return A(); }
> > int foo()
> > {
> >      A a;
> >      auto b = a;
> >      auto c = getA();
> >      auto d = A();
> >      auto *e = new A();
> > }
> >
> > I would like to make a function that could return the CXCursor for A for
> > all of these vardecls (b, c, d and e).
>
> I've asked about this a while ago and it has been discussed in lengths but
> without solution yet -- At some point Clang reported the deduced type, but
> stopped doing so in later versions.
>
> See full discussion here:
>   http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-January/034845.html
>
> Disclaimer: I'd really like to see this being fixed as well.
>
> Greets
>
> > The code I have is here:
> >
> > https://github.com/Andersbakken/rtags/blob/master/src/RTagsClang.cpp
>
> > Starting at line 232 (resolveAutoTypeRef).
> >
> > best regards and thanks for a wonderful library.
> >
> > Anders
>
> --
> Kevin Funk | kfunk at kde.org <javascript:;> | http://kfunk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150410/cb1f3fe0/attachment.html>


More information about the cfe-dev mailing list