aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/expand
diff options
context:
space:
mode:
authorjjasmine <tanghocle456@gmail.com>2024-05-28 21:56:19 -0700
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-17 16:35:43 +0100
commit256bb62f995625ff32748e479b371c20082189ba (patch)
treefcbee9189caa2ed95855d87e9f5272eaef8aa824 /gcc/rust/expand
parent5d2d1a2d9818bcde16e0c41df450e2537fb1fee4 (diff)
downloadgcc-256bb62f995625ff32748e479b371c20082189ba.zip
gcc-256bb62f995625ff32748e479b371c20082189ba.tar.gz
gcc-256bb62f995625ff32748e479b371c20082189ba.tar.bz2
gccrs: Got AST::Fragment to be created from InlineAsm
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
Diffstat (limited to 'gcc/rust/expand')
-rw-r--r--gcc/rust/expand/rust-macro-builtins-asm.cc31
1 files changed, 25 insertions, 6 deletions
diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc b/gcc/rust/expand/rust-macro-builtins-asm.cc
index 9e02400..ee57f7f 100644
--- a/gcc/rust/expand/rust-macro-builtins-asm.cc
+++ b/gcc/rust/expand/rust-macro-builtins-asm.cc
@@ -220,27 +220,40 @@ parse_reg_operand (Parser<MacroInvocLexer> &parser, TokenId last_token_id,
bool is_explicit_reg = false;
bool is_global_asm = inlineAsm.is_global_asm;
if (!is_global_asm && check_identifier (parser, "in"))
- {}
+ {
+ return tl::nullopt;
+ }
else if (!is_global_asm && check_identifier (parser, "out"))
- {}
+ {
+ return tl::nullopt;
+ }
else if (!is_global_asm && check_identifier (parser, "lateout"))
- {}
+ {
+ return tl::nullopt;
+ }
else if (!is_global_asm && check_identifier (parser, "inout"))
- {}
+ {
+ return tl::nullopt;
+ }
else if (!is_global_asm && check_identifier (parser, "inlateout"))
- {}
+ {
+ return tl::nullopt;
+ }
else if (parser.peek_current_token ()->get_id () == CONST)
{
rust_unreachable ();
// todo: Please handle const
+ return tl::nullopt;
}
else if (false && check_identifier (parser, "sym"))
{
// todo: Please handle sym
+ return tl::nullopt;
}
else if (false && check_identifier (parser, "label"))
{
// todo: Please handle label
+ return tl::nullopt;
}
else
{
@@ -518,7 +531,13 @@ parse_asm (location_t invoc_locus, AST::MacroInvocData &invoc,
// operands stream, also handles the optional ","
parse_asm_arg (parser, last_token_id, inlineAsmCtx);
- return tl::nullopt;
+ AST::SingleASTNode single
+ = AST::SingleASTNode (inlineAsmCtx.inlineAsm.clone_expr_without_block ());
+ std::vector<AST::SingleASTNode> single_vec = {single};
+
+ AST::Fragment fragment_ast
+ = AST::Fragment (single_vec, std::vector<std::unique_ptr<AST::Token>> ());
+ return fragment_ast;
}
} // namespace Rust