diff options
author | Jing Yu <jingyu@google.com> | 2012-02-15 15:40:16 -0800 |
---|---|---|
committer | Jing Yu <jingyu@google.com> | 2012-02-15 15:40:16 -0800 |
commit | 3f73d6ef90458b45bbbb33ef4c2b174d4662a22d (patch) | |
tree | 1b5f0d96c51b51168b3713058a1b62e92f1136eb /gcc-4.6/libiberty/cp-demangle.c | |
parent | d7030123e04baab5dbff9c9ee04c0de99bd9a774 (diff) | |
download | toolchain_gcc-3f73d6ef90458b45bbbb33ef4c2b174d4662a22d.zip toolchain_gcc-3f73d6ef90458b45bbbb33ef4c2b174d4662a22d.tar.gz toolchain_gcc-3f73d6ef90458b45bbbb33ef4c2b174d4662a22d.tar.bz2 |
Sync down FSF r184235@google/gcc-4_6_2-mobile branch
1) Get mostly new patches from FSF gcc-4.6 branch
2) Fix PR52129
3) Insert GNU-stack note for all ARM targets
Change-Id: I2b9926981210e517e4021242908074319a91d6bd
Diffstat (limited to 'gcc-4.6/libiberty/cp-demangle.c')
-rw-r--r-- | gcc-4.6/libiberty/cp-demangle.c | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/gcc-4.6/libiberty/cp-demangle.c b/gcc-4.6/libiberty/cp-demangle.c index 7e951cc..179197c 100644 --- a/gcc-4.6/libiberty/cp-demangle.c +++ b/gcc-4.6/libiberty/cp-demangle.c @@ -419,6 +419,9 @@ static struct demangle_component *d_lambda (struct d_info *); static struct demangle_component *d_unnamed_type (struct d_info *); +static struct demangle_component * +d_clone_suffix (struct d_info *, struct demangle_component *); + static int d_add_substitution (struct d_info *, struct demangle_component *); @@ -804,6 +807,7 @@ d_make_comp (struct d_info *di, enum demangle_component_type type, case DEMANGLE_COMPONENT_LITERAL_NEG: case DEMANGLE_COMPONENT_COMPOUND_NAME: case DEMANGLE_COMPONENT_VECTOR_TYPE: + case DEMANGLE_COMPONENT_CLONE: if (left == NULL || right == NULL) return NULL; break; @@ -1036,7 +1040,7 @@ d_make_sub (struct d_info *di, const char *name, int len) return p; } -/* <mangled-name> ::= _Z <encoding> +/* <mangled-name> ::= _Z <encoding> [<clone-suffix>]* TOP_LEVEL is non-zero when called at the top level. */ @@ -1044,6 +1048,8 @@ CP_STATIC_IF_GLIBCPP_V3 struct demangle_component * cplus_demangle_mangled_name (struct d_info *di, int top_level) { + struct demangle_component *p; + if (! d_check_char (di, '_') /* Allow missing _ if not at toplevel to work around a bug in G++ abi-version=2 mangling; see the comment in @@ -1052,7 +1058,18 @@ cplus_demangle_mangled_name (struct d_info *di, int top_level) return NULL; if (! d_check_char (di, 'Z')) return NULL; - return d_encoding (di, top_level); + p = d_encoding (di, top_level); + + /* If at top level and parsing parameters, check for a clone + suffix. */ + if (top_level && (di->options & DMGL_PARAMS) != 0) + while (d_peek_char (di) == '.' + && (IS_LOWER (d_peek_next_char (di)) + || d_peek_next_char (di) == '_' + || IS_DIGIT (d_peek_next_char (di)))) + p = d_clone_suffix (di, p); + + return p; } /* Return whether a function should have a return type. The argument @@ -2346,7 +2363,7 @@ d_parmlist (struct d_info *di) struct demangle_component *type; char peek = d_peek_char (di); - if (peek == '\0' || peek == 'E') + if (peek == '\0' || peek == 'E' || peek == '.') break; type = cplus_demangle_type (di); if (type == NULL) @@ -3066,6 +3083,33 @@ d_unnamed_type (struct d_info *di) return ret; } +/* <clone-suffix> ::= [ . <clone-type-identifier> ] [ . <nonnegative number> ]* +*/ + +static struct demangle_component * +d_clone_suffix (struct d_info *di, struct demangle_component *encoding) +{ + const char *suffix = d_str (di); + const char *pend = suffix; + struct demangle_component *n; + + if (*pend == '.' && (IS_LOWER (pend[1]) || pend[1] == '_')) + { + pend += 2; + while (IS_LOWER (*pend) || *pend == '_') + ++pend; + } + while (*pend == '.' && IS_DIGIT (pend[1])) + { + pend += 2; + while (IS_DIGIT (*pend)) + ++pend; + } + d_advance (di, pend - suffix); + n = d_make_name (di, suffix, pend - suffix); + return d_make_comp (di, DEMANGLE_COMPONENT_CLONE, encoding, n); +} + /* Add a new substitution. */ static int @@ -4343,6 +4387,13 @@ d_print_comp (struct d_print_info *dpi, d_append_char (dpi, '}'); return; + case DEMANGLE_COMPONENT_CLONE: + d_print_comp (dpi, d_left (dc)); + d_append_string (dpi, " [clone "); + d_print_comp (dpi, d_right (dc)); + d_append_char (dpi, ']'); + return; + default: d_print_error (dpi); return; |