]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Collect procedural macros in the crate
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 6 Sep 2023 12:44:20 +0000 (14:44 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:09:32 +0000 (19:09 +0100)
commit4a2bd8382529db95b37c216f5abe96aa752b34a1
tree9606a81009143f6ead438df5714e5f9f015f64ce
parent4ec72feab8a555e73f7485b9c3792202b19cbe3c
gccrs: Collect procedural macros in the crate

Collect informations on procedural macros in the compiled crate. For
attribute and bang procedural macros we only require the final address
as well as the name of the function. Derive procedural macros are a bit
different, we collect the fonction's address through it's fndecl tree as
well as the trait's name and the multiple attributes.

gcc/rust/ChangeLog:

* backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl):
Make the function non static in order to be able to access the
compile context. Also add the whole proc macro infomrmation
collection.
(get_attributes): Add a function to retrieve the different
attributes from a derive procedural macro definition attribute.
(get_trait_name): Add a function to retrieve the trait name from
a derive procedural macro definition attribute.
* backend/rust-compile-base.h: Add function prototypes.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/backend/rust-compile-base.cc
gcc/rust/backend/rust-compile-base.h