14 #ifndef LLVM_CLANG_AST_MANGLE_H 15 #define LLVM_CLANG_AST_MANGLE_H 20 #include "llvm/ADT/DenseMap.h" 21 #include "llvm/Support/Casting.h" 30 class CXXConstructorDecl;
31 class CXXDestructorDecl;
34 struct MethodVFTableLocation;
38 struct ThisAdjustment;
52 virtual void anchor();
58 llvm::DenseMap<const BlockDecl*, unsigned> GlobalBlockIds;
59 llvm::DenseMap<const BlockDecl*, unsigned> LocalBlockIds;
60 llvm::DenseMap<const TagDecl*, uint64_t> AnonStructIds;
68 : Context(Context), Diags(Diags), Kind(Kind) {}
79 llvm::DenseMap<const BlockDecl *, unsigned> &BlockIds
80 = Local? LocalBlockIds : GlobalBlockIds;
81 std::pair<llvm::DenseMap<const BlockDecl *, unsigned>::iterator,
bool>
82 Result = BlockIds.insert(std::make_pair(BD, BlockIds.size()));
83 return Result.first->second;
87 std::pair<llvm::DenseMap<const TagDecl *, uint64_t>::iterator,
bool>
88 Result = AnonStructIds.insert(std::make_pair(TD, AnonStructIds.size()));
89 return Result.first->second;
95 bool shouldMangleDeclName(
const NamedDecl *D);
96 virtual bool shouldMangleCXXName(
const NamedDecl *D) = 0;
97 virtual bool shouldMangleStringLiteral(
const StringLiteral *SL) = 0;
100 void mangleName(
const NamedDecl *D, raw_ostream &);
101 virtual void mangleCXXName(
const NamedDecl *D, raw_ostream &) = 0;
108 virtual void mangleReferenceTemporary(
const VarDecl *D,
109 unsigned ManglingNumber,
111 virtual void mangleCXXRTTI(
QualType T, raw_ostream &) = 0;
112 virtual void mangleCXXRTTIName(
QualType T, raw_ostream &) = 0;
117 virtual void mangleStringLiteral(
const StringLiteral *SL, raw_ostream &) = 0;
119 void mangleGlobalBlock(
const BlockDecl *BD,
129 void mangleObjCMethodNameWithoutSize(
const ObjCMethodDecl *MD, raw_ostream &);
130 void mangleObjCMethodName(
const ObjCMethodDecl *MD, raw_ostream &);
132 virtual void mangleStaticGuardVariable(
const VarDecl *D, raw_ostream &) = 0;
134 virtual void mangleDynamicInitializer(
const VarDecl *D, raw_ostream &) = 0;
136 virtual void mangleDynamicAtExitDestructor(
const VarDecl *D,
139 virtual void mangleSEHFilterExpression(
const NamedDecl *EnclosingDecl,
140 raw_ostream &Out) = 0;
142 virtual void mangleSEHFinallyBlock(
const NamedDecl *EnclosingDecl,
143 raw_ostream &Out) = 0;
149 virtual void mangleTypeName(
QualType T, raw_ostream &) = 0;
159 virtual void mangleCXXVTable(
const CXXRecordDecl *RD, raw_ostream &) = 0;
160 virtual void mangleCXXVTT(
const CXXRecordDecl *RD, raw_ostream &) = 0;
164 virtual void mangleItaniumThreadLocalInit(
const VarDecl *D,
166 virtual void mangleItaniumThreadLocalWrapper(
const VarDecl *D,
175 return C->
getKind() == MK_Itanium;
192 raw_ostream &Out) = 0;
199 raw_ostream &Out) = 0;
201 virtual void mangleThreadSafeStaticGuardVariable(
const VarDecl *VD,
203 raw_ostream &Out) = 0;
205 virtual void mangleVirtualMemPtrThunk(
const CXXMethodDecl *MD,
207 raw_ostream &Out) = 0;
209 virtual void mangleCXXVirtualDisplacementMap(
const CXXRecordDecl *SrcRD,
211 raw_ostream &Out) = 0;
213 virtual void mangleCXXThrowInfo(
QualType T,
bool IsConst,
bool IsVolatile,
214 bool IsUnaligned, uint32_t NumEntries,
215 raw_ostream &Out) = 0;
217 virtual void mangleCXXCatchableTypeArray(
QualType T, uint32_t NumEntries,
218 raw_ostream &Out) = 0;
222 uint32_t NVOffset, int32_t VBPtrOffset,
223 uint32_t VBIndex, raw_ostream &Out) = 0;
225 virtual void mangleCXXRTTIBaseClassDescriptor(
226 const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset,
227 uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) = 0;
229 virtual void mangleCXXRTTIBaseClassArray(
const CXXRecordDecl *Derived,
230 raw_ostream &Out) = 0;
232 mangleCXXRTTIClassHierarchyDescriptor(
const CXXRecordDecl *Derived,
233 raw_ostream &Out) = 0;
236 mangleCXXRTTICompleteObjectLocator(
const CXXRecordDecl *Derived,
238 raw_ostream &Out) = 0;
241 return C->
getKind() == MK_Microsoft;
A (possibly-)qualified type.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
C Language Family Type Representation.
The base class of the type hierarchy.
Represents a C++ constructor within a class.
Represents a variable declaration or definition.
A this pointer adjustment.
ObjCMethodDecl - Represents an instance or class method declaration.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The this pointer adjustment as well as an optional return adjustment for a thunk. ...
static bool classof(const MangleContext *C)
Concrete class used by the front-end to report problems and issues.
Enums/classes describing ABI related information about constructors, destructors and thunks...
MangleContext(ASTContext &Context, DiagnosticsEngine &Diags, ManglerKind Kind)
CXXDtorType
C++ destructor types.
ASTContext & getASTContext() const
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a C++ destructor within a class.
virtual void startNewFunction()
unsigned getBlockId(const BlockDecl *BD, bool Local)
Represents the declaration of a struct/union/class/enum.
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)
CXXCtorType
C++ constructor types.
MicrosoftMangleContext(ASTContext &C, DiagnosticsEngine &D)
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static bool classof(const MangleContext *C)
DiagnosticsEngine & getDiags() const
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
ItaniumMangleContext(ASTContext &C, DiagnosticsEngine &D)
Represents a C++ struct/union/class.
StringLiteral - This represents a string literal expression, e.g.
This represents a decl that may have a name.
ManglerKind getKind() const