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;
269 const bool PointersAre64Bit;
272 enum QualifierMangleMode { QMM_Drop, QMM_Mangle, QMM_Escape, QMM_Result };
274 MicrosoftCXXNameMangler(MicrosoftMangleContextImpl &C, raw_ostream &Out_)
276 PointersAre64Bit(C.getASTContext().getTargetInfo().getPointerWidth(0) ==
279 MicrosoftCXXNameMangler(MicrosoftMangleContextImpl &C, raw_ostream &Out_,
282 PointersAre64Bit(C.getASTContext().getTargetInfo().getPointerWidth(0) ==
285 MicrosoftCXXNameMangler(MicrosoftMangleContextImpl &C, raw_ostream &Out_,
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);
353 void mangleArrayType(
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()) {
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));
875 Name +=
"<unnamed-type-";
876 Name += DD->getName();
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));
936 mangleOperatorName(Name.getCXXOverloadedOperator(), ND->
getLocation());
941 mangleSourceName(Name.getCXXLiteralIdentifier()->getName());
946 llvm_unreachable(
"Can't mangle a deduction guide name!");
949 llvm_unreachable(
"Can't mangle a using directive name!");
953 void MicrosoftCXXNameMangler::mangleNestedName(
const NamedDecl *ND) {
956 const DeclContext *DC = getEffectiveDeclContext(ND);
959 if (isa<TagDecl>(ND) || isa<VarDecl>(ND)) {
961 if (
Context.getNextDiscriminator(ND, Disc)) {
968 if (
const BlockDecl *BD = dyn_cast<BlockDecl>(DC)) {
970 [](StringRef
Name,
const unsigned Discriminator,
971 const unsigned ParameterDiscriminator) -> std::string {
973 llvm::raw_string_ostream Stream(Buffer);
976 Stream <<
'_' << Discriminator;
977 if (ParameterDiscriminator)
978 Stream <<
'_' << ParameterDiscriminator;
982 unsigned Discriminator = BD->getBlockManglingNumber();
984 Discriminator =
Context.getBlockId(BD,
false);
989 unsigned ParameterDiscriminator = 0;
990 if (
const auto *MC = BD->getBlockManglingContextDecl())
991 if (
const auto *
P = dyn_cast<ParmVarDecl>(MC))
992 if (
const auto *F = dyn_cast<FunctionDecl>(
P->getDeclContext()))
993 ParameterDiscriminator =
994 F->getNumParams() -
P->getFunctionScopeIndex();
996 DC = getEffectiveDeclContext(BD);
999 mangleSourceName(Discriminate(
"_block_invoke", Discriminator,
1000 ParameterDiscriminator));
1005 if (
const auto *MC = BD->getBlockManglingContextDecl())
1006 if (!isa<ParmVarDecl>(MC))
1007 if (
const auto *ND = dyn_cast<NamedDecl>(MC))
1008 mangleUnqualifiedName(ND);
1012 if (
const auto *RD = dyn_cast<RecordDecl>(DC))
1021 if (PointersAre64Bit)
1025 Discriminate(
"__block_literal", Discriminator,
1026 ParameterDiscriminator));
1031 if (isa<RecordDecl>(DC))
1034 }
else if (
const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(DC)) {
1035 mangleObjCMethodName(Method);
1036 }
else if (isa<NamedDecl>(DC)) {
1037 ND = cast<NamedDecl>(DC);
1038 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
1042 mangleUnqualifiedName(ND);
1045 if (
const auto *LDADC = getLambdaDefaultArgumentDeclContext(ND)) {
1055 void MicrosoftCXXNameMangler::mangleCXXDtorType(
CXXDtorType T) {
1070 llvm_unreachable(
"not expecting a COMDAT");
1072 llvm_unreachable(
"Unsupported dtor type?");
1081 case OO_New: Out <<
"?2";
break;
1083 case OO_Delete: Out <<
"?3";
break;
1085 case OO_Equal: Out <<
"?4";
break;
1087 case OO_GreaterGreater: Out <<
"?5";
break;
1089 case OO_LessLess: Out <<
"?6";
break;
1091 case OO_Exclaim: Out <<
"?7";
break;
1093 case OO_EqualEqual: Out <<
"?8";
break;
1095 case OO_ExclaimEqual: Out <<
"?9";
break;
1097 case OO_Subscript: Out <<
"?A";
break;
1100 case OO_Arrow: Out <<
"?C";
break;
1102 case OO_Star: Out <<
"?D";
break;
1104 case OO_PlusPlus: Out <<
"?E";
break;
1106 case OO_MinusMinus: Out <<
"?F";
break;
1108 case OO_Minus: Out <<
"?G";
break;
1110 case OO_Plus: Out <<
"?H";
break;
1112 case OO_Amp: Out <<
"?I";
break;
1114 case OO_ArrowStar: Out <<
"?J";
break;
1116 case OO_Slash: Out <<
"?K";
break;
1118 case OO_Percent: Out <<
"?L";
break;
1120 case OO_Less: Out <<
"?M";
break;
1122 case OO_LessEqual: Out <<
"?N";
break;
1124 case OO_Greater: Out <<
"?O";
break;
1126 case OO_GreaterEqual: Out <<
"?P";
break;
1128 case OO_Comma: Out <<
"?Q";
break;
1130 case OO_Call: Out <<
"?R";
break;
1132 case OO_Tilde: Out <<
"?S";
break;
1134 case OO_Caret: Out <<
"?T";
break;
1136 case OO_Pipe: Out <<
"?U";
break;
1138 case OO_AmpAmp: Out <<
"?V";
break;
1140 case OO_PipePipe: Out <<
"?W";
break;
1142 case OO_StarEqual: Out <<
"?X";
break;
1144 case OO_PlusEqual: Out <<
"?Y";
break;
1146 case OO_MinusEqual: Out <<
"?Z";
break;
1148 case OO_SlashEqual: Out <<
"?_0";
break;
1150 case OO_PercentEqual: Out <<
"?_1";
break;
1152 case OO_GreaterGreaterEqual: Out <<
"?_2";
break;
1154 case OO_LessLessEqual: Out <<
"?_3";
break;
1156 case OO_AmpEqual: Out <<
"?_4";
break;
1158 case OO_PipeEqual: Out <<
"?_5";
break;
1160 case OO_CaretEqual: Out <<
"?_6";
break;
1189 case OO_Array_New: Out <<
"?_U";
break;
1191 case OO_Array_Delete: Out <<
"?_V";
break;
1193 case OO_Coawait: Out <<
"?__L";
break;
1195 case OO_Conditional: {
1198 "cannot mangle this conditional operator yet");
1199 Diags.
Report(Loc, DiagID);
1205 llvm_unreachable(
"Not an overloaded operator");
1209 void MicrosoftCXXNameMangler::mangleSourceName(StringRef Name) {
1211 BackRefVec::iterator Found =
1212 std::find(NameBackReferences.begin(), NameBackReferences.end(),
Name);
1213 if (Found == NameBackReferences.end()) {
1214 if (NameBackReferences.size() < 10)
1215 NameBackReferences.push_back(Name);
1218 Out << (Found - NameBackReferences.begin());
1222 void MicrosoftCXXNameMangler::mangleObjCMethodName(
const ObjCMethodDecl *MD) {
1223 Context.mangleObjCMethodName(MD, Out);
1226 void MicrosoftCXXNameMangler::mangleTemplateInstantiationName(
1233 ArgBackRefMap OuterArgsContext;
1234 BackRefVec OuterTemplateContext;
1235 PassObjectSizeArgsSet OuterPassObjectSizeArgs;
1236 NameBackReferences.swap(OuterTemplateContext);
1237 TypeBackReferences.swap(OuterArgsContext);
1238 PassObjectSizeArgs.swap(OuterPassObjectSizeArgs);
1240 mangleUnscopedTemplateName(TD);
1241 mangleTemplateArgs(TD, TemplateArgs);
1244 NameBackReferences.swap(OuterTemplateContext);
1245 TypeBackReferences.swap(OuterArgsContext);
1246 PassObjectSizeArgs.swap(OuterPassObjectSizeArgs);
1250 MicrosoftCXXNameMangler::mangleUnscopedTemplateName(
const TemplateDecl *TD) {
1253 mangleUnqualifiedName(TD);
1256 void MicrosoftCXXNameMangler::mangleIntegerLiteral(
const llvm::APSInt &Value,
1261 if (IsBoolean && Value.getBoolValue())
1263 else if (Value.isSigned())
1264 mangleNumber(Value.getSExtValue());
1266 mangleNumber(Value.getZExtValue());
1269 void MicrosoftCXXNameMangler::mangleExpression(
const Expr *
E) {
1282 if (UO->getOpcode() == UO_AddrOf)
1283 UE = dyn_cast<CXXUuidofExpr>(UO->getSubExpr());
1301 std::string Name =
"_GUID_" + Uuid.lower();
1302 std::replace(Name.begin(), Name.end(),
'-',
'_');
1304 mangleSourceName(Name);
1310 mangleArtificalTagType(
TTK_Struct,
"__s_GUID");
1324 void MicrosoftCXXNameMangler::mangleTemplateArgs(
1328 assert(TPL->
size() == TemplateArgs.
size() &&
1329 "size mismatch between args and parms!");
1333 mangleTemplateArg(TD, TA, TPL->
getParam(Idx++));
1336 void MicrosoftCXXNameMangler::mangleTemplateArg(
const TemplateDecl *TD,
1350 llvm_unreachable(
"Can't mangle null template arguments!");
1352 llvm_unreachable(
"Can't mangle template expansion arguments!");
1360 if (isa<FieldDecl>(ND) || isa<IndirectFieldDecl>(ND)) {
1361 mangleMemberDataPointer(
1363 cast<ValueDecl>(ND));
1364 }
else if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
1371 mangleFunctionEncoding(FD,
true);
1385 const CXXRecordDecl *RD = MPT->getMostRecentCXXRecordDecl();
1386 if (MPT->isMemberFunctionPointerType() &&
1387 !isa<FunctionTemplateDecl>(TD)) {
1388 mangleMemberFunctionPointer(RD,
nullptr);
1391 if (MPT->isMemberDataPointer()) {
1392 if (!isa<FunctionTemplateDecl>(TD)) {
1393 mangleMemberDataPointer(RD,
nullptr);
1403 mangleIntegerLiteral(llvm::APSInt::get(-1),
false);
1408 mangleIntegerLiteral(llvm::APSInt::getUnsigned(0),
false);
1416 if (TemplateArgs.empty()) {
1417 if (isa<TemplateTypeParmDecl>(Parm) ||
1418 isa<TemplateTemplateParmDecl>(Parm))
1425 else if (isa<NonTypeTemplateParmDecl>(Parm))
1428 llvm_unreachable(
"unexpected template parameter decl!");
1431 mangleTemplateArg(TD, PA, Parm);
1438 if (
const auto *TD = dyn_cast<TagDecl>(ND)) {
1440 }
else if (isa<TypeAliasDecl>(ND)) {
1444 llvm_unreachable(
"unexpected template template NamedDecl!");
1451 void MicrosoftCXXNameMangler::mangleQualifiers(
Qualifiers Quals,
1509 if (HasConst && HasVolatile) {
1511 }
else if (HasVolatile) {
1513 }
else if (HasConst) {
1519 if (HasConst && HasVolatile) {
1521 }
else if (HasVolatile) {
1523 }
else if (HasConst) {
1534 MicrosoftCXXNameMangler::mangleRefQualifier(
RefQualifierKind RefQualifier) {
1537 switch (RefQualifier) {
1551 void MicrosoftCXXNameMangler::manglePointerExtQualifiers(
Qualifiers Quals,
1554 if (PointersAre64Bit &&
1566 void MicrosoftCXXNameMangler::manglePointerCVQualifiers(
Qualifiers Quals) {
1574 if (HasConst && HasVolatile) {
1576 }
else if (HasVolatile) {
1578 }
else if (HasConst) {
1585 void MicrosoftCXXNameMangler::mangleArgumentType(
QualType T,
1596 QualType OriginalType = DT->getOriginalType();
1599 if (
const auto *AT = getASTContext().getAsArrayType(OriginalType))
1600 OriginalType = getASTContext().getIncompleteArrayType(
1601 AT->getElementType(), AT->getSizeModifier(),
1602 AT->getIndexTypeCVRQualifiers());
1616 ArgBackRefMap::iterator Found = TypeBackReferences.find(TypePtr);
1618 if (Found == TypeBackReferences.end()) {
1619 size_t OutSizeBefore = Out.tell();
1621 mangleType(T, Range, QMM_Drop);
1626 bool LongerThanOneChar = (Out.tell() - OutSizeBefore > 1);
1627 if (LongerThanOneChar && TypeBackReferences.size() < 10) {
1628 size_t Size = TypeBackReferences.size();
1629 TypeBackReferences[TypePtr] = Size;
1632 Out << Found->second;
1636 void MicrosoftCXXNameMangler::manglePassObjectSizeArg(
1637 const PassObjectSizeAttr *POSA) {
1638 int Type = POSA->getType();
1640 auto Iter = PassObjectSizeArgs.insert(Type).first;
1641 auto *TypePtr = (
const void *)&*Iter;
1642 ArgBackRefMap::iterator Found = TypeBackReferences.find(TypePtr);
1644 if (Found == TypeBackReferences.end()) {
1645 mangleArtificalTagType(
TTK_Enum,
"__pass_object_size" + llvm::utostr(Type),
1648 if (TypeBackReferences.size() < 10) {
1649 size_t Size = TypeBackReferences.size();
1650 TypeBackReferences[TypePtr] = Size;
1653 Out << Found->second;
1658 QualifierMangleMode QMM) {
1663 if (
const ArrayType *AT = getASTContext().getAsArrayType(T)) {
1666 if (QMM == QMM_Mangle)
1668 else if (QMM == QMM_Escape || QMM == QMM_Result)
1670 mangleArrayType(AT);
1681 if (
const FunctionType *FT = dyn_cast<FunctionType>(T)) {
1683 mangleFunctionType(FT);
1686 mangleQualifiers(Quals,
false);
1689 if (!IsPointer && Quals) {
1691 mangleQualifiers(Quals,
false);
1697 if ((!IsPointer && Quals) || isa<TagType>(T)) {
1699 mangleQualifiers(Quals,
false);
1707 #define ABSTRACT_TYPE(CLASS, PARENT)
1708 #define NON_CANONICAL_TYPE(CLASS, PARENT) \
1710 llvm_unreachable("can't mangle non-canonical type " #CLASS "Type"); \
1712 #define TYPE(CLASS, PARENT) \
1714 mangleType(cast<CLASS##Type>(ty), Quals, Range); \
1716 #include "clang/AST/TypeNodes.def"
1717 #undef ABSTRACT_TYPE
1718 #undef NON_CANONICAL_TYPE
1752 case BuiltinType::Void:
1755 case BuiltinType::SChar:
1758 case BuiltinType::Char_U:
1759 case BuiltinType::Char_S:
1762 case BuiltinType::UChar:
1765 case BuiltinType::Short:
1768 case BuiltinType::UShort:
1771 case BuiltinType::Int:
1774 case BuiltinType::UInt:
1777 case BuiltinType::Long:
1780 case BuiltinType::ULong:
1783 case BuiltinType::Float:
1786 case BuiltinType::Double:
1790 case BuiltinType::LongDouble:
1793 case BuiltinType::LongLong:
1796 case BuiltinType::ULongLong:
1799 case BuiltinType::Int128:
1802 case BuiltinType::UInt128:
1805 case BuiltinType::Bool:
1808 case BuiltinType::Char16:
1811 case BuiltinType::Char32:
1814 case BuiltinType::WChar_S:
1815 case BuiltinType::WChar_U:
1819 #define BUILTIN_TYPE(Id, SingletonId)
1820 #define PLACEHOLDER_TYPE(Id, SingletonId) \
1821 case BuiltinType::Id:
1822 #include "clang/AST/BuiltinTypes.def"
1823 case BuiltinType::Dependent:
1824 llvm_unreachable(
"placeholder types shouldn't get to name mangling");
1826 case BuiltinType::ObjCId:
1828 mangleArtificalTagType(
TTK_Struct,
"objc_object");
1830 case BuiltinType::ObjCClass:
1832 mangleArtificalTagType(
TTK_Struct,
"objc_class");
1834 case BuiltinType::ObjCSel:
1836 mangleArtificalTagType(
TTK_Struct,
"objc_selector");
1839 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1840 case BuiltinType::Id: \
1841 Out << "PAUocl_" #ImgType "_" #Suffix "@@"; \
1843 #include "clang/Basic/OpenCLImageTypes.def"
1844 case BuiltinType::OCLSampler:
1846 mangleArtificalTagType(
TTK_Struct,
"ocl_sampler");
1848 case BuiltinType::OCLEvent:
1850 mangleArtificalTagType(
TTK_Struct,
"ocl_event");
1852 case BuiltinType::OCLClkEvent:
1854 mangleArtificalTagType(
TTK_Struct,
"ocl_clkevent");
1856 case BuiltinType::OCLQueue:
1858 mangleArtificalTagType(
TTK_Struct,
"ocl_queue");
1860 case BuiltinType::OCLReserveID:
1862 mangleArtificalTagType(
TTK_Struct,
"ocl_reserveid");
1865 case BuiltinType::NullPtr:
1869 case BuiltinType::Float128:
1870 case BuiltinType::Half: {
1889 mangleFunctionType(T,
nullptr,
true);
1892 mangleFunctionType(T);
1898 mangleFunctionType(T);
1901 void MicrosoftCXXNameMangler::mangleFunctionType(
const FunctionType *T,
1903 bool ForceThisQuals) {
1911 bool IsInLambda =
false;
1912 bool IsStructor =
false, HasThisQuals = ForceThisQuals, IsCtorClosure =
false;
1914 if (
const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(D)) {
1918 HasThisQuals =
true;
1919 if (isa<CXXDestructorDecl>(MD)) {
1921 }
else if (isa<CXXConstructorDecl>(MD)) {
1927 CC = getASTContext().getDefaultCallingConvention(
1936 manglePointerExtQualifiers(Quals,
QualType());
1938 mangleQualifiers(Quals,
false);
1941 mangleCallingConvention(CC);
1946 if (isa<CXXDestructorDecl>(D) && isStructorDecl(D)) {
1950 Out << (PointersAre64Bit ?
"PEAXI@Z" :
"PAXI@Z");
1959 if (IsCtorClosure) {
1969 mangleArgumentType(getASTContext().getLValueReferenceType(
1977 llvm_unreachable(
"unexpected constructor closure!");
1985 if (
const auto *AT =
1991 "shouldn't need to mangle __auto_type!");
1992 mangleSourceName(AT->isDecltypeAuto() ?
"<decltype-auto>" :
"<auto>");
1994 }
else if (IsInLambda) {
1999 mangleType(ResultType, Range, QMM_Result);
2027 manglePassObjectSizeArg(
P);
2036 mangleThrowSpecification(Proto);
2039 void MicrosoftCXXNameMangler::mangleFunctionClass(
const FunctionDecl *FD) {
2064 if (
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
2068 if (isa<CXXDestructorDecl>(MD) && isStructorDecl(MD) &&
2074 llvm_unreachable(
"Unsupported access specifier");
2103 void MicrosoftCXXNameMangler::mangleCallingConvention(
CallingConv CC) {
2124 llvm_unreachable(
"Unsupported CC for mangling");
2127 case CC_C: Out <<
'A';
break;
2136 void MicrosoftCXXNameMangler::mangleCallingConvention(
const FunctionType *T) {
2139 void MicrosoftCXXNameMangler::mangleThrowSpecification(
2156 "cannot mangle this unresolved dependent type yet");
2166 void MicrosoftCXXNameMangler::mangleTagTypeKind(
TagTypeKind TTK) {
2185 mangleType(cast<TagType>(T)->getDecl());
2189 mangleType(cast<TagType>(T)->getDecl());
2191 void MicrosoftCXXNameMangler::mangleType(
const TagDecl *TD) {
2195 void MicrosoftCXXNameMangler::mangleArtificalTagType(
2198 mangleTagTypeKind(TK);
2201 mangleSourceName(UnqualifiedName);
2203 for (
auto I = NestedNames.rbegin(), E = NestedNames.rend(); I !=
E; ++
I)
2204 mangleSourceName(*I);
2217 void MicrosoftCXXNameMangler::mangleDecayedArrayType(
const ArrayType *T) {
2225 llvm_unreachable(
"Should have been special cased");
2229 llvm_unreachable(
"Should have been special cased");
2233 llvm_unreachable(
"Should have been special cased");
2237 llvm_unreachable(
"Should have been special cased");
2239 void MicrosoftCXXNameMangler::mangleArrayType(
const ArrayType *T) {
2243 if (ElementTy->isConstantArrayType()) {
2245 getASTContext().getAsConstantArrayType(ElementTy);
2246 Dimensions.push_back(CAT->
getSize());
2248 }
else if (ElementTy->isIncompleteArrayType()) {
2250 getASTContext().getAsIncompleteArrayType(ElementTy);
2251 Dimensions.push_back(llvm::APInt(32, 0));
2253 }
else if (ElementTy->isVariableArrayType()) {
2255 getASTContext().getAsVariableArrayType(ElementTy);
2256 Dimensions.push_back(llvm::APInt(32, 0));
2258 }
else if (ElementTy->isDependentSizedArrayType()) {
2261 getASTContext().getAsDependentSizedArrayType(ElementTy);
2264 "cannot mangle this dependent-length array yet");
2274 mangleNumber(Dimensions.size());
2275 for (
const llvm::APInt &Dimension : Dimensions)
2276 mangleNumber(Dimension.getLimitedValue());
2286 manglePointerCVQualifiers(Quals);
2287 manglePointerExtQualifiers(Quals, PointeeType);
2291 mangleFunctionType(FPT,
nullptr,
true);
2295 mangleType(PointeeType, Range, QMM_Drop);
2303 "cannot mangle this template type parameter type yet");
2312 "cannot mangle this substituted parameter pack yet");
2323 manglePointerCVQualifiers(Quals);
2324 manglePointerExtQualifiers(Quals, PointeeType);
2325 mangleType(PointeeType, Range);
2330 manglePointerCVQualifiers(Quals);
2331 manglePointerExtQualifiers(Quals, PointeeType);
2334 mangleType(PointeeType, Range);
2345 manglePointerExtQualifiers(Quals, PointeeType);
2346 mangleType(PointeeType, Range);
2357 manglePointerExtQualifiers(Quals, PointeeType);
2358 mangleType(PointeeType, Range);
2366 llvm::raw_svector_ostream Stream(TemplateMangling);
2367 MicrosoftCXXNameMangler Extra(
Context, Stream);
2369 Extra.mangleSourceName(
"_Complex");
2370 Extra.mangleType(ElementType, Range, QMM_Escape);
2372 mangleArtificalTagType(
TTK_Struct, TemplateMangling, {
"__clang"});
2378 assert(ET &&
"vectors with non-builtin elements are unsupported");
2379 uint64_t Width = getASTContext().getTypeSize(T);
2382 size_t OutSizeBefore = Out.tell();
2383 llvm::Triple::ArchType AT =
2384 getASTContext().getTargetInfo().getTriple().getArch();
2385 if (AT == llvm::Triple::x86 || AT == llvm::Triple::x86_64) {
2386 if (Width == 64 && ET->
getKind() == BuiltinType::LongLong) {
2387 mangleArtificalTagType(
TTK_Union,
"__m64");
2388 }
else if (Width >= 128) {
2389 if (ET->
getKind() == BuiltinType::Float)
2390 mangleArtificalTagType(
TTK_Union,
"__m" + llvm::utostr(Width));
2391 else if (ET->
getKind() == BuiltinType::LongLong)
2392 mangleArtificalTagType(
TTK_Union,
"__m" + llvm::utostr(Width) +
'i');
2393 else if (ET->
getKind() == BuiltinType::Double)
2394 mangleArtificalTagType(
TTK_Struct,
"__m" + llvm::utostr(Width) +
'd');
2398 bool IsBuiltin = Out.tell() != OutSizeBefore;
2405 llvm::raw_svector_ostream Stream(TemplateMangling);
2406 MicrosoftCXXNameMangler Extra(
Context, Stream);
2408 Extra.mangleSourceName(
"__vector");
2409 Extra.mangleType(
QualType(ET, 0), Range, QMM_Escape);
2410 Extra.mangleIntegerLiteral(llvm::APSInt::getUnsigned(T->
getNumElements()),
2413 mangleArtificalTagType(
TTK_Union, TemplateMangling, {
"__clang"});
2417 void MicrosoftCXXNameMangler::mangleType(
const ExtVectorType *T,
2419 mangleType(static_cast<const VectorType *>(T), Quals, Range);
2425 "cannot mangle this dependent-sized extended vector type yet");
2447 manglePointerCVQualifiers(Quals);
2448 manglePointerExtQualifiers(Quals, PointeeType);
2457 llvm_unreachable(
"Cannot mangle injected class name type.");
2464 "cannot mangle this template specialization type yet");
2473 "cannot mangle this dependent name type yet");
2478 void MicrosoftCXXNameMangler::mangleType(
2483 "cannot mangle this dependent template specialization type yet");
2492 "cannot mangle this pack expansion yet");
2501 "cannot mangle this typeof(type) yet");
2510 "cannot mangle this typeof(expression) yet");
2519 "cannot mangle this decltype() yet");
2528 "cannot mangle this unary transform type yet");
2539 "cannot mangle this 'auto' type yet");
2540 Diags.Report(Range.
getBegin(), DiagID)
2544 void MicrosoftCXXNameMangler::mangleType(
2550 "cannot mangle this deduced class template specialization type yet");
2551 Diags.Report(Range.
getBegin(), DiagID)
2560 llvm::raw_svector_ostream Stream(TemplateMangling);
2561 MicrosoftCXXNameMangler Extra(
Context, Stream);
2563 Extra.mangleSourceName(
"_Atomic");
2564 Extra.mangleType(ValueType, Range, QMM_Escape);
2566 mangleArtificalTagType(
TTK_Struct, TemplateMangling, {
"__clang"});
2573 "cannot mangle this OpenCL pipe type yet");
2578 void MicrosoftMangleContextImpl::mangleCXXName(
const NamedDecl *D,
2580 assert((isa<FunctionDecl>(D) || isa<VarDecl>(D)) &&
2581 "Invalid mangleName() call, argument is not a variable or function!");
2582 assert(!isa<CXXConstructorDecl>(D) && !isa<CXXDestructorDecl>(D) &&
2583 "Invalid mangleName() call on 'structor decl!");
2586 getASTContext().getSourceManager(),
2587 "Mangling declaration");
2589 msvc_hashing_ostream MHO(Out);
2590 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2591 return Mangler.mangle(D);
2620 MicrosoftCXXNameMangler &Mangler,
2627 llvm_unreachable(
"Unsupported access specifier");
2638 Out <<
'R' << AccessSpec;
2639 Mangler.mangleNumber(
2641 Mangler.mangleNumber(
2643 Mangler.mangleNumber(
2645 Mangler.mangleNumber(static_cast<uint32_t>(Adjustment.
NonVirtual));
2648 Mangler.mangleNumber(
2650 Mangler.mangleNumber(-static_cast<uint32_t>(Adjustment.
NonVirtual));
2655 llvm_unreachable(
"Unsupported access specifier");
2665 Mangler.mangleNumber(-static_cast<uint32_t>(Adjustment.
NonVirtual));
2669 llvm_unreachable(
"Unsupported access specifier");
2683 MicrosoftMangleContextImpl::mangleVirtualMemPtrThunk(
const CXXMethodDecl *MD,
2686 cast<MicrosoftVTableContext>(getASTContext().getVTableContext());
2690 msvc_hashing_ostream MHO(Out);
2691 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2692 Mangler.getStream() <<
"\01?";
2693 Mangler.mangleVirtualMemPtrThunk(MD, ML);
2696 void MicrosoftMangleContextImpl::mangleThunk(
const CXXMethodDecl *MD,
2699 msvc_hashing_ostream MHO(Out);
2700 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2701 Mangler.getStream() <<
"\01?";
2702 Mangler.mangleName(MD);
2705 assert(Thunk.
Method !=
nullptr &&
2706 "Thunk info should hold the overridee decl");
2709 Mangler.mangleFunctionType(
2713 void MicrosoftMangleContextImpl::mangleCXXDtorThunk(
2720 msvc_hashing_ostream MHO(Out);
2721 MicrosoftCXXNameMangler Mangler(*
this, MHO, DD, Type);
2722 Mangler.getStream() <<
"\01??_E";
2728 void MicrosoftMangleContextImpl::mangleCXXVFTable(
2735 msvc_hashing_ostream MHO(Out);
2736 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2737 if (Derived->
hasAttr<DLLImportAttr>())
2738 Mangler.getStream() <<
"\01??_S";
2740 Mangler.getStream() <<
"\01??_7";
2741 Mangler.mangleName(Derived);
2742 Mangler.getStream() <<
"6B";
2744 Mangler.mangleName(RD);
2745 Mangler.getStream() <<
'@';
2748 void MicrosoftMangleContextImpl::mangleCXXVBTable(
2755 msvc_hashing_ostream MHO(Out);
2756 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2757 Mangler.getStream() <<
"\01??_8";
2758 Mangler.mangleName(Derived);
2759 Mangler.getStream() <<
"7B";
2761 Mangler.mangleName(RD);
2762 Mangler.getStream() <<
'@';
2765 void MicrosoftMangleContextImpl::mangleCXXRTTI(
QualType T, raw_ostream &Out) {
2766 msvc_hashing_ostream MHO(Out);
2767 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2768 Mangler.getStream() <<
"\01??_R0";
2769 Mangler.mangleType(T,
SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
2770 Mangler.getStream() <<
"@8";
2773 void MicrosoftMangleContextImpl::mangleCXXRTTIName(
QualType T,
2775 MicrosoftCXXNameMangler Mangler(*
this, Out);
2776 Mangler.getStream() <<
'.';
2777 Mangler.mangleType(T,
SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
2780 void MicrosoftMangleContextImpl::mangleCXXVirtualDisplacementMap(
2782 msvc_hashing_ostream MHO(Out);
2783 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2784 Mangler.getStream() <<
"\01??_K";
2785 Mangler.mangleName(SrcRD);
2786 Mangler.getStream() <<
"$C";
2787 Mangler.mangleName(DstRD);
2790 void MicrosoftMangleContextImpl::mangleCXXThrowInfo(
QualType T,
bool IsConst,
2793 uint32_t NumEntries,
2795 msvc_hashing_ostream MHO(Out);
2796 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2797 Mangler.getStream() <<
"_TI";
2799 Mangler.getStream() <<
'C';
2801 Mangler.getStream() <<
'V';
2803 Mangler.getStream() <<
'U';
2804 Mangler.getStream() << NumEntries;
2805 Mangler.mangleType(T,
SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
2808 void MicrosoftMangleContextImpl::mangleCXXCatchableTypeArray(
2809 QualType T, uint32_t NumEntries, raw_ostream &Out) {
2810 msvc_hashing_ostream MHO(Out);
2811 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2812 Mangler.getStream() <<
"_CTA";
2813 Mangler.getStream() << NumEntries;
2814 Mangler.mangleType(T,
SourceRange(), MicrosoftCXXNameMangler::QMM_Result);
2817 void MicrosoftMangleContextImpl::mangleCXXCatchableType(
2819 uint32_t NVOffset, int32_t VBPtrOffset, uint32_t VBIndex,
2821 MicrosoftCXXNameMangler Mangler(*
this, Out);
2822 Mangler.getStream() <<
"_CT";
2826 llvm::raw_svector_ostream Stream(RTTIMangling);
2827 msvc_hashing_ostream MHO(Stream);
2828 mangleCXXRTTI(T, MHO);
2830 Mangler.getStream() << RTTIMangling.substr(1);
2835 if (!getASTContext().getLangOpts().isCompatibleWithMSVC(
2838 llvm::raw_svector_ostream Stream(CopyCtorMangling);
2839 msvc_hashing_ostream MHO(Stream);
2840 mangleCXXCtor(CD, CT, MHO);
2842 Mangler.getStream() << CopyCtorMangling.substr(1);
2844 Mangler.getStream() << Size;
2845 if (VBPtrOffset == -1) {
2847 Mangler.getStream() << NVOffset;
2850 Mangler.getStream() << NVOffset;
2851 Mangler.getStream() << VBPtrOffset;
2852 Mangler.getStream() << VBIndex;
2856 void MicrosoftMangleContextImpl::mangleCXXRTTIBaseClassDescriptor(
2857 const CXXRecordDecl *Derived, uint32_t NVOffset, int32_t VBPtrOffset,
2858 uint32_t VBTableOffset, uint32_t Flags, raw_ostream &Out) {
2859 msvc_hashing_ostream MHO(Out);
2860 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2861 Mangler.getStream() <<
"\01??_R1";
2862 Mangler.mangleNumber(NVOffset);
2863 Mangler.mangleNumber(VBPtrOffset);
2864 Mangler.mangleNumber(VBTableOffset);
2865 Mangler.mangleNumber(Flags);
2866 Mangler.mangleName(Derived);
2867 Mangler.getStream() <<
"8";
2870 void MicrosoftMangleContextImpl::mangleCXXRTTIBaseClassArray(
2872 msvc_hashing_ostream MHO(Out);
2873 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2874 Mangler.getStream() <<
"\01??_R2";
2875 Mangler.mangleName(Derived);
2876 Mangler.getStream() <<
"8";
2879 void MicrosoftMangleContextImpl::mangleCXXRTTIClassHierarchyDescriptor(
2881 msvc_hashing_ostream MHO(Out);
2882 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2883 Mangler.getStream() <<
"\01??_R3";
2884 Mangler.mangleName(Derived);
2885 Mangler.getStream() <<
"8";
2888 void MicrosoftMangleContextImpl::mangleCXXRTTICompleteObjectLocator(
2896 llvm::raw_svector_ostream Stream(VFTableMangling);
2897 mangleCXXVFTable(Derived, BasePath, Stream);
2899 if (VFTableMangling.startswith(
"\01??@")) {
2900 assert(VFTableMangling.endswith(
"@"));
2901 Out << VFTableMangling <<
"??_R4@";
2905 assert(VFTableMangling.startswith(
"\01??_7") ||
2906 VFTableMangling.startswith(
"\01??_S"));
2908 Out <<
"\01??_R4" << StringRef(VFTableMangling).drop_front(5);
2911 void MicrosoftMangleContextImpl::mangleSEHFilterExpression(
2912 const NamedDecl *EnclosingDecl, raw_ostream &Out) {
2913 msvc_hashing_ostream MHO(Out);
2914 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2919 Mangler.getStream() <<
"\01?filt$" << SEHFilterIds[EnclosingDecl]++ <<
"@0@";
2920 Mangler.mangleName(EnclosingDecl);
2923 void MicrosoftMangleContextImpl::mangleSEHFinallyBlock(
2924 const NamedDecl *EnclosingDecl, raw_ostream &Out) {
2925 msvc_hashing_ostream MHO(Out);
2926 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2931 Mangler.getStream() <<
"\01?fin$" << SEHFinallyIds[EnclosingDecl]++ <<
"@0@";
2932 Mangler.mangleName(EnclosingDecl);
2935 void MicrosoftMangleContextImpl::mangleTypeName(
QualType T, raw_ostream &Out) {
2938 MicrosoftCXXNameMangler Mangler(*
this, Out);
2939 Mangler.getStream() <<
'?';
2946 msvc_hashing_ostream MHO(Out);
2947 MicrosoftCXXNameMangler mangler(*
this, MHO, D, Type);
2954 msvc_hashing_ostream MHO(Out);
2955 MicrosoftCXXNameMangler mangler(*
this, MHO, D, Type);
2959 void MicrosoftMangleContextImpl::mangleReferenceTemporary(
2960 const VarDecl *VD,
unsigned ManglingNumber, raw_ostream &Out) {
2961 msvc_hashing_ostream MHO(Out);
2962 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2964 Mangler.getStream() <<
"\01?$RT" << ManglingNumber <<
'@';
2965 Mangler.mangle(VD,
"");
2968 void MicrosoftMangleContextImpl::mangleThreadSafeStaticGuardVariable(
2969 const VarDecl *VD,
unsigned GuardNum, raw_ostream &Out) {
2970 msvc_hashing_ostream MHO(Out);
2971 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2973 Mangler.getStream() <<
"\01?$TSS" << GuardNum <<
'@';
2974 Mangler.mangleNestedName(VD);
2975 Mangler.getStream() <<
"@4HA";
2978 void MicrosoftMangleContextImpl::mangleStaticGuardVariable(
const VarDecl *VD,
2990 msvc_hashing_ostream MHO(Out);
2991 MicrosoftCXXNameMangler Mangler(*
this, MHO);
2995 Mangler.getStream() << (VD->
getTLSKind() ?
"\01??__J" :
"\01??_B");
2997 Mangler.getStream() <<
"\01?$S1@";
2999 unsigned ScopeDepth = 0;
3000 if (Visible && !getNextDiscriminator(VD, ScopeDepth))
3004 Mangler.mangle(VD,
"");
3006 Mangler.mangleNestedName(VD);
3007 Mangler.getStream() << (Visible ?
"@5" :
"@4IA");
3009 Mangler.mangleNumber(ScopeDepth);
3012 void MicrosoftMangleContextImpl::mangleInitFiniStub(
const VarDecl *D,
3015 msvc_hashing_ostream MHO(Out);
3016 MicrosoftCXXNameMangler Mangler(*
this, MHO);
3017 Mangler.getStream() <<
"\01??__" << CharCode;
3018 Mangler.mangleName(D);
3020 Mangler.mangleVariableEncoding(D);
3021 Mangler.getStream() <<
'@';
3025 Mangler.getStream() <<
"YAXXZ";
3028 void MicrosoftMangleContextImpl::mangleDynamicInitializer(
const VarDecl *D,
3031 mangleInitFiniStub(D,
'E', Out);
3035 MicrosoftMangleContextImpl::mangleDynamicAtExitDestructor(
const VarDecl *D,
3038 mangleInitFiniStub(D,
'F', Out);
3041 void MicrosoftMangleContextImpl::mangleStringLiteral(
const StringLiteral *SL,
3062 MicrosoftCXXNameMangler Mangler(*
this, Out);
3063 Mangler.getStream() <<
"\01??_C@_";
3067 Mangler.getStream() <<
'1';
3069 Mangler.getStream() <<
'0';
3078 auto GetLittleEndianByte = [&SL](
unsigned Index) {
3080 uint32_t CodeUnit = SL->
getCodeUnit(Index / CharByteWidth);
3081 unsigned OffsetInCodeUnit = Index % CharByteWidth;
3082 return static_cast<char>((CodeUnit >> (8 * OffsetInCodeUnit)) & 0xff);
3085 auto GetBigEndianByte = [&SL](
unsigned Index) {
3087 uint32_t CodeUnit = SL->
getCodeUnit(Index / CharByteWidth);
3088 unsigned OffsetInCodeUnit = (CharByteWidth - 1) - (Index % CharByteWidth);
3089 return static_cast<char>((CodeUnit >> (8 * OffsetInCodeUnit)) & 0xff);
3095 JC.update(GetLittleEndianByte(I));
3105 Mangler.mangleNumber(JC.getCRC());
3111 auto MangleByte = [&Mangler](
char Byte) {
3119 Mangler.getStream() << Byte;
3120 }
else if (
isLetter(Byte & 0x7f)) {
3121 Mangler.getStream() <<
'?' <<
static_cast<char>(Byte & 0x7f);
3123 const char SpecialChars[] = {
',',
'/',
'\\',
':',
'.',
3124 ' ',
'\n',
'\t',
'\'',
'-'};
3126 std::find(std::begin(SpecialChars), std::end(SpecialChars), Byte);
3127 if (Pos != std::end(SpecialChars)) {
3128 Mangler.getStream() <<
'?' << (Pos - std::begin(SpecialChars));
3130 Mangler.getStream() <<
"?$";
3131 Mangler.getStream() <<
static_cast<char>(
'A' + ((Byte >> 4) & 0xf));
3132 Mangler.getStream() <<
static_cast<char>(
'A' + (Byte & 0xf));
3142 MangleByte(GetBigEndianByte(I));
3144 MangleByte(GetLittleEndianByte(I));
3147 if (NumCharsToMangle < 32)
3152 Mangler.getStream() <<
'@';
3157 return new MicrosoftMangleContextImpl(Context, Diags);
unsigned getNumElements() const
Defines the clang::ASTContext interface.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
FunctionDecl - 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
PointerType - C99 6.7.5.1 - Pointer Declarators.
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
bool isMemberPointerType() const
__auto_type (GNU extension)
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
MSInheritanceAttr::Spelling getMSInheritanceModel() const
Returns the inheritance model used for this record.
FunctionType - C99 6.7.5.3 - Function Declarators.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
Represents a qualified type name for which the type name is dependent.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
Decl - This represents one declaration (or definition), e.g.
static LLVM_READONLY bool isLetter(unsigned char c)
Return true if this character is an ASCII letter: [a-zA-Z].
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type.
QualType getPointeeType() const
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
The base class of the type hierarchy.
bool hasLinkage() const
Determine whether this declaration has linkage.
int64_t NonVirtual
The non-virtual adjustment from the derived object to its nearest virtual base.
std::unique_ptr< llvm::MemoryBuffer > Buffer
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)
bool isBooleanType() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
bool isBlockPointerType() const
Represents a C++ constructor within a class.
Default closure variant of a ctor.
const llvm::APInt & getSize() const
void * getAsOpaquePtr() const
VarDecl - An instance of this class is created to represent a variable declaration or definition...
TLSKind getTLSKind() const
Represents an empty template argument, e.g., one that has not been deduced.
AccessSpecifier getAccess() const
CallingConv getCallConv() const
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.
The collection of all-type qualifiers we support.
unsigned getNumParams() const
int32_t VBOffsetOffset
The offset (in bytes) of the vbase offset in the vbtable.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
bool isExternC() const
Determines whether this function is a function with external, C linkage.
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.
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
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...
bool isReferenceType() const
bool isAnyPointerType() const
bool isTranslationUnit() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
TagKind getTagKind() 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. ...
uint32_t getCodeUnit(size_t i) const
An rvalue reference type, per C++11 [dcl.ref].
unsigned getLambdaManglingNumber() const
If this is the closure type of a lambda expression, retrieve the number to be used for name mangling ...
An lvalue ref-qualifier was provided (&).
const LangOptions & getLangOpts() const
unsigned getLength() const
CharUnits - This is an opaque type for sizes expressed in character units.
QualType getBaseType() const
Gets the base type of this object type.
QualType getReturnType() const
const CXXRecordDecl * getParent() const
Returns the parent of this method declaration, which is the class in which this method is defined...
bool isExternC() const
Determines whether this variable is a variable with external, C linkage.
Concrete class used by the front-end to report problems and issues.
Represents a typeof (or typeof) expression (a GCC extension).
Enums/classes describing ABI related information about constructors, destructors and thunks...
TypeClass getTypeClass() const
bool isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
detail::InMemoryDirectory::const_iterator I
Represents an extended vector type where either the type or size is dependent.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
CXXRecordDecl * getMostRecentDecl()
QualType getParamType(unsigned i) const
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.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
bool hasUnaligned() const
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.
CXXDtorType
C++ destructor types.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
QualType getPointeeType() const
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
StringRef getName() const
Return the actual identifier string.
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 ParmVarDecl * getParamDecl(unsigned i) const
ArgKind getKind() const
Return the kind of stored template argument.
DeclContext * getDeclContext()
Represents the type decltype(expr) (C++11).
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
bool isFunctionOrMethod() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isExternallyVisible() const
CharUnits getVBPtrOffset() const
getVBPtrOffset - Get the offset for virtual base table pointer.
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
StringRef getUuidStr() const
Represents a GCC generic vector type.
An lvalue reference type, per C++11 [dcl.ref].
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.
QualType getElementType() const
static const TemplateDecl * isTemplate(const NamedDecl *ND, const TemplateArgumentList *&TemplateArgs)
The result type of a method or function.
The COMDAT used for dtors.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
TypedefNameDecl * getTypedefNameForAnonDecl() const
GlobalDecl - represents a global declaration.
const clang::PrintingPolicy & getPrintingPolicy() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
SourceRange getBracketsRange() const
Encodes a location in the source.
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
QualType getElementType() const
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
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 withConst() const
Represents a static or instance method of a struct/union/class.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
No ref-qualifier was provided.
This file defines OpenMP nodes for declarative directives.
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...
unsigned getCharByteWidth() const
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
SourceLocation getBegin() const
const T * castAs() const
Member-template castAs<specific type>.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
An rvalue ref-qualifier was provided (&&).
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
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.
QualType getPointeeType() const
Represents a pack expansion of types.
static void mangleThunkThisAdjustment(const CXXMethodDecl *MD, const ThisAdjustment &Adjustment, MicrosoftCXXNameMangler &Mangler, raw_ostream &Out)
Expr * getSizeExpr() const
Base class for declarations which introduce a typedef-name.
Represents a template argument.
QualType getAsType() const
Retrieve the type for a type template argument.
TagTypeKind
The kind of a tag type.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
ThisAdjustment This
The this pointer adjustment.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
unsigned getByteLength() const
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...
A decomposition declaration.
DeclarationName - The name of a declaration.
detail::InMemoryDirectory::const_iterator E
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isLambda() const
Determine whether this class describes a lambda function object.
union clang::ThisAdjustment::VirtualAdjustment Virtual
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
Represents a pointer to an Objective C object.
Not an overloaded operator.
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 T * getAs() const
Member-template getAs<specific type>'.
unsigned getTypeQuals() const
QualType getCanonicalType() const
QualType getIntegralType() const
Retrieve the type of the integral value.
bool isFunctionType() const
ExtVectorType - Extended vector type.
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
ReturnAdjustment Return
The return adjustment.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
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 isStaticDataMember() const
Determines whether this is a static data member.
QualType getPointeeType() const
bool isCompatibleWithMSVC(MSVCMajorVersion MajorVersion) const
A template argument list.
static 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_].
const Type * getClass() const
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
ArrayRef< TemplateArgument > getPackAsArray() const
Return the array of arguments in this template argument pack.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
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.
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'.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
QualType getParamTypeForDecl() const
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.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType getElementType() const
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
NamedDecl - This represents a decl with a name.
StringRef getName(const PrintingPolicy &Policy) 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...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const char * getStmtClassName() const
bool nullFieldOffsetIsZero() const
In the Microsoft C++ ABI, use zero for the field offset of a null data member pointer if we can guara...
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.
const MethodVFTableLocation & getMethodVFTableLocation(GlobalDecl GD)
PrettyStackTraceDecl - If a crash occurs, indicate that it happened when doing something to a specifi...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isPointerType() const