[cfe-dev] libclang isn't listing all fields of a struct

Jeet Parekh via cfe-dev cfe-dev at lists.llvm.org
Tue Oct 30 19:49:40 PDT 2018

I have been trying to learn about the AST using python bindings of
libclang. But I have not been able to enumerate the fields of a struct
successfully. I don't know if I'm doing it wrong, or if it's a bug.

Here is the code I wrote:

It simply prints the displayname, spelling, and number of fields of a

And I am running it on the imgui.h file from the
https://github.com/ocornut/imgui project.

For a lot of the structs, I get "fields count: 0". I wrote an equivalent
program in C++. And I got the same result. How do I fix it?

I have cloned the clang repo from the provided git mirror. The latest
commit in my clone is:
git commit id: 3b778bc3cec73f904457d70d6f956e1aafe1b550
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345691

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181031/964735ce/attachment.html>

More information about the cfe-dev mailing list