LLVM  8.0.0svn
Enumerations | Functions
MicrosoftDemangle.cpp File Reference
#include "llvm/Demangle/Demangle.h"
#include "Compiler.h"
#include "StringView.h"
#include "Utility.h"
#include <cctype>
#include <cstdio>
#include <tuple>
Include dependency graph for MicrosoftDemangle.cpp:

Go to the source code of this file.

Enumerations

enum  Qualifiers : uint8_t {
  Q_None = 0, Q_Const = 1 << 0, Q_Volatile = 1 << 1, Q_Far = 1 << 2,
  Q_Huge = 1 << 3, Q_Unaligned = 1 << 4, Q_Restrict = 1 << 5, Q_Pointer64 = 1 << 6
}
 
enum  StorageClass : uint8_t {
  StorageClass::None, StorageClass::PrivateStatic, StorageClass::ProtectedStatic, StorageClass::PublicStatic,
  Global, StorageClass::FunctionLocalStatic
}
 
enum  QualifierMangleMode { QualifierMangleMode::Drop, QualifierMangleMode::Mangle, QualifierMangleMode::Result }
 
enum  PointerAffinity { PointerAffinity::Pointer, PointerAffinity::Reference, PointerAffinity::RValueReference }
 
enum  CallingConv : uint8_t {
  CallingConv::None, CallingConv::Cdecl, CallingConv::Pascal, CallingConv::Thiscall,
  CallingConv::Stdcall, CallingConv::Fastcall, CallingConv::Clrcall, CallingConv::Eabi,
  CallingConv::Vectorcall, CallingConv::Regcall
}
 
enum  ReferenceKind : uint8_t { ReferenceKind::None, ReferenceKind::LValueRef, ReferenceKind::RValueRef }
 
enum  PrimTy : uint8_t {
  PrimTy::Unknown, PrimTy::None, PrimTy::Function, PrimTy::Ptr,
  PrimTy::MemberPtr, PrimTy::Array, PrimTy::Struct, PrimTy::Union,
  PrimTy::Class, PrimTy::Enum, PrimTy::Void, PrimTy::Bool,
  PrimTy::Char, PrimTy::Schar, PrimTy::Uchar, PrimTy::Char16,
  PrimTy::Char32, PrimTy::Short, PrimTy::Ushort, PrimTy::Int,
  PrimTy::Uint, PrimTy::Long, PrimTy::Ulong, PrimTy::Int64,
  PrimTy::Uint64, PrimTy::Wchar, PrimTy::Float, PrimTy::Double,
  PrimTy::Ldouble, PrimTy::Nullptr
}
 
enum  FuncClass : uint16_t {
  Public = 1 << 0, Protected = 1 << 1, Private = 1 << 2, Global = 1 << 3,
  Global, Static = 1 << 4, Virtual = 1 << 5, Far = 1 << 6,
  ExternC = 1 << 7, NoPrototype = 1 << 8
}
 
enum  NameBackrefBehavior : uint8_t { NBB_None = 0, NBB_Template = 1 << 0, NBB_Simple = 1 << 1 }
 
enum  SymbolCategory { SymbolCategory::Unknown, SymbolCategory::Function, SymbolCategory::Variable, SymbolCategory::StringLiteral }
 

Functions

static bool startsWithDigit (StringView S)
 
static void outputSpaceIfNecessary (OutputStream &OS)
 
static bool isMemberPointer (StringView MangledName)
 
static void outputCallingConvention (OutputStream &OS, CallingConv CC)
 
static bool startsWithLocalScopePattern (StringView S)
 
static void outputParameterList (OutputStream &OS, const FunctionParams &Params, NameResolver &Resolver)
 
static void outputStringLiteral (OutputStream &OS, const Name &TheString)
 
static void outputName (OutputStream &OS, const Name *TheName, const Type *Ty, NameResolver &Resolver)
 
static void outputParameterList (OutputStream &OS, const TemplateParams &Params, NameResolver &Resolver)
 
static void outputNameComponent (OutputStream &OS, const Name &N, NameResolver &Resolver)
 
static bool isRebasedHexDigit (char C)
 
static uint8_t rebasedHexDigitToNumber (char C)
 
static void writeHexDigit (char *Buffer, uint8_t Digit)
 
static void outputHex (OutputStream &OS, unsigned C)
 
static void outputEscapedChar (OutputStream &OS, unsigned C)
 
