Commit 5d46e1bc authored by Haakan Younes's avatar Haakan Younes Committed by Fumitoshi Ukai

Add demangle support for ABI tags. (#416)


Support ABI tags after <local-source-name> in demangle.cc.
Update the reference URL.

Fixes #50 
parent 7fcb278d
......@@ -30,7 +30,7 @@
// Author: Satoru Takabayashi
//
// For reference check out:
// http://www.codesourcery.com/public/cxx-abi/abi.html#mangling
// http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangling
//
// Note that we only have partial C++0x support yet.
......@@ -423,6 +423,8 @@ static bool ParseNumber(State *state, int *number_out);
static bool ParseFloatNumber(State *state);
static bool ParseSeqId(State *state);
static bool ParseIdentifier(State *state, int length);
static bool ParseAbiTags(State *state);
static bool ParseAbiTag(State *state);
static bool ParseOperatorName(State *state);
static bool ParseSpecialName(State *state);
static bool ParseCallOffset(State *state);
......@@ -594,13 +596,13 @@ static bool ParsePrefix(State *state) {
// <unqualified-name> ::= <operator-name>
// ::= <ctor-dtor-name>
// ::= <source-name>
// ::= <local-source-name>
// ::= <source-name> [<abi-tags>]
// ::= <local-source-name> [<abi-tags>]
static bool ParseUnqualifiedName(State *state) {
return (ParseOperatorName(state) ||
ParseCtorDtorName(state) ||
ParseSourceName(state) ||
ParseLocalSourceName(state));
(ParseSourceName(state) && Optional(ParseAbiTags(state))) ||
(ParseLocalSourceName(state) && Optional(ParseAbiTags(state))));
}
// <source-name> ::= <positive length number> <identifier>
......@@ -703,6 +705,23 @@ static bool ParseIdentifier(State *state, int length) {
return true;
}
// <abi-tags> ::= <abi-tag> [<abi-tags>]
static bool ParseAbiTags(State *state) {
State copy = *state;
DisableAppend(state);
if (OneOrMore(ParseAbiTag, state)) {
RestoreAppend(state, copy.append);
return true;
}
*state = copy;
return false;
}
// <abi-tag> ::= B <source-name>
static bool ParseAbiTag(State *state) {
return ParseOneCharToken(state, 'B') && ParseSourceName(state);
}
// <operator-name> ::= nw, and other two letters cases
// ::= cv <type> # (cast)
// ::= v <digit> <source-name> # vendor extended operator
......
......@@ -43,6 +43,10 @@ _ZNcvT_IiEEv operator ?<>()
# "<< <" case.
_ZlsI3fooE operator<< <>
# ABI tags.
_Z1AB3barB3foo A
_ZN3fooL3barB5cxx11E foo::bar
# Random things we found interesting.
_ZN3FooISt6vectorISsSaISsEEEclEv Foo<>::operator()()
_ZTI9Callback1IiE Callback1<>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment