From: jjasmine Date: Tue, 21 May 2024 22:02:00 +0000 (-0700) Subject: gccrs: Make InlineAsm non-abstract for usage in parsing. X-Git-Tag: basepoints/gcc-16~1383 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca10fe5f2a66060a7ab01cc2b3bd68154e385742;p=thirdparty%2Fgcc.git gccrs: Make InlineAsm non-abstract for usage in parsing. gcc/rust/ChangeLog: * ast/rust-expr.h: Make InlineAsm non-abstract for usage in parsing. --- diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 84fb5e8ab33..03336cdcc59 100644 --- a/gcc/rust/ast/rust-expr.h +++ b/gcc/rust/ast/rust-expr.h @@ -4809,11 +4809,8 @@ struct InlineAsmPlaceHolder struct InlineAsmTemplatePiece { bool is_placeholder; - union - { - std::string string; - InlineAsmPlaceHolder placeholder; - }; + std::string string; + InlineAsmPlaceHolder placeholder; }; struct TupleClobber @@ -4832,16 +4829,47 @@ struct TupleTemplateStr }; // Inline Assembly Node -class InlineAsm : public ExprWithoutBlock +class InlineAsm : private ExprWithoutBlock { +private: + location_t locus; + // TODO: Not sure how outer_attrs plays with InlineAsm, I put it here in order + // to override, very hacky. + std::vector outer_attrs; + public: std::vector template_; std::vector template_strs; std::vector operands; - TupleClobber clobber_abi; - InlineAsmOptions options; + std::vector clobber_abi; + // std::set options; + std::set options; + std::vector line_spans; + bool is_global_asm; + + InlineAsm (location_t locus, bool is_global_asm) + : locus (locus), is_global_asm (is_global_asm) + {} + void accept_vis (ASTVisitor &vis) override{}; + + std::string as_string () const override { return "InlineAsm AST Node"; } + + location_t get_locus () const override { return locus; } + + void mark_for_strip () override {} + + bool is_marked_for_strip () const override { return false; } + + std::vector &get_outer_attrs () override { return outer_attrs; } + + void set_outer_attrs (std::vector v) override { outer_attrs = v; } + + ExprWithoutBlock *clone_expr_without_block_impl () const override + { + return nullptr; + } }; } // namespace AST