14 #ifndef LLVM_CLANG_AST_MANGLE_H 15 #define LLVM_CLANG_AST_MANGLE_H 19 #include "llvm/ADT/DenseMap.h" 20 #include "llvm/Support/Casting.h" 29 class CXXConstructorDecl;
30 class CXXDestructorDecl;
33 struct MethodVFTableLocation;
37 struct ThisAdjustment;
51 virtual void anchor();
57 llvm::DenseMap<const BlockDecl*, unsigned> GlobalBlockIds;
58 llvm::DenseMap<const BlockDecl*, unsigned> LocalBlockIds;
59 llvm::DenseMap<const TagDecl*, uint64_t> AnonStructIds;
67 : Context(Context), Diags(Diags), Kind(Kind) {}
78 llvm::DenseMap<const BlockDecl *, unsigned> &BlockIds
79 = Local? LocalBlockIds : GlobalBlockIds;
80 std::pair<llvm::DenseMap<const BlockDecl *, unsigned>::iterator,
bool>
81 Result = BlockIds.insert(std::make_pair(BD, BlockIds.size()));
82 return Result.first->second;
86 std::pair<llvm::DenseMap<const TagDecl *, uint64_t>::iterator,
bool>
87 Result = AnonStructIds.insert(std::make_pair(TD, AnonStructIds.size()));
88 return Result.first->second;
94 bool shouldMangleDeclName(
const NamedDecl *D);
95 virtual bool shouldMangleCXXName(
const NamedDecl *D) = 0;
96 virtual bool shouldMangleStringLiteral(
const StringLiteral *SL) = 0;
99 void mangleName(
const NamedDecl *D, raw_ostream &);
100 virtual void mangleCXXName(
const NamedDecl *D, raw_ostream &) = 0;
107 virtual void mangleReferenceTemporary(
const VarDecl *D,
108 unsigned ManglingNumber,
110 virtual void mangleCXXRTTI(
QualType T, raw_ostream &) = 0;
111 virtual void mangleCXXRTTIName(
QualType T, raw_ostream &) = 0;
116 virtual void mangleStringLiteral(
const StringLiteral *SL, raw_ostream &) = 0;
118 void mangleGlobalBlock(
const BlockDecl *BD,
128 void mangleObjCMethodNameWithoutSize(
const ObjCMethodDecl *MD, raw_ostream &);
129 void mangleObjCMethodName(
const ObjCMethodDecl *MD, raw_ostream &);
131 virtual void mangleStaticGuardVariable(
const VarDecl *D, raw_ostream &) = 0;
133 virtual void mangleDynamicInitializer(
const VarDecl *D, raw_ostream &) = 0;
135 virtual void mangleDynamicAtExitDestructor(
const VarDecl *D,
138 virtual void mangleSEHFilterExpression(
const NamedDecl *EnclosingDecl,
139 raw_ostream &Out) = 0;
141 virtual void mangleSEHFinallyBlock(
const NamedDecl *EnclosingDecl,
142 raw_ostream &Out) = 0;
148 virtual void mangleTypeName(
QualType T, raw_ostream &) = 0;
158 virtual void mangleCXXVTable(
const CXXRecordDecl *RD, raw_ostream &) = 0;
159 virtual void mangleCXXVTT(
const CXXRecordDecl *RD, raw_ostream &) = 0;
163 virtual void mangleItaniumThreadLocalInit(
const VarDecl *D,
165 virtual void mangleItaniumThreadLocalWrapper(
const VarDecl *D,
174 return C->
getKind() == MK_Itanium;
191 raw_ostream &Out) = 0;
198 raw_ostream &Out) = 0;
200 virtual void mangleThreadSafeStaticGuardVariable(
const VarDecl *VD,
202 raw_ostream &Out) = 0;
204 virtual void mangleVirtualMemPtrThunk(
const CXXMethodDecl *MD,
206 raw_ostream &Out) = 0;
208 virtual void mangleCXXVirtualDisplacementMap(
const CXXRecordDecl *SrcRD,
210 raw_ostream &Out) = 0;
212 virtual void mangleCXXThrowInfo(
QualType T,
bool IsConst,
bool IsVolatile,
213 bool IsUnaligned, uint32_t NumEntries,
214 raw_ostream &Out) = 0;
216 virtual void mangleCXXCatchableTypeArray(
QualType T, uint32_t NumEntries,
217 raw_ostream &Out) = 0;
221 uint32_t NVOffset, int32_t VBPtrOffset,
222 uint32_t VBIndex, raw_ostream &Out) = 0;
224 virtual void mangleCXXRTTIBaseClassDescriptor(
225 const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset,
226 uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) = 0;
228 virtual void mangleCXXRTTIBaseClassArray(
const CXXRecordDecl *Derived,
229 raw_ostream &Out) = 0;
231 mangleCXXRTTIClassHierarchyDescriptor(
const CXXRecordDecl *Derived,
232 raw_ostream &Out) = 0;
235 mangleCXXRTTICompleteObjectLocator(
const CXXRecordDecl *Derived,
237 raw_ostream &Out) = 0;
240 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