26 #include "llvm/ADT/iterator.h" 28 using namespace clang;
44 assert(RT &&
"type of VarDecl is expected to be RecordType.");
45 assert(RT->
getDecl()->
isUnion() &&
"RecordType is expected to be a union.");
47 return FD->getIdentifier();
54 struct DecompositionDeclName {
58 BindingArray Bindings;
62 : llvm::iterator_adaptor_base<Iterator, BindingArray::const_iterator,
63 std::random_access_iterator_tag,
64 const IdentifierInfo *> {
65 Iterator(BindingArray::const_iterator It) : iterator_adaptor_base(It) {}
67 return (*this->I)->getIdentifier();
70 Iterator begin()
const {
return Iterator(Bindings.begin()); }
71 Iterator end()
const {
return Iterator(Bindings.end()); }
81 return {ArrayInfo::getEmptyKey()};
84 return {ArrayInfo::getTombstoneKey()};
87 assert(!isEqual(Key, getEmptyKey()) && !isEqual(Key, getTombstoneKey()));
88 return llvm::hash_combine_range(Key.begin(), Key.end());
90 static bool isEqual(DecompositionDeclName LHS, DecompositionDeclName RHS) {
91 if (ArrayInfo::isEqual(LHS.Bindings, ArrayInfo::getEmptyKey()))
92 return ArrayInfo::isEqual(RHS.Bindings, ArrayInfo::getEmptyKey());
93 if (ArrayInfo::isEqual(LHS.Bindings, ArrayInfo::getTombstoneKey()))
94 return ArrayInfo::isEqual(RHS.Bindings, ArrayInfo::getTombstoneKey());
95 return LHS.Bindings.size() == RHS.Bindings.size() &&
96 std::equal(LHS.begin(), LHS.end(), RHS.begin());
106 llvm::DenseMap<const Type *, unsigned> ManglingNumbers;
107 llvm::DenseMap<const IdentifierInfo *, unsigned> VarManglingNumbers;
108 llvm::DenseMap<const IdentifierInfo *, unsigned> TagManglingNumbers;
109 llvm::DenseMap<DecompositionDeclName, unsigned>
110 DecompsitionDeclManglingNumbers;
113 unsigned getManglingNumber(
const CXXMethodDecl *CallOperator)
override {
121 Context.getFunctionType(Context.VoidTy, Proto->
getParamTypes(), EPI);
126 unsigned getManglingNumber(
const BlockDecl *BD)
override {
127 const Type *Ty =
nullptr;
128 return ++ManglingNumbers[Ty];
131 unsigned getStaticLocalNumber(
const VarDecl *VD)
override {
136 unsigned getManglingNumber(
const VarDecl *VD,
unsigned)
override {
137 if (
auto *DD = dyn_cast<DecompositionDecl>(VD)) {
138 DecompositionDeclName Name{DD->bindings()};
139 return ++DecompsitionDeclManglingNumbers[Name];
146 Identifier = findAnonymousUnionVarDeclName(*VD);
151 unsigned getManglingNumber(
const TagDecl *TD,
unsigned)
override {
156 class ItaniumCXXABI :
public CXXABI {
160 ItaniumCXXABI(
ASTContext &Ctx) : Context(Ctx) { }
166 MemberPointerInfo MPI;
169 MPI.HasPadding =
false;
175 CallingConv getDefaultMethodCallConv(
bool isVariadic)
const override {
177 if (!isVariadic && T.isWindowsGNUEnvironment() &&
178 T.getArch() == llvm::Triple::x86)
198 getCopyConstructorForExceptionObject(
CXXRecordDecl *RD)
override {
205 void addTypedefNameForUnnamedTagDecl(
TagDecl *TD,
212 void addDeclaratorForUnnamedTagDecl(
TagDecl *TD,
219 std::unique_ptr<MangleNumberingContext>
220 createMangleNumberingContext()
const override {
221 return llvm::make_unique<ItaniumNumberingContext>();
227 return new ItaniumCXXABI(Ctx);
Defines the clang::ASTContext interface.
unsigned getTypeWidth(IntType T) const
Return the width (in bits) of the specified integer type enum.
A (possibly-)qualified type.
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
C Language Family Type Representation.
bool isVariadic() const
Whether this function prototype is variadic.
The base class of the type hierarchy.
const TargetInfo & getTargetInfo() const
Represents a C++ constructor within a class.
Represents a variable declaration or definition.
const T * getAs() const
Member-template getAs<specific type>'.
Extra information about a function prototype.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
One of these records is kept for each identifier that is lexed.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
ArrayRef< QualType > getParamTypes() const
Represents a member of a struct/union/class.
static DecompositionDeclName getTombstoneKey()
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
static bool isEqual(DecompositionDeclName LHS, DecompositionDeclName RHS)
CharUnits - This is an opaque type for sizes expressed in character units.
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
static unsigned getHashValue(DecompositionDeclName Key)
Represents a prototype with parameter type info, e.g.
bool isDynamicClass() const
Represents a ValueDecl that came out of a declarator.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
Exposes information about the current target.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
const FieldDecl * findFirstNamedDataMember() const
Finds the first data member which has a name.
virtual CallingConv getDefaultCallingConv() const
Gets the default calling convention for the given target and declaration context. ...
const T * castAs() const
Member-template castAs<specific type>.
static DecompositionDeclName getEmptyKey()
Implements C++ ABI-specific semantic analysis functions.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
unsigned getTypeAlign(IntType T) const
Return the alignment (in bits) of the specified integer type enum.
RecordDecl * getDecl() const
IntType getPtrDiffType(unsigned AddrSpace) const
QualType getCanonicalType() const
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.
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Base class for declarations which introduce a typedef-name.
Dataflow Directional Tag Classes.
A pointer to member type per C++ 8.3.3 - Pointers to members.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
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.
bool isMemberFunctionPointer() const
Returns true if the member type (i.e.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
Defines the clang::TargetInfo interface.