Skip to content

Commit

Permalink
gcc/rust/ChangeLog:
Browse files Browse the repository at this point in the history
	* 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 <[email protected]>
  • Loading branch information
saeitoshi-10 committed Jan 1, 2025
1 parent 6205877 commit 0030d01
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 1 addition & 6 deletions gcc/rust/ast/rust-collect-lang-items.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ());
Expand Down
8 changes: 8 additions & 0 deletions gcc/rust/util/rust-attributes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions gcc/rust/util/rust-attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0030d01

Please sign in to comment.