diff options
author | jjasmine <tanghocle456@gmail.com> | 2024-05-21 15:02:00 -0700 |
---|---|---|
committer | CohenArthur <arthur.cohen@embecosm.com> | 2024-06-13 15:31:07 +0000 |
commit | 3c93736b8b898d48147488669b01338ffa09d47f (patch) | |
tree | ede0bf8f14ffbf7ed3c14a6cc479ba523c15c2ad | |
parent | c3bdf2dda85db805ffc63c2d10850da544357405 (diff) | |
download | gcc-3c93736b8b898d48147488669b01338ffa09d47f.zip gcc-3c93736b8b898d48147488669b01338ffa09d47f.tar.gz gcc-3c93736b8b898d48147488669b01338ffa09d47f.tar.bz2 |
Make InlineAsm non-abstract for usage in parsing.
gcc/rust/ChangeLog:
* ast/rust-expr.h: Make InlineAsm non-abstract for usage in parsing.
-rw-r--r-- | gcc/rust/ast/rust-expr.h | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h index 84fb5e8..03336cd 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<Attribute> outer_attrs; + public: std::vector<InlineAsmTemplatePiece> template_; std::vector<TupleTemplateStr> template_strs; std::vector<InlineAsmOperand> operands; - TupleClobber clobber_abi; - InlineAsmOptions options; + std::vector<TupleClobber> clobber_abi; + // std::set<InlineAsmOptions> options; + std::set<std::string> options; + std::vector<location_t> 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<Attribute> &get_outer_attrs () override { return outer_attrs; } + + void set_outer_attrs (std::vector<Attribute> v) override { outer_attrs = v; } + + ExprWithoutBlock *clone_expr_without_block_impl () const override + { + return nullptr; + } }; } // namespace AST |