diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-03-01 10:41:45 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-03-01 11:19:11 +0100 |
commit | 58d1721529e99c7c633615e7491b777a6198ed00 (patch) | |
tree | 494dea8c86717a2efeacd4dc757de0bc5d48ff0a /gcc/rust/ast/rust-macro.h | |
parent | 12d156566af84ec834abb7e18feac6e8f5884451 (diff) | |
download | gcc-58d1721529e99c7c633615e7491b777a6198ed00.zip gcc-58d1721529e99c7c633615e7491b777a6198ed00.tar.gz gcc-58d1721529e99c7c633615e7491b777a6198ed00.tar.bz2 |
macroinvocation: Only allow *stmt* visitors when semicoloned
Diffstat (limited to 'gcc/rust/ast/rust-macro.h')
-rw-r--r-- | gcc/rust/ast/rust-macro.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/rust/ast/rust-macro.h b/gcc/rust/ast/rust-macro.h index de1d0a5..2b39624 100644 --- a/gcc/rust/ast/rust-macro.h +++ b/gcc/rust/ast/rust-macro.h @@ -469,6 +469,8 @@ class MacroInvocation : public TypeNoBounds, // Important for when we actually expand the macro bool is_semi_coloned; + NodeId node_id; + public: std::string as_string () const override; @@ -477,7 +479,9 @@ public: bool is_semi_coloned = false) : outer_attrs (std::move (outer_attrs)), invoc_data (std::move (invoc_data)), locus (locus), - fragment (ASTFragment::create_empty ()), is_semi_coloned (is_semi_coloned) + fragment (ASTFragment::create_empty ()), + is_semi_coloned (is_semi_coloned), + node_id (Analysis::Mappings::get ()->get_next_node_id ()) {} Location get_locus () const override final { return locus; } @@ -504,6 +508,8 @@ public: return ExprWithoutBlock::get_node_id (); } + NodeId get_macro_node_id () const { return node_id; } + MacroInvocData &get_invoc_data () { return invoc_data; } ASTFragment &get_fragment () { return fragment; } @@ -562,12 +568,9 @@ protected: } ExprWithoutBlock *to_stmt () const override - - - - - { - auto new_impl = clone_macro_invocation_impl(); + + { + auto new_impl = clone_macro_invocation_impl (); new_impl->is_semi_coloned = true; return new_impl; |