]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Remove reduntant as_string calls.
authorEnes Cevik <enes@nsvke.com>
Wed, 3 Jun 2026 09:20:32 +0000 (12:20 +0300)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 25 Jun 2026 17:21:31 +0000 (19:21 +0200)
gcc/rust/ChangeLog:

* backend/rust-compile-base.cc (HIRCompileBase::setup_fndecl):
Remove reduntant as_string calls.

Signed-off-by: Enes Cevik <enes@nsvke.com>
gcc/rust/backend/rust-compile-base.cc

index 340e2617882b5c9a3c773759daad2f494edc8ee1..f566cc07b738d7f60a45d33855fdb3e292b76679 100644 (file)
@@ -78,24 +78,19 @@ HIRCompileBase::setup_fndecl (tree fndecl, bool is_main_entry_point,
   // is it inline?
   for (const auto &attr : attrs)
     {
-      bool is_inline
-       = attr.get_path ().as_string () == Values::Attributes::INLINE;
-      bool is_must_use
-       = attr.get_path ().as_string () == Values::Attributes::MUST_USE;
-      bool is_cold = attr.get_path ().as_string () == Values::Attributes::COLD;
-      bool is_link_section
-       = attr.get_path ().as_string () == Values::Attributes::LINK_SECTION;
-      bool no_mangle
-       = attr.get_path ().as_string () == Values::Attributes::NO_MANGLE;
-      bool is_deprecated
-       = attr.get_path ().as_string () == Values::Attributes::DEPRECATED;
-      bool is_proc_macro
-       = attr.get_path ().as_string () == Values::Attributes::PROC_MACRO;
+      std::string attr_str = attr.get_path ().as_string ();
+
+      bool is_inline = attr_str == Values::Attributes::INLINE;
+      bool is_must_use = attr_str == Values::Attributes::MUST_USE;
+      bool is_cold = attr_str == Values::Attributes::COLD;
+      bool is_link_section = attr_str == Values::Attributes::LINK_SECTION;
+      bool no_mangle = attr_str == Values::Attributes::NO_MANGLE;
+      bool is_deprecated = attr_str == Values::Attributes::DEPRECATED;
+      bool is_proc_macro = attr_str == Values::Attributes::PROC_MACRO;
       bool is_proc_macro_attribute
-       = attr.get_path ().as_string ()
-         == Values::Attributes::PROC_MACRO_ATTRIBUTE;
-      bool is_proc_macro_derive = attr.get_path ().as_string ()
-                                 == Values::Attributes::PROC_MACRO_DERIVE;
+       = attr_str == Values::Attributes::PROC_MACRO_ATTRIBUTE;
+      bool is_proc_macro_derive
+       = attr_str == Values::Attributes::PROC_MACRO_DERIVE;
 
       if (is_inline)
        {