llvm-project/libcxxabi
Richard Smith 2077b62a62 Port LLVM r340203 (and r340205) to libcxxabi.
Move Itanium demangler implementation into a header file and add visitation support.

Summary:
This transforms the Itanium demangler into a generic reusable library that can
be used to build, traverse, and transform Itanium mangled name trees.

This is in preparation for adding a canonicalizing demangler, which
cannot live in the Demangle library for layering reasons. In order to
keep the diffs simpler, this patch moves more code to the new header
than is strictly necessary: in particular, all of the printLeft /
printRight implementations can be moved to the implementation file.
(And indeed we could make them non-virtual now if we wished, and remove
the vptr from Node.)

All nodes are now included in the Kind enumeration, rather than omitting
some of the Expr nodes, and the three different floating-point literal
node types now have distinct Kind values.

As a proof of concept for the visitation / matching mechanism, this
patch implements a Node dumping facility on top of it, replacing the
prior mechanism that produced the pretty-printed output rather than a
tree dump. Sample dump output:

FunctionEncoding(
  NameType("int"),
  NameWithTemplateArgs(
    NestedName(
      NameWithTemplateArgs(
        NameType("A"),
        TemplateArgs(
          {NameType("B")})),
      NameType("f")),
    TemplateArgs(
      {NameType("int")})),
  {},
  <null>,
  QualConst, FunctionRefQual::FrefQualLValue)

As a next step, it would make sense to move the LLVM high-level interface to
the demangler (the itaniumDemangler function and ItaniumPartialDemangler class)
into the Support library, and implement them in terms of the Demangle library.
This would allow the libc++abi demangler implementation to be an identical copy
of the llvm Demangle library, and would allow the LLVM implementation to reuse
LLVM components such as llvm::BumpPtrAllocator, but we'll need to decide how to
coordinate that with the MS ABI demangler, so I'm not doing that in this patch.

No functionality change intended other than the behavior of dump().

Reviewers: erik.pilkington, zturner, chandlerc, dlj

Subscribers: aheejin, llvm-commits

Differential Revision: https://reviews.llvm.org/D50930

llvm-svn: 340207
2018-08-20 20:14:49 +00:00
..
cmake [CMake] Convert paths to the right form in standalone builds on Windows 2018-06-20 20:59:18 +00:00
fuzz add cxa_demangle_fuzzer 2016-12-28 03:28:29 +00:00
include [CFI] Disable CFI checks for __cxa_decrement_exception_refcount 2018-04-09 22:11:28 +00:00
lib
src Port LLVM r340203 (and r340205) to libcxxabi. 2018-08-20 20:14:49 +00:00
test [libcxxabi] Fix test_exception_address_alignment test for ARM 2018-08-16 11:38:09 +00:00
www [CMake] Be more consistent about naming targets and components in libc++abi 2016-08-28 18:28:51 +00:00
.arcconfig [libcxxabi] Set up .arcconfig to point to new Diffusion CXXA repository 2017-12-04 23:14:03 +00:00
.clang-format Fully Reformat fallback_malloc.cpp 2017-03-04 03:23:15 +00:00
.gitignore .gitignore: ignore vim swap files 2015-12-04 02:15:02 +00:00
CMakeLists.txt Update version to 8.0.0svn 2018-08-01 14:25:03 +00:00
CREDITS.TXT Try again, this time with the correct address 2017-12-29 19:26:28 +00:00
LICENSE.TXT Update copyright year to 2018. 2018-06-18 12:22:17 +00:00