aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/resolve
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-02-15 20:58:48 +0100
committerCohenArthur <arthur.cohen@embecosm.com>2024-03-01 15:42:36 +0000
commit12ca8dbb4bc22da1b93630c884b75ce254605882 (patch)
treedabaaeac068924aa1d6520bbe3aad26ad196e905 /gcc/rust/resolve
parent7064be37a38b4c3c8ad8193e13312e2c558303dc (diff)
downloadgcc-12ca8dbb4bc22da1b93630c884b75ce254605882.zip
gcc-12ca8dbb4bc22da1b93630c884b75ce254605882.tar.gz
gcc-12ca8dbb4bc22da1b93630c884b75ce254605882.tar.bz2
ast: Add base nodes for FormatArgs
This commit adds a base for creating AST FormatArgs nodes after expanding invocations of `format_args!()`. These nodes will then be expanded to the proper runtime function calls (to core::fmt::rt) during the AST lowering. gcc/rust/ChangeLog: * ast/rust-builtin-ast-nodes.h: New file. * ast/rust-ast-full-decls.h (class FormatArgs): Declare new class. * ast/rust-ast-collector.cc: Handle FormatArgs nodes properly. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-full.h: Likewise. * ast/rust-ast-visitor.cc: Likewise. * ast/rust-ast-visitor.h: Likewise. * ast/rust-ast.cc: Likewise. * ast/rust-ast.h: Likewise. * expand/rust-derive.h: Likewise. * hir/rust-ast-lower-base.cc: Likewise. * hir/rust-ast-lower-base.h: Likewise. * hir/rust-ast-lower-expr.cc: Likewise. * hir/rust-ast-lower-expr.h: Likewise. * resolve/rust-ast-resolve-base.cc: Likewise. * resolve/rust-ast-resolve-base.h: Likewise.
Diffstat (limited to 'gcc/rust/resolve')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-base.cc6
-rw-r--r--gcc/rust/resolve/rust-ast-resolve-base.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.cc b/gcc/rust/resolve/rust-ast-resolve-base.cc
index c88bd58..04a0bb6 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-base.cc
@@ -650,5 +650,11 @@ void
ResolverBase::visit (AST::FunctionParam &)
{}
+void
+ResolverBase::visit (AST::FormatArgs &fmt)
+{
+ rust_sorry_at (0, "unimplemented format_args!() visitor");
+}
+
} // namespace Resolver
} // namespace Rust
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.h b/gcc/rust/resolve/rust-ast-resolve-base.h
index 9bc6433..3b4d286 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.h
+++ b/gcc/rust/resolve/rust-ast-resolve-base.h
@@ -20,6 +20,7 @@
#define RUST_AST_RESOLVE_BASE_H
#include "rust-ast-visitor.h"
+#include "rust-ast.h"
#include "rust-name-resolver.h"
#include "rust-diagnostics.h"
#include "rust-location.h"
@@ -198,6 +199,8 @@ public:
void visit (AST::VariadicParam &param);
void visit (AST::SelfParam &param);
+ void visit (AST::FormatArgs &fmt);
+
protected:
ResolverBase ()
: resolver (Resolver::get ()), mappings (Analysis::Mappings::get ()),