[libcxx-commits] [PATCH] D145492: [libcxxabi][Demangle] Don't drop ctor/dtor name for abi-tagged structures

Michael Buch via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 7 05:28:56 PST 2023


Michael137 created this revision.
Michael137 added reviewers: aprantl, ldionne, urnathan.
Herald added a reviewer: jhenderson.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added projects: libc++abi, LLVM.
Herald added subscribers: llvm-commits, libcxx-commits.
Herald added a reviewer: libc++abi.

Before this patch we would demangle abi-tagged structures as follows:

  $ c++filt -n _ZN1SB5OuterC2Ev
  S[abi:Outer]:()
  
  $ c++filt -n _ZN1SB5OuterD2Ev
  S[abi:Outer]::~()

This is because `Node::getBaseName` was unimplemented for the
`AbiTagAttr` node, which meant that when we tried printing `CtorDtorName`
where its `Basename` `Node` was an `AbiTagAttr`, we'd drop the
name.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145492

Files:
  libcxxabi/src/demangle/ItaniumDemangle.h
  llvm/test/tools/llvm-cxxfilt/abitag.test


Index: llvm/test/tools/llvm-cxxfilt/abitag.test
===================================================================
--- llvm/test/tools/llvm-cxxfilt/abitag.test
+++ llvm/test/tools/llvm-cxxfilt/abitag.test
@@ -1,6 +1,7 @@
-RUN: llvm-cxxfilt -n _Z14returns_stringB5cxx11v _Z6globalB5cxx11 _Z6globalB12a_longer_tag | FileCheck %s
+RUN: llvm-cxxfilt -n _Z14returns_stringB5cxx11v _Z6globalB5cxx11 _Z6globalB12a_longer_tag _ZN6globalB3TagC2Ev _ZN6globalB3TagD2Ev | FileCheck %s
 
 CHECK: returns_string[abi:cxx11]()
 CHECK-NEXT: global[abi:cxx11]
 CHECK-NEXT: global[abi:a_longer_tag]
-
+CHECK-NEXT: global[abi:Tag]::global()
+CHECK-NEXT: global[abi:Tag]::~global()
Index: libcxxabi/src/demangle/ItaniumDemangle.h
===================================================================
--- libcxxabi/src/demangle/ItaniumDemangle.h
+++ libcxxabi/src/demangle/ItaniumDemangle.h
@@ -537,6 +537,8 @@
 
   template<typename Fn> void match(Fn F) const { F(Base, Tag); }
 
+  StringView getBaseName() const override { return Base->getBaseName(); }
+
   void printLeft(OutputBuffer &OB) const override {
     Base->printLeft(OB);
     OB += "[abi:";


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145492.503001.patch
Type: text/x-patch
Size: 1134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230307/45c76541/attachment.bin>


More information about the libcxx-commits mailing list