Fix demangling template parameter packs (#414)

* Fix demangling template parameter packs

Clang 4.0.1-10 and gcc 7.3.0 both mangle the function "void add<int>(int)" as
"_Z3addIJiEEvDpT_".  The template parameter pack is of the form
J <template-arg>* E

The opening character for a param pack could be either I or J, as libiberty
follows [1].  This change simply adds the J case.

[1] fbd263526a/libiberty/cp-demangle.c (L3209)
This commit is contained in:
Thomas Anderson 2019-01-06 22:26:08 -08:00 committed by Fumitoshi Ukai
parent 0e4ce7c0c0
commit 7fcb278d1e
2 changed files with 6 additions and 1 deletions

View File

@ -1097,10 +1097,11 @@ static bool ParseTemplateArgs(State *state) {
// <template-arg> ::= <type>
// ::= <expr-primary>
// ::= I <template-arg>* E # argument pack
// ::= J <template-arg>* E # argument pack
// ::= X <expression> E
static bool ParseTemplateArg(State *state) {
State copy = *state;
if (ParseOneCharToken(state, 'I') &&
if ((ParseOneCharToken(state, 'I') || ParseOneCharToken(state, 'J')) &&
ZeroOrMore(ParseTemplateArg, state) &&
ParseOneCharToken(state, 'E')) {
return true;

View File

@ -135,3 +135,7 @@ _ZlsRSoRKSs operator<<()
_ZngILi42EEvN1AIXplT_Li2EEE1TE operator-<>()
_ZplR1XS0_ operator+()
_Zrm1XS_ operator%()
# Template argument packs can start with I or J.
_Z3addIIiEEvDpT_ add<>()
_Z3addIJiEEvDpT_ add<>()