14 #ifndef LLVM_CLANG_AST_MANGLE_H
15 #define LLVM_CLANG_AST_MANGLE_H
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/SmallString.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/Support/Casting.h"
23 #include "llvm/Support/raw_ostream.h"
28 class CXXConstructorDecl;
29 class CXXDestructorDecl;
35 struct ThisAdjustment;
49 virtual void anchor();
55 llvm::DenseMap<const BlockDecl*, unsigned> GlobalBlockIds;
56 llvm::DenseMap<const BlockDecl*, unsigned> LocalBlockIds;
57 llvm::DenseMap<const TagDecl*, uint64_t> AnonStructIds;
65 : Context(Context), Diags(Diags), Kind(Kind) {}
76 llvm::DenseMap<const BlockDecl *, unsigned> &BlockIds
77 = Local? LocalBlockIds : GlobalBlockIds;
79 Result = BlockIds.insert(std::make_pair(BD, BlockIds.size()));
80 return Result.first->second;
85 Result = AnonStructIds.insert(std::make_pair(TD, AnonStructIds.size()));
86 return Result.first->second;
106 unsigned ManglingNumber,
136 raw_ostream &Out) = 0;
139 raw_ostream &Out) = 0;
188 raw_ostream &Out) = 0;
195 raw_ostream &Out) = 0;
199 raw_ostream &Out) = 0;
206 raw_ostream &Out) = 0;
209 uint32_t NumEntries, raw_ostream &Out) = 0;
212 raw_ostream &Out) = 0;
216 uint32_t NVOffset, int32_t VBPtrOffset,
217 uint32_t VBIndex, raw_ostream &Out) = 0;
220 const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset,
221 uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) = 0;
224 raw_ostream &Out) = 0;
227 raw_ostream &Out) = 0;
232 raw_ostream &Out) = 0;
virtual void mangleSEHFilterExpression(const NamedDecl *EnclosingDecl, raw_ostream &Out)=0
A (possibly-)qualified type.
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
virtual void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type, raw_ostream &)=0
virtual void mangleStaticGuardVariable(const VarDecl *D, raw_ostream &)=0
C Language Family Type Representation.
virtual void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type, raw_ostream &)=0
virtual void mangleSEHFinallyBlock(const NamedDecl *EnclosingDecl, raw_ostream &Out)=0
ASTContext & getASTContext() const
The base class of the type hierarchy.
Represents a C++ constructor within a class.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
A this pointer adjustment.
ObjCMethodDecl - Represents an instance or class method declaration.
virtual void mangleCXXDtorComdat(const CXXDestructorDecl *D, raw_ostream &)=0
virtual void mangleCXXThrowInfo(QualType T, bool IsConst, bool IsVolatile, uint32_t NumEntries, raw_ostream &Out)=0
virtual void mangleItaniumThreadLocalWrapper(const VarDecl *D, raw_ostream &)=0
virtual void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset, const CXXRecordDecl *Type, raw_ostream &)=0
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
virtual void mangleVirtualMemPtrThunk(const CXXMethodDecl *MD, raw_ostream &)=0
virtual void mangleCXXRTTIBaseClassDescriptor(const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset, uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out)=0
The this pointer adjustment as well as an optional return adjustment for a thunk. ...
bool shouldMangleDeclName(const NamedDecl *D)
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
static bool classof(const MangleContext *C)
virtual void mangleReferenceTemporary(const VarDecl *D, unsigned ManglingNumber, raw_ostream &)=0
Concrete class used by the front-end to report problems and issues.
virtual void mangleCXXVTable(const CXXRecordDecl *RD, raw_ostream &)=0
Enums/classes describing ABI related information about constructors, destructors and thunks...
virtual void mangleCXXRTTI(QualType T, raw_ostream &)=0
void mangleName(const NamedDecl *D, raw_ostream &)
virtual void mangleDynamicAtExitDestructor(const VarDecl *D, raw_ostream &)=0
ID
Defines the set of possible language-specific address spaces.
MangleContext(ASTContext &Context, DiagnosticsEngine &Diags, ManglerKind Kind)
CXXDtorType
C++ destructor types.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Represents a C++ destructor within a class.
virtual void mangleDynamicInitializer(const VarDecl *D, raw_ostream &)=0
The result type of a method or function.
virtual void startNewFunction()
virtual void mangleItaniumThreadLocalInit(const VarDecl *D, raw_ostream &)=0
virtual void mangleThreadSafeStaticGuardVariable(const VarDecl *VD, unsigned GuardNum, raw_ostream &Out)=0
virtual void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, const ThisAdjustment &ThisAdjustment, raw_ostream &)=0
virtual void mangleCXXRTTIName(QualType T, raw_ostream &)=0
virtual void mangleCXXCatchableTypeArray(QualType T, uint32_t NumEntries, raw_ostream &Out)=0
virtual bool shouldMangleStringLiteral(const StringLiteral *SL)=0
const TemplateArgument * iterator
unsigned getBlockId(const BlockDecl *BD, bool Local)
TagDecl - Represents the declaration of a struct/union/class/enum.
void mangleDtorBlock(const CXXDestructorDecl *CD, CXXDtorType DT, const BlockDecl *BD, raw_ostream &Out)
virtual bool shouldMangleCXXName(const NamedDecl *D)=0
Represents a static or instance method of a struct/union/class.
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
uint64_t getAnonymousStructId(const TagDecl *TD)
virtual void mangleCXXName(const NamedDecl *D, raw_ostream &)=0
virtual void mangleCXXVBTable(const CXXRecordDecl *Derived, ArrayRef< const CXXRecordDecl * > BasePath, raw_ostream &Out)=0
Mangle vbtable symbols.
virtual void mangleCXXVFTable(const CXXRecordDecl *Derived, ArrayRef< const CXXRecordDecl * > BasePath, raw_ostream &Out)=0
Mangle vftable symbols.
virtual void mangleTypeName(QualType T, raw_ostream &)=0
Generates a unique string for an externally visible type for use with TBAA or type uniquing...
CXXCtorType
C++ constructor types.
ManglerKind getKind() const
virtual void mangleCXXCatchableType(QualType T, const CXXConstructorDecl *CD, CXXCtorType CT, uint32_t Size, uint32_t NVOffset, int32_t VBPtrOffset, uint32_t VBIndex, raw_ostream &Out)=0
MicrosoftMangleContext(ASTContext &C, DiagnosticsEngine &D)
void mangleGlobalBlock(const BlockDecl *BD, const NamedDecl *ID, raw_ostream &Out)
void mangleBlock(const DeclContext *DC, const BlockDecl *BD, raw_ostream &Out)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static bool classof(const MangleContext *C)
void mangleObjCMethodName(const ObjCMethodDecl *MD, raw_ostream &)
virtual void mangleCXXRTTIClassHierarchyDescriptor(const CXXRecordDecl *Derived, raw_ostream &Out)=0
virtual void mangleCXXRTTIBaseClassArray(const CXXRecordDecl *Derived, raw_ostream &Out)=0
ItaniumMangleContext(ASTContext &C, DiagnosticsEngine &D)
Represents a C++ struct/union/class.
virtual void mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, raw_ostream &)=0
virtual void mangleCXXRTTICompleteObjectLocator(const CXXRecordDecl *Derived, ArrayRef< const CXXRecordDecl * > BasePath, raw_ostream &Out)=0
virtual void mangleStringLiteral(const StringLiteral *SL, raw_ostream &)=0
virtual void mangleCXXVirtualDisplacementMap(const CXXRecordDecl *SrcRD, const CXXRecordDecl *DstRD, raw_ostream &Out)=0
StringLiteral - This represents a string literal expression, e.g.
virtual void mangleCXXVTT(const CXXRecordDecl *RD, raw_ostream &)=0
NamedDecl - This represents a decl with a name.
DiagnosticsEngine & getDiags() const
void mangleCtorBlock(const CXXConstructorDecl *CD, CXXCtorType CT, const BlockDecl *BD, raw_ostream &Out)
virtual void mangleCXXCtorComdat(const CXXConstructorDecl *D, raw_ostream &)=0