-
Notifications
You must be signed in to change notification settings - Fork 163
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
refactor some attribute functions in rust-hir-map.cc and rust-early-name-resolver.cc #3344
base: master
Are you sure you want to change the base?
Conversation
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): "modified impl" * util/rust-attributes.cc (Attributes::is_rustc_builtin_macro): "helper function" * util/rust-attributes.h: "added" * util/rust-hir-map.cc (Mappings::insert_macro_def): "modified impl" Signed-off-by: Om Swaroop Nayak <96killerat96@gmail.com>
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.
some cleanup needed
for (auto attr : outer_attrs) | ||
{ | ||
if (attr.get_path () == Values::Attributes::RUSTC_BUILTIN_MACRO) | ||
{ |
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.
You can just do return true here no need for the extra braces
bool | ||
Attributes::is_rustc_builtin_macro (AST::AttrVec outer_attrs) | ||
{ | ||
for (auto attr : outer_attrs) |
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.
you should probably do const auto attr
@@ -37,6 +37,18 @@ Attributes::is_known (const std::string &attribute_path) | |||
|
|||
return !lookup.is_error (); | |||
} | |||
bool | |||
Attributes::is_rustc_builtin_macro (AST::AttrVec outer_attrs) |
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.
You should be using const AST::AttrVec& outer_attrs since this can be constified
gcc/rust/ChangeLog:
* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): "modified impl"
* util/rust-attributes.cc (Attributes::is_rustc_builtin_macro): "helper function"
* util/rust-attributes.h: "added"
* util/rust-hir-map.cc (Mappings::insert_macro_def): "modified impl"
Thank you for making Rust GCC better!
If your PR fixes an issue, you can add "Fixes #issue_number" into this
PR description and the git commit message. This way the issue will be
automatically closed when your PR is merged. If your change addresses
an issue but does not fully fix it please mark it as "Addresses #issue_number"
in the git commit message.
Here is a checklist to help you with your PR.
make check-rust
passes locallyclang-format
gcc/testsuite/rust/
Note that you can skip the above if you are just opening a WIP PR in
order to get feedback.
Addresses #3291
*Please write a comment explaining your change. This is the message
that will be part of the merge commit.