36#include "llvm/ADT/StringExtras.h"
37#include "llvm/Support/ErrorHandling.h"
38#include "llvm/Support/raw_ostream.h"
39#include "llvm/TargetParser/RISCVTargetParser.h"
46static bool isLocalContainerContext(
const DeclContext *DC) {
47 return isa<FunctionDecl>(DC) || isa<ObjCMethodDecl>(DC) || isa<BlockDecl>(DC);
52 return ftd->getTemplatedDecl();
59 return (fn ? getStructor(fn) :
decl);
62static bool isLambda(
const NamedDecl *ND) {
70static const unsigned UnknownArity = ~0
U;
73 typedef std::pair<const DeclContext*, IdentifierInfo*> DiscriminatorKeyTy;
74 llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
75 llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
76 const DiscriminatorOverrideTy DiscriminatorOverride =
nullptr;
79 bool NeedsUniqueInternalLinkageNames =
false;
82 explicit ItaniumMangleContextImpl(
84 DiscriminatorOverrideTy DiscriminatorOverride,
bool IsAux =
false)
86 DiscriminatorOverride(DiscriminatorOverride) {}
98 NeedsUniqueInternalLinkageNames =
true;
103 raw_ostream &)
override;
105 const ThunkInfo &Thunk,
bool, raw_ostream &)
override;
107 raw_ostream &)
override;
114 bool NormalizeIntegers)
override;
116 bool NormalizeIntegers)
override;
123 raw_ostream &Out)
override;
126 raw_ostream &Out)
override;
128 raw_ostream &Out)
override;
131 raw_ostream &)
override;
139 bool getNextDiscriminator(
const NamedDecl *ND,
unsigned &disc) {
145 if (
const TagDecl *Tag = dyn_cast<TagDecl>(ND)) {
146 if (
Tag->getName().empty() && !
Tag->getTypedefNameForAnonDecl())
153 if (discriminator == 1)
155 disc = discriminator - 2;
160 unsigned &discriminator = Uniquifier[ND];
161 if (!discriminator) {
162 const DeclContext *DC = getEffectiveDeclContext(ND);
163 discriminator = ++Discriminator[std::make_pair(DC, ND->
getIdentifier())];
165 if (discriminator == 1)
167 disc = discriminator-2;
174 assert(Lambda->
isLambda() &&
"RD must be a lambda!");
175 std::string Name(
"<lambda");
179 const ParmVarDecl *Parm = dyn_cast_or_null<ParmVarDecl>(LambdaContextDecl);
184 unsigned DefaultArgNo =
186 Name += llvm::utostr(DefaultArgNo);
190 if (LambdaManglingNumber)
191 LambdaId = LambdaManglingNumber;
195 Name += llvm::utostr(LambdaId);
201 return DiscriminatorOverride;
208 return getEffectiveDeclContext(cast<Decl>(DC));
211 bool isInternalLinkageDecl(
const NamedDecl *ND);
217class CXXNameMangler {
218 ItaniumMangleContextImpl &Context;
222 bool NormalizeIntegers =
false;
224 bool NullOut =
false;
229 bool DisableDerivedAbiTags =
false;
235 unsigned StructorType = 0;
240 unsigned TemplateDepthOffset = 0;
245 class FunctionTypeDepthState {
248 enum { InResultTypeMask = 1 };
251 FunctionTypeDepthState() =
default;
254 unsigned getDepth()
const {
259 bool isInResultType()
const {
260 return Bits & InResultTypeMask;
263 FunctionTypeDepthState push() {
264 FunctionTypeDepthState tmp = *
this;
265 Bits = (Bits & ~InResultTypeMask) + 2;
269 void enterResultType() {
270 Bits |= InResultTypeMask;
273 void leaveResultType() {
274 Bits &= ~InResultTypeMask;
277 void pop(FunctionTypeDepthState saved) {
278 assert(getDepth() == saved.getDepth() + 1);
293 class AbiTagState final {
295 explicit AbiTagState(AbiTagState *&Head) : LinkHead(Head) {
301 AbiTagState(
const AbiTagState &) =
delete;
302 AbiTagState &operator=(
const AbiTagState &) =
delete;
304 ~AbiTagState() { pop(); }
306 void write(raw_ostream &Out,
const NamedDecl *ND,
307 const AbiTagList *AdditionalAbiTags) {
309 if (!isa<FunctionDecl>(ND) && !isa<VarDecl>(ND)) {
311 !AdditionalAbiTags &&
312 "only function and variables need a list of additional abi tags");
313 if (
const auto *NS = dyn_cast<NamespaceDecl>(ND)) {
314 if (
const auto *AbiTag = NS->getAttr<AbiTagAttr>()) {
315 UsedAbiTags.insert(UsedAbiTags.end(), AbiTag->tags().begin(),
316 AbiTag->tags().end());
324 if (
const auto *AbiTag = ND->
getAttr<AbiTagAttr>()) {
325 UsedAbiTags.insert(UsedAbiTags.end(), AbiTag->tags().begin(),
326 AbiTag->tags().end());
327 TagList.insert(TagList.end(), AbiTag->tags().begin(),
328 AbiTag->tags().end());
331 if (AdditionalAbiTags) {
332 UsedAbiTags.insert(UsedAbiTags.end(), AdditionalAbiTags->begin(),
333 AdditionalAbiTags->end());
334 TagList.insert(TagList.end(), AdditionalAbiTags->begin(),
335 AdditionalAbiTags->end());
339 TagList.erase(std::unique(TagList.begin(), TagList.end()), TagList.end());
341 writeSortedUniqueAbiTags(Out, TagList);
344 const AbiTagList &getUsedAbiTags()
const {
return UsedAbiTags; }
345 void setUsedAbiTags(
const AbiTagList &AbiTags) {
346 UsedAbiTags = AbiTags;
349 const AbiTagList &getEmittedAbiTags()
const {
350 return EmittedAbiTags;
353 const AbiTagList &getSortedUniqueUsedAbiTags() {
354 llvm::sort(UsedAbiTags);
355 UsedAbiTags.erase(std::unique(UsedAbiTags.begin(), UsedAbiTags.end()),
362 AbiTagList UsedAbiTags;
364 AbiTagList EmittedAbiTags;
366 AbiTagState *&LinkHead;
367 AbiTagState *
Parent =
nullptr;
370 assert(LinkHead ==
this &&
371 "abi tag link head must point to us on destruction");
374 UsedAbiTags.begin(), UsedAbiTags.end());
375 Parent->EmittedAbiTags.insert(
Parent->EmittedAbiTags.end(),
376 EmittedAbiTags.begin(),
377 EmittedAbiTags.end());
382 void writeSortedUniqueAbiTags(raw_ostream &Out,
const AbiTagList &AbiTags) {
383 for (
const auto &Tag : AbiTags) {
384 EmittedAbiTags.push_back(Tag);
392 AbiTagState *AbiTags =
nullptr;
393 AbiTagState AbiTagsRoot;
395 llvm::DenseMap<uintptr_t, unsigned> Substitutions;
396 llvm::DenseMap<StringRef, unsigned> ModuleSubstitutions;
398 ASTContext &getASTContext()
const {
return Context.getASTContext(); }
401 return Context.getASTContext().
getLangOpts().getClangABICompat() <= Ver;
410 llvm::StringRef Name,
bool HasAllocator);
413 CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out_,
414 const NamedDecl *
D =
nullptr,
bool NullOut_ =
false)
415 : Context(
C), Out(Out_), NullOut(NullOut_), Structor(getStructor(
D)),
416 AbiTagsRoot(AbiTags) {
418 assert(!
D || (!isa<CXXDestructorDecl>(
D) &&
419 !isa<CXXConstructorDecl>(
D)));
421 CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out_,
423 : Context(
C), Out(Out_), Structor(getStructor(
D)), StructorType(
Type),
424 AbiTagsRoot(AbiTags) {}
425 CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out_,
427 : Context(
C), Out(Out_), Structor(getStructor(
D)), StructorType(
Type),
428 AbiTagsRoot(AbiTags) {}
430 CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out_,
431 bool NormalizeIntegers_)
432 : Context(
C), Out(Out_), NormalizeIntegers(NormalizeIntegers_),
433 NullOut(
false), Structor(nullptr), AbiTagsRoot(AbiTags) {}
434 CXXNameMangler(CXXNameMangler &Outer, raw_ostream &Out_)
435 : Context(Outer.Context), Out(Out_), Structor(Outer.Structor),
436 StructorType(Outer.StructorType), SeqID(Outer.SeqID),
437 FunctionTypeDepth(Outer.FunctionTypeDepth), AbiTagsRoot(AbiTags),
438 Substitutions(Outer.Substitutions),
439 ModuleSubstitutions(Outer.ModuleSubstitutions) {}
441 CXXNameMangler(CXXNameMangler &Outer, llvm::raw_null_ostream &Out_)
442 : CXXNameMangler(Outer, (raw_ostream &)Out_) {
446 struct WithTemplateDepthOffset {
unsigned Offset; };
447 CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out,
448 WithTemplateDepthOffset Offset)
449 : CXXNameMangler(
C, Out) {
450 TemplateDepthOffset = Offset.Offset;
453 raw_ostream &getStream() {
return Out; }
455 void disableDerivedAbiTags() { DisableDerivedAbiTags =
true; }
456 static bool shouldHaveAbiTags(ItaniumMangleContextImpl &
C,
const VarDecl *VD);
459 void mangleCallOffset(int64_t NonVirtual, int64_t
Virtual);
460 void mangleNumber(
const llvm::APSInt &I);
461 void mangleNumber(int64_t Number);
462 void mangleFloat(
const llvm::APFloat &F);
464 void mangleSeqID(
unsigned SeqID);
467 void mangleNameOrStandardSubstitution(
const NamedDecl *ND);
469 void mangleModuleNamePrefix(StringRef Name,
bool IsPartition =
false);
470 void mangleVendorQualifier(StringRef Name);
474 bool mangleSubstitution(
const NamedDecl *ND);
482 bool mangleStandardSubstitution(
const NamedDecl *ND);
484 void addSubstitution(
const NamedDecl *ND) {
487 addSubstitution(
reinterpret_cast<uintptr_t>(ND));
492 addSubstitution(
reinterpret_cast<uintptr_t>(NNS));
498 void extendSubstitutions(CXXNameMangler*
Other);
501 bool recursive =
false);
505 unsigned NumTemplateArgs,
506 unsigned KnownArity = UnknownArity);
508 void mangleFunctionEncodingBareType(
const FunctionDecl *FD);
511 const AbiTagList *AdditionalAbiTags);
512 void mangleModuleName(
const NamedDecl *ND);
516 const AbiTagList *AdditionalAbiTags) {
517 mangleUnqualifiedName(GD, cast<NamedDecl>(GD.
getDecl())->getDeclName(), DC,
518 UnknownArity, AdditionalAbiTags);
522 const AbiTagList *AdditionalAbiTags);
524 const AbiTagList *AdditionalAbiTags);
526 const AbiTagList *AdditionalAbiTags);
530 void mangleSourceNameWithAbiTags(
531 const NamedDecl *ND,
const AbiTagList *AdditionalAbiTags =
nullptr);
533 const AbiTagList *AdditionalAbiTags);
538 void mangleTypeConstraint(
const ConceptDecl *Concept,
541 void mangleRequiresClause(
const Expr *RequiresClause);
544 const AbiTagList *AdditionalAbiTags,
545 bool NoFunction=
false);
548 void mangleNestedNameWithClosurePrefix(
GlobalDecl GD,
550 const AbiTagList *AdditionalAbiTags);
552 void manglePrefix(
const DeclContext *DC,
bool NoFunction=
false);
554 void mangleTemplatePrefix(
GlobalDecl GD,
bool NoFunction=
false);
557 void mangleClosurePrefix(
const NamedDecl *ND,
bool NoFunction =
false);
558 bool mangleUnresolvedTypeOrSimpleId(
QualType DestroyedType,
559 StringRef Prefix =
"");
568#define ABSTRACT_TYPE(CLASS, PARENT)
569#define NON_CANONICAL_TYPE(CLASS, PARENT)
570#define TYPE(CLASS, PARENT) void mangleType(const CLASS##Type *T);
571#include "clang/AST/TypeNodes.inc"
573 void mangleType(
const TagType*);
575 static StringRef getCallingConvQualifierName(
CallingConv CC);
582 void mangleAArch64NeonVectorType(
const VectorType *
T);
584 void mangleAArch64FixedSveVectorType(
const VectorType *
T);
586 void mangleRISCVFixedRVVVectorType(
const VectorType *
T);
590 void mangleFloatLiteral(
QualType T,
const llvm::APFloat &
V);
591 void mangleFixedPointLiteral();
594 void mangleMemberExprBase(
const Expr *base,
bool isArrow);
595 void mangleMemberExpr(
const Expr *base,
bool isArrow,
600 unsigned NumTemplateArgs,
601 unsigned knownArity);
602 void mangleCastExpression(
const Expr *
E, StringRef CastEncoding);
603 void mangleInitListElements(
const InitListExpr *InitList);
606 void mangleExpression(
const Expr *
E,
unsigned Arity = UnknownArity,
607 bool AsTemplateArg =
false);
611 struct TemplateArgManglingInfo;
614 unsigned NumTemplateArgs);
617 void mangleTemplateArg(TemplateArgManglingInfo &Info,
unsigned Index,
620 void mangleTemplateArgExpr(
const Expr *
E);
622 bool NeedExactType =
false);
624 void mangleTemplateParameter(
unsigned Depth,
unsigned Index);
629 const AbiTagList *AdditionalAbiTags);
632 AbiTagList makeFunctionReturnTypeTags(
const FunctionDecl *FD);
634 AbiTagList makeVariableTypeTags(
const VarDecl *VD);
642 getASTContext(), getASTContext().getTranslationUnitDecl(),
644 &getASTContext().Idents.get(
"std"),
654ItaniumMangleContextImpl::getEffectiveDeclContext(
const Decl *
D) {
664 dyn_cast_or_null<ParmVarDecl>(RD->getLambdaContextDecl()))
665 return ContextParam->getDeclContext();
669 if (
const BlockDecl *BD = dyn_cast<BlockDecl>(
D)) {
671 dyn_cast_or_null<ParmVarDecl>(BD->getBlockManglingContextDecl()))
672 return ContextParam->getDeclContext();
680 if (
D == getASTContext().getVaListTagDecl()) {
681 const llvm::Triple &
T = getASTContext().getTargetInfo().getTriple();
682 if (
T.isARM() ||
T.isThumb() ||
T.isAArch64())
683 return getStdNamespace();
687 if (isa<CapturedDecl>(DC) || isa<OMPDeclareReductionDecl>(DC) ||
688 isa<OMPDeclareMapperDecl>(DC)) {
689 return getEffectiveDeclContext(cast<Decl>(DC));
692 if (
const auto *VD = dyn_cast<VarDecl>(
D))
694 return getASTContext().getTranslationUnitDecl();
696 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
698 return getASTContext().getTranslationUnitDecl();
701 if (FD->isMemberLikeConstrainedFriend() &&
702 getASTContext().getLangOpts().getClangABICompat() >
703 LangOptions::ClangABI::Ver17)
710bool ItaniumMangleContextImpl::isInternalLinkageDecl(
const NamedDecl *ND) {
713 getEffectiveDeclContext(ND)->isFileContext() &&
720bool ItaniumMangleContextImpl::isUniqueInternalLinkageDecl(
722 if (!NeedsUniqueInternalLinkageNames || !ND)
725 const auto *FD = dyn_cast<FunctionDecl>(ND);
734 if (isInternalLinkageDecl(ND))
740bool ItaniumMangleContextImpl::shouldMangleCXXName(
const NamedDecl *
D) {
741 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
744 if (FD->hasAttr<OverloadableAttr>())
760 if (FD->isMSVCRTEntryPoint())
774 if (!getASTContext().getLangOpts().
CPlusPlus)
777 if (
const auto *VD = dyn_cast<VarDecl>(
D)) {
779 if (isa<DecompositionDecl>(VD))
792 DC = getEffectiveParentContext(DC);
794 !CXXNameMangler::shouldHaveAbiTags(*
this, VD) &&
795 !isa<VarTemplateSpecializationDecl>(VD) &&
803void CXXNameMangler::writeAbiTags(
const NamedDecl *ND,
804 const AbiTagList *AdditionalAbiTags) {
805 assert(AbiTags &&
"require AbiTagState");
806 AbiTags->write(Out, ND, DisableDerivedAbiTags ?
nullptr : AdditionalAbiTags);
809void CXXNameMangler::mangleSourceNameWithAbiTags(
810 const NamedDecl *ND,
const AbiTagList *AdditionalAbiTags) {
812 writeAbiTags(ND, AdditionalAbiTags);
820 if (isa<FunctionDecl>(GD.
getDecl()))
821 mangleFunctionEncoding(GD);
826 dyn_cast<IndirectFieldDecl>(GD.
getDecl()))
827 mangleName(IFD->getAnonField());
829 llvm_unreachable(
"unexpected kind of global decl");
832void CXXNameMangler::mangleFunctionEncoding(
GlobalDecl GD) {
837 if (!Context.shouldMangleDeclName(FD)) {
842 AbiTagList ReturnTypeAbiTags = makeFunctionReturnTypeTags(FD);
843 if (ReturnTypeAbiTags.empty()) {
852 FunctionTypeDepthState Saved = FunctionTypeDepth.push();
854 FunctionTypeDepth.pop(Saved);
855 mangleFunctionEncodingBareType(FD);
863 llvm::raw_svector_ostream FunctionEncodingStream(FunctionEncodingBuf);
864 CXXNameMangler FunctionEncodingMangler(*
this, FunctionEncodingStream);
866 FunctionEncodingMangler.disableDerivedAbiTags();
868 FunctionTypeDepthState Saved = FunctionTypeDepth.push();
869 FunctionEncodingMangler.mangleNameWithAbiTags(FD,
nullptr);
870 FunctionTypeDepth.pop(Saved);
873 size_t EncodingPositionStart = FunctionEncodingStream.str().size();
874 FunctionEncodingMangler.mangleFunctionEncodingBareType(FD);
878 const AbiTagList &UsedAbiTags =
879 FunctionEncodingMangler.AbiTagsRoot.getSortedUniqueUsedAbiTags();
880 AbiTagList AdditionalAbiTags(ReturnTypeAbiTags.size());
881 AdditionalAbiTags.erase(
882 std::set_difference(ReturnTypeAbiTags.begin(), ReturnTypeAbiTags.end(),
883 UsedAbiTags.begin(), UsedAbiTags.end(),
884 AdditionalAbiTags.begin()),
885 AdditionalAbiTags.end());
888 Saved = FunctionTypeDepth.push();
889 mangleNameWithAbiTags(FD, &AdditionalAbiTags);
890 FunctionTypeDepth.pop(Saved);
891 Out << FunctionEncodingStream.str().substr(EncodingPositionStart);
895 extendSubstitutions(&FunctionEncodingMangler);
898void CXXNameMangler::mangleFunctionEncodingBareType(
const FunctionDecl *FD) {
899 if (FD->
hasAttr<EnableIfAttr>()) {
900 FunctionTypeDepthState Saved = FunctionTypeDepth.push();
901 Out <<
"Ua9enable_ifI";
902 for (AttrVec::const_iterator I = FD->
getAttrs().begin(),
905 EnableIfAttr *EIA = dyn_cast<EnableIfAttr>(*I);
908 if (isCompatibleWith(LangOptions::ClangABI::Ver11)) {
913 mangleExpression(EIA->getCond());
916 mangleTemplateArgExpr(EIA->getCond());
920 FunctionTypeDepth.pop(Saved);
925 if (
auto *CD = dyn_cast<CXXConstructorDecl>(FD))
926 if (
auto Inherited = CD->getInheritedConstructor())
927 FD = Inherited.getConstructor();
945 bool MangleReturnType =
false;
947 if (!(isa<CXXConstructorDecl>(FD) || isa<CXXDestructorDecl>(FD) ||
948 isa<CXXConversionDecl>(FD)))
949 MangleReturnType =
true;
952 FD = PrimaryTemplate->getTemplatedDecl();
956 MangleReturnType, FD);
961 if (!Context.getEffectiveParentContext(NS)->isTranslationUnit())
965 return II && II->
isStr(
"std");
970bool CXXNameMangler::isStdNamespace(
const DeclContext *DC) {
974 return isStd(cast<NamespaceDecl>(DC));
981 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
990 dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
991 TemplateArgs = &Spec->getTemplateArgs();
992 return GD.
getWithDecl(Spec->getSpecializedTemplate());
997 dyn_cast<VarTemplateSpecializationDecl>(ND)) {
998 TemplateArgs = &Spec->getTemplateArgs();
999 return GD.
getWithDecl(Spec->getSpecializedTemplate());
1010void CXXNameMangler::mangleName(
GlobalDecl GD) {
1012 if (
const VarDecl *VD = dyn_cast<VarDecl>(ND)) {
1014 AbiTagList VariableTypeAbiTags = makeVariableTypeTags(VD);
1015 if (VariableTypeAbiTags.empty()) {
1017 mangleNameWithAbiTags(VD,
nullptr);
1022 llvm::raw_null_ostream NullOutStream;
1023 CXXNameMangler VariableNameMangler(*
this, NullOutStream);
1024 VariableNameMangler.disableDerivedAbiTags();
1025 VariableNameMangler.mangleNameWithAbiTags(VD,
nullptr);
1028 const AbiTagList &UsedAbiTags =
1029 VariableNameMangler.AbiTagsRoot.getSortedUniqueUsedAbiTags();
1030 AbiTagList AdditionalAbiTags(VariableTypeAbiTags.size());
1031 AdditionalAbiTags.erase(
1032 std::set_difference(VariableTypeAbiTags.begin(),
1033 VariableTypeAbiTags.end(), UsedAbiTags.begin(),
1034 UsedAbiTags.end(), AdditionalAbiTags.begin()),
1035 AdditionalAbiTags.end());
1038 mangleNameWithAbiTags(VD, &AdditionalAbiTags);
1040 mangleNameWithAbiTags(GD,
nullptr);
1045 const DeclContext *DC = Context.getEffectiveDeclContext(
D);
1047 if (isLocalContainerContext(DC))
1048 return dyn_cast<RecordDecl>(
D);
1050 DC = Context.getEffectiveDeclContext(
D);
1055void CXXNameMangler::mangleNameWithAbiTags(
GlobalDecl GD,
1056 const AbiTagList *AdditionalAbiTags) {
1063 const DeclContext *DC = Context.getEffectiveDeclContext(ND);
1064 bool IsLambda = isLambda(ND);
1070 if (isLocalContainerContext(DC) && ND->
hasLinkage() && !IsLambda)
1072 DC = Context.getEffectiveParentContext(DC);
1073 else if (GetLocalClassDecl(ND) &&
1074 (!IsLambda || isCompatibleWith(LangOptions::ClangABI::Ver18))) {
1075 mangleLocalName(GD, AdditionalAbiTags);
1079 assert(!isa<LinkageSpecDecl>(DC) &&
"context cannot be LinkageSpecDecl");
1083 if (
const NamedDecl *PrefixND = getClosurePrefix(ND)) {
1084 mangleNestedNameWithClosurePrefix(GD, PrefixND, AdditionalAbiTags);
1088 if (isLocalContainerContext(DC)) {
1089 mangleLocalName(GD, AdditionalAbiTags);
1097 mangleUnscopedTemplateName(TD, DC, AdditionalAbiTags);
1102 mangleUnscopedName(GD, DC, AdditionalAbiTags);
1106 mangleNestedName(GD, DC, AdditionalAbiTags);
1109void CXXNameMangler::mangleModuleName(
const NamedDecl *ND) {
1112 mangleModuleNamePrefix(M->getPrimaryModuleInterfaceName());
1120void CXXNameMangler::mangleModuleNamePrefix(StringRef Name,
bool IsPartition) {
1122 auto It = ModuleSubstitutions.find(Name);
1123 if (It != ModuleSubstitutions.end()) {
1125 mangleSeqID(It->second);
1131 auto Parts = Name.rsplit(
'.');
1132 if (Parts.second.empty())
1133 Parts.second = Parts.first;
1135 mangleModuleNamePrefix(Parts.first, IsPartition);
1136 IsPartition =
false;
1142 Out << Parts.second.size() << Parts.second;
1143 ModuleSubstitutions.insert({Name, SeqID++});
1146void CXXNameMangler::mangleTemplateName(
const TemplateDecl *TD,
1148 const DeclContext *DC = Context.getEffectiveDeclContext(TD);
1151 mangleUnscopedTemplateName(TD, DC,
nullptr);
1154 mangleNestedName(TD, Args);
1159 const AbiTagList *AdditionalAbiTags) {
1163 assert(!isa<LinkageSpecDecl>(DC) &&
"unskipped LinkageSpecDecl");
1164 if (isStdNamespace(DC))
1167 mangleUnqualifiedName(GD, DC, AdditionalAbiTags);
1170void CXXNameMangler::mangleUnscopedTemplateName(
1175 if (mangleSubstitution(ND))
1179 if (
const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(ND)) {
1180 assert(!AdditionalAbiTags &&
1181 "template template param cannot have abi tags");
1182 mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
1183 }
else if (isa<BuiltinTemplateDecl>(ND) || isa<ConceptDecl>(ND)) {
1184 mangleUnscopedName(GD, DC, AdditionalAbiTags);
1190 addSubstitution(ND);
1193void CXXNameMangler::mangleFloat(
const llvm::APFloat &f) {
1207 llvm::APInt valueBits = f.bitcastToAPInt();
1208 unsigned numCharacters = (valueBits.getBitWidth() + 3) / 4;
1209 assert(numCharacters != 0);
1215 for (
unsigned stringIndex = 0; stringIndex != numCharacters; ++stringIndex) {
1217 unsigned digitBitIndex = 4 * (numCharacters - stringIndex - 1);
1220 uint64_t hexDigit = valueBits.getRawData()[digitBitIndex / 64];
1221 hexDigit >>= (digitBitIndex % 64);
1225 static const char charForHex[16] = {
1226 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
1227 '8',
'9',
'a',
'b',
'c',
'd',
'e',
'f'
1229 buffer[stringIndex] = charForHex[hexDigit];
1232 Out.write(buffer.data(), numCharacters);
1235void CXXNameMangler::mangleFloatLiteral(
QualType T,
const llvm::APFloat &
V) {
1242void CXXNameMangler::mangleFixedPointLiteral() {
1249void CXXNameMangler::mangleNullPointer(
QualType T) {
1256void CXXNameMangler::mangleNumber(
const llvm::APSInt &
Value) {
1257 if (
Value.isSigned() &&
Value.isNegative()) {
1265void CXXNameMangler::mangleNumber(int64_t Number) {
1275void CXXNameMangler::mangleCallOffset(int64_t NonVirtual, int64_t
Virtual) {
1283 mangleNumber(NonVirtual);
1289 mangleNumber(NonVirtual);
1297 if (!mangleSubstitution(
QualType(TST, 0))) {
1298 mangleTemplatePrefix(TST->getTemplateName());
1303 mangleTemplateArgs(TST->getTemplateName(), TST->template_arguments());
1306 }
else if (
const auto *DTST =
1308 if (!mangleSubstitution(
QualType(DTST, 0))) {
1309 TemplateName Template = getASTContext().getDependentTemplateName(
1310 DTST->getQualifier(), DTST->getIdentifier());
1311 mangleTemplatePrefix(Template);
1316 mangleTemplateArgs(Template, DTST->template_arguments());
1317 addSubstitution(
QualType(DTST, 0));
1347 switch (qualifier->
getKind()) {
1359 llvm_unreachable(
"Can't mangle __super specifier");
1363 mangleUnresolvedPrefix(qualifier->
getPrefix(),
1371 mangleUnresolvedPrefix(qualifier->
getPrefix(),
1388 mangleUnresolvedPrefix(qualifier->
getPrefix(),
1395 if (mangleUnresolvedTypeOrSimpleId(
QualType(
type, 0), recursive ?
"N" :
""))
1404 mangleUnresolvedPrefix(qualifier->
getPrefix(),
1422void CXXNameMangler::mangleUnresolvedName(
1425 unsigned knownArity) {
1426 if (qualifier) mangleUnresolvedPrefix(qualifier);
1427 switch (
name.getNameKind()) {
1430 mangleSourceName(
name.getAsIdentifierInfo());
1435 mangleUnresolvedTypeOrSimpleId(
name.getCXXNameType());
1442 mangleOperatorName(name, knownArity);
1445 llvm_unreachable(
"Can't mangle a constructor name!");
1447 llvm_unreachable(
"Can't mangle a using directive name!");
1449 llvm_unreachable(
"Can't mangle a deduction guide name!");
1453 llvm_unreachable(
"Can't mangle Objective-C selector names here!");
1459 mangleTemplateArgs(
TemplateName(), TemplateArgs, NumTemplateArgs);
1462void CXXNameMangler::mangleUnqualifiedName(
1464 unsigned KnownArity,
const AbiTagList *AdditionalAbiTags) {
1472 mangleModuleName(ND);
1476 auto *FD = dyn_cast<FunctionDecl>(ND);
1477 auto *FTD = dyn_cast<FunctionTemplateDecl>(ND);
1479 (FTD && FTD->getTemplatedDecl()->isMemberLikeConstrainedFriend())) {
1480 if (!isCompatibleWith(LangOptions::ClangABI::Ver17))
1484 unsigned Arity = KnownArity;
1485 switch (Name.getNameKind()) {
1490 if (
auto *DD = dyn_cast<DecompositionDecl>(ND)) {
1497 for (
auto *BD : DD->bindings())
1498 mangleSourceName(BD->getDeclName().getAsIdentifierInfo());
1500 writeAbiTags(ND, AdditionalAbiTags);
1504 if (
auto *GD = dyn_cast<MSGuidDecl>(ND)) {
1507 SmallString<
sizeof(
"_GUID_12345678_1234_1234_1234_1234567890ab")> GUID;
1508 llvm::raw_svector_ostream GUIDOS(GUID);
1509 Context.mangleMSGuidDecl(GD, GUIDOS);
1510 Out << GUID.size() << GUID;
1514 if (
auto *TPO = dyn_cast<TemplateParamObjectDecl>(ND)) {
1517 mangleValueInTemplateArg(TPO->getType().getUnqualifiedType(),
1518 TPO->getValue(),
true);
1536 if (Context.isInternalLinkageDecl(ND))
1539 bool IsRegCall = FD &&
1543 FD && FD->
hasAttr<CUDAGlobalAttr>() &&
1546 mangleDeviceStubName(II);
1548 mangleRegCallName(II);
1550 mangleSourceName(II);
1552 writeAbiTags(ND, AdditionalAbiTags);
1557 assert(ND &&
"mangling empty name without declaration");
1559 if (
const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(ND)) {
1562 Out <<
"12_GLOBAL__N_1";
1567 if (
const VarDecl *VD = dyn_cast<VarDecl>(ND)) {
1581 &&
"Expected anonymous struct or union!");
1588 assert(FD->
getIdentifier() &&
"Data member name isn't an identifier!");
1601 if (isa<ObjCContainerDecl>(ND))
1605 const TagDecl *TD = cast<TagDecl>(ND);
1608 "Typedef should not be in another decl context!");
1609 assert(
D->getDeclName().getAsIdentifierInfo() &&
1610 "Typedef was not named!");
1611 mangleSourceName(
D->getDeclName().getAsIdentifierInfo());
1612 assert(!AdditionalAbiTags &&
"Type cannot have additional abi tags");
1615 writeAbiTags(TD,
nullptr);
1625 std::optional<unsigned> DeviceNumber =
1626 Context.getDiscriminatorOverride()(Context.getASTContext(),
Record);
1632 if (
Record->isLambda() &&
1633 ((DeviceNumber && *DeviceNumber > 0) ||
1634 (!DeviceNumber &&
Record->getLambdaManglingNumber() > 0))) {
1635 assert(!AdditionalAbiTags &&
1636 "Lambda type cannot have additional abi tags");
1643 unsigned UnnamedMangle =
1644 getASTContext().getManglingNumber(TD, Context.isAux());
1646 if (UnnamedMangle > 1)
1647 Out << UnnamedMangle - 2;
1649 writeAbiTags(TD, AdditionalAbiTags);
1655 unsigned AnonStructId =
1657 : Context.getAnonymousStructId(TD, dyn_cast<FunctionDecl>(DC));
1664 Str += llvm::utostr(AnonStructId);
1674 llvm_unreachable(
"Can't mangle Objective-C selector names here!");
1680 if (
auto Inherited =
1681 cast<CXXConstructorDecl>(ND)->getInheritedConstructor()) {
1682 InheritedFrom = Inherited.getConstructor()->
getParent();
1683 InheritedTemplateName =
1684 TemplateName(Inherited.getConstructor()->getPrimaryTemplate());
1685 InheritedTemplateArgs =
1686 Inherited.getConstructor()->getTemplateSpecializationArgs();
1692 mangleCXXCtorType(
static_cast<CXXCtorType>(StructorType), InheritedFrom);
1700 if (InheritedTemplateArgs)
1701 mangleTemplateArgs(InheritedTemplateName, *InheritedTemplateArgs);
1703 writeAbiTags(ND, AdditionalAbiTags);
1711 mangleCXXDtorType(
static_cast<CXXDtorType>(StructorType));
1717 writeAbiTags(ND, AdditionalAbiTags);
1721 if (ND && Arity == UnknownArity) {
1722 Arity = cast<FunctionDecl>(ND)->getNumParams();
1725 if (
const auto *MD = dyn_cast<CXXMethodDecl>(ND))
1726 if (MD->isImplicitObjectMemberFunction())
1732 mangleOperatorName(Name, Arity);
1733 writeAbiTags(ND, AdditionalAbiTags);
1737 llvm_unreachable(
"Can't mangle a deduction guide name!");
1740 llvm_unreachable(
"Can't mangle a using directive name!");
1744void CXXNameMangler::mangleRegCallName(
const IdentifierInfo *II) {
1748 if (getASTContext().getLangOpts().RegCall4)
1749 Out << II->
getLength() +
sizeof(
"__regcall4__") - 1 <<
"__regcall4__"
1752 Out << II->
getLength() +
sizeof(
"__regcall3__") - 1 <<
"__regcall3__"
1756void CXXNameMangler::mangleDeviceStubName(
const IdentifierInfo *II) {
1760 Out << II->
getLength() +
sizeof(
"__device_stub__") - 1 <<
"__device_stub__"
1771void CXXNameMangler::mangleNestedName(
GlobalDecl GD,
1773 const AbiTagList *AdditionalAbiTags,
1782 if (
const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(ND)) {
1783 Qualifiers MethodQuals = Method->getMethodQualifiers();
1786 if (Method->isExplicitObjectMemberFunction())
1789 mangleQualifiers(MethodQuals);
1790 mangleRefQualifier(Method->getRefQualifier());
1796 mangleTemplatePrefix(TD, NoFunction);
1799 manglePrefix(DC, NoFunction);
1800 mangleUnqualifiedName(GD, DC, AdditionalAbiTags);
1805void CXXNameMangler::mangleNestedName(
const TemplateDecl *TD,
1811 mangleTemplatePrefix(TD);
1817void CXXNameMangler::mangleNestedNameWithClosurePrefix(
1819 const AbiTagList *AdditionalAbiTags) {
1828 mangleClosurePrefix(PrefixND);
1829 mangleUnqualifiedName(GD,
nullptr, AdditionalAbiTags);
1840 if (
auto *CD = dyn_cast<CXXConstructorDecl>(DC))
1842 else if (
auto *DD = dyn_cast<CXXDestructorDecl>(DC))
1849void CXXNameMangler::mangleLocalName(
GlobalDecl GD,
1850 const AbiTagList *AdditionalAbiTags) {
1857 assert(isa<NamedDecl>(
D) || isa<BlockDecl>(
D));
1859 const DeclContext *DC = Context.getEffectiveDeclContext(RD ? RD :
D);
1864 AbiTagState LocalAbiTags(AbiTags);
1867 mangleObjCMethodName(MD);
1868 else if (
const BlockDecl *BD = dyn_cast<BlockDecl>(DC))
1869 mangleBlockForPrefix(BD);
1875 LocalAbiTags.setUsedAbiTags(LocalAbiTags.getEmittedAbiTags());
1898 mangleNumber(Num - 2);
1907 mangleUnqualifiedName(RD, DC, AdditionalAbiTags);
1908 }
else if (
const BlockDecl *BD = dyn_cast<BlockDecl>(
D)) {
1909 if (
const NamedDecl *PrefixND = getClosurePrefix(BD))
1910 mangleClosurePrefix(PrefixND,
true );
1912 manglePrefix(Context.getEffectiveDeclContext(BD),
true );
1913 assert(!AdditionalAbiTags &&
"Block cannot have additional abi tags");
1914 mangleUnqualifiedBlock(BD);
1917 mangleNestedName(GD, Context.getEffectiveDeclContext(ND),
1918 AdditionalAbiTags,
true );
1920 }
else if (
const BlockDecl *BD = dyn_cast<BlockDecl>(
D)) {
1924 = dyn_cast_or_null<ParmVarDecl>(BD->getBlockManglingContextDecl())) {
1930 mangleNumber(Num - 2);
1935 assert(!AdditionalAbiTags &&
"Block cannot have additional abi tags");
1936 mangleUnqualifiedBlock(BD);
1938 mangleUnqualifiedName(GD, DC, AdditionalAbiTags);
1941 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(RD ? RD :
D)) {
1943 if (Context.getNextDiscriminator(ND, disc)) {
1947 Out <<
"__" << disc <<
'_';
1952void CXXNameMangler::mangleBlockForPrefix(
const BlockDecl *
Block) {
1953 if (GetLocalClassDecl(
Block)) {
1954 mangleLocalName(
Block,
nullptr);
1958 if (isLocalContainerContext(DC)) {
1959 mangleLocalName(
Block,
nullptr);
1963 mangleClosurePrefix(PrefixND);
1966 mangleUnqualifiedBlock(
Block);
1969void CXXNameMangler::mangleUnqualifiedBlock(
const BlockDecl *
Block) {
1972 if (
Decl *Context =
Block->getBlockManglingContextDecl()) {
1973 if (isCompatibleWith(LangOptions::ClangABI::Ver12) &&
1974 (isa<VarDecl>(Context) || isa<FieldDecl>(Context)) &&
1975 Context->getDeclContext()->isRecord()) {
1976 const auto *ND = cast<NamedDecl>(Context);
1978 mangleSourceNameWithAbiTags(ND);
1985 unsigned Number =
Block->getBlockManglingNumber();
1989 Number = Context.getBlockId(
Block,
false);
2007void CXXNameMangler::mangleTemplateParamDecl(
const NamedDecl *
Decl) {
2009 if (
auto *Ty = dyn_cast<TemplateTypeParmDecl>(
Decl)) {
2010 if (Ty->isParameterPack())
2013 if (Constraint && !isCompatibleWith(LangOptions::ClangABI::Ver17)) {
2016 mangleTypeConstraint(Constraint);
2020 }
else if (
auto *Tn = dyn_cast<NonTypeTemplateParmDecl>(
Decl)) {
2021 if (Tn->isExpandedParameterPack()) {
2022 for (
unsigned I = 0, N = Tn->getNumExpansionTypes(); I != N; ++I) {
2024 mangleType(Tn->getExpansionType(I));
2028 if (Tn->isParameterPack()) {
2031 T = PackExpansion->getPattern();
2036 }
else if (
auto *Tt = dyn_cast<TemplateTemplateParmDecl>(
Decl)) {
2037 if (Tt->isExpandedParameterPack()) {
2038 for (
unsigned I = 0, N = Tt->getNumExpansionTemplateParameters(); I != N;
2040 mangleTemplateParameterList(Tt->getExpansionTemplateParameters(I));
2042 if (Tt->isParameterPack())
2044 mangleTemplateParameterList(Tt->getTemplateParameters());
2049void CXXNameMangler::mangleTemplateParameterList(
2052 for (
auto *Param : *Params)
2053 mangleTemplateParamDecl(Param);
2054 mangleRequiresClause(Params->getRequiresClause());
2058void CXXNameMangler::mangleTypeConstraint(
2060 const DeclContext *DC = Context.getEffectiveDeclContext(Concept);
2062 mangleTemplateName(Concept, Arguments);
2064 mangleUnscopedName(Concept, DC,
nullptr);
2066 mangleNestedName(Concept, DC,
nullptr);
2069void CXXNameMangler::mangleTypeConstraint(
const TypeConstraint *Constraint) {
2074 Args.push_back(ArgLoc.getArgument());
2079void CXXNameMangler::mangleRequiresClause(
const Expr *RequiresClause) {
2081 if (RequiresClause && !isCompatibleWith(LangOptions::ClangABI::Ver17)) {
2083 mangleExpression(RequiresClause);
2087void CXXNameMangler::mangleLambda(
const CXXRecordDecl *Lambda) {
2091 if (isCompatibleWith(LangOptions::ClangABI::Ver12) &&
2092 (isa<VarDecl>(Context) || isa<FieldDecl>(Context)) &&
2093 !isa<ParmVarDecl>(Context)) {
2096 mangleSourceName(Name);
2106 mangleLambdaSig(Lambda);
2120 std::optional<unsigned> DeviceNumber =
2121 Context.getDiscriminatorOverride()(Context.getASTContext(), Lambda);
2125 assert(Number > 0 &&
"Lambda should be mangled as an unnamed class");
2127 mangleNumber(Number - 2);
2131void CXXNameMangler::mangleLambdaSig(
const CXXRecordDecl *Lambda) {
2134 mangleTemplateParamDecl(
D);
2138 mangleRequiresClause(TPL->getRequiresClause());
2142 mangleBareFunctionType(Proto,
false,
2147 switch (qualifier->
getKind()) {
2153 llvm_unreachable(
"Can't mangle __super specifier");
2170 bool Clang14Compat = isCompatibleWith(LangOptions::ClangABI::Ver14);
2171 if (!Clang14Compat && mangleSubstitution(qualifier))
2182 addSubstitution(qualifier);
2186 llvm_unreachable(
"unexpected nested name specifier");
2189void CXXNameMangler::manglePrefix(
const DeclContext *DC,
bool NoFunction) {
2197 assert(!isa<LinkageSpecDecl>(DC) &&
"prefix cannot be LinkageSpecDecl");
2202 if (NoFunction && isLocalContainerContext(DC))
2205 const NamedDecl *ND = cast<NamedDecl>(DC);
2206 if (mangleSubstitution(ND))
2212 mangleTemplatePrefix(TD);
2214 }
else if (
const NamedDecl *PrefixND = getClosurePrefix(ND)) {
2215 mangleClosurePrefix(PrefixND, NoFunction);
2216 mangleUnqualifiedName(ND,
nullptr,
nullptr);
2218 const DeclContext *DC = Context.getEffectiveDeclContext(ND);
2219 manglePrefix(DC, NoFunction);
2220 mangleUnqualifiedName(ND, DC,
nullptr);
2223 addSubstitution(ND);
2226void CXXNameMangler::mangleTemplatePrefix(
TemplateName Template) {
2231 return mangleTemplatePrefix(TD);
2234 assert(
Dependent &&
"unexpected template name kind");
2238 bool Clang11Compat = isCompatibleWith(LangOptions::ClangABI::Ver11);
2239 if (!Clang11Compat && mangleSubstitution(Template))
2243 manglePrefix(Qualifier);
2245 if (Clang11Compat && mangleSubstitution(Template))
2249 mangleSourceName(
Id);
2251 mangleOperatorName(
Dependent->getOperator(), UnknownArity);
2253 addSubstitution(Template);
2256void CXXNameMangler::mangleTemplatePrefix(
GlobalDecl GD,
2265 if (mangleSubstitution(ND))
2269 if (
const auto *TTP = dyn_cast<TemplateTemplateParmDecl>(ND)) {
2270 mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
2272 const DeclContext *DC = Context.getEffectiveDeclContext(ND);
2273 manglePrefix(DC, NoFunction);
2274 if (isa<BuiltinTemplateDecl>(ND) || isa<ConceptDecl>(ND))
2275 mangleUnqualifiedName(GD, DC,
nullptr);
2281 addSubstitution(ND);
2284const NamedDecl *CXXNameMangler::getClosurePrefix(
const Decl *ND) {
2285 if (isCompatibleWith(LangOptions::ClangABI::Ver12))
2289 if (
auto *
Block = dyn_cast<BlockDecl>(ND)) {
2290 Context = dyn_cast_or_null<NamedDecl>(
Block->getBlockManglingContextDecl());
2291 }
else if (
auto *RD = dyn_cast<CXXRecordDecl>(ND)) {
2293 Context = dyn_cast_or_null<NamedDecl>(RD->getLambdaContextDecl());
2300 if ((isa<VarDecl>(Context) && cast<VarDecl>(Context)->hasGlobalStorage()) ||
2301 isa<FieldDecl>(Context))
2307void CXXNameMangler::mangleClosurePrefix(
const NamedDecl *ND,
bool NoFunction) {
2310 if (mangleSubstitution(ND))
2315 mangleTemplatePrefix(TD, NoFunction);
2318 const auto *DC = Context.getEffectiveDeclContext(ND);
2319 manglePrefix(DC, NoFunction);
2320 mangleUnqualifiedName(ND, DC,
nullptr);
2325 addSubstitution(ND);
2334 if (mangleSubstitution(TN))
2347 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(TD))
2348 mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
2355 llvm_unreachable(
"can't mangle an overloaded template name as a <type>");
2363 mangleUnresolvedPrefix(
Dependent->getQualifier());
2364 mangleSourceName(
Dependent->getIdentifier());
2384 Out <<
"_SUBSTPACK_";
2389 addSubstitution(TN);
2392bool CXXNameMangler::mangleUnresolvedTypeOrSimpleId(
QualType Ty,
2398 case Type::Adjusted:
2400 case Type::ArrayParameter:
2402 case Type::BlockPointer:
2403 case Type::LValueReference:
2404 case Type::RValueReference:
2405 case Type::MemberPointer:
2406 case Type::ConstantArray:
2407 case Type::IncompleteArray:
2408 case Type::VariableArray:
2409 case Type::DependentSizedArray:
2410 case Type::DependentAddressSpace:
2411 case Type::DependentVector:
2412 case Type::DependentSizedExtVector:
2414 case Type::ExtVector:
2415 case Type::ConstantMatrix:
2416 case Type::DependentSizedMatrix:
2417 case Type::FunctionProto:
2418 case Type::FunctionNoProto:
2420 case Type::Attributed:
2421 case Type::BTFTagAttributed:
2423 case Type::DeducedTemplateSpecialization:
2424 case Type::PackExpansion:
2425 case Type::ObjCObject:
2426 case Type::ObjCInterface:
2427 case Type::ObjCObjectPointer:
2428 case Type::ObjCTypeParam:
2431 case Type::MacroQualified:
2433 case Type::DependentBitInt:
2434 case Type::CountAttributed:
2435 llvm_unreachable(
"type is illegal as a nested name specifier");
2437 case Type::SubstTemplateTypeParmPack:
2442 Out <<
"_SUBSTPACK_";
2449 case Type::TypeOfExpr:
2451 case Type::Decltype:
2452 case Type::PackIndexing:
2453 case Type::TemplateTypeParm:
2454 case Type::UnaryTransform:
2455 case Type::SubstTemplateTypeParm:
2469 mangleSourceNameWithAbiTags(cast<TypedefType>(Ty)->getDecl());
2472 case Type::UnresolvedUsing:
2473 mangleSourceNameWithAbiTags(
2474 cast<UnresolvedUsingType>(Ty)->getDecl());
2479 mangleSourceNameWithAbiTags(cast<TagType>(Ty)->getDecl());
2482 case Type::TemplateSpecialization: {
2484 cast<TemplateSpecializationType>(Ty);
2493 assert(TD &&
"no template for template specialization type");
2494 if (isa<TemplateTemplateParmDecl>(TD))
2495 goto unresolvedType;
2497 mangleSourceNameWithAbiTags(TD);
2504 llvm_unreachable(
"invalid base for a template specialization type");
2518 Out <<
"_SUBSTPACK_";
2523 assert(TD && !isa<TemplateTemplateParmDecl>(TD));
2524 mangleSourceNameWithAbiTags(TD);
2538 case Type::InjectedClassName:
2539 mangleSourceNameWithAbiTags(
2540 cast<InjectedClassNameType>(Ty)->getDecl());
2543 case Type::DependentName:
2544 mangleSourceName(cast<DependentNameType>(Ty)->
getIdentifier());
2547 case Type::DependentTemplateSpecialization: {
2549 cast<DependentTemplateSpecializationType>(Ty);
2550 TemplateName Template = getASTContext().getDependentTemplateName(
2558 return mangleUnresolvedTypeOrSimpleId(cast<UsingType>(Ty)->desugar(),
2560 case Type::Elaborated:
2561 return mangleUnresolvedTypeOrSimpleId(
2562 cast<ElaboratedType>(Ty)->getNamedType(), Prefix);
2568void CXXNameMangler::mangleOperatorName(
DeclarationName Name,
unsigned Arity) {
2569 switch (Name.getNameKind()) {
2578 llvm_unreachable(
"Not an operator name");
2583 mangleType(Name.getCXXNameType());
2588 mangleSourceName(Name.getCXXLiteralIdentifier());
2592 mangleOperatorName(Name.getCXXOverloadedOperator(), Arity);
2601 case OO_New: Out <<
"nw";
break;
2603 case OO_Array_New: Out <<
"na";
break;
2605 case OO_Delete: Out <<
"dl";
break;
2607 case OO_Array_Delete: Out <<
"da";
break;
2611 Out << (Arity == 1?
"ps" :
"pl");
break;
2615 Out << (Arity == 1?
"ng" :
"mi");
break;
2619 Out << (Arity == 1?
"ad" :
"an");
break;
2624 Out << (Arity == 1?
"de" :
"ml");
break;
2626 case OO_Tilde: Out <<
"co";
break;
2628 case OO_Slash: Out <<
"dv";
break;
2630 case OO_Percent: Out <<
"rm";
break;
2632 case OO_Pipe: Out <<
"or";
break;
2634 case OO_Caret: Out <<
"eo";
break;
2636 case OO_Equal: Out <<
"aS";
break;
2638 case OO_PlusEqual: Out <<
"pL";
break;
2640 case OO_MinusEqual: Out <<
"mI";
break;
2642 case OO_StarEqual: Out <<
"mL";
break;
2644 case OO_SlashEqual: Out <<
"dV";
break;
2646 case OO_PercentEqual: Out <<
"rM";
break;
2648 case OO_AmpEqual: Out <<
"aN";
break;
2650 case OO_PipeEqual: Out <<
"oR";
break;
2652 case OO_CaretEqual: Out <<
"eO";
break;
2654 case OO_LessLess: Out <<
"ls";
break;
2656 case OO_GreaterGreater: Out <<
"rs";
break;
2658 case OO_LessLessEqual: Out <<
"lS";
break;
2660 case OO_GreaterGreaterEqual: Out <<
"rS";
break;
2662 case OO_EqualEqual: Out <<
"eq";
break;
2664 case OO_ExclaimEqual: Out <<
"ne";
break;
2666 case OO_Less: Out <<
"lt";
break;
2668 case OO_Greater: Out <<
"gt";
break;
2670 case OO_LessEqual: Out <<
"le";
break;
2672 case OO_GreaterEqual: Out <<
"ge";
break;
2674 case OO_Exclaim: Out <<
"nt";
break;
2676 case OO_AmpAmp: Out <<
"aa";
break;
2678 case OO_PipePipe: Out <<
"oo";
break;
2680 case OO_PlusPlus: Out <<
"pp";
break;
2682 case OO_MinusMinus: Out <<
"mm";
break;
2684 case OO_Comma: Out <<
"cm";
break;
2686 case OO_ArrowStar: Out <<
"pm";
break;
2688 case OO_Arrow: Out <<
"pt";
break;
2690 case OO_Call: Out <<
"cl";
break;
2692 case OO_Subscript: Out <<
"ix";
break;
2697 case OO_Conditional: Out <<
"qu";
break;
2700 case OO_Coawait: Out <<
"aw";
break;
2703 case OO_Spaceship: Out <<
"ss";
break;
2707 llvm_unreachable(
"Not an overloaded operator");
2736 if (TargetAS != 0 ||
2738 ASString =
"AS" + llvm::utostr(TargetAS);
2741 default: llvm_unreachable(
"Not a language specific address space");
2745 case LangAS::opencl_global:
2746 ASString =
"CLglobal";
2748 case LangAS::opencl_global_device:
2749 ASString =
"CLdevice";
2751 case LangAS::opencl_global_host:
2752 ASString =
"CLhost";
2754 case LangAS::opencl_local:
2755 ASString =
"CLlocal";
2757 case LangAS::opencl_constant:
2758 ASString =
"CLconstant";
2760 case LangAS::opencl_private:
2761 ASString =
"CLprivate";
2763 case LangAS::opencl_generic:
2764 ASString =
"CLgeneric";
2768 case LangAS::sycl_global:
2769 ASString =
"SYglobal";
2771 case LangAS::sycl_global_device:
2772 ASString =
"SYdevice";
2774 case LangAS::sycl_global_host:
2775 ASString =
"SYhost";
2777 case LangAS::sycl_local:
2778 ASString =
"SYlocal";
2780 case LangAS::sycl_private:
2781 ASString =
"SYprivate";
2784 case LangAS::cuda_device:
2785 ASString =
"CUdevice";
2787 case LangAS::cuda_constant:
2788 ASString =
"CUconstant";
2790 case LangAS::cuda_shared:
2791 ASString =
"CUshared";
2794 case LangAS::ptr32_sptr:
2795 ASString =
"ptr32_sptr";
2797 case LangAS::ptr32_uptr:
2798 ASString =
"ptr32_uptr";
2805 if (!ASString.empty())
2806 mangleVendorQualifier(ASString);
2819 mangleVendorQualifier(
"__weak");
2823 mangleVendorQualifier(
"__unaligned");
2835 mangleVendorQualifier(
"__strong");
2839 mangleVendorQualifier(
"__autoreleasing");
2862void CXXNameMangler::mangleVendorQualifier(StringRef name) {
2869 switch (RefQualifier) {
2883void CXXNameMangler::mangleObjCMethodName(
const ObjCMethodDecl *MD) {
2884 Context.mangleObjCMethodNameAsSourceName(MD, Out);
2897 Ctx.
getLangOpts().getClangABICompat() > LangOptions::ClangABI::Ver17)
2903 if (Ctx.
getLangOpts().getClangABICompat() > LangOptions::ClangABI::Ver6 &&
2910 if (DeducedTST->getDeducedType().isNull())
2915void CXXNameMangler::mangleType(
QualType T) {
2949 T =
T.getCanonicalType();
2956 = dyn_cast<TemplateSpecializationType>(
T))
2965 =
T.getSingleStepDesugaredType(Context.getASTContext());
2974 const Type *ty = split.
Ty;
2976 bool isSubstitutable =
2978 if (isSubstitutable && mangleSubstitution(
T))
2983 if (quals && isa<ArrayType>(
T)) {
2993 dyn_cast<DependentAddressSpaceType>(ty)) {
2995 mangleQualifiers(splitDAST.
Quals, DAST);
2998 mangleQualifiers(quals);
3006#define ABSTRACT_TYPE(CLASS, PARENT)
3007#define NON_CANONICAL_TYPE(CLASS, PARENT) \
3009 llvm_unreachable("can't mangle non-canonical type " #CLASS "Type"); \
3011#define TYPE(CLASS, PARENT) \
3013 mangleType(static_cast<const CLASS##Type*>(ty)); \
3015#include "clang/AST/TypeNodes.inc"
3020 if (isSubstitutable)
3024void CXXNameMangler::mangleNameOrStandardSubstitution(
const NamedDecl *ND) {
3025 if (!mangleStandardSubstitution(ND))
3071 std::string type_name;
3075 if (NormalizeIntegers &&
T->isInteger()) {
3076 if (
T->isSignedInteger()) {
3077 switch (getASTContext().getTypeSize(
T)) {
3081 if (mangleSubstitution(BuiltinType::SChar))
3084 addSubstitution(BuiltinType::SChar);
3087 if (mangleSubstitution(BuiltinType::Short))
3090 addSubstitution(BuiltinType::Short);
3093 if (mangleSubstitution(BuiltinType::Int))
3096 addSubstitution(BuiltinType::Int);
3099 if (mangleSubstitution(BuiltinType::Long))
3102 addSubstitution(BuiltinType::Long);
3105 if (mangleSubstitution(BuiltinType::Int128))
3108 addSubstitution(BuiltinType::Int128);
3111 llvm_unreachable(
"Unknown integer size for normalization");
3114 switch (getASTContext().getTypeSize(
T)) {
3116 if (mangleSubstitution(BuiltinType::UChar))
3119 addSubstitution(BuiltinType::UChar);
3122 if (mangleSubstitution(BuiltinType::UShort))
3125 addSubstitution(BuiltinType::UShort);
3128 if (mangleSubstitution(BuiltinType::UInt))
3131 addSubstitution(BuiltinType::UInt);
3134 if (mangleSubstitution(BuiltinType::ULong))
3137 addSubstitution(BuiltinType::ULong);
3140 if (mangleSubstitution(BuiltinType::UInt128))
3143 addSubstitution(BuiltinType::UInt128);
3146 llvm_unreachable(
"Unknown integer size for normalization");
3151 switch (
T->getKind()) {
3152 case BuiltinType::Void:
3155 case BuiltinType::Bool:
3158 case BuiltinType::Char_U:
3159 case BuiltinType::Char_S:
3162 case BuiltinType::UChar:
3165 case BuiltinType::UShort:
3168 case BuiltinType::UInt:
3171 case BuiltinType::ULong:
3174 case BuiltinType::ULongLong:
3177 case BuiltinType::UInt128:
3180 case BuiltinType::SChar:
3183 case BuiltinType::WChar_S:
3184 case BuiltinType::WChar_U:
3187 case BuiltinType::Char8:
3190 case BuiltinType::Char16:
3193 case BuiltinType::Char32:
3196 case BuiltinType::Short:
3199 case BuiltinType::Int:
3202 case BuiltinType::Long:
3205 case BuiltinType::LongLong:
3208 case BuiltinType::Int128:
3211 case BuiltinType::Float16:
3214 case BuiltinType::ShortAccum:
3217 case BuiltinType::Accum:
3220 case BuiltinType::LongAccum:
3223 case BuiltinType::UShortAccum:
3226 case BuiltinType::UAccum:
3229 case BuiltinType::ULongAccum:
3232 case BuiltinType::ShortFract:
3235 case BuiltinType::Fract:
3238 case BuiltinType::LongFract:
3241 case BuiltinType::UShortFract:
3244 case BuiltinType::UFract:
3247 case BuiltinType::ULongFract:
3250 case BuiltinType::SatShortAccum:
3253 case BuiltinType::SatAccum:
3256 case BuiltinType::SatLongAccum:
3259 case BuiltinType::SatUShortAccum:
3262 case BuiltinType::SatUAccum:
3265 case BuiltinType::SatULongAccum:
3268 case BuiltinType::SatShortFract:
3271 case BuiltinType::SatFract:
3274 case BuiltinType::SatLongFract:
3277 case BuiltinType::SatUShortFract:
3280 case BuiltinType::SatUFract:
3283 case BuiltinType::SatULongFract:
3286 case BuiltinType::Half:
3289 case BuiltinType::Float:
3292 case BuiltinType::Double:
3295 case BuiltinType::LongDouble: {
3297 getASTContext().getLangOpts().OpenMP &&
3298 getASTContext().getLangOpts().OpenMPIsTargetDevice
3299 ? getASTContext().getAuxTargetInfo()
3300 : &getASTContext().getTargetInfo();
3304 case BuiltinType::Float128: {
3306 getASTContext().getLangOpts().OpenMP &&
3307 getASTContext().getLangOpts().OpenMPIsTargetDevice
3308 ? getASTContext().getAuxTargetInfo()
3309 : &getASTContext().getTargetInfo();
3313 case BuiltinType::BFloat16: {
3315 ((getASTContext().getLangOpts().OpenMP &&
3316 getASTContext().getLangOpts().OpenMPIsTargetDevice) ||
3317 getASTContext().getLangOpts().SYCLIsDevice)
3318 ? getASTContext().getAuxTargetInfo()
3319 : &getASTContext().getTargetInfo();
3323 case BuiltinType::Ibm128: {
3324 const TargetInfo *TI = &getASTContext().getTargetInfo();
3328 case BuiltinType::NullPtr:
3332#define BUILTIN_TYPE(Id, SingletonId)
3333#define PLACEHOLDER_TYPE(Id, SingletonId) \
3334 case BuiltinType::Id:
3335#include "clang/AST/BuiltinTypes.def"
3336 case BuiltinType::Dependent:
3338 llvm_unreachable(
"mangling a placeholder type");
3340 case BuiltinType::ObjCId:
3341 Out <<
"11objc_object";
3343 case BuiltinType::ObjCClass:
3344 Out <<
"10objc_class";
3346 case BuiltinType::ObjCSel:
3347 Out <<
"13objc_selector";
3349#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3350 case BuiltinType::Id: \
3351 type_name = "ocl_" #ImgType "_" #Suffix; \
3352 Out << type_name.size() << type_name; \
3354#include "clang/Basic/OpenCLImageTypes.def"
3355 case BuiltinType::OCLSampler:
3356 Out <<
"11ocl_sampler";
3358 case BuiltinType::OCLEvent:
3359 Out <<
"9ocl_event";
3361 case BuiltinType::OCLClkEvent:
3362 Out <<
"12ocl_clkevent";
3364 case BuiltinType::OCLQueue:
3365 Out <<
"9ocl_queue";
3367 case BuiltinType::OCLReserveID:
3368 Out <<
"13ocl_reserveid";
3370#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
3371 case BuiltinType::Id: \
3372 type_name = "ocl_" #ExtType; \
3373 Out << type_name.size() << type_name; \
3375#include "clang/Basic/OpenCLExtensionTypes.def"
3379#define SVE_VECTOR_TYPE(InternalName, MangledName, Id, SingletonId, NumEls, \
3380 ElBits, IsSigned, IsFP, IsBF) \
3381 case BuiltinType::Id: \
3382 if (T->getKind() == BuiltinType::SveBFloat16 && \
3383 isCompatibleWith(LangOptions::ClangABI::Ver17)) { \
3385 type_name = "__SVBFloat16_t"; \
3386 Out << "u" << type_name.size() << type_name; \
3388 type_name = MangledName; \
3389 Out << (type_name == InternalName ? "u" : "") << type_name.size() \
3393#define SVE_PREDICATE_TYPE(InternalName, MangledName, Id, SingletonId, NumEls) \
3394 case BuiltinType::Id: \
3395 type_name = MangledName; \
3396 Out << (type_name == InternalName ? "u" : "") << type_name.size() \
3399#define SVE_OPAQUE_TYPE(InternalName, MangledName, Id, SingletonId) \
3400 case BuiltinType::Id: \
3401 type_name = MangledName; \
3402 Out << (type_name == InternalName ? "u" : "") << type_name.size() \
3405#include "clang/Basic/AArch64SVEACLETypes.def"
3406#define PPC_VECTOR_TYPE(Name, Id, Size) \
3407 case BuiltinType::Id: \
3408 type_name = #Name; \
3409 Out << 'u' << type_name.size() << type_name; \
3411#include "clang/Basic/PPCTypes.def"
3413#define RVV_TYPE(Name, Id, SingletonId) \
3414 case BuiltinType::Id: \
3416 Out << 'u' << type_name.size() << type_name; \
3418#include "clang/Basic/RISCVVTypes.def"
3419#define WASM_REF_TYPE(InternalName, MangledName, Id, SingletonId, AS) \
3420 case BuiltinType::Id: \
3421 type_name = MangledName; \
3422 Out << 'u' << type_name.size() << type_name; \
3424#include "clang/Basic/WebAssemblyReferenceTypes.def"
3425#define AMDGPU_TYPE(Name, Id, SingletonId) \
3426 case BuiltinType::Id: \
3428 Out << 'u' << type_name.size() << type_name; \
3430#include "clang/Basic/AMDGPUTypes.def"
3434StringRef CXXNameMangler::getCallingConvQualifierName(
CallingConv CC) {
3477 return "swiftasynccall";
3479 llvm_unreachable(
"bad calling convention");
3482void CXXNameMangler::mangleExtFunctionInfo(
const FunctionType *
T) {
3491 StringRef CCQualifier = getCallingConvQualifierName(
T->
getExtInfo().
getCC());
3492 if (!CCQualifier.empty())
3493 mangleVendorQualifier(CCQualifier);
3507 case ParameterABI::Ordinary:
3511 case ParameterABI::SwiftContext:
3512 case ParameterABI::SwiftAsyncContext:
3513 case ParameterABI::SwiftErrorResult:
3514 case ParameterABI::SwiftIndirectResult:
3520 mangleVendorQualifier(
"ns_consumed");
3523 mangleVendorQualifier(
"noescape");
3530 mangleExtFunctionInfo(
T);
3547 mangleType(ExceptTy);
3558 mangleBareFunctionType(
T,
true);
3572 FunctionTypeDepthState saved = FunctionTypeDepth.push();
3574 FunctionTypeDepth.enterResultType();
3576 FunctionTypeDepth.leaveResultType();
3578 FunctionTypeDepth.pop(saved);
3583 bool MangleReturnType,
3587 FunctionTypeDepthState saved = FunctionTypeDepth.push();
3590 if (MangleReturnType) {
3591 FunctionTypeDepth.enterResultType();
3595 mangleVendorQualifier(
"ns_returns_retained");
3600 auto SplitReturnTy = ReturnTy.
split();
3602 ReturnTy = getASTContext().getQualifiedType(SplitReturnTy);
3604 mangleType(ReturnTy);
3606 FunctionTypeDepth.leaveResultType();
3628 assert(
Attr->getType() <= 9 &&
Attr->getType() >= 0);
3629 if (
Attr->isDynamic())
3630 Out <<
"U25pass_dynamic_object_size" <<
Attr->getType();
3632 Out <<
"U17pass_object_size" <<
Attr->getType();
3643 FunctionTypeDepth.enterResultType();
3647 FunctionTypeDepth.pop(saved);
3653 mangleName(
T->getDecl());
3658void CXXNameMangler::mangleType(
const EnumType *
T) {
3659 mangleType(
static_cast<const TagType*
>(
T));
3661void CXXNameMangler::mangleType(
const RecordType *
T) {
3662 mangleType(
static_cast<const TagType*
>(
T));
3664void CXXNameMangler::mangleType(
const TagType *
T) {
3665 mangleName(
T->getDecl());
3672 Out <<
'A' <<
T->getSize() <<
'_';
3673 mangleType(
T->getElementType());
3678 if (
T->getSizeExpr())
3679 mangleExpression(
T->getSizeExpr());
3681 mangleType(
T->getElementType());
3688 if (
T->getSizeExpr())
3689 mangleExpression(
T->getSizeExpr());
3691 mangleType(
T->getElementType());
3695 mangleType(
T->getElementType());
3725 mangleType(PointeeType);
3730 mangleTemplateParameter(
T->getDepth(),
T->getIndex());
3739 Out <<
"_SUBSTPACK_";
3767 mangleType(
T->getElementType());
3773void CXXNameMangler::mangleNeonVectorType(
const VectorType *
T) {
3775 assert(EltType->
isBuiltinType() &&
"Neon vector element not a BuiltinType");
3776 const char *EltName =
nullptr;
3777 if (
T->getVectorKind() == VectorKind::NeonPoly) {
3778 switch (cast<BuiltinType>(EltType)->
getKind()) {
3779 case BuiltinType::SChar:
3780 case BuiltinType::UChar:
3781 EltName =
"poly8_t";
3783 case BuiltinType::Short:
3784 case BuiltinType::UShort:
3785 EltName =
"poly16_t";
3787 case BuiltinType::LongLong:
3788 case BuiltinType::ULongLong:
3789 EltName =
"poly64_t";
3791 default: llvm_unreachable(
"unexpected Neon polynomial vector element type");
3794 switch (cast<BuiltinType>(EltType)->
getKind()) {
3795 case BuiltinType::SChar: EltName =
"int8_t";
break;
3796 case BuiltinType::UChar: EltName =
"uint8_t";
break;
3797 case BuiltinType::Short: EltName =
"int16_t";
break;
3798 case BuiltinType::UShort: EltName =
"uint16_t";
break;
3799 case BuiltinType::Int: EltName =
"int32_t";
break;
3800 case BuiltinType::UInt: EltName =
"uint32_t";
break;
3801 case BuiltinType::LongLong: EltName =
"int64_t";
break;
3802 case BuiltinType::ULongLong: EltName =
"uint64_t";
break;
3803 case BuiltinType::Double: EltName =
"float64_t";
break;
3804 case BuiltinType::Float: EltName =
"float32_t";
break;
3805 case BuiltinType::Half: EltName =
"float16_t";
break;
3806 case BuiltinType::BFloat16: EltName =
"bfloat16_t";
break;
3808 llvm_unreachable(
"unexpected Neon vector element type");
3811 const char *BaseName =
nullptr;
3812 unsigned BitSize = (
T->getNumElements() *
3813 getASTContext().getTypeSize(EltType));
3815 BaseName =
"__simd64_";
3817 assert(BitSize == 128 &&
"Neon vector type not 64 or 128 bits");
3818 BaseName =
"__simd128_";
3820 Out << strlen(BaseName) + strlen(EltName);
3821 Out << BaseName << EltName;
3828 "cannot mangle this dependent neon vector type yet");
3829 Diags.
Report(
T->getAttributeLoc(), DiagID);
3834 case BuiltinType::SChar:
3836 case BuiltinType::Short:
3838 case BuiltinType::Int:
3840 case BuiltinType::Long:
3841 case BuiltinType::LongLong:
3843 case BuiltinType::UChar:
3845 case BuiltinType::UShort:
3847 case BuiltinType::UInt:
3849 case BuiltinType::ULong:
3850 case BuiltinType::ULongLong:
3852 case BuiltinType::Half:
3854 case BuiltinType::Float:
3856 case BuiltinType::Double:
3858 case BuiltinType::BFloat16:
3861 llvm_unreachable(
"Unexpected vector element base type");
3868void CXXNameMangler::mangleAArch64NeonVectorType(
const VectorType *
T) {
3870 assert(EltType->
isBuiltinType() &&
"Neon vector element not a BuiltinType");
3872 (
T->getNumElements() * getASTContext().getTypeSize(EltType));
3875 assert((BitSize == 64 || BitSize == 128) &&
3876 "Neon vector type not 64 or 128 bits");
3879 if (
T->getVectorKind() == VectorKind::NeonPoly) {
3880 switch (cast<BuiltinType>(EltType)->
getKind()) {
3881 case BuiltinType::UChar:
3884 case BuiltinType::UShort:
3887 case BuiltinType::ULong:
3888 case BuiltinType::ULongLong:
3892 llvm_unreachable(
"unexpected Neon polynomial vector element type");
3898 (
"__" + EltName +
"x" + Twine(
T->getNumElements()) +
"_t").str();
3905 "cannot mangle this dependent neon vector type yet");
3906 Diags.
Report(
T->getAttributeLoc(), DiagID);
3933void CXXNameMangler::mangleAArch64FixedSveVectorType(
const VectorType *
T) {
3934 assert((
T->getVectorKind() == VectorKind::SveFixedLengthData ||
3935 T->getVectorKind() == VectorKind::SveFixedLengthPredicate) &&
3936 "expected fixed-length SVE vector!");
3940 "expected builtin type for fixed-length SVE vector!");
3943 switch (cast<BuiltinType>(EltType)->
getKind()) {
3944 case BuiltinType::SChar:
3947 case BuiltinType::UChar: {
3948 if (
T->getVectorKind() == VectorKind::SveFixedLengthData)
3954 case BuiltinType::Short:
3957 case BuiltinType::UShort:
3960 case BuiltinType::Int:
3963 case BuiltinType::UInt:
3966 case BuiltinType::Long:
3969 case BuiltinType::ULong:
3972 case BuiltinType::Half:
3975 case BuiltinType::Float:
3978 case BuiltinType::Double:
3981 case BuiltinType::BFloat16:
3985 llvm_unreachable(
"unexpected element type for fixed-length SVE vector!");
3988 unsigned VecSizeInBits = getASTContext().getTypeInfo(
T).Width;
3990 if (
T->getVectorKind() == VectorKind::SveFixedLengthPredicate)
3994 << VecSizeInBits <<
"EE";
3997void CXXNameMangler::mangleAArch64FixedSveVectorType(
4002 "cannot mangle this dependent fixed-length SVE vector type yet");
4003 Diags.
Report(
T->getAttributeLoc(), DiagID);
4006void CXXNameMangler::mangleRISCVFixedRVVVectorType(
const VectorType *
T) {
4007 assert((
T->getVectorKind() == VectorKind::RVVFixedLengthData ||
4008 T->getVectorKind() == VectorKind::RVVFixedLengthMask) &&
4009 "expected fixed-length RVV vector!");
4013 "expected builtin type for fixed-length RVV vector!");
4016 llvm::raw_svector_ostream TypeNameOS(TypeNameStr);
4017 TypeNameOS <<
"__rvv_";
4018 switch (cast<BuiltinType>(EltType)->
getKind()) {
4019 case BuiltinType::SChar:
4020 TypeNameOS <<
"int8";
4022 case BuiltinType::UChar:
4023 if (
T->getVectorKind() == VectorKind::RVVFixedLengthData)
4024 TypeNameOS <<
"uint8";
4026 TypeNameOS <<
"bool";
4028 case BuiltinType::Short:
4029 TypeNameOS <<
"int16";
4031 case BuiltinType::UShort:
4032 TypeNameOS <<
"uint16";
4034 case BuiltinType::Int:
4035 TypeNameOS <<
"int32";
4037 case BuiltinType::UInt:
4038 TypeNameOS <<
"uint32";
4040 case BuiltinType::Long:
4041 TypeNameOS <<
"int64";
4043 case BuiltinType::ULong:
4044 TypeNameOS <<
"uint64";
4046 case BuiltinType::Float16:
4047 TypeNameOS <<
"float16";
4049 case BuiltinType::Float:
4050 TypeNameOS <<
"float32";
4052 case BuiltinType::Double:
4053 TypeNameOS <<
"float64";
4056 llvm_unreachable(
"unexpected element type for fixed-length RVV vector!");
4059 unsigned VecSizeInBits = getASTContext().getTypeInfo(
T).Width;
4062 auto VScale = getASTContext().getTargetInfo().getVScaleRange(
4063 getASTContext().getLangOpts());
4064 unsigned VLen = VScale->first * llvm::RISCV::RVVBitsPerBlock;
4066 if (
T->getVectorKind() == VectorKind::RVVFixedLengthData) {
4068 if (VecSizeInBits >= VLen)
4069 TypeNameOS << (VecSizeInBits / VLen);
4071 TypeNameOS <<
'f' << (VLen / VecSizeInBits);
4073 TypeNameOS << (VLen / VecSizeInBits);
4077 Out <<
"9__RVV_VLSI" <<
'u' << TypeNameStr.size() << TypeNameStr <<
"Lj"
4078 << VecSizeInBits <<
"EE";
4081void CXXNameMangler::mangleRISCVFixedRVVVectorType(
4086 "cannot mangle this dependent fixed-length RVV vector type yet");
4087 Diags.
Report(
T->getAttributeLoc(), DiagID);
4098void CXXNameMangler::mangleType(
const VectorType *
T) {
4099 if ((
T->getVectorKind() == VectorKind::Neon ||
4100 T->getVectorKind() == VectorKind::NeonPoly)) {
4101 llvm::Triple
Target = getASTContext().getTargetInfo().getTriple();
4102 llvm::Triple::ArchType Arch =
4103 getASTContext().getTargetInfo().getTriple().getArch();
4104 if ((Arch == llvm::Triple::aarch64 ||
4105 Arch == llvm::Triple::aarch64_be) && !
Target.isOSDarwin())
4106 mangleAArch64NeonVectorType(
T);
4108 mangleNeonVectorType(
T);
4110 }
else if (
T->getVectorKind() == VectorKind::SveFixedLengthData ||
4111 T->getVectorKind() == VectorKind::SveFixedLengthPredicate) {
4112 mangleAArch64FixedSveVectorType(
T);
4114 }
else if (
T->getVectorKind() == VectorKind::RVVFixedLengthData ||
4115 T->getVectorKind() == VectorKind::RVVFixedLengthMask) {
4116 mangleRISCVFixedRVVVectorType(
T);
4119 Out <<
"Dv" <<
T->getNumElements() <<
'_';
4120 if (
T->getVectorKind() == VectorKind::AltiVecPixel)
4122 else if (
T->getVectorKind() == VectorKind::AltiVecBool)
4125 mangleType(
T->getElementType());
4129 if ((
T->getVectorKind() == VectorKind::Neon ||
4130 T->getVectorKind() == VectorKind::NeonPoly)) {
4131 llvm::Triple
Target = getASTContext().getTargetInfo().getTriple();
4132 llvm::Triple::ArchType Arch =
4133 getASTContext().getTargetInfo().getTriple().getArch();
4134 if ((Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_be) &&
4136 mangleAArch64NeonVectorType(
T);
4138 mangleNeonVectorType(
T);
4140 }
else if (
T->getVectorKind() == VectorKind::SveFixedLengthData ||
4141 T->getVectorKind() == VectorKind::SveFixedLengthPredicate) {
4142 mangleAArch64FixedSveVectorType(
T);
4144 }
else if (
T->getVectorKind() == VectorKind::RVVFixedLengthData) {
4145 mangleRISCVFixedRVVVectorType(
T);
4150 mangleExpression(
T->getSizeExpr());
4152 if (
T->getVectorKind() == VectorKind::AltiVecPixel)
4154 else if (
T->getVectorKind() == VectorKind::AltiVecBool)
4157 mangleType(
T->getElementType());
4165 mangleExpression(
T->getSizeExpr());
4167 mangleType(
T->getElementType());
4174 StringRef VendorQualifier =
"matrix_type";
4175 Out <<
"u" << VendorQualifier.size() << VendorQualifier;
4178 auto &ASTCtx = getASTContext();
4179 unsigned BitWidth = ASTCtx.getTypeSize(ASTCtx.getSizeType());
4180 llvm::APSInt Rows(BitWidth);
4181 Rows =
T->getNumRows();
4182 mangleIntegerLiteral(ASTCtx.getSizeType(), Rows);
4183 llvm::APSInt Columns(BitWidth);
4184 Columns =
T->getNumColumns();
4185 mangleIntegerLiteral(ASTCtx.getSizeType(), Columns);
4186 mangleType(
T->getElementType());
4193 StringRef VendorQualifier =
"matrix_type";
4194 Out <<
"u" << VendorQualifier.size() << VendorQualifier;
4197 mangleTemplateArgExpr(
T->getRowExpr());
4198 mangleTemplateArgExpr(
T->getColumnExpr());
4199 mangleType(
T->getElementType());
4205 mangleQualifiers(split.
Quals,
T);
4212 mangleType(
T->getPattern());
4216 if (!
T->hasSelectedType())
4217 mangleType(
T->getPattern());
4219 mangleType(
T->getSelectedType());
4223 mangleSourceName(
T->getDecl()->getIdentifier());
4228 if (
T->isKindOfType())
4229 Out <<
"U8__kindof";
4231 if (!
T->qual_empty()) {
4234 llvm::raw_svector_ostream QualOS(QualStr);
4235 QualOS <<
"objcproto";
4236 for (
const auto *I :
T->quals()) {
4237 StringRef
name = I->getName();
4240 Out <<
'U' << QualStr.size() << QualStr;
4243 mangleType(
T->getBaseType());
4245 if (
T->isSpecialized()) {
4248 for (
auto typeArg :
T->getTypeArgs())
4249 mangleType(typeArg);
4255 Out <<
"U13block_pointer";
4263 mangleType(
T->getInjectedSpecializationType());
4267 if (
TemplateDecl *TD =
T->getTemplateName().getAsTemplateDecl()) {
4268 mangleTemplateName(TD,
T->template_arguments());
4273 mangleTemplatePrefix(
T->getTemplateName());
4278 mangleTemplateArgs(
T->getTemplateName(),
T->template_arguments());
4294 switch (
T->getKeyword()) {
4295 case ElaboratedTypeKeyword::None:
4296 case ElaboratedTypeKeyword::Typename:
4298 case ElaboratedTypeKeyword::Struct:
4299 case ElaboratedTypeKeyword::Class:
4300 case ElaboratedTypeKeyword::Interface:
4303 case ElaboratedTypeKeyword::Union:
4306 case ElaboratedTypeKeyword::Enum:
4312 manglePrefix(
T->getQualifier());
4313 mangleSourceName(
T->getIdentifier());
4323 getASTContext().getDependentTemplateName(
T->getQualifier(),
4324 T->getIdentifier());
4325 mangleTemplatePrefix(Prefix);
4330 mangleTemplateArgs(Prefix,
T->template_arguments());
4334void CXXNameMangler::mangleType(
const TypeOfType *
T) {
4347 Expr *
E =
T->getUnderlyingExpr();
4357 if (isa<DeclRefExpr>(
E) ||
4358 isa<MemberExpr>(
E) ||
4359 isa<UnresolvedLookupExpr>(
E) ||
4360 isa<DependentScopeDeclRefExpr>(
E) ||
4361 isa<CXXDependentScopeMemberExpr>(
E) ||
4362 isa<UnresolvedMemberExpr>(
E))
4366 mangleExpression(
E);
4376 StringRef BuiltinName;
4377 switch (
T->getUTTKind()) {
4378#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \
4379 case UnaryTransformType::Enum: \
4380 BuiltinName = "__" #Trait; \
4382#include "clang/Basic/TransformTypeTraits.def"
4384 Out << BuiltinName.size() << BuiltinName;
4388 mangleType(
T->getBaseType());
4392void CXXNameMangler::mangleType(
const AutoType *
T) {
4393 assert(
T->getDeducedType().isNull() &&
4394 "Deduced AutoType shouldn't be handled here!");
4395 assert(
T->getKeyword() != AutoTypeKeyword::GNUAutoType &&
4396 "shouldn't need to mangle __auto_type!");
4401 if (
T->isConstrained() && !isCompatibleWith(LangOptions::ClangABI::Ver17)) {
4402 Out << (
T->isDecltypeAuto() ?
"DK" :
"Dk");
4403 mangleTypeConstraint(
T->getTypeConstraintConcept(),
4404 T->getTypeConstraintArguments());
4406 Out << (
T->isDecltypeAuto() ?
"Dc" :
"Da");
4413 return mangleType(Deduced);
4415 TemplateDecl *TD =
T->getTemplateName().getAsTemplateDecl();
4416 assert(TD &&
"shouldn't form deduced TST unless we know we have a template");
4418 if (mangleSubstitution(TD))
4422 addSubstitution(TD);
4425void CXXNameMangler::mangleType(
const AtomicType *
T) {
4429 mangleType(
T->getValueType());
4432void CXXNameMangler::mangleType(
const PipeType *
T) {
4439void CXXNameMangler::mangleType(
const BitIntType *
T) {
4443 Out <<
"D" << (
T->isUnsigned() ?
"U" :
"B") <<
T->getNumBits() <<
"_";
4450 Out <<
"D" << (
T->isUnsigned() ?
"U" :
"B");
4451 mangleExpression(
T->getNumBitsExpr());
4456 mangleType(cast<ConstantArrayType>(
T));
4459void CXXNameMangler::mangleIntegerLiteral(
QualType T,
4460 const llvm::APSInt &
Value) {
4467 Out << (
Value.getBoolValue() ?
'1' :
'0');
4469 mangleNumber(
Value);
4475void CXXNameMangler::mangleMemberExprBase(
const Expr *
Base,
bool IsArrow) {
4478 if (!RT->getDecl()->isAnonymousStructOrUnion())
4480 const auto *ME = dyn_cast<MemberExpr>(
Base);
4483 Base = ME->getBase();
4484 IsArrow = ME->isArrow();
4487 if (
Base->isImplicitCXXThis()) {
4493 Out << (IsArrow ?
"pt" :
"dt");
4494 mangleExpression(
Base);
4499void CXXNameMangler::mangleMemberExpr(
const Expr *base,
4505 unsigned NumTemplateArgs,
4510 mangleMemberExprBase(base, isArrow);
4511 mangleUnresolvedName(qualifier, member, TemplateArgs, NumTemplateArgs, arity);
4524 if (callee == fn)
return false;
4528 if (!lookup)
return false;
4545void CXXNameMangler::mangleCastExpression(
const Expr *
E, StringRef CastEncoding) {
4547 Out << CastEncoding;
4552void CXXNameMangler::mangleInitListElements(
const InitListExpr *InitList) {
4554 InitList = Syntactic;
4555 for (
unsigned i = 0, e = InitList->
getNumInits(); i != e; ++i)
4556 mangleExpression(InitList->
getInit(i));
4559void CXXNameMangler::mangleRequirement(
SourceLocation RequiresExprLoc,
4566 auto HandleSubstitutionFailure =
4571 "containing a substitution failure");
4577 case Requirement::RK_Type: {
4578 const auto *TR = cast<concepts::TypeRequirement>(Req);
4579 if (TR->isSubstitutionFailure())
4580 return HandleSubstitutionFailure(
4581 TR->getSubstitutionDiagnostic()->DiagLoc);
4584 mangleType(TR->getType()->getType());
4588 case Requirement::RK_Simple:
4589 case Requirement::RK_Compound: {
4590 const auto *ER = cast<concepts::ExprRequirement>(Req);
4591 if (ER->isExprSubstitutionFailure())
4592 return HandleSubstitutionFailure(
4593 ER->getExprSubstitutionDiagnostic()->DiagLoc);
4596 mangleExpression(ER->getExpr());
4598 if (ER->hasNoexceptRequirement())
4601 if (!ER->getReturnTypeRequirement().isEmpty()) {
4602 if (ER->getReturnTypeRequirement().isSubstitutionFailure())
4603 return HandleSubstitutionFailure(ER->getReturnTypeRequirement()
4604 .getSubstitutionDiagnostic()
4608 mangleTypeConstraint(ER->getReturnTypeRequirement().getTypeConstraint());
4613 case Requirement::RK_Nested:
4614 const auto *NR = cast<concepts::NestedRequirement>(Req);
4615 if (NR->hasInvalidConstraint()) {
4618 return HandleSubstitutionFailure(RequiresExprLoc);
4622 mangleExpression(NR->getConstraintExpr());
4627void CXXNameMangler::mangleExpression(
const Expr *
E,
unsigned Arity,
4628 bool AsTemplateArg) {
4657 QualType ImplicitlyConvertedToType;
4661 bool IsPrimaryExpr =
true;
4662 auto NotPrimaryExpr = [&] {
4663 if (AsTemplateArg && IsPrimaryExpr)
4665 IsPrimaryExpr =
false;
4668 auto MangleDeclRefExpr = [&](
const NamedDecl *
D) {
4679 mangleFunctionParam(cast<ParmVarDecl>(
D));
4682 case Decl::EnumConstant: {
4689 case Decl::NonTypeTemplateParm:
4702 case Expr::NoStmtClass:
4703#define ABSTRACT_STMT(Type)
4704#define EXPR(Type, Base)
4705#define STMT(Type, Base) \
4706 case Expr::Type##Class:
4707#include "clang/AST/StmtNodes.inc"
4712 case Expr::AddrLabelExprClass:
4713 case Expr::DesignatedInitUpdateExprClass:
4714 case Expr::ImplicitValueInitExprClass:
4715 case Expr::ArrayInitLoopExprClass:
4716 case Expr::ArrayInitIndexExprClass:
4717 case Expr::NoInitExprClass:
4718 case Expr::ParenListExprClass:
4719 case Expr::MSPropertyRefExprClass:
4720 case Expr::MSPropertySubscriptExprClass:
4721 case Expr::TypoExprClass:
4722 case Expr::RecoveryExprClass:
4723 case Expr::ArraySectionExprClass:
4724 case Expr::OMPArrayShapingExprClass:
4725 case Expr::OMPIteratorExprClass:
4726 case Expr::CXXInheritedCtorInitExprClass:
4727 case Expr::CXXParenListInitExprClass:
4728 case Expr::PackIndexingExprClass:
4729 llvm_unreachable(
"unexpected statement kind");
4731 case Expr::ConstantExprClass:
4732 E = cast<ConstantExpr>(
E)->getSubExpr();
4736 case Expr::BlockExprClass:
4737 case Expr::ChooseExprClass:
4738 case Expr::CompoundLiteralExprClass:
4739 case Expr::ExtVectorElementExprClass:
4740 case Expr::GenericSelectionExprClass:
4741 case Expr::ObjCEncodeExprClass:
4742 case Expr::ObjCIsaExprClass:
4743 case Expr::ObjCIvarRefExprClass:
4744 case Expr::ObjCMessageExprClass:
4745 case Expr::ObjCPropertyRefExprClass:
4746 case Expr::ObjCProtocolExprClass:
4747 case Expr::ObjCSelectorExprClass:
4748 case Expr::ObjCStringLiteralClass:
4749 case Expr::ObjCBoxedExprClass:
4750 case Expr::ObjCArrayLiteralClass:
4751 case Expr::ObjCDictionaryLiteralClass:
4752 case Expr::ObjCSubscriptRefExprClass:
4753 case Expr::ObjCIndirectCopyRestoreExprClass:
4754 case Expr::ObjCAvailabilityCheckExprClass:
4755 case Expr::OffsetOfExprClass:
4756 case Expr::PredefinedExprClass:
4757 case Expr::ShuffleVectorExprClass:
4758 case Expr::ConvertVectorExprClass:
4759 case Expr::StmtExprClass:
4760 case Expr::ArrayTypeTraitExprClass:
4761 case Expr::ExpressionTraitExprClass:
4762 case Expr::VAArgExprClass:
4763 case Expr::CUDAKernelCallExprClass:
4764 case Expr::AsTypeExprClass:
4765 case Expr::PseudoObjectExprClass:
4766 case Expr::AtomicExprClass:
4767 case Expr::SourceLocExprClass:
4768 case Expr::EmbedExprClass:
4769 case Expr::BuiltinBitCastExprClass:
4776 "cannot yet mangle expression type %0");
4784 case Expr::CXXUuidofExprClass: {
4789 if (!isCompatibleWith(LangOptions::ClangABI::Ver11)) {
4790 Out <<
"u8__uuidof";
4799 Out <<
"u8__uuidoft";
4803 Out <<
"u8__uuidofz";
4804 mangleExpression(UuidExp);
4811 case Expr::BinaryConditionalOperatorClass: {
4816 "?: operator with omitted middle operand cannot be mangled");
4823 case Expr::OpaqueValueExprClass:
4824 llvm_unreachable(
"cannot mangle opaque value; mangling wrong thing?");
4826 case Expr::InitListExprClass: {
4829 mangleInitListElements(cast<InitListExpr>(
E));
4834 case Expr::DesignatedInitExprClass: {
4836 auto *DIE = cast<DesignatedInitExpr>(
E);
4837 for (
const auto &
Designator : DIE->designators()) {
4843 mangleExpression(DIE->getArrayIndex(
Designator));
4846 "unknown designator kind");
4848 mangleExpression(DIE->getArrayRangeStart(
Designator));
4849 mangleExpression(DIE->getArrayRangeEnd(
Designator));
4852 mangleExpression(DIE->getInit());
4856 case Expr::CXXDefaultArgExprClass:
4857 E = cast<CXXDefaultArgExpr>(
E)->getExpr();
4860 case Expr::CXXDefaultInitExprClass:
4861 E = cast<CXXDefaultInitExpr>(
E)->getExpr();
4864 case Expr::CXXStdInitializerListExprClass:
4865 E = cast<CXXStdInitializerListExpr>(
E)->getSubExpr();
4868 case Expr::SubstNonTypeTemplateParmExprClass: {
4871 auto *SNTTPE = cast<SubstNonTypeTemplateParmExpr>(
E);
4872 if (
auto *CE = dyn_cast<ConstantExpr>(SNTTPE->getReplacement())) {
4874 QualType ParamType = SNTTPE->getParameterType(Context.getASTContext());
4875 assert(CE->hasAPValueResult() &&
"expected the NTTP to have an APValue");
4876 mangleValueInTemplateArg(ParamType, CE->getAPValueResult(),
false,
4882 E = cast<SubstNonTypeTemplateParmExpr>(
E)->getReplacement();
4886 case Expr::UserDefinedLiteralClass:
4889 case Expr::CXXMemberCallExprClass:
4890 case Expr::CallExprClass: {
4911 if (isa<PackExpansionExpr>(Arg))
4912 CallArity = UnknownArity;
4914 mangleExpression(CE->
getCallee(), CallArity);
4916 mangleExpression(Arg);
4921 case Expr::CXXNewExprClass: {
4925 Out << (New->
isArray() ?
"na" :
"nw");
4928 mangleExpression(*I);
4942 mangleExpression(*I);
4944 for (
unsigned i = 0, e = PLE->getNumExprs(); i != e; ++i)
4945 mangleExpression(PLE->getExpr(i));
4947 CXXNewInitializationStyle::Braces &&
4948 isa<InitListExpr>(
Init)) {
4950 mangleInitListElements(cast<InitListExpr>(
Init));
4952 mangleExpression(
Init);
4958 case Expr::CXXPseudoDestructorExprClass: {
4960 const auto *PDE = cast<CXXPseudoDestructorExpr>(
E);
4961 if (
const Expr *
Base = PDE->getBase())
4962 mangleMemberExprBase(
Base, PDE->isArrow());
4966 mangleUnresolvedPrefix(Qualifier,
4968 mangleUnresolvedTypeOrSimpleId(ScopeInfo->getType());
4972 if (!mangleUnresolvedTypeOrSimpleId(ScopeInfo->getType()))
4975 }
else if (Qualifier) {
4976 mangleUnresolvedPrefix(Qualifier);
4980 QualType DestroyedType = PDE->getDestroyedType();
4981 mangleUnresolvedTypeOrSimpleId(DestroyedType);
4985 case Expr::MemberExprClass: {
4996 case Expr::UnresolvedMemberExprClass: {
5007 case Expr::CXXDependentScopeMemberExprClass: {
5010 = cast<CXXDependentScopeMemberExpr>(
E);
5020 case Expr::UnresolvedLookupExprClass: {
5029 case Expr::CXXUnresolvedConstructExprClass: {
5035 assert(N == 1 &&
"unexpected form for list initialization");
5036 auto *IL = cast<InitListExpr>(CE->
getArg(0));
5039 mangleInitListElements(IL);
5046 if (N != 1) Out <<
'_';
5047 for (
unsigned I = 0; I != N; ++I) mangleExpression(CE->
getArg(I));
5048 if (N != 1) Out <<
'E';
5052 case Expr::CXXConstructExprClass: {
5054 const auto *CE = cast<CXXConstructExpr>(
E);
5059 "implicit CXXConstructExpr must have one argument");
5060 E = cast<CXXConstructExpr>(
E)->getArg(0);
5066 mangleExpression(
E);
5071 case Expr::CXXTemporaryObjectExprClass: {
5073 const auto *CE = cast<CXXTemporaryObjectExpr>(
E);
5082 if (!List && N != 1)
5084 if (CE->isStdInitListInitialization()) {
5090 auto *ILE = cast<InitListExpr>(SILE->getSubExpr()->IgnoreImplicit());
5091 mangleInitListElements(ILE);
5094 mangleExpression(
E);
5101 case Expr::CXXScalarValueInitExprClass:
5108 case Expr::CXXNoexceptExprClass:
5111 mangleExpression(cast<CXXNoexceptExpr>(
E)->getOperand());
5114 case Expr::UnaryExprOrTypeTraitExprClass: {
5133 : ImplicitlyConvertedToType;
5135 mangleIntegerLiteral(
T,
V);
5141 auto MangleAlignofSizeofArg = [&] {
5154 MangleAlignofSizeofArg();
5156 case UETT_PreferredAlignOf:
5160 if (!isCompatibleWith(LangOptions::ClangABI::Ver11)) {
5161 Out <<
"u11__alignof__";
5172 MangleAlignofSizeofArg();
5174 case UETT_DataSizeOf: {
5178 "cannot yet mangle __datasizeof expression");
5182 case UETT_PtrAuthTypeDiscriminator: {
5186 "cannot yet mangle __builtin_ptrauth_type_discriminator expression");
5190 case UETT_VecStep: {
5193 "cannot yet mangle vec_step expression");
5197 case UETT_OpenMPRequiredSimdAlign: {
5201 "cannot yet mangle __builtin_omp_required_simd_align expression");
5205 case UETT_VectorElements: {
5209 "cannot yet mangle __builtin_vectorelements expression");
5217 case Expr::TypeTraitExprClass: {
5223 Out << Spelling.size() << Spelling;
5225 mangleType(TSI->getType());
5231 case Expr::CXXThrowExprClass: {
5245 case Expr::CXXTypeidExprClass: {
5260 case Expr::CXXDeleteExprClass: {
5271 case Expr::UnaryOperatorClass: {
5280 case Expr::ArraySubscriptExprClass: {
5287 mangleExpression(AE->
getLHS());
5288 mangleExpression(AE->
getRHS());
5292 case Expr::MatrixSubscriptExprClass: {
5296 mangleExpression(ME->
getBase());
5302 case Expr::CompoundAssignOperatorClass:
5303 case Expr::BinaryOperatorClass: {
5311 mangleExpression(BO->
getLHS());
5312 mangleExpression(BO->
getRHS());
5316 case Expr::CXXRewrittenBinaryOperatorClass: {
5320 cast<CXXRewrittenBinaryOperator>(
E)->getDecomposedForm();
5323 mangleExpression(Decomposed.
LHS);
5324 mangleExpression(Decomposed.
RHS);
5328 case Expr::ConditionalOperatorClass: {
5331 mangleOperatorName(OO_Conditional, 3);
5332 mangleExpression(CO->
getCond());
5333 mangleExpression(CO->
getLHS(), Arity);
5334 mangleExpression(CO->
getRHS(), Arity);
5338 case Expr::ImplicitCastExprClass: {
5339 ImplicitlyConvertedToType =
E->
getType();
5340 E = cast<ImplicitCastExpr>(
E)->getSubExpr();
5344 case Expr::ObjCBridgedCastExprClass: {
5348 StringRef
Kind = cast<ObjCBridgedCastExpr>(
E)->getBridgeKindName();
5349 Out <<
"v1U" <<
Kind.size() <<
Kind;
5350 mangleCastExpression(
E,
"cv");
5354 case Expr::CStyleCastExprClass:
5356 mangleCastExpression(
E,
"cv");
5359 case Expr::CXXFunctionalCastExprClass: {
5361 auto *
Sub = cast<ExplicitCastExpr>(
E)->getSubExpr()->IgnoreImplicit();
5363 if (
auto *CCE = dyn_cast<CXXConstructExpr>(Sub))
5364 if (CCE->getParenOrBraceRange().isInvalid())
5365 Sub = CCE->getArg(0)->IgnoreImplicit();
5366 if (
auto *StdInitList = dyn_cast<CXXStdInitializerListExpr>(Sub))
5367 Sub = StdInitList->getSubExpr()->IgnoreImplicit();
5368 if (
auto *IL = dyn_cast<InitListExpr>(Sub)) {
5371 mangleInitListElements(IL);
5374 mangleCastExpression(
E,
"cv");
5379 case Expr::CXXStaticCastExprClass:
5381 mangleCastExpression(
E,
"sc");
5383 case Expr::CXXDynamicCastExprClass:
5385 mangleCastExpression(
E,
"dc");
5387 case Expr::CXXReinterpretCastExprClass:
5389 mangleCastExpression(
E,
"rc");
5391 case Expr::CXXConstCastExprClass:
5393 mangleCastExpression(
E,
"cc");
5395 case Expr::CXXAddrspaceCastExprClass:
5397 mangleCastExpression(
E,
"ac");
5400 case Expr::CXXOperatorCallExprClass: {
5409 for (
unsigned i = 0; i != NumArgs; ++i)
5410 mangleExpression(CE->
getArg(i));
5414 case Expr::ParenExprClass:
5415 E = cast<ParenExpr>(
E)->getSubExpr();
5418 case Expr::ConceptSpecializationExprClass: {
5419 auto *CSE = cast<ConceptSpecializationExpr>(
E);
5420 if (isCompatibleWith(LangOptions::ClangABI::Ver17)) {
5425 mangleTemplateName(CSE->getNamedConcept(), CSE->getTemplateArguments());
5431 mangleUnresolvedName(
5432 CSE->getNestedNameSpecifierLoc().getNestedNameSpecifier(),
5433 CSE->getConceptNameInfo().getName(),
5434 CSE->getTemplateArgsAsWritten()->getTemplateArgs(),
5435 CSE->getTemplateArgsAsWritten()->getNumTemplateArgs());
5439 case Expr::RequiresExprClass: {
5441 auto *RE = cast<RequiresExpr>(
E);
5445 if (RE->getLParenLoc().isValid()) {
5447 FunctionTypeDepthState saved = FunctionTypeDepth.push();
5448 if (RE->getLocalParameters().empty()) {
5451 for (
ParmVarDecl *Param : RE->getLocalParameters()) {
5459 FunctionTypeDepth.enterResultType();
5461 mangleRequirement(RE->getExprLoc(), Req);
5462 FunctionTypeDepth.pop(saved);
5467 mangleRequirement(RE->getExprLoc(), Req);
5473 case Expr::DeclRefExprClass:
5475 MangleDeclRefExpr(cast<DeclRefExpr>(
E)->getDecl());
5478 case Expr::SubstNonTypeTemplateParmPackExprClass:
5484 Out <<
"_SUBSTPACK_";
5487 case Expr::FunctionParmPackExprClass: {
5491 Out <<
"v110_SUBSTPACK";
5496 case Expr::DependentScopeDeclRefExprClass: {
5505 case Expr::CXXBindTemporaryExprClass:
5506 E = cast<CXXBindTemporaryExpr>(
E)->getSubExpr();
5509 case Expr::ExprWithCleanupsClass:
5510 E = cast<ExprWithCleanups>(
E)->getSubExpr();
5513 case Expr::FloatingLiteralClass: {
5520 case Expr::FixedPointLiteralClass:
5522 mangleFixedPointLiteral();
5525 case Expr::CharacterLiteralClass:
5529 Out << cast<CharacterLiteral>(
E)->getValue();
5534 case Expr::ObjCBoolLiteralExprClass:
5537 Out << (cast<ObjCBoolLiteralExpr>(
E)->getValue() ?
'1' :
'0');
5541 case Expr::CXXBoolLiteralExprClass:
5544 Out << (cast<CXXBoolLiteralExpr>(
E)->getValue() ?
'1' :
'0');
5548 case Expr::IntegerLiteralClass: {
5550 llvm::APSInt
Value(cast<IntegerLiteral>(
E)->getValue());
5552 Value.setIsSigned(
true);
5557 case Expr::ImaginaryLiteralClass: {
5565 dyn_cast<FloatingLiteral>(IE->
getSubExpr())) {
5567 mangleFloat(llvm::APFloat(Imag->getValue().getSemantics()));
5569 mangleFloat(Imag->getValue());
5572 llvm::APSInt
Value(cast<IntegerLiteral>(IE->
getSubExpr())->getValue());
5574 Value.setIsSigned(
true);
5575 mangleNumber(
Value);
5581 case Expr::StringLiteralClass: {
5585 assert(isa<ConstantArrayType>(
E->
getType()));
5591 case Expr::GNUNullExprClass:
5594 mangleIntegerLiteral(
E->
getType(), llvm::APSInt(32));
5597 case Expr::CXXNullPtrLiteralExprClass: {
5603 case Expr::LambdaExprClass: {
5608 mangleType(Context.getASTContext().
getRecordType(cast<LambdaExpr>(
E)->getLambdaClass()));
5613 case Expr::PackExpansionExprClass:
5616 mangleExpression(cast<PackExpansionExpr>(
E)->getPattern());
5619 case Expr::SizeOfPackExprClass: {
5621 auto *SPE = cast<SizeOfPackExpr>(
E);
5622 if (SPE->isPartiallySubstituted()) {
5624 for (
const auto &A : SPE->getPartialArguments())
5625 mangleTemplateArg(A,
false);
5633 mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
5635 = dyn_cast<NonTypeTemplateParmDecl>(Pack))
5636 mangleTemplateParameter(NTTP->getDepth(), NTTP->getIndex());
5638 = dyn_cast<TemplateTemplateParmDecl>(Pack))
5639 mangleTemplateParameter(TempTP->getDepth(), TempTP->getIndex());
5641 mangleFunctionParam(cast<ParmVarDecl>(Pack));
5645 case Expr::MaterializeTemporaryExprClass:
5646 E = cast<MaterializeTemporaryExpr>(
E)->getSubExpr();
5649 case Expr::CXXFoldExprClass: {
5651 auto *FE = cast<CXXFoldExpr>(
E);
5652 if (FE->isLeftFold())
5653 Out << (FE->getInit() ?
"fL" :
"fl");
5655 Out << (FE->getInit() ?
"fR" :
"fr");
5657 if (FE->getOperator() == BO_PtrMemD)
5665 mangleExpression(FE->getLHS());
5667 mangleExpression(FE->getRHS());
5671 case Expr::CXXThisExprClass:
5676 case Expr::CoawaitExprClass:
5679 Out <<
"v18co_await";
5680 mangleExpression(cast<CoawaitExpr>(
E)->getOperand());
5683 case Expr::DependentCoawaitExprClass:
5686 Out <<
"v18co_await";
5687 mangleExpression(cast<DependentCoawaitExpr>(
E)->getOperand());
5690 case Expr::CoyieldExprClass:
5693 Out <<
"v18co_yield";
5694 mangleExpression(cast<CoawaitExpr>(
E)->getOperand());
5696 case Expr::SYCLUniqueStableNameExprClass: {
5697 const auto *USN = cast<SYCLUniqueStableNameExpr>(
E);
5700 Out <<
"u33__builtin_sycl_unique_stable_name";
5701 mangleType(USN->getTypeSourceInfo()->getType());
5708 if (AsTemplateArg && !IsPrimaryExpr)
5740void CXXNameMangler::mangleFunctionParam(
const ParmVarDecl *parm) {
5747 assert(parmDepth < FunctionTypeDepth.getDepth());
5748 unsigned nestingDepth = FunctionTypeDepth.getDepth() - parmDepth;
5749 if (FunctionTypeDepth.isInResultType())
5752 if (nestingDepth == 0) {
5755 Out <<
"fL" << (nestingDepth - 1) <<
'p';
5763 &&
"parameter's type is still an array type?");
5766 dyn_cast<DependentAddressSpaceType>(parm->
getType())) {
5773 if (parmIndex != 0) {
5774 Out << (parmIndex - 1);
5802 llvm_unreachable(
"closure constructors don't exist for the Itanium ABI!");
5805 mangleName(InheritedFrom);
5859 if (
auto *FTD = dyn_cast_or_null<FunctionTemplateDecl>(
ResolvedTemplate)) {
5860 auto *RD = dyn_cast<CXXRecordDecl>(FTD->getDeclContext());
5861 if (!RD || !RD->isGenericLambda())
5877 if (
auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param))
5878 return TTP->hasTypeConstraint();
5895 if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param))
5896 return NTTP->getType()->isInstantiationDependentType() ||
5897 NTTP->getType()->getContainedDeducedType();
5901 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
5912 auto MangleTemplateParamListToString =
5914 unsigned DepthOffset) {
5915 llvm::raw_svector_ostream Stream(Buffer);
5916 CXXNameMangler(
Mangler.Context, Stream,
5917 WithTemplateDepthOffset{DepthOffset})
5918 .mangleTemplateParameterList(Params);
5921 MangleTemplateParamListToString(ParamTemplateHead,
5922 TTP->getTemplateParameters(), 0);
5926 MangleTemplateParamListToString(ArgTemplateHead,
5928 TTP->getTemplateParameters()->
getDepth());
5929 return ParamTemplateHead != ArgTemplateHead;
5939 return {
true,
nullptr};
5944 assert(ParamIdx < ResolvedTemplate->getTemplateParameters()->size() &&
5945 "no parameter for argument");
5966 return {
true,
nullptr};
5981 auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param);
5982 bool NeedExactType = NTTP && NTTP->getType()->getContainedDeducedType();
5983 return {NeedExactType,
nullptr};
5995void CXXNameMangler::mangleTemplateArgs(
TemplateName TN,
5997 unsigned NumTemplateArgs) {
6000 TemplateArgManglingInfo Info(*
this, TN);
6001 for (
unsigned i = 0; i != NumTemplateArgs; ++i) {
6002 mangleTemplateArg(Info, i, TemplateArgs[i].
getArgument());
6004 mangleRequiresClause(Info.getTrailingRequiresClauseToMangle());
6008void CXXNameMangler::mangleTemplateArgs(
TemplateName TN,
6012 TemplateArgManglingInfo Info(*
this, TN);
6013 for (
unsigned i = 0, e = AL.
size(); i != e; ++i) {
6014 mangleTemplateArg(Info, i, AL[i]);
6016 mangleRequiresClause(Info.getTrailingRequiresClauseToMangle());
6020void CXXNameMangler::mangleTemplateArgs(
TemplateName TN,
6024 TemplateArgManglingInfo Info(*
this, TN);
6025 for (
unsigned i = 0; i != Args.size(); ++i) {
6026 mangleTemplateArg(Info, i, Args[i]);
6028 mangleRequiresClause(Info.getTrailingRequiresClauseToMangle());
6032void CXXNameMangler::mangleTemplateArg(TemplateArgManglingInfo &Info,
6034 TemplateArgManglingInfo::Info ArgInfo = Info.getArgInfo(Index, A);
6037 if (ArgInfo.TemplateParameterToMangle &&
6038 !isCompatibleWith(LangOptions::ClangABI::Ver17)) {
6045 mangleTemplateParamDecl(ArgInfo.TemplateParameterToMangle);
6048 mangleTemplateArg(A, ArgInfo.NeedExactType);
6051void CXXNameMangler::mangleTemplateArg(
TemplateArgument A,
bool NeedExactType) {
6061 llvm_unreachable(
"Cannot mangle NULL template argument");
6088 auto *TPO = cast<TemplateParamObjectDecl>(
D);
6089 mangleValueInTemplateArg(TPO->getType().getUnqualifiedType(),
6090 TPO->getValue(),
true,
6097 if (
D->isCXXInstanceMember())
6100 else if (
D->getType()->isArrayType() &&
6103 !isCompatibleWith(LangOptions::ClangABI::Ver11))
6124 true, NeedExactType);
6130 mangleTemplateArg(
P, NeedExactType);
6136void CXXNameMangler::mangleTemplateArgExpr(
const Expr *
E) {
6137 if (!isCompatibleWith(LangOptions::ClangABI::Ver11)) {
6138 mangleExpression(
E, UnknownArity,
true);
6153 if (
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(
E)) {
6155 if (isa<VarDecl>(
D) || isa<FunctionDecl>(
D)) {
6163 mangleExpression(
E);
6176 switch (
V.getKind()) {
6184 assert(RD &&
"unexpected type for record value");
6193 if (!FD->isUnnamedBitField() &&
6203 assert(RD &&
"unexpected type for union value");
6206 if (!FD->isUnnamedBitField())
6217 for (
unsigned I = 0, N =
V.getArrayInitializedElts(); I != N; ++I)
6225 for (
unsigned I = 0, N =
V.getVectorLength(); I != N; ++I)
6235 return V.getFloat().isPosZero();
6238 return !
V.getFixedPoint().getValue();
6241 return V.getComplexFloatReal().isPosZero() &&
6242 V.getComplexFloatImag().isPosZero();
6245 return !
V.getComplexIntReal() && !
V.getComplexIntImag();
6248 return V.isNullPointer();
6251 return !
V.getMemberPointerDecl();
6254 llvm_unreachable(
"Unhandled APValue::ValueKind enum");
6261 T = AT->getElementType();
6263 dyn_cast<FieldDecl>(
E.getAsBaseOrMember().getPointer()))
6267 cast<CXXRecordDecl>(
E.getAsBaseOrMember().getPointer()));
6308 Diags.
Report(UnionLoc, DiagID);
6315 bool NeedExactType) {
6318 T = getASTContext().getUnqualifiedArrayType(
T, Quals);
6321 bool IsPrimaryExpr =
true;
6322 auto NotPrimaryExpr = [&] {
6323 if (TopLevel && IsPrimaryExpr)
6325 IsPrimaryExpr =
false;
6329 switch (
V.getKind()) {
6338 llvm_unreachable(
"unexpected value kind in template argument");
6342 assert(RD &&
"unexpected type for record value");
6348 (Fields.back()->isUnnamedBitField() ||
6350 V.getStructField(Fields.back()->getFieldIndex())))) {
6354 if (Fields.empty()) {
6355 while (!Bases.empty() &&
6357 V.getStructBase(Bases.size() - 1)))
6358 Bases = Bases.drop_back();
6365 for (
unsigned I = 0, N = Bases.size(); I != N; ++I)
6366 mangleValueInTemplateArg(Bases[I].getType(),
V.getStructBase(I),
false);
6367 for (
unsigned I = 0, N = Fields.size(); I != N; ++I) {
6368 if (Fields[I]->isUnnamedBitField())
6370 mangleValueInTemplateArg(Fields[I]->getType(),
6371 V.getStructField(Fields[I]->getFieldIndex()),
6398 mangleSourceName(II);
6399 mangleValueInTemplateArg(FD->
getType(),
V.getUnionValue(),
false);
6413 unsigned N =
V.getArraySize();
6415 N =
V.getArrayInitializedElts();
6420 for (
unsigned I = 0; I != N; ++I) {
6421 const APValue &Elem = I <
V.getArrayInitializedElts()
6422 ?
V.getArrayInitializedElt(I)
6423 :
V.getArrayFiller();
6424 mangleValueInTemplateArg(ElemT, Elem,
false);
6436 unsigned N =
V.getVectorLength();
6439 for (
unsigned I = 0; I != N; ++I)
6440 mangleValueInTemplateArg(VT->
getElementType(),
V.getVectorElt(I),
false);
6446 mangleIntegerLiteral(
T,
V.getInt());
6450 mangleFloatLiteral(
T,
V.getFloat());
6454 mangleFixedPointLiteral();
6462 if (!
V.getComplexFloatReal().isPosZero() ||
6463 !
V.getComplexFloatImag().isPosZero())
6465 if (!
V.getComplexFloatImag().isPosZero())
6476 if (
V.getComplexIntReal().getBoolValue() ||
6477 V.getComplexIntImag().getBoolValue())
6479 if (
V.getComplexIntImag().getBoolValue())
6488 "unexpected type for LValue template arg");
6490 if (
V.isNullPointer()) {
6491 mangleNullPointer(
T);
6500 if (Offset.isZero()) {
6512 Out << Offset.getQuantity() <<
'E';
6520 if (!
V.hasLValuePath()) {
6536 bool IsArrayToPointerDecayMangledAsDecl =
false;
6537 if (TopLevel && Ctx.
getLangOpts().getClangABICompat() <=
6538 LangOptions::ClangABI::Ver11) {
6540 IsArrayToPointerDecayMangledAsDecl =
6541 BType->
isArrayType() &&
V.getLValuePath().size() == 1 &&
6542 V.getLValuePath()[0].getAsArrayIndex() == 0 &&
6546 if ((!
V.getLValuePath().empty() ||
V.isLValueOnePastTheEnd()) &&
6547 !IsArrayToPointerDecayMangledAsDecl) {
6564 if (NeedExactType &&
6566 !isCompatibleWith(LangOptions::ClangABI::Ver11)) {
6586 mangleExpression(
E);
6590 mangleType(
QualType(TI.getType(), 0));
6593 llvm_unreachable(
"unexpected lvalue base kind in template argument");
6603 mangleNumber(
V.getLValueOffset().getQuantity());
6610 if (!
V.getLValueOffset().isZero())
6611 mangleNumber(
V.getLValueOffset().getQuantity());
6615 bool OnePastTheEnd =
V.isLValueOnePastTheEnd();
6619 if (
auto *CAT = dyn_cast<ConstantArrayType>(AT))
6620 OnePastTheEnd |= CAT->getSize() ==
E.getAsArrayIndex();
6621 TypeSoFar = AT->getElementType();
6623 const Decl *
D =
E.getAsBaseOrMember().getPointer();
6624 if (
auto *FD = dyn_cast<FieldDecl>(
D)) {
6649 if (!
V.getMemberPointerDecl()) {
6650 mangleNullPointer(
T);
6657 if (!
V.getMemberPointerPath().empty()) {
6660 }
else if (NeedExactType &&
6663 V.getMemberPointerDecl()->getType()) &&
6664 !isCompatibleWith(LangOptions::ClangABI::Ver11)) {
6669 mangle(
V.getMemberPointerDecl());
6671 if (!
V.getMemberPointerPath().empty()) {
6674 if (!Offset.isZero())
6675 mangleNumber(Offset.getQuantity());
6681 if (TopLevel && !IsPrimaryExpr)
6685void CXXNameMangler::mangleTemplateParameter(
unsigned Depth,
unsigned Index) {
6695 Depth += TemplateDepthOffset;
6697 Out <<
'L' << (Depth - 1) <<
'_';
6703void CXXNameMangler::mangleSeqID(
unsigned SeqID) {
6706 }
else if (SeqID == 1) {
6716 for (; SeqID != 0; SeqID /= 36) {
6717 unsigned C = SeqID % 36;
6718 *I++ = (
C < 10 ?
'0' +
C :
'A' +
C - 10);
6721 Out.write(I.base(), I - BufferRef.rbegin());
6726void CXXNameMangler::mangleExistingSubstitution(
TemplateName tname) {
6727 bool result = mangleSubstitution(tname);
6728 assert(result &&
"no existing substitution for template name");
6734bool CXXNameMangler::mangleSubstitution(
const NamedDecl *ND) {
6736 if (mangleStandardSubstitution(ND))
6740 return mangleSubstitution(
reinterpret_cast<uintptr_t>(ND));
6745 "mangleSubstitution(NestedNameSpecifier *) is only used for "
6746 "identifier nested name specifiers.");
6748 return mangleSubstitution(
reinterpret_cast<uintptr_t>(NNS));
6758bool CXXNameMangler::mangleSubstitution(
QualType T) {
6761 return mangleSubstitution(RT->getDecl());
6766 return mangleSubstitution(TypePtr);
6769bool CXXNameMangler::mangleSubstitution(
TemplateName Template) {
6771 return mangleSubstitution(TD);
6774 return mangleSubstitution(
6778bool CXXNameMangler::mangleSubstitution(
uintptr_t Ptr) {
6779 llvm::DenseMap<uintptr_t, unsigned>::iterator I = Substitutions.find(Ptr);
6780 if (I == Substitutions.end())
6783 unsigned SeqID = I->second;
6792bool CXXNameMangler::isSpecializedAs(
QualType S, llvm::StringRef Name,
6802 dyn_cast<ClassTemplateSpecializationDecl>(RT->
getDecl());
6806 if (!isStdNamespace(Context.getEffectiveDeclContext(SD)))
6810 if (TemplateArgs.
size() != 1)
6813 if (TemplateArgs[0].getAsType() != A)
6825bool CXXNameMangler::isStdCharSpecialization(
6827 bool HasAllocator) {
6832 if (TemplateArgs.
size() != (HasAllocator ? 3 : 2))
6835 QualType A = TemplateArgs[0].getAsType();
6843 if (!isSpecializedAs(TemplateArgs[1].getAsType(),
"char_traits", A))
6847 !isSpecializedAs(TemplateArgs[2].getAsType(),
"allocator", A))
6856bool CXXNameMangler::mangleStandardSubstitution(
const NamedDecl *ND) {
6858 if (
const NamespaceDecl *NS = dyn_cast<NamespaceDecl>(ND)) {
6867 if (!isStdNamespace(Context.getEffectiveDeclContext(TD)))
6888 dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
6889 if (!isStdNamespace(Context.getEffectiveDeclContext(SD)))
6898 if (isStdCharSpecialization(SD,
"basic_string",
true)) {
6905 if (isStdCharSpecialization(SD,
"basic_istream",
false)) {
6912 if (isStdCharSpecialization(SD,
"basic_ostream",
false)) {
6919 if (isStdCharSpecialization(SD,
"basic_iostream",
false)) {
6929void CXXNameMangler::addSubstitution(
QualType T) {
6932 addSubstitution(RT->
getDecl());
6938 addSubstitution(TypePtr);
6941void CXXNameMangler::addSubstitution(
TemplateName Template) {
6943 return addSubstitution(TD);
6949void CXXNameMangler::addSubstitution(
uintptr_t Ptr) {
6950 assert(!Substitutions.count(Ptr) &&
"Substitution already exists!");
6951 Substitutions[Ptr] = SeqID++;
6954void CXXNameMangler::extendSubstitutions(CXXNameMangler*
Other) {
6955 assert(
Other->SeqID >= SeqID &&
"Must be superset of substitutions!");
6956 if (
Other->SeqID > SeqID) {
6957 Substitutions.swap(
Other->Substitutions);
6958 SeqID =
Other->SeqID;
6963CXXNameMangler::makeFunctionReturnTypeTags(
const FunctionDecl *FD) {
6965 if (DisableDerivedAbiTags)
6966 return AbiTagList();
6968 llvm::raw_null_ostream NullOutStream;
6969 CXXNameMangler TrackReturnTypeTags(*
this, NullOutStream);
6970 TrackReturnTypeTags.disableDerivedAbiTags();
6974 FunctionTypeDepthState saved = TrackReturnTypeTags.FunctionTypeDepth.push();
6975 TrackReturnTypeTags.FunctionTypeDepth.enterResultType();
6977 TrackReturnTypeTags.FunctionTypeDepth.leaveResultType();
6978 TrackReturnTypeTags.FunctionTypeDepth.pop(saved);
6980 return TrackReturnTypeTags.AbiTagsRoot.getSortedUniqueUsedAbiTags();
6984CXXNameMangler::makeVariableTypeTags(
const VarDecl *VD) {
6986 if (DisableDerivedAbiTags)
6987 return AbiTagList();
6989 llvm::raw_null_ostream NullOutStream;
6990 CXXNameMangler TrackVariableType(*
this, NullOutStream);
6991 TrackVariableType.disableDerivedAbiTags();
6993 TrackVariableType.mangleType(VD->
getType());
6995 return TrackVariableType.AbiTagsRoot.getSortedUniqueUsedAbiTags();
6998bool CXXNameMangler::shouldHaveAbiTags(ItaniumMangleContextImpl &
C,
7000 llvm::raw_null_ostream NullOutStream;
7001 CXXNameMangler TrackAbiTags(
C, NullOutStream,
nullptr,
true);
7002 TrackAbiTags.mangle(VD);
7003 return TrackAbiTags.AbiTagsRoot.getUsedAbiTags().size();
7016void ItaniumMangleContextImpl::mangleCXXName(
GlobalDecl GD,
7019 assert((isa<FunctionDecl, VarDecl, TemplateParamObjectDecl>(
D)) &&
7020 "Invalid mangleName() call, argument is not a variable or function!");
7023 getASTContext().getSourceManager(),
7024 "Mangling declaration");
7026 if (
auto *CD = dyn_cast<CXXConstructorDecl>(
D)) {
7028 CXXNameMangler Mangler(*
this, Out, CD,
Type);
7032 if (
auto *DD = dyn_cast<CXXDestructorDecl>(
D)) {
7034 CXXNameMangler Mangler(*
this, Out, DD,
Type);
7038 CXXNameMangler Mangler(*
this, Out,
D);
7076 unsigned TypedDiscriminator =
7078 Mangler.mangleVendorQualifier(
"__vtptrauth");
7079 auto &ManglerStream = Mangler.getStream();
7080 ManglerStream <<
"I";
7081 if (
const auto *ExplicitAuth =
7082 PtrauthClassRD->
getAttr<VTablePointerAuthenticationAttr>()) {
7083 ManglerStream <<
"Lj" << ExplicitAuth->getKey();
7085 if (ExplicitAuth->getAddressDiscrimination() ==
7086 VTablePointerAuthenticationAttr::DefaultAddressDiscrimination)
7087 ManglerStream <<
"Lb" << LangOpts.PointerAuthVTPtrAddressDiscrimination;
7089 ManglerStream <<
"Lb"
7090 << (ExplicitAuth->getAddressDiscrimination() ==
7091 VTablePointerAuthenticationAttr::AddressDiscrimination);
7093 switch (ExplicitAuth->getExtraDiscrimination()) {
7094 case VTablePointerAuthenticationAttr::DefaultExtraDiscrimination: {
7095 if (LangOpts.PointerAuthVTPtrTypeDiscrimination)
7096 ManglerStream <<
"Lj" << TypedDiscriminator;
7098 ManglerStream <<
"Lj" << 0;
7101 case VTablePointerAuthenticationAttr::TypeDiscrimination:
7102 ManglerStream <<
"Lj" << TypedDiscriminator;
7104 case VTablePointerAuthenticationAttr::CustomDiscrimination:
7105 ManglerStream <<
"Lj" << ExplicitAuth->getCustomDiscriminationValue();
7107 case VTablePointerAuthenticationAttr::NoExtraDiscrimination:
7108 ManglerStream <<
"Lj" << 0;
7112 ManglerStream <<
"Lj"
7113 << (
unsigned)VTablePointerAuthenticationAttr::DefaultKey;
7114 ManglerStream <<
"Lb" << LangOpts.PointerAuthVTPtrAddressDiscrimination;
7115 if (LangOpts.PointerAuthVTPtrTypeDiscrimination)
7116 ManglerStream <<
"Lj" << TypedDiscriminator;
7118 ManglerStream <<
"Lj" << 0;
7120 ManglerStream <<
"E";
7123void ItaniumMangleContextImpl::mangleThunk(
const CXXMethodDecl *MD,
7125 bool ElideOverrideInfo,
7134 assert(!isa<CXXDestructorDecl>(MD) &&
7135 "Use mangleCXXDtor for destructor decls!");
7136 CXXNameMangler Mangler(*
this, Out);
7137 Mangler.getStream() <<
"_ZT";
7139 Mangler.getStream() <<
'c';
7150 Mangler.mangleFunctionEncoding(MD);
7151 if (!ElideOverrideInfo)
7158 bool ElideOverrideInfo,
7162 CXXNameMangler Mangler(*
this, Out, DD,
Type);
7163 Mangler.getStream() <<
"_ZT";
7171 if (!ElideOverrideInfo)
7176void ItaniumMangleContextImpl::mangleStaticGuardVariable(
const VarDecl *
D,
7180 CXXNameMangler Mangler(*
this, Out);
7183 Mangler.getStream() <<
"_ZGV";
7184 Mangler.mangleName(
D);
7187void ItaniumMangleContextImpl::mangleDynamicInitializer(
const VarDecl *MD,
7192 Out <<
"__cxx_global_var_init";
7195void ItaniumMangleContextImpl::mangleDynamicAtExitDestructor(
const VarDecl *
D,
7198 CXXNameMangler Mangler(*
this, Out);
7199 Mangler.getStream() <<
"__dtor_";
7200 if (shouldMangleDeclName(
D))
7203 Mangler.getStream() <<
D->getName();
7206void ItaniumMangleContextImpl::mangleDynamicStermFinalizer(
const VarDecl *
D,
7210 CXXNameMangler Mangler(*
this, Out);
7211 Mangler.getStream() <<
"__finalize_";
7212 if (shouldMangleDeclName(
D))
7215 Mangler.getStream() <<
D->getName();
7218void ItaniumMangleContextImpl::mangleSEHFilterExpression(
7219 GlobalDecl EnclosingDecl, raw_ostream &Out) {
7220 CXXNameMangler Mangler(*
this, Out);
7221 Mangler.getStream() <<
"__filt_";
7222 auto *EnclosingFD = cast<FunctionDecl>(EnclosingDecl.
getDecl());
7223 if (shouldMangleDeclName(EnclosingFD))
7224 Mangler.mangle(EnclosingDecl);
7226 Mangler.getStream() << EnclosingFD->getName();
7229void ItaniumMangleContextImpl::mangleSEHFinallyBlock(
7230 GlobalDecl EnclosingDecl, raw_ostream &Out) {
7231 CXXNameMangler Mangler(*
this, Out);
7232 Mangler.getStream() <<
"__fin_";
7233 auto *EnclosingFD = cast<FunctionDecl>(EnclosingDecl.
getDecl());
7234 if (shouldMangleDeclName(EnclosingFD))
7235 Mangler.mangle(EnclosingDecl);
7237 Mangler.getStream() << EnclosingFD->getName();
7240void ItaniumMangleContextImpl::mangleItaniumThreadLocalInit(
const VarDecl *
D,
7243 CXXNameMangler Mangler(*
this, Out);
7244 Mangler.getStream() <<
"_ZTH";
7245 Mangler.mangleName(
D);
7249ItaniumMangleContextImpl::mangleItaniumThreadLocalWrapper(
const VarDecl *
D,
7252 CXXNameMangler Mangler(*
this, Out);
7253 Mangler.getStream() <<
"_ZTW";
7254 Mangler.mangleName(
D);
7257void ItaniumMangleContextImpl::mangleReferenceTemporary(
const VarDecl *
D,
7258 unsigned ManglingNumber,
7262 CXXNameMangler Mangler(*
this, Out);
7263 Mangler.getStream() <<
"_ZGR";
7264 Mangler.mangleName(
D);
7265 assert(ManglingNumber > 0 &&
"Reference temporary mangling number is zero!");
7266 Mangler.mangleSeqID(ManglingNumber - 1);
7269void ItaniumMangleContextImpl::mangleCXXVTable(
const CXXRecordDecl *RD,
7272 CXXNameMangler Mangler(*
this, Out);
7273 Mangler.getStream() <<
"_ZTV";
7274 Mangler.mangleNameOrStandardSubstitution(RD);
7277void ItaniumMangleContextImpl::mangleCXXVTT(
const CXXRecordDecl *RD,
7280 CXXNameMangler Mangler(*
this, Out);
7281 Mangler.getStream() <<
"_ZTT";
7282 Mangler.mangleNameOrStandardSubstitution(RD);
7285void ItaniumMangleContextImpl::mangleCXXCtorVTable(
const CXXRecordDecl *RD,
7290 CXXNameMangler Mangler(*
this, Out);
7291 Mangler.getStream() <<
"_ZTC";
7292 Mangler.mangleNameOrStandardSubstitution(RD);
7293 Mangler.getStream() << Offset;
7294 Mangler.getStream() <<
'_';
7295 Mangler.mangleNameOrStandardSubstitution(
Type);
7298void ItaniumMangleContextImpl::mangleCXXRTTI(
QualType Ty, raw_ostream &Out) {
7300 assert(!Ty.
hasQualifiers() &&
"RTTI info cannot have top-level qualifiers");
7301 CXXNameMangler Mangler(*
this, Out);
7302 Mangler.getStream() <<
"_ZTI";
7303 Mangler.mangleType(Ty);
7306void ItaniumMangleContextImpl::mangleCXXRTTIName(
7307 QualType Ty, raw_ostream &Out,
bool NormalizeIntegers =
false) {
7309 CXXNameMangler Mangler(*
this, Out, NormalizeIntegers);
7310 Mangler.getStream() <<
"_ZTS";
7311 Mangler.mangleType(Ty);
7314void ItaniumMangleContextImpl::mangleCanonicalTypeName(
7315 QualType Ty, raw_ostream &Out,
bool NormalizeIntegers =
false) {
7316 mangleCXXRTTIName(Ty, Out, NormalizeIntegers);
7319void ItaniumMangleContextImpl::mangleStringLiteral(
const StringLiteral *, raw_ostream &) {
7320 llvm_unreachable(
"Can't mangle string literals");
7323void ItaniumMangleContextImpl::mangleLambdaSig(
const CXXRecordDecl *Lambda,
7325 CXXNameMangler Mangler(*
this, Out);
7326 Mangler.mangleLambdaSig(Lambda);
7329void ItaniumMangleContextImpl::mangleModuleInitializer(
const Module *M,
7332 CXXNameMangler Mangler(*
this, Out);
7333 Mangler.getStream() <<
"_ZGI";
7337 auto Partition = M->
Name.find(
':');
7338 Mangler.mangleModuleNamePrefix(
7339 StringRef(&M->
Name[Partition + 1], M->
Name.size() - Partition - 1),
7347 return new ItaniumMangleContextImpl(
7350 return std::nullopt;
7359 return new ItaniumMangleContextImpl(Context, Diags, DiscriminatorOverride,
Enums/classes describing ABI related information about constructors, destructors and thunks.
Defines the clang::ASTContext interface.
enum clang::sema::@1651::IndirectLocalPathEntry::EntryKind Kind
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
static bool isTypeSubstitutable(Qualifiers Quals, const Type *Ty, ASTContext &Ctx)
static IdentifierInfo * getUnionInitName(SourceLocation UnionLoc, DiagnosticsEngine &Diags, const FieldDecl *FD)
static bool hasMangledSubstitutionQualifiers(QualType T)
Determine whether the given type has any qualifiers that are relevant for substitutions.
static GlobalDecl getParentOfLocalEntity(const DeclContext *DC)
static StringRef mangleAArch64VectorBase(const BuiltinType *EltType)
static void mangleOverrideDiscrimination(CXXNameMangler &Mangler, ASTContext &Context, const ThunkInfo &Thunk)
Mangles the pointer authentication override attribute for classes that have explicit overrides for th...
static bool isZeroInitialized(QualType T, const APValue &V)
Determine whether a given value is equivalent to zero-initialization for the purpose of discarding a ...
static const GlobalDecl isTemplate(GlobalDecl GD, const TemplateArgumentList *&TemplateArgs)
static bool isParenthesizedADLCallee(const CallExpr *call)
Look at the callee of the given call expression and determine if it's a parenthesized id-expression w...
static TemplateName asTemplateName(GlobalDecl GD)
static QualType getLValueType(ASTContext &Ctx, const APValue &LV)
llvm::MachO::Target Target
llvm::MachO::Record Record
Defines the clang::Module class, which describes a module in the source code.
static StringRef getIdentifier(const Token &Tok)
Defines the SourceManager interface.
Enums/classes describing THUNK related information about constructors, destructors and thunks.
Defines the clang::TypeLoc interface and its subclasses.
static const TemplateArgument & getArgument(const TemplateArgument &A)
A non-discriminated union of a base, field, or array index.
static LValuePathEntry ArrayIndex(uint64_t Index)
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
const LValueBase getLValueBase() const
ArrayRef< LValuePathEntry > getLValuePath() const
@ Indeterminate
This object has an indeterminate value (C++ [basic.indet]).
@ None
There is no such object (it's outside its lifetime).
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
unsigned getManglingNumber(const NamedDecl *ND, bool ForAuxTarget=false) const
bool hasSimilarType(QualType T1, QualType T2)
Determine if two types are similar, according to the C++ rules.
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
TemplateName getCanonicalTemplateName(const TemplateName &Name) const
Retrieves the "canonical" template name that refers to a given template.
CharUnits getMemberPointerPathAdjustment(const APValue &MP) const
Find the 'this' offset for the member path in a pointer-to-member APValue.
QualType getRecordType(const RecordDecl *Decl) const
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
const LangOptions & getLangOpts() const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
bool addressSpaceMapManglingFor(LangAS AS) const
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
const CXXRecordDecl * baseForVTableAuthentication(const CXXRecordDecl *ThisClass)
Resolve the root record to be used to derive the vtable pointer authentication policy for the specifi...
unsigned getTargetAddressSpace(LangAS AS) const
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
uint16_t getPointerAuthVTablePointerDiscriminator(const CXXRecordDecl *RD)
Return the "other" discriminator used for the pointer auth schema used for vtable pointers in instanc...
Represents a constant array type that does not decay to a pointer when used as a function parameter.
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Attr - This represents one attribute.
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
A builtin binary operation expression such as "x + y" or "x <= y".
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given binary opcode.
A binding in a decomposition declaration.
A fixed int type of a specified bitwidth.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
This class is used for builtin types like 'int'.
Represents a base class of a C++ class.
Represents a call to a C++ constructor.
Represents a C++ constructor within a class.
Represents a delete expression for memory deallocation and destructor calls, e.g.
bool isGlobalDelete() const
Represents a C++ member access expression where the actual member referenced could not be resolved be...
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the member name.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
NamedDecl * getFirstQualifierFoundInScope() const
Retrieve the first part of the nested-name-specifier that was found in the scope of the member access...
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
bool isImplicitAccess() const
True if this is an implicit access, i.e.
Represents a C++ destructor within a class.
Represents a static or instance method of a struct/union/class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
QualType getAllocatedType() const
arg_iterator placement_arg_end()
CXXNewInitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
bool hasInitializer() const
Whether this new-expression has any initializer at all.
arg_iterator placement_arg_begin()
Expr * getInitializer()
The initializer of this new-expression.
A call to an overloaded operator written using operator syntax.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Represents a C++ struct/union/class.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
TemplateParameterList * getGenericLambdaTemplateParameterList() const
Retrieve the generic lambda's template parameter list.
base_class_iterator bases_end()
bool isLambda() const
Determine whether this class describes a lambda function object.
unsigned getLambdaManglingNumber() const
If this is the closure type of a lambda expression, retrieve the number to be used for name mangling ...
base_class_iterator bases_begin()
TypeSourceInfo * getLambdaTypeInfo() const
ArrayRef< NamedDecl * > getLambdaExplicitTemplateParameters() const
Retrieve the lambda template parameters that were specified explicitly.
CXXMethodDecl * getLambdaStaticInvoker() const
Retrieve the lambda static invoker, the address of which is returned by the conversion operator,...
A C++ throw-expression (C++ [except.throw]).
const Expr * getSubExpr() const
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
bool isTypeOperand() const
Expr * getExprOperand() const
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
bool isListInitialization() const
Determine whether this expression models list-initialization.
Expr * getArg(unsigned I)
unsigned getNumArgs() const
Retrieve the number of arguments.
A Microsoft C++ __uuidof expression, which gets the _GUID that corresponds to the supplied type or ex...
Expr * getExprOperand() const
QualType getTypeOperand(ASTContext &Context) const
Retrieves the type operand of this __uuidof() expression after various required adjustments (removing...
bool isTypeOperand() const
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
CharUnits - This is an opaque type for sizes expressed in character units.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
Complex values, per C99 6.2.5p11.
QualType getElementType() const
Declaration of a C++20 concept.
ConditionalOperator - The ?: ternary operator.
Expr * getCond() const
getCond - Return the expression representing the condition for the ?: operator.
Represents the canonical version of C arrays with a specified constant size.
Represents a concrete matrix type with constant number of rows and columns.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isFileContext() const
bool isTranslationUnit() const
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
bool isFunctionOrMethod() const
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
bool isParameterPack() const
Whether this declaration is a parameter pack.
SourceLocation getLocation() const
void setImplicit(bool I=true)
DeclContext * getDeclContext()
bool isInAnonymousNamespace() const
Module * getOwningModuleForLinkage() const
Get the module that owns this declaration for linkage purposes.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
The name of a declaration.
@ CXXConversionFunctionName
Expr * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
Represents the type decltype(expr) (C++11).
Represents a C++17 deduced template specialization type.
Represents an extended address space qualifier where the input address space value is dependent.
Expr * getAddrSpaceExpr() const
QualType getPointeeType() const
Represents a qualified type name for which the type name is dependent.
A qualified reference to a name whose declaration cannot yet be resolved.
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies this declaration.
unsigned getNumTemplateArgs() const
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
TemplateArgumentLoc const * getTemplateArgs() const
Represents an array type in C++ whose size is a value-dependent expression.
Represents an extended vector type where either the type or size is dependent.
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Represents a dependent template name that cannot be resolved prior to template instantiation.
Represents a template specialization type whose template cannot be resolved, e.g.
const IdentifierInfo * getIdentifier() const
ArrayRef< TemplateArgument > template_arguments() const
NestedNameSpecifier * getQualifier() const
Represents a vector type where either the type or size is dependent.
Designator - A designator in a C99 designated initializer.
bool isArrayDesignator() const
bool isArrayRangeDesignator() const
bool isFieldDesignator() const
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
An instance of this object exists for each enum constant that is defined.
llvm::APSInt getInitVal() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
ExplicitCastExpr - An explicit cast written in the source code.
This represents one expression.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
EvaluateKnownConstInt - Call EvaluateAsRValue and return the folded integer.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
ExtVectorType - Extended vector type.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
llvm::APFloat getValue() const
Represents a function declaration or definition.
const ParmVarDecl * getParamDecl(unsigned i) const
bool isMemberLikeConstrainedFriend() const
Determine whether a function is a friend function that cannot be redeclared outside of its class,...
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
VarDecl * getParameterPack() const
Get the parameter pack which this expression refers to.
Represents a prototype with parameter type info, e.g.
ExtParameterInfo getExtParameterInfo(unsigned I) const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
unsigned getNumParams() const
Qualifiers getMethodQuals() const
QualType getParamType(unsigned i) const
bool isVariadic() const
Whether this function prototype is variadic.
Expr * getNoexceptExpr() const
Return the expression inside noexcept(expression), or a null pointer if there is none (because the ex...
bool isNothrow(bool ResultIfDependent=false) const
Determine whether this function type has a non-throwing exception specification.
ArrayRef< QualType > exceptions() const
bool hasInstantiationDependentExceptionSpec() const
Return whether this function has an instantiation-dependent exception spec.
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type?
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
Declaration of a template function.
A class which abstracts out some details necessary for making a call.
CallingConv getCC() const
bool getProducesResult() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
bool isConsumed() const
Is this parameter considered "consumed" by Objective-C ARC? Consumed parameters must have retainable ...
ParameterABI getABI() const
Return the ABI treatment of this parameter.
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
QualType getReturnType() const
GlobalDecl - represents a global declaration.
CXXCtorType getCtorType() const
KernelReferenceKind getKernelReferenceKind() const
GlobalDecl getWithDecl(const Decl *D)
CXXDtorType getDtorType() const
const Decl * getDecl() const
One of these records is kept for each identifier that is lexed.
unsigned getLength() const
Efficiently return the length of this identifier info.
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
StringRef getName() const
Return the actual identifier string.
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1....
const Expr * getSubExpr() const
Represents a C array with an unspecified size.
Represents a field injected from an anonymous union/struct into the parent scope.
Describes an C or C++ initializer list.
unsigned getNumInits() const
InitListExpr * getSyntacticForm() const
const Expr * getInit(unsigned Init) const
The injected class name of a C++ class template or class template partial specialization.
virtual DiscriminatorOverrideTy getDiscriminatorOverride() const =0
virtual void mangleDynamicStermFinalizer(const VarDecl *D, raw_ostream &)=0
virtual void mangleCXXVTT(const CXXRecordDecl *RD, raw_ostream &)=0
virtual void mangleItaniumThreadLocalInit(const VarDecl *D, raw_ostream &)=0
virtual void mangleCXXCtorComdat(const CXXConstructorDecl *D, raw_ostream &)=0
virtual void mangleLambdaSig(const CXXRecordDecl *Lambda, raw_ostream &)=0
virtual void mangleCXXDtorComdat(const CXXDestructorDecl *D, raw_ostream &)=0
virtual void mangleItaniumThreadLocalWrapper(const VarDecl *D, raw_ostream &)=0
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
virtual void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset, const CXXRecordDecl *Type, raw_ostream &)=0
virtual void mangleModuleInitializer(const Module *Module, raw_ostream &)=0
std::optional< unsigned >(*)(ASTContext &, const NamedDecl *) DiscriminatorOverrideTy
An lvalue reference type, per C++11 [dcl.ref].
ClangABI
Clang versions with different platform ABI conformance.
virtual void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type, const ThunkInfo &Thunk, bool ElideOverrideInfo, raw_ostream &)=0
virtual void mangleCXXRTTI(QualType T, raw_ostream &)=0
virtual std::string getLambdaString(const CXXRecordDecl *Lambda)=0
virtual bool shouldMangleStringLiteral(const StringLiteral *SL)=0
ASTContext & getASTContext() const
uint64_t getAnonymousStructIdForDebugInfo(const NamedDecl *D)
virtual void mangleDynamicAtExitDestructor(const VarDecl *D, raw_ostream &)=0
virtual bool isUniqueInternalLinkageDecl(const NamedDecl *ND)
virtual void mangleSEHFilterExpression(GlobalDecl EnclosingDecl, raw_ostream &Out)=0
virtual void mangleThunk(const CXXMethodDecl *MD, const ThunkInfo &Thunk, bool ElideOverrideInfo, raw_ostream &)=0
virtual void mangleCanonicalTypeName(QualType T, raw_ostream &, bool NormalizeIntegers=false)=0
Generates a unique string for an externally visible type for use with TBAA or type uniquing.
virtual void mangleStringLiteral(const StringLiteral *SL, raw_ostream &)=0
virtual void mangleCXXName(GlobalDecl GD, raw_ostream &)=0
virtual void needsUniqueInternalLinkageNames()
virtual void mangleReferenceTemporary(const VarDecl *D, unsigned ManglingNumber, raw_ostream &)=0
virtual bool shouldMangleCXXName(const NamedDecl *D)=0
virtual void mangleCXXRTTIName(QualType T, raw_ostream &, bool NormalizeIntegers=false)=0
virtual void mangleDynamicInitializer(const VarDecl *D, raw_ostream &)=0
virtual void mangleCXXVTable(const CXXRecordDecl *RD, raw_ostream &)=0
virtual void mangleSEHFinallyBlock(GlobalDecl EnclosingDecl, raw_ostream &Out)=0
virtual void mangleStaticGuardVariable(const VarDecl *D, raw_ostream &)=0
MatrixSubscriptExpr - Matrix subscript expression for the MatrixType extension.
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
const TemplateArgumentLoc * getTemplateArgs() const
Retrieve the template arguments provided as part of this template-id.
unsigned getNumTemplateArgs() const
Retrieve the number of template arguments provided as part of this template-id.
NestedNameSpecifier * getQualifier() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name.
A pointer to member type per C++ 8.3.3 - Pointers to members.
QualType getPointeeType() const
Describes a module or submodule.
std::string Name
The name of this module.
StringRef getPrimaryModuleInterfaceName() const
Get the primary module interface name from a partition.
bool isModulePartition() const
Is this a module partition.
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
DeclarationName getDeclName() const
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.
bool hasLinkage() const
Determine whether this declaration has linkage.
bool isExternallyVisible() const
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Represent a C++ namespace.
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
unsigned getDepth() const
Get the nesting depth of the template parameter.
Interfaces are the core concept in Objective-C for object oriented design.
ObjCMethodDecl - Represents an instance or class method declaration.
Represents a pointer to an Objective C object.
Represents a class type in Objective C.
NestedNameSpecifier * getQualifier() const
Fetches the nested-name qualifier, if one was given.
decls_iterator decls_begin() const
unsigned getNumDecls() const
Gets the number of declarations in the unresolved set.
TemplateArgumentLoc const * getTemplateArgs() const
unsigned getNumTemplateArgs() const
DeclarationName getName() const
Gets the name looked up.
Represents a pack expansion of types.
A single parameter index whose accessors require each use to make explicit the parameter index encodi...
Represents a parameter to a function.
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
unsigned getFunctionScopeDepth() const
PointerType - C99 6.7.5.1 - Pointer Declarators.
PrettyStackTraceDecl - If a crash occurs, indicate that it happened when doing something to a specifi...
A (possibly-)qualified type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
bool hasUnaligned() const
bool hasAddressSpace() const
ObjCLifetime getObjCLifetime() const
LangAS getAddressSpace() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
bool isLambda() const
Determine whether this record is a class describing a lambda function object.
const FieldDecl * findFirstNamedDataMember() const
Finds the first data member which has a name.
field_range fields() const
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Encodes a location in the source.
StmtClass getStmtClass() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
const char * getStmtClassName() const
StringLiteral - This represents a string literal expression, e.g.
A structure for storing the information associated with a substituted template template parameter.
TemplateName getReplacement() const
Represents the result of substituting a set of types for a template type parameter pack.
Represents the declaration of a struct/union/class/enum.
TypedefNameDecl * getTypedefNameForAnonDecl() const
Exposes information about the current target.
virtual const char * getFloat128Mangling() const
Return the mangled code of __float128.
virtual const char * getIbm128Mangling() const
Return the mangled code of __ibm128.
virtual const char * getLongDoubleMangling() const
Return the mangled code of long double.
virtual const char * getBFloat16Mangling() const
Return the mangled code of bfloat.
A template argument list.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
bool isDependent() const
Whether this template argument is dependent on a template parameter such that its result can change f...
bool isInstantiationDependent() const
Whether this template argument is dependent on a template parameter.
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
QualType getAsType() const
Retrieve the type for a type template argument.
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
QualType getIntegralType() const
Retrieve the type of the integral value.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
bool isPackExpansion() const
Determine whether this template argument is a pack expansion.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
A template parameter object.
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
unsigned getDepth() const
Get the depth of this template parameter list in the set of template parameter lists.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
Represents a type template specialization; the template must be a class template, a type alias templa...
ArrayRef< TemplateArgument > template_arguments() const
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
ConceptDecl * getNamedConcept() const
Symbolic representation of typeid(T) for some type T.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
A container of type source information.
QualType getType() const
Return the type wrapped by this type source info.
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
TypeTrait getTrait() const
Determine which type trait this expression uses.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBooleanType() const
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isDependentAddressSpaceType() const
bool isVoidPointerType() const
bool isPointerType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isSVESizelessBuiltinType() const
Returns true for SVE scalable vector types.
const T * castAs() const
Member-template castAs<specific type>.
bool isReferenceType() const
const CXXRecordDecl * getPointeeCXXRecordDecl() const
If this is a pointer or reference to a RecordType, return the CXXRecordDecl that the type refers to.
const Type * getArrayElementTypeNoTypeQual() const
If this is an array type, return the element type of the array, potentially with type qualifiers miss...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isOpenCLSpecificType() const
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
TypeClass getTypeClass() const
const T * getAs() const
Member-template getAs<specific type>'.
bool isRecordType() const
Base class for declarations which introduce a typedef-name.
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand.
QualType getArgumentType() const
bool isArgumentType() const
UnaryExprOrTypeTrait getKind() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
Expr * getSubExpr() const
static OverloadedOperatorKind getOverloadedOperator(Opcode Opc)
Retrieve the overloaded operator kind that corresponds to the given unary opcode.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
DeclarationName getMemberName() const
Retrieve the name of the member that this expression refers to.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '.
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void print(llvm::raw_ostream &Out) const
Represents a variable declaration or definition.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a C array with a specified size that is not an integer-constant-expression.
Represents a GCC generic vector type.
QualType getElementType() const
A static requirement that can be used in a requires-expression to check properties of types and expre...
RequirementKind getKind() const
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool Sub(InterpState &S, CodePtr OpPC)
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
@ OO_None
Not an overloaded operator.
@ NUM_OVERLOADED_OPERATORS
CXXCtorType
C++ constructor types.
@ Ctor_Base
Base object ctor.
@ Ctor_DefaultClosure
Default closure variant of a ctor.
@ Ctor_CopyingClosure
Copying closure variant of a ctor.
@ Ctor_Complete
Complete object ctor.
@ Ctor_Comdat
The COMDAT used for ctors.
llvm::StringRef getParameterABISpelling(ParameterABI kind)
RefQualifierKind
The kind of C++11 ref-qualifier associated with a function type.
@ RQ_None
No ref-qualifier was provided.
@ RQ_LValue
An lvalue ref-qualifier was provided (&).
@ RQ_RValue
An rvalue ref-qualifier was provided (&&).
LanguageLinkage
Describes the different kinds of language linkage (C++ [dcl.link]) that an entity may have.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
CXXDtorType
C++ destructor types.
@ Dtor_Comdat
The COMDAT used for dtors.
@ Dtor_Base
Base object dtor.
@ Dtor_Complete
Complete object dtor.
@ Dtor_Deleting
Deleting dtor.
LangAS
Defines the address space values used by the address space qualifier of QualType.
const char * getTraitSpelling(ExpressionTrait T) LLVM_READONLY
Return the spelling of the type trait TT. Never null.
const FunctionProtoType * T
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ Other
Other implicit parameter.
@ EST_Dynamic
throw(T1, T2)
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Information about how to mangle a template argument.
bool NeedExactType
Do we need to mangle the template argument with an exactly correct type?
const NamedDecl * TemplateParameterToMangle
If we need to prefix the mangling with a mangling of the template parameter, the corresponding parame...
bool isOverloadable()
Determine whether the resolved template might be overloaded on its template parameter list.
TemplateArgManglingInfo(const CXXNameMangler &Mangler, TemplateName TN)
bool needToMangleTemplateParam(const NamedDecl *Param, const TemplateArgument &Arg)
Determine whether we need to prefix this <template-arg> mangling with a <template-param-decl>.
const NamedDecl * UnresolvedExpandedPack
const CXXNameMangler & Mangler
TemplateDecl * ResolvedTemplate
Info getArgInfo(unsigned ParamIdx, const TemplateArgument &Arg)
Determine information about how this template argument should be mangled.
const Expr * getTrailingRequiresClauseToMangle()
Determine if we should mangle a requires-clause after the template argument list.
bool SeenPackExpansionIntoNonPack
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
union clang::ReturnAdjustment::VirtualAdjustment Virtual
int64_t NonVirtual
The non-virtual adjustment from the derived object to its nearest virtual base.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
const Type * Ty
The locally-unqualified type.
Qualifiers Quals
The local qualifiers.
Iterator for iterating over Stmt * arrays that contain only T *.
A this pointer adjustment.
union clang::ThisAdjustment::VirtualAdjustment Virtual
int64_t NonVirtual
The non-virtual adjustment from the derived object to its nearest virtual base.
The this pointer adjustment as well as an optional return adjustment for a thunk.
ThisAdjustment This
The this pointer adjustment.
ReturnAdjustment Return
The return adjustment.
struct clang::ReturnAdjustment::VirtualAdjustment::@191 Itanium
int64_t VBaseOffsetOffset
The offset (in bytes), relative to the address point of the virtual base class offset.
struct clang::ThisAdjustment::VirtualAdjustment::@193 Itanium
int64_t VCallOffsetOffset
The offset (in bytes), relative to the address point, of the virtual call offset.