gccrs: Add crate_name and crate_type to attribute values

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>
This commit is contained in:
Pierre-Emmanuel Patry
2026-02-10 13:56:08 +01:00
committed by Arthur Cohen
parent 7459c47d42
commit b6bfe68e0c
2 changed files with 3 additions and 1 deletions

View 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);

View 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";