On 5/29/25 6:46 AM, Alfie Richards wrote:
This is a reimplementation of get_target_clone_attr_len,
get_attr_str, and separate_attrs using string_slice and auto_vec to make
memory management and use simpler.
Adds get_target_version helper function to get the target_version string
from a decl.
gcc/c-family/ChangeLog:
* c-attribs.cc (handle_target_clones_attribute): Change to use
get_clone_versions.
gcc/ChangeLog:
* tree.cc (get_clone_versions): New function.
(get_clone_attr_versions): New function.
(get_version): New function.
* tree.h (get_clone_versions): New function.
(get_clone_attr_versions): New function.
(get_target_version): New function.
---
gcc/c-family/c-attribs.cc | 4 ++-
gcc/tree.cc | 59 +++++++++++++++++++++++++++++++++++++++
gcc/tree.h | 11 ++++++++
3 files changed, 73 insertions(+), 1 deletion(-)
diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc
index 5a0e3d328ba..5dff489fcca 100644
--- a/gcc/c-family/c-attribs.cc
+++ b/gcc/c-family/c-attribs.cc
@@ -6132,7 +6132,9 @@ handle_target_clones_attribute (tree *node, tree name,
tree ARG_UNUSED (args),
}
}
- if (get_target_clone_attr_len (args) == -1)
+ auto_vec<string_slice> versions= get_clone_attr_versions (args, NULL);
Nit. Space before the equals sign.
OK for the trunk. It looks like this could go forward now rather than
waiting for full kit approval, but you know the inter-dependencies of
the kit better than I.
jeff