diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2024-10-10 21:24:50 -0400 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:16 +0100 |
commit | b7f03bbd20d6aab28b85b8edb645ff20badd6d10 (patch) | |
tree | aa05eda632998791bddc4794b22766b39702ea12 /gcc/rust/expand/rust-macro-builtins-asm.cc | |
parent | b05e174a34799f5a24235ff5d553387963c41da4 (diff) | |
download | gcc-b7f03bbd20d6aab28b85b8edb645ff20badd6d10.zip gcc-b7f03bbd20d6aab28b85b8edb645ff20badd6d10.tar.gz gcc-b7f03bbd20d6aab28b85b8edb645ff20badd6d10.tar.bz2 |
gccrs: Rework InlineAsmOperand
Not thrilled with some of this boilerplate, but it does seem like an
improvement.
gcc/rust/ChangeLog:
* ast/rust-expr.h
(InlineAsmOperand): Replace multiple mutually-exclusive tl::optional
fields with a std::unique_ptr and modify nested classes to allow
this. Also, make getters return references where possible.
* expand/rust-macro-builtins-asm.cc
(parse_reg_operand_out): Pass location when constructing
InlineAsmOperand.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc/rust/expand/rust-macro-builtins-asm.cc')
-rw-r--r-- | gcc/rust/expand/rust-macro-builtins-asm.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc b/gcc/rust/expand/rust-macro-builtins-asm.cc index 52dba15..1017d9f 100644 --- a/gcc/rust/expand/rust-macro-builtins-asm.cc +++ b/gcc/rust/expand/rust-macro-builtins-asm.cc @@ -341,6 +341,7 @@ tl::expected<InlineAsmContext, InlineAsmParseError> parse_reg_operand_out (InlineAsmContext inline_asm_ctx) { auto &parser = inline_asm_ctx.parser; + location_t locus = parser.peek_current_token ()->get_locus (); if (!inline_asm_ctx.is_global_asm () && check_identifier (parser, "out")) { auto reg = parse_reg (inline_asm_ctx); @@ -355,7 +356,7 @@ parse_reg_operand_out (InlineAsmContext inline_asm_ctx) // instead of nullptr struct AST::InlineAsmOperand::Out out (reg, false, std::move (expr)); - inline_asm_ctx.inline_asm.operands.push_back (out); + inline_asm_ctx.inline_asm.operands.emplace_back (out, locus); return inline_asm_ctx; } |