https://gcc.gnu.org/g:591e01d35957ab3e2a8082e0f2ef6e855683aa16

commit 591e01d35957ab3e2a8082e0f2ef6e855683aa16
Author: Alfie Richards <alfie.richa...@arm.com>
Date:   Fri Jan 31 10:49:42 2025 +0000

    Change make_attribute to take string_slice.
    
    gcc/ChangeLog:
    
            * attribs.cc (make_attribute): Change arguments.
            * attribs.h (make_attribute): Change arguments.

Diff:
---
 gcc/attribs.cc | 18 ++++++------------
 gcc/attribs.h  |  2 +-
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/gcc/attribs.cc b/gcc/attribs.cc
index f6667839c013..37d6ce0f9161 100644
--- a/gcc/attribs.cc
+++ b/gcc/attribs.cc
@@ -1072,25 +1072,19 @@ apply_tm_attr (tree fndecl, tree attr)
   decl_attributes (&TREE_TYPE (fndecl), tree_cons (attr, NULL, NULL), 0);
 }
 
-/* Makes a function attribute of the form NAME(ARG_NAME) and chains
+/* Makes a function attribute of the form NAME (ARG_NAME) and chains
    it to CHAIN.  */
 
 tree
-make_attribute (const char *name, const char *arg_name, tree chain)
+make_attribute (string_slice name, string_slice arg_name, tree chain)
 {
-  tree attr_name;
-  tree attr_arg_name;
-  tree attr_args;
-  tree attr;
-
-  attr_name = get_identifier (name);
-  attr_arg_name = build_string (strlen (arg_name), arg_name);
-  attr_args = tree_cons (NULL_TREE, attr_arg_name, NULL_TREE);
-  attr = tree_cons (attr_name, attr_args, chain);
+  tree attr_name = get_identifier_with_length (name.begin (), name.size ());
+  tree attr_arg_name = build_string (arg_name.size (), arg_name.begin ());
+  tree attr_args = tree_cons (NULL_TREE, attr_arg_name, NULL_TREE);
+  tree attr = tree_cons (attr_name, attr_args, chain);
   return attr;
 }
 
-
 /* Common functions used for target clone support.  */
 
 /* Comparator function to be used in qsort routine to sort attribute
diff --git a/gcc/attribs.h b/gcc/attribs.h
index 4b946390f76b..b8b6838599cc 100644
--- a/gcc/attribs.h
+++ b/gcc/attribs.h
@@ -45,7 +45,7 @@ extern bool cxx11_attribute_p (const_tree);
 extern tree get_attribute_name (const_tree);
 extern tree get_attribute_namespace (const_tree);
 extern void apply_tm_attr (tree, tree);
-extern tree make_attribute (const char *, const char *, tree);
+extern tree make_attribute (string_slice, string_slice, tree);
 extern bool attribute_ignored_p (tree);
 extern bool attribute_ignored_p (const attribute_spec *const);
 extern bool any_nonignored_attribute_p (tree);

Reply via email to