-
Notifications
You must be signed in to change notification settings - Fork 742
Do not print builtin macro definitions in ast_dump #566
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
Conversation
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Two minor nits.
src/clang.rs
Outdated
/// Returns whether the cursor refers to a built-in definition. | ||
pub fn is_builtin(&self) -> bool { | ||
let (file, _, _, _) = self.location().location(); | ||
!file.name().is_some() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: file.name().is_none()
instead.
src/lib.rs
Outdated
None => ctx.options().builtins, | ||
Some(..) => true, | ||
} | ||
!cursor.is_builtin() || ctx.options().builtins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'd reverse the order here since the second is way less expensive to check.
@emilio thanks for the feedback. Latest commit should address those two points. |
@bors-servo r=emilio,fitzgen Thanks @tsliang ! |
📌 Commit b826a80 has been approved by |
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.
☀️ Test successful - status-travis |
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.