27 #include "llvm/ADT/FoldingSet.h" 28 #include "llvm/ADT/iterator.h" 30 using namespace clang;
46 assert(RT &&
"type of VarDecl is expected to be RecordType.");
47 assert(RT->
getDecl()->
isUnion() &&
"RecordType is expected to be a union.");
49 return FD->getIdentifier();
56 struct DecompositionDeclName {
60 BindingArray Bindings;
64 : llvm::iterator_adaptor_base<Iterator, BindingArray::const_iterator,
65 std::random_access_iterator_tag,
66 const IdentifierInfo *> {
67 Iterator(BindingArray::const_iterator It) : iterator_adaptor_base(It) {}
69 return (*this->I)->getIdentifier();
72 Iterator begin()
const {
return Iterator(Bindings.begin()); }
73 Iterator end()
const {
return Iterator(Bindings.end()); }
91 if (LHSEmpty || RHSEmpty)
92 return LHSEmpty && RHSEmpty;
96 if (LHSTombstone || RHSTombstone)
97 return LHSTombstone && RHSTombstone;
106 return {ArrayInfo::getEmptyKey()};
109 return {ArrayInfo::getTombstoneKey()};
112 assert(!isEqual(Key, getEmptyKey()) && !isEqual(Key, getTombstoneKey()));
113 return llvm::hash_combine_range(Key.begin(), Key.end());
115 static bool isEqual(DecompositionDeclName LHS, DecompositionDeclName RHS) {
117 LHS.Bindings, RHS.Bindings))
120 return LHS.Bindings.size() == RHS.Bindings.size() &&
121 std::equal(LHS.begin(), LHS.end(), RHS.begin());
132 llvm::StringMap<unsigned> LambdaManglingNumbers;
133 unsigned BlockManglingNumber = 0;
134 llvm::DenseMap<const IdentifierInfo *, unsigned> VarManglingNumbers;
135 llvm::DenseMap<const IdentifierInfo *, unsigned> TagManglingNumbers;
136 llvm::DenseMap<DecompositionDeclName, unsigned>
137 DecompsitionDeclManglingNumbers;
142 unsigned getManglingNumber(
const CXXMethodDecl *CallOperator)
override {
149 llvm::raw_svector_ostream Out(LambdaSig);
152 return ++LambdaManglingNumbers[LambdaSig];
155 unsigned getManglingNumber(
const BlockDecl *BD)
override {
156 return ++BlockManglingNumber;
159 unsigned getStaticLocalNumber(
const VarDecl *VD)
override {
164 unsigned getManglingNumber(
const VarDecl *VD,
unsigned)
override {
165 if (
auto *DD = dyn_cast<DecompositionDecl>(VD)) {
166 DecompositionDeclName Name{DD->bindings()};
167 return ++DecompsitionDeclManglingNumbers[Name];
174 Identifier = findAnonymousUnionVarDeclName(*VD);
179 unsigned getManglingNumber(
const TagDecl *TD,
unsigned)
override {
184 class ItaniumCXXABI :
public CXXABI {
186 std::unique_ptr<MangleContext> Mangler;
197 MemberPointerInfo MPI;
200 MPI.HasPadding =
false;
206 CallingConv getDefaultMethodCallConv(
bool isVariadic)
const override {
208 if (!isVariadic && T.isWindowsGNUEnvironment() &&
209 T.getArch() == llvm::Triple::x86)
229 getCopyConstructorForExceptionObject(
CXXRecordDecl *RD)
override {
236 void addTypedefNameForUnnamedTagDecl(
TagDecl *TD,
243 void addDeclaratorForUnnamedTagDecl(
TagDecl *TD,
250 std::unique_ptr<MangleNumberingContext>
251 createMangleNumberingContext()
const override {
252 return std::make_unique<ItaniumNumberingContext>(
253 cast<ItaniumMangleContext>(Mangler.get()));
259 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.
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
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.
Optional< bool > areDenseMapKeysEqualSpecialValues(T LHS, T RHS)
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>'.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
virtual void mangleLambdaSig(const CXXRecordDecl *Lambda, raw_ostream &)=0
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 ...
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...
bool isLambda() const
Determine whether this class describes a lambda function object.
bool isDenseMapKeyTombstone(T V)
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
static unsigned getHashValue(DecompositionDeclName Key)
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. ...
static DecompositionDeclName getEmptyKey()
Implements C++ ABI-specific semantic analysis functions.
The result type of a method or function.
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
Represents the declaration of a struct/union/class/enum.
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.
const CXXRecordDecl * getParent() const
Return the parent of this method declaration, which is the class in which this method is defined...
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.
bool isDenseMapKeyEmpty(T V)