On 20 October 2018 00:26:15 CEST, Michael Ploujnikov <michael.ploujni...@oracle.com> wrote: >While working on >https://gcc.gnu.org/ml/gcc-patches/2018-09/msg00228.html I've >accumulated a few easy patches.
+/* Return decl name IDENTIFIER with string SUFFIX appended. */ + +tree +suffixed_function_name (tree identifier, const char *suffix) +{ + const char *name = IDENTIFIER_POINTER (identifier); + size_t len = strlen (name); + char *prefix; + + prefix = XALLOCAVEC (char, len + strlen (suffix) + 2); + memcpy (prefix, name, len); + prefix[len] = symbol_table::symbol_suffix_separator (); + strcpy (prefix + len + 1, suffix); + return get_identifier (prefix); +} + FWIW I think I would phrase this as char *str = concat ( IDENTIFIER_POINTER (identifier), symbol_table::symbol_suffix_separator (), suffix); tree ret = get_identifier (str); free (str); return ret;