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

Kevin Funk kfunk at kde.org
Fri Apr 10 05:39:56 PDT 2015


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 | http://kfunk.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150410/a3e0946f/attachment.sig>


More information about the cfe-dev mailing list