looking for a C++ header file parser

I am looking for some package that can parse C++ header files (hopefully recursively), and return a structure that holds all the available name information, classes, structs, namespaces, global variables, types, macros, functions, ect…

Is there a way to use Clang to do this?

Thanks!

I am looking for some package that can parse C++ header files (hopefully
recursively), and return a structure that holds all the available name
information, classes, structs, namespaces, global variables, types,
macros, functions, ect...

Is there a way to use Clang to do this?

Yes. LibTooling — Clang 15.0.0git documentation

You can get the Clang to do this, yes.

Depending on exactly what you need to do with the data, you may be fine to just (automatically?) produce a file that includes the base-header-file, and then pass that to clang -Xclang -ast-dump -fsyntax-only yourfile-here.c, and capture that output (perhaps with -fno-color-diagnostics to make it more machine readable) - along with some post-processing (e.g. some shell script or python code to parse that).

Otherwise, you will need to use clang and it’s tool helpers as a library and build a small C++ program that invokes clang and retrieves the AST as a data-structure, and then work on that (again, depends on exactly what you want to achieve).

You can get the Clang to do this, yes.

Depending on exactly what you need to do with the data, you may be fine to just (automatically?) produce a file that includes the base-header-file, and then pass that to clang -Xclang -ast-dump -fsyntax-only yourfile-here.c, and capture that output (perhaps with -fno-color-diagnostics to make it more machine readable) - along with some post-processing (e.g. some shell script or python code to parse that).

Note that -ast-dump is not meant to be used for anything but fancy output, and does not contain all information of the AST.