https://gcc.gnu.org/g:2c883bb004c08cef9bf01f90cf39108e14dd98b5

commit r15-8582-g2c883bb004c08cef9bf01f90cf39108e14dd98b5
Author: Arthur Cohen <arthur.co...@embecosm.com>
Date:   Wed Dec 18 12:20:27 2024 +0100

    gccrs: lang-items: Collect trait functions that are lang items
    
    gcc/rust/ChangeLog:
    
            * ast/rust-collect-lang-items.cc (CollectLangItems::visit): Add 
visitor for collecting
            functions that might be lang items.
            * ast/rust-collect-lang-items.h: Likewise.

Diff:
---
 gcc/rust/ast/rust-collect-lang-items.cc | 8 ++++++++
 gcc/rust/ast/rust-collect-lang-items.h  | 1 +
 2 files changed, 9 insertions(+)

diff --git a/gcc/rust/ast/rust-collect-lang-items.cc 
b/gcc/rust/ast/rust-collect-lang-items.cc
index 308720ae69ab..50d134a429f5 100644
--- a/gcc/rust/ast/rust-collect-lang-items.cc
+++ b/gcc/rust/ast/rust-collect-lang-items.cc
@@ -82,5 +82,13 @@ CollectLangItems::visit (AST::TraitItemType &item)
   DefaultASTVisitor::visit (item);
 }
 
+void
+CollectLangItems::visit (AST::Function &item)
+{
+  maybe_add_lang_item (item);
+
+  DefaultASTVisitor::visit (item);
+}
+
 } // namespace AST
 } // namespace Rust
diff --git a/gcc/rust/ast/rust-collect-lang-items.h 
b/gcc/rust/ast/rust-collect-lang-items.h
index 552648f04eda..1d021b1d9c50 100644
--- a/gcc/rust/ast/rust-collect-lang-items.h
+++ b/gcc/rust/ast/rust-collect-lang-items.h
@@ -47,6 +47,7 @@ public:
 
   void visit (AST::Trait &item) override;
   void visit (AST::TraitItemType &item) override;
+  void visit (AST::Function &item) override;
 
 private:
   template <typename T> void maybe_add_lang_item (const T &item);

Reply via email to