Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Demangle/ItaniumDemangle.cpp
Show First 20 Lines • Show All 398 Lines • ▼ Show 20 Lines | char *ItaniumPartialDemangler::getFunctionBaseName(char *Buf, size_t *N) const { | ||||
const Node *Name = static_cast<const FunctionEncoding *>(RootNode)->getName(); | const Node *Name = static_cast<const FunctionEncoding *>(RootNode)->getName(); | ||||
while (true) { | while (true) { | ||||
switch (Name->getKind()) { | switch (Name->getKind()) { | ||||
case Node::KAbiTagAttr: | case Node::KAbiTagAttr: | ||||
Name = static_cast<const AbiTagAttr *>(Name)->Base; | Name = static_cast<const AbiTagAttr *>(Name)->Base; | ||||
continue; | continue; | ||||
case Node::KModuleEntity: | |||||
Name = static_cast<const ModuleEntity *>(Name)->Name; | |||||
continue; | |||||
case Node::KNestedName: | case Node::KNestedName: | ||||
Name = static_cast<const NestedName *>(Name)->Name; | Name = static_cast<const NestedName *>(Name)->Name; | ||||
continue; | continue; | ||||
case Node::KLocalName: | case Node::KLocalName: | ||||
Name = static_cast<const LocalName *>(Name)->Entity; | Name = static_cast<const LocalName *>(Name)->Entity; | ||||
continue; | continue; | ||||
case Node::KNameWithTemplateArgs: | case Node::KNameWithTemplateArgs: | ||||
Name = static_cast<const NameWithTemplateArgs *>(Name)->Name; | Name = static_cast<const NameWithTemplateArgs *>(Name)->Name; | ||||
Show All 22 Lines | while (true) { | ||||
} | } | ||||
if (Name->getKind() == Node::KNameWithTemplateArgs) { | if (Name->getKind() == Node::KNameWithTemplateArgs) { | ||||
Name = static_cast<const NameWithTemplateArgs *>(Name)->Name; | Name = static_cast<const NameWithTemplateArgs *>(Name)->Name; | ||||
continue; | continue; | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
if (Name->getKind() == Node::KModuleEntity) | |||||
Name = static_cast<const ModuleEntity *>(Name)->Name; | |||||
switch (Name->getKind()) { | switch (Name->getKind()) { | ||||
case Node::KNestedName: | case Node::KNestedName: | ||||
static_cast<const NestedName *>(Name)->Qual->print(OB); | static_cast<const NestedName *>(Name)->Qual->print(OB); | ||||
break; | break; | ||||
case Node::KLocalName: { | case Node::KLocalName: { | ||||
auto *LN = static_cast<const LocalName *>(Name); | auto *LN = static_cast<const LocalName *>(Name); | ||||
LN->Encoding->print(OB); | LN->Encoding->print(OB); | ||||
OB += "::"; | OB += "::"; | ||||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Lines | case Node::KLocalName: | ||||
N = static_cast<const LocalName *>(N)->Entity; | N = static_cast<const LocalName *>(N)->Entity; | ||||
break; | break; | ||||
case Node::KNameWithTemplateArgs: | case Node::KNameWithTemplateArgs: | ||||
N = static_cast<const NameWithTemplateArgs *>(N)->Name; | N = static_cast<const NameWithTemplateArgs *>(N)->Name; | ||||
break; | break; | ||||
case Node::KNestedName: | case Node::KNestedName: | ||||
N = static_cast<const NestedName *>(N)->Name; | N = static_cast<const NestedName *>(N)->Name; | ||||
break; | break; | ||||
case Node::KModuleEntity: | |||||
N = static_cast<const ModuleEntity *>(N)->Name; | |||||
break; | |||||
} | } | ||||
} | } | ||||
return false; | return false; | ||||
} | } | ||||
bool ItaniumPartialDemangler::isFunction() const { | bool ItaniumPartialDemangler::isFunction() const { | ||||
assert(RootNode != nullptr && "must call partialDemangle()"); | assert(RootNode != nullptr && "must call partialDemangle()"); | ||||
return static_cast<const Node *>(RootNode)->getKind() == | return static_cast<const Node *>(RootNode)->getKind() == | ||||
Show All 12 Lines |