gccrs: lang-item: Add LangItem::PrettyString

Which formats a lang item as it appears in source code.

gcc/rust/ChangeLog:

	* util/rust-lang-item.cc (LangItem::PrettyString): New.
	* util/rust-lang-item.h: New.
This commit is contained in:
Arthur Cohen
2024-12-26 22:45:12 +00:00
parent 88aeeccaca
commit 5702b0a24e
2 changed files with 7 additions and 0 deletions

View File

@@ -118,6 +118,12 @@ LangItem::ToString (LangItem::Kind type)
return str.value ();
}
std::string
LangItem::PrettyString (LangItem::Kind type)
{
return "#[lang = \"" + LangItem::ToString (type) + "\"]";
}
LangItem::Kind
LangItem::OperatorToLangItem (ArithmeticOrLogicalOperator op)
{

View File

@@ -134,6 +134,7 @@ public:
static tl::optional<Kind> Parse (const std::string &item);
static std::string ToString (Kind type);
static std::string PrettyString (Kind type);
static Kind OperatorToLangItem (ArithmeticOrLogicalOperator op);
static Kind
CompoundAssignmentOperatorToLangItem (ArithmeticOrLogicalOperator op);