]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Add crate_name and crate_type to attribute values
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 10 Feb 2026 12:56:08 +0000 (13:56 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Fri, 20 Mar 2026 17:10:37 +0000 (18:10 +0100)
gcc/rust/ChangeLog:

* rust-session-manager.cc (Session::handle_crate_name): Use the new
constexpr instead of a raw string value.
* util/rust-attribute-values.h: Add crate_name and crate_type values.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/rust-session-manager.cc
gcc/rust/util/rust-attribute-values.h

index cf3237ccd71162016d66d8fd6748d95d92c9e159..a74b99754b83dcf0875cda47b5e519cae7c7f408 100644 (file)
@@ -476,7 +476,7 @@ Session::handle_crate_name (const char *filename,
 
   for (const auto &attr : parsed_crate.inner_attrs)
     {
-      if (attr.get_path () != "crate_name")
+      if (attr.get_path () != Values::Attributes::CRATE_NAME)
        continue;
 
       auto msg_str = Analysis::Attributes::extract_string_literal (attr);
index 34e938025b8fab9e9802b33c575a2125ec9c0022..f4146b8802a544ae9914fe9d77f3a2841803a186 100644 (file)
@@ -50,6 +50,8 @@ public:
   static constexpr auto &PROC_MACRO = "proc_macro";
   static constexpr auto &PROC_MACRO_DERIVE = "proc_macro_derive";
   static constexpr auto &PROC_MACRO_ATTRIBUTE = "proc_macro_attribute";
+  static constexpr auto &CRATE_NAME = "crate_name";
+  static constexpr auto &CRATE_TYPE = "crate_type";
 
   static constexpr auto &TARGET_FEATURE = "target_feature";
   static constexpr auto &FEATURE = "feature";