LLVM  10.0.0svn
Classes | Functions
MicrosoftDemangle.cpp File Reference
#include "llvm/Demangle/MicrosoftDemangle.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/Demangle/MicrosoftDemangleNodes.h"
#include "llvm/Demangle/DemangleConfig.h"
#include "llvm/Demangle/StringView.h"
#include "llvm/Demangle/Utility.h"
#include <array>
#include <cctype>
#include <cstdio>
#include <tuple>
Include dependency graph for MicrosoftDemangle.cpp:

Go to the source code of this file.

Classes

struct  NodeList
 

Functions

static bool startsWithDigit (StringView S)
 
static bool isMemberPointer (StringView MangledName, bool &Error)
 
static SpecialIntrinsicKind consumeSpecialIntrinsicKind (StringView &MangledName)
 
static bool startsWithLocalScopePattern (StringView S)
 
static bool isTagType (StringView S)
 
static bool isCustomType (StringView S)
 
static bool isPointerType (StringView S)
 
static bool isArrayType (StringView S)
 
static bool isFunctionType (StringView S)
 
static FunctionRefQualifier demangleFunctionRefQualifier (StringView &MangledName)
 
static std::pair< Qualifiers, PointerAffinitydemanglePointerCVQualifiers (StringView &MangledName)
 
static NamedIdentifierNodesynthesizeNamedIdentifier (ArenaAllocator &Arena, StringView Name)
 
static QualifiedNameNodesynthesizeQualifiedName (ArenaAllocator &Arena, IdentifierNode *Identifier)
 
static QualifiedNameNodesynthesizeQualifiedName (ArenaAllocator &Arena, StringView Name)
 
static VariableSymbolNodesynthesizeVariable (ArenaAllocator &Arena, TypeNode *Type, StringView VariableName)
 
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)
 
static unsigned countTrailingNullBytes (const uint8_t *StringBytes, int Length)
 
static unsigned countEmbeddedNulls (const uint8_t *StringBytes, unsigned Length)
 
static unsigned guessCharByteSize (const uint8_t *StringBytes, unsigned NumChars, uint64_t NumBytes)
 
static unsigned decodeMultiByteChar (const uint8_t *StringBytes, unsigned CharIndex, unsigned CharBytes)
 
static NodeArrayNodenodeListToNodeArray (ArenaAllocator &Arena, NodeList *Head, size_t Count)
 

Function Documentation

◆ consumeSpecialIntrinsicKind()

static SpecialIntrinsicKind consumeSpecialIntrinsicKind ( StringView MangledName)
static

◆ countEmbeddedNulls()

static unsigned countEmbeddedNulls ( const uint8_t *  StringBytes,
unsigned  Length 
)
static

Definition at line 1195 of file MicrosoftDemangle.cpp.

References I, and llvm::ms_demangle::Result.

Referenced by guessCharByteSize().

◆ countTrailingNullBytes()

static unsigned countTrailingNullBytes ( const uint8_t *  StringBytes,
int  Length 
)
static

Definition at line 1184 of file MicrosoftDemangle.cpp.

Referenced by guessCharByteSize().

◆ decodeMultiByteChar()

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

◆ demangleFunctionRefQualifier()

static FunctionRefQualifier demangleFunctionRefQualifier ( StringView MangledName)
static

◆ demanglePointerCVQualifiers()

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

◆ guessCharByteSize()

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

Definition at line 1208 of file MicrosoftDemangle.cpp.

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

Referenced by decodeMultiByteChar().

◆ isArrayType()

static bool isArrayType ( StringView  S)
static

Definition at line 209 of file MicrosoftDemangle.cpp.

Referenced by nodeListToNodeArray().

◆ isCustomType()

static bool isCustomType ( StringView  S)
static

Definition at line 192 of file MicrosoftDemangle.cpp.

Referenced by nodeListToNodeArray().

◆ isFunctionType()

static bool isFunctionType ( StringView  S)
static

Definition at line 211 of file MicrosoftDemangle.cpp.

Referenced by nodeListToNodeArray().

◆ isMemberPointer()

static bool isMemberPointer ( StringView  MangledName,
bool Error 
)
static

Definition at line 42 of file MicrosoftDemangle.cpp.

References DEMANGLE_UNREACHABLE, and startsWithDigit().

Referenced by nodeListToNodeArray().

◆ isPointerType()

static bool isPointerType ( StringView  S)
static

Definition at line 194 of file MicrosoftDemangle.cpp.

Referenced by nodeListToNodeArray().

◆ isRebasedHexDigit()

static bool isRebasedHexDigit ( char  C)
static

Definition at line 1026 of file MicrosoftDemangle.cpp.

Referenced by rebasedHexDigitToNumber().

◆ isTagType()

static bool isTagType ( StringView  S)
static

Definition at line 181 of file MicrosoftDemangle.cpp.

Referenced by nodeListToNodeArray().

◆ nodeListToNodeArray()

static NodeArrayNode* nodeListToNodeArray ( ArenaAllocator Arena,
NodeList Head,
size_t  Count 
)
static

Definition at line 1557 of file MicrosoftDemangle.cpp.

References llvm::ms_demangle::PointerTypeNode::Affinity, llvm::ms_demangle::TemplateParameterReferenceNode::Affinity, llvm::ms_demangle::ArenaAllocator::alloc(), llvm::ms_demangle::ArenaAllocator::allocArray(), assert(), llvm::ms_demangle::Bool, llvm::ms_demangle::FunctionSignatureNode::CallConvention, llvm::ms_demangle::Cdecl, llvm::ms_demangle::Char, llvm::ms_demangle::Char16, llvm::ms_demangle::Char32, llvm::ms_demangle::Char8, llvm::ms_demangle::Class, llvm::ms_demangle::PointerTypeNode::ClassParent, llvm::ms_demangle::Clrcall, llvm::ms_demangle::QualifiedNameNode::Components, llvm::ms_demangle::NodeArrayNode::Count, D, DEMANGLE_FALLTHROUGH, DEMANGLE_UNREACHABLE, demangleFunctionRefQualifier(), demanglePointerCVQualifiers(), llvm::ms_demangle::ArrayTypeNode::Dimensions, llvm::ms_demangle::Double, llvm::ms_demangle::Drop, llvm::ms_demangle::Eabi, llvm::ms_demangle::ArrayTypeNode::ElementType, llvm::ms_demangle::Enum, llvm::ms_demangle::Fastcall, R600_InstFlag::FC, llvm::ms_demangle::FC_ExternC, llvm::ms_demangle::FC_Far, llvm::ms_demangle::FC_Global, llvm::ms_demangle::FC_None, llvm::ms_demangle::FC_NoParameterList, llvm::ms_demangle::FC_Private, llvm::ms_demangle::FC_Protected, llvm::ms_demangle::FC_Public, llvm::ms_demangle::FC_Static, llvm::ms_demangle::FC_StaticThisAdjust, llvm::ms_demangle::FC_Virtual, llvm::ms_demangle::FC_VirtualThisAdjust, llvm::ms_demangle::FC_VirtualThisAdjustEx, first, llvm::ms_demangle::Float, llvm::ms_demangle::FunctionSignatureNode::FunctionClass, llvm::ms_demangle::FunctionLocalStatic, llvm::ms_demangle::QualifiedNameNode::getUnqualifiedIdentifier(), llvm::ms_demangle::Global, I, llvm::ms_demangle::CustomTypeNode::Identifier, llvm::ms_demangle::Int, llvm::ms_demangle::Int64, isArrayType(), isCustomType(), isFunctionType(), isMemberPointer(), llvm::ms_demangle::TemplateParameterReferenceNode::IsMemberPointer, llvm::ms_demangle::FunctionSignatureNode::IsNoexcept, isPointerType(), isTagType(), llvm::ms_demangle::FunctionSignatureNode::IsVariadic, llvm::ms_demangle::Ldouble, llvm::ms_demangle::Long, llvm::ms_demangle::Mangle, NodeList::N, N, llvm::ms_demangle::SymbolNode::Name, NodeList::Next, llvm::ms_demangle::NodeArrayNode::Nodes, llvm::ms_demangle::None, llvm::ms_demangle::Nullptr, llvm::ms_demangle::FunctionSignatureNode::Params, parse(), llvm::ms_demangle::Pascal, llvm::ms_demangle::PointerTypeNode::Pointee, llvm::ms_demangle::Pointer, llvm::ms_demangle::PrivateStatic, llvm::ms_demangle::ProtectedStatic, llvm::ms_demangle::PublicStatic, llvm::ms_demangle::Q_Const, llvm::ms_demangle::Q_None, llvm::ms_demangle::Q_Pointer64, llvm::ms_demangle::Q_Restrict, llvm::ms_demangle::Q_Unaligned, llvm::ms_demangle::Q_Volatile, llvm::ms_demangle::TagTypeNode::QualifiedName, llvm::ms_demangle::TypeNode::Quals, llvm::ms_demangle::Reference, llvm::ms_demangle::FunctionSignatureNode::RefQualifier, llvm::ms_demangle::Result, llvm::ms_demangle::FunctionSignatureNode::ReturnType, llvm::ms_demangle::Schar, llvm::ms_demangle::Short, llvm::ms_demangle::FunctionSymbolNode::Signature, startsWithDigit(), llvm::ms_demangle::ThunkSignatureNode::ThisAdjustor::StaticOffset, llvm::ms_demangle::Stdcall, llvm::ms_demangle::Struct, llvm::ARMBuildAttrs::Symbol, llvm::ms_demangle::TemplateParameterReferenceNode::Symbol, llvm::CallingConv::Tail, llvm::ms_demangle::ThunkSignatureNode::ThisAdjust, llvm::ms_demangle::Thiscall, llvm::ms_demangle::TemplateParameterReferenceNode::ThunkOffsetCount, llvm::ms_demangle::TemplateParameterReferenceNode::ThunkOffsets, TT, llvm::ms_demangle::Uchar, llvm::ms_demangle::Uint, llvm::ms_demangle::Uint64, llvm::ms_demangle::Ulong, llvm::ms_demangle::Union, llvm::ms_demangle::Ushort, llvm::ms_demangle::ThunkSignatureNode::ThisAdjustor::VBOffsetOffset, llvm::ms_demangle::ThunkSignatureNode::ThisAdjustor::VBPtrOffset, llvm::ms_demangle::Vectorcall, llvm::ms_demangle::Void, llvm::ms_demangle::ThunkSignatureNode::ThisAdjustor::VtordispOffset, and llvm::ms_demangle::Wchar.

