aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/tree/rust-hir.h
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-03-01 12:35:18 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:21:09 +0100
commit51ba68e38a04b1eecf7ad43c067ce18dc783e722 (patch)
treef4697e5d70c8b9ad1e8f67475ca88201c67fd7e5 /gcc/rust/hir/tree/rust-hir.h
parent3e0437dc981af591f46234fd2e3aebb3c60028cc (diff)
downloadgcc-51ba68e38a04b1eecf7ad43c067ce18dc783e722.zip
gcc-51ba68e38a04b1eecf7ad43c067ce18dc783e722.tar.gz
gcc-51ba68e38a04b1eecf7ad43c067ce18dc783e722.tar.bz2
gccrs: hir: Add ExportedMacro node and handling.
This HIR node represents macros which should be exported into the final Rust metadata files. Because our metadata exporter operates on the HIR, while macros are inherently tied to the AST, we need a way to propagate exported macros up until the metadata export pass on the HIR. Hence the existence of this class, whose sole purpose is to keep enough information for the metadata exporter to retrieve the original AST::MacroRulesDefinition. Handling for actually exporting these macros will come later. gcc/rust/ChangeLog: * hir/tree/rust-hir-item.h (class ExportedMacro): Add new ExportedMacro class. * hir/tree/rust-hir.cc (ExportedMacro::accept_vis): New function. (ExportedMacro::get_locus): Likewise. (ExportedMacro::get_item_kind): Likewise. (ExportedMacro::clone_item_impl): Likewise. * hir/tree/rust-hir-full-decls.h (class ExportedMacro): Forward declare class. * backend/rust-compile-item.h: Add visitor for ExportedMacro. * backend/rust-compile-stmt.h: Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.h: Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.cc (PubRestrictedVisitor::visit): Likewise. * checks/errors/privacy/rust-pub-restricted-visitor.h: Likewise. * checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise. * checks/errors/privacy/rust-reachability.h: Likewise. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::visit): Likewise. * checks/errors/privacy/rust-visibility-resolver.h: Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-const-checker.h: Likewise. * checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise. * checks/errors/rust-unsafe-checker.h: Likewise. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise. * hir/rust-ast-lower-item.h: Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h: Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * metadata/rust-export-metadata.cc: Likewise. * typecheck/rust-hir-type-check-item.h: Likewise. * typecheck/rust-hir-type-check-stmt.cc (TypeCheckStmt::visit): Likewise. * typecheck/rust-hir-type-check-stmt.h: Likewise. * typecheck/rust-tycheck-dump.h: Likewise. * hir/tree/rust-hir.h: Add new ItemKind::MacroExport variant. * util/rust-attributes.cc: Add #[macro_export] attribute.
Diffstat (limited to 'gcc/rust/hir/tree/rust-hir.h')
-rw-r--r--gcc/rust/hir/tree/rust-hir.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/rust/hir/tree/rust-hir.h b/gcc/rust/hir/tree/rust-hir.h
index 31f1494..d9eea87 100644
--- a/gcc/rust/hir/tree/rust-hir.h
+++ b/gcc/rust/hir/tree/rust-hir.h
@@ -191,6 +191,7 @@ public:
Trait,
Impl,
Module,
+ MacroExport,
};
virtual ItemKind get_item_kind () const = 0;