[demangler] Fix demangling a template argument which happens to be a null pointer

As seen in https://github.com/llvm/llvm-project/issues/51854
llvm-cxxfilt was having trouble demangling the case "_Z1fIDnLDn0EEvv".
We handled the "LDNE" case and "LPi0E" but not "LDn0E". This change adds
that handling.

Differential Revision: https://reviews.llvm.org/D124010
This commit is contained in:
gbreynoo 2022-04-28 15:55:26 +01:00
parent 451c5578b8
commit 5420834aad
3 changed files with 3 additions and 2 deletions

View File

@ -4340,7 +4340,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExprPrimary() {
return nullptr;
}
case 'D':
if (consumeIf("DnE"))
if (consumeIf("Dn") && (consumeIf('0'), consumeIf('E')))
return make<NameType>("nullptr");
return nullptr;
case 'T':

View File

@ -644,6 +644,7 @@ const char* cases[][2] =
{"_ZNSs4_Rep20_S_empty_rep_storageE", "std::string::_Rep::_S_empty_rep_storage"},
{"_ZZN23ImageLoaderMachOClassic26bindIndirectSymbolPointersERKN11ImageLoader11LinkContextEbbE13alreadyWarned", "ImageLoaderMachOClassic::bindIndirectSymbolPointers(ImageLoader::LinkContext const&, bool, bool)::alreadyWarned"},
{"_ZN12_GLOBAL__N_115emergency_mutexE", "(anonymous namespace)::emergency_mutex"},
{"_Z1fIDnLDn0EEvv", "void f<std::nullptr_t, nullptr>()"},
// clang

View File

@ -4340,7 +4340,7 @@ Node *AbstractManglingParser<Derived, Alloc>::parseExprPrimary() {
return nullptr;
}
case 'D':
if (consumeIf("DnE"))
if (consumeIf("Dn") && (consumeIf('0'), consumeIf('E')))
return make<NameType>("nullptr");
return nullptr;
case 'T':