14 #ifndef LLVM_CLANG_AST_MANGLE_H
15 #define LLVM_CLANG_AST_MANGLE_H
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/ADT/SmallString.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/Support/Casting.h"
24 #include "llvm/Support/raw_ostream.h"
29 class CXXConstructorDecl;
30 class CXXDestructorDecl;
36 struct ThisAdjustment;
50 virtual void anchor();
56 llvm::DenseMap<const BlockDecl*, unsigned> GlobalBlockIds;
57 llvm::DenseMap<const BlockDecl*, unsigned> LocalBlockIds;
58 llvm::DenseMap<const TagDecl*, uint64_t> AnonStructIds;
66 : Context(Context), Diags(Diags), Kind(Kind) {}
77 llvm::DenseMap<const BlockDecl *, unsigned> &BlockIds
78 = Local? LocalBlockIds : GlobalBlockIds;
80 Result = BlockIds.insert(std::make_pair(BD, BlockIds.size()));
81 return Result.first->second;
86 Result = AnonStructIds.insert(std::make_pair(TD, AnonStructIds.size()));
87 return Result.first->second;
107 unsigned ManglingNumber,
138 raw_ostream &Out) = 0;
141 raw_ostream &Out) = 0;
190 raw_ostream &Out) = 0;
197 raw_ostream &Out) = 0;
201 raw_ostream &Out) = 0;
208 raw_ostream &Out) = 0;
211 bool IsUnaligned, uint32_t NumEntries,
212 raw_ostream &Out) = 0;
215 raw_ostream &Out) = 0;
219 uint32_t NVOffset, int32_t VBPtrOffset,
220 uint32_t VBIndex, raw_ostream &Out) = 0;
223 const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset,
224 uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) = 0;
227 raw_ostream &Out) = 0;
230 raw_ostream &Out) = 0;
235 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
void mangleObjCMethodNameWithoutSize(const ObjCMethodDecl *MD, raw_ostream &)
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 mangleCXXThrowInfo(QualType T, bool IsConst, bool IsVolatile, bool IsUnaligned, uint32_t NumEntries, raw_ostream &Out)=0
virtual void mangleDynamicAtExitDestructor(const VarDecl *D, raw_ostream &)=0
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