demangle
Copyright (c) 2026 demangle contributors

This product is licensed under the MIT License; see LICENSE.

It includes and derives from third-party work, listed below with the notices
their licences require.

================================================================================
Rust demangling -- src/demangle/schemes/rust/
--------------------------------------------------------------------------------
Derived from the rust_demangler package by Team bi0s
(https://github.com/teambi0s/rust_demangler), used under the MIT License and
substantially modified. Both the legacy and v0 grammars have been reworked, and
the code was further developed as part of SMDA (https://github.com/danielplohmann/smda)
before being extracted into this project.

MIT License

Copyright (c) 2021 Team bi0s

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

================================================================================
MSVC demangling -- src/demangle/schemes/msvc/
--------------------------------------------------------------------------------
Derived from the MSVC demangler in SMDA (https://github.com/danielplohmann/smda),
used under the BSD 2-Clause License and substantially modified: the parser was
rebuilt against the Builder protocol so it can produce a tree as well as text,
and its node kinds and renderer are new.

BSD 2-Clause License

Copyright (c) 2018-2020, Daniel Plohmann and Steffen Enders

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

================================================================================
MSVC conformance corpus -- tests/conformance/msvc-llvm-corpus.txt
--------------------------------------------------------------------------------
The mangled names are LLVM's demangler test corpus (llvm/test/Demangle/ms-*.test),
used under the Apache License 2.0 with the LLVM exception. The expected column
was produced by running llvm-undname over them.

tests/conformance/msvc-arm64ec.txt, msvc-suppressions.txt, msvc-dbghelp.txt and
msvc-name-only.txt are derived from the same names: the first inserts the ARM64EC
marker into each, and the others record what llvm-undname's flags and
dbghelp.dll's UnDecorateSymbolName print for them.

================================================================================
Itanium conformance corpus -- tests/conformance/itanium-libcxxabi.txt.gz
--------------------------------------------------------------------------------
Transcribed from LLVM's libcxxabi/test/DemangleTestCases.inc
(https://github.com/llvm/llvm-project), mangled names and expected output both,
used under the Apache License 2.0 with the LLVM exception.

================================================================================
GNU libiberty conformance corpora -- tests/conformance/d-libiberty.txt,
tests/conformance/ada-libiberty.txt, tests/conformance/gnuv2-libiberty.txt
--------------------------------------------------------------------------------
Transcribed from GCC's libiberty test suite (https://gcc.gnu.org/): the D
vectors from libiberty/testsuite/d-demangle-expected on GCC's master branch, and
the Ada/GNAT and pre-Itanium C++ vectors from
libiberty/testsuite/demangle-expected at GCC 8.3.0. Mangled names and expected
output both come from those files, reformatted here as tab-separated rows. They
are part of GCC, which is distributed under the GNU General Public License.

================================================================================
CodeWarrior conformance corpus -- tests/conformance/codewarrior-cwdemangle.txt
--------------------------------------------------------------------------------
Transcribed from the test module of cwdemangle
(https://github.com/encounter/cwdemangle, lib/src/lib.rs): mangled names,
options and expected output. That project dedicates it to the public domain
under CC0-1.0.

================================================================================
Rust conformance corpus -- tests/conformance/rustc-upstream.txt
--------------------------------------------------------------------------------
Transcribed from the #[test] blocks of v0.rs, legacy.rs and lib.rs in
rustc-demangle (https://github.com/rust-lang/rustc-demangle), mangled names and
expected output both. rustc-demangle is dual-licensed under the MIT License and
the Apache License 2.0.

================================================================================
Specifications
--------------------------------------------------------------------------------
docs/specs/itanium-grammar.txt is a transcription of the grammar productions from
the Itanium C++ ABI (https://itanium-cxx-abi.github.io/cxx-abi/abi.html), included
for reference while reading the parser.

================================================================================
Swift demangling -- src/demangle/schemes/swift/
--------------------------------------------------------------------------------
The grammar, the demangling-tree node kinds, and the spelling rules are those of
the Swift compiler's own demangler (lib/Demangling/Demangler.cpp,
lib/Demangling/NodePrinter.cpp, lib/Demangling/Punycode.cpp and the
include/swift/Demangling/*.def tables), which is the only complete description of
the mangling that exists. The Python here is an independent implementation of that
algorithm, but it follows its structure closely enough to be worth crediting.

The Swift project is licensed under the Apache License 2.0 with the Runtime
Library Exception; see https://swift.org/LICENSE.txt.

================================================================================
Swift conformance corpus -- tests/conformance/swift-real-world.txt
--------------------------------------------------------------------------------
Part of this file is the mangled names from the Swift compiler's own demangler
test corpus (test/Demangle/Inputs/manglings.txt), used under the Apache License
2.0 with the Runtime Library Exception. The expected column was produced by
running a swift-demangle built from the swiftlang/swift main branch over them.
The rest is a stratified sample of the symbols in the shipped Swift runtime and
Foundation.

================================================================================
Swift conformance corpora -- tests/conformance/swift-upstream.txt,
tests/conformance/swift-simplified.txt, tests/conformance/swift-refusals.txt
--------------------------------------------------------------------------------
Transcribed from the Swift compiler's test/Demangle/Inputs/manglings.txt and
simplified-manglings.txt (https://github.com/swiftlang/swift), mangled names and
expected output both, used under the Apache License 2.0 with the Runtime Library
Exception. swift-refusals.txt holds the names from manglings.txt that
swift-demangle itself refuses.

================================================================================
Nim demangling -- src/demangle/schemes/nim/
--------------------------------------------------------------------------------
The mangling rules are transcribed from the Nim compiler's own
compiler/mangleutils.nim (identifier escaping) and compiler/modulegraphs.nim
(module path encoding), which are the only description of them that exists --
Nim ships no demangler. Nim is licensed under the MIT License; see
https://github.com/nim-lang/Nim/blob/devel/copying.txt.

================================================================================
Nim conformance corpus -- tests/conformance/nim-real-world.txt
--------------------------------------------------------------------------------
Produced by compiling purpose-built Nim programs with the shipped Nim 1.6.14 and
Nim 2.2.0 compilers and reading the .ndi debug-mapping files they write. The
mangled names and the source names are the compilers' own output.

================================================================================
Free Pascal demangling -- src/demangle/schemes/pascal/
--------------------------------------------------------------------------------
The mangling rules are transcribed from the Free Pascal compiler's own
compiler/symdef.pas (make_mangledname, mangledprocparanames, rtti_mangledname),
compiler/symsym.pas (variable and typed-constant prefixes), compiler/ncgvmt.pas
(interface tables and wrappers) and compiler/symtable.pas (operator names), which
are the only description of them that exists -- Free Pascal ships no demangler.
The compiler is licensed under the GNU General Public License version 2 or later;
its runtime library is under the LGPL with a static-linking exception. No Free
Pascal code is included here: the Python is an independent implementation of the
rules those files describe.

================================================================================
Free Pascal conformance corpus -- tests/conformance/pascal-real-world.txt
--------------------------------------------------------------------------------
The mangled names are symbols from the object files of the Free Pascal 3.2.2
runtime and packages as shipped by Debian/Ubuntu. The expected column is this
library's own reading; see tests/test_pascal.py for what establishes it.

================================================================================
Delphi/C++Builder conformance corpora -- tests/conformance/delphi-tdump.txt,
tests/conformance/delphi-real-world.txt
--------------------------------------------------------------------------------
Both columns are the borland.yaml sample from the unmangler project by Andrey
"Zed" Zaikin (https://github.com/zed-0xff/unmangler), used under the MIT License.
That file is a dump the project's misc/2_tdump.rb produced by running Embarcadero's
own tdump.exe -q -um over the export tables of real Delphi BPLs and C++Builder
DLLs: the mangled names are those exports, and the expected column is what that
unmangler printed for each. Reformatted here as tab-separated rows, and split into
the whole table and a per-kind sample of it.

MIT License

Copyright (c) 2013 Andrey "Zed" Zaikin

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in the
Software without restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
