-
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 all attribute functions in rust-privacy-reporter.cc #3339
base: master
Are you sure you want to change the base?
Conversation
* checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute):"Removed checker function" (proc_macro_privacy_check): "modified checker implementation" * util/rust-attributes.cc (is_proc_macro_type): "modifed fn into Attributes class" (Attributes::is_proc_macro_type): "modifed fn" (check_proc_macro_non_function): "modified checker implementation" (check_proc_macro_non_root): "modified checker implementation" * util/rust-attributes.h: "included definition" Signed-off-by: Om Swaroop Nayak <96killerat96@gmail.com>
You need to fix your commit format before this can be merged |
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.
needs some changes
// attribute in a vector of attribute | ||
for (const auto &attr : item->get_outer_attrs ()) | ||
{ | ||
if (Analysis::Attributes::is_proc_macro_type (attr) != tl::nullopt) |
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.
this seems odd i think you should be storing the result here in a variable instead of calling it twice like this
// Emit an error when one encountered attribute is either #[proc_macro], | ||
// #[proc_macro_attribute] or #[proc_macro_derive] | ||
static void | ||
check_proc_macro_non_function (const AST::AttrVec &attributes) | ||
{ | ||
for (auto &attr : attributes) | ||
{ | ||
if (is_proc_macro_type (attr)) | ||
if (Attributes::is_proc_macro_type (attr) != tl::nullopt) |
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.
can this not just be if (Attributes::is_proc_macro_type (attr)) ?
@@ -258,7 +261,7 @@ check_proc_macro_non_root (AST::AttrVec attributes, location_t loc) | |||
{ | |||
for (auto &attr : attributes) | |||
{ | |||
if (is_proc_macro_type (attr)) | |||
if (Attributes::is_proc_macro_type (attr) != tl::nullopt) |
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.
same here
gcc/rust/ChangeLog:
* checks/errors/privacy/rust-privacy-reporter.cc (find_proc_macro_attribute):"Removed checker function" (proc_macro_privacy_check): "modified checker implementation"
* util/rust-attributes.cc (is_proc_macro_type): "modifed fn into Attributes class" (Attributes::is_proc_macro_type): "modifed fn" (check_proc_macro_non_function): "modified checker implementation" (check_proc_macro_non_root): "modified checker implementation"
* util/rust-attributes.h: "included definition"
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.