24 using namespace clang;
31 llvm::DenseMap<const Type *, unsigned> ManglingNumbers;
32 unsigned LambdaManglingNumber;
33 unsigned StaticLocalNumber;
34 unsigned StaticThreadlocalNumber;
37 MicrosoftNumberingContext()
39 StaticLocalNumber(0), StaticThreadlocalNumber(0) {}
41 unsigned getManglingNumber(
const CXXMethodDecl *CallOperator)
override {
42 return ++LambdaManglingNumber;
45 unsigned getManglingNumber(
const BlockDecl *BD)
override {
46 const Type *Ty =
nullptr;
47 return ++ManglingNumbers[Ty];
50 unsigned getStaticLocalNumber(
const VarDecl *VD)
override {
52 return ++StaticThreadlocalNumber;
53 return ++StaticLocalNumber;
56 unsigned getManglingNumber(
const VarDecl *VD,
57 unsigned MSLocalManglingNumber)
override {
58 return MSLocalManglingNumber;
61 unsigned getManglingNumber(
const TagDecl *TD,
62 unsigned MSLocalManglingNumber)
override {
63 return MSLocalManglingNumber;
67 class MicrosoftCXXABI :
public CXXABI {
69 llvm::SmallDenseMap<CXXRecordDecl *, CXXConstructorDecl *> RecordToCopyCtor;
70 llvm::SmallDenseMap<std::pair<const CXXConstructorDecl *, unsigned>,
Expr *>
76 std::pair<uint64_t, unsigned>
79 CallingConv getDefaultMethodCallConv(
bool isVariadic)
const override {
101 unsigned ParmIdx,
Expr *DAE)
override {
102 CtorToDefaultArgExpr[std::make_pair(CD, ParmIdx)] = DAE;
106 unsigned ParmIdx)
override {
107 return CtorToDefaultArgExpr[std::make_pair(CD, ParmIdx)];
111 getCopyConstructorForExceptionObject(
CXXRecordDecl *RD)
override {
112 return RecordToCopyCtor[RD];
118 assert(CD !=
nullptr);
119 assert(RecordToCopyCtor[RD] ==
nullptr || RecordToCopyCtor[RD] == CD);
120 RecordToCopyCtor[RD] = CD;
124 return new MicrosoftNumberingContext();
148 return MSInheritanceAttr::Keyword_unspecified_inheritance;
150 return MSInheritanceAttr::Keyword_virtual_inheritance;
152 return MSInheritanceAttr::Keyword_multiple_inheritance;
153 return MSInheritanceAttr::Keyword_single_inheritance;
156 MSInheritanceAttr::Spelling
158 MSInheritanceAttr *IA = getAttr<MSInheritanceAttr>();
159 assert(IA &&
"Expected MSInheritanceAttr on the CXXRecordDecl!");
160 return IA->getSemanticSpelling();
164 if (MSVtorDispAttr *VDA = getAttr<MSVtorDispAttr>())
165 return VDA->getVtorDispMode();
166 return MSVtorDispAttr::Mode(
getASTContext().getLangOpts().VtorDispMode);
198 static std::pair<unsigned, unsigned>
211 if (MSInheritanceAttr::hasVBPtrOffsetField(Inheritance))
213 if (MSInheritanceAttr::hasVBTableOffsetField(Inheritance))
215 return std::make_pair(Ptrs, Ints);
218 std::pair<uint64_t, unsigned> MicrosoftCXXABI::getMemberPointerWidthAndAlign(
228 uint64_t Width = Ptrs * PtrSize + Ints * IntSize;
234 if (Ptrs + Ints > 1 && Target.
getTriple().isArch32Bit())
242 Width = llvm::RoundUpToAlignment(Width, Align);
243 return std::make_pair(Width, Align);
247 return new MicrosoftCXXABI(Ctx);
Defines the clang::ASTContext interface.
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
bool isParsingBaseSpecifiers() const
QualType getType() const
Retrieves the type of the base class.
MSInheritanceAttr::Spelling getMSInheritanceModel() const
Returns the inheritance model used for this record.
bool hasDefinition() const
Represents a C++ constructor within a class.
TLSKind getTLSKind() const
MSVtorDispAttr::Mode getMSVtorDispMode() const
Controls when vtordisps will be emitted if this record is used as a virtual base. ...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const TargetInfo & getTargetInfo() const
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
base_class_iterator bases_begin()
bool isMemberFunctionPointer() const
Exposes information about the current target.
MSInheritanceAttr::Spelling calculateInheritanceModel() const
Calculate what the inheritance model would be for this class.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
Implements C++ ABI-specific semantic analysis functions.
unsigned getNumBases() const
Retrieves the number of base classes of this class.
unsigned getIntAlign() const
CallingConv
CallingConv - Specifies the calling convention that a function uses.
CXXRecordDecl * getMostRecentCXXRecordDecl() const
static bool usesMultipleInheritanceModel(const CXXRecordDecl *RD)
uint64_t getPointerAlign(unsigned AddrSpace) const
TagDecl - Represents the declaration of a struct/union/class/enum.
ASTContext & getASTContext() const LLVM_READONLY
Represents a static or instance method of a struct/union/class.
bool isDynamicClass() const
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
unsigned getIntWidth() const
CharUnits getNonVirtualSize() const
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Represents a C++ struct/union/class.
Defines the clang::TargetInfo interface.
unsigned getNumVBases() const
Retrieves the number of virtual base classes of this class.
bool isPolymorphic() const
static std::pair< unsigned, unsigned > getMSMemberPointerSlots(const MemberPointerType *MPT)