-
Notifications
You must be signed in to change notification settings - Fork 743
Don't print out builtin macro definitions with --emit-clang-ast #476
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
Comments
Please make a comment here if you intend to work on this issue. Thank you! |
@fitzgen I'd be happy to take a look. I'll check out |
Awesome! Let us know if you need any help! |
@tsliang Have you made any progress with this? |
@jdm unfortunately not - I've been extremely sick for the last two weeks. I'm going to work on it this weekend. |
I'm implementing the skip inside the |
Hi @tsliang! First of all, hope you're better now :) See the Thanks for working on this! :) |
@emilio thanks for the kind words! I am indeed feeling better :) Thanks for the tip about |
Glad to hear that! :)
The context parameter is not important to determine whether it's builtin, that is only used to determine whether to generate builtins, so you can remove that argument, and handle it in the caller. That way, the current: if !filter_builtins(ctx, cursor) {
return Continue;
} would become something like: if ctx.options().builtins && cursor.is_builtin() {
return Continue;
} Where Thanks again for taking this! |
@emilio thanks for the guidance! I've written something and I'll make a PR later today :) |
Resolves issue rust-lang#476. Moves out logic for checking whether a cursor has a filename (previously used exclusively in private function lib::filter_builtins) into the actual cursor. This code is then used to check whether a cursor is a builtin when dumping the AST.
Resolves issue rust-lang#476. Moves out logic for checking whether a cursor has a filename (previously used exclusively in private function lib::filter_builtins) into the actual cursor. This code is then used to check whether a cursor is a builtin when dumping the AST.
ok, one more question: I've done my code changes, and I ran |
The If you check out the latest master and run It might also help to open a PR so we can comment on the code. |
On Tue, Mar 07, 2017 at 12:40:42PM -0800, Tai Sassen-Liang wrote:
ok, one more question: I've done my code changes, and I ran `cargo
test` in the root directory (unlike the last patch I wrote, no
`libbindgen` directory appeared when I built the code). The first time
I ran the tests I got 4 failures, but 4 files were changed during the
test run (diff attached). After running `cargo test` again, there are
no failures. Is this expected behavior? Should I commit the changed
files?
This happens because you have libclang 3.8 instead of 3.9. You can skip
the tests that have differences with --features llvm_stable (though
maybe it was renamed not long ago?). You can check what travis is doing
looking at .travis.yml.
In any case, those changes shouldn't be in the final PR.
Thanks again! :)
|
Resolves issue rust-lang#476. Moves out logic for checking whether a cursor has a filename (previously used exclusively in private function lib::filter_builtins) into the actual cursor. This code is then used to check whether a cursor is a builtin when dumping the AST.
Resolves issue rust-lang#476. Moves out logic for checking whether a cursor has a filename (previously used exclusively in private function lib::filter_builtins) into the actual cursor. This code is then used to check whether a cursor is a builtin when dumping the AST.
PR made! @fitzgen The libbindgen folder was just what I remember from the last patch I wrote, which was months ago. Btw, what's the best way to keep up to date with changes like this? I feel bad for bugging you guys with silly questions like this. Thanks a lot for the help and patience, @fitzgen @emilio and @jdm |
It is not "bugging" us (or at least me) at all :-P The only way to know is to follow the changes happening, read the emails generated by PRs and comments and everything, which can be a bit much at times. Really it's no big deal to ask a quick question. That's what we're all here for :) |
You're too kind. If you ever come to Amsterdam I'll bring you appreciation snacks :) |
Do not print builtin macro definitions in ast_dump Resolves issue #476. Moves out logic for checking whether a cursor has a filename (previously used exclusively in private function lib::filter_builtins) into the actual cursor. This code is then used to check whether a cursor is a builtin when dumping the AST.
This was fixed by #566. |
There are a lot of builtin macros that clutter up our AST dump output, and we never actually care about them.
We should skip printing them in
clang::ast_dump
.Basically, if
cursor.kind() == CXCursor_MacroDefinition && cursor.location() == "builtin definition"
, then we should skip dumping this cursor's AST.Happy to mentor whoever picks this up, and clarify further!
The text was updated successfully, but these errors were encountered: