]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: gcc/rust/ChangeLog:
authorOm Swaroop Nayak <96killerat96@gmail.com>
Wed, 1 Jan 2025 17:02:02 +0000 (09:02 -0800)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 21 Mar 2025 11:56:56 +0000 (12:56 +0100)
* ast/rust-collect-lang-items.cc (get_lang_item_attr): "removed checker fn"
* util/rust-attributes.cc (Attributes::is_lang_item): "added fn"
* util/rust-attributes.h: "added fn"

Signed-off-by: Om Swaroop Nayak <96killerat96@gmail.com>
gcc/rust/ast/rust-collect-lang-items.cc
gcc/rust/util/rust-attributes.cc
gcc/rust/util/rust-attributes.h

index 50d134a429f514171f0845cce8d8919adf7dd0c7..ec6919dca14ecf6dfd5f91b724e2bd68c7c0a95f 100644 (file)
@@ -40,12 +40,7 @@ get_lang_item_attr (const T &maybe_lang_item)
          continue;
        }
 
-      bool is_lang_item = str_path == Values::Attributes::LANG
-                         && attr.has_attr_input ()
-                         && attr.get_attr_input ().get_attr_input_type ()
-                              == AST::AttrInput::AttrInputType::LITERAL;
-
-      if (is_lang_item)
+      if (Analysis::Attributes::is_lang_item (str_path, attr))
        {
          auto &literal
            = static_cast<AST::AttrInputLiteral &> (attr.get_attr_input ());
index 9f63234112c5b3a68ea32df6217931d02f25c054..0234903ba58572feb6178e2bf51de28aa2295110 100644 (file)
@@ -37,6 +37,14 @@ Attributes::is_known (const std::string &attribute_path)
 
   return !lookup.is_error ();
 }
+bool
+Attributes::is_lang_item (const std::string &attribute_path,
+                         const AST::Attribute &attr)
+{
+  return ((attribute_path == Values::Attributes::LANG) && attr.has_attr_input ()
+         && (attr.get_attr_input ().get_attr_input_type ()
+             == AST::AttrInput::AttrInputType::LITERAL));
+}
 
 using Attrs = Values::Attributes;
 
index c928c8eb9d2629bb01a9d85b8290d77d2e9ad9f4..30f9eef213bc5eff71c5a5bf61d461da8ae47222 100644 (file)
@@ -29,6 +29,8 @@ class Attributes
 {
 public:
   static bool is_known (const std::string &attribute_path);
+  static bool is_lang_item (const std::string &attribute_path,
+                           const AST::Attribute &attr);
 };
 
 enum CompilerPass