[cfe-dev] Access to the field of a structure

Sean Silva chisophugis at gmail.com
Wed Feb 18 15:43:20 PST 2015


You will first want to get the RecordDecl
through TypedefNameDecl::getUnderlyingType and then use the decls_begin/end
iterators for iterating (or the decls() range in a range-for) (note these
methods are inherited from DeclContext).

-- Sean Silva

On Sat, Feb 14, 2015 at 1:15 PM, Alberto Barbaro <barbaro.alberto at gmail.com>
wrote:

> Hi All,
> in my .c file I have a struct like this:
>
> typedef struct var {
>     int x;
>     int y;
> } point;
>
>
> Overriding the VisitTypedefDecl method I can access to the structure using
> a TypedefNameDecl variable. How can I access to the fields of the struct?
>
> Thanks,
> Alberto
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> 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/20150218/b03143db/attachment.html>


More information about the cfe-dev mailing list