diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-12-04 13:53:11 +0000 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-21 12:33:11 +0100 |
commit | f8dd4cc166149c9a9a6393b440a4cf89b8fa6307 (patch) | |
tree | caf67f090c5eda3149f785cbc06e77ce94451923 /gcc/rust/hir | |
parent | ed773fca7b930403d8863995077e1929bd715d91 (diff) | |
download | gcc-f8dd4cc166149c9a9a6393b440a4cf89b8fa6307.zip gcc-f8dd4cc166149c9a9a6393b440a4cf89b8fa6307.tar.gz gcc-f8dd4cc166149c9a9a6393b440a4cf89b8fa6307.tar.bz2 |
gccrs: attributes: Add class for sharing methods on attributes.
gcc/rust/ChangeLog:
* util/rust-attributes.h (class Attributes): New.
* util/rust-attributes.cc: Implement Attributes::is_known().
* ast/rust-collect-lang-items.cc (is_known_attribute): Remove.
(get_lang_item_attr): Call Attributes::is_known() instead.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Likewise.
(ASTLoweringBase::is_known_attribute): Remove.
Diffstat (limited to 'gcc/rust/hir')
-rw-r--r-- | gcc/rust/hir/rust-ast-lower-base.cc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc index 18e6fff..f6d7f0c 100644 --- a/gcc/rust/hir/rust-ast-lower-base.cc +++ b/gcc/rust/hir/rust-ast-lower-base.cc @@ -25,6 +25,7 @@ #include "rust-diagnostics.h" #include "rust-item.h" #include "rust-system.h" +#include "rust-attributes.h" namespace Rust { namespace HIR { @@ -751,7 +752,7 @@ ASTLoweringBase::handle_outer_attributes (const ItemWrapper &item) for (const auto &attr : item.get_outer_attrs ()) { const auto &str_path = attr.get_path ().as_string (); - if (!is_known_attribute (str_path)) + if (!Analysis::Attributes::is_known (str_path)) { rust_error_at (attr.get_locus (), "unknown attribute"); continue; @@ -815,13 +816,6 @@ ASTLoweringBase::handle_lang_item_attribute (const ItemWrapper &item, } bool -ASTLoweringBase::is_known_attribute (const std::string &attribute_path) const -{ - const auto &lookup = attr_mappings->lookup_builtin (attribute_path); - return !lookup.is_error (); -} - -bool ASTLoweringBase::attribute_handled_in_another_pass ( const std::string &attribute_path) const { |