Import libcxxrt master 8a853717e61d5d55cbdf74d9d0a7545da5d5ff92.

Interesting fixes which were not already merged:
0c7c611 Merge C++ demangler bug fixes from ELF Tool Chain (#40)
2b208d9 __cxa_demangle_gnu3: demangle 'z' as '...', not 'ellipsis' (#41)

MFC after:	3 days
This commit is contained in:
Dimitry Andric 2017-03-25 13:17:48 +00:00
commit 4a1f3708f7

View File

@ -846,7 +846,7 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata,
free(buf); free(buf);
++e_idx; ++e_idx;
break; break;
}; }
--idx; --idx;
} }
@ -1007,7 +1007,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata)
return (cpp_demangle_push_str(ddata, "true", 4)); return (cpp_demangle_push_str(ddata, "true", 4));
default: default:
return (0); return (0);
}; }
case 'd': case 'd':
++ddata->cur; ++ddata->cur;
@ -1057,7 +1057,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata)
default: default:
return (0); return (0);
}; }
} }
static int static int
@ -1332,14 +1332,14 @@ cpp_demangle_read_expression(struct cpp_demangle_data *ddata)
/* operator sizeof */ /* operator sizeof */
ddata->cur += 2; ddata->cur += 2;
return (cpp_demangle_read_expression_unary(ddata, "sizeof", 6)); return (cpp_demangle_read_expression_unary(ddata, "sizeof", 6));
}; }
switch (*ddata->cur) { switch (*ddata->cur) {
case 'L': case 'L':
return (cpp_demangle_read_expr_primary(ddata)); return (cpp_demangle_read_expr_primary(ddata));
case 'T': case 'T':
return (cpp_demangle_read_tmpl_param(ddata)); return (cpp_demangle_read_tmpl_param(ddata));
}; }
return (0); return (0);
} }
@ -1555,11 +1555,13 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
if (!cpp_demangle_push_str(ddata, if (!cpp_demangle_push_str(ddata,
"non-transaction clone for ", 26)) "non-transaction clone for ", 26))
return (0); return (0);
break;
case 't': case 't':
default: default:
if (!cpp_demangle_push_str(ddata, if (!cpp_demangle_push_str(ddata,
"transaction clone for ", 22)) "transaction clone for ", 22))
return (0); return (0);
break;
} }
++ddata->cur; ++ddata->cur;
return (cpp_demangle_read_encoding(ddata)); return (cpp_demangle_read_encoding(ddata));
@ -1712,7 +1714,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata)
if (*ddata->cur == '\0') if (*ddata->cur == '\0')
return (0); return (0);
break; break;
}; }
return (cpp_demangle_read_name(ddata)); return (cpp_demangle_read_name(ddata));
} }
@ -1784,7 +1786,7 @@ cpp_demangle_read_name(struct cpp_demangle_data *ddata)
return (cpp_demangle_read_nested_name(ddata)); return (cpp_demangle_read_nested_name(ddata));
case 'Z': case 'Z':
return (cpp_demangle_read_local_name(ddata)); return (cpp_demangle_read_local_name(ddata));
}; }
if (!vector_str_init(&v)) if (!vector_str_init(&v))
return (0); return (0);
@ -1885,7 +1887,7 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
case 'K': case 'K':
ddata->mem_cst = true; ddata->mem_cst = true;
break; break;
}; }
++ddata->cur; ++ddata->cur;
} }
@ -1913,7 +1915,7 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata)
default: default:
if (!cpp_demangle_read_uqname(ddata)) if (!cpp_demangle_read_uqname(ddata))
goto clean; goto clean;
}; }
if ((subst_str = vector_str_substr(output, p_idx, if ((subst_str = vector_str_substr(output, p_idx,
output->size - 1, &subst_str_len)) == NULL) output->size - 1, &subst_str_len)) == NULL)
@ -2188,35 +2190,35 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('S', 'd'): case SIMPLE_HASH('S', 'd'):
/* std::basic_iostream<char, std::char_traits<char> > */ /* std::basic_iostream<char, std::char_traits<char> > */
if (!cpp_demangle_push_str(ddata, "std::iostream", 19)) if (!cpp_demangle_push_str(ddata, "std::basic_iostream", 19))
return (0); return (0);
ddata->last_sname = "iostream"; ddata->last_sname = "basic_iostream";
ddata->cur += 2; ddata->cur += 2;
if (*ddata->cur == 'I') if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata, return (cpp_demangle_read_subst_stdtmpl(ddata,
"std::iostream", 19)); "std::basic_iostream", 19));
return (1); return (1);
case SIMPLE_HASH('S', 'i'): case SIMPLE_HASH('S', 'i'):
/* std::basic_istream<char, std::char_traits<char> > */ /* std::basic_istream<char, std::char_traits<char> > */
if (!cpp_demangle_push_str(ddata, "std::istream", 18)) if (!cpp_demangle_push_str(ddata, "std::basic_istream", 18))
return (0); return (0);
ddata->last_sname = "istream"; ddata->last_sname = "basic_istream";
ddata->cur += 2; ddata->cur += 2;
if (*ddata->cur == 'I') if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata, return (cpp_demangle_read_subst_stdtmpl(ddata,
"std::istream", 18)); "std::basic_istream", 18));
return (1); return (1);
case SIMPLE_HASH('S', 'o'): case SIMPLE_HASH('S', 'o'):
/* std::basic_ostream<char, std::char_traits<char> > */ /* std::basic_ostream<char, std::char_traits<char> > */
if (!cpp_demangle_push_str(ddata, "std::ostream", 18)) if (!cpp_demangle_push_str(ddata, "std::basic_ostream", 18))
return (0); return (0);
ddata->last_sname = "istream"; ddata->last_sname = "basic_ostream";
ddata->cur += 2; ddata->cur += 2;
if (*ddata->cur == 'I') if (*ddata->cur == 'I')
return (cpp_demangle_read_subst_stdtmpl(ddata, return (cpp_demangle_read_subst_stdtmpl(ddata,
"std::ostream", 18)); "std::basic_ostream", 18));
return (1); return (1);
case SIMPLE_HASH('S', 's'): case SIMPLE_HASH('S', 's'):
@ -2238,7 +2240,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata)
case SIMPLE_HASH('S', 't'): case SIMPLE_HASH('S', 't'):
/* std:: */ /* std:: */
return (cpp_demangle_read_subst_std(ddata)); return (cpp_demangle_read_subst_std(ddata));
}; }
if (*(++ddata->cur) == '\0') if (*(++ddata->cur) == '\0')
return (0); return (0);
@ -2386,7 +2388,7 @@ cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *ddata)
return (cpp_demangle_read_expr_primary(ddata)); return (cpp_demangle_read_expr_primary(ddata));
case 'X': case 'X':
return (cpp_demangle_read_expression(ddata)); return (cpp_demangle_read_expression(ddata));
}; }
return (cpp_demangle_read_type(ddata, 0)); return (cpp_demangle_read_type(ddata, 0));
} }
@ -2863,11 +2865,11 @@ cpp_demangle_read_type(struct cpp_demangle_data *ddata, int delimit)
case 'z': case 'z':
/* ellipsis */ /* ellipsis */
if (!cpp_demangle_push_str(ddata, "ellipsis", 8)) if (!cpp_demangle_push_str(ddata, "...", 3))
goto clean; goto clean;
++ddata->cur; ++ddata->cur;
goto rtn; goto rtn;
}; }
if (!cpp_demangle_read_name(ddata)) if (!cpp_demangle_read_name(ddata))
goto clean; goto clean;
@ -3331,7 +3333,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
return (0); return (0);
ddata->cur += 2; ddata->cur += 2;
return (1); return (1);
}; }
/* vendor extened operator */ /* vendor extened operator */
if (*ddata->cur == 'v' && ELFTC_ISDIGIT(*(ddata->cur + 1))) { if (*ddata->cur == 'v' && ELFTC_ISDIGIT(*(ddata->cur + 1))) {
@ -3377,7 +3379,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata)
return (0); return (0);
ddata->cur +=2; ddata->cur +=2;
return (1); return (1);
}; }
/* source name */ /* source name */
if (ELFTC_ISDIGIT(*ddata->cur) != 0) if (ELFTC_ISDIGIT(*ddata->cur) != 0)
@ -3740,7 +3742,7 @@ hex_to_dec(char c)
return (15); return (15);
default: default:
return (-1); return (-1);
}; }
} }
static void static void