30 #include "llvm/ADT/StringExtras.h" 31 #include "llvm/Support/JamCRC.h" 32 #include "llvm/Support/MD5.h" 33 #include "llvm/Support/MathExtras.h" 35 using namespace clang;
39 struct msvc_hashing_ostream :
public llvm::raw_svector_ostream {
43 msvc_hashing_ostream(raw_ostream &OS)
44 :
llvm::raw_svector_ostream(Buffer), OS(OS) {}
45 ~msvc_hashing_ostream()
override {
46 StringRef MangledName = str();
47 bool StartsWithEscape = MangledName.startswith(
"\01");
49 MangledName = MangledName.drop_front(1);
50 if (MangledName.size() <= 4096) {
56 llvm::MD5::MD5Result Hash;
57 Hasher.update(MangledName);
61 llvm::MD5::stringifyResult(Hash, HexString);
65 OS <<
"??@" << HexString <<
'@';
70 getLambdaDefaultArgumentDeclContext(
const Decl *D) {
71 if (
const auto *RD = dyn_cast<CXXRecordDecl>(D))
73 if (
const auto *Parm =
74 dyn_cast_or_null<ParmVarDecl>(RD->getLambdaContextDecl()))
75 return Parm->getDeclContext();
88 if (
const auto *LDADC = getLambdaDefaultArgumentDeclContext(D))
92 if (
const BlockDecl *BD = dyn_cast<BlockDecl>(D)) {
94 dyn_cast_or_null<ParmVarDecl>(BD->getBlockManglingContextDecl()))
95 return ContextParam->getDeclContext();
99 if (isa<CapturedDecl>(DC) || isa<OMPDeclareReductionDecl>(DC)) {
100 return getEffectiveDeclContext(cast<Decl>(DC));
107 return getEffectiveDeclContext(cast<Decl>(DC));
111 if (
const auto *FTD = dyn_cast<FunctionTemplateDecl>(ND))
114 const auto *FD = cast<FunctionDecl>(ND);
115 if (
const auto *FTD = FD->getPrimaryTemplate())
124 typedef std::pair<const DeclContext *, IdentifierInfo *> DiscriminatorKeyTy;
125 llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
126 llvm::DenseMap<const NamedDecl *, unsigned> Uniquifier;
127 llvm::DenseMap<const CXXRecordDecl *, unsigned> LambdaIds;
128 llvm::DenseMap<const NamedDecl *, unsigned> SEHFilterIds;
129 llvm::DenseMap<const NamedDecl *, unsigned> SEHFinallyIds;
134 bool shouldMangleCXXName(
const NamedDecl *D)
override;
135 bool shouldMangleStringLiteral(
const StringLiteral *SL)
override;
136 void mangleCXXName(
const NamedDecl *D, raw_ostream &Out)
override;
138 raw_ostream &)
override;
140 raw_ostream &)
override;
143 raw_ostream &)
override;
146 raw_ostream &Out)
override;
149 raw_ostream &Out)
override;
150 void mangleCXXVirtualDisplacementMap(
const CXXRecordDecl *SrcRD,
152 raw_ostream &Out)
override;
153 void mangleCXXThrowInfo(
QualType T,
bool IsConst,
bool IsVolatile,
154 bool IsUnaligned, uint32_t NumEntries,
155 raw_ostream &Out)
override;
156 void mangleCXXCatchableTypeArray(
QualType T, uint32_t NumEntries,
157 raw_ostream &Out)
override;
160 int32_t VBPtrOffset, uint32_t VBIndex,
161 raw_ostream &Out)
override;
162 void mangleCXXRTTI(
QualType T, raw_ostream &Out)
override;
163 void mangleCXXRTTIName(
QualType T, raw_ostream &Out)
override;
164 void mangleCXXRTTIBaseClassDescriptor(
const CXXRecordDecl *Derived,
165 uint32_t NVOffset, int32_t VBPtrOffset,
166 uint32_t VBTableOffset, uint32_t Flags,
167 raw_ostream &Out)
override;
168 void mangleCXXRTTIBaseClassArray(
const CXXRecordDecl *Derived,
169 raw_ostream &Out)
override;
170 void mangleCXXRTTIClassHierarchyDescriptor(
const CXXRecordDecl *Derived,
171 raw_ostream &Out)
override;
173 mangleCXXRTTICompleteObjectLocator(
const CXXRecordDecl *Derived,
175 raw_ostream &Out)
override;
176 void mangleTypeName(
QualType T, raw_ostream &)
override;
178 raw_ostream &)
override;
180 raw_ostream &)
override;
181 void mangleReferenceTemporary(
const VarDecl *,
unsigned ManglingNumber,
182 raw_ostream &)
override;
183 void mangleStaticGuardVariable(
const VarDecl *D, raw_ostream &Out)
override;
184 void mangleThreadSafeStaticGuardVariable(
const VarDecl *D,
unsigned GuardNum,
185 raw_ostream &Out)
override;
186 void mangleDynamicInitializer(
const VarDecl *D, raw_ostream &Out)
override;
187 void mangleDynamicAtExitDestructor(
const VarDecl *D,
188 raw_ostream &Out)
override;
189 void mangleSEHFilterExpression(
const NamedDecl *EnclosingDecl,
190 raw_ostream &Out)
override;
191 void mangleSEHFinallyBlock(
const NamedDecl *EnclosingDecl,
192 raw_ostream &Out)
override;
193 void mangleStringLiteral(
const StringLiteral *SL, raw_ostream &Out)
override;
194 bool getNextDiscriminator(
const NamedDecl *ND,
unsigned &disc) {
195 const DeclContext *DC = getEffectiveDeclContext(ND);
201 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND)) {
202 if (RD->isLambda()) {
210 disc = getASTContext().getManglingNumber(ND);
215 if (
const TagDecl *Tag = dyn_cast<TagDecl>(ND)) {
216 if (!Tag->hasNameForLinkage() &&
217 !getASTContext().getDeclaratorForUnnamedTagDecl(Tag) &&
218 !getASTContext().getTypedefNameForUnnamedTagDecl(Tag))
223 unsigned &discriminator = Uniquifier[ND];
225 discriminator = ++Discriminator[std::make_pair(DC, ND->
getIdentifier())];
226 disc = discriminator + 1;
231 assert(RD->
isLambda() &&
"RD must be a lambda!");
234 "RD must not have a mangling number!");
235 std::pair<llvm::DenseMap<const CXXRecordDecl *, unsigned>::iterator,
bool>
236 Result = LambdaIds.insert(std::make_pair(RD, LambdaIds.size()));
237 return Result.first->second;
241 void mangleInitFiniStub(
const VarDecl *D,
char CharCode, raw_ostream &Out);
246 class MicrosoftCXXNameMangler {
247 MicrosoftMangleContextImpl &Context;
257 BackRefVec NameBackReferences;
259 typedef llvm::DenseMap<const void *, unsigned> ArgBackRefMap;
260 ArgBackRefMap TypeBackReferences;
262 typedef std::set<int> PassObjectSizeArgsSet;
263 PassObjectSizeArgsSet PassObjectSizeArgs;
265 ASTContext &getASTContext()
const {
return Context.getASTContext(); }
269 const bool PointersAre64Bit;
272 enum QualifierMangleMode { QMM_Drop, QMM_Mangle, QMM_Escape, QMM_Result };
274 MicrosoftCXXNameMangler(MicrosoftMangleContextImpl &
C, raw_ostream &Out_)
275 : Context(C), Out(Out_), Structor(nullptr), StructorType(-1),
276 PointersAre64Bit(C.getASTContext().getTargetInfo().getPointerWidth(0) ==
279 MicrosoftCXXNameMangler(MicrosoftMangleContextImpl &
C, raw_ostream &Out_,
281 : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(Type),
282 PointersAre64Bit(C.getASTContext().getTargetInfo().getPointerWidth(0) ==
285 MicrosoftCXXNameMangler(MicrosoftMangleContextImpl &
C, raw_ostream &Out_,
287 : Context(C), Out(Out_), Structor(getStructor(D)), StructorType(Type),
288 PointersAre64Bit(C.getASTContext().getTargetInfo().getPointerWidth(0) ==
291 raw_ostream &getStream()
const {
return Out; }
293 void mangle(
const NamedDecl *D, StringRef Prefix =
"\01?");
295 void mangleFunctionEncoding(
const FunctionDecl *FD,
bool ShouldMangle);
296 void mangleVariableEncoding(
const VarDecl *VD);
300 void mangleVirtualMemPtrThunk(
303 void mangleNumber(int64_t Number);
305 void mangleArtificalTagType(
TagTypeKind TK, StringRef UnqualifiedName,
308 QualifierMangleMode QMM = QMM_Mangle);
311 bool ForceThisQuals =
false);
312 void mangleNestedName(
const NamedDecl *ND);
315 bool isStructorDecl(
const NamedDecl *ND)
const {
316 return ND == Structor || getStructor(ND) == Structor;
319 void mangleUnqualifiedName(
const NamedDecl *ND) {
323 void mangleSourceName(StringRef Name);
326 void mangleQualifiers(
Qualifiers Quals,
bool IsMember);
328 void manglePointerCVQualifiers(
Qualifiers Quals);
331 void mangleUnscopedTemplateName(
const TemplateDecl *ND);
338 void manglePassObjectSizeArg(
const PassObjectSizeAttr *POSA);
341 #define ABSTRACT_TYPE(CLASS, PARENT) 342 #define NON_CANONICAL_TYPE(CLASS, PARENT) 343 #define TYPE(CLASS, PARENT) void mangleType(const CLASS##Type *T, \ 346 #include "clang/AST/TypeNodes.def" 348 #undef NON_CANONICAL_TYPE 351 void mangleType(
const TagDecl *TD);
352 void mangleDecayedArrayType(
const ArrayType *
T);
357 void mangleIntegerLiteral(
const llvm::APSInt &Number,
bool IsBoolean);
358 void mangleExpression(
const Expr *E);
368 bool MicrosoftMangleContextImpl::shouldMangleCXXName(
const NamedDecl *D) {
369 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
372 if (FD->hasAttr<OverloadableAttr>())
384 if (FD->isMSVCRTEntryPoint())
398 if (!getASTContext().getLangOpts().CPlusPlus)
402 if (VD && !isa<DecompositionDecl>(D)) {
408 const DeclContext *DC = getEffectiveDeclContext(D);
412 DC = getEffectiveParentContext(DC);
415 !isa<VarTemplateSpecializationDecl>(D) &&
424 MicrosoftMangleContextImpl::shouldMangleStringLiteral(
const StringLiteral *SL) {
428 void MicrosoftCXXNameMangler::mangle(
const NamedDecl *D, StringRef Prefix) {
439 mangleFunctionEncoding(FD, Context.shouldMangleDeclName(FD));
440 else if (
const VarDecl *VD = dyn_cast<VarDecl>(D))
441 mangleVariableEncoding(VD);
443 llvm_unreachable(
"Tried to mangle unexpected NamedDecl!");
446 void MicrosoftCXXNameMangler::mangleFunctionEncoding(
const FunctionDecl *FD,
470 mangleFunctionClass(FD);
472 mangleFunctionType(FT, FD);
478 void MicrosoftCXXNameMangler::mangleVariableEncoding(
const VarDecl *VD) {
509 mangleType(Ty, SR, QMM_Drop);
510 manglePointerExtQualifiers(
513 mangleQualifiers(MPT->getPointeeType().getQualifiers(),
true);
516 mangleName(MPT->getClass()->getAsCXXRecordDecl());
519 }
else if (
const ArrayType *AT = getASTContext().getAsArrayType(Ty)) {
521 mangleDecayedArrayType(AT);
522 if (AT->getElementType()->isArrayType())
527 mangleType(Ty, SR, QMM_Drop);
532 void MicrosoftCXXNameMangler::mangleMemberDataPointer(
const CXXRecordDecl *RD,
539 int64_t VBTableOffset;
542 FieldOffset = getASTContext().getFieldOffset(VD);
543 assert(FieldOffset % getASTContext().
getCharWidth() == 0 &&
544 "cannot take address of bitfield");
545 FieldOffset /= getASTContext().getCharWidth();
549 if (IM == MSInheritanceAttr::Keyword_virtual_inheritance)
550 FieldOffset -= getASTContext().getOffsetOfBaseWithVBPtr(RD).getQuantity();
559 case MSInheritanceAttr::Keyword_single_inheritance: Code =
'0';
break;
560 case MSInheritanceAttr::Keyword_multiple_inheritance: Code =
'0';
break;
561 case MSInheritanceAttr::Keyword_virtual_inheritance: Code =
'F';
break;
562 case MSInheritanceAttr::Keyword_unspecified_inheritance: Code =
'G';
break;
567 mangleNumber(FieldOffset);
572 if (MSInheritanceAttr::hasVBPtrOffsetField(IM))
574 if (MSInheritanceAttr::hasVBTableOffsetField(IM))
575 mangleNumber(VBTableOffset);
579 MicrosoftCXXNameMangler::mangleMemberFunctionPointer(
const CXXRecordDecl *RD,
590 case MSInheritanceAttr::Keyword_single_inheritance: Code =
'1';
break;
591 case MSInheritanceAttr::Keyword_multiple_inheritance: Code =
'H';
break;
592 case MSInheritanceAttr::Keyword_virtual_inheritance: Code =
'I';
break;
593 case MSInheritanceAttr::Keyword_unspecified_inheritance: Code =
'J';
break;
598 uint64_t NVOffset = 0;
599 uint64_t VBTableOffset = 0;
600 uint64_t VBPtrOffset = 0;
602 Out <<
'$' << Code <<
'?';
605 cast<MicrosoftVTableContext>(getASTContext().getVTableContext());
608 mangleVirtualMemPtrThunk(MD, ML);
609 NVOffset = ML.VFPtrOffset.getQuantity();
610 VBTableOffset = ML.VBTableIndex * 4;
612 const ASTRecordLayout &Layout = getASTContext().getASTRecordLayout(RD);
617 mangleFunctionEncoding(MD,
true);
620 if (VBTableOffset == 0 &&
621 IM == MSInheritanceAttr::Keyword_virtual_inheritance)
622 NVOffset -= getASTContext().getOffsetOfBaseWithVBPtr(RD).getQuantity();
625 if (IM == MSInheritanceAttr::Keyword_single_inheritance) {
629 if (IM == MSInheritanceAttr::Keyword_unspecified_inheritance)
634 if (MSInheritanceAttr::hasNVOffsetField(
true, IM))
635 mangleNumber(static_cast<uint32_t>(NVOffset));
636 if (MSInheritanceAttr::hasVBPtrOffsetField(IM))
637 mangleNumber(VBPtrOffset);
638 if (MSInheritanceAttr::hasVBTableOffsetField(IM))
639 mangleNumber(VBTableOffset);
642 void MicrosoftCXXNameMangler::mangleVirtualMemPtrThunk(
646 CharUnits PointerWidth = getASTContext().toCharUnitsFromBits(
647 getASTContext().getTargetInfo().getPointerWidth(0));
653 mangleNumber(OffsetInVFTable);
658 void MicrosoftCXXNameMangler::mangleName(
const NamedDecl *ND) {
662 mangleUnqualifiedName(ND);
664 mangleNestedName(ND);
670 void MicrosoftCXXNameMangler::mangleNumber(int64_t Number) {
677 uint64_t
Value =
static_cast<uint64_t
>(Number);
685 else if (Value >= 1 && Value <= 10)
691 char EncodedNumberBuffer[
sizeof(uint64_t) * 2];
694 for (; Value != 0; Value >>= 4)
695 *I++ =
'A' + (Value & 0xf);
696 Out.write(I.base(), I - BufferRef.rbegin());
704 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
713 dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
714 TemplateArgs = &Spec->getTemplateArgs();
715 return Spec->getSpecializedTemplate();
720 dyn_cast<VarTemplateSpecializationDecl>(ND)) {
721 TemplateArgs = &Spec->getTemplateArgs();
722 return Spec->getSpecializedTemplate();
728 void MicrosoftCXXNameMangler::mangleUnqualifiedName(
const NamedDecl *ND,
741 if (isa<FunctionTemplateDecl>(TD)) {
742 mangleTemplateInstantiationName(TD, *TemplateArgs);
763 llvm::raw_svector_ostream Stream(TemplateMangling);
764 MicrosoftCXXNameMangler Extra(Context, Stream);
765 Extra.mangleTemplateInstantiationName(TD, *TemplateArgs);
767 mangleSourceName(TemplateMangling);
774 mangleSourceName(II->getName());
779 assert(ND &&
"mangling empty name without declaration");
782 if (NS->isAnonymousNamespace()) {
793 for (
auto *BD : DD->bindings()) {
796 Name += BD->getDeclName().getAsIdentifierInfo()->getName();
799 mangleSourceName(Name);
803 if (
const VarDecl *VD = dyn_cast<VarDecl>(ND)) {
806 assert(RD &&
"expected variable decl to have a record type");
812 Name += llvm::utostr(Context.getAnonymousStructId(RD) + 1);
813 mangleSourceName(Name.str());
818 const TagDecl *TD = cast<TagDecl>(ND);
821 "Typedef should not be in another decl context!");
823 "Typedef was not named!");
828 if (
const CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(TD)) {
829 if (Record->isLambda()) {
832 Decl *LambdaContextDecl = Record->getLambdaContextDecl();
833 unsigned LambdaManglingNumber = Record->getLambdaManglingNumber();
836 dyn_cast_or_null<ParmVarDecl>(LambdaContextDecl);
841 unsigned DefaultArgNo =
843 Name += llvm::utostr(DefaultArgNo);
847 if (LambdaManglingNumber)
848 LambdaId = LambdaManglingNumber;
850 LambdaId = Context.getLambdaId(Record);
852 Name += llvm::utostr(LambdaId);
855 mangleSourceName(Name);
859 if (LambdaManglingNumber && LambdaContextDecl) {
860 if ((isa<VarDecl>(LambdaContextDecl) ||
861 isa<FieldDecl>(LambdaContextDecl)) &&
863 mangleUnqualifiedName(cast<NamedDecl>(LambdaContextDecl));
872 Context.getASTContext().getDeclaratorForUnnamedTagDecl(TD)) {
875 Name +=
"<unnamed-type-";
876 Name += DD->getName();
878 Context.getASTContext().getTypedefNameForUnnamedTagDecl(
882 Name +=
"<unnamed-type-";
883 Name += TND->getName();
884 }
else if (
auto *ED = dyn_cast<EnumDecl>(TD)) {
885 auto EnumeratorI = ED->enumerator_begin();
886 assert(EnumeratorI != ED->enumerator_end());
887 Name +=
"<unnamed-enum-";
888 Name += EnumeratorI->getName();
891 Name +=
"<unnamed-type-$S";
892 Name += llvm::utostr(Context.getAnonymousStructId(TD) + 1);
895 mangleSourceName(Name.str());
902 llvm_unreachable(
"Can't mangle Objective-C selector names here!");
905 if (isStructorDecl(ND)) {
919 if (isStructorDecl(ND))
922 mangleCXXDtorType(static_cast<CXXDtorType>(StructorType));
946 llvm_unreachable(
"Can't mangle a deduction guide name!");
949 llvm_unreachable(
"Can't mangle a using directive name!");
955 void MicrosoftCXXNameMangler::mangleNestedName(
const NamedDecl *ND) {
956 const DeclContext *DC = getEffectiveDeclContext(ND);
958 if (isa<TagDecl>(ND) || isa<VarDecl>(ND)) {
960 if (Context.getNextDiscriminator(ND, Disc)) {
967 if (
const BlockDecl *BD = dyn_cast<BlockDecl>(DC)) {
969 [](StringRef Name,
const unsigned Discriminator,
970 const unsigned ParameterDiscriminator) -> std::string {
972 llvm::raw_string_ostream Stream(Buffer);
975 Stream <<
'_' << Discriminator;
976 if (ParameterDiscriminator)
977 Stream <<
'_' << ParameterDiscriminator;
981 unsigned Discriminator = BD->getBlockManglingNumber();
983 Discriminator = Context.getBlockId(BD,
false);
988 unsigned ParameterDiscriminator = 0;
989 if (
const auto *MC = BD->getBlockManglingContextDecl())
990 if (
const auto *
P = dyn_cast<ParmVarDecl>(MC))
991 if (
const auto *F = dyn_cast<FunctionDecl>(
P->getDeclContext()))
992 ParameterDiscriminator =
993 F->getNumParams() -
P->getFunctionScopeIndex();
995 DC = getEffectiveDeclContext(BD);
998 mangleSourceName(Discriminate(
"_block_invoke", Discriminator,
999 ParameterDiscriminator));
1004 if (
const auto *MC = BD->getBlockManglingContextDecl())
1005 if (!isa<ParmVarDecl>(MC))
1006 if (
const auto *ND = dyn_cast<NamedDecl>(MC))
1007 mangleUnqualifiedName(ND);
1011 if (
const auto *RD = dyn_cast<RecordDecl>(DC))
1020 if (PointersAre64Bit)
1024 Discriminate(
"__block_literal", Discriminator,
1025 ParameterDiscriminator));
1030 if (isa<RecordDecl>(DC))
1033 }
else if (
const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(DC)) {
1034 mangleObjCMethodName(Method);
1035 }
else if (isa<NamedDecl>(DC)) {
1036 ND = cast<NamedDecl>(DC);
1037 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
1041 mangleUnqualifiedName(ND);
1044 if (
const auto *LDADC = getLambdaDefaultArgumentDeclContext(ND)) {
1054 void MicrosoftCXXNameMangler::mangleCXXDtorType(
CXXDtorType T) {
1069 llvm_unreachable(
"not expecting a COMDAT");
1071 llvm_unreachable(
"Unsupported dtor type?");
1080 case OO_New: Out <<
"?2";
break;
1082 case OO_Delete: Out <<
"?3";
break;
1084 case OO_Equal: Out <<
"?4";
break;
1086 case OO_GreaterGreater: Out <<
"?5";
break;
1088 case OO_LessLess: Out <<
"?6";
break;
1090 case OO_Exclaim: Out <<
"?7";
break;
1092 case OO_EqualEqual: Out <<
"?8";
break;
1094 case OO_ExclaimEqual: Out <<
"?9";
break;
1096 case OO_Subscript: Out <<
"?A";
break;
1099 case OO_Arrow: Out <<
"?C";
break;
1101 case OO_Star: Out <<
"?D";
break;
1103 case OO_PlusPlus: Out <<
"?E";
break;
1105 case OO_MinusMinus: Out <<
"?F";
break;
1107 case OO_Minus: Out <<
"?G";
break;
1109 case OO_Plus: Out <<
"?H";
break;
1111 case OO_Amp: Out <<
"?I";
break;
1113 case OO_ArrowStar: Out <<
"?J";
break;
1115 case OO_Slash: Out <<
"?K";
break;
1117 case OO_Percent: Out <<
"?L";
break;
1119 case OO_Less: Out <<
"?M";
break;
1121 case OO_LessEqual: Out <<
"?N";
break;
1123 case OO_Greater: Out <<
"?O";
break;
1125 case OO_GreaterEqual: Out <<
"?P";
break;
1127 case OO_Comma: Out <<
"?Q";
break;
1129 case OO_Call: Out <<
"?R";
break;
1131 case OO_Tilde: Out <<
"?S";
break;
1133 case OO_Caret: Out <<
"?T";
break;
1135 case OO_Pipe: Out <<
"?U";
break;
1137 case OO_AmpAmp: Out <<
"?V";
break;
1139 case OO_PipePipe: Out <<
"?W";
break;
1141 case OO_StarEqual: Out <<
"?X";
break;
1143 case OO_PlusEqual: Out <<
"?Y";
break;
1145 case OO_MinusEqual: Out <<
"?Z";
break;
1147 case OO_SlashEqual: Out <<
"?_0";
break;
1149 case OO_PercentEqual: Out <<
"?_1";
break;
1151 case OO_GreaterGreaterEqual: Out <<
"?_2";
break;
1153 case OO_LessLessEqual: Out <<
"?_3";
break;
1155 case OO_AmpEqual: Out <<
"?_4";
break;
1157 case OO_PipeEqual: Out <<
"?_5";
break;
1159 case OO_CaretEqual: Out <<
"?_6";
break;
1188 case OO_Array_New: Out <<
"?_U";
break;
1190 case OO_Array_Delete: Out <<
"?_V";
break;
1192 case OO_Coawait: Out <<
"?__L";
break;
1194 case OO_Spaceship: {
1198 "cannot mangle this three-way comparison operator yet");
1199 Diags.
Report(Loc, DiagID);
1203 case OO_Conditional: {
1206 "cannot mangle this conditional operator yet");
1207 Diags.
Report(Loc, DiagID);
1213 llvm_unreachable(
"Not an overloaded operator");
1217 void MicrosoftCXXNameMangler::mangleSourceName(StringRef Name) {
1219 BackRefVec::iterator Found =
1220 std::find(NameBackReferences.begin(), NameBackReferences.end(), Name);
1221 if (Found == NameBackReferences.end()) {
1222 if (NameBackReferences.size() < 10)
1223 NameBackReferences.push_back(Name);
1226 Out << (Found - NameBackReferences.begin());
1230 void MicrosoftCXXNameMangler::mangleObjCMethodName(
const ObjCMethodDecl *MD) {
1231 Context.mangleObjCMethodName(MD, Out);
1234 void MicrosoftCXXNameMangler::mangleTemplateInstantiationName(
1241 ArgBackRefMap OuterArgsContext;
1242 BackRefVec OuterTemplateContext;
1243 PassObjectSizeArgsSet OuterPassObjectSizeArgs;
1244 NameBackReferences.swap(OuterTemplateContext);
1245 TypeBackReferences.swap(OuterArgsContext);
1246 PassObjectSizeArgs.swap(OuterPassObjectSizeArgs);
1248 mangleUnscopedTemplateName(TD);
1249 mangleTemplateArgs(TD, TemplateArgs);
1252 NameBackReferences.swap(OuterTemplateContext);
1253 TypeBackReferences.swap(OuterArgsContext);
1254 PassObjectSizeArgs.swap(OuterPassObjectSizeArgs);
1258 MicrosoftCXXNameMangler::mangleUnscopedTemplateName(
const TemplateDecl *TD) {
1261 mangleUnqualifiedName(TD);
1264 void MicrosoftCXXNameMangler::mangleIntegerLiteral(
const llvm::APSInt &Value,
1269 if (IsBoolean && Value.getBoolValue())
1271 else if (Value.isSigned())
1272 mangleNumber(Value.getSExtValue());
1274 mangleNumber(Value.getZExtValue());
1277 void MicrosoftCXXNameMangler::mangleExpression(
const Expr *E) {
1290 if (UO->getOpcode() == UO_AddrOf)
1291 UE = dyn_cast<CXXUuidofExpr>(UO->getSubExpr());
1309 std::string Name =
"_GUID_" + Uuid.lower();
1310 std::replace(Name.begin(), Name.end(),
'-',
'_');
1312 mangleSourceName(Name);
1318 mangleArtificalTagType(
TTK_Struct,
"__s_GUID");
1332 void MicrosoftCXXNameMangler::mangleTemplateArgs(
1336 assert(TPL->
size() == TemplateArgs.
size() &&
1337 "size mismatch between args and parms!");
1341 mangleTemplateArg(TD, TA, TPL->
getParam(Idx++));
1344 void MicrosoftCXXNameMangler::mangleTemplateArg(
const TemplateDecl *TD,
1358 llvm_unreachable(
"Can't mangle null template arguments!");
1360 llvm_unreachable(
"Can't mangle template expansion arguments!");
1368 if (isa<FieldDecl>(ND) || isa<IndirectFieldDecl>(ND)) {
1369 mangleMemberDataPointer(
1371 cast<ValueDecl>(ND));
1372 }
else if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
1379 mangleFunctionEncoding(FD,
true);
1393 const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
1394 if (MPT->isMemberFunctionPointerType() &&
1395 !isa<FunctionTemplateDecl>(TD)) {
1396 mangleMemberFunctionPointer(RD,
nullptr);
1399 if (MPT->isMemberDataPointer()) {
1400 if (!isa<FunctionTemplateDecl>(TD)) {
1401 mangleMemberDataPointer(RD,
nullptr);
1411 mangleIntegerLiteral(llvm::APSInt::get(-1),
false);
1416 mangleIntegerLiteral(llvm::APSInt::getUnsigned(0),
false);
1424 if (TemplateArgs.empty()) {
1425 if (isa<TemplateTypeParmDecl>(Parm) ||
1426 isa<TemplateTemplateParmDecl>(Parm))
1429 Out << (Context.getASTContext().getLangOpts().isCompatibleWithMSVC(
1433 else if (isa<NonTypeTemplateParmDecl>(Parm))
1436 llvm_unreachable(
"unexpected template parameter decl!");
1439 mangleTemplateArg(TD, PA, Parm);
1446 if (
const auto *TD = dyn_cast<TagDecl>(ND)) {
1448 }
else if (isa<TypeAliasDecl>(ND)) {
1452 llvm_unreachable(
"unexpected template template NamedDecl!");
1459 void MicrosoftCXXNameMangler::mangleQualifiers(
Qualifiers Quals,
1517 if (HasConst && HasVolatile) {
1519 }
else if (HasVolatile) {
1521 }
else if (HasConst) {
1527 if (HasConst && HasVolatile) {
1529 }
else if (HasVolatile) {
1531 }
else if (HasConst) {
1542 MicrosoftCXXNameMangler::mangleRefQualifier(
RefQualifierKind RefQualifier) {
1545 switch (RefQualifier) {
1559 void MicrosoftCXXNameMangler::manglePointerExtQualifiers(
Qualifiers Quals,
1562 if (PointersAre64Bit &&
1574 void MicrosoftCXXNameMangler::manglePointerCVQualifiers(
Qualifiers Quals) {
1582 if (HasConst && HasVolatile) {
1584 }
else if (HasVolatile) {
1586 }
else if (HasConst) {
1593 void MicrosoftCXXNameMangler::mangleArgumentType(
QualType T,
1604 QualType OriginalType = DT->getOriginalType();
1607 if (
const auto *AT = getASTContext().getAsArrayType(OriginalType))
1608 OriginalType = getASTContext().getIncompleteArrayType(
1609 AT->getElementType(), AT->getSizeModifier(),
1610 AT->getIndexTypeCVRQualifiers());
1624 ArgBackRefMap::iterator Found = TypeBackReferences.find(TypePtr);
1626 if (Found == TypeBackReferences.end()) {
1627 size_t OutSizeBefore = Out.tell();
1629 mangleType(T, Range, QMM_Drop);
1634 bool LongerThanOneChar = (Out.tell() - OutSizeBefore > 1);
1635 if (LongerThanOneChar && TypeBackReferences.size() < 10) {
1636 size_t Size = TypeBackReferences.size();
1637 TypeBackReferences[TypePtr] = Size;
1640 Out << Found->second;
1644 void MicrosoftCXXNameMangler::manglePassObjectSizeArg(
1645 const PassObjectSizeAttr *POSA) {
1646 int Type = POSA->getType();
1648 auto Iter = PassObjectSizeArgs.insert(Type).first;
1649 auto *TypePtr = (
const void *)&*Iter;
1650 ArgBackRefMap::iterator Found = TypeBackReferences.find(TypePtr);
1652 if (Found == TypeBackReferences.end()) {
1653 mangleArtificalTagType(
TTK_Enum,
"__pass_object_size" + llvm::utostr(Type),
1656 if (TypeBackReferences.size() < 10) {
1657 size_t Size = TypeBackReferences.size();
1658 TypeBackReferences[TypePtr] = Size;
1661 Out << Found->second;
1666 QualifierMangleMode QMM) {
1671 if (
const ArrayType *AT = getASTContext().getAsArrayType(T)) {
1674 if (QMM == QMM_Mangle)
1676 else if (QMM == QMM_Escape || QMM == QMM_Result)
1678 mangleArrayType(AT);
1689 if (
const FunctionType *FT = dyn_cast<FunctionType>(T)) {
1691 mangleFunctionType(FT);
1694 mangleQualifiers(Quals,
false);
1697 if (!IsPointer && Quals) {
1699 mangleQualifiers(Quals,
false);
1705 if ((!IsPointer && Quals) || isa<TagType>(T)) {
1707 mangleQualifiers(Quals,
false);
1715 #define ABSTRACT_TYPE(CLASS, PARENT) 1716 #define NON_CANONICAL_TYPE(CLASS, PARENT) \ 1718 llvm_unreachable("can't mangle non-canonical type " #CLASS "Type"); \ 1720 #define TYPE(CLASS, PARENT) \ 1722 mangleType(cast<CLASS##Type>(ty), Quals, Range); \ 1724 #include "clang/AST/TypeNodes.def" 1725 #undef ABSTRACT_TYPE 1726 #undef NON_CANONICAL_TYPE 1760 case BuiltinType::Void:
1763 case BuiltinType::SChar:
1766 case BuiltinType::Char_U:
1767 case BuiltinType::Char_S:
1770 case BuiltinType::UChar:
1773 case BuiltinType::Short:
1776 case BuiltinType::UShort:
1779 case BuiltinType::Int:
1782 case BuiltinType::UInt:
1785 case BuiltinType::Long:
1788 case BuiltinType::ULong:
1791 case BuiltinType::Float:
1794 case BuiltinType::Double:
1798 case BuiltinType::LongDouble:
1801 case BuiltinType::LongLong:
1804 case BuiltinType::ULongLong:
1807 case BuiltinType::Int128:
1810 case BuiltinType::UInt128:
1813 case BuiltinType::Bool:
1816 case BuiltinType::Char16:
1819 case BuiltinType::Char32:
1822 case BuiltinType::WChar_S:
1823 case BuiltinType::WChar_U:
1827 #define BUILTIN_TYPE(Id, SingletonId) 1828 #define PLACEHOLDER_TYPE(Id, SingletonId) \ 1829 case BuiltinType::Id: 1830 #include "clang/AST/BuiltinTypes.def" 1831 case BuiltinType::Dependent:
1832 llvm_unreachable(
"placeholder types shouldn't get to name mangling");
1834 case BuiltinType::ObjCId:
1836 mangleArtificalTagType(
TTK_Struct,
"objc_object");
1838 case BuiltinType::ObjCClass:
1840 mangleArtificalTagType(
TTK_Struct,
"objc_class");
1842 case BuiltinType::ObjCSel:
1844 mangleArtificalTagType(
TTK_Struct,
"objc_selector");
1847 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1848 case BuiltinType::Id: \ 1849 Out << "PAUocl_" #ImgType "_" #Suffix "@@"; \ 1851 #include "clang/Basic/OpenCLImageTypes.def" 1852 case BuiltinType::OCLSampler:
1854 mangleArtificalTagType(
TTK_Struct,
"ocl_sampler");
1856 case BuiltinType::OCLEvent:
1858 mangleArtificalTagType(
TTK_Struct,
"ocl_event");
1860 case BuiltinType::OCLClkEvent:
1862 mangleArtificalTagType(
TTK_Struct,
"ocl_clkevent");
1864 case BuiltinType::OCLQueue:
1866 mangleArtificalTagType(
TTK_Struct,
"ocl_queue");
1868 case BuiltinType::OCLReserveID:
1870 mangleArtificalTagType(
TTK_Struct,
"ocl_reserveid");
1873 case BuiltinType::NullPtr:
1877 case BuiltinType::Float16:
1878 case BuiltinType::Float128:
1879 case BuiltinType::Half: {
1884 << T->
getName(Context.getASTContext().getPrintingPolicy()) << Range;
1898 mangleFunctionType(T,
nullptr,
true);
1901 mangleFunctionType(T);
1907 mangleFunctionType(T);
1910 void MicrosoftCXXNameMangler::mangleFunctionType(
const FunctionType *T,
1912 bool ForceThisQuals) {
1920 bool IsInLambda =
false;
1921 bool IsStructor =
false, HasThisQuals = ForceThisQuals, IsCtorClosure =
false;
1923 if (
const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(D)) {
1926 if (MD->isInstance())
1927 HasThisQuals =
true;
1928 if (isa<CXXDestructorDecl>(MD)) {
1930 }
else if (isa<CXXConstructorDecl>(MD)) {
1936 CC = getASTContext().getDefaultCallingConvention(
1945 manglePointerExtQualifiers(Quals,
QualType());
1947 mangleQualifiers(Quals,
false);
1950 mangleCallingConvention(CC);
1955 if (isa<CXXDestructorDecl>(D) && isStructorDecl(D)) {
1959 Out << (PointersAre64Bit ?
"PEAXI@Z" :
"PAXI@Z");
1968 if (IsCtorClosure) {
1978 mangleArgumentType(getASTContext().getLValueReferenceType(
1986 llvm_unreachable(
"unexpected constructor closure!");
1994 if (
const auto *AT =
2000 "shouldn't need to mangle __auto_type!");
2001 mangleSourceName(AT->isDecltypeAuto() ?
"<decltype-auto>" :
"<auto>");
2003 }
else if (IsInLambda) {
2008 mangleType(ResultType, Range, QMM_Result);
2024 for (
unsigned I = 0, E = Proto->
getNumParams(); I != E; ++I) {
2036 manglePassObjectSizeArg(
P);
2045 mangleThrowSpecification(Proto);
2048 void MicrosoftCXXNameMangler::mangleFunctionClass(
const FunctionDecl *FD) {
2073 if (
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
2074 bool IsVirtual = MD->isVirtual();
2077 if (isa<CXXDestructorDecl>(MD) && isStructorDecl(MD) &&
2083 llvm_unreachable(
"Unsupported access specifier");
2112 void MicrosoftCXXNameMangler::mangleCallingConvention(
CallingConv CC) {
2133 llvm_unreachable(
"Unsupported CC for mangling");
2136 case CC_C: Out <<
'A';
break;
2146 void MicrosoftCXXNameMangler::mangleCallingConvention(
const FunctionType *T) {
2149 void MicrosoftCXXNameMangler::mangleThrowSpecification(
2166 "cannot mangle this unresolved dependent type yet");
2176 void MicrosoftCXXNameMangler::mangleTagTypeKind(
TagTypeKind TTK) {
2195 mangleType(cast<TagType>(T)->getDecl());
2199 mangleType(cast<TagType>(T)->getDecl());
2201 void MicrosoftCXXNameMangler::mangleType(
const TagDecl *TD) {
2205 void MicrosoftCXXNameMangler::mangleArtificalTagType(
2208 mangleTagTypeKind(TK);
2211 mangleSourceName(UnqualifiedName);
2213 for (
auto I = NestedNames.rbegin(), E = NestedNames.rend(); I != E; ++I)
2214 mangleSourceName(*I);
2227 void MicrosoftCXXNameMangler::mangleDecayedArrayType(
const ArrayType *T) {
2235 llvm_unreachable(
"Should have been special cased");
2239 llvm_unreachable(
"Should have been special cased");
2243 llvm_unreachable(
"Should have been special cased");
2247 llvm_unreachable(
"Should have been special cased");
2249 void MicrosoftCXXNameMangler::mangleArrayType(
const ArrayType *T) {
2255 getASTContext().getAsConstantArrayType(ElementTy);
2256 Dimensions.push_back(CAT->
getSize());
2260 getASTContext().getAsIncompleteArrayType(ElementTy);
2261 Dimensions.push_back(llvm::APInt(32, 0));
2265 getASTContext().getAsVariableArrayType(ElementTy);
2266 Dimensions.push_back(llvm::APInt(32, 0));
2271 getASTContext().getAsDependentSizedArrayType(ElementTy);
2274 "cannot mangle this dependent-length array yet");
2284 mangleNumber(Dimensions.size());
2285 for (
const llvm::APInt &Dimension : Dimensions)
2286 mangleNumber(Dimension.getLimitedValue());
2296 manglePointerCVQualifiers(Quals);
2297 manglePointerExtQualifiers(Quals, PointeeType);
2301 mangleFunctionType(FPT,
nullptr,
true);
2305 mangleType(PointeeType, Range, QMM_Drop);
2313 "cannot mangle this template type parameter type yet");
2322 "cannot mangle this substituted parameter pack yet");
2333 manglePointerCVQualifiers(Quals);
2334 manglePointerExtQualifiers(Quals, PointeeType);
2335 mangleType(PointeeType, Range);
2344 manglePointerCVQualifiers(Quals);
2345 manglePointerExtQualifiers(Quals, PointeeType);
2346 mangleType(PointeeType, Range);
2357 manglePointerExtQualifiers(Quals, PointeeType);
2358 mangleType(PointeeType, Range);
2369 manglePointerExtQualifiers(Quals, PointeeType);
2370 mangleType(PointeeType, Range);
2378 llvm::raw_svector_ostream Stream(TemplateMangling);
2379 MicrosoftCXXNameMangler Extra(Context, Stream);
2381 Extra.mangleSourceName(
"_Complex");
2382 Extra.mangleType(ElementType, Range, QMM_Escape);
2384 mangleArtificalTagType(
TTK_Struct, TemplateMangling, {
"__clang"});
2390 assert(ET &&
"vectors with non-builtin elements are unsupported");
2391 uint64_t Width = getASTContext().getTypeSize(T);
2394 size_t OutSizeBefore = Out.tell();
2395 llvm::Triple::ArchType AT =
2396 getASTContext().getTargetInfo().getTriple().getArch();
2397 if (AT == llvm::Triple::x86 || AT == llvm::Triple::x86_64) {
2398 if (Width == 64 && ET->
getKind() == BuiltinType::LongLong) {
2399 mangleArtificalTagType(
TTK_Union,
"__m64");
2400 }
else if (Width >= 128) {
2401 if (ET->
getKind() == BuiltinType::Float)
2402 mangleArtificalTagType(
TTK_Union,
"__m" + llvm::utostr(Width));
2403 else if (ET->
getKind() == BuiltinType::LongLong)
2404 mangleArtificalTagType(
TTK_Union,
"__m" + llvm::utostr(Width) +
'i');
2405 else if (ET->
getKind() == BuiltinType::Double)
2406 mangleArtificalTagType(
TTK_Struct,
"__m" + llvm::utostr(Width) +
'd');
2410 bool IsBuiltin = Out.tell() != OutSizeBefore;
2417 llvm::raw_svector_ostream Stream(TemplateMangling);
2418 MicrosoftCXXNameMangler Extra(Context, Stream);
2420 Extra.mangleSourceName(
"__vector");
2421 Extra.mangleType(
QualType(ET, 0), Range, QMM_Escape);
2422 Extra.mangleIntegerLiteral(llvm::APSInt::getUnsigned(T->
getNumElements()),
2425 mangleArtificalTagType(
TTK_Union, TemplateMangling, {
"__clang"});
2429 void MicrosoftCXXNameMangler::mangleType(
const ExtVectorType *T,
2431 mangleType(static_cast<const VectorType *>(T), Quals, Range);
2437 "cannot mangle this dependent-sized extended vector type yet");
2447 "cannot mangle this dependent address space type yet");
2468 manglePointerCVQualifiers(Quals);
2469 manglePointerExtQualifiers(Quals, PointeeType);
2478 llvm_unreachable(
"Cannot mangle injected class name type.");
2485 "cannot mangle this template specialization type yet");
2494 "cannot mangle this dependent name type yet");
2499 void MicrosoftCXXNameMangler::mangleType(
2504 "cannot mangle this dependent template specialization type yet");
2513 "cannot mangle this pack expansion yet");
2522 "cannot mangle this typeof(type) yet");
2531 "cannot mangle this typeof(expression) yet");
2540 "cannot mangle this decltype() yet");
2549 "cannot mangle this unary transform type yet");
2560 "cannot mangle this 'auto' type yet");
2561 Diags.Report(Range.
getBegin(), DiagID)
2565 void MicrosoftCXXNameMangler::mangleType(
2571 "cannot mangle this deduced class template specialization type yet");
2572 Diags.Report(Range.
getBegin(), DiagID)
2581 llvm::raw_svector_ostream Stream(TemplateMangling);
2582 MicrosoftCXXNameMangler Extra(Context, Stream);
2584 Extra.mangleSourceName(
"_Atomic");
2585 Extra.mangleType(ValueType, Range, QMM_Escape);
2587 mangleArtificalTagType(
TTK_Struct, TemplateMangling, {
"__clang"});
2594 "cannot mangle this OpenCL pipe type yet");
2599 void MicrosoftMangleContextImpl::mangleCXXName(
const NamedDecl *D,
2601 assert((isa<FunctionDecl>(D) || isa<VarDecl>(D)) &&
2602 "Invalid mangleName() call, argument is not a variable or function!");
2603 assert(!isa<CXXConstructorDecl>(D) && !isa<CXXDestructorDecl>(D) &&
2604 "Invalid mangleName() call on 'structor decl!");
2607 getASTContext().getSourceManager(),
2608 "Mangling declaration");
2610 msvc_hashing_ostream MHO(Out);
2611 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2612 return Mangler.mangle(D);
2641 MicrosoftCXXNameMangler &Mangler,
2648 llvm_unreachable(
"Unsupported access specifier");
2659 Out <<
'R' << AccessSpec;
2660 Mangler.mangleNumber(
2662 Mangler.mangleNumber(
2664 Mangler.mangleNumber(
2666 Mangler.mangleNumber(static_cast<uint32_t>(Adjustment.
NonVirtual));
2669 Mangler.mangleNumber(
2671 Mangler.mangleNumber(-static_cast<uint32_t>(Adjustment.
NonVirtual));
2676 llvm_unreachable(
"Unsupported access specifier");
2686 Mangler.mangleNumber(-static_cast<uint32_t>(Adjustment.
NonVirtual));
2690 llvm_unreachable(
"Unsupported access specifier");
2704 MicrosoftMangleContextImpl::mangleVirtualMemPtrThunk(
const CXXMethodDecl *MD,
2707 cast<MicrosoftVTableContext>(getASTContext().getVTableContext());
2711 msvc_hashing_ostream MHO(Out);
2712 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2713 Mangler.getStream() <<
"\01?";
2714 Mangler.mangleVirtualMemPtrThunk(MD, ML);
2717 void MicrosoftMangleContextImpl::mangleThunk(
const CXXMethodDecl *MD,
2720 msvc_hashing_ostream MHO(Out);
2721 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2722 Mangler.getStream() <<
"\01?";
2723 Mangler.mangleName(MD);
2726 assert(Thunk.
Method !=
nullptr &&
2727 "Thunk info should hold the overridee decl");
2730 Mangler.mangleFunctionType(
2734 void MicrosoftMangleContextImpl::mangleCXXDtorThunk(
2741 msvc_hashing_ostream MHO(Out);
2742 MicrosoftCXXNameMangler Mangler(*
this, MHO, DD, Type);
2743 Mangler.getStream() <<
"\01??_E";
2749 void MicrosoftMangleContextImpl::mangleCXXVFTable(
2756 msvc_hashing_ostream MHO(Out);
2757 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2758 if (Derived->
hasAttr<DLLImportAttr>())
2759 Mangler.getStream() <<
"\01??_S";
2761 Mangler.getStream() <<
"\01??_7";
2762 Mangler.mangleName(Derived);
2763 Mangler.getStream() <<
"6B";
2765 Mangler.mangleName(RD);
2766 Mangler.getStream() <<
'@';
2769 void MicrosoftMangleContextImpl::mangleCXXVBTable(
2776 msvc_hashing_ostream MHO(Out);
2777 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2778 Mangler.getStream() <<
"\01??_8";
2779 Mangler.mangleName(Derived);
2780 Mangler.getStream() <<
"7B";
2782 Mangler.mangleName(RD);
2783 Mangler.getStream() <<
'@';
2786 void MicrosoftMangleContextImpl::mangleCXXRTTI(
QualType T, raw_ostream &Out) {
2787 msvc_hashing_ostream MHO(Out);
2788 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2789 Mangler.getStream() <<
"\01??_R0";
2790 Mangler.mangleType(T,
SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
2791 Mangler.getStream() <<
"@8";
2794 void MicrosoftMangleContextImpl::mangleCXXRTTIName(
QualType T,
2796 MicrosoftCXXNameMangler Mangler(*
this, Out);
2797 Mangler.getStream() <<
'.';
2798 Mangler.mangleType(T,
SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
2801 void MicrosoftMangleContextImpl::mangleCXXVirtualDisplacementMap(
2803 msvc_hashing_ostream MHO(Out);
2804 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2805 Mangler.getStream() <<
"\01??_K";
2806 Mangler.mangleName(SrcRD);
2807 Mangler.getStream() <<
"$C";
2808 Mangler.mangleName(DstRD);
2811 void MicrosoftMangleContextImpl::mangleCXXThrowInfo(
QualType T,
bool IsConst,
2814 uint32_t NumEntries,
2816 msvc_hashing_ostream MHO(Out);
2817 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2818 Mangler.getStream() <<
"_TI";
2820 Mangler.getStream() <<
'C';
2822 Mangler.getStream() <<
'V';
2824 Mangler.getStream() <<
'U';
2825 Mangler.getStream() << NumEntries;
2826 Mangler.mangleType(T,
SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
2829 void MicrosoftMangleContextImpl::mangleCXXCatchableTypeArray(
2830 QualType T, uint32_t NumEntries, raw_ostream &Out) {
2831 msvc_hashing_ostream MHO(Out);
2832 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2833 Mangler.getStream() <<
"_CTA";
2834 Mangler.getStream() << NumEntries;
2835 Mangler.mangleType(T,
SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
2838 void MicrosoftMangleContextImpl::mangleCXXCatchableType(
2840 uint32_t NVOffset, int32_t VBPtrOffset, uint32_t VBIndex,
2842 MicrosoftCXXNameMangler Mangler(*
this, Out);
2843 Mangler.getStream() <<
"_CT";
2847 llvm::raw_svector_ostream Stream(RTTIMangling);
2848 msvc_hashing_ostream MHO(Stream);
2849 mangleCXXRTTI(T, MHO);
2851 Mangler.getStream() << RTTIMangling.substr(1);
2856 if (!getASTContext().getLangOpts().isCompatibleWithMSVC(
2859 llvm::raw_svector_ostream Stream(CopyCtorMangling);
2860 msvc_hashing_ostream MHO(Stream);
2861 mangleCXXCtor(CD, CT, MHO);
2863 Mangler.getStream() << CopyCtorMangling.substr(1);
2865 Mangler.getStream() << Size;
2866 if (VBPtrOffset == -1) {
2868 Mangler.getStream() << NVOffset;
2871 Mangler.getStream() << NVOffset;
2872 Mangler.getStream() << VBPtrOffset;
2873 Mangler.getStream() << VBIndex;
2877 void MicrosoftMangleContextImpl::mangleCXXRTTIBaseClassDescriptor(
2878 const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset,
2879 uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) {
2880 msvc_hashing_ostream MHO(Out);
2881 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2882 Mangler.getStream() <<
"\01??_R1";
2883 Mangler.mangleNumber(NVOffset);
2884 Mangler.mangleNumber(VBPtrOffset);
2885 Mangler.mangleNumber(VBTableOffset);
2886 Mangler.mangleNumber(Flags);
2887 Mangler.mangleName(Derived);
2888 Mangler.getStream() <<
"8";
2891 void MicrosoftMangleContextImpl::mangleCXXRTTIBaseClassArray(
2893 msvc_hashing_ostream MHO(Out);
2894 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2895 Mangler.getStream() <<
"\01??_R2";
2896 Mangler.mangleName(Derived);
2897 Mangler.getStream() <<
"8";
2900 void MicrosoftMangleContextImpl::mangleCXXRTTIClassHierarchyDescriptor(
2902 msvc_hashing_ostream MHO(Out);
2903 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2904 Mangler.getStream() <<
"\01??_R3";
2905 Mangler.mangleName(Derived);
2906 Mangler.getStream() <<
"8";
2909 void MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator(
2917 llvm::raw_svector_ostream Stream(VFTableMangling);
2918 mangleCXXVFTable(Derived, BasePath, Stream);
2920 if (VFTableMangling.startswith(
"\01??@")) {
2921 assert(VFTableMangling.endswith(
"@"));
2922 Out << VFTableMangling <<
"??_R4@";
2926 assert(VFTableMangling.startswith(
"\01??_7") ||
2927 VFTableMangling.startswith(
"\01??_S"));
2929 Out <<
"\01??_R4" << StringRef(VFTableMangling).drop_front(5);
2932 void MicrosoftMangleContextImpl::mangleSEHFilterExpression(
2933 const NamedDecl *EnclosingDecl, raw_ostream &Out) {
2934 msvc_hashing_ostream MHO(Out);
2935 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2940 Mangler.getStream() <<
"\01?filt$" << SEHFilterIds[EnclosingDecl]++ <<
"@0@";
2941 Mangler.mangleName(EnclosingDecl);
2944 void MicrosoftMangleContextImpl::mangleSEHFinallyBlock(
2945 const NamedDecl *EnclosingDecl, raw_ostream &Out) {
2946 msvc_hashing_ostream MHO(Out);
2947 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2952 Mangler.getStream() <<
"\01?fin$" << SEHFinallyIds[EnclosingDecl]++ <<
"@0@";
2953 Mangler.mangleName(EnclosingDecl);
2956 void MicrosoftMangleContextImpl::mangleTypeName(
QualType T, raw_ostream &Out) {
2959 MicrosoftCXXNameMangler Mangler(*
this, Out);
2960 Mangler.getStream() <<
'?';
2967 msvc_hashing_ostream MHO(Out);
2968 MicrosoftCXXNameMangler mangler(*
this, MHO, D, Type);
2975 msvc_hashing_ostream MHO(Out);
2976 MicrosoftCXXNameMangler mangler(*
this, MHO, D, Type);
2980 void MicrosoftMangleContextImpl::mangleReferenceTemporary(
2981 const VarDecl *VD,
unsigned ManglingNumber, raw_ostream &Out) {
2982 msvc_hashing_ostream MHO(Out);
2983 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2985 Mangler.getStream() <<
"\01?$RT" << ManglingNumber <<
'@';
2986 Mangler.mangle(VD,
"");
2989 void MicrosoftMangleContextImpl::mangleThreadSafeStaticGuardVariable(
2990 const VarDecl *VD,
unsigned GuardNum, raw_ostream &Out) {
2991 msvc_hashing_ostream MHO(Out);
2992 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2994 Mangler.getStream() <<
"\01?$TSS" << GuardNum <<
'@';
2995 Mangler.mangleNestedName(VD);
2996 Mangler.getStream() <<
"@4HA";
2999 void MicrosoftMangleContextImpl::mangleStaticGuardVariable(
const VarDecl *VD,
3011 msvc_hashing_ostream MHO(Out);
3012 MicrosoftCXXNameMangler Mangler(*
this, MHO);
3016 Mangler.getStream() << (VD->
getTLSKind() ?
"\01??__J" :
"\01??_B");
3018 Mangler.getStream() <<
"\01?$S1@";
3020 unsigned ScopeDepth = 0;
3021 if (Visible && !getNextDiscriminator(VD, ScopeDepth))
3025 Mangler.mangle(VD,
"");
3027 Mangler.mangleNestedName(VD);
3028 Mangler.getStream() << (Visible ?
"@5" :
"@4IA");
3030 Mangler.mangleNumber(ScopeDepth);
3033 void MicrosoftMangleContextImpl::mangleInitFiniStub(
const VarDecl *D,
3036 msvc_hashing_ostream MHO(Out);
3037 MicrosoftCXXNameMangler Mangler(*
this, MHO);
3038 Mangler.getStream() <<
"\01??__" << CharCode;
3039 Mangler.mangleName(D);
3041 Mangler.mangleVariableEncoding(D);
3042 Mangler.getStream() <<
'@';
3046 Mangler.getStream() <<
"YAXXZ";
3049 void MicrosoftMangleContextImpl::mangleDynamicInitializer(
const VarDecl *D,
3052 mangleInitFiniStub(D,
'E', Out);
3056 MicrosoftMangleContextImpl::mangleDynamicAtExitDestructor(
const VarDecl *D,
3059 mangleInitFiniStub(D,
'F', Out);
3062 void MicrosoftMangleContextImpl::mangleStringLiteral(
const StringLiteral *SL,
3083 MicrosoftCXXNameMangler Mangler(*
this, Out);
3084 Mangler.getStream() <<
"\01??_C@_";
3088 Mangler.getStream() <<
'1';
3090 Mangler.getStream() <<
'0';
3099 auto GetLittleEndianByte = [&SL](
unsigned Index) {
3101 uint32_t CodeUnit = SL->
getCodeUnit(Index / CharByteWidth);
3102 unsigned OffsetInCodeUnit = Index % CharByteWidth;
3103 return static_cast<char>((CodeUnit >> (8 * OffsetInCodeUnit)) & 0xff);
3106 auto GetBigEndianByte = [&SL](
unsigned Index) {
3108 uint32_t CodeUnit = SL->
getCodeUnit(Index / CharByteWidth);
3109 unsigned OffsetInCodeUnit = (CharByteWidth - 1) - (Index % CharByteWidth);
3110 return static_cast<char>((CodeUnit >> (8 * OffsetInCodeUnit)) & 0xff);
3116 JC.update(GetLittleEndianByte(I));
3126 Mangler.mangleNumber(JC.getCRC());
3132 auto MangleByte = [&Mangler](
char Byte) {
3140 Mangler.getStream() << Byte;
3141 }
else if (
isLetter(Byte & 0x7f)) {
3142 Mangler.getStream() <<
'?' <<
static_cast<char>(Byte & 0x7f);
3144 const char SpecialChars[] = {
',',
'/',
'\\',
':',
'.',
3145 ' ',
'\n',
'\t',
'\'',
'-'};
3147 std::find(std::begin(SpecialChars), std::end(SpecialChars), Byte);
3148 if (Pos != std::end(SpecialChars)) {
3149 Mangler.getStream() <<
'?' << (Pos - std::begin(SpecialChars));
3151 Mangler.getStream() <<
"?$";
3152 Mangler.getStream() <<
static_cast<char>(
'A' + ((Byte >> 4) & 0xf));
3153 Mangler.getStream() <<
static_cast<char>(
'A' + (Byte & 0xf));
3160 for (
unsigned I = 0, E = NumCharsToMangle * SL->
getCharByteWidth(); I != E;
3163 MangleByte(GetBigEndianByte(I));
3165 MangleByte(GetLittleEndianByte(I));
3168 if (NumCharsToMangle < 32)
3173 Mangler.getStream() <<
'@';
3178 return new MicrosoftMangleContextImpl(Context, Diags);
Defines the clang::ASTContext interface.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
An instance of this class is created to represent a function declaration or definition.
static Qualifiers fromCVRUMask(unsigned CVRU)
struct clang::ThisAdjustment::VirtualAdjustment::@119 Microsoft
StringRef getName(const PrintingPolicy &Policy) const
PointerType - C99 6.7.5.1 - Pointer Declarators.
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
QualType getPointeeType() const
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
bool isBlockPointerType() const
bool isMemberPointerType() const
bool isExternC() const
Determines whether this function is a function with external, C linkage.
__auto_type (GNU extension)
ArrayRef< TemplateArgument > getPackAsArray() const
Return the array of arguments in this template argument pack.
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
FunctionType - C99 6.7.5.3 - Function Declarators.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Represents a qualified type name for which the type name is dependent.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Decl - This represents one declaration (or definition), e.g.
Defines the C++ template declaration subclasses.
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Represents a C++11 auto or C++14 decltype(auto) type.
The base class of the type hierarchy.
int64_t NonVirtual
The non-virtual adjustment from the derived object to its nearest virtual base.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
NamespaceDecl - Represent a C++ namespace.
NamedDecl * getParam(unsigned Idx)
QualType withConst() const
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
Represents a C++ constructor within a class.
Default closure variant of a ctor.
MSInheritanceAttr::Spelling getMSInheritanceModel() const
Returns the inheritance model used for this record.
QualType getElementType() const
VarDecl - An instance of this class is created to represent a variable declaration or definition...
unsigned getNumParams() const
const T * getAs() const
Member-template getAs<specific type>'.
Represents an empty template argument, e.g., one that has not been deduced.
Represents a C++17 deduced template specialization type.
A this pointer adjustment.
The "__interface" keyword.
Represents a variable template specialization, which refers to a variable template with a given set o...
ObjCMethodDecl - Represents an instance or class method declaration.
const CXXMethodDecl * Method
Holds a pointer to the overridden method this thunk is for, if needed by the ABI to distinguish diffe...
Stores a list of template parameters for a TemplateDecl and its derived classes.
ParmVarDecl - Represents a parameter to a function.
Defines the clang::Expr interface and subclasses for C++ expressions.
QualType getIntegralType() const
Retrieve the type of the integral value.
The collection of all-type qualifiers we support.
bool isVariableArrayType() const
bool isDependentSizedArrayType() const
const char * getStmtClassName() const
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
int32_t VBOffsetOffset
The offset (in bytes) of the vbase offset in the vbtable.
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Linkage getFormalLinkage() const
Get the linkage from a semantic point of view.
One of these records is kept for each identifier that is lexed.
Represents a class template specialization, which refers to a class template with a given set of temp...
Represents a class type in Objective C.
QualType getPointeeType() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
LLVM_READONLY bool isLetter(unsigned char c)
Return true if this character is an ASCII letter: [a-zA-Z].
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
bool isReferenceType() const
Represents the result of substituting a set of types for a template type parameter pack...
The this pointer adjustment as well as an optional return adjustment for a thunk. ...
unsigned getCharByteWidth() const
QualType getParamTypeForDecl() const
unsigned getTypeQuals() const
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
An rvalue reference type, per C++11 [dcl.ref].
unsigned getLength() const
An lvalue ref-qualifier was provided (&).
TagKind getTagKind() const
CharUnits - This is an opaque type for sizes expressed in character units.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Concrete class used by the front-end to report problems and issues.
Represents a typeof (or typeof) expression (a GCC extension).
const Type * getClass() const
bool isLambda() const
Determine whether this class describes a lambda function object.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
Enums/classes describing ABI related information about constructors, destructors and thunks...
void * getAsOpaquePtr() const
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
Expr * getSizeExpr() const
Represents an extended vector type where either the type or size is dependent.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
bool isExternC() const
Determines whether this variable is a variable with external, C linkage.
unsigned getLambdaManglingNumber() const
If this is the closure type of a lambda expression, retrieve the number to be used for name mangling ...
QualType getBaseType() const
Gets the base type of this object type.
CXXRecordDecl * getMostRecentDecl()
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
Expr * IgnoreParenNoopCasts(ASTContext &Ctx) LLVM_READONLY
IgnoreParenNoopCasts - Ignore parentheses and casts that do not change the value (including ptr->int ...
Represents a ValueDecl that came out of a declarator.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
Represents an array type in C++ whose size is a value-dependent expression.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
CXXDtorType
C++ destructor types.
QualType getElementType() const
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
QualType getPointeeType() const
const FunctionProtoType * T
const T * castAs() const
Member-template castAs<specific type>.
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
Represents a C++ destructor within a class.
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
DeclContext * getDeclContext()
uint32_t getCodeUnit(size_t i) const
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
TLSKind getTLSKind() const
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Represents the type decltype(expr) (C++11).
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
bool isFunctionOrMethod() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Represents a GCC generic vector type.
An lvalue reference type, per C++11 [dcl.ref].
CharUnits getVBPtrOffset() const
getVBPtrOffset - Get the offset for virtual base table pointer.
static const TemplateDecl * isTemplate(const NamedDecl *ND, const TemplateArgumentList *&TemplateArgs)
The result type of a method or function.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool nullFieldOffsetIsZero() const
In the Microsoft C++ ABI, use zero for the field offset of a null data member pointer if we can guara...
The COMDAT used for dtors.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
GlobalDecl - represents a global declaration.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
QualType getCanonicalType() const
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
QualType getReturnType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
TagDecl - Represents the declaration of a struct/union/class/enum.
LanguageLinkage
Describes the different kinds of language linkage (C++ [dcl.link]) that an entity may have...
QualType getElementType() const
Represents a static or instance method of a struct/union/class.
No ref-qualifier was provided.
const ParmVarDecl * getParamDecl(unsigned i) const
This file defines OpenMP nodes for declarative directives.
bool isAnyPointerType() const
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
TypeClass getTypeClass() const
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
An rvalue ref-qualifier was provided (&&).
SourceRange getBracketsRange() const
Represents a pointer type decayed from an array or function type.
CXXCtorType
C++ constructor types.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
The injected class name of a C++ class template or class template partial specialization.
Represents a pack expansion of types.
StringRef getName() const
Return the actual identifier string.
static void mangleThunkThisAdjustment(const CXXMethodDecl *MD, const ThisAdjustment &Adjustment, MicrosoftCXXNameMangler &Mangler, raw_ostream &Out)
Base class for declarations which introduce a typedef-name.
Represents a template argument.
TagTypeKind
The kind of a tag type.
Dataflow Directional Tag Classes.
ThisAdjustment This
The this pointer adjustment.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
The base class of all kinds of template declarations (e.g., class, function, etc.).
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
The template argument is a pack expansion of a template name that was provided for a template templat...
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
AccessSpecifier getAccess() const
A decomposition declaration.
DeclarationName - The name of a declaration.
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isBooleanType() const
LLVM_READONLY bool isIdentifierBody(unsigned char c, bool AllowDollar=false)
Returns true if this is a body character of a C identifier, which is [a-zA-Z0-9_].
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return true if this expression is a valid integer constant expression...
union clang::ThisAdjustment::VirtualAdjustment Virtual
Represents a pointer to an Objective C object.
unsigned getByteLength() const
Not an overloaded operator.
bool isIncompleteArrayType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
const llvm::APInt & getSize() const
bool isFunctionType() const
bool isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
ExtVectorType - Extended vector type.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
ReturnAdjustment Return
The return adjustment.
The template argument is a type.
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
The template argument is actually a parameter pack.
bool isConstantArrayType() const
A template argument list.
StringRef getUuidStr() const
ArgKind getKind() const
Return the kind of stored template argument.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
QualType getParamType(unsigned i) const
CallingConv getCallConv() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
TypedefNameDecl * getTypedefNameForAnonDecl() const
bool hasUnaligned() const
Represents a C++ struct/union/class.
Represents a template specialization type whose template cannot be resolved, e.g. ...
The template argument is a template name that was provided for a template template parameter...
Represents a C array with an unspecified size.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
int32_t VtordispOffset
The offset of the vtordisp (in bytes), relative to the ECX.
static unsigned getCharWidth(tok::TokenKind kind, const TargetInfo &Target)
This class is used for builtin types like 'int'.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Copying closure variant of a ctor.
StringLiteral - This represents a string literal expression, e.g.
Defines the clang::TargetInfo interface.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
uint64_t Index
Method's index in the vftable.
unsigned getNumElements() const
QualType getAsType() const
Retrieve the type for a type template argument.
Represents an extended address space qualifier where the input address space value is dependent...
Represents a type template specialization; the template must be a class template, a type alias templa...
bool isPointerType() const
bool isStaticDataMember() const
Determines whether this is a static data member.
A trivial tuple used to represent a source range.
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
NamedDecl - This represents a decl with a name.
bool isTranslationUnit() const
Represents a C array with a specified size that is not an integer-constant-expression.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
SourceLocation getBegin() const
int32_t VBPtrOffset
The offset of the vbptr of the derived class (in bytes), relative to the ECX after vtordisp adjustmen...
Represents the canonical version of C arrays with a specified constant size.
bool hasLinkage() const
Determine whether this declaration has linkage.
const MethodVFTableLocation & getMethodVFTableLocation(GlobalDecl GD)
SourceLocation getLocation() const
QualType getPointeeType() const
bool isExternallyVisible() const
PrettyStackTraceDecl - If a crash occurs, indicate that it happened when doing something to a specifi...
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.