◆ outputEscapedChar()

static void outputEscapedChar ( OutputStream OS,
unsigned  C 
)
static

Definition at line 1136 of file MicrosoftDemangle.cpp.

References outputHex().

Referenced by decodeMultiByteChar().

◆ outputHex()

static void outputHex ( OutputStream OS,
unsigned  C 
)
static

Definition at line 1110 of file MicrosoftDemangle.cpp.

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

Referenced by outputEscapedChar().

◆ rebasedHexDigitToNumber()

static uint8_t rebasedHexDigitToNumber ( char  C)
static

Definition at line 1028 of file MicrosoftDemangle.cpp.

References assert(), C, isRebasedHexDigit(), Lookup(), and startsWithDigit().

◆ startsWithDigit()

static bool startsWithDigit ( StringView  S)
static

◆ startsWithLocalScopePattern()

static bool startsWithLocalScopePattern ( StringView  S)
static

Definition at line 142 of file MicrosoftDemangle.cpp.

◆ synthesizeNamedIdentifier()

static NamedIdentifierNode* synthesizeNamedIdentifier ( ArenaAllocator Arena,
StringView  Name 
)
static

◆ synthesizeQualifiedName() [1/2]

static QualifiedNameNode* synthesizeQualifiedName ( ArenaAllocator Arena,
IdentifierNode Identifier 
)
static

◆ synthesizeQualifiedName() [2/2]

static QualifiedNameNode* synthesizeQualifiedName ( ArenaAllocator Arena,
StringView  Name 
)
static

◆ synthesizeVariable()

static VariableSymbolNode* synthesizeVariable ( ArenaAllocator Arena,
TypeNode Type,
StringView  VariableName 
)
static

Definition at line 341 of file MicrosoftDemangle.cpp.

