aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand
AgeCommit message (Collapse)AuthorFilesLines
2025-03-19gccrs: Fix compiler error on ast wrong implicit construct push_backbadumbatish1-1/+2
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Fix compiler error on ast wrong implicit construct push_back
2025-03-19gccrs: Provide input operand for gccrsbadumbatish1-4/+5
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_construct_inputs): Provide input operand for gccrs * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Move expr to In (expand_inline_asm_strings): Add comments to debug strings gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: Remove inout, functionality not supported. Remove redundant {} * rust/execute/torture/inline_asm_mov_x_5_ARM.rs: Add operand in * rust/execute/torture/inline_asm_mov_x_5_x86_64.rs: Likewise
2025-03-19gccrs: Rework InlineAsmOperandOwen Avery1-1/+2
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>
2025-03-19rust: Add support for Clone and Copy derive on generic typesPhilip Herron4-16/+168
When we generate derivations for Copy and Clone we need to make sure the associated impl block sets up the generic parameters and arguments correctly. This patch introduces the framework to copy chunks of the AST because we need to make sure these new AST nodes have their own associated id, calling clone on the nodes will just confuse name-resolution and subsequent mappings. Fixes #3139 gcc/rust/ChangeLog: * Make-lang.in: new objects * ast/rust-ast-builder.cc (Builder::generic_type_path_segment): new helper (Builder::single_generic_type_path): likewise (Builder::new_type): likewise (Builder::new_lifetime_param): likewise (Builder::new_type_param): likewise (Builder::new_lifetime): likewise (Builder::new_generic_args): likewise * ast/rust-ast-builder.h: new helper decls * ast/rust-ast.h: new const getters * ast/rust-path.h: likewise * ast/rust-type.h: likewise * expand/rust-derive-clone.cc (DeriveClone::clone_impl): take the types generics (DeriveClone::visit_tuple): likewise (DeriveClone::visit_struct): likewise (DeriveClone::visit_union): likewise * expand/rust-derive-clone.h: update header * expand/rust-derive-copy.cc (DeriveCopy::copy_impl): similarly take type generics (DeriveCopy::visit_struct): likewise (DeriveCopy::visit_tuple): likewise (DeriveCopy::visit_enum): likewise (DeriveCopy::visit_union): likewise * expand/rust-derive-copy.h: likewse * ast/rust-ast-builder-type.cc: New file. * ast/rust-ast-builder-type.h: New file. gcc/testsuite/ChangeLog: * rust/compile/issue-3139-1.rs: New test. * rust/compile/issue-3139-2.rs: New test. * rust/compile/issue-3139-3.rs: New test. * rust/compile/nr2/exclude: these all break nr2
2025-03-19gccrs: Rehaul, Apply code review from Arthurbadumbatish2-45/+26
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::visit): Change API, public/private, comments, formatting from code review (CompileAsm::asm_build_expr): Likewise. (CompileAsm::tree_codegen_asm): Likewise. * backend/rust-compile-asm.h (class CompileAsm): Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::visit): Likewise. * expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise. (parse_options): Likewise. (parse_asm_arg): Likewise. (expand_inline_asm_strings): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise. (expand_inline_asm_strings): Likewise. (expand_inline_asm_string): Likewise. * hir/tree/rust-hir-expr.h: Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_typecheck.rs: Change comments
2025-03-19gccrs: Make inline mov compilesbadumbatish1-12/+55
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (CompileAsm::asm_build_expr): Remove debug * expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): properly formatted via rust instead of c (parse_asm): formatted comment (parse_format_strings): formatted comment * hir/tree/rust-hir-expr.h: fix is_simple_asm() gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: Fix format asm * rust/compile/inline_asm_parse_output_operand.rs: Fix format asm * rust/execute/torture/inline_asm_mov_x_5.rs: Move to... * rust/execute/inline_asm_mov_x_5.rs: ...here.
2025-03-19gccrs: Move strip double quotes, add scaffold expandbadumbatish2-11/+38
gcc/rust/ChangeLog: * backend/rust-compile-asm.cc (strip_double_quotes): Move strip double quotes to parse phase (CompileAsm::asm_construct_string_tree): Likewise * backend/rust-compile-asm.h (strip_double_quotes): Likewise * expand/rust-macro-builtins-asm.cc (strip_double_quotes): Likewise (expand_inline_asm): Renamed to expand_inline_asm_strings (expand_inline_asm_strings): Renamed from expand_inline_asm (parse_asm): Move strip double quotes to parse phase (parse_format_strings): Likewise * expand/rust-macro-builtins-asm.h (strip_double_quotes): Likewise (expand_inline_asm_strings): Inline asm expansion fn (expand_inline_asm_string): Inline asm expansion fn
2025-03-19gccrs: Start work on expand inline asmbadumbatish1-2/+31
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Remove warnings (parse_reg_operand_out): Remove warnings (expand_inline_asm): New function for eventual expansion (parse_asm): Use expand_inline_asm gcc/testsuite/ChangeLog: * rust/execute/torture/inline_asm_mov_x_5.rs: New test.
2025-03-19gccrs: Fix the parser's operand and flags storagebadumbatish1-6/+15
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Fix parsing logic & reassignment logic (parse_reg_operand_in): Fix parsing (parse_reg_operand_out): Fix parsing (parse_reg_operand_inout): Fix parsing (parse_reg_operand_unexpected): Remove rust_unreachable() (parse_asm_arg): Fix parsing logic
2025-03-19gccrs: ast: Introduce class hierarchy for lang item pathsArthur Cohen1-0/+2
Create a base Path class which is derived into two children classes for regular paths and lang item paths. This allows it to hold either the segments of a fully formed path, or the node ID of a lang-item path. This is required in order to create these special paths which do not have segments, and do not necessarily have a canonical form - they only depend on where the item was defined. gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (class PathPattern): Rename PathPattern to... (class Path): ...Path * ast/rust-ast-collector.cc (TokenCollector::visit): Add required methods for LangItemPath and RegularPath. * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * ast/rust-path.cc (PathPattern::as_string): Likewise. (RegularPath::as_string): Likewise. (LangItemPath::as_string): Likewise. (PathPattern::convert_to_simple_path): Likewise. (RegularPath::convert_to_simple_path): Likewise. (RegularPath::accept_vis): Likewise. (LangItemPath::accept_vis): Likewise. (PathInExpression::as_string): Likewise. (QualifiedPathInExpression::as_string): Likewise. * ast/rust-path.h (class PathPattern): Likewise. (class Path): Likewise. (class RegularPath): Likewise. (class LangItemPath): Likewise. (class PathInExpression): Likewise. (class QualifiedPathInExpression): Likewise. * ast/rust-pattern.h (class PathPattern): Likewise. (class Path): Likewise. * expand/rust-derive.h: Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise. * hir/rust-ast-lower-base.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise.
2025-03-19gccrs: Eager expansion for include* gccrs#1805 gccrs#1865Liam Naddell5-15/+58
gcc/rust/ChangeLog: * expand/rust-expand-visitor.h: remove auto keyword * expand/rust-macro-builtins-helpers.cc: allow for changing macro invoc types on eager expansions to semicoloned macros * expand/rust-macro-builtins-helpers.h: add default semicoloned argument * expand/rust-macro-builtins-include.cc: allow for eager expansion for include and include_bytes allow for parsing include invocations as items instead of expressions, which allows invocations at global scope * expand/rust-macro-expand.cc: push Expr type for eager invocations gcc/testsuite/ChangeLog: * rust/compile/macros/builtin/include1.rs: add basic include test at global scope * rust/compile/macros/builtin/include2.rs: add basic include test at local scope with expression * rust/compile/macros/builtin/include3.rs: add eager expansion test at global scope * rust/compile/macros/builtin/include4.rs: add eager expansion test at local scope with expression * rust/compile/macros/builtin/include_bytes.rs: add eager expansion test at global scope * rust/compile/macros/builtin/include_rs: supporting test file with dummy function * rust/compile/macros/builtin/include_rs2: supporting test file with dummy string * rust/compile/macros/builtin/include_str.rs: add eager expansion test at global scope * rust/execute/torture/builtin_macro_include_bytes.rs: clean up old test logic, add permutations for eager expansion * rust/execute/torture/builtin_macro_include_str.rs: add eager expansion permutations
2025-03-19gccrs: Use new constructors and control flow for operandbadumbatish1-24/+15
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): changed to class (class InlineAsmOperand): Have appropriate constructor, and getter * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Use the new implement constructors and new control flow. (parse_reg_operand_in): Likewise (parse_reg_operand_out): Likewise (parse_reg_operand_inout): Likewise (parse_reg_operand_const): Likewise
2025-03-19gccrs: Fix the parser's operand and flags storagebadumbatish2-21/+52
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): Add construction for register_type * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Fix parsing logic & reassignment logic (parse_reg_operand_in): Fix parsing (parse_reg_operand_out): Fix parsing (parse_reg_operand_inout): Fix parsing (parse_reg_operand_unexpected): Remove rust_unreachable() (parse_asm_arg): Fix parsing logic * expand/rust-macro-builtins-asm.h: Add = operator overloading gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_operands.rs: Test now passing * rust/compile/inline_asm_parse_operand.rs: Remove _, not supported right now
2025-03-19gccrs: Properly striping struct fields when using attrsAntonio Gomes2-0/+28
gcc/rust/ChangeLog: * expand/rust-cfg-strip.cc: Strip struct expr fields and strip fields in struct definition * expand/rust-cfg-strip.h: Signatures for new function maybe_strip_struct_expr_fields gcc/testsuite/ChangeLog: * rust/compile/macro-issue2983_2984.rs: Add test to check for correct stripped fields Signed-off-by: Antonio Gomes <antoniospg100@gmail.com>
2025-03-17gccrs: [gccrs#2987] Patch ICE when deriving Clone and CopyLiam Naddell1-8/+9
gcc/rust/ChangeLog: * expand/rust-expand-visitor.cc: Fix ICE caused by unique_ptr UB and buggy iterator use gcc/testsuite/ChangeLog: * rust/compile/issue-2987.rs: Add test for deriving Clone and Copy at the same time Signed-off-by: Liam Naddell <liam.naddell@mail.utoronto.ca>
2025-03-17gccrs: Added options for ParseModebadumbatish1-2/+4
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Added options for ParseMode * ast/rust-fmt.h (collect_pieces): Likewise. (struct Pieces): Likewise. * expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise. libgrust/ChangeLog: * libformat_parser/generic_format_parser/src/lib.rs: Likewise. * libformat_parser/src/bin.rs: Likewise. * libformat_parser/src/lib.rs: Likewise.
2025-03-17gccrs: Safe-guard InlineAsm structsbadumbatish1-14/+13
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>
2025-03-17gccrs: Store parse result of parse_format_string(s)badumbatish1-1/+16
gcc/rust/ChangeLog: * ast/rust-expr.h (struct TupleTemplateStr): Store parse result of parse_format_string(s) * expand/rust-macro-builtins-asm.cc (parse_format_strings): Likewise Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Clean up monadic operations on expected<>jjasmine1-5/+3
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_asm): Clean up monadic operations on expected<> Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Addresses warning, put warn unused in right placejjasmine2-11/+34
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Addresses warning, put warn unused in right place (parse_reg_operand_inout): Likewise. (parse_asm_arg): Likewise. * expand/rust-macro-builtins-asm.h (enum WARN_UNUSED_RESULT): Likewise. (enum InlineAsmParseError): Likewise. (validate): Likewise. (parse_asm_arg): Likewise. (parse_format_strings): Likewise. (parse_clobber_abi): Likewise. (parse_reg_operand): Likewise. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. (parse_reg_operand_lateout): Likewise. (parse_reg_operand_inout): Likewise. (parse_reg_operand_inlateout): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_sym): Likewise. (parse_reg_operand_unexpected): Likewise. (parse_asm): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_format_string): Likewise. Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Add WARN_UNUSED_RESULT parse errorjjasmine1-1/+2
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.h (enum InlineAsmParseError): Add WARN_UNUSED_RESULT parse error (enum WARN_UNUSED_RESULT): Likewise. Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Added a test that is expected to failjjasmine2-30/+35
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): added comments (parse_options): Likewise (parse_asm_arg): Likewise (parse_asm): Likewise * expand/rust-macro-builtins-asm.h: Likewise gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_options.rs: new test * rust/compile/inline_asm_illegal_operands.rs: New test. This is expected to fail but we couldn't resolve parse_expr()'s general functionality yet Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Added tl::expected to parse_operandjjasmine2-16/+70
Added tl::expected to parse_operand by implementing the validation inside the parse_reg_operand function. gcc/rust/ChangeLog: * ast/rust-expr.h: Added tl::expected to parse_operand * expand/rust-macro-builtins-asm.cc (parse_reg): Likewise. (parse_reg_operand): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_inout): Likewise. (parse_asm_arg): Likewise. * expand/rust-macro-builtins-asm.h: Likewise. Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Scaffold expected on parse_options and asm_argjjasmine2-16/+28
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (check_and_set): Scaffold expected on parse_options and asm_arg (parse_options): Likewise (parse_asm_arg): Likewise * expand/rust-macro-builtins-asm.h (check_and_set): Likewise (parse_label): Likewise Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Finish expected parse_reg_operandjjasmine2-36/+35
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand_in): Finish expected parse_reg_operand (parse_reg_operand_unexpected): Likewise * expand/rust-macro-builtins-asm.h (parse_reg_operand_unexpected): Likewise Signed-off-by: badumbatish <tanghocle456@gmail.com>
2025-03-17gccrs: Finish incorporating expected of parse_reg_operandjjasmine2-97/+180
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Finish incorporating expected of parse_reg_operand (parse_reg): Likewise. (parse_reg_operand): Likewise. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. (parse_reg_operand_lateout): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_inout): Likewise. (parse_reg_operand_sym): Likewise. (MacroBuiltin::asm_handler): Likewise. (parse_asm_arg): Likewise. (parse_asm): Likewise. (parse_format_strings): Likewise. (validate): Likewise. * expand/rust-macro-builtins-asm.h (class InlineAsmParseError): Likewise. (enum InlineAsmParseError): Likewise. (validate): Likewise. (parse_format_strings): Likewise. (parse_reg_operand_in): Likewise. (parse_reg_operand_out): Likewise. (parse_reg_operand_lateout): Likewise. (parse_reg_operand_inout): Likewise. (parse_reg_operand_inlateout): Likewise. (parse_reg_operand_const): Likewise. (parse_reg_operand_sym): Likewise.
2025-03-17gccrs: expand: Switch semicolon boolean to an enum instead.Arthur Cohen12-71/+91
gcc/rust/ChangeLog: * ast/rust-ast-fragment.h (enum class): Add InvocKind and AsmKind enums. * ast/rust-macro.h: Switch semicolon boolean to InvocKind enum. * expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise. * expand/rust-macro-builtins-asm.cc (MacroBuiltin::asm_handler): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm): Likewise. * expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise. * expand/rust-macro-builtins-include.cc (MacroBuiltin::include_bytes_handler): Likewise. (MacroBuiltin::include_str_handler): Likewise. (MacroBuiltin::include_handler): Likewise. * expand/rust-macro-builtins-location.cc (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Likewise. (MacroBuiltin::line_handler): Likewise. * expand/rust-macro-builtins-log-debug.cc (MacroBuiltin::assert_handler): Likewise. * expand/rust-macro-builtins-utility.cc (MacroBuiltin::compile_error_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::cfg_handler): Likewise. (MacroBuiltin::stringify_handler): Likewise. * expand/rust-macro-builtins.cc (format_args_maker): Likewise. (enum class): Likewise. (inline_asm_maker): Likewise. (MacroBuiltin::sorry): Likewise. (MacroBuiltin::proc_macro_builtin): Likewise. * expand/rust-macro-builtins.h: Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise. (MacroExpander::expand_eager_invocations): Likewise. (MacroExpander::expand_invoc): Likewise. * expand/rust-macro-expand.h (struct MacroExpander): Likewise.
2025-03-17gccrs: expand: Keep track of semicoloned builtin macrosArthur Cohen10-54/+89
This is quite a rough fix (like a lot of the macro expansion code...) but it allows built-in macros to be treated as statements. I *think* asm!() might be the only one where it really matters, but also doing something like { line!(); } will now work, whereas before the macro invocation would not get expanded properly and would be ignored. gcc/rust/ChangeLog: * ast/rust-ast-fragment.h: Pass `is_semicolon` information to builtin macro transcribers. * ast/rust-macro.h: Pass semicolon information to transcriber.. * expand/rust-macro-builtins-asm.cc (MacroBuiltin::asm_handler): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm): Likewise. * expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise. * expand/rust-macro-builtins-include.cc (MacroBuiltin::include_bytes_handler): Likewise. (MacroBuiltin::include_str_handler): Likewise. (MacroBuiltin::include_handler): Likewise. * expand/rust-macro-builtins-location.cc (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Likewise. (MacroBuiltin::line_handler): Likewise. * expand/rust-macro-builtins-log-debug.cc (MacroBuiltin::assert_handler): Likewise. * expand/rust-macro-builtins-utility.cc (MacroBuiltin::compile_error_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::cfg_handler): Likewise. (MacroBuiltin::stringify_handler): Likewise. * expand/rust-macro-builtins.cc (format_args_maker): Likewise. (inline_asm_maker): Likewise. (MacroBuiltin::sorry): Likewise. (MacroBuiltin::proc_macro_builtin): Likewise. * expand/rust-macro-builtins.h: Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise. (MacroExpander::expand_invoc): Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Remove rust_unreachable. * ast/rust-ast.cc (InlineAsm::accept_vis): Likewise. * hir/tree/rust-hir.cc (InlineAsm::accept_vis): Likewise.
2025-03-17gccrs: Partial second layer of expected in parsing asmjjasmine2-69/+37
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parseDirSpec): Partial second layer of expected in parsing asm (parse_clobber_abi): Likewise (parse_operand): Likewise (parse_reg_operand): Likewise (parse_asm_arg): Likewise * expand/rust-macro-builtins-asm.h (parse_clobber_abi): Likewise (parse_reg_operand): Likewise (parse_operand): Likewise
2025-03-17gccrs: Expected first layer donejjasmine2-36/+61
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg): Expected first layer done (parse_reg_operand): Likewise. (parse_asm_arg): Likewise. (parse_format_strings): Likewise. (parse_asm): Likewise. (validate): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm_arg): Likewise. (validate): Likewise. (parse_format_strings): Likewise.
2025-03-17gccrs: Move parser and last_token_id to InlineAsmCtxjjasmine2-69/+70
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Move parser and last_token_id to InlineAsmCtx to prepapre for tl::expected. (parse_reg): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_format_string): Likewise. (parse_asm_arg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (class InlineAsmParseError): Likewise. (parse_asm_arg): Likewise. (check_and_set): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_clobber_abi): Likewise. (parse_format_string): Likewise.
2025-03-17gccrs: Update parser to parse strings in the first stagejjasmine1-49/+13
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Update parser to parse strings in the first stage (parse_label): not needed right now
2025-03-17gccrs: Scaffolding validation of asm!jjasmine2-7/+27
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_asm): Scaffolding validation of asm! (validate): Likewise * expand/rust-macro-builtins-asm.h (validate): Likewise
2025-03-17gccrs: Partial support for operandjjasmine2-7/+59
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): Partial support for operand * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. (parse_label): Likewise. * expand/rust-macro-builtins-asm.h (parse_label): Likewise.
2025-03-17gccrs: Refactoring and supporting more parse_reg_operandjjasmine1-48/+73
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmOperand): Refactoring and supporting more parse_reg_operand * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. (rust_debug): Likewise.
2025-03-17gccrs: Fix visitor-related warningsjjasmine2-2/+18
gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): Fix visitor-related warnings * ast/rust-ast-collector.h: Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast-visitor.h: Likewise. * checks/errors/borrowck/rust-bir-builder-struct.h: Likewise. * checks/errors/borrowck/rust-function-collector.h: Likewise. * checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise. * checks/errors/rust-const-checker.h: Likewise. * expand/rust-derive.h: Likewise. * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h: Likewise. * hir/tree/rust-hir-visitor.h: Likewise. * resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise. * resolve/rust-ast-resolve-base.h: Likewise.
2025-03-17gccrs: Add potentially_nonpromoted_keywords set strjjasmine2-80/+97
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Add potentially_nonpromoted_keywords set str (check_identifier): likewise * expand/rust-macro-builtins-asm.h (parse_format_string): likewise gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: fix warnings
2025-03-17gccrs: Successful parse of in and inout, albeit with strjjasmine2-10/+102
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Successful parse of in and inout, albeit with str (check_identifier): Likewise. (parse_asm_arg): Likewise. * expand/rust-macro-builtins-asm.h (parse_format_string): Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_parse_operand.rs: New test.
2025-03-17gccrs: Fix warningsjjasmine1-3/+7
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Fix compile warnings. (parse_options): Likewise. (parse_asm): Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_options.rs:
2025-03-17gccrs: Refactoring for inline asm prjjasmine3-81/+96
gcc/rust/ChangeLog: * ast/rust-expr.h (struct AnonConst): major refactoring of inline asm, mostly concerns naming convention, trinary conditionals, warnings, adding rust_unreachables in not-yet supported errors. (struct InlineAsmRegOrRegClass): Likewise. (struct InlineAsmOperand): Likewise. * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Likewise. (parse_reg): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_format_string): Likewise. (parse_asm_arg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm_arg): Likewise. (check_identifier): Likewise. (check_and_set): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_clobber_abi): Likewise. * expand/rust-macro-builtins.cc (enum class): Likewise. (inline_asm_maker): Likewise. * checks/errors/borrowck/ffi-polonius/Cargo.lock: Removed. Likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_faulty_clobber.rs: Likewise. * rust/compile/inline_asm_faulty_clobber_1.rs: Likewise. * rust/compile/inline_asm_faulty_clobber_2.rs: Likewise. * rust/compile/inline_asm_illegal_options.rs: Likewise.
2025-03-17gccrs: Got AST::Fragment to be created from InlineAsmjjasmine1-6/+25
gcc/rust/ChangeLog: * ast/rust-expr.h (struct AnonConst): Got AST::Fragment to be created from InlineAsm. (struct InlineAsmOperand): Likewise. (class InlineAsm): Likewise. * expand/rust-macro-builtins-asm.cc (parse_reg_operand): Likewise. (parse_asm): likewise
2025-03-17gccrs: Working towards parse_reg and parse_reg_operandjjasmine2-13/+20
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parse_reg): Working towards parse_reg and parse_reg_operand (parse_reg_operand): Working towards parse_reg and parse_reg_operand (parse_asm_arg): Add todo about errors * expand/rust-macro-builtins-asm.h (parse_global_asm): remove dead code. (parse_nonglobal_asm): remove dead code.
2025-03-17gccrs: Renamed parseAsmArg to conform to other function namesjjasmine2-5/+5
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (parseAsmArg): Renamed parseAsmArg to conform to other function names (parse_asm_arg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parseAsmArg): Likewise. (parse_asm_arg): Likewise.
2025-03-17gccrs: Big Refactor after meetingjjasmine2-51/+145
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmRegOrRegClass): Remove union (struct InlineAsmOperand): Make instances of inside struct. * expand/rust-macro-builtins-asm.cc (parse_clobber_abi): Change signature with inlineAsmCtx. (parse_reg): Likewise. (parse_operand): Likewise. (parse_reg_operand): Likewise. (check_and_set): Likewise. (parse_options): Likewise. (parse_format_string): Likewise. (parseAsmArg): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (class InlineAsmContext): Likewise. (parseAsmArg): Likewise. (check_and_set): Likewise. (parse_reg_operand): Likewise. (parse_options): Likewise. (parse_reg): Likewise. (parse_clobber_abi): Likewise.
2025-03-17gccrs: Remove global_asm and non_global_asm handlerjjasmine3-20/+23
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (MacroBuiltin::global_asm_handler): Remove global_asm and non_global_asm handler (MacroBuiltin::nonglobal_asm_handler): Likewise. (MacroBuiltin::asm_handler): Likewise. * expand/rust-macro-builtins.cc (enum class): Likewise. (inline_asm_maker): Likewise. * expand/rust-macro-builtins.h: Likewise.
2025-03-17gccrs: Rename InlineAsmOptions to InlineAsmOptionjjasmine2-22/+22
Rename InlineAsmOptions to InlineAsmOption for clarity gcc/rust/ChangeLog: * ast/rust-ast-full-decls.h (enum class): Rename InlineAsmOptions to InlineAsmOption for clarity * ast/rust-expr.h (enum class): Likewise. * expand/rust-macro-builtins-asm.cc (check_and_set): Likewise. (parse_options): Likewise. * expand/rust-macro-builtins-asm.h (check_and_set): Likewise. * hir/tree/rust-hir-expr.h: Likewise.
2025-03-17gccrs: Scaffolding parse_regjjasmine1-1/+48
gcc/rust/ChangeLog: * ast/rust-expr.h (struct InlineAsmRegOrRegClass): Scaffolding parse_reg * expand/rust-macro-builtins-asm.cc (parse_reg): Likewise. (parse_operand): Likewise. (parseAsmArg): Likewise.
2025-03-17gccrs: Resolve static decl warningjjasmine1-3/+3
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.h (parseAsmArg): Resolve static decl warning (parse_nonglobal_asm): Resolve static decl warning
2025-03-17gccrs: Add checks for duplicate options in inline asmjjasmine1-10/+25
gcc/rust/ChangeLog: * expand/rust-macro-builtins-asm.cc (check_and_set): Add checks for duplicate options in inline asm (parse_options): likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_illegal_options.rs: New test.
2025-03-17gccrs: Parsing of options(...) done.jjasmine2-17/+15
This is without any mutually exclusive options checked, or any relationship with reg_operands. Very primitive. gcc/rust/ChangeLog: * ast/rust-expr.h: parsing of options(...) * expand/rust-macro-builtins-asm.cc (check_and_set): likewise. (parse_options): likewise. (parseAsmArg): likewise. * expand/rust-macro-builtins-asm.h (check_and_set): likewise. gcc/testsuite/ChangeLog: * rust/compile/inline_asm_legal_options.rs: New test.