[cfe-dev] Inherited members/functions in CXXRecordDecl

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Tue Nov 15 07:30:01 PST 2016


I would expect you'd have to look at the base class, yes - the AST is, at
least somewhat, a syntax tree, representing the code as written.

On Tue, Nov 15, 2016 at 2:41 AM David Come via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hello,
>
>
> I'm using clang and libtooling 3.9 to parse some C++ code.
>
> With the following snippet :
>
> struct A0  {
>    char* p;
>    void Z();
> };
> struct A : A0{
>    const int i;
>    volatile double g;
> protected:
>    void f(){};
> };
>
> When iterating over fields and methods on A's CXXRecordDecl in my visitor,
>
> I only get fields i and g ; and method f. I completely miss p and Z.
>
>
> Is this normal ? How can I get them when looking at A's CXXRecordDecl ?
> Do I have to iterate over A base classes and add A0's public/protected
> members ?
>
>
> Thanks.
>
> David Come
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161115/eb4ec533/attachment.html>


More information about the cfe-dev mailing list