[cfe-dev] Getting past error: member access into incomplete type

Matthieu Monrocq matthieu.monrocq at gmail.com
Sun Sep 2 03:29:06 PDT 2012

On Sun, Sep 2, 2012 at 8:04 AM, James Dennett <james.dennett at gmail.com>wrote:

> On Sat, Sep 1, 2012 at 6:14 PM, Eric Schulte <eric.schulte at gmx.com> wrote:
> > Hi,
> >
> > I'm working on a small AST-manipulation tool built upon clang [1].  I
> > had an implementation which worked but didn't deal well with included
> > headings.  I've since re-written this using the Tooling interface,
> > however using the example code from [2] I run into the following "member
> > access into incomplete type" error on an ASTContext [3].
> >
> > It looks like I could solve this error by stepping back to previous
> > versions of clang and llvm [4], but I'd prefer to fix this so that it
> > works with the current code and moving forward.  The broken file is at,
> > https://github.com/eschulte/clang-mutate/blob/master/mutate-tool.cpp
> >
> > Any suggestions would be greatly appreciated.
> If I'm reading this correctly, your code just needs to #include the
> definition of the ASTContext class (from
> include/clang/AST/ASTContext.h) in order to refer to a member of
> ASTContext (e.g., "Context.getTranslationUnitDecl()").
> -- James
I agree with James.

There has been refactoring on the headers in the AST and Sema (I think) to
move from direct inclusion to forward declaration which probably broke a
few clients that relied on the inclusions being done for them. Normally if
you would just make the inclusion yourself now, it should work as before.

-- Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20120902/0ae3fb5b/attachment.html>

More information about the cfe-dev mailing list