unsigned countTrailingNullBytes (const uint8_t *StringBytes, int Length)
 
unsigned countEmbeddedNulls (const uint8_t *StringBytes, unsigned Length)
 
unsigned guessCharByteSize (const uint8_t *StringBytes, unsigned NumChars, unsigned NumBytes)
 
static unsigned decodeMultiByteChar (const uint8_t *StringBytes, unsigned CharIndex, unsigned CharBytes)
 
static bool isTagType (StringView S)
 
static bool isPointerType (StringView S)
 
static bool isArrayType (StringView S)
 
static bool isFunctionType (StringView S)
 
static std::pair< Qualifiers, PointerAffinitydemanglePointerCVQualifiers (StringView &MangledName)
 

Enumeration Type Documentation

◆ CallingConv

enum CallingConv : uint8_t
strong
Enumerator
None 
Cdecl 
Pascal 
Thiscall 
Stdcall 
Fastcall 
Clrcall 
Eabi 
Vectorcall 
Regcall 

Definition at line 146 of file MicrosoftDemangle.cpp.

◆ FuncClass

enum FuncClass : uint16_t
Enumerator
Public 
Protected 
Private 
Global 
Global 
Static 
Virtual 
Far 
ExternC 
NoPrototype 

Definition at line 198 of file MicrosoftDemangle.cpp.

◆ NameBackrefBehavior

enum NameBackrefBehavior : uint8_t
Enumerator
NBB_None 
NBB_Template 
NBB_Simple 

Definition at line 210 of file MicrosoftDemangle.cpp.

◆ PointerAffinity

enum PointerAffinity
strong
Enumerator
Pointer 
Reference 
RValueReference 

Definition at line 143 of file MicrosoftDemangle.cpp.

◆ PrimTy

enum PrimTy : uint8_t
strong
Enumerator
Unknown 
None 
Function 
Ptr 
MemberPtr 
Array 
Struct 
Union 
Class 
Enum 
Void 
Bool 
Char 
Schar 
Uchar 
Char16 
Char32 
Short 
Ushort 
Int 
Uint 
Long 
Ulong 
Int64 
Uint64 
Wchar 
Float 
Double 
Ldouble 
Nullptr 

Definition at line 162 of file MicrosoftDemangle.cpp.

◆ QualifierMangleMode

enum QualifierMangleMode
strong
Enumerator
Drop 
Mangle 
Result 

Definition at line 141 of file MicrosoftDemangle.cpp.

◆ Qualifiers

enum Qualifiers : uint8_t
Enumerator
Q_None 
Q_Const 
Q_Volatile 
Q_Far 
Q_Huge 
Q_Unaligned 
Q_Restrict 
Q_Pointer64 

Definition at line 121 of file MicrosoftDemangle.cpp.

◆ ReferenceKind

enum ReferenceKind : uint8_t
strong
Enumerator
None 
LValueRef 
RValueRef 

Definition at line 159 of file MicrosoftDemangle.cpp.

◆ StorageClass

enum StorageClass : uint8_t
strong
Enumerator
None 
PrivateStatic 
ProtectedStatic 
PublicStatic 
Global 
FunctionLocalStatic 

Definition at line 132 of file MicrosoftDemangle.cpp.

◆ SymbolCategory

enum SymbolCategory
strong
Enumerator
Unknown 
Function 
Variable 
StringLiteral 

Definition at line 216 of file MicrosoftDemangle.cpp.

Function Documentation

◆ countEmbeddedNulls()

unsigned countEmbeddedNulls ( const uint8_t *  StringBytes,
unsigned  Length 
)

Definition at line 1611 of file MicrosoftDemangle.cpp.

References I, and Result.

Referenced by guessCharByteSize().

◆ countTrailingNullBytes()

unsigned countTrailingNullBytes ( const uint8_t *  StringBytes,
int  Length 
)

Definition at line 1602 of file MicrosoftDemangle.cpp.

Referenced by guessCharByteSize().

◆ decodeMultiByteChar()

static unsigned decodeMultiByteChar ( const uint8_t *  StringBytes,
unsigned  CharIndex,
unsigned  CharBytes 
)
static

◆ demanglePointerCVQualifiers()

static std::pair<Qualifiers, PointerAffinity> demanglePointerCVQualifiers ( StringView MangledName)
static

◆ guessCharByteSize()

