Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# core.demangle

The demangle module converts mangled D symbols to a representation similar to what would have existed in code.
License:
Distributed under the Boost Software License 1.0. (See accompanying file LICENSE)
Authors:
Sean Kelly

Source core/demangle.d

pure nothrow @safe char[] `demangle`(const(char)[] `buf`, char[] `dst` = null);
  Demangles D mangled names. If it is not a D mangled name, it returns its argument name.
  Parameters:

  const(char)[] `buf` | The string to demangle.
  char[] `dst` | An optional destination buffer.

  Returns:
  The demangled name or the original string if the name is not a mangled D name.
pure nothrow @safe char[] `demangleType`(const(char)[] `buf`, char[] `dst` = null);
  Demangles a D mangled type.
  Parameters:

  const(char)[] `buf` | The string to demangle.
  char[] `dst` | An optional destination buffer.

  Returns:
  The demangled type name or the original string if the name is not a mangled D type.
pure nothrow @safe char[] `reencodeMangled`(const(char)[] `mangled`);
  reencode a mangled symbol name that might include duplicate occurrences of the same identifier by replacing all but the first occurence with a back reference.
  Parameters:

  const(char)[] `mangled` | The mangled string representing the type

  Returns:
  The mangled name with deduplicated identifiers
pure nothrow @safe char[] `mangle`(T)(const(char)[] `fqn`, char[] `dst` = null);
  Mangles a D symbol.
  Parameters:

  T | The type of the symbol.
  const(char)[] `fqn` | The fully qualified name of the symbol.
  char[] `dst` | An optional destination buffer.

  Returns:
  The mangled name for a symbols of type T and the given fully qualified name.
  Examples:

      assert(mangle!int("a.b") == "_D1a1bi");
      assert(mangle!(char[])("test.foo") == "_D4test3fooAa");
      assert(mangle!(int function(int))("a.b") == "_D1a1bPFiZi");

pure nothrow @safe char[] `mangleFunc`(T : FT*, FT)(const(char)[] `fqn`, char[] `dst` = null)
if (is(FT == function));
  Mangles a D function.
  Parameters:

  T | function pointer type.
  const(char)[] `fqn` | The fully qualified name of the symbol.
  char[] `dst` | An optional destination buffer.

  Returns:
  The mangled name for a function with function pointer type T and the given fully qualified name.
enum string `cPrefix`;
  C name mangling is done by adding a prefix on some platforms.

Copyright © 1999-2018 by the D Language Foundation | Page generated by Ddoc on Thu Oct 11 13:08:58 2018