Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: please clarify how it relates to clang ast-dump #112

Open
attila-lendvai opened this issue Dec 24, 2022 · 2 comments
Open

doc: please clarify how it relates to clang ast-dump #112

attila-lendvai opened this issue Dec 24, 2022 · 2 comments

Comments

@attila-lendvai
Copy link
Contributor

attila-lendvai commented Dec 24, 2022

apparently there's something called clang ast-dump, that can dump the AST in json format (as mentioned at libsdl-org/SDL#6337 (comment)).

it would be nice if the readme clarified how c2ffi relates to clang ast-dump, and what justifies the creation of a custom tool.

@attila-lendvai
Copy link
Contributor Author

attila-lendvai commented Feb 27, 2024

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?

@rpav
Copy link
Owner

rpav commented Feb 27, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants