mirror of
https://github.com/RPCS3/llvm.git
synced 2026-01-31 01:25:19 +01:00
Reviewers: erik.pilkington, ruiu, echristo, pcc Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D47248 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333159 91177308-0d34-0410-b5e6-96231b3b80d8
85 lines
2.9 KiB
C++
85 lines
2.9 KiB
C++
//===--- Demangle.h ---------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include <cstddef>
|
|
|
|
namespace llvm {
|
|
/// This is a llvm local version of __cxa_demangle. Other than the name and
|
|
/// being in the llvm namespace it is identical.
|
|
///
|
|
/// The mangled_name is demangled into buf and returned. If the buffer is not
|
|
/// large enough, realloc is used to expand it.
|
|
///
|
|
/// The *status will be set to
|
|
/// unknown_error: -4
|
|
/// invalid_args: -3
|
|
/// invalid_mangled_name: -2
|
|
/// memory_alloc_failure: -1
|
|
/// success: 0
|
|
|
|
char *itaniumDemangle(const char *mangled_name, char *buf, size_t *n,
|
|
int *status);
|
|
|
|
/// "Partial" demangler. This supports demangling a string into an AST
|
|
/// (typically an intermediate stage in itaniumDemangle) and querying certain
|
|
/// properties or partially printing the demangled name.
|
|
struct ItaniumPartialDemangler {
|
|
ItaniumPartialDemangler();
|
|
|
|
ItaniumPartialDemangler(ItaniumPartialDemangler &&Other);
|
|
ItaniumPartialDemangler &operator=(ItaniumPartialDemangler &&Other);
|
|
|
|
/// Demangle into an AST. Subsequent calls to the rest of the member functions
|
|
/// implicitly operate on the AST this produces.
|
|
/// \return true on error, false otherwise
|
|
bool partialDemangle(const char *MangledName);
|
|
|
|
/// Just print the entire mangled name into Buf. Buf and N behave like the
|
|
/// second and third parameters to itaniumDemangle.
|
|
char *finishDemangle(char *Buf, size_t *N) const;
|
|
|
|
/// Get the base name of a function. This doesn't include trailing template
|
|
/// arguments, ie for "a::b<int>" this function returns "b".
|
|
char *getFunctionBaseName(char *Buf, size_t *N) const;
|
|
|
|
/// Get the context name for a function. For "a::b::c", this function returns
|
|
/// "a::b".
|
|
char *getFunctionDeclContextName(char *Buf, size_t *N) const;
|
|
|
|
/// Get the entire name of this function.
|
|
char *getFunctionName(char *Buf, size_t *N) const;
|
|
|
|
/// Get the parameters for this function.
|
|
char *getFunctionParameters(char *Buf, size_t *N) const;
|
|
char *getFunctionReturnType(char *Buf, size_t *N) const;
|
|
|
|
/// If this function has any any cv or reference qualifiers. These imply that
|
|
/// the function is a non-static member function.
|
|
bool hasFunctionQualifiers() const;
|
|
|
|
/// If this symbol describes a constructor or destructor.
|
|
bool isCtorOrDtor() const;
|
|
|
|
/// If this symbol describes a function.
|
|
bool isFunction() const;
|
|
|
|
/// If this symbol describes a variable.
|
|
bool isData() const;
|
|
|
|
/// If this symbol is a <special-name>. These are generally implicitly
|
|
/// generated by the implementation, such as vtables and typeinfo names.
|
|
bool isSpecialName() const;
|
|
|
|
~ItaniumPartialDemangler();
|
|
private:
|
|
void *RootNode;
|
|
void *Context;
|
|
};
|
|
} // namespace llvm
|