aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-ast.cc
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2023-02-23 16:50:39 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 18:13:36 +0100
commita8a27b074f40cbac16af37db4c03a1128ce8f201 (patch)
treed072187d0bf5823cf013570946f0b33391a162b8 /gcc/rust/ast/rust-ast.cc
parent8b8701243c280559fa8d2426bf8fb0b13d1f563a (diff)
downloadgcc-a8a27b074f40cbac16af37db4c03a1128ce8f201.zip
gcc-a8a27b074f40cbac16af37db4c03a1128ce8f201.tar.gz
gcc-a8a27b074f40cbac16af37db4c03a1128ce8f201.tar.bz2
gccrs: ast: Add ExternalTypeItem node
gcc/rust/ChangeLog: * ast/rust-item.h (class ExternalTypeItem): New class. * ast/rust-ast.cc (ExternalTypeItem::as_string): New function. (ExternalTypeItem::accept_vis): Likewise. * ast/rust-ast-full-decls.h (class ExternalTypeItem): Declare class. * ast/rust-ast-dump.cc (Dump::visit): Add base visitor for ExternalTypeItem. * ast/rust-ast-dump.h: Likewise. * ast/rust-ast-visitor.h: Likewise. * checks/errors/rust-feature-gate.h: Likewise. * expand/rust-attribute-visitor.cc (AttrVisitor::visit): Likewise. * expand/rust-attribute-visitor.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise. * resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit): Likewise. * resolve/rust-early-name-resolver.h: Likewise. * util/rust-attributes.cc (AttributeChecker::visit): Likewise. * util/rust-attributes.h: Likewise.
Diffstat (limited to 'gcc/rust/ast/rust-ast.cc')
-rw-r--r--gcc/rust/ast/rust-ast.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc
index 6692505..13d31cf 100644
--- a/gcc/rust/ast/rust-ast.cc
+++ b/gcc/rust/ast/rust-ast.cc
@@ -3407,6 +3407,16 @@ EnumItemDiscriminant::as_string () const
}
std::string
+ExternalTypeItem::as_string () const
+{
+ auto str = append_attributes (outer_attrs, OUTER);
+
+ str += "type " + item_name + ";";
+
+ return str;
+}
+
+std::string
ExternalStaticItem::as_string () const
{
// outer attributes
@@ -5493,6 +5503,12 @@ TraitImpl::accept_vis (ASTVisitor &vis)
}
void
+ExternalTypeItem::accept_vis (ASTVisitor &vis)
+{
+ vis.visit (*this);
+}
+
+void
ExternalStaticItem::accept_vis (ASTVisitor &vis)
{
vis.visit (*this);