Add support for demangling C++11 thread_local variables. In clang, the grammar for mangling for these names are "<special-name> ::= TW <object name>" for wrapper variables or "<special-name> ::= TH <object name>" for initialization variables.

llvm-svn: 293638
This commit is contained in:
David Bozier 2017-01-31 15:18:56 +00:00
parent 1b39d5db7b
commit ec78fd11ca
2 changed files with 26 additions and 0 deletions

View File

@ -4345,6 +4345,8 @@ parse_call_offset(const char* first, const char* last)
// # base is the nominal target function of thunk
// ::= GV <object name> # Guard variable for one-time initialization
// # No <type>
// ::= TW <object name> # Thread-local wrapper
// ::= TH <object name> # Thread-local initialization
// extension ::= TC <first type> <number> _ <second type> # construction vtable for second-in-first
// extension ::= GR <object name> # reference temporary for object
@ -4448,6 +4450,28 @@ parse_special_name(const char* first, const char* last, C& db)
}
}
break;
case 'W':
// TW <object name> # Thread-local wrapper
t = parse_name(first + 2, last, db);
if (t != first + 2)
{
if (db.names.empty())
return first;
db.names.back().first.insert(0, "thread-local wrapper routine for ");
first = t;
}
break;
case 'H':
//TH <object name> # Thread-local initialization
t = parse_name(first + 2, last, db);
if (t != first + 2)
{
if (db.names.empty())
return first;
db.names.back().first.insert(0, "thread-local initialization routine for ");
first = t;
}
break;
default:
// T <call-offset> <base encoding>
{

View File

@ -29602,6 +29602,8 @@ const char* cases[][2] =
// FIXME(compnerd) pretty print this as void (*)(unsigned long &) volatile &&
{"PVFvRmOE", "void (*)(unsigned long&) volatile&&"},
{"PFvRmOE", "void (*)(unsigned long&) &&"},
{"_ZTW1x", "thread-local wrapper routine for x"},
{"_ZTHN3fooE", "thread-local initialization routine for foo"},
};
const unsigned N = sizeof(cases) / sizeof(cases[0]);