aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c60
1 files changed, 26 insertions, 34 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 9a8f5e5..8ca7211 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -9747,40 +9747,32 @@ clean_symbol_name (char *p)
*p = '_';
}
-/* For anonymous aggregate types, we need some sort of name to
- hold on to. In practice, this should not appear, but it should
- not be harmful if it does. */
-bool
-anon_aggrname_p(const_tree id_node)
-{
-#ifndef NO_DOT_IN_LABEL
- return (IDENTIFIER_POINTER (id_node)[0] == '.'
- && IDENTIFIER_POINTER (id_node)[1] == '_');
-#else /* NO_DOT_IN_LABEL */
-#ifndef NO_DOLLAR_IN_LABEL
- return (IDENTIFIER_POINTER (id_node)[0] == '$' \
- && IDENTIFIER_POINTER (id_node)[1] == '_');
-#else /* NO_DOLLAR_IN_LABEL */
-#define ANON_AGGRNAME_PREFIX "__anon_"
- return (!strncmp (IDENTIFIER_POINTER (id_node), ANON_AGGRNAME_PREFIX,
- sizeof (ANON_AGGRNAME_PREFIX) - 1));
-#endif /* NO_DOLLAR_IN_LABEL */
-#endif /* NO_DOT_IN_LABEL */
-}
-
-/* Return a format for an anonymous aggregate name. */
-const char *
-anon_aggrname_format()
-{
-#ifndef NO_DOT_IN_LABEL
- return "._%d";
-#else /* NO_DOT_IN_LABEL */
-#ifndef NO_DOLLAR_IN_LABEL
- return "$_%d";
-#else /* NO_DOLLAR_IN_LABEL */
- return "__anon_%d";
-#endif /* NO_DOLLAR_IN_LABEL */
-#endif /* NO_DOT_IN_LABEL */
+static GTY(()) unsigned anon_cnt = 0; /* Saved for PCH. */
+
+/* Create a unique anonymous identifier. The identifier is still a
+ valid assembly label. */
+
+tree
+make_anon_name ()
+{
+ const char *fmt =
+#if !defined (NO_DOT_IN_LABEL)
+ "."
+#elif !defined (NO_DOLLAR_IN_LABEL)
+ "$"
+#else
+ "_"
+#endif
+ "_anon_%d";
+
+ char buf[24];
+ int len = snprintf (buf, sizeof (buf), fmt, anon_cnt++);
+ gcc_checking_assert (len < int (sizeof (buf)));
+
+ tree id = get_identifier_with_length (buf, len);
+ IDENTIFIER_ANON_P (id) = true;
+
+ return id;
}
/* Generate a name for a special-purpose function.