Open attila-lendvai opened 1 year ago
https://clang.llvm.org/docs/IntroductionToTheClangAST.html#examining-the-ast
apparently there's clang -ast-dump=json
, but i haven't tried it.
and there's a Rust project that uses it:
https://github.com/dtolnay/clang-ast
maybe it entirely subersedes c2ffi?
@rpav, any word on this?
I'll have to look at it again but I recall it not producing anything particularly easy to work with... I'll have to check the JSON output.
Note there's more than simple AST that's very commonly useful... notably constant evaluation/values and the #define hack c2ffi does, which can pull useful values from things like #define SOME_SIZE sizeof(Foo)+1
or the like.
If clang-ast does this it might be pretty ideal, but I haven't checked in awhile.
apparently there's something called clang ast-dump, that can dump the AST in json format (as mentioned at https://github.com/libsdl-org/SDL/issues/6337#issuecomment-1278569855).
it would be nice if the readme clarified how c2ffi relates to clang ast-dump, and what justifies the creation of a custom tool.