aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/ast/rust-expr.h6
-rw-r--r--gcc/rust/checks/errors/borrowck/ffi-polonius/Cargo.lock39
-rw-r--r--gcc/rust/expand/rust-macro-builtins-asm.cc49
3 files changed, 93 insertions, 1 deletions
diff --git a/gcc/rust/ast/rust-expr.h b/gcc/rust/ast/rust-expr.h
index 719a76c..3091740 100644
--- a/gcc/rust/ast/rust-expr.h
+++ b/gcc/rust/ast/rust-expr.h
@@ -4743,6 +4743,12 @@ struct InlineAsmRegOrRegClass
std::string Symbol;
};
+ Type type;
+ union
+ {
+ struct Reg reg;
+ struct RegClass regClass;
+ };
Identifier name;
location_t locus;
};
diff --git a/gcc/rust/checks/errors/borrowck/ffi-polonius/Cargo.lock b/gcc/rust/checks/errors/borrowck/ffi-polonius/Cargo.lock
new file mode 100644
index 0000000..55cc711
--- /dev/null
+++ b/gcc/rust/checks/errors/borrowck/ffi-polonius/Cargo.lock
@@ -0,0 +1,39 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "datafrog"
+version = "2.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a0afaad2b26fa326569eb264b1363e8ae3357618c43982b3f285f0774ce76b69"
+
+[[package]]
+name = "ffi-polonius"
+version = "0.1.0"
+dependencies = [
+ "polonius-engine",
+]
+
+[[package]]
+name = "log"
+version = "0.4.21"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
+
+[[package]]
+name = "polonius-engine"
+version = "0.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4e8e505342045d397d0b6674dcb82d6faf5cf40484d30eeb88fc82ef14e903f"
+dependencies = [
+ "datafrog",
+ "log",
+ "rustc-hash",
+]
+
+[[package]]
+name = "rustc-hash"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc b/gcc/rust/expand/rust-macro-builtins-asm.cc
index 68a617a..f6940ff 100644
--- a/gcc/rust/expand/rust-macro-builtins-asm.cc
+++ b/gcc/rust/expand/rust-macro-builtins-asm.cc
@@ -125,6 +125,53 @@ parse_clobber_abi (Parser<MacroInvocLexer> &parser, TokenId last_token_id,
return 0;
}
+int
+parse_reg (Parser<MacroInvocLexer> &parser, TokenId last_token_id,
+ AST::InlineAsm &inlineAsm, bool is_explicit)
+{
+ if (!parser.skip_token (LEFT_PAREN))
+ {
+ // TODO: we expect a left parenthesis here, please return the correct
+ // error.
+ return 0;
+ }
+
+ // after successful left parenthesis parsing, we should return ast of
+ // InlineAsmRegOrRegClass of reg or reg class
+ auto token = parser.peek_current_token ();
+ auto tok_id = token->get_id ();
+
+ if (tok_id == IDENTIFIER)
+ {
+ // construct a InlineAsmRegOrRegClass
+ }
+ else if (tok_id == STRING_LITERAL)
+ {
+ // TODO: there is STRING_LITERAL, and BYTE_STRING_LITERAL, should we check
+ // for both?
+
+ // construct a InlineAsmRegOrRegClass
+ }
+ else
+ {
+ // TODO
+ }
+ if (!parser.skip_token (RIGHT_PAREN))
+ {
+ // we expect a left parenthesis here, please return the correct error.
+ return 0;
+ }
+
+ return 0;
+}
+
+int
+parse_operand (Parser<MacroInvocLexer> &parser, TokenId last_token_id,
+ AST::InlineAsm &inlineAsm)
+{
+ return 0;
+}
+
void
check_and_set (Parser<MacroInvocLexer> &parser, AST::InlineAsm &inlineAsm,
AST::InlineAsmOptions option)
@@ -340,7 +387,7 @@ parseAsmArg (Parser<MacroInvocLexer> &parser, TokenId last_token_id,
return 0;
}
-static tl::optional<AST::Fragment>
+tl::optional<AST::Fragment>
parse_asm (location_t invoc_locus, AST::MacroInvocData &invoc,
bool is_global_asm)
{