From: jjasmine <[email protected]>
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.
---
gcc/rust/ast/rust-ast-collector.cc | 5 +++++
gcc/rust/ast/rust-ast-collector.h | 2 +-
gcc/rust/ast/rust-ast-visitor.cc | 6 ++++++
gcc/rust/ast/rust-ast-visitor.h | 5 +++--
.../errors/borrowck/rust-bir-builder-struct.h | 1 +
.../errors/borrowck/rust-function-collector.h | 1 +
gcc/rust/checks/errors/rust-const-checker.cc | 4 ++++
gcc/rust/checks/errors/rust-const-checker.h | 2 ++
gcc/rust/expand/rust-derive.h | 1 +
gcc/rust/expand/rust-macro-builtins-asm.cc | 19 +++++++++++++++++--
gcc/rust/hir/rust-hir-dump.cc | 5 +++++
gcc/rust/hir/rust-hir-dump.h | 1 +
gcc/rust/hir/tree/rust-hir-visitor.h | 3 ++-
gcc/rust/resolve/rust-ast-resolve-base.cc | 4 ++++
gcc/rust/resolve/rust-ast-resolve-base.h | 1 +
15 files changed, 54 insertions(+), 6 deletions(-)
diff --git a/gcc/rust/ast/rust-ast-collector.cc
b/gcc/rust/ast/rust-ast-collector.cc
index bc8bc9caabe..f1d5c8c6c32 100644
--- a/gcc/rust/ast/rust-ast-collector.cc
+++ b/gcc/rust/ast/rust-ast-collector.cc
@@ -18,6 +18,7 @@
#include "rust-ast-collector.h"
#include "rust-ast.h"
#include "rust-diagnostics.h"
+#include "rust-expr.h"
#include "rust-item.h"
#include "rust-keyword-values.h"
#include "rust-token.h"
@@ -1511,6 +1512,10 @@ TokenCollector::visit (AsyncBlockExpr &expr)
visit (expr.get_block_expr ());
}
+void
+TokenCollector::visit (InlineAsm &expr)
+{}
+
// rust-item.h
void
diff --git a/gcc/rust/ast/rust-ast-collector.h
b/gcc/rust/ast/rust-ast-collector.h
index 7b418bb6d31..b2dc41b4318 100644
--- a/gcc/rust/ast/rust-ast-collector.h
+++ b/gcc/rust/ast/rust-ast-collector.h
@@ -303,7 +303,7 @@ public:
void visit (MatchExpr &expr);
void visit (AwaitExpr &expr);
void visit (AsyncBlockExpr &expr);
-
+ void visit (InlineAsm &expr);
// rust-item.h
void visit (TypeParam ¶m);
void visit (LifetimeWhereClauseItem &item);
diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc
index 2c1674e21ea..c4abf2ea870 100644
--- a/gcc/rust/ast/rust-ast-visitor.cc
+++ b/gcc/rust/ast/rust-ast-visitor.cc
@@ -662,6 +662,12 @@ DefaultASTVisitor::visit (AST::AsyncBlockExpr &expr)
visit (expr.get_block_expr ());
}
+void
+DefaultASTVisitor::visit (AST::InlineAsm &expr)
+{
+ rust_unreachable ();
+}
+
void
DefaultASTVisitor::visit (AST::TypeParam ¶m)
{
diff --git a/gcc/rust/ast/rust-ast-visitor.h b/gcc/rust/ast/rust-ast-visitor.h
index d91ef3da93e..2f56d89c582 100644
--- a/gcc/rust/ast/rust-ast-visitor.h
+++ b/gcc/rust/ast/rust-ast-visitor.h
@@ -23,7 +23,6 @@
// full include not required - only forward decls
#include "rust-ast-full-decls.h"
#include "rust-ast.h"
-#include "rust-expr.h"
#include "rust-item.h"
#include "rust-system.h"
@@ -129,7 +128,7 @@ public:
virtual void visit (MatchExpr &expr) = 0;
virtual void visit (AwaitExpr &expr) = 0;
virtual void visit (AsyncBlockExpr &expr) = 0;
- virtual void visit (InlineAsm &expr) { rust_unreachable (); }
+ virtual void visit (InlineAsm &expr) = 0;
// rust-item.h
virtual void visit (TypeParam ¶m) = 0;
@@ -313,6 +312,8 @@ protected:
virtual void visit (AST::MatchExpr &expr) override;
virtual void visit (AST::AwaitExpr &expr) override;
virtual void visit (AST::AsyncBlockExpr &expr) override;
+ virtual void visit (InlineAsm &expr) override;
+
virtual void visit (AST::TypeParam ¶m) override;
virtual void visit (AST::LifetimeWhereClauseItem &item) override;
virtual void visit (AST::TypeBoundWhereClauseItem &item) override;
diff --git a/gcc/rust/checks/errors/borrowck/rust-bir-builder-struct.h
b/gcc/rust/checks/errors/borrowck/rust-bir-builder-struct.h
index 17331ddc826..53346bfe737 100644
--- a/gcc/rust/checks/errors/borrowck/rust-bir-builder-struct.h
+++ b/gcc/rust/checks/errors/borrowck/rust-bir-builder-struct.h
@@ -154,6 +154,7 @@ protected:
void visit (HIR::MatchExpr &expr) override { rust_unreachable (); }
void visit (HIR::AwaitExpr &expr) override { rust_unreachable (); }
void visit (HIR::AsyncBlockExpr &expr) override { rust_unreachable (); }
+ void visit (HIR::InlineAsm &expr) override { rust_unreachable (); }
void visit (HIR::TypeParam ¶m) override { rust_unreachable (); }
void visit (HIR::ConstGenericParam ¶m) override { rust_unreachable (); }
void visit (HIR::LifetimeWhereClauseItem &item) override
diff --git a/gcc/rust/checks/errors/borrowck/rust-function-collector.h
b/gcc/rust/checks/errors/borrowck/rust-function-collector.h
index 990534fed94..51109d7dbdc 100644
--- a/gcc/rust/checks/errors/borrowck/rust-function-collector.h
+++ b/gcc/rust/checks/errors/borrowck/rust-function-collector.h
@@ -124,6 +124,7 @@ public:
void visit (HIR::MatchExpr &expr) override {}
void visit (HIR::AwaitExpr &expr) override {}
void visit (HIR::AsyncBlockExpr &expr) override {}
+ void visit (HIR::InlineAsm &expr) override {}
void visit (HIR::TypeParam ¶m) override {}
void visit (HIR::ConstGenericParam ¶m) override {}
void visit (HIR::LifetimeWhereClauseItem &item) override {}
diff --git a/gcc/rust/checks/errors/rust-const-checker.cc
b/gcc/rust/checks/errors/rust-const-checker.cc
index 8c12012b33f..2beee210279 100644
--- a/gcc/rust/checks/errors/rust-const-checker.cc
+++ b/gcc/rust/checks/errors/rust-const-checker.cc
@@ -534,6 +534,10 @@ ConstChecker::visit (AsyncBlockExpr &)
// TODO: Visit block expression
}
+void
+ConstChecker::visit (InlineAsm &)
+{}
+
void
ConstChecker::visit (TypeParam &)
{}
diff --git a/gcc/rust/checks/errors/rust-const-checker.h
b/gcc/rust/checks/errors/rust-const-checker.h
index 8b9df0ec9d4..8890761e61d 100644
--- a/gcc/rust/checks/errors/rust-const-checker.h
+++ b/gcc/rust/checks/errors/rust-const-checker.h
@@ -133,6 +133,8 @@ private:
virtual void visit (MatchExpr &expr) override;
virtual void visit (AwaitExpr &expr) override;
virtual void visit (AsyncBlockExpr &expr) override;
+ virtual void visit (InlineAsm &expr) override;
+
virtual void visit (TypeParam ¶m) override;
virtual void visit (ConstGenericParam ¶m) override;
virtual void visit (LifetimeWhereClauseItem &item) override;
diff --git a/gcc/rust/expand/rust-derive.h b/gcc/rust/expand/rust-derive.h
index c92f9c07f28..1924432d8ed 100644
--- a/gcc/rust/expand/rust-derive.h
+++ b/gcc/rust/expand/rust-derive.h
@@ -143,6 +143,7 @@ private:
virtual void visit (MatchExpr &expr) override final{};
virtual void visit (AwaitExpr &expr) override final{};
virtual void visit (AsyncBlockExpr &expr) override final{};
+ virtual void visit (InlineAsm &expr) override final{};
virtual void visit (TypeParam ¶m) override final{};
virtual void visit (LifetimeWhereClauseItem &item) override final{};
virtual void visit (TypeBoundWhereClauseItem &item) override final{};
diff --git a/gcc/rust/expand/rust-macro-builtins-asm.cc
b/gcc/rust/expand/rust-macro-builtins-asm.cc
index 55ba95a7331..b666fad34e2 100644
--- a/gcc/rust/expand/rust-macro-builtins-asm.cc
+++ b/gcc/rust/expand/rust-macro-builtins-asm.cc
@@ -263,8 +263,23 @@ parse_reg_operand (Parser<MacroInvocLexer> &parser,
TokenId last_token_id,
}
else if (!is_global_asm && check_identifier (parser, "out"))
{
- rust_unreachable ();
- return tl::nullopt;
+ rust_debug ("Enter parse_reg_operand out");
+
+ auto reg = parse_reg (parser, last_token_id, inline_asm_ctx);
+
+ auto expr = parse_format_string (parser, last_token_id, inline_asm_ctx);
+ reg_operand.register_type = AST::InlineAsmOperand::RegisterType::Out;
+
+ // Since reg is of type optional<T>, we need to check if it is not
+ // optional first.
+ // TODO: We don't throw any errors since we should have throw any
+ // encountered parsing error in parse_reg
+ if (reg)
+ {
+ reg_operand.in.reg = reg.value ();
+ }
+
+ return reg_operand;
}
else if (!is_global_asm && check_identifier (parser, "lateout"))
{
diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc
index 567c4f38004..f0fd9141f5e 100644
--- a/gcc/rust/hir/rust-hir-dump.cc
+++ b/gcc/rust/hir/rust-hir-dump.cc
@@ -24,6 +24,7 @@
#include "rust-hir.h"
#include <string>
#include "rust-attribute-values.h"
+#include "tree/rust-hir-expr.h"
namespace Rust {
namespace HIR {
@@ -1470,6 +1471,10 @@ Dump::visit (AsyncBlockExpr &e)
end ("AsyncBlockExpr");
}
+void
+Dump::visit (InlineAsm &e)
+{}
+
void
Dump::visit (TypeParam &e)
{
diff --git a/gcc/rust/hir/rust-hir-dump.h b/gcc/rust/hir/rust-hir-dump.h
index 51273c1203f..bb5c3606b51 100644
--- a/gcc/rust/hir/rust-hir-dump.h
+++ b/gcc/rust/hir/rust-hir-dump.h
@@ -166,6 +166,7 @@ private:
virtual void visit (MatchExpr &) override;
virtual void visit (AwaitExpr &) override;
virtual void visit (AsyncBlockExpr &) override;
+ virtual void visit (InlineAsm &) override;
virtual void visit (TypeParam &) override;
virtual void visit (ConstGenericParam &) override;
diff --git a/gcc/rust/hir/tree/rust-hir-visitor.h
b/gcc/rust/hir/tree/rust-hir-visitor.h
index be1414905fa..72609f4c850 100644
--- a/gcc/rust/hir/tree/rust-hir-visitor.h
+++ b/gcc/rust/hir/tree/rust-hir-visitor.h
@@ -86,7 +86,7 @@ public:
virtual void visit (MatchExpr &expr) = 0;
virtual void visit (AwaitExpr &expr) = 0;
virtual void visit (AsyncBlockExpr &expr) = 0;
- virtual void visit (InlineAsm &expr) {}
+ virtual void visit (InlineAsm &expr) = 0;
virtual void visit (TypeParam ¶m) = 0;
virtual void visit (ConstGenericParam ¶m) = 0;
virtual void visit (LifetimeWhereClauseItem &item) = 0;
@@ -225,6 +225,7 @@ public:
virtual void visit (MatchExpr &) override {}
virtual void visit (AwaitExpr &) override {}
virtual void visit (AsyncBlockExpr &) override {}
+ virtual void visit (InlineAsm &) override {}
virtual void visit (TypeParam &) override {}
virtual void visit (ConstGenericParam &) override {}
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.cc
b/gcc/rust/resolve/rust-ast-resolve-base.cc
index 66ce5bfa35a..69f146c48f2 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-base.cc
@@ -322,6 +322,10 @@ void
ResolverBase::visit (AST::AsyncBlockExpr &)
{}
+void
+ResolverBase::visit (AST::InlineAsm &)
+{}
+
void
ResolverBase::visit (AST::TypeParam &)
{}
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.h
b/gcc/rust/resolve/rust-ast-resolve-base.h
index 46bcac6ec8e..0d497f81eac 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.h
+++ b/gcc/rust/resolve/rust-ast-resolve-base.h
@@ -104,6 +104,7 @@ public:
void visit (AST::MatchExpr &);
void visit (AST::AwaitExpr &);
void visit (AST::AsyncBlockExpr &);
+ void visit (AST::InlineAsm &);
void visit (AST::TypeParam &);
--
2.45.2