gccrs: Support outer attribute handling on trait items just like normal items
authorPhilip Herron <philip.herron@embecosm.com>
Fri, 14 Oct 2022 15:06:33 +0000 (16:06 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 21 Feb 2023 11:36:35 +0000 (12:36 +0100)
commit8f0b1526e04c80fd3cc30f692f482df14939088b
tree6f073fd86bca5240d90db3144eccf3ecdb24f32d
parentacbaadfa46d0833a28b935e5cfab1bc2b30467a6
gccrs: Support outer attribute handling on trait items just like normal items

gcc/rust/ChangeLog:

* hir/rust-ast-lower-base.h (class ItemWrapper): New class.
* hir/rust-ast-lower-base.cc (ASTLoweringBase::handle_outer_attributes): Use
`ItemWrapper` class.
(ASTLoweringBase::handle_doc_item_attribute): Likewise.
(ASTLoweringBase::handle_lang_item_attribute): Likewise.
* hir/rust-ast-lower-implitem.h: Check outer attributes on items.
* hir/tree/rust-hir-item.h: Add `get_trait_locus` methods.
* hir/tree/rust-hir.h: Likewise.
* util/rust-hir-map.h: Add defId mappings and associated functions.
* util/rust-hir-map.cc (Mappings::insert_defid_mapping): Implement insertion to said
mappings.
(Mappings::lookup_trait_item_defid): And looking up said mappings.
gcc/rust/hir/rust-ast-lower-base.cc
gcc/rust/hir/rust-ast-lower-base.h
gcc/rust/hir/rust-ast-lower-implitem.h
gcc/rust/hir/tree/rust-hir-item.h
gcc/rust/hir/tree/rust-hir.h
gcc/rust/util/rust-hir-map.cc
gcc/rust/util/rust-hir-map.h