unsigned guessCharByteSize ( const uint8_t *  StringBytes,
unsigned  NumChars,
unsigned  NumBytes 
)

Definition at line 1620 of file MicrosoftDemangle.cpp.

References assert(), countEmbeddedNulls(), and countTrailingNullBytes().

Referenced by decodeMultiByteChar().

◆ isArrayType()

static bool isArrayType ( StringView  S)
static

Definition at line 2091 of file MicrosoftDemangle.cpp.

Referenced by isFunctionType().

◆ isFunctionType()

static bool isFunctionType ( StringView  S)
static

◆ isMemberPointer()

static bool isMemberPointer ( StringView  MangledName)
static

◆ isPointerType()

static bool isPointerType ( StringView  S)
static

Definition at line 2076 of file MicrosoftDemangle.cpp.

References StringView::front(), and StringView::startsWith().

Referenced by isFunctionType().

◆ isRebasedHexDigit()

static bool isRebasedHexDigit ( char  C)
static

Definition at line 1446 of file MicrosoftDemangle.cpp.

Referenced by rebasedHexDigitToNumber().

◆ isTagType()

static bool isTagType ( StringView  S)
static

Definition at line 2065 of file MicrosoftDemangle.cpp.

References StringView::front().

Referenced by isFunctionType().

◆ outputCallingConvention()

static void outputCallingConvention ( OutputStream OS,
CallingConv  CC 
)
static

Definition at line 432 of file MicrosoftDemangle.cpp.

References Cdecl, Clrcall, Eabi, Fastcall, outputSpaceIfNecessary(), Pascal, Regcall, Stdcall, Thiscall, and Vectorcall.

Referenced by outputName().

◆ outputEscapedChar()

static void outputEscapedChar ( OutputStream OS,
unsigned  C 
)
static

Definition at line 1557 of file MicrosoftDemangle.cpp.

References outputHex().

Referenced by decodeMultiByteChar().

◆ outputHex()

static void outputHex ( OutputStream OS,
unsigned  C 
)
static

Definition at line 1529 of file MicrosoftDemangle.cpp.

References assert(), I, and writeHexDigit().

Referenced by outputEscapedChar().

◆ outputName()

static void outputName ( OutputStream OS,
const Name TheName,
const Type Ty,
NameResolver &  Resolver 
)
static

◆ outputNameComponent()

static void outputNameComponent ( OutputStream OS,
const Name N,
NameResolver &  Resolver 
)
static

Definition at line 596 of file MicrosoftDemangle.cpp.

References outputParameterList().

Referenced by outputName().

◆ outputParameterList() [1/2]

static void outputParameterList ( OutputStream OS,
const FunctionParams &  Params,
NameResolver &  Resolver 
)
static

Definition at line 510 of file MicrosoftDemangle.cpp.

Referenced by outputName(), and outputNameComponent().

◆ outputParameterList() [2/2]

static void outputParameterList ( OutputStream OS,
const TemplateParams &  Params,
NameResolver &  Resolver 
)
static

Definition at line 556 of file MicrosoftDemangle.cpp.

References outputName().

◆ outputSpaceIfNecessary()

static void outputSpaceIfNecessary ( OutputStream OS)
static

Definition at line 111 of file MicrosoftDemangle.cpp.

References OutputStream::back(), C, and OutputStream::empty().

Referenced by outputCallingConvention(), and outputName().

◆ outputStringLiteral()

static void outputStringLiteral ( OutputStream OS,
const Name TheString 
)
static

Definition at line 529 of file MicrosoftDemangle.cpp.

References assert(), Char, Char16, Char32, outputName(), and Wchar.

Referenced by demanglePointerCVQualifiers().

◆ rebasedHexDigitToNumber()

static uint8_t rebasedHexDigitToNumber ( char  C)
static

◆ startsWithDigit()

static bool startsWithDigit ( StringView  S)
static

◆ startsWithLocalScopePattern()

static bool startsWithLocalScopePattern ( StringView  S)
static

Definition at line 468 of file MicrosoftDemangle.cpp.

References StringView::consumeFront(), and StringView::size().

Referenced by decodeMultiByteChar().

◆ writeHexDigit()

static void writeHexDigit ( char Buffer,
uint8_t  Digit 
)
static

Definition at line 1524 of file MicrosoftDemangle.cpp.

References assert().

Referenced by outputHex().