Skip to content

Commit

Permalink
Change the attribute checker visitor to default one
Browse files Browse the repository at this point in the history
Make the attribute checker visitor inherit from the default visitor
in order to keep visit behavior shared.

gcc/rust/ChangeLog:

	* util/rust-attributes.cc (AttributeChecker::visit): Add visit function
	for crates.
	* util/rust-attributes.h (class AttributeChecker): Update function
	prototypes.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
  • Loading branch information
P-E-P committed Dec 1, 2023
1 parent 48942f6 commit fba0a7b
Show file tree
Hide file tree
Showing 2 changed files with 171 additions and 171 deletions.
23 changes: 11 additions & 12 deletions gcc/rust/util/rust-attributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// along with GCC; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.

#include "rust-ast-visitor.h"
#include "rust-system.h"
#include "rust-session-manager.h"
#include "rust-attributes.h"
Expand Down Expand Up @@ -94,6 +95,12 @@ AttributeChecker::AttributeChecker () {}

void
AttributeChecker::go (AST::Crate &crate)
{
visit (crate);
}

void
AttributeChecker::visit (AST::Crate &crate)
{
check_attributes (crate.get_inner_attrs ());

Expand Down Expand Up @@ -468,8 +475,8 @@ AttributeChecker::visit (AST::BlockExpr &expr)
check_proc_macro_non_root (item->get_outer_attrs (),
item->get_locus ());
}
stmt->accept_vis (*this);
}
AST::DefaultASTVisitor::visit (expr);
}

void
Expand Down Expand Up @@ -512,12 +519,6 @@ void
AttributeChecker::visit (AST::ReturnExpr &)
{}

void
AttributeChecker::visit (AST::UnsafeBlockExpr &expr)
{
expr.get_block_expr ()->accept_vis (*this);
}

void
AttributeChecker::visit (AST::LoopExpr &)
{}
Expand Down Expand Up @@ -582,8 +583,8 @@ AttributeChecker::visit (AST::Module &module)
for (auto &item : module.get_items ())
{
check_proc_macro_non_root (item->get_outer_attrs (), item->get_locus ());
item->accept_vis (*this);
}
AST::DefaultASTVisitor::visit (module);
}

void
Expand Down Expand Up @@ -754,16 +755,14 @@ void
AttributeChecker::visit (AST::InherentImpl &impl)
{
check_proc_macro_non_function (impl.get_outer_attrs ());
for (auto &item : impl.get_impl_items ())
item->accept_vis (*this);
AST::DefaultASTVisitor::visit (impl);
}

void
AttributeChecker::visit (AST::TraitImpl &impl)
{
check_proc_macro_non_function (impl.get_outer_attrs ());
for (auto &item : impl.get_impl_items ())
item->accept_vis (*this);
AST::DefaultASTVisitor::visit (impl);
}

void
Expand Down
Loading

0 comments on commit fba0a7b

Please sign in to comment.