Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Demangle/DLangDemangle.cpp
Show First 20 Lines • Show All 236 Lines • ▼ Show 20 Lines | const char *Demangler::parseIdentifier(OutputBuffer *Demangled, | ||||
if (strlen(Endptr) < Len) | if (strlen(Endptr) < Len) | ||||
return nullptr; | return nullptr; | ||||
Mangled = Endptr; | Mangled = Endptr; | ||||
// TODO: Parse template instances with a length prefix. | // TODO: Parse template instances with a length prefix. | ||||
// There can be multiple different declarations in the same function that | |||||
// have the same mangled name. To make the mangled names unique, a fake | |||||
// parent in the form `__Sddd' is added to the symbol. | |||||
if (Len >= 4 && Mangled[0] == '_' && Mangled[1] == '_' && Mangled[2] == 'S') { | |||||
const char *NumPtr = Mangled + 3; | |||||
while (NumPtr < (Mangled + Len) && std::isdigit(*NumPtr)) | |||||
++NumPtr; | |||||
if (Mangled + Len == NumPtr) { | |||||
// Skip over the fake parent. | |||||
Mangled += Len; | |||||
return parseIdentifier(Demangled, Mangled); | |||||
} | |||||
// Else demangle it as a plain identifier. | |||||
} | |||||
return parseLName(Demangled, Mangled, Len); | return parseLName(Demangled, Mangled, Len); | ||||
} | } | ||||
const char *Demangler::parseLName(OutputBuffer *Demangled, const char *Mangled, | const char *Demangler::parseLName(OutputBuffer *Demangled, const char *Mangled, | ||||
unsigned long Len) { | unsigned long Len) { | ||||
switch (Len) { | switch (Len) { | ||||
case 6: | case 6: | ||||
if (strncmp(Mangled, "__initZ", Len + 1) == 0) { | if (strncmp(Mangled, "__initZ", Len + 1) == 0) { | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |