[libcxx-commits] [PATCH] D124010: [llvm-cxxfilt] Unable to demangle a template argument which happens to be a null pointer

Owen Reynolds via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Apr 26 09:11:56 PDT 2022


gbreynoo updated this revision to Diff 425243.
gbreynoo added a comment.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.

Move testing to area suggested by @urnathan.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124010/new/

https://reviews.llvm.org/D124010

Files:
  libcxxabi/test/test_demangle.pass.cpp
  llvm/include/llvm/Demangle/ItaniumDemangle.h


Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -4342,6 +4342,10 @@
   case 'D':
     if (consumeIf("DnE"))
       return make<NameType>("nullptr");
+    // A template argument which happens to be a null pointer is mangled as if
+    // it were a literal 0 of the appropriate pointer type.
+    if (consumeIf("Dn0E"))
+      return make<EnumLiteral>(make<NameType>("std::nullptr_t"), "0");
     return nullptr;
   case 'T':
     // Invalid mangled name per
Index: libcxxabi/test/test_demangle.pass.cpp
===================================================================
--- libcxxabi/test/test_demangle.pass.cpp
+++ libcxxabi/test/test_demangle.pass.cpp
@@ -644,6 +644,7 @@
     {"_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, (std::nullptr_t)0>()"},
 
     // clang
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124010.425243.patch
Type: text/x-patch
Size: 1345 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220426/684a4fe1/attachment-0001.bin>


More information about the libcxx-commits mailing list