1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00
llvm-mirror/include/llvm/Demangle
Chandler Carruth 43ee626c3c Update more file headers across all of the LLVM projects in the monorepo
to reflect the new license. These used slightly different spellings that
defeated my regular expressions.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

llvm-svn: 351648
2019-01-19 10:56:40 +00:00
..
Demangle.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
DemangleConfig.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ItaniumDemangle.h Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
MicrosoftDemangle.h Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
MicrosoftDemangleNodes.h Update more file headers across all of the LLVM projects in the monorepo 2019-01-19 10:56:40 +00:00
README.txt NFC: Make the copies of the demangler byte-for-byte identical 2019-01-17 20:37:51 +00:00
StringView.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Utility.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00

Itanium Name Demangler Library
==============================

Introduction
------------

This directory contains the generic itanium name demangler library. The main
purpose of the library is to demangle C++ symbols, i.e. convert the string
"_Z1fv" into "f()". You can also use the CRTP base ManglingParser to perform
some simple analysis on the mangled name, or (in LLVM) use the opaque
ItaniumPartialDemangler to query the demangled AST.

Why are there multiple copies of the this library in the source tree?
---------------------------------------------------------------------

This directory is mirrored between libcxxabi/demangle and
llvm/include/llvm/Demangle. The simple reason for this is that both projects
need to demangle symbols, but neither can depend on each other. libcxxabi needs
the demangler to implement __cxa_demangle, which is part of the itanium ABI
spec. LLVM needs a copy for a bunch of places, but doesn't want to use the
system's __cxa_demangle because it a) might not be available (i.e., on Windows),
and b) probably isn't that up-to-date on the latest language features.

The copy of the demangler in LLVM has some extra stuff that aren't needed in
libcxxabi (ie, the MSVC demangler, ItaniumPartialDemangler), which depend on the
shared generic components. Despite these differences, we want to keep the "core"
generic demangling library identical between both copies to simplify development
and testing.

If you're working on the generic library, then do the work first in libcxxabi,
then run the cp-to-llvm.sh script in src/demangle. This script takes as an
argument the path to llvm, and re-copies the changes you made to libcxxabi over.
Note that this script just blindly overwrites all changes to the generic library
in llvm, so be careful.

Because the core demangler needs to work in libcxxabi, everything needs to be
declared in an anonymous namespace (see DEMANGLE_NAMESPACE_BEGIN), and you can't
introduce any code that depends on the libcxx dylib.

Hopefully, when LLVM becomes a monorepo, we can de-duplicate this code, and have
both LLVM and libcxxabi depend on a shared demangler library.

Testing
-------

The tests are split up between libcxxabi/test/{unit,}test_demangle.cpp, and
llvm/unittest/Demangle. The llvm directory should only get tests for stuff not
included in the core library. In the future though, we should probably move all
the tests to LLVM.

It is also a really good idea to run libFuzzer after non-trivial changes, see
libcxxabi/fuzz/cxa_demangle_fuzzer.cpp and https://llvm.org/docs/LibFuzzer.html.