llvm-cxxmap.rst 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. llvm-cxxmap - Mangled name remapping tool
  2. =========================================
  3. .. program:: llvm-cxxmap
  4. SYNOPSIS
  5. --------
  6. :program:`llvm-cxxmap` [*options*] *symbol-file-1* *symbol-file-2*
  7. DESCRIPTION
  8. -----------
  9. The :program:`llvm-cxxmap` tool performs fuzzy matching of C++ mangled names,
  10. based on a file describing name components that should be considered equivalent.
  11. The symbol files should contain a list of C++ mangled names (one per line).
  12. Blank lines and lines starting with ``#`` are ignored. The output is a list
  13. of pairs of equivalent symbols, one per line, of the form
  14. .. code-block:: none
  15. <symbol-1> <symbol-2>
  16. where ``<symbol-1>`` is a symbol from *symbol-file-1* and ``<symbol-2>`` is
  17. a symbol from *symbol-file-2*. Mappings for which the two symbols are identical
  18. are omitted.
  19. OPTIONS
  20. -------
  21. .. program:: llvm-cxxmap
  22. .. option:: -remapping-file=file, -r=file
  23. Specify a file containing a list of equivalence rules that should be used
  24. to determine whether two symbols are equivalent. Required.
  25. See :ref:`remapping-file`.
  26. .. option:: -output=file, -o=file
  27. Specify a file to write the list of matched names to. If unspecified, the
  28. list will be written to stdout.
  29. .. option:: -Wambiguous
  30. Produce a warning if there are multiple equivalent (but distinct) symbols in
  31. *symbol-file-2*.
  32. .. option:: -Wincomplete
  33. Produce a warning if *symbol-file-1* contains a symbol for which there is no
  34. equivalent symbol in *symbol-file-2*.
  35. .. _remapping-file:
  36. REMAPPING FILE
  37. --------------
  38. The remapping file is a text file containing lines of the form
  39. .. code-block:: none
  40. fragmentkind fragment1 fragment2
  41. where ``fragmentkind`` is one of ``name``, ``type``, or ``encoding``,
  42. indicating whether the following mangled name fragments are
  43. <`name <http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.name>`_>s,
  44. <`type <http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.type>`_>s, or
  45. <`encoding <http://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.encoding>`_>s,
  46. respectively.
  47. Blank lines and lines starting with ``#`` are ignored.
  48. For convenience, built-in <substitution>s such as ``St`` and ``Ss``
  49. are accepted as <name>s (even though they technically are not <name>s).
  50. For example, to specify that ``absl::string_view`` and ``std::string_view``
  51. should be treated as equivalent, the following remapping file could be used:
  52. .. code-block:: none
  53. # absl::string_view is considered equivalent to std::string_view
  54. type N4absl11string_viewE St17basic_string_viewIcSt11char_traitsIcEE
  55. # std:: might be std::__1:: in libc++ or std::__cxx11:: in libstdc++
  56. name St St3__1
  57. name St St7__cxx11
  58. .. note::
  59. Symbol remapping is currently only supported for C++ mangled names
  60. following the Itanium C++ ABI mangling scheme. This covers all C++ targets
  61. supported by Clang other than Windows targets.