diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2024-10-10 21:24:50 -0400 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2024-10-13 23:50:45 +0000 |
commit | 583eb22ce186fc5acbb330e9553af40257951cef (patch) | |
tree | 80403dd749d0f4d46243009096ac84cdbf090e72 /gcc/rust/expand/rust-macro-builtins-asm.cc | |
parent | 3bff5cf047e452c479d60ca0daff05056d7bf11a (diff) | |
download | gcc-583eb22ce186fc5acbb330e9553af40257951cef.zip gcc-583eb22ce186fc5acbb330e9553af40257951cef.tar.gz gcc-583eb22ce186fc5acbb330e9553af40257951cef.tar.bz2 |
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 43a54d1..061c684 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; } |