[cfe-dev] Detecting struct forward references

Manuel Klimek klimek at google.com
Fri Jul 27 08:11:32 PDT 2012


On Fri, Jul 27, 2012 at 2:34 PM, Jacob Carlborg <doob at me.com> wrote:
> Is it possible to detect if a struct declaration is a forward reference?
> For example:
>
> struct Foo;
>
> I'm using libclang. If it's not possible in libclang how would I do it
> using the C++ APIs?

I don't know whether it's possible with libclang, but using the C++
APIs you'd find that this is a declaration, but not a definition
(isThisDeclarationADefinition()). With the AST matchers you'd find
them saying record(unless(isDefinition())).

Cheers,
/Manuel

>
> --
> /Jacob Carlborg
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list