diff options
author | badumbatish <tanghocle456@gmail.com> | 2024-06-30 17:37:58 -0700 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-07-03 09:25:47 +0000 |
commit | 61bf44479706ff92dd66c4ce5abc97c4c7465b29 (patch) | |
tree | adce55240b3c1a5cd845e30b1757f5cfe632ddd9 /gcc/rust/expand/rust-macro-builtins-asm.cc | |
parent | b657fa0c78b422ab020693b3f0eca5cb98fb1492 (diff) | |
download | gcc-61bf44479706ff92dd66c4ce5abc97c4c7465b29.zip gcc-61bf44479706ff92dd66c4ce5abc97c4c7465b29.tar.gz gcc-61bf44479706ff92dd66c4ce5abc97c4c7465b29.tar.bz2 |
Safe-guard InlineAsm structs
gcc/rust/ChangeLog:
* ast/rust-expr.h (struct AnonConst):
Safe-guard InlineAsm structs
(struct InlineAsmOperand): Likewise.
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in):
Likewise.
(parse_reg_operand_out): Likewise.
(parse_reg_operand_inout): Likewise.
Signed-off-by: badumbatish <tanghocle456@gmail.com>
Diffstat (limited to 'gcc/rust/expand/rust-macro-builtins-asm.cc')
-rw-r--r-- | gcc/rust/expand/rust-macro-builtins-asm.cc | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc b/gcc/rust/expand/rust-macro-builtins-asm.cc index 43e4120..4681280 100644 --- a/gcc/rust/expand/rust-macro-builtins-asm.cc +++ b/gcc/rust/expand/rust-macro-builtins-asm.cc @@ -307,9 +307,9 @@ parse_reg_operand_in (InlineAsmContext inline_asm_ctx) // TODO: When we've succesfully parse an expr, remember to clone_expr() // instead of nullptr - struct AST::InlineAsmOperand::In in (reg, nullptr); - reg_operand.set_in (in); - inline_asm_ctx.inline_asm.operands.push_back (reg_operand); + // struct AST::InlineAsmOperand::In in (reg, nullptr); + // reg_operand.set_in (in); + // inline_asm_ctx.inline_asm.operands.push_back (reg_operand); return inline_asm_ctx; } return tl::unexpected<InlineAsmParseError> (NONCOMMITED); @@ -328,9 +328,9 @@ parse_reg_operand_out (InlineAsmContext inline_asm_ctx) // TODO: When we've succesfully parse an expr, remember to clone_expr() // instead of nullptr - struct AST::InlineAsmOperand::Out out (reg, false, nullptr); - reg_operand.set_out (out); - inline_asm_ctx.inline_asm.operands.push_back (reg_operand); + // struct AST::InlineAsmOperand::Out out (reg, false, nullptr); + // reg_operand.set_out (out); + // inline_asm_ctx.inline_asm.operands.push_back (reg_operand); return inline_asm_ctx; } @@ -397,11 +397,10 @@ parse_reg_operand_inout (InlineAsmContext inline_asm_ctx) // https://github.com/rust-lang/rust/blob/a3167859f2fd8ff2241295469876a2b687280bdc/compiler/rustc_builtin_macros/src/asm.rs#L135 // RUST VERSION: ast::InlineAsmOperand::SplitInOut { reg, in_expr: // expr, out_expr, late: false } - struct AST::InlineAsmOperand::SplitInOut split_in_out (reg, false, - nullptr, - nullptr); - reg_operand.set_split_in_out (split_in_out); - inline_asm_ctx.inline_asm.operands.push_back (reg_operand); + // struct AST::InlineAsmOperand::SplitInOut split_in_out (reg, + // false, nullptr, + // nullptr); reg_operand.set_split_in_out (split_in_out); + // inline_asm_ctx.inline_asm.operands.push_back (reg_operand); return inline_asm_ctx; } @@ -410,9 +409,9 @@ parse_reg_operand_inout (InlineAsmContext inline_asm_ctx) // https://github.com/rust-lang/rust/blob/a3167859f2fd8ff2241295469876a2b687280bdc/compiler/rustc_builtin_macros/src/asm.rs#L137 // RUST VERSION: ast::InlineAsmOperand::InOut { reg, expr, late: false // } - struct AST::InlineAsmOperand::InOut inout (reg, false, nullptr); - reg_operand.set_in_out (inout); - inline_asm_ctx.inline_asm.operands.push_back (reg_operand); + // struct AST::InlineAsmOperand::InOut inout (reg, false, + // nullptr); reg_operand.set_in_out (inout); + // inline_asm_ctx.inline_asm.operands.push_back (reg_operand); return inline_asm_ctx; } } |