aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/ast/rust-macro.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/ast/rust-macro.h')
-rw-r--r--gcc/rust/ast/rust-macro.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h
index 76b3b2a..fc01e57 100644
--- a/gcc/rust/ast/rust-macro.h
+++ b/gcc/rust/ast/rust-macro.h
@@ -24,11 +24,11 @@
#include "rust-ast-fragment.h"
#include "rust-location.h"
#include "rust-item.h"
-#include "rust-make-unique.h"
#include "rust-macro-builtins.h"
namespace Rust {
namespace AST {
+
class MacroFragSpec
{
public:
@@ -521,7 +521,7 @@ public:
mbe (Identifier rule_name, DelimType delim_type, std::vector<MacroRule> rules,
std::vector<Attribute> outer_attrs, location_t locus)
{
- return Rust::make_unique<MacroRulesDefinition> (
+ return std::make_unique<MacroRulesDefinition> (
MacroRulesDefinition (rule_name, delim_type, rules, outer_attrs, locus,
AST::MacroRulesDefinition::MacroKind::MBE,
AST::Visibility::create_error ()));
@@ -532,7 +532,7 @@ public:
std::vector<Attribute> outer_attrs, location_t locus,
Visibility vis)
{
- return Rust::make_unique<MacroRulesDefinition> (MacroRulesDefinition (
+ return std::make_unique<MacroRulesDefinition> (MacroRulesDefinition (
rule_name, AST::DelimType::CURLY, rules, outer_attrs, locus,
AST::MacroRulesDefinition::MacroKind::DeclMacro, vis));
}
@@ -572,13 +572,13 @@ public:
is_builtin_rule = true;
}
- AST::Kind get_ast_kind () const override
+ MacroKind get_kind () const { return kind; }
+
+ Item::Kind get_item_kind () const override
{
- return AST::Kind::MACRO_RULES_DEFINITION;
+ return Item::Kind::MacroRulesDefinition;
}
- MacroKind get_kind () const { return kind; }
-
protected:
/* Use covariance to implement clone function as returning this object rather
* than base */
@@ -610,11 +610,6 @@ public:
std::string as_string () const override;
- Pattern::Kind get_pattern_kind () override
- {
- return Pattern::Kind::MacroInvocation;
- }
-
/**
* The default constructor you should use. Whenever we parse a macro call, we
* cannot possibly know whether or not this call refers to a builtin macro or
@@ -677,11 +672,6 @@ public:
return ExprWithoutBlock::get_node_id ();
}
- AST::Kind get_ast_kind () const override
- {
- return AST::Kind::MACRO_INVOCATION;
- }
-
NodeId get_macro_node_id () const { return node_id; }
MacroInvocData &get_invoc_data () { return invoc_data; }
@@ -800,6 +790,21 @@ public:
void add_semicolon () override { is_semi_coloned = true; }
+ Pattern::Kind get_pattern_kind () override
+ {
+ return Pattern::Kind::MacroInvocation;
+ }
+
+ Expr::Kind get_expr_kind () const override
+ {
+ return Expr::Kind::MacroInvocation;
+ }
+
+ Item::Kind get_item_kind () const override
+ {
+ return Item::Kind::MacroInvocation;
+ }
+
protected:
Item *clone_item_impl () const override
{