References llvm::ms_demangle::ArenaAllocator::alloc(), llvm::ms_demangle::ArrayDelete, llvm::ms_demangle::ArrayNew, llvm::ms_demangle::ArraySubscript, assert(), llvm::ms_demangle::Assign, llvm::ms_demangle::Basic, llvm::ms_demangle::BitwiseAnd, llvm::ms_demangle::BitwiseAndEqual, llvm::ms_demangle::BitwiseNot, llvm::ms_demangle::BitwiseOr, llvm::ms_demangle::BitwiseOrEqual, llvm::ms_demangle::BitwiseXor, llvm::ms_demangle::BitwiseXorEqual, llvm::ms_demangle::CoAwait, llvm::ms_demangle::Comma, consumeSpecialIntrinsicKind(), llvm::ms_demangle::ConversionOperatorIdentifier, llvm::ms_demangle::CopyCtorClosure, llvm::ms_demangle::Decrement, llvm::ms_demangle::DefaultCtorClosure, llvm::ms_demangle::Delete, DEMANGLE_UNREACHABLE, llvm::ms_demangle::Dereference, llvm::ms_demangle::DivEqual, llvm::ms_demangle::Divide, llvm::ms_demangle::DoubleUnder, llvm::ms_demangle::DynamicAtexitDestructor, llvm::ms_demangle::DynamicInitializer, llvm::ms_demangle::EHVecCtorIter, llvm::ms_demangle::EHVecDtorIter, llvm::ms_demangle::EHVectorCopyCtorIter, llvm::ms_demangle::EHVectorVbaseCopyCtorIter, llvm::ms_demangle::EHVecVbaseCtorIter, llvm::ms_demangle::Equals, llvm::ms_demangle::RttiBaseClassDescriptorNode::Flags, llvm::ms_demangle::QualifiedNameNode::getUnqualifiedIdentifier(), llvm::ms_demangle::GreaterThan, llvm::ms_demangle::GreaterThanEqual, I, llvm::ms_demangle::Increment, llvm::ms_demangle::DynamicStructorIdentifierNode::IsDestructor, llvm::ms_demangle::StructorIdentifierNode::IsDestructor, llvm::ms_demangle::Node::kind(), llvm::ms_demangle::LeftShift, llvm::ms_demangle::LessThan, llvm::ms_demangle::LessThanEqual, llvm::ms_demangle::LocalStaticGuard, llvm::ms_demangle::LocalStaticThreadGuard, llvm::ms_demangle::LocalVftable, llvm::ms_demangle::LocalVftableCtorClosure, llvm::ms_demangle::LogicalAnd, llvm::ms_demangle::LogicalNot, llvm::ms_demangle::LogicalOr, llvm::ms_demangle::LshEqual, llvm::ms_demangle::ManVectorCtorIter, llvm::ms_demangle::ManVectorDtorIter, llvm::ms_demangle::ManVectorVbaseCopyCtorIter, llvm::ms_demangle::MemberPointer, llvm::ms_demangle::Minus, llvm::ms_demangle::MinusEqual, llvm::ms_demangle::ModEqual, llvm::ms_demangle::Modulus, N, Name, llvm::ms_demangle::DynamicStructorIdentifierNode::Name, llvm::ms_demangle::LiteralOperatorIdentifierNode::Name, llvm::ms_demangle::SymbolNode::Name, llvm::ms_demangle::New, llvm::ms_demangle::None, llvm::ms_demangle::NotEquals, StringView::npos, llvm::ms_demangle::RttiBaseClassDescriptorNode::NVOffset, llvm::ms_demangle::Parens, llvm::ms_demangle::Plus, llvm::ms_demangle::PlusEqual, llvm::ms_demangle::Pointer, llvm::ms_demangle::Result, llvm::ms_demangle::FunctionSignatureNode::ReturnType, llvm::ms_demangle::RightShift, llvm::ms_demangle::RshEqual, llvm::ms_demangle::RttiBaseClassArray, llvm::ms_demangle::RttiBaseClassDescriptor, llvm::ms_demangle::RttiClassHierarchyDescriptor, llvm::ms_demangle::RttiCompleteObjLocator, llvm::ms_demangle::RttiTypeDescriptor, llvm::PPCISD::SC, llvm::ms_demangle::ScalarDelDtor, llvm::ms_demangle::FunctionSymbolNode::Signature, llvm::ms_demangle::Spaceship, llvm::ms_demangle::StringLiteralSymbol, llvm::ARMBuildAttrs::Symbol, synthesizeNamedIdentifier(), synthesizeQualifiedName(), llvm::ms_demangle::ConversionOperatorIdentifierNode::TargetType, llvm::ms_demangle::TimesEqual, llvm::ms_demangle::VariableSymbolNode::Type, llvm::ms_demangle::Typeof, llvm::ms_demangle::UdtReturning, llvm::ms_demangle::Under, llvm::ms_demangle::Unknown, llvm::ms_demangle::DynamicStructorIdentifierNode::Variable, llvm::ms_demangle::VariableSymbol, llvm::ms_demangle::VbaseDtor, llvm::ms_demangle::RttiBaseClassDescriptorNode::VBPtrOffset, llvm::ms_demangle::Vbtable, llvm::ms_demangle::RttiBaseClassDescriptorNode::VBTableOffset, llvm::ms_demangle::VcallThunk, llvm::ms_demangle::VdispMap, llvm::ms_demangle::VecCtorIter, llvm::ms_demangle::VecDelDtor, llvm::ms_demangle::VecDtorIter, llvm::ms_demangle::VectorCopyCtorIter, llvm::ms_demangle::VectorVbaseCopyCtorIter, llvm::ms_demangle::VecVbaseCtorIter, and llvm::ms_demangle::Vftable.

◆ writeHexDigit()

static void writeHexDigit ( char Buffer,
uint8_t  Digit 
)
static

Definition at line 1105 of file MicrosoftDemangle.cpp.

References assert().

Referenced by outputHex().