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

refactor some attribute functions in rust-ast-lower-base.cc and rust-toplevel-name-resolver.cc #3345

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saeitoshi-10
Copy link

gcc/rust/changelog:
* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_macro_definition): "modified fn"
* resolve/rust-toplevel-name-resolver-2.0.cc (is_macro_export): "rm check fn"
(TopLevel::visit): "modified fn"
* util/rust-attributes.cc (Attributes::is_macro_export): "added checker fn"
* util/rust-attributes.h: "added"

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.

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.

	* hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_macro_definition): "modified fn"
	* resolve/rust-toplevel-name-resolver-2.0.cc (is_macro_export): "rm check fn"
	(TopLevel::visit): "modified fn"
	* util/rust-attributes.cc (Attributes::is_macro_export): "added checker fn"
	* util/rust-attributes.h: "added"

Signed-off-by: Om Swaroop Nayak <[email protected]>
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs some cleanup

for (const auto &attr : def.get_outer_attrs ())
if (attr.get_path ().as_string () == Values::Attributes::MACRO_EXPORT)
return true;
// static bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to remove this comment since you have moved the function over to another file

if (is_export)


if (Analysis::Attributes::is_macro_export(def.get_outer_attrs()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like bad formating here you need space before the opening braces for the arguments

for (auto &attr : outer_attrs)
{
if (attr.get_path ().as_string() == Values::Attributes::MACRO_EXPORT)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can get rid of this braces here in the if statement

@@ -37,6 +37,18 @@ Attributes::is_known (const std::string &attribute_path)

return !lookup.is_error ();
}
bool
Attributes::is_macro_export (AST::AttrVec outer_attrs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing const reference here

bool
Attributes::is_macro_export (AST::AttrVec outer_attrs)
{
for (auto &attr : outer_attrs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In progress
Development

Successfully merging this pull request may close these issues.

2 participants