]> git.lizzy.rs Git - rust.git/blob - src/tools/rust-demangler/README.md
Auto merge of #102684 - JhonnyBillM:delete-target-data-layout-errors-wrapper, r=davidtwco
[rust.git] / src / tools / rust-demangler / README.md
1 # rust-demangler
2
3 _Demangles rustc mangled names._
4
5 `rust-demangler` supports the requirements of the [`llvm-cov show -Xdemangler`
6 option](https://llvm.org/docs/CommandGuide/llvm-cov.html#cmdoption-llvm-cov-show-xdemangler),
7 to perform Rust-specific symbol demangling:
8
9 > _The demangler is expected to read a newline-separated list of symbols from
10 > stdin and write a newline-separated list of the same length to stdout._
11
12 To use `rust-demangler` with `llvm-cov` for example:
13
14 ```shell
15 $ TARGET="${PWD}/build/x86_64-unknown-linux-gnu"
16 $ "${TARGET}"/llvm/bin/llvm-cov show \
17   --Xdemangler=path/to/rust-demangler \
18   --instr-profile=main.profdata ./main --show-line-counts-or-regions
19 ```
20
21 `rust-demangler` is a Rust "extended tool", used in Rust compiler tests, and
22 optionally included in Rust distributions that enable coverage profiling. Symbol
23 demangling is implemented using the
24 [rustc-demangle](https://crates.io/crates/rustc-demangle) crate.
25
26 _(Note, for Rust developers, the third-party tool
27 [`rustfilt`](https://crates.io/crates/rustfilt) also supports `llvm-cov` symbol
28 demangling. `rustfilt` is a more generalized tool that searches any body of
29 text, using pattern matching, to find and demangle Rust symbols.)_
30
31 ## License
32
33 Rust-demangler is distributed under the terms of both the MIT license and the
34 Apache License (Version 2.0).
35
36 See [LICENSE-APACHE](/LICENSE-APACHE) and [LICENSE-MIT](/LICENSE-MIT) for details.