;
44static boolisLocalContainerContext(
const DeclContext*DC) {
45 returnisa<FunctionDecl>(DC) || isa<ObjCMethodDecl>(DC) || isa<BlockDecl>(DC);
50 returnftd->getTemplatedDecl();
57 return(fn ? getStructor(fn) :
decl);
60static boolisLambda(
const NamedDecl*ND) {
65 return Record->isLambda();
68static const unsignedUnknownArity = ~0
U;
71 typedefstd::pair<const DeclContext*, IdentifierInfo*> DiscriminatorKeyTy;
72llvm::DenseMap<DiscriminatorKeyTy, unsigned> Discriminator;
73llvm::DenseMap<const NamedDecl*, unsigned> Uniquifier;
74 constDiscriminatorOverrideTy DiscriminatorOverride =
nullptr;
77 boolNeedsUniqueInternalLinkageNames =
false;
80 explicitItaniumMangleContextImpl(
82DiscriminatorOverrideTy DiscriminatorOverride,
boolIsAux =
false)
84DiscriminatorOverride(DiscriminatorOverride) {}
96NeedsUniqueInternalLinkageNames =
true;
101raw_ostream &)
override;
103 const ThunkInfo&Thunk,
bool, raw_ostream &)
override;
105raw_ostream &)
override;
112 boolNormalizeIntegers)
override;
114 boolNormalizeIntegers)
override;
121raw_ostream &Out)
override;
124raw_ostream &Out)
override;
126raw_ostream &Out)
override;
129raw_ostream &)
override;
137 boolgetNextDiscriminator(
const NamedDecl*ND,
unsigned&disc) {
143 if(
const TagDecl*Tag = dyn_cast<TagDecl>(ND)) {
144 if(
Tag->getName().empty() && !
Tag->getTypedefNameForAnonDecl())
151 if(discriminator == 1)
153disc = discriminator - 2;
158 unsigned&discriminator = Uniquifier[ND];
159 if(!discriminator) {
160 const DeclContext*DC = getEffectiveDeclContext(ND);
161discriminator = ++Discriminator[std::make_pair(DC, ND->
getIdentifier())];
163 if(discriminator == 1)
165disc = discriminator-2;
172assert(Lambda->
isLambda() &&
"RD must be a lambda!");
173std::string Name(
"<lambda");
177 const ParmVarDecl*Parm = dyn_cast_or_null<ParmVarDecl>(LambdaContextDecl);
179Parm ? dyn_cast<FunctionDecl>(Parm->
getDeclContext()) : nullptr;
182 unsignedDefaultArgNo =
184Name += llvm::utostr(DefaultArgNo);
188 if(LambdaManglingNumber)
189LambdaId = LambdaManglingNumber;
193Name += llvm::utostr(LambdaId);
199 returnDiscriminatorOverride;
206 returngetEffectiveDeclContext(cast<Decl>(DC));
209 boolisInternalLinkageDecl(
const NamedDecl*ND);
215classCXXNameMangler {
216ItaniumMangleContextImpl &Context;
220 boolNormalizeIntegers =
false;
222 boolNullOut =
false;
227 boolDisableDerivedAbiTags =
false;
233 unsignedStructorType = 0;
238 unsignedTemplateDepthOffset = 0;
243 classFunctionTypeDepthState {
246 enum{ InResultTypeMask = 1 };
249FunctionTypeDepthState() =
default;
252 unsignedgetDepth()
const{
257 boolisInResultType()
const{
258 returnBits & InResultTypeMask;
261FunctionTypeDepthState push() {
262FunctionTypeDepthState tmp = *
this;
263Bits = (Bits & ~InResultTypeMask) + 2;
267 voidenterResultType() {
268Bits |= InResultTypeMask;
271 voidleaveResultType() {
272Bits &= ~InResultTypeMask;
275 voidpop(FunctionTypeDepthState saved) {
276assert(getDepth() == saved.getDepth() + 1);
291 classAbiTagState final {
293 explicitAbiTagState(AbiTagState *&Head) : LinkHead(Head) {
299AbiTagState(
constAbiTagState &) =
delete;
300AbiTagState &operator=(
constAbiTagState &) =
delete;
302~AbiTagState() { pop(); }
304 voidwrite(raw_ostream &Out,
const NamedDecl*ND,
305 constAbiTagList *AdditionalAbiTags) {
307 if(!isa<FunctionDecl>(ND) && !isa<VarDecl>(ND)) {
309!AdditionalAbiTags &&
310 "only function and variables need a list of additional abi tags");
311 if(
const auto*NS = dyn_cast<NamespaceDecl>(ND)) {
312 if(
const auto*AbiTag = NS->getAttr<AbiTagAttr>()) {
313UsedAbiTags.insert(UsedAbiTags.end(), AbiTag->tags().begin(),
314AbiTag->tags().end());
322 if(
const auto*AbiTag = ND->
getAttr<AbiTagAttr>()) {
323UsedAbiTags.insert(UsedAbiTags.end(), AbiTag->tags().begin(),
324AbiTag->tags().end());
325TagList.insert(TagList.end(), AbiTag->tags().begin(),
326AbiTag->tags().end());
329 if(AdditionalAbiTags) {
330UsedAbiTags.insert(UsedAbiTags.end(), AdditionalAbiTags->begin(),
331AdditionalAbiTags->end());
332TagList.insert(TagList.end(), AdditionalAbiTags->begin(),
333AdditionalAbiTags->end());
337TagList.erase(std::unique(TagList.begin(), TagList.end()), TagList.end());
339writeSortedUniqueAbiTags(Out, TagList);
342 constAbiTagList &getUsedAbiTags()
const{
returnUsedAbiTags; }
343 voidsetUsedAbiTags(
constAbiTagList &AbiTags) {
344UsedAbiTags = AbiTags;
347 constAbiTagList &getEmittedAbiTags()
const{
348 returnEmittedAbiTags;
351 constAbiTagList &getSortedUniqueUsedAbiTags() {
352llvm::sort(UsedAbiTags);
353UsedAbiTags.erase(std::unique(UsedAbiTags.begin(), UsedAbiTags.end()),
360AbiTagList UsedAbiTags;
362AbiTagList EmittedAbiTags;
364AbiTagState *&LinkHead;
365AbiTagState *
Parent=
nullptr;
368assert(LinkHead ==
this&&
369 "abi tag link head must point to us on destruction");
371 Parent->UsedAbiTags.insert(
Parent->UsedAbiTags.end(),
372UsedAbiTags.begin(), UsedAbiTags.end());
373 Parent->EmittedAbiTags.insert(
Parent->EmittedAbiTags.end(),
374EmittedAbiTags.begin(),
375EmittedAbiTags.end());
380 voidwriteSortedUniqueAbiTags(raw_ostream &Out,
constAbiTagList &AbiTags) {
381 for(
const auto&Tag : AbiTags) {
382EmittedAbiTags.push_back(Tag);
390AbiTagState *AbiTags =
nullptr;
391AbiTagState AbiTagsRoot;
393llvm::DenseMap<uintptr_t, unsigned> Substitutions;
394llvm::DenseMap<StringRef, unsigned> ModuleSubstitutions;
396 ASTContext&getASTContext()
const{
returnContext.getASTContext(); }
399 returnContext.getASTContext().
getLangOpts().getClangABICompat() <= Ver;
408llvm::StringRef Name,
boolHasAllocator);
411CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out_,
412 const NamedDecl*
D=
nullptr,
boolNullOut_ =
false)
413: Context(
C), Out(Out_), NullOut(NullOut_), Structor(getStructor(
D)),
414AbiTagsRoot(AbiTags) {
416assert(!
D|| (!isa<CXXDestructorDecl>(
D) &&
417!isa<CXXConstructorDecl>(
D)));
419CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out_,
421: Context(
C), Out(Out_), Structor(getStructor(
D)), StructorType(
Type),
422AbiTagsRoot(AbiTags) {}
423CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out_,
425: Context(
C), Out(Out_), Structor(getStructor(
D)), StructorType(
Type),
426AbiTagsRoot(AbiTags) {}
428CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out_,
429 boolNormalizeIntegers_)
430: Context(
C), Out(Out_), NormalizeIntegers(NormalizeIntegers_),
431NullOut(
false), Structor(nullptr), AbiTagsRoot(AbiTags) {}
432CXXNameMangler(CXXNameMangler &Outer, raw_ostream &Out_)
433: Context(Outer.Context), Out(Out_), Structor(Outer.Structor),
434StructorType(Outer.StructorType), SeqID(Outer.SeqID),
435FunctionTypeDepth(Outer.FunctionTypeDepth), AbiTagsRoot(AbiTags),
436Substitutions(Outer.Substitutions),
437ModuleSubstitutions(Outer.ModuleSubstitutions) {}
439CXXNameMangler(CXXNameMangler &Outer, llvm::raw_null_ostream &Out_)
440: CXXNameMangler(Outer, (raw_ostream &)Out_) {
444 structWithTemplateDepthOffset {
unsignedOffset; };
445CXXNameMangler(ItaniumMangleContextImpl &
C, raw_ostream &Out,
446WithTemplateDepthOffset Offset)
447: CXXNameMangler(
C, Out) {
448TemplateDepthOffset = Offset.Offset;
451raw_ostream &getStream() {
returnOut; }
453 voiddisableDerivedAbiTags() { DisableDerivedAbiTags =
true; }
454 static boolshouldHaveAbiTags(ItaniumMangleContextImpl &
C,
const VarDecl*VD);
457 voidmangleCallOffset(int64_t NonVirtual, int64_t
Virtual);
458 voidmangleNumber(
constllvm::APSInt &I);
459 voidmangleNumber(int64_t Number);
460 voidmangleFloat(
constllvm::APFloat &F);
462 voidmangleSeqID(
unsignedSeqID);
467 voidmangleModuleNamePrefix(StringRef Name,
boolIsPartition =
false);
468 voidmangleVendorQualifier(StringRef Name);
469 voidmangleVendorType(StringRef Name);
473 boolmangleSubstitution(
const NamedDecl*ND);
481 boolmangleStandardSubstitution(
const NamedDecl*ND);
483 voidaddSubstitution(
const NamedDecl*ND) {
486addSubstitution(
reinterpret_cast<uintptr_t>(ND));
491addSubstitution(
reinterpret_cast<uintptr_t>(NNS));
497 voidextendSubstitutions(CXXNameMangler*
Other);
500 boolrecursive =
false);
504 unsignedNumTemplateArgs,
505 unsignedKnownArity = UnknownArity);
507 voidmangleFunctionEncodingBareType(
const FunctionDecl*FD);
510 constAbiTagList *AdditionalAbiTags);
511 voidmangleModuleName(
const NamedDecl*ND);
515 constAbiTagList *AdditionalAbiTags) {
516mangleUnqualifiedName(GD, cast<NamedDecl>(GD.
getDecl())->getDeclName(), DC,
517UnknownArity, AdditionalAbiTags);
521 constAbiTagList *AdditionalAbiTags);
523 constAbiTagList *AdditionalAbiTags);
525 constAbiTagList *AdditionalAbiTags);
529 voidmangleSourceNameWithAbiTags(
530 const NamedDecl*ND,
constAbiTagList *AdditionalAbiTags =
nullptr);
532 constAbiTagList *AdditionalAbiTags);
537 voidmangleTypeConstraint(
const ConceptDecl*Concept,
540 voidmangleRequiresClause(
const Expr*RequiresClause);
543 constAbiTagList *AdditionalAbiTags,
544 boolNoFunction=
false);
547 voidmangleNestedNameWithClosurePrefix(
GlobalDeclGD,
549 constAbiTagList *AdditionalAbiTags);
551 voidmanglePrefix(
const DeclContext*DC,
boolNoFunction=
false);
553 voidmangleTemplatePrefix(
GlobalDeclGD,
boolNoFunction=
false);
556 voidmangleClosurePrefix(
const NamedDecl*ND,
boolNoFunction =
false);
557 boolmangleUnresolvedTypeOrSimpleId(
QualTypeDestroyedType,
558StringRef Prefix =
"");
567#define ABSTRACT_TYPE(CLASS, PARENT) 568#define NON_CANONICAL_TYPE(CLASS, PARENT) 569#define TYPE(CLASS, PARENT) void mangleType(const CLASS##Type *T); 570#include "clang/AST/TypeNodes.inc" 572 voidmangleType(
const TagType*);
574 staticStringRef getCallingConvQualifierName(
CallingConvCC);
577 voidmangleSMEAttrs(
unsignedSMEAttrs);
582 voidmangleAArch64NeonVectorType(
const VectorType*
T);
584 voidmangleAArch64FixedSveVectorType(
const VectorType*
T);
586 voidmangleRISCVFixedRVVVectorType(
const VectorType*
T);
589 voidmangleIntegerLiteral(
QualType T,
constllvm::APSInt &
Value);
590 voidmangleFloatLiteral(
QualType T,
constllvm::APFloat &
V);
591 voidmangleFixedPointLiteral();
594 voidmangleMemberExprBase(
const Expr*base,
boolisArrow);
595 voidmangleMemberExpr(
const Expr*base,
boolisArrow,
600 unsignedNumTemplateArgs,
601 unsignedknownArity);
602 voidmangleCastExpression(
const Expr*
E, StringRef CastEncoding);
603 voidmangleInitListElements(
const InitListExpr*InitList);
606 voidmangleExpression(
const Expr*
E,
unsignedArity = UnknownArity,
607 boolAsTemplateArg =
false);
611 structTemplateArgManglingInfo;
614 unsignedNumTemplateArgs);
617 voidmangleTemplateArg(TemplateArgManglingInfo &Info,
unsignedIndex,
620 voidmangleTemplateArgExpr(
const Expr*
E);
622 boolNeedExactType =
false);
624 voidmangleTemplateParameter(
unsignedDepth,
unsignedIndex);
626 voidmangleFunctionParam(
const ParmVarDecl*parm);
629 constAbiTagList *AdditionalAbiTags);
632AbiTagList makeFunctionReturnTypeTags(
const FunctionDecl*FD);
634AbiTagList makeVariableTypeTags(
const VarDecl*VD);
642getASTContext(), getASTContext().getTranslationUnitDecl(),
644&getASTContext().Idents.get(
"std"),
654ItaniumMangleContextImpl::getEffectiveDeclContext(
const Decl*
D) {
664dyn_cast_or_null<ParmVarDecl>(RD->getLambdaContextDecl()))
665 returnContextParam->getDeclContext();
669 if(
const BlockDecl*BD = dyn_cast<BlockDecl>(
D)) {
671dyn_cast_or_null<ParmVarDecl>(BD->getBlockManglingContextDecl()))
672 returnContextParam->getDeclContext();
680 if(
D== getASTContext().getVaListTagDecl()) {
681 constllvm::Triple &
T= getASTContext().getTargetInfo().getTriple();
682 if(
T.isARM() ||
T.isThumb() ||
T.isAArch64())
683 returngetStdNamespace();
687 if(isa<CapturedDecl>(DC) || isa<OMPDeclareReductionDecl>(DC) ||
688isa<OMPDeclareMapperDecl>(DC)) {
689 returngetEffectiveDeclContext(cast<Decl>(DC));
692 if(
const auto*VD = dyn_cast<VarDecl>(
D))
694 returngetASTContext().getTranslationUnitDecl();
696 if(
const auto*FD = getASTContext().getLangOpts().getClangABICompat() >
697LangOptions::ClangABI::Ver19
699: dyn_cast<FunctionDecl>(
D)) {
701 returngetASTContext().getTranslationUnitDecl();
704 if(FD->isMemberLikeConstrainedFriend() &&
705getASTContext().getLangOpts().getClangABICompat() >
706LangOptions::ClangABI::Ver17)
713boolItaniumMangleContextImpl::isInternalLinkageDecl(
const NamedDecl*ND) {
716getEffectiveDeclContext(ND)->isFileContext() &&
723boolItaniumMangleContextImpl::isUniqueInternalLinkageDecl(
725 if(!NeedsUniqueInternalLinkageNames || !ND)
728 const auto*FD = dyn_cast<FunctionDecl>(ND);
737 if(isInternalLinkageDecl(ND))
743boolItaniumMangleContextImpl::shouldMangleCXXName(
const NamedDecl*
D) {
744 if(
const auto*FD = dyn_cast<FunctionDecl>(
D)) {
747 if(FD->hasAttr<OverloadableAttr>())
763 if(FD->isMSVCRTEntryPoint())
777 if(!getASTContext().getLangOpts().
CPlusPlus)
780 if(
const auto*VD = dyn_cast<VarDecl>(
D)) {
782 if(isa<DecompositionDecl>(VD))
795DC = getEffectiveParentContext(DC);
797!CXXNameMangler::shouldHaveAbiTags(*
this, VD) &&
798!isa<VarTemplateSpecializationDecl>(VD) &&
806voidCXXNameMangler::writeAbiTags(
const NamedDecl*ND,
807 constAbiTagList *AdditionalAbiTags) {
808assert(AbiTags &&
"require AbiTagState");
809AbiTags->write(Out, ND, DisableDerivedAbiTags ?
nullptr: AdditionalAbiTags);
812voidCXXNameMangler::mangleSourceNameWithAbiTags(
813 const NamedDecl*ND,
constAbiTagList *AdditionalAbiTags) {
815writeAbiTags(ND, AdditionalAbiTags);
823 if(isa<FunctionDecl>(GD.
getDecl()))
824mangleFunctionEncoding(GD);
829dyn_cast<IndirectFieldDecl>(GD.
getDecl()))
830mangleName(IFD->getAnonField());
832llvm_unreachable(
"unexpected kind of global decl");
835voidCXXNameMangler::mangleFunctionEncoding(
GlobalDeclGD) {
840 if(!Context.shouldMangleDeclName(FD)) {
845AbiTagList ReturnTypeAbiTags = makeFunctionReturnTypeTags(FD);
846 if(ReturnTypeAbiTags.empty()) {
855FunctionTypeDepthState Saved = FunctionTypeDepth.push();
857FunctionTypeDepth.pop(Saved);
858mangleFunctionEncodingBareType(FD);
866llvm::raw_svector_ostream FunctionEncodingStream(FunctionEncodingBuf);
867CXXNameMangler FunctionEncodingMangler(*
this, FunctionEncodingStream);
869FunctionEncodingMangler.disableDerivedAbiTags();
871FunctionTypeDepthState Saved = FunctionTypeDepth.push();
872FunctionEncodingMangler.mangleNameWithAbiTags(FD,
nullptr);
873FunctionTypeDepth.pop(Saved);
876 size_tEncodingPositionStart = FunctionEncodingStream.str().size();
877FunctionEncodingMangler.mangleFunctionEncodingBareType(FD);
881 constAbiTagList &UsedAbiTags =
882FunctionEncodingMangler.AbiTagsRoot.getSortedUniqueUsedAbiTags();
883AbiTagList AdditionalAbiTags(ReturnTypeAbiTags.size());
884AdditionalAbiTags.erase(
885std::set_difference(ReturnTypeAbiTags.begin(), ReturnTypeAbiTags.end(),
886UsedAbiTags.begin(), UsedAbiTags.end(),
887AdditionalAbiTags.begin()),
888AdditionalAbiTags.end());
891Saved = FunctionTypeDepth.push();
892mangleNameWithAbiTags(FD, &AdditionalAbiTags);
893FunctionTypeDepth.pop(Saved);
894Out << FunctionEncodingStream.str().substr(EncodingPositionStart);
898extendSubstitutions(&FunctionEncodingMangler);
901voidCXXNameMangler::mangleFunctionEncodingBareType(
const FunctionDecl*FD) {
902 if(FD->
hasAttr<EnableIfAttr>()) {
903FunctionTypeDepthState Saved = FunctionTypeDepth.push();
904Out <<
"Ua9enable_ifI";
905 for(AttrVec::const_iterator I = FD->
getAttrs().begin(),
908EnableIfAttr *EIA = dyn_cast<EnableIfAttr>(*I);
911 if(isCompatibleWith(LangOptions::ClangABI::Ver11)) {
916mangleExpression(EIA->getCond());
919mangleTemplateArgExpr(EIA->getCond());
923FunctionTypeDepth.pop(Saved);
928 if(
auto*CD = dyn_cast<CXXConstructorDecl>(FD))
929 if(
autoInherited = CD->getInheritedConstructor())
930FD = Inherited.getConstructor();
948 boolMangleReturnType =
false;
950 if(!(isa<CXXConstructorDecl>(FD) || isa<CXXDestructorDecl>(FD) ||
951isa<CXXConversionDecl>(FD)))
952MangleReturnType =
true;
955FD = PrimaryTemplate->getTemplatedDecl();
959MangleReturnType, FD);
964 if(!Context.getEffectiveParentContext(NS)->isTranslationUnit())
968 returnII && II->
isStr(
"std");
973boolCXXNameMangler::isStdNamespace(
const DeclContext*DC) {
977 returnisStd(cast<NamespaceDecl>(DC));
984 if(
const FunctionDecl*FD = dyn_cast<FunctionDecl>(ND)) {
993dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
994TemplateArgs = &Spec->getTemplateArgs();
995 returnGD.
getWithDecl(Spec->getSpecializedTemplate());
1000dyn_cast<VarTemplateSpecializationDecl>(ND)) {
1001TemplateArgs = &Spec->getTemplateArgs();
1002 returnGD.
getWithDecl(Spec->getSpecializedTemplate());
1013voidCXXNameMangler::mangleName(
GlobalDeclGD) {
1015 if(
const VarDecl*VD = dyn_cast<VarDecl>(ND)) {
1017AbiTagList VariableTypeAbiTags = makeVariableTypeTags(VD);
1018 if(VariableTypeAbiTags.empty()) {
1020mangleNameWithAbiTags(VD,
nullptr);
1025llvm::raw_null_ostream NullOutStream;
1026CXXNameMangler VariableNameMangler(*
this, NullOutStream);
1027VariableNameMangler.disableDerivedAbiTags();
1028VariableNameMangler.mangleNameWithAbiTags(VD,
nullptr);
1031 constAbiTagList &UsedAbiTags =
1032VariableNameMangler.AbiTagsRoot.getSortedUniqueUsedAbiTags();
1033AbiTagList AdditionalAbiTags(VariableTypeAbiTags.size());
1034AdditionalAbiTags.erase(
1035std::set_difference(VariableTypeAbiTags.begin(),
1036VariableTypeAbiTags.end(), UsedAbiTags.begin(),
1037UsedAbiTags.end(), AdditionalAbiTags.begin()),
1038AdditionalAbiTags.end());
1041mangleNameWithAbiTags(VD, &AdditionalAbiTags);
1043mangleNameWithAbiTags(GD,
nullptr);
1047const RecordDecl*CXXNameMangler::GetLocalClassDecl(
const Decl*
D) {
1048 const DeclContext*DC = Context.getEffectiveDeclContext(
D);
1050 if(isLocalContainerContext(DC))
1051 returndyn_cast<RecordDecl>(
D);
1053DC = Context.getEffectiveDeclContext(
D);
1058voidCXXNameMangler::mangleNameWithAbiTags(
GlobalDeclGD,
1059 constAbiTagList *AdditionalAbiTags) {
1066 const DeclContext*DC = Context.getEffectiveDeclContext(ND);
1067 boolIsLambda = isLambda(ND);
1073 if(isLocalContainerContext(DC) && ND->
hasLinkage() && !IsLambda)
1075DC = Context.getEffectiveParentContext(DC);
1076 else if(GetLocalClassDecl(ND) &&
1077(!IsLambda || isCompatibleWith(LangOptions::ClangABI::Ver18))) {
1078mangleLocalName(GD, AdditionalAbiTags);
1082assert(!isa<LinkageSpecDecl>(DC) &&
"context cannot be LinkageSpecDecl");
1086 if(
const NamedDecl*PrefixND = getClosurePrefix(ND)) {
1087mangleNestedNameWithClosurePrefix(GD, PrefixND, AdditionalAbiTags);
1091 if(isLocalContainerContext(DC)) {
1092mangleLocalName(GD, AdditionalAbiTags);
1100mangleUnscopedTemplateName(TD, DC, AdditionalAbiTags);
1105mangleUnscopedName(GD, DC, AdditionalAbiTags);
1109mangleNestedName(GD, DC, AdditionalAbiTags);
1112voidCXXNameMangler::mangleModuleName(
const NamedDecl*ND) {
1115mangleModuleNamePrefix(M->getPrimaryModuleInterfaceName());
1123voidCXXNameMangler::mangleModuleNamePrefix(StringRef Name,
boolIsPartition) {
1125 autoIt = ModuleSubstitutions.find(Name);
1126 if(It != ModuleSubstitutions.end()) {
1128mangleSeqID(It->second);
1134 autoParts = Name.rsplit(
'.');
1135 if(Parts.second.empty())
1136Parts.second = Parts.first;
1138mangleModuleNamePrefix(Parts.first, IsPartition);
1139IsPartition =
false;
1145Out << Parts.second.size() << Parts.second;
1146ModuleSubstitutions.insert({Name, SeqID++});
1149voidCXXNameMangler::mangleTemplateName(
const TemplateDecl*TD,
1151 const DeclContext*DC = Context.getEffectiveDeclContext(TD);
1154mangleUnscopedTemplateName(TD, DC,
nullptr);
1157mangleNestedName(TD, Args);
1162 constAbiTagList *AdditionalAbiTags) {
1166assert(!isa<LinkageSpecDecl>(DC) &&
"unskipped LinkageSpecDecl");
1167 if(isStdNamespace(DC)) {
1168 if(getASTContext().getTargetInfo().getTriple().isOSSolaris()) {
1170 if(
const RecordDecl*RD = dyn_cast<RecordDecl>(ND)) {
1177 if(llvm::is_contained({
"div_t",
"ldiv_t",
"lconv",
"tm"},
type)) {
1187mangleUnqualifiedName(GD, DC, AdditionalAbiTags);
1190voidCXXNameMangler::mangleUnscopedTemplateName(
1195 if(mangleSubstitution(ND))
1199 if(
const auto*TTP = dyn_cast<TemplateTemplateParmDecl>(ND)) {
1200assert(!AdditionalAbiTags &&
1201 "template template param cannot have abi tags");
1202mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
1203}
else if(isa<BuiltinTemplateDecl>(ND) || isa<ConceptDecl>(ND)) {
1204mangleUnscopedName(GD, DC, AdditionalAbiTags);
1210addSubstitution(ND);
1213voidCXXNameMangler::mangleFloat(
constllvm::APFloat &f) {
1227llvm::APInt valueBits = f.bitcastToAPInt();
1228 unsignednumCharacters = (valueBits.getBitWidth() + 3) / 4;
1229assert(numCharacters != 0);
1235 for(
unsignedstringIndex = 0; stringIndex != numCharacters; ++stringIndex) {
1237 unsigneddigitBitIndex = 4 * (numCharacters - stringIndex - 1);
1240 uint64_thexDigit = valueBits.getRawData()[digitBitIndex / 64];
1241hexDigit >>= (digitBitIndex % 64);
1245 static const charcharForHex[16] = {
1246 '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
1247 '8',
'9',
'a',
'b',
'c',
'd',
'e',
'f' 1249buffer[stringIndex] = charForHex[hexDigit];
1252Out.write(buffer.data(), numCharacters);
1255voidCXXNameMangler::mangleFloatLiteral(
QualType T,
constllvm::APFloat &
V) {
1262voidCXXNameMangler::mangleFixedPointLiteral() {
1269voidCXXNameMangler::mangleNullPointer(
QualType T) {
1276voidCXXNameMangler::mangleNumber(
constllvm::APSInt &
Value) {
1277 if(
Value.isSigned() &&
Value.isNegative()) {
1285voidCXXNameMangler::mangleNumber(int64_t Number) {
1295voidCXXNameMangler::mangleCallOffset(int64_t NonVirtual, int64_t
Virtual) {
1303mangleNumber(NonVirtual);
1309mangleNumber(NonVirtual);
1317 if(!mangleSubstitution(
QualType(TST, 0))) {
1318mangleTemplatePrefix(TST->getTemplateName());
1323mangleTemplateArgs(TST->getTemplateName(), TST->template_arguments());
1324addSubstitution(
QualType(TST, 0));
1326}
else if(
const auto*DTST =
1328 if(!mangleSubstitution(
QualType(DTST, 0))) {
1329 TemplateNameTemplate = getASTContext().getDependentTemplateName(
1330DTST->getQualifier(), DTST->getIdentifier());
1331mangleTemplatePrefix(Template);
1336mangleTemplateArgs(Template, DTST->template_arguments());
1337addSubstitution(
QualType(DTST, 0));
1367 switch(qualifier->
getKind()) {
1379llvm_unreachable(
"Can't mangle __super specifier");
1383mangleUnresolvedPrefix(qualifier->
getPrefix(),
1391mangleUnresolvedPrefix(qualifier->
getPrefix(),
1408mangleUnresolvedPrefix(qualifier->
getPrefix(),
1415 if(mangleUnresolvedTypeOrSimpleId(
QualType(
type, 0), recursive ?
"N":
""))
1424mangleUnresolvedPrefix(qualifier->
getPrefix(),
1442voidCXXNameMangler::mangleUnresolvedName(
1445 unsignedknownArity) {
1446 if(qualifier) mangleUnresolvedPrefix(qualifier);
1447 switch(
name.getNameKind()) {
1450mangleSourceName(
name.getAsIdentifierInfo());
1455mangleUnresolvedTypeOrSimpleId(
name.getCXXNameType());
1462mangleOperatorName(name, knownArity);
1465llvm_unreachable(
"Can't mangle a constructor name!");
1467llvm_unreachable(
"Can't mangle a using directive name!");
1469llvm_unreachable(
"Can't mangle a deduction guide name!");
1473llvm_unreachable(
"Can't mangle Objective-C selector names here!");
1479mangleTemplateArgs(
TemplateName(), TemplateArgs, NumTemplateArgs);
1482voidCXXNameMangler::mangleUnqualifiedName(
1484 unsignedKnownArity,
constAbiTagList *AdditionalAbiTags) {
1492mangleModuleName(ND);
1496 auto*FD = dyn_cast<FunctionDecl>(ND);
1497 auto*FTD = dyn_cast<FunctionTemplateDecl>(ND);
1499(FTD && FTD->getTemplatedDecl()->isMemberLikeConstrainedFriend())) {
1500 if(!isCompatibleWith(LangOptions::ClangABI::Ver17))
1504 unsignedArity = KnownArity;
1505 switch(Name.getNameKind()) {
1510 if(
auto*DD = dyn_cast<DecompositionDecl>(ND)) {
1517 for(
auto*BD : DD->bindings())
1518mangleSourceName(BD->getDeclName().getAsIdentifierInfo());
1520writeAbiTags(ND, AdditionalAbiTags);
1524 if(
auto*GD = dyn_cast<MSGuidDecl>(ND)) {
1527 SmallString<
sizeof(
"_GUID_12345678_1234_1234_1234_1234567890ab")> GUID;
1528llvm::raw_svector_ostream GUIDOS(GUID);
1529Context.mangleMSGuidDecl(GD, GUIDOS);
1530Out << GUID.size() << GUID;
1534 if(
auto*TPO = dyn_cast<TemplateParamObjectDecl>(ND)) {
1537mangleValueInTemplateArg(TPO->getType().getUnqualifiedType(),
1538TPO->getValue(),
true);
1556 if(Context.isInternalLinkageDecl(ND))
1559 boolIsRegCall = FD &&
1563FD && FD->
hasAttr<CUDAGlobalAttr>() &&
1566mangleDeviceStubName(II);
1568mangleRegCallName(II);
1570mangleSourceName(II);
1572writeAbiTags(ND, AdditionalAbiTags);
1577assert(ND &&
"mangling empty name without declaration");
1579 if(
const NamespaceDecl*NS = dyn_cast<NamespaceDecl>(ND)) {
1582Out <<
"12_GLOBAL__N_1";
1587 if(
const VarDecl*VD = dyn_cast<VarDecl>(ND)) {
1601&&
"Expected anonymous struct or union!");
1608assert(FD->
getIdentifier() &&
"Data member name isn't an identifier!");
1621 if(isa<ObjCContainerDecl>(ND))
1625 const TagDecl*TD = cast<TagDecl>(ND);
1628 "Typedef should not be in another decl context!");
1629assert(
D->getDeclName().getAsIdentifierInfo() &&
1630 "Typedef was not named!");
1631mangleSourceName(
D->getDeclName().getAsIdentifierInfo());
1632assert(!AdditionalAbiTags &&
"Type cannot have additional abi tags");
1635writeAbiTags(TD,
nullptr);
1645std::optional<unsigned> DeviceNumber =
1646Context.getDiscriminatorOverride()(Context.getASTContext(),
Record);
1652 if(
Record->isLambda() &&
1653((DeviceNumber && *DeviceNumber > 0) ||
1654(!DeviceNumber &&
Record->getLambdaManglingNumber() > 0))) {
1655assert(!AdditionalAbiTags &&
1656 "Lambda type cannot have additional abi tags");
1663 unsignedUnnamedMangle =
1664getASTContext().getManglingNumber(TD, Context.isAux());
1666 if(UnnamedMangle > 1)
1667Out << UnnamedMangle - 2;
1669writeAbiTags(TD, AdditionalAbiTags);
1675 unsignedAnonStructId =
1677: Context.getAnonymousStructId(TD, dyn_cast<FunctionDecl>(DC));
1684Str += llvm::utostr(AnonStructId);
1694llvm_unreachable(
"Can't mangle Objective-C selector names here!");
1700 if(
autoInherited =
1701cast<CXXConstructorDecl>(ND)->getInheritedConstructor()) {
1702InheritedFrom = Inherited.getConstructor()->
getParent();
1703InheritedTemplateName =
1704 TemplateName(Inherited.getConstructor()->getPrimaryTemplate());
1705InheritedTemplateArgs =
1706Inherited.getConstructor()->getTemplateSpecializationArgs();
1712mangleCXXCtorType(
static_cast<CXXCtorType>(StructorType), InheritedFrom);
1720 if(InheritedTemplateArgs)
1721mangleTemplateArgs(InheritedTemplateName, *InheritedTemplateArgs);
1723writeAbiTags(ND, AdditionalAbiTags);
1731mangleCXXDtorType(
static_cast<CXXDtorType>(StructorType));
1737writeAbiTags(ND, AdditionalAbiTags);
1741 if(ND && Arity == UnknownArity) {
1742Arity = cast<FunctionDecl>(ND)->getNumParams();
1745 if(
const auto*MD = dyn_cast<CXXMethodDecl>(ND))
1746 if(MD->isImplicitObjectMemberFunction())
1752mangleOperatorName(Name, Arity);
1753writeAbiTags(ND, AdditionalAbiTags);
1757llvm_unreachable(
"Can't mangle a deduction guide name!");
1760llvm_unreachable(
"Can't mangle a using directive name!");
1764voidCXXNameMangler::mangleRegCallName(
const IdentifierInfo*II) {
1768 if(getASTContext().getLangOpts().RegCall4)
1769Out << II->
getLength() +
sizeof(
"__regcall4__") - 1 <<
"__regcall4__" 1772Out << II->
getLength() +
sizeof(
"__regcall3__") - 1 <<
"__regcall3__" 1776voidCXXNameMangler::mangleDeviceStubName(
const IdentifierInfo*II) {
1780Out << II->
getLength() +
sizeof(
"__device_stub__") - 1 <<
"__device_stub__" 1784voidCXXNameMangler::mangleSourceName(
const IdentifierInfo*II) {
1791voidCXXNameMangler::mangleNestedName(
GlobalDeclGD,
1793 constAbiTagList *AdditionalAbiTags,
1802 if(
const CXXMethodDecl*Method = dyn_cast<CXXMethodDecl>(ND)) {
1803 QualifiersMethodQuals = Method->getMethodQualifiers();
1806 if(Method->isExplicitObjectMemberFunction())
1809mangleQualifiers(MethodQuals);
1810mangleRefQualifier(Method->getRefQualifier());
1816mangleTemplatePrefix(TD, NoFunction);
1819manglePrefix(DC, NoFunction);
1820mangleUnqualifiedName(GD, DC, AdditionalAbiTags);
1825voidCXXNameMangler::mangleNestedName(
const TemplateDecl*TD,
1831mangleTemplatePrefix(TD);
1837voidCXXNameMangler::mangleNestedNameWithClosurePrefix(
1839 constAbiTagList *AdditionalAbiTags) {
1848mangleClosurePrefix(PrefixND);
1849mangleUnqualifiedName(GD,
nullptr, AdditionalAbiTags);
1860 if(
auto*CD = dyn_cast<CXXConstructorDecl>(DC))
1862 else if(
auto*DD = dyn_cast<CXXDestructorDecl>(DC))
1869voidCXXNameMangler::mangleLocalName(
GlobalDeclGD,
1870 constAbiTagList *AdditionalAbiTags) {
1877assert(isa<NamedDecl>(
D) || isa<BlockDecl>(
D));
1879 const DeclContext*DC = Context.getEffectiveDeclContext(RD ? RD :
D);
1884AbiTagState LocalAbiTags(AbiTags);
1887mangleObjCMethodName(MD);
1888 else if(
const BlockDecl*BD = dyn_cast<BlockDecl>(DC))
1889mangleBlockForPrefix(BD);
1895LocalAbiTags.setUsedAbiTags(LocalAbiTags.getEmittedAbiTags());
1910 if(CXXRD && CXXRD->
isLambda()) {
1918mangleNumber(
Num- 2);
1927mangleUnqualifiedName(RD, DC, AdditionalAbiTags);
1928}
else if(
const BlockDecl*BD = dyn_cast<BlockDecl>(
D)) {
1929 if(
const NamedDecl*PrefixND = getClosurePrefix(BD))
1930mangleClosurePrefix(PrefixND,
true);
1932manglePrefix(Context.getEffectiveDeclContext(BD),
true);
1933assert(!AdditionalAbiTags &&
"Block cannot have additional abi tags");
1934mangleUnqualifiedBlock(BD);
1937mangleNestedName(GD, Context.getEffectiveDeclContext(ND),
1938AdditionalAbiTags,
true);
1940}
else if(
const BlockDecl*BD = dyn_cast<BlockDecl>(
D)) {
1944= dyn_cast_or_null<ParmVarDecl>(BD->getBlockManglingContextDecl())) {
1950mangleNumber(
Num- 2);
1955assert(!AdditionalAbiTags &&
"Block cannot have additional abi tags");
1956mangleUnqualifiedBlock(BD);
1958mangleUnqualifiedName(GD, DC, AdditionalAbiTags);
1961 if(
const NamedDecl*ND = dyn_cast<NamedDecl>(RD ? RD :
D)) {
1963 if(Context.getNextDiscriminator(ND, disc)) {
1967Out <<
"__"<< disc <<
'_';
1972voidCXXNameMangler::mangleBlockForPrefix(
const BlockDecl*
Block) {
1973 if(GetLocalClassDecl(
Block)) {
1974mangleLocalName(
Block,
nullptr);
1978 if(isLocalContainerContext(DC)) {
1979mangleLocalName(
Block,
nullptr);
1983mangleClosurePrefix(PrefixND);
1986mangleUnqualifiedBlock(
Block);
1989voidCXXNameMangler::mangleUnqualifiedBlock(
const BlockDecl*
Block) {
1992 if(
Decl*Context =
Block->getBlockManglingContextDecl()) {
1993 if(isCompatibleWith(LangOptions::ClangABI::Ver12) &&
1994(isa<VarDecl>(Context) || isa<FieldDecl>(Context)) &&
1995Context->getDeclContext()->isRecord()) {
1996 const auto*ND = cast<NamedDecl>(Context);
1998mangleSourceNameWithAbiTags(ND);
2005 unsignedNumber =
Block->getBlockManglingNumber();
2009Number = Context.getBlockId(
Block,
false);
2027voidCXXNameMangler::mangleTemplateParamDecl(
const NamedDecl*
Decl) {
2029 if(
auto*Ty = dyn_cast<TemplateTypeParmDecl>(
Decl)) {
2030 if(Ty->isParameterPack())
2033 if(Constraint && !isCompatibleWith(LangOptions::ClangABI::Ver17)) {
2036mangleTypeConstraint(Constraint);
2040}
else if(
auto*Tn = dyn_cast<NonTypeTemplateParmDecl>(
Decl)) {
2041 if(Tn->isExpandedParameterPack()) {
2042 for(
unsignedI = 0, N = Tn->getNumExpansionTypes(); I != N; ++I) {
2044mangleType(Tn->getExpansionType(I));
2048 if(Tn->isParameterPack()) {
2051 T= PackExpansion->getPattern();
2056}
else if(
auto*Tt = dyn_cast<TemplateTemplateParmDecl>(
Decl)) {
2057 if(Tt->isExpandedParameterPack()) {
2058 for(
unsignedI = 0, N = Tt->getNumExpansionTemplateParameters(); I != N;
2060mangleTemplateParameterList(Tt->getExpansionTemplateParameters(I));
2062 if(Tt->isParameterPack())
2064mangleTemplateParameterList(Tt->getTemplateParameters());
2069voidCXXNameMangler::mangleTemplateParameterList(
2072 for(
auto*Param : *Params)
2073mangleTemplateParamDecl(Param);
2074mangleRequiresClause(Params->getRequiresClause());
2078voidCXXNameMangler::mangleTypeConstraint(
2080 const DeclContext*DC = Context.getEffectiveDeclContext(Concept);
2082mangleTemplateName(Concept, Arguments);
2084mangleUnscopedName(Concept, DC,
nullptr);
2086mangleNestedName(Concept, DC,
nullptr);
2089voidCXXNameMangler::mangleTypeConstraint(
const TypeConstraint*Constraint) {
2094Args.push_back(ArgLoc.getArgument());
2099voidCXXNameMangler::mangleRequiresClause(
const Expr*RequiresClause) {
2101 if(RequiresClause && !isCompatibleWith(LangOptions::ClangABI::Ver17)) {
2103mangleExpression(RequiresClause);
2107voidCXXNameMangler::mangleLambda(
const CXXRecordDecl*Lambda) {
2111 if(isCompatibleWith(LangOptions::ClangABI::Ver12) &&
2112(isa<VarDecl>(Context) || isa<FieldDecl>(Context)) &&
2113!isa<ParmVarDecl>(Context)) {
2116mangleSourceName(Name);
2126mangleLambdaSig(Lambda);
2140std::optional<unsigned> DeviceNumber =
2141Context.getDiscriminatorOverride()(Context.getASTContext(), Lambda);
2145assert(Number > 0 &&
"Lambda should be mangled as an unnamed class");
2147mangleNumber(Number - 2);
2151voidCXXNameMangler::mangleLambdaSig(
const CXXRecordDecl*Lambda) {
2154mangleTemplateParamDecl(
D);
2158mangleRequiresClause(TPL->getRequiresClause());
2162mangleBareFunctionType(Proto,
false,
2167 switch(qualifier->
getKind()) {
2173llvm_unreachable(
"Can't mangle __super specifier");
2190 boolClang14Compat = isCompatibleWith(LangOptions::ClangABI::Ver14);
2191 if(!Clang14Compat && mangleSubstitution(qualifier))
2202addSubstitution(qualifier);
2206llvm_unreachable(
"unexpected nested name specifier");
2209voidCXXNameMangler::manglePrefix(
const DeclContext*DC,
boolNoFunction) {
2217assert(!isa<LinkageSpecDecl>(DC) &&
"prefix cannot be LinkageSpecDecl");
2222 if(NoFunction && isLocalContainerContext(DC))
2225 const NamedDecl*ND = cast<NamedDecl>(DC);
2226 if(mangleSubstitution(ND))
2232mangleTemplatePrefix(TD);
2234}
else if(
const NamedDecl*PrefixND = getClosurePrefix(ND)) {
2235mangleClosurePrefix(PrefixND, NoFunction);
2236mangleUnqualifiedName(ND,
nullptr,
nullptr);
2238 const DeclContext*DC = Context.getEffectiveDeclContext(ND);
2239manglePrefix(DC, NoFunction);
2240mangleUnqualifiedName(ND, DC,
nullptr);
2243addSubstitution(ND);
2246voidCXXNameMangler::mangleTemplatePrefix(
TemplateNameTemplate) {
2251 returnmangleTemplatePrefix(TD);
2254assert(
Dependent&&
"unexpected template name kind");
2258 boolClang11Compat = isCompatibleWith(LangOptions::ClangABI::Ver11);
2259 if(!Clang11Compat && mangleSubstitution(Template))
2263manglePrefix(Qualifier);
2265 if(Clang11Compat && mangleSubstitution(Template))
2269mangleSourceName(
Id);
2271mangleOperatorName(
Dependent->getOperator(), UnknownArity);
2273addSubstitution(Template);
2276voidCXXNameMangler::mangleTemplatePrefix(
GlobalDeclGD,
2285 if(mangleSubstitution(ND))
2289 if(
const auto*TTP = dyn_cast<TemplateTemplateParmDecl>(ND)) {
2290mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
2292 const DeclContext*DC = Context.getEffectiveDeclContext(ND);
2293manglePrefix(DC, NoFunction);
2294 if(isa<BuiltinTemplateDecl>(ND) || isa<ConceptDecl>(ND))
2295mangleUnqualifiedName(GD, DC,
nullptr);
2301addSubstitution(ND);
2304const NamedDecl*CXXNameMangler::getClosurePrefix(
const Decl*ND) {
2305 if(isCompatibleWith(LangOptions::ClangABI::Ver12))
2309 if(
auto*
Block= dyn_cast<BlockDecl>(ND)) {
2310Context = dyn_cast_or_null<NamedDecl>(
Block->getBlockManglingContextDecl());
2311}
else if(
auto*RD = dyn_cast<CXXRecordDecl>(ND)) {
2313Context = dyn_cast_or_null<NamedDecl>(RD->getLambdaContextDecl());
2320 if((isa<VarDecl>(Context) && cast<VarDecl>(Context)->hasGlobalStorage()) ||
2321isa<FieldDecl>(Context))
2327voidCXXNameMangler::mangleClosurePrefix(
const NamedDecl*ND,
boolNoFunction) {
2330 if(mangleSubstitution(ND))
2335mangleTemplatePrefix(TD, NoFunction);
2338 const auto*DC = Context.getEffectiveDeclContext(ND);
2339manglePrefix(DC, NoFunction);
2340mangleUnqualifiedName(ND, DC,
nullptr);
2345addSubstitution(ND);
2354 if(mangleSubstitution(TN))
2367 if(
auto*TTP = dyn_cast<TemplateTemplateParmDecl>(TD))
2368mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
2375llvm_unreachable(
"can't mangle an overloaded template name as a <type>");
2383mangleUnresolvedPrefix(
Dependent->getQualifier());
2384mangleSourceName(
Dependent->getIdentifier());
2404Out <<
"_SUBSTPACK_";
2408llvm_unreachable(
"Unexpected DeducedTemplate");
2411addSubstitution(TN);
2414boolCXXNameMangler::mangleUnresolvedTypeOrSimpleId(
QualTypeTy,
2420 caseType::Adjusted:
2422 caseType::ArrayParameter:
2424 caseType::BlockPointer:
2425 caseType::LValueReference:
2426 caseType::RValueReference:
2427 caseType::MemberPointer:
2428 caseType::ConstantArray:
2429 caseType::IncompleteArray:
2430 caseType::VariableArray:
2431 caseType::DependentSizedArray:
2432 caseType::DependentAddressSpace:
2433 caseType::DependentVector:
2434 caseType::DependentSizedExtVector:
2436 caseType::ExtVector:
2437 caseType::ConstantMatrix:
2438 caseType::DependentSizedMatrix:
2439 caseType::FunctionProto:
2440 caseType::FunctionNoProto:
2442 caseType::Attributed:
2443 caseType::BTFTagAttributed:
2444 caseType::HLSLAttributedResource:
2446 caseType::DeducedTemplateSpecialization:
2447 caseType::PackExpansion:
2448 caseType::ObjCObject:
2449 caseType::ObjCInterface:
2450 caseType::ObjCObjectPointer:
2451 caseType::ObjCTypeParam:
2454 caseType::MacroQualified:
2456 caseType::DependentBitInt:
2457 caseType::CountAttributed:
2458llvm_unreachable(
"type is illegal as a nested name specifier");
2460 caseType::SubstTemplateTypeParmPack:
2465Out <<
"_SUBSTPACK_";
2472 caseType::TypeOfExpr:
2474 caseType::Decltype:
2475 caseType::PackIndexing:
2476 caseType::TemplateTypeParm:
2477 caseType::UnaryTransform:
2478 caseType::SubstTemplateTypeParm:
2492mangleSourceNameWithAbiTags(cast<TypedefType>(Ty)->getDecl());
2495 caseType::UnresolvedUsing:
2496mangleSourceNameWithAbiTags(
2497cast<UnresolvedUsingType>(Ty)->getDecl());
2502mangleSourceNameWithAbiTags(cast<TagType>(Ty)->getDecl());
2505 caseType::TemplateSpecialization: {
2507cast<TemplateSpecializationType>(Ty);
2516assert(TD &&
"no template for template specialization type");
2517 if(isa<TemplateTemplateParmDecl>(TD))
2518 gotounresolvedType;
2520mangleSourceNameWithAbiTags(TD);
2528llvm_unreachable(
"invalid base for a template specialization type");
2542Out <<
"_SUBSTPACK_";
2547assert(TD && !isa<TemplateTemplateParmDecl>(TD));
2548mangleSourceNameWithAbiTags(TD);
2562 caseType::InjectedClassName:
2563mangleSourceNameWithAbiTags(
2564cast<InjectedClassNameType>(Ty)->getDecl());
2567 caseType::DependentName:
2568mangleSourceName(cast<DependentNameType>(Ty)->
getIdentifier());
2571 caseType::DependentTemplateSpecialization: {
2573cast<DependentTemplateSpecializationType>(Ty);
2574 TemplateNameTemplate = getASTContext().getDependentTemplateName(
2582 returnmangleUnresolvedTypeOrSimpleId(cast<UsingType>(Ty)->desugar(),
2584 caseType::Elaborated:
2585 returnmangleUnresolvedTypeOrSimpleId(
2586cast<ElaboratedType>(Ty)->getNamedType(), Prefix);
2592voidCXXNameMangler::mangleOperatorName(
DeclarationNameName,
unsignedArity) {
2593 switch(Name.getNameKind()) {
2602llvm_unreachable(
"Not an operator name");
2607mangleType(Name.getCXXNameType());
2612mangleSourceName(Name.getCXXLiteralIdentifier());
2616mangleOperatorName(Name.getCXXOverloadedOperator(), Arity);
2625 caseOO_New: Out <<
"nw";
break;
2627 caseOO_Array_New: Out <<
"na";
break;
2629 caseOO_Delete: Out <<
"dl";
break;
2631 caseOO_Array_Delete: Out <<
"da";
break;
2635Out << (Arity == 1?
"ps":
"pl");
break;
2639Out << (Arity == 1?
"ng":
"mi");
break;
2643Out << (Arity == 1?
"ad":
"an");
break;
2648Out << (Arity == 1?
"de":
"ml");
break;
2650 caseOO_Tilde: Out <<
"co";
break;
2652 caseOO_Slash: Out <<
"dv";
break;
2654 caseOO_Percent: Out <<
"rm";
break;
2656 caseOO_Pipe: Out <<
"or";
break;
2658 caseOO_Caret: Out <<
"eo";
break;
2660 caseOO_Equal: Out <<
"aS";
break;
2662 caseOO_PlusEqual: Out <<
"pL";
break;
2664 caseOO_MinusEqual: Out <<
"mI";
break;
2666 caseOO_StarEqual: Out <<
"mL";
break;
2668 caseOO_SlashEqual: Out <<
"dV";
break;
2670 caseOO_PercentEqual: Out <<
"rM";
break;
2672 caseOO_AmpEqual: Out <<
"aN";
break;
2674 caseOO_PipeEqual: Out <<
"oR";
break;
2676 caseOO_CaretEqual: Out <<
"eO";
break;
2678 caseOO_LessLess: Out <<
"ls";
break;
2680 caseOO_GreaterGreater: Out <<
"rs";
break;
2682 caseOO_LessLessEqual: Out <<
"lS";
break;
2684 caseOO_GreaterGreaterEqual: Out <<
"rS";
break;
2686 caseOO_EqualEqual: Out <<
"eq";
break;
2688 caseOO_ExclaimEqual: Out <<
"ne";
break;
2690 caseOO_Less: Out <<
"lt";
break;
2692 caseOO_Greater: Out <<
"gt";
break;
2694 caseOO_LessEqual: Out <<
"le";
break;
2696 caseOO_GreaterEqual: Out <<
"ge";
break;
2698 caseOO_Exclaim: Out <<
"nt";
break;
2700 caseOO_AmpAmp: Out <<
"aa";
break;
2702 caseOO_PipePipe: Out <<
"oo";
break;
2704 caseOO_PlusPlus: Out <<
"pp";
break;
2706 caseOO_MinusMinus: Out <<
"mm";
break;
2708 caseOO_Comma: Out <<
"cm";
break;
2710 caseOO_ArrowStar: Out <<
"pm";
break;
2712 caseOO_Arrow: Out <<
"pt";
break;
2714 caseOO_Call: Out <<
"cl";
break;
2716 caseOO_Subscript: Out <<
"ix";
break;
2721 caseOO_Conditional: Out <<
"qu";
break;
2724 caseOO_Coawait: Out <<
"aw";
break;
2727 caseOO_Spaceship: Out <<
"ss";
break;
2731llvm_unreachable(
"Not an overloaded operator");
2760 if(TargetAS != 0 ||
2762ASString =
"AS"+ llvm::utostr(TargetAS);
2765 default: llvm_unreachable(
"Not a language specific address space");
2769 caseLangAS::opencl_global:
2770ASString =
"CLglobal";
2772 caseLangAS::opencl_global_device:
2773ASString =
"CLdevice";
2775 caseLangAS::opencl_global_host:
2776ASString =
"CLhost";
2778 caseLangAS::opencl_local:
2779ASString =
"CLlocal";
2781 caseLangAS::opencl_constant:
2782ASString =
"CLconstant";
2784 caseLangAS::opencl_private:
2785ASString =
"CLprivate";
2787 caseLangAS::opencl_generic:
2788ASString =
"CLgeneric";
2792 caseLangAS::sycl_global:
2793ASString =
"SYglobal";
2795 caseLangAS::sycl_global_device:
2796ASString =
"SYdevice";
2798 caseLangAS::sycl_global_host:
2799ASString =
"SYhost";
2801 caseLangAS::sycl_local:
2802ASString =
"SYlocal";
2804 caseLangAS::sycl_private:
2805ASString =
"SYprivate";
2808 caseLangAS::cuda_device:
2809ASString =
"CUdevice";
2811 caseLangAS::cuda_constant:
2812ASString =
"CUconstant";
2814 caseLangAS::cuda_shared:
2815ASString =
"CUshared";
2818 caseLangAS::ptr32_sptr:
2819ASString =
"ptr32_sptr";
2821 caseLangAS::ptr32_uptr:
2825 if(!getASTContext().getTargetInfo().getTriple().isOSzOS())
2826ASString =
"ptr32_uptr";
2829ASString =
"ptr64";
2833 if(!ASString.empty())
2834mangleVendorQualifier(ASString);
2847mangleVendorQualifier(
"__weak");
2851mangleVendorQualifier(
"__unaligned");
2863mangleVendorQualifier(
"__strong");
2867mangleVendorQualifier(
"__autoreleasing");
2890voidCXXNameMangler::mangleVendorQualifier(StringRef name) {
2891Out <<
'U'<<
name.size() <<
name;
2894voidCXXNameMangler::mangleVendorType(StringRef name) {
2895Out <<
'u'<<
name.size() <<
name;
2901 switch(RefQualifier) {
2915voidCXXNameMangler::mangleObjCMethodName(
const ObjCMethodDecl*MD) {
2916Context.mangleObjCMethodNameAsSourceName(MD, Out);
2929Ctx.
getLangOpts().getClangABICompat() > LangOptions::ClangABI::Ver17)
2935 if(Ctx.
getLangOpts().getClangABICompat() > LangOptions::ClangABI::Ver6 &&
2942 if(DeducedTST->getDeducedType().isNull())
2947voidCXXNameMangler::mangleType(
QualType T) {
2981 T=
T.getCanonicalType();
2988= dyn_cast<TemplateSpecializationType>(
T))
2997=
T.getSingleStepDesugaredType(Context.getASTContext());
2998 if(Desugared ==
T)
3006 const Type*ty = split.
Ty;
3008 boolisSubstitutable =
3010 if(isSubstitutable && mangleSubstitution(
T))
3015 if(quals && isa<ArrayType>(
T)) {
3025dyn_cast<DependentAddressSpaceType>(ty)) {
3027mangleQualifiers(splitDAST.
Quals, DAST);
3030mangleQualifiers(quals);
3038#define ABSTRACT_TYPE(CLASS, PARENT) 3039#define NON_CANONICAL_TYPE(CLASS, PARENT) \ 3041 llvm_unreachable("can't mangle non-canonical type "#CLASS "Type"); \
3043#define TYPE(CLASS, PARENT) \ 3045 mangleType(static_cast<const CLASS##Type*>(ty)); \ 3047#include "clang/AST/TypeNodes.inc" 3052 if(isSubstitutable)
3053addSubstitution(
T);
3057 if(mangleSubstitution(
Record))
3060 if(isCompatibleWith(LangOptions::ClangABI::Ver19))
3062addSubstitution(
Record);
3065voidCXXNameMangler::mangleType(
const BuiltinType*
T) {
3107std::string type_name;
3111 if(NormalizeIntegers &&
T->isInteger()) {
3112 if(
T->isSignedInteger()) {
3113 switch(getASTContext().getTypeSize(
T)) {
3117 if(mangleSubstitution(BuiltinType::SChar))
3120addSubstitution(BuiltinType::SChar);
3123 if(mangleSubstitution(BuiltinType::Short))
3126addSubstitution(BuiltinType::Short);
3129 if(mangleSubstitution(BuiltinType::Int))
3132addSubstitution(BuiltinType::Int);
3135 if(mangleSubstitution(BuiltinType::Long))
3138addSubstitution(BuiltinType::Long);
3141 if(mangleSubstitution(BuiltinType::Int128))
3144addSubstitution(BuiltinType::Int128);
3147llvm_unreachable(
"Unknown integer size for normalization");
3150 switch(getASTContext().getTypeSize(
T)) {
3152 if(mangleSubstitution(BuiltinType::UChar))
3155addSubstitution(BuiltinType::UChar);
3158 if(mangleSubstitution(BuiltinType::UShort))
3161addSubstitution(BuiltinType::UShort);
3164 if(mangleSubstitution(BuiltinType::UInt))
3167addSubstitution(BuiltinType::UInt);
3170 if(mangleSubstitution(BuiltinType::ULong))
3173addSubstitution(BuiltinType::ULong);
3176 if(mangleSubstitution(BuiltinType::UInt128))
3179addSubstitution(BuiltinType::UInt128);
3182llvm_unreachable(
"Unknown integer size for normalization");
3187 switch(
T->getKind()) {
3188 caseBuiltinType::Void:
3191 caseBuiltinType::Bool:
3194 caseBuiltinType::Char_U:
3195 caseBuiltinType::Char_S:
3198 caseBuiltinType::UChar:
3201 caseBuiltinType::UShort:
3204 caseBuiltinType::UInt:
3207 caseBuiltinType::ULong:
3210 caseBuiltinType::ULongLong:
3213 caseBuiltinType::UInt128:
3216 caseBuiltinType::SChar:
3219 caseBuiltinType::WChar_S:
3220 caseBuiltinType::WChar_U:
3223 caseBuiltinType::Char8:
3226 caseBuiltinType::Char16:
3229 caseBuiltinType::Char32:
3232 caseBuiltinType::Short:
3235 caseBuiltinType::Int:
3238 caseBuiltinType::Long:
3241 caseBuiltinType::LongLong:
3244 caseBuiltinType::Int128:
3247 caseBuiltinType::Float16:
3250 caseBuiltinType::ShortAccum:
3253 caseBuiltinType::Accum:
3256 caseBuiltinType::LongAccum:
3259 caseBuiltinType::UShortAccum:
3262 caseBuiltinType::UAccum:
3265 caseBuiltinType::ULongAccum:
3268 caseBuiltinType::ShortFract:
3271 caseBuiltinType::Fract:
3274 caseBuiltinType::LongFract:
3277 caseBuiltinType::UShortFract:
3280 caseBuiltinType::UFract:
3283 caseBuiltinType::ULongFract:
3286 caseBuiltinType::SatShortAccum:
3289 caseBuiltinType::SatAccum:
3292 caseBuiltinType::SatLongAccum:
3295 caseBuiltinType::SatUShortAccum:
3298 caseBuiltinType::SatUAccum:
3301 caseBuiltinType::SatULongAccum:
3304 caseBuiltinType::SatShortFract:
3307 caseBuiltinType::SatFract:
3310 caseBuiltinType::SatLongFract:
3313 caseBuiltinType::SatUShortFract:
3316 caseBuiltinType::SatUFract:
3319 caseBuiltinType::SatULongFract:
3322 caseBuiltinType::Half:
3325 caseBuiltinType::Float:
3328 caseBuiltinType::Double:
3331 caseBuiltinType::LongDouble: {
3333getASTContext().getLangOpts().OpenMP &&
3334getASTContext().getLangOpts().OpenMPIsTargetDevice
3335? getASTContext().getAuxTargetInfo()
3336: &getASTContext().getTargetInfo();
3340 caseBuiltinType::Float128: {
3342getASTContext().getLangOpts().OpenMP &&
3343getASTContext().getLangOpts().OpenMPIsTargetDevice
3344? getASTContext().getAuxTargetInfo()
3345: &getASTContext().getTargetInfo();
3349 caseBuiltinType::BFloat16: {
3351((getASTContext().getLangOpts().OpenMP &&
3352getASTContext().getLangOpts().OpenMPIsTargetDevice) ||
3353getASTContext().getLangOpts().SYCLIsDevice)
3354? getASTContext().getAuxTargetInfo()
3355: &getASTContext().getTargetInfo();
3359 caseBuiltinType::Ibm128: {
3360 const TargetInfo*TI = &getASTContext().getTargetInfo();
3364 caseBuiltinType::NullPtr:
3368#define BUILTIN_TYPE(Id, SingletonId) 3369#define PLACEHOLDER_TYPE(Id, SingletonId) \ 3370 case BuiltinType::Id: 3371#include "clang/AST/BuiltinTypes.def" 3372 caseBuiltinType::Dependent:
3374llvm_unreachable(
"mangling a placeholder type");
3376 caseBuiltinType::ObjCId:
3377Out <<
"11objc_object";
3379 caseBuiltinType::ObjCClass:
3380Out <<
"10objc_class";
3382 caseBuiltinType::ObjCSel:
3383Out <<
"13objc_selector";
3385#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 3386 case BuiltinType::Id: \ 3387 type_name = "ocl_"#ImgType "_" #Suffix; \
3388Out << type_name.size() << type_name; \
3390#include "clang/Basic/OpenCLImageTypes.def" 3391 caseBuiltinType::OCLSampler:
3392Out <<
"11ocl_sampler";
3394 caseBuiltinType::OCLEvent:
3395Out <<
"9ocl_event";
3397 caseBuiltinType::OCLClkEvent:
3398Out <<
"12ocl_clkevent";
3400 caseBuiltinType::OCLQueue:
3401Out <<
"9ocl_queue";
3403 caseBuiltinType::OCLReserveID:
3404Out <<
"13ocl_reserveid";
3406#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 3407 case BuiltinType::Id: \ 3408 type_name = "ocl_"#ExtType; \
3409Out << type_name.size() << type_name; \
3411#include "clang/Basic/OpenCLExtensionTypes.def" 3415#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \ 3416 case BuiltinType::Id: \ 3417 if (T->getKind() == BuiltinType::SveBFloat16 && \ 3418 isCompatibleWith(LangOptions::ClangABI::Ver17)) { \ 3420 mangleVendorType("__SVBFloat16_t"); \
3422type_name = #MangledName; \
3423Out << (type_name == #Name ? "u" : "") << type_name.size() << type_name; \
3426#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \ 3427 case BuiltinType::Id: \ 3428 type_name = #MangledName; \ 3429 Out << (type_name == #Name ? "u": "") << type_name.size() << type_name; \
3431#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \ 3432 case BuiltinType::Id: \ 3433 type_name = #MangledName; \ 3434 Out << (type_name == #Name ? "u": "") << type_name.size() << type_name; \
3436#define SVE_SCALAR_TYPE(Name, MangledName, Id, SingletonId, Bits) \ 3437 case BuiltinType::Id: \ 3438 type_name = #MangledName; \ 3439 Out << (type_name == #Name ? "u": "") << type_name.size() << type_name; \
3441#include "clang/Basic/AArch64SVEACLETypes.def" 3442#define PPC_VECTOR_TYPE(Name, Id, Size) \ 3443 case BuiltinType::Id: \ 3444 mangleVendorType(#Name); \ 3446#include "clang/Basic/PPCTypes.def" 3448#define RVV_TYPE(Name, Id, SingletonId) \ 3449 case BuiltinType::Id: \ 3450 mangleVendorType(Name); \ 3452#include "clang/Basic/RISCVVTypes.def" 3453#define WASM_REF_TYPE(InternalName, MangledName, Id, SingletonId, AS) \ 3454 case BuiltinType::Id: \ 3455 mangleVendorType(MangledName); \ 3457#include "clang/Basic/WebAssemblyReferenceTypes.def" 3458#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \ 3459 case BuiltinType::Id: \ 3460 mangleVendorType(Name); \ 3462#include "clang/Basic/AMDGPUTypes.def" 3463#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ 3464 case BuiltinType::Id: \ 3465 mangleVendorType(#Name); \ 3467#include "clang/Basic/HLSLIntangibleTypes.def" 3471StringRef CXXNameMangler::getCallingConvQualifierName(
CallingConvCC) {
3512 return "swiftcall";
3514 return "swiftasynccall";
3516llvm_unreachable(
"bad calling convention");
3519voidCXXNameMangler::mangleExtFunctionInfo(
const FunctionType*
T) {
3528StringRef CCQualifier = getCallingConvQualifierName(
T->
getExtInfo().
getCC());
3529 if(!CCQualifier.empty())
3530mangleVendorQualifier(CCQualifier);
3563llvm_unreachable(
"Unrecognised SME attribute");
3578voidCXXNameMangler::mangleSMEAttrs(
unsignedSMEAttrs) {
3598Out <<
"Lj"<<
static_cast<unsigned>(Bitmask) <<
"EE";
3609 caseParameterABI::Ordinary:
3613 caseParameterABI::HLSLOut:
3614 caseParameterABI::HLSLInOut:
3619 caseParameterABI::SwiftContext:
3620 caseParameterABI::SwiftAsyncContext:
3621 caseParameterABI::SwiftErrorResult:
3622 caseParameterABI::SwiftIndirectResult:
3628mangleVendorQualifier(
"ns_consumed");
3631mangleVendorQualifier(
"noescape");
3641Out <<
"11__SME_ATTRSI";
3643mangleExtFunctionInfo(
T);
3660mangleType(ExceptTy);
3671mangleBareFunctionType(
T,
true);
3678mangleSMEAttrs(SMEAttrs);
3687FunctionTypeDepthState saved = FunctionTypeDepth.push();
3689FunctionTypeDepth.enterResultType();
3691FunctionTypeDepth.leaveResultType();
3693FunctionTypeDepth.pop(saved);
3698 boolMangleReturnType,
3702FunctionTypeDepthState saved = FunctionTypeDepth.push();
3705 if(MangleReturnType) {
3706FunctionTypeDepth.enterResultType();
3710mangleVendorQualifier(
"ns_returns_retained");
3715 autoSplitReturnTy = ReturnTy.
split();
3717ReturnTy = getASTContext().getQualifiedType(SplitReturnTy);
3719mangleType(ReturnTy);
3721FunctionTypeDepth.leaveResultType();
3729 for(
unsignedI = 0,
E= Proto->
getNumParams(); I !=
E; ++I) {
3743assert(
Attr->getType() <= 9 &&
Attr->getType() >= 0);
3744 if(
Attr->isDynamic())
3745Out <<
"U25pass_dynamic_object_size"<<
Attr->getType();
3747Out <<
"U17pass_object_size"<<
Attr->getType();
3758FunctionTypeDepth.enterResultType();
3762FunctionTypeDepth.pop(saved);
3768mangleName(
T->getDecl());
3773voidCXXNameMangler::mangleType(
const EnumType*
T) {
3774mangleType(
static_cast<const TagType*
>(
T));
3776voidCXXNameMangler::mangleType(
const RecordType*
T) {
3777mangleType(
static_cast<const TagType*
>(
T));
3779voidCXXNameMangler::mangleType(
const TagType*
T) {
3780mangleName(
T->getDecl());
3787Out <<
'A'<<
T->getSize() <<
'_';
3788mangleType(
T->getElementType());
3793 if(
T->getSizeExpr())
3794mangleExpression(
T->getSizeExpr());
3796mangleType(
T->getElementType());
3803 if(
T->getSizeExpr())
3804mangleExpression(
T->getSizeExpr());
3806mangleType(
T->getElementType());
3810mangleType(
T->getElementType());
3817mangleType(
QualType(
T->getClass(), 0));
3840mangleType(PointeeType);
3845mangleTemplateParameter(
T->getDepth(),
T->getIndex());
3854Out <<
"_SUBSTPACK_";
3858voidCXXNameMangler::mangleType(
const PointerType*
T) {
3880voidCXXNameMangler::mangleType(
const ComplexType*
T) {
3882mangleType(
T->getElementType());
3888voidCXXNameMangler::mangleNeonVectorType(
const VectorType*
T) {
3889 QualTypeEltType =
T->getElementType();
3890assert(EltType->
isBuiltinType() &&
"Neon vector element not a BuiltinType");
3891 const char*EltName =
nullptr;
3892 if(
T->getVectorKind() == VectorKind::NeonPoly) {
3893 switch(cast<BuiltinType>(EltType)->
getKind()) {
3894 caseBuiltinType::SChar:
3895 caseBuiltinType::UChar:
3896EltName =
"poly8_t";
3898 caseBuiltinType::Short:
3899 caseBuiltinType::UShort:
3900EltName =
"poly16_t";
3902 caseBuiltinType::LongLong:
3903 caseBuiltinType::ULongLong:
3904EltName =
"poly64_t";
3906 default: llvm_unreachable(
"unexpected Neon polynomial vector element type");
3909 switch(cast<BuiltinType>(EltType)->
getKind()) {
3910 caseBuiltinType::SChar: EltName =
"int8_t";
break;
3911 caseBuiltinType::UChar: EltName =
"uint8_t";
break;
3912 caseBuiltinType::Short: EltName =
"int16_t";
break;
3913 caseBuiltinType::UShort: EltName =
"uint16_t";
break;
3914 caseBuiltinType::Int: EltName =
"int32_t";
break;
3915 caseBuiltinType::UInt: EltName =
"uint32_t";
break;
3916 caseBuiltinType::LongLong: EltName =
"int64_t";
break;
3917 caseBuiltinType::ULongLong: EltName =
"uint64_t";
break;
3918 caseBuiltinType::Double: EltName =
"float64_t";
break;
3919 caseBuiltinType::Float: EltName =
"float32_t";
break;
3920 caseBuiltinType::Half: EltName =
"float16_t";
break;
3921 caseBuiltinType::BFloat16: EltName =
"bfloat16_t";
break;
3922 caseBuiltinType::MFloat8:
3923EltName =
"mfloat8_t";
3926llvm_unreachable(
"unexpected Neon vector element type");
3929 const char*BaseName =
nullptr;
3930 unsignedBitSize = (
T->getNumElements() *
3931getASTContext().getTypeSize(EltType));
3933BaseName =
"__simd64_";
3935assert(BitSize == 128 &&
"Neon vector type not 64 or 128 bits");
3936BaseName =
"__simd128_";
3938Out << strlen(BaseName) + strlen(EltName);
3939Out << BaseName << EltName;
3946 "cannot mangle this dependent neon vector type yet");
3947Diags.
Report(
T->getAttributeLoc(), DiagID);
3951 switch(EltType->
getKind()) {
3952 caseBuiltinType::SChar:
3954 caseBuiltinType::Short:
3956 caseBuiltinType::Int:
3958 caseBuiltinType::Long:
3959 caseBuiltinType::LongLong:
3961 caseBuiltinType::UChar:
3963 caseBuiltinType::UShort:
3965 caseBuiltinType::UInt:
3967 caseBuiltinType::ULong:
3968 caseBuiltinType::ULongLong:
3970 caseBuiltinType::Half:
3972 caseBuiltinType::Float:
3974 caseBuiltinType::Double:
3976 caseBuiltinType::BFloat16:
3978 caseBuiltinType::MFloat8:
3981llvm_unreachable(
"Unexpected vector element base type");
3988voidCXXNameMangler::mangleAArch64NeonVectorType(
const VectorType*
T) {
3989 QualTypeEltType =
T->getElementType();
3990assert(EltType->
isBuiltinType() &&
"Neon vector element not a BuiltinType");
3992(
T->getNumElements() * getASTContext().getTypeSize(EltType));
3995assert((BitSize == 64 || BitSize == 128) &&
3996 "Neon vector type not 64 or 128 bits");
3999 if(
T->getVectorKind() == VectorKind::NeonPoly) {
4000 switch(cast<BuiltinType>(EltType)->
getKind()) {
4001 caseBuiltinType::UChar:
4004 caseBuiltinType::UShort:
4005EltName =
"Poly16";
4007 caseBuiltinType::ULong:
4008 caseBuiltinType::ULongLong:
4009EltName =
"Poly64";
4012llvm_unreachable(
"unexpected Neon polynomial vector element type");
4018(
"__"+ EltName +
"x"+ Twine(
T->getNumElements()) +
"_t").str();
4025 "cannot mangle this dependent neon vector type yet");
4026Diags.
Report(
T->getAttributeLoc(), DiagID);
4053voidCXXNameMangler::mangleAArch64FixedSveVectorType(
const VectorType*
T) {
4054assert((
T->getVectorKind() == VectorKind::SveFixedLengthData ||
4055 T->getVectorKind() == VectorKind::SveFixedLengthPredicate) &&
4056 "expected fixed-length SVE vector!");
4058 QualTypeEltType =
T->getElementType();
4060 "expected builtin type for fixed-length SVE vector!");
4063 switch(cast<BuiltinType>(EltType)->
getKind()) {
4064 caseBuiltinType::SChar:
4067 caseBuiltinType::UChar: {
4068 if(
T->getVectorKind() == VectorKind::SveFixedLengthData)
4074 caseBuiltinType::Short:
4077 caseBuiltinType::UShort:
4080 caseBuiltinType::Int:
4083 caseBuiltinType::UInt:
4086 caseBuiltinType::Long:
4089 caseBuiltinType::ULong:
4092 caseBuiltinType::Half:
4095 caseBuiltinType::Float:
4098 caseBuiltinType::Double:
4101 caseBuiltinType::BFloat16:
4105llvm_unreachable(
"unexpected element type for fixed-length SVE vector!");
4108 unsignedVecSizeInBits = getASTContext().getTypeInfo(
T).Width;
4110 if(
T->getVectorKind() == VectorKind::SveFixedLengthPredicate)
4113Out <<
"9__SVE_VLSI";
4114mangleVendorType(TypeName);
4115Out <<
"Lj"<< VecSizeInBits <<
"EE";
4118voidCXXNameMangler::mangleAArch64FixedSveVectorType(
4123 "cannot mangle this dependent fixed-length SVE vector type yet");
4124Diags.
Report(
T->getAttributeLoc(), DiagID);
4127voidCXXNameMangler::mangleRISCVFixedRVVVectorType(
const VectorType*
T) {
4128assert((
T->getVectorKind() == VectorKind::RVVFixedLengthData ||
4129 T->getVectorKind() == VectorKind::RVVFixedLengthMask ||
4130 T->getVectorKind() == VectorKind::RVVFixedLengthMask_1 ||
4131 T->getVectorKind() == VectorKind::RVVFixedLengthMask_2 ||
4132 T->getVectorKind() == VectorKind::RVVFixedLengthMask_4) &&
4133 "expected fixed-length RVV vector!");
4135 QualTypeEltType =
T->getElementType();
4137 "expected builtin type for fixed-length RVV vector!");
4140llvm::raw_svector_ostream TypeNameOS(TypeNameStr);
4141TypeNameOS <<
"__rvv_";
4142 switch(cast<BuiltinType>(EltType)->
getKind()) {
4143 caseBuiltinType::SChar:
4144TypeNameOS <<
"int8";
4146 caseBuiltinType::UChar:
4147 if(
T->getVectorKind() == VectorKind::RVVFixedLengthData)
4148TypeNameOS <<
"uint8";
4150TypeNameOS <<
"bool";
4152 caseBuiltinType::Short:
4153TypeNameOS <<
"int16";
4155 caseBuiltinType::UShort:
4156TypeNameOS <<
"uint16";
4158 caseBuiltinType::Int:
4159TypeNameOS <<
"int32";
4161 caseBuiltinType::UInt:
4162TypeNameOS <<
"uint32";
4164 caseBuiltinType::Long:
4165TypeNameOS <<
"int64";
4167 caseBuiltinType::ULong:
4168TypeNameOS <<
"uint64";
4170 caseBuiltinType::Float16:
4171TypeNameOS <<
"float16";
4173 caseBuiltinType::Float:
4174TypeNameOS <<
"float32";
4176 caseBuiltinType::Double:
4177TypeNameOS <<
"float64";
4180llvm_unreachable(
"unexpected element type for fixed-length RVV vector!");
4183 unsignedVecSizeInBits;
4184 switch(
T->getVectorKind()) {
4185 caseVectorKind::RVVFixedLengthMask_1:
4188 caseVectorKind::RVVFixedLengthMask_2:
4191 caseVectorKind::RVVFixedLengthMask_4:
4195VecSizeInBits = getASTContext().getTypeInfo(
T).Width;
4200 autoVScale = getASTContext().getTargetInfo().getVScaleRange(
4201getASTContext().getLangOpts(),
false);
4202 unsignedVLen = VScale->first * llvm::RISCV::RVVBitsPerBlock;
4204 if(
T->getVectorKind() == VectorKind::RVVFixedLengthData) {
4206 if(VecSizeInBits >= VLen)
4207TypeNameOS << (VecSizeInBits / VLen);
4209TypeNameOS <<
'f'<< (VLen / VecSizeInBits);
4211TypeNameOS << (VLen / VecSizeInBits);
4213TypeNameOS <<
"_t";
4215Out <<
"9__RVV_VLSI";
4216mangleVendorType(TypeNameStr);
4217Out <<
"Lj"<< VecSizeInBits <<
"EE";
4220voidCXXNameMangler::mangleRISCVFixedRVVVectorType(
4225 "cannot mangle this dependent fixed-length RVV vector type yet");
4226Diags.
Report(
T->getAttributeLoc(), DiagID);
4237voidCXXNameMangler::mangleType(
const VectorType*
T) {
4238 if((
T->getVectorKind() == VectorKind::Neon ||
4239 T->getVectorKind() == VectorKind::NeonPoly)) {
4240llvm::Triple
Target= getASTContext().getTargetInfo().getTriple();
4241llvm::Triple::ArchType Arch =
4242getASTContext().getTargetInfo().getTriple().getArch();
4243 if((Arch == llvm::Triple::aarch64 ||
4244Arch == llvm::Triple::aarch64_be) && !
Target.isOSDarwin())
4245mangleAArch64NeonVectorType(
T);
4247mangleNeonVectorType(
T);
4249}
else if(
T->getVectorKind() == VectorKind::SveFixedLengthData ||
4250 T->getVectorKind() == VectorKind::SveFixedLengthPredicate) {
4251mangleAArch64FixedSveVectorType(
T);
4253}
else if(
T->getVectorKind() == VectorKind::RVVFixedLengthData ||
4254 T->getVectorKind() == VectorKind::RVVFixedLengthMask ||
4255 T->getVectorKind() == VectorKind::RVVFixedLengthMask_1 ||
4256 T->getVectorKind() == VectorKind::RVVFixedLengthMask_2 ||
4257 T->getVectorKind() == VectorKind::RVVFixedLengthMask_4) {
4258mangleRISCVFixedRVVVectorType(
T);
4261Out <<
"Dv"<<
T->getNumElements() <<
'_';
4262 if(
T->getVectorKind() == VectorKind::AltiVecPixel)
4264 else if(
T->getVectorKind() == VectorKind::AltiVecBool)
4267mangleType(
T->getElementType());
4271 if((
T->getVectorKind() == VectorKind::Neon ||
4272 T->getVectorKind() == VectorKind::NeonPoly)) {
4273llvm::Triple
Target= getASTContext().getTargetInfo().getTriple();
4274llvm::Triple::ArchType Arch =
4275getASTContext().getTargetInfo().getTriple().getArch();
4276 if((Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_be) &&
4278mangleAArch64NeonVectorType(
T);
4280mangleNeonVectorType(
T);
4282}
else if(
T->getVectorKind() == VectorKind::SveFixedLengthData ||
4283 T->getVectorKind() == VectorKind::SveFixedLengthPredicate) {
4284mangleAArch64FixedSveVectorType(
T);
4286}
else if(
T->getVectorKind() == VectorKind::RVVFixedLengthData) {
4287mangleRISCVFixedRVVVectorType(
T);
4292mangleExpression(
T->getSizeExpr());
4294 if(
T->getVectorKind() == VectorKind::AltiVecPixel)
4296 else if(
T->getVectorKind() == VectorKind::AltiVecBool)
4299mangleType(
T->getElementType());
4303mangleType(
static_cast<const VectorType*
>(
T));
4307mangleExpression(
T->getSizeExpr());
4309mangleType(
T->getElementType());
4316mangleVendorType(
"matrix_type");
4319 auto&ASTCtx = getASTContext();
4320 unsignedBitWidth = ASTCtx.getTypeSize(ASTCtx.getSizeType());
4321llvm::APSInt Rows(BitWidth);
4322Rows =
T->getNumRows();
4323mangleIntegerLiteral(ASTCtx.getSizeType(), Rows);
4324llvm::APSInt Columns(BitWidth);
4325Columns =
T->getNumColumns();
4326mangleIntegerLiteral(ASTCtx.getSizeType(), Columns);
4327mangleType(
T->getElementType());
4334mangleVendorType(
"matrix_type");
4337mangleTemplateArgExpr(
T->getRowExpr());
4338mangleTemplateArgExpr(
T->getColumnExpr());
4339mangleType(
T->getElementType());
4345mangleQualifiers(split.
Quals,
T);
4352mangleType(
T->getPattern());
4356 if(!
T->hasSelectedType())
4357mangleType(
T->getPattern());
4359mangleType(
T->getSelectedType());
4363mangleSourceName(
T->getDecl()->getIdentifier());
4368 if(
T->isKindOfType())
4369Out <<
"U8__kindof";
4371 if(!
T->qual_empty()) {
4374llvm::raw_svector_ostream QualOS(QualStr);
4375QualOS <<
"objcproto";
4376 for(
const auto*I :
T->quals()) {
4377StringRef
name= I->getName();
4380mangleVendorQualifier(QualStr);
4383mangleType(
T->getBaseType());
4385 if(
T->isSpecialized()) {
4388 for(
autotypeArg :
T->getTypeArgs())
4389mangleType(typeArg);
4395Out <<
"U13block_pointer";
4403mangleType(
T->getInjectedSpecializationType());
4407 if(
TemplateDecl*TD =
T->getTemplateName().getAsTemplateDecl()) {
4408mangleTemplateName(TD,
T->template_arguments());
4410 if(mangleSubstitution(
QualType(
T, 0)))
4413mangleTemplatePrefix(
T->getTemplateName());
4418mangleTemplateArgs(
T->getTemplateName(),
T->template_arguments());
4434 switch(
T->getKeyword()) {
4435 caseElaboratedTypeKeyword::None:
4436 caseElaboratedTypeKeyword::Typename:
4438 caseElaboratedTypeKeyword::Struct:
4439 caseElaboratedTypeKeyword::Class:
4440 caseElaboratedTypeKeyword::Interface:
4443 caseElaboratedTypeKeyword::Union:
4446 caseElaboratedTypeKeyword::Enum:
4452manglePrefix(
T->getQualifier());
4453mangleSourceName(
T->getIdentifier());
4463getASTContext().getDependentTemplateName(
T->getQualifier(),
4464 T->getIdentifier());
4465mangleTemplatePrefix(Prefix);
4470mangleTemplateArgs(Prefix,
T->template_arguments());
4474voidCXXNameMangler::mangleType(
const TypeOfType*
T) {
4487 Expr*
E=
T->getUnderlyingExpr();
4497 if(isa<DeclRefExpr>(
E) ||
4498isa<MemberExpr>(
E) ||
4499isa<UnresolvedLookupExpr>(
E) ||
4500isa<DependentScopeDeclRefExpr>(
E) ||
4501isa<CXXDependentScopeMemberExpr>(
E) ||
4502isa<UnresolvedMemberExpr>(
E))
4506mangleExpression(
E);
4514StringRef BuiltinName;
4515 switch(
T->getUTTKind()) {
4516#define TRANSFORM_TYPE_TRAIT_DEF(Enum, Trait) \ 4517 case UnaryTransformType::Enum: \ 4518 BuiltinName = "__"#Trait; \
4520#include "clang/Basic/TransformTypeTraits.def" 4522mangleVendorType(BuiltinName);
4526mangleType(
T->getBaseType());
4530voidCXXNameMangler::mangleType(
const AutoType*
T) {
4531assert(
T->getDeducedType().isNull() &&
4532 "Deduced AutoType shouldn't be handled here!");
4533assert(
T->getKeyword() != AutoTypeKeyword::GNUAutoType &&
4534 "shouldn't need to mangle __auto_type!");
4539 if(
T->isConstrained() && !isCompatibleWith(LangOptions::ClangABI::Ver17)) {
4540Out << (
T->isDecltypeAuto() ?
"DK":
"Dk");
4541mangleTypeConstraint(
T->getTypeConstraintConcept(),
4542 T->getTypeConstraintArguments());
4544Out << (
T->isDecltypeAuto() ?
"Dc":
"Da");
4549 QualTypeDeduced =
T->getDeducedType();
4551 returnmangleType(Deduced);
4555 "shouldn't form deduced TST unless we know we have a template");
4559voidCXXNameMangler::mangleType(
const AtomicType*
T) {
4562Out <<
"U7_Atomic";
4563mangleType(
T->getValueType());
4566voidCXXNameMangler::mangleType(
const PipeType*
T) {
4570Out <<
"8ocl_pipe";
4573voidCXXNameMangler::mangleType(
const BitIntType*
T) {
4577Out <<
"D"<< (
T->isUnsigned() ?
"U":
"B") <<
T->getNumBits() <<
"_";
4584Out <<
"D"<< (
T->isUnsigned() ?
"U":
"B");
4585mangleExpression(
T->getNumBitsExpr());
4590mangleType(cast<ConstantArrayType>(
T));
4598 casellvm::dxil::ResourceClass::UAV:
4601 casellvm::dxil::ResourceClass::SRV:
4604 casellvm::dxil::ResourceClass::CBuffer:
4607 casellvm::dxil::ResourceClass::Sampler:
4615 if(
T->hasContainedType())
4617mangleVendorQualifier(Str);
4619 if(
T->hasContainedType()) {
4620mangleType(
T->getContainedType());
4622mangleType(
T->getWrappedType());
4625voidCXXNameMangler::mangleIntegerLiteral(
QualType T,
4626 constllvm::APSInt &
Value) {
4633Out << (
Value.getBoolValue() ?
'1':
'0');
4635mangleNumber(
Value);
4641voidCXXNameMangler::mangleMemberExprBase(
const Expr*
Base,
boolIsArrow) {
4643 while(
const auto*RT =
Base->getType()->getAs<
RecordType>()) {
4644 if(!RT->getDecl()->isAnonymousStructOrUnion())
4646 const auto*ME = dyn_cast<MemberExpr>(
Base);
4649 Base= ME->getBase();
4650IsArrow = ME->isArrow();
4653 if(
Base->isImplicitCXXThis()) {
4659Out << (IsArrow ?
"pt":
"dt");
4660mangleExpression(
Base);
4665voidCXXNameMangler::mangleMemberExpr(
const Expr*base,
4671 unsignedNumTemplateArgs,
4676mangleMemberExprBase(base, isArrow);
4677mangleUnresolvedName(qualifier, member, TemplateArgs, NumTemplateArgs, arity);
4690 if(callee == fn)
return false;
4694 if(!lookup)
return false;
4711voidCXXNameMangler::mangleCastExpression(
const Expr*
E, StringRef CastEncoding) {
4713Out << CastEncoding;
4718voidCXXNameMangler::mangleInitListElements(
const InitListExpr*InitList) {
4720InitList = Syntactic;
4721 for(
unsignedi = 0, e = InitList->
getNumInits(); i != e; ++i)
4722mangleExpression(InitList->
getInit(i));
4725voidCXXNameMangler::mangleRequirement(
SourceLocationRequiresExprLoc,
4732 autoHandleSubstitutionFailure =
4737 "containing a substitution failure");
4743 caseRequirement::RK_Type: {
4744 const auto*TR = cast<concepts::TypeRequirement>(Req);
4745 if(TR->isSubstitutionFailure())
4746 returnHandleSubstitutionFailure(
4747TR->getSubstitutionDiagnostic()->DiagLoc);
4750mangleType(TR->getType()->getType());
4754 caseRequirement::RK_Simple:
4755 caseRequirement::RK_Compound: {
4756 const auto*ER = cast<concepts::ExprRequirement>(Req);
4757 if(ER->isExprSubstitutionFailure())
4758 returnHandleSubstitutionFailure(
4759ER->getExprSubstitutionDiagnostic()->DiagLoc);
4762mangleExpression(ER->getExpr());
4764 if(ER->hasNoexceptRequirement())
4767 if(!ER->getReturnTypeRequirement().isEmpty()) {
4768 if(ER->getReturnTypeRequirement().isSubstitutionFailure())
4769 returnHandleSubstitutionFailure(ER->getReturnTypeRequirement()
4770.getSubstitutionDiagnostic()
4774mangleTypeConstraint(ER->getReturnTypeRequirement().getTypeConstraint());
4779 caseRequirement::RK_Nested:
4780 const auto*NR = cast<concepts::NestedRequirement>(Req);
4781 if(NR->hasInvalidConstraint()) {
4784 returnHandleSubstitutionFailure(RequiresExprLoc);
4788mangleExpression(NR->getConstraintExpr());
4793voidCXXNameMangler::mangleExpression(
const Expr*
E,
unsignedArity,
4794 boolAsTemplateArg) {
4823 QualTypeImplicitlyConvertedToType;
4827 boolIsPrimaryExpr =
true;
4828 autoNotPrimaryExpr = [&] {
4829 if(AsTemplateArg && IsPrimaryExpr)
4831IsPrimaryExpr =
false;
4834 autoMangleDeclRefExpr = [&](
const NamedDecl*
D) {
4845mangleFunctionParam(cast<ParmVarDecl>(
D));
4848 caseDecl::EnumConstant: {
4855 caseDecl::NonTypeTemplateParm:
4868 caseExpr::NoStmtClass:
4869#define ABSTRACT_STMT(Type) 4870#define EXPR(Type, Base) 4871#define STMT(Type, Base) \ 4872 case Expr::Type##Class: 4873#include "clang/AST/StmtNodes.inc" 4878 caseExpr::AddrLabelExprClass:
4879 caseExpr::DesignatedInitUpdateExprClass:
4880 caseExpr::ImplicitValueInitExprClass:
4881 caseExpr::ArrayInitLoopExprClass:
4882 caseExpr::ArrayInitIndexExprClass:
4883 caseExpr::NoInitExprClass:
4884 caseExpr::ParenListExprClass:
4885 caseExpr::MSPropertyRefExprClass:
4886 caseExpr::MSPropertySubscriptExprClass:
4887 caseExpr::TypoExprClass:
4888 caseExpr::RecoveryExprClass:
4889 caseExpr::ArraySectionExprClass:
4890 caseExpr::OMPArrayShapingExprClass:
4891 caseExpr::OMPIteratorExprClass:
4892 caseExpr::CXXInheritedCtorInitExprClass:
4893 caseExpr::CXXParenListInitExprClass:
4894 caseExpr::PackIndexingExprClass:
4895llvm_unreachable(
"unexpected statement kind");
4897 caseExpr::ConstantExprClass:
4898 E= cast<ConstantExpr>(
E)->getSubExpr();
4902 caseExpr::BlockExprClass:
4903 caseExpr::ChooseExprClass:
4904 caseExpr::CompoundLiteralExprClass:
4905 caseExpr::ExtVectorElementExprClass:
4906 caseExpr::GenericSelectionExprClass:
4907 caseExpr::ObjCEncodeExprClass:
4908 caseExpr::ObjCIsaExprClass:
4909 caseExpr::ObjCIvarRefExprClass:
4910 caseExpr::ObjCMessageExprClass:
4911 caseExpr::ObjCPropertyRefExprClass:
4912 caseExpr::ObjCProtocolExprClass:
4913 caseExpr::ObjCSelectorExprClass:
4914 caseExpr::ObjCStringLiteralClass:
4915 caseExpr::ObjCBoxedExprClass:
4916 caseExpr::ObjCArrayLiteralClass:
4917 caseExpr::ObjCDictionaryLiteralClass:
4918 caseExpr::ObjCSubscriptRefExprClass:
4919 caseExpr::ObjCIndirectCopyRestoreExprClass:
4920 caseExpr::ObjCAvailabilityCheckExprClass:
4921 caseExpr::OffsetOfExprClass:
4922 caseExpr::PredefinedExprClass:
4923 caseExpr::ShuffleVectorExprClass:
4924 caseExpr::ConvertVectorExprClass:
4925 caseExpr::StmtExprClass:
4926 caseExpr::ArrayTypeTraitExprClass:
4927 caseExpr::ExpressionTraitExprClass:
4928 caseExpr::VAArgExprClass:
4929 caseExpr::CUDAKernelCallExprClass:
4930 caseExpr::AsTypeExprClass:
4931 caseExpr::PseudoObjectExprClass:
4932 caseExpr::AtomicExprClass:
4933 caseExpr::SourceLocExprClass:
4934 caseExpr::EmbedExprClass:
4935 caseExpr::BuiltinBitCastExprClass:
4936 caseExpr::ResolvedUnexpandedPackExprClass: {
4942 "cannot yet mangle expression type %0");
4950 caseExpr::CXXUuidofExprClass: {
4955 if(!isCompatibleWith(LangOptions::ClangABI::Ver11)) {
4956Out <<
"u8__uuidof";
4965Out <<
"u8__uuidoft";
4969Out <<
"u8__uuidofz";
4970mangleExpression(UuidExp);
4977 caseExpr::BinaryConditionalOperatorClass: {
4982 "?: operator with omitted middle operand cannot be mangled");
4989 caseExpr::OpaqueValueExprClass:
4990llvm_unreachable(
"cannot mangle opaque value; mangling wrong thing?");
4992 caseExpr::InitListExprClass: {
4995mangleInitListElements(cast<InitListExpr>(
E));
5000 caseExpr::DesignatedInitExprClass: {
5002 auto*DIE = cast<DesignatedInitExpr>(
E);
5003 for(
const auto&
Designator: DIE->designators()) {
5006mangleSourceName(
Designator.getFieldName());
5009mangleExpression(DIE->getArrayIndex(
Designator));
5012 "unknown designator kind");
5014mangleExpression(DIE->getArrayRangeStart(
Designator));
5015mangleExpression(DIE->getArrayRangeEnd(
Designator));
5018mangleExpression(DIE->getInit());
5022 caseExpr::CXXDefaultArgExprClass:
5023 E= cast<CXXDefaultArgExpr>(
E)->getExpr();
5026 caseExpr::CXXDefaultInitExprClass:
5027 E= cast<CXXDefaultInitExpr>(
E)->getExpr();
5030 caseExpr::CXXStdInitializerListExprClass:
5031 E= cast<CXXStdInitializerListExpr>(
E)->getSubExpr();
5034 caseExpr::SubstNonTypeTemplateParmExprClass: {
5037 auto*SNTTPE = cast<SubstNonTypeTemplateParmExpr>(
E);
5038 if(
auto*CE = dyn_cast<ConstantExpr>(SNTTPE->getReplacement())) {
5040 QualTypeParamType = SNTTPE->getParameterType(Context.getASTContext());
5041assert(CE->hasAPValueResult() &&
"expected the NTTP to have an APValue");
5042mangleValueInTemplateArg(ParamType, CE->getAPValueResult(),
false,
5048 E= cast<SubstNonTypeTemplateParmExpr>(
E)->getReplacement();
5052 caseExpr::UserDefinedLiteralClass:
5055 caseExpr::CXXMemberCallExprClass:
5056 caseExpr::CallExprClass: {
5058 const CallExpr*CE = cast<CallExpr>(
E);
5077 if(isa<PackExpansionExpr>(Arg))
5078CallArity = UnknownArity;
5080mangleExpression(CE->
getCallee(), CallArity);
5082mangleExpression(Arg);
5087 caseExpr::CXXNewExprClass: {
5091Out << (New->
isArray() ?
"na":
"nw");
5094mangleExpression(*I);
5108mangleExpression(*I);
5110 for(
unsignedi = 0, e = PLE->getNumExprs(); i != e; ++i)
5111mangleExpression(PLE->getExpr(i));
5113CXXNewInitializationStyle::Braces &&
5114isa<InitListExpr>(
Init)) {
5116mangleInitListElements(cast<InitListExpr>(
Init));
5118mangleExpression(
Init);
5124 caseExpr::CXXPseudoDestructorExprClass: {
5126 const auto*PDE = cast<CXXPseudoDestructorExpr>(
E);
5127 if(
const Expr*
Base= PDE->getBase())
5128mangleMemberExprBase(
Base, PDE->isArrow());
5132mangleUnresolvedPrefix(Qualifier,
5134mangleUnresolvedTypeOrSimpleId(ScopeInfo->getType());
5138 if(!mangleUnresolvedTypeOrSimpleId(ScopeInfo->getType()))
5141}
else if(Qualifier) {
5142mangleUnresolvedPrefix(Qualifier);
5146 QualTypeDestroyedType = PDE->getDestroyedType();
5147mangleUnresolvedTypeOrSimpleId(DestroyedType);
5151 caseExpr::MemberExprClass: {
5162 caseExpr::UnresolvedMemberExprClass: {
5173 caseExpr::CXXDependentScopeMemberExprClass: {
5176= cast<CXXDependentScopeMemberExpr>(
E);
5186 caseExpr::UnresolvedLookupExprClass: {
5195 caseExpr::CXXUnresolvedConstructExprClass: {
5201assert(N == 1 &&
"unexpected form for list initialization");
5202 auto*IL = cast<InitListExpr>(CE->
getArg(0));
5205mangleInitListElements(IL);
5212 if(N != 1) Out <<
'_';
5213 for(
unsignedI = 0; I != N; ++I) mangleExpression(CE->
getArg(I));
5214 if(N != 1) Out <<
'E';
5218 caseExpr::CXXConstructExprClass: {
5220 const auto*CE = cast<CXXConstructExpr>(
E);
5225 "implicit CXXConstructExpr must have one argument");
5226 E= cast<CXXConstructExpr>(
E)->getArg(0);
5232mangleExpression(
E);
5237 caseExpr::CXXTemporaryObjectExprClass: {
5239 const auto*CE = cast<CXXTemporaryObjectExpr>(
E);
5248 if(!List && N != 1)
5250 if(CE->isStdInitListInitialization()) {
5256 auto*ILE = cast<InitListExpr>(SILE->getSubExpr()->IgnoreImplicit());
5257mangleInitListElements(ILE);
5260mangleExpression(
E);
5267 caseExpr::CXXScalarValueInitExprClass:
5274 caseExpr::CXXNoexceptExprClass:
5277mangleExpression(cast<CXXNoexceptExpr>(
E)->getOperand());
5280 caseExpr::UnaryExprOrTypeTraitExprClass: {
5299: ImplicitlyConvertedToType;
5301mangleIntegerLiteral(
T,
V);
5307 autoMangleAlignofSizeofArg = [&] {
5320MangleAlignofSizeofArg();
5322 caseUETT_PreferredAlignOf:
5326 if(!isCompatibleWith(LangOptions::ClangABI::Ver11)) {
5327Out <<
"u11__alignof__";
5338MangleAlignofSizeofArg();
5340 caseUETT_DataSizeOf: {
5344 "cannot yet mangle __datasizeof expression");
5348 caseUETT_PtrAuthTypeDiscriminator: {
5352 "cannot yet mangle __builtin_ptrauth_type_discriminator expression");
5356 caseUETT_VecStep: {
5359 "cannot yet mangle vec_step expression");
5363 caseUETT_OpenMPRequiredSimdAlign: {
5367 "cannot yet mangle __builtin_omp_required_simd_align expression");
5371 caseUETT_VectorElements: {
5375 "cannot yet mangle __builtin_vectorelements expression");
5383 caseExpr::TypeTraitExprClass: {
5388mangleVendorType(Spelling);
5390mangleType(TSI->getType());
5396 caseExpr::CXXThrowExprClass: {
5410 caseExpr::CXXTypeidExprClass: {
5425 caseExpr::CXXDeleteExprClass: {
5436 caseExpr::UnaryOperatorClass: {
5445 caseExpr::ArraySubscriptExprClass: {
5452mangleExpression(AE->
getLHS());
5453mangleExpression(AE->
getRHS());
5457 caseExpr::MatrixSubscriptExprClass: {
5461mangleExpression(ME->
getBase());
5467 caseExpr::CompoundAssignOperatorClass:
5468 caseExpr::BinaryOperatorClass: {
5476mangleExpression(BO->
getLHS());
5477mangleExpression(BO->
getRHS());
5481 caseExpr::CXXRewrittenBinaryOperatorClass: {
5485cast<CXXRewrittenBinaryOperator>(
E)->getDecomposedForm();
5488mangleExpression(Decomposed.
LHS);
5489mangleExpression(Decomposed.
RHS);
5493 caseExpr::ConditionalOperatorClass: {
5496mangleOperatorName(OO_Conditional,
3);
5497mangleExpression(CO->
getCond());
5498mangleExpression(CO->
getLHS(), Arity);
5499mangleExpression(CO->
getRHS(), Arity);
5503 caseExpr::ImplicitCastExprClass: {
5504ImplicitlyConvertedToType =
E->
getType();
5505 E= cast<ImplicitCastExpr>(
E)->getSubExpr();
5509 caseExpr::ObjCBridgedCastExprClass: {
5513StringRef
Kind= cast<ObjCBridgedCastExpr>(
E)->getBridgeKindName();
5514Out <<
"v1U"<<
Kind.size() <<
Kind;
5515mangleCastExpression(
E,
"cv");
5519 caseExpr::CStyleCastExprClass:
5521mangleCastExpression(
E,
"cv");
5524 caseExpr::CXXFunctionalCastExprClass: {
5526 auto*
Sub= cast<ExplicitCastExpr>(
E)->getSubExpr()->IgnoreImplicit();
5528 if(
auto*CCE = dyn_cast<CXXConstructExpr>(Sub))
5529 if(CCE->getParenOrBraceRange().isInvalid())
5530 Sub= CCE->getArg(0)->IgnoreImplicit();
5531 if(
auto*StdInitList = dyn_cast<CXXStdInitializerListExpr>(Sub))
5532 Sub= StdInitList->getSubExpr()->IgnoreImplicit();
5533 if(
auto*IL = dyn_cast<InitListExpr>(Sub)) {
5536mangleInitListElements(IL);
5539mangleCastExpression(
E,
"cv");
5544 caseExpr::CXXStaticCastExprClass:
5546mangleCastExpression(
E,
"sc");
5548 caseExpr::CXXDynamicCastExprClass:
5550mangleCastExpression(
E,
"dc");
5552 caseExpr::CXXReinterpretCastExprClass:
5554mangleCastExpression(
E,
"rc");
5556 caseExpr::CXXConstCastExprClass:
5558mangleCastExpression(
E,
"cc");
5560 caseExpr::CXXAddrspaceCastExprClass:
5562mangleCastExpression(
E,
"ac");
5565 caseExpr::CXXOperatorCallExprClass: {
5574 for(
unsignedi = 0; i != NumArgs; ++i)
5575mangleExpression(CE->
getArg(i));
5579 caseExpr::ParenExprClass:
5580 E= cast<ParenExpr>(
E)->getSubExpr();
5583 caseExpr::ConceptSpecializationExprClass: {
5584 auto*CSE = cast<ConceptSpecializationExpr>(
E);
5585 if(isCompatibleWith(LangOptions::ClangABI::Ver17)) {
5590mangleTemplateName(CSE->getNamedConcept(), CSE->getTemplateArguments());
5596mangleUnresolvedName(
5597CSE->getNestedNameSpecifierLoc().getNestedNameSpecifier(),
5598CSE->getConceptNameInfo().getName(),
5599CSE->getTemplateArgsAsWritten()->getTemplateArgs(),
5600CSE->getTemplateArgsAsWritten()->getNumTemplateArgs());
5604 caseExpr::RequiresExprClass: {
5606 auto*RE = cast<RequiresExpr>(
E);
5610 if(RE->getLParenLoc().isValid()) {
5612FunctionTypeDepthState saved = FunctionTypeDepth.push();
5613 if(RE->getLocalParameters().empty()) {
5616 for(
ParmVarDecl*Param : RE->getLocalParameters()) {
5624FunctionTypeDepth.enterResultType();
5626mangleRequirement(RE->getExprLoc(), Req);
5627FunctionTypeDepth.pop(saved);
5632mangleRequirement(RE->getExprLoc(), Req);
5638 caseExpr::DeclRefExprClass:
5640MangleDeclRefExpr(cast<DeclRefExpr>(
E)->getDecl());
5643 caseExpr::SubstNonTypeTemplateParmPackExprClass:
5649Out <<
"_SUBSTPACK_";
5652 caseExpr::FunctionParmPackExprClass: {
5656Out <<
"v110_SUBSTPACK";
5661 caseExpr::DependentScopeDeclRefExprClass: {
5670 caseExpr::CXXBindTemporaryExprClass:
5671 E= cast<CXXBindTemporaryExpr>(
E)->getSubExpr();
5674 caseExpr::ExprWithCleanupsClass:
5675 E= cast<ExprWithCleanups>(
E)->getSubExpr();
5678 caseExpr::FloatingLiteralClass: {
5685 caseExpr::FixedPointLiteralClass:
5687mangleFixedPointLiteral();
5690 caseExpr::CharacterLiteralClass:
5694Out << cast<CharacterLiteral>(
E)->getValue();
5699 caseExpr::ObjCBoolLiteralExprClass:
5702Out << (cast<ObjCBoolLiteralExpr>(
E)->getValue() ?
'1':
'0');
5706 caseExpr::CXXBoolLiteralExprClass:
5709Out << (cast<CXXBoolLiteralExpr>(
E)->getValue() ?
'1':
'0');
5713 caseExpr::IntegerLiteralClass: {
5715llvm::APSInt
Value(cast<IntegerLiteral>(
E)->getValue());
5717 Value.setIsSigned(
true);
5722 caseExpr::ImaginaryLiteralClass: {
5730dyn_cast<FloatingLiteral>(IE->
getSubExpr())) {
5732mangleFloat(llvm::APFloat(Imag->getValue().getSemantics()));
5734mangleFloat(Imag->getValue());
5737llvm::APSInt
Value(cast<IntegerLiteral>(IE->
getSubExpr())->getValue());
5739 Value.setIsSigned(
true);
5740mangleNumber(
Value);
5746 caseExpr::StringLiteralClass: {
5750assert(isa<ConstantArrayType>(
E->
getType()));
5756 caseExpr::GNUNullExprClass:
5759mangleIntegerLiteral(
E->
getType(), llvm::APSInt(32));
5762 caseExpr::CXXNullPtrLiteralExprClass: {
5768 caseExpr::LambdaExprClass: {
5773mangleType(Context.getASTContext().
getRecordType(cast<LambdaExpr>(
E)->getLambdaClass()));
5778 caseExpr::PackExpansionExprClass:
5781mangleExpression(cast<PackExpansionExpr>(
E)->getPattern());
5784 caseExpr::SizeOfPackExprClass: {
5786 auto*SPE = cast<SizeOfPackExpr>(
E);
5787 if(SPE->isPartiallySubstituted()) {
5789 for(
const auto&A : SPE->getPartialArguments())
5790mangleTemplateArg(A,
false);
5798mangleTemplateParameter(TTP->getDepth(), TTP->getIndex());
5800= dyn_cast<NonTypeTemplateParmDecl>(Pack))
5801mangleTemplateParameter(NTTP->getDepth(), NTTP->getIndex());
5803= dyn_cast<TemplateTemplateParmDecl>(Pack))
5804mangleTemplateParameter(TempTP->getDepth(), TempTP->getIndex());
5806mangleFunctionParam(cast<ParmVarDecl>(Pack));
5810 caseExpr::MaterializeTemporaryExprClass:
5811 E= cast<MaterializeTemporaryExpr>(
E)->getSubExpr();
5814 caseExpr::CXXFoldExprClass: {
5816 auto*FE = cast<CXXFoldExpr>(
E);
5817 if(FE->isLeftFold())
5818Out << (FE->getInit() ?
"fL":
"fl");
5820Out << (FE->getInit() ?
"fR":
"fr");
5822 if(FE->getOperator() == BO_PtrMemD)
5830mangleExpression(FE->getLHS());
5832mangleExpression(FE->getRHS());
5836 caseExpr::CXXThisExprClass:
5841 caseExpr::CoawaitExprClass:
5844Out <<
"v18co_await";
5845mangleExpression(cast<CoawaitExpr>(
E)->getOperand());
5848 caseExpr::DependentCoawaitExprClass:
5851Out <<
"v18co_await";
5852mangleExpression(cast<DependentCoawaitExpr>(
E)->getOperand());
5855 caseExpr::CoyieldExprClass:
5858Out <<
"v18co_yield";
5859mangleExpression(cast<CoawaitExpr>(
E)->getOperand());
5861 caseExpr::SYCLUniqueStableNameExprClass: {
5862 const auto*USN = cast<SYCLUniqueStableNameExpr>(
E);
5865Out <<
"u33__builtin_sycl_unique_stable_name";
5866mangleType(USN->getTypeSourceInfo()->getType());
5871 caseExpr::HLSLOutArgExprClass:
5873 "cannot mangle hlsl temporary value; mangling wrong thing?");
5874 caseExpr::OpenACCAsteriskSizeExprClass: {
5879 "cannot yet mangle OpenACC Asterisk Size expression");
5885 if(AsTemplateArg && !IsPrimaryExpr)
5917voidCXXNameMangler::mangleFunctionParam(
const ParmVarDecl*parm) {
5924assert(parmDepth < FunctionTypeDepth.getDepth());
5925 unsignednestingDepth = FunctionTypeDepth.getDepth() - parmDepth;
5926 if(FunctionTypeDepth.isInResultType())
5929 if(nestingDepth == 0) {
5932Out <<
"fL"<< (nestingDepth - 1) <<
'p';
5940&&
"parameter's type is still an array type?");
5943dyn_cast<DependentAddressSpaceType>(parm->
getType())) {
5950 if(parmIndex != 0) {
5951Out << (parmIndex - 1);
5979llvm_unreachable(
"closure constructors don't exist for the Itanium ABI!");
5982mangleName(InheritedFrom);
5985voidCXXNameMangler::mangleCXXDtorType(
CXXDtorType T) {
6036 if(
auto*FTD = dyn_cast_or_null<FunctionTemplateDecl>(
ResolvedTemplate)) {
6037 auto*RD = dyn_cast<CXXRecordDecl>(FTD->getDeclContext());
6038 if(!RD || !RD->isGenericLambda())
6054 if(
auto*TTP = dyn_cast<TemplateTypeParmDecl>(Param))
6055 returnTTP->hasTypeConstraint();
6072 if(
auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param))
6073 returnNTTP->getType()->isInstantiationDependentType() ||
6074NTTP->getType()->getContainedDeducedType();
6078 auto*TTP = cast<TemplateTemplateParmDecl>(Param);
6081 "A DeducedTemplateName shouldn't escape partial ordering");
6092 autoMangleTemplateParamListToString =
6094 unsignedDepthOffset) {
6095llvm::raw_svector_ostream Stream(Buffer);
6096CXXNameMangler(
Mangler.Context, Stream,
6097WithTemplateDepthOffset{DepthOffset})
6098.mangleTemplateParameterList(Params);
6101MangleTemplateParamListToString(ParamTemplateHead,
6102TTP->getTemplateParameters(), 0);
6106MangleTemplateParamListToString(ArgTemplateHead,
6108TTP->getTemplateParameters()->
getDepth());
6109 returnParamTemplateHead != ArgTemplateHead;
6119 return{
true,
nullptr};
6124assert(ParamIdx < ResolvedTemplate->getTemplateParameters()->size() &&
6125 "no parameter for argument");
6146 return{
true,
nullptr};
6161 auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param);
6162 boolNeedExactType = NTTP && NTTP->getType()->getContainedDeducedType();
6163 return{NeedExactType,
nullptr};
6175voidCXXNameMangler::mangleTemplateArgs(
TemplateNameTN,
6177 unsignedNumTemplateArgs) {
6180TemplateArgManglingInfo Info(*
this, TN);
6181 for(
unsignedi = 0; i != NumTemplateArgs; ++i) {
6182mangleTemplateArg(Info, i, TemplateArgs[i].
getArgument());
6184mangleRequiresClause(Info.getTrailingRequiresClauseToMangle());
6188voidCXXNameMangler::mangleTemplateArgs(
TemplateNameTN,
6192TemplateArgManglingInfo Info(*
this, TN);
6193 for(
unsignedi = 0, e = AL.
size(); i != e; ++i) {
6194mangleTemplateArg(Info, i, AL[i]);
6196mangleRequiresClause(Info.getTrailingRequiresClauseToMangle());
6200voidCXXNameMangler::mangleTemplateArgs(
TemplateNameTN,
6204TemplateArgManglingInfo Info(*
this, TN);
6205 for(
unsignedi = 0; i != Args.size(); ++i) {
6206mangleTemplateArg(Info, i, Args[i]);
6208mangleRequiresClause(Info.getTrailingRequiresClauseToMangle());
6212voidCXXNameMangler::mangleTemplateArg(TemplateArgManglingInfo &Info,
6214TemplateArgManglingInfo::Info ArgInfo = Info.getArgInfo(Index, A);
6217 if(ArgInfo.TemplateParameterToMangle &&
6218!isCompatibleWith(LangOptions::ClangABI::Ver17)) {
6225mangleTemplateParamDecl(ArgInfo.TemplateParameterToMangle);
6228mangleTemplateArg(A, ArgInfo.NeedExactType);
6231voidCXXNameMangler::mangleTemplateArg(
TemplateArgumentA,
boolNeedExactType) {
6241llvm_unreachable(
"Cannot mangle NULL template argument");
6268 auto*TPO = cast<TemplateParamObjectDecl>(
D);
6269mangleValueInTemplateArg(TPO->getType().getUnqualifiedType(),
6270TPO->getValue(),
true,
6277 if(
D->isCXXInstanceMember())
6280 else if(
D->getType()->isArrayType() &&
6283!isCompatibleWith(LangOptions::ClangABI::Ver11))
6304 true, NeedExactType);
6310mangleTemplateArg(
P, NeedExactType);
6316voidCXXNameMangler::mangleTemplateArgExpr(
const Expr*
E) {
6317 if(!isCompatibleWith(LangOptions::ClangABI::Ver11)) {
6318mangleExpression(
E, UnknownArity,
true);
6333 if(
const DeclRefExpr*DRE = dyn_cast<DeclRefExpr>(
E)) {
6335 if(isa<VarDecl>(
D) || isa<FunctionDecl>(
D)) {
6343mangleExpression(
E);
6356 switch(
V.getKind()) {
6364assert(RD &&
"unexpected type for record value");
6373 if(!FD->isUnnamedBitField() &&
6383assert(RD &&
"unexpected type for union value");
6386 if(!FD->isUnnamedBitField())
6397 for(
unsignedI = 0, N =
V.getArrayInitializedElts(); I != N; ++I)
6405 for(
unsignedI = 0, N =
V.getVectorLength(); I != N; ++I)
6412 return!
V.getInt();
6415 return V.getFloat().isPosZero();
6418 return!
V.getFixedPoint().getValue();
6421 return V.getComplexFloatReal().isPosZero() &&
6422 V.getComplexFloatImag().isPosZero();
6425 return!
V.getComplexIntReal() && !
V.getComplexIntImag();
6428 return V.isNullPointer();
6431 return!
V.getMemberPointerDecl();
6434llvm_unreachable(
"Unhandled APValue::ValueKind enum");
6441 T= AT->getElementType();
6443dyn_cast<FieldDecl>(
E.getAsBaseOrMember().getPointer()))
6447cast<CXXRecordDecl>(
E.getAsBaseOrMember().getPointer()));
6488Diags.
Report(UnionLoc, DiagID);
6495 boolNeedExactType) {
6498 T= getASTContext().getUnqualifiedArrayType(
T, Quals);
6501 boolIsPrimaryExpr =
true;
6502 autoNotPrimaryExpr = [&] {
6503 if(TopLevel && IsPrimaryExpr)
6505IsPrimaryExpr =
false;
6509 switch(
V.getKind()) {
6518llvm_unreachable(
"unexpected value kind in template argument");
6522assert(RD &&
"unexpected type for record value");
6528(Fields.back()->isUnnamedBitField() ||
6530 V.getStructField(Fields.back()->getFieldIndex())))) {
6534 if(Fields.empty()) {
6535 while(!Bases.empty() &&
6537 V.getStructBase(Bases.size() - 1)))
6538Bases = Bases.drop_back();
6545 for(
unsignedI = 0, N = Bases.size(); I != N; ++I)
6546mangleValueInTemplateArg(Bases[I].getType(),
V.getStructBase(I),
false);
6547 for(
unsignedI = 0, N = Fields.size(); I != N; ++I) {
6548 if(Fields[I]->isUnnamedBitField())
6550mangleValueInTemplateArg(Fields[I]->getType(),
6551 V.getStructField(Fields[I]->getFieldIndex()),
6578mangleSourceName(II);
6579mangleValueInTemplateArg(FD->
getType(),
V.getUnionValue(),
false);
6593 unsignedN =
V.getArraySize();
6595N =
V.getArrayInitializedElts();
6600 for(
unsignedI = 0; I != N; ++I) {
6601 const APValue&Elem = I <
V.getArrayInitializedElts()
6602?
V.getArrayInitializedElt(I)
6603:
V.getArrayFiller();
6604mangleValueInTemplateArg(ElemT, Elem,
false);
6616 unsignedN =
V.getVectorLength();
6619 for(
unsignedI = 0; I != N; ++I)
6620mangleValueInTemplateArg(VT->
getElementType(),
V.getVectorElt(I),
false);
6626mangleIntegerLiteral(
T,
V.getInt());
6630mangleFloatLiteral(
T,
V.getFloat());
6634mangleFixedPointLiteral();
6642 if(!
V.getComplexFloatReal().isPosZero() ||
6643!
V.getComplexFloatImag().isPosZero())
6645 if(!
V.getComplexFloatImag().isPosZero())
6656 if(
V.getComplexIntReal().getBoolValue() ||
6657 V.getComplexIntImag().getBoolValue())
6659 if(
V.getComplexIntImag().getBoolValue())
6668 "unexpected type for LValue template arg");
6670 if(
V.isNullPointer()) {
6671mangleNullPointer(
T);
6680 if(Offset.isZero()) {
6692Out << Offset.getQuantity() <<
'E';
6700 if(!
V.hasLValuePath()) {
6716 boolIsArrayToPointerDecayMangledAsDecl =
false;
6717 if(TopLevel && Ctx.
getLangOpts().getClangABICompat() <=
6718LangOptions::ClangABI::Ver11) {
6720IsArrayToPointerDecayMangledAsDecl =
6721BType->
isArrayType() &&
V.getLValuePath().size() == 1 &&
6722 V.getLValuePath()[0].getAsArrayIndex() == 0 &&
6726 if((!
V.getLValuePath().empty() ||
V.isLValueOnePastTheEnd()) &&
6727!IsArrayToPointerDecayMangledAsDecl) {
6744 if(NeedExactType &&
6746!isCompatibleWith(LangOptions::ClangABI::Ver11)) {
6766mangleExpression(
E);
6770mangleType(
QualType(TI.getType(), 0));
6773llvm_unreachable(
"unexpected lvalue base kind in template argument");
6783mangleNumber(
V.getLValueOffset().getQuantity());
6790 if(!
V.getLValueOffset().isZero())
6791mangleNumber(
V.getLValueOffset().getQuantity());
6795 boolOnePastTheEnd =
V.isLValueOnePastTheEnd();
6799 if(
auto*CAT = dyn_cast<ConstantArrayType>(AT))
6800OnePastTheEnd |= CAT->getSize() ==
E.getAsArrayIndex();
6801TypeSoFar = AT->getElementType();
6803 const Decl*
D=
E.getAsBaseOrMember().getPointer();
6804 if(
auto*FD = dyn_cast<FieldDecl>(
D)) {
6829 if(!
V.getMemberPointerDecl()) {
6830mangleNullPointer(
T);
6837 if(!
V.getMemberPointerPath().empty()) {
6840}
else if(NeedExactType &&
6843 V.getMemberPointerDecl()->getType()) &&
6844!isCompatibleWith(LangOptions::ClangABI::Ver11)) {
6849mangle(
V.getMemberPointerDecl());
6851 if(!
V.getMemberPointerPath().empty()) {
6854 if(!Offset.isZero())
6855mangleNumber(Offset.getQuantity());
6861 if(TopLevel && !IsPrimaryExpr)
6865voidCXXNameMangler::mangleTemplateParameter(
unsignedDepth,
unsignedIndex) {
6875Depth += TemplateDepthOffset;
6877Out <<
'L'<< (Depth - 1) <<
'_';
6883voidCXXNameMangler::mangleSeqID(
unsignedSeqID) {
6886}
else if(SeqID == 1) {
6896 for(; SeqID != 0; SeqID /= 36) {
6897 unsigned C= SeqID % 36;
6898*I++ = (
C< 10 ?
'0'+
C:
'A'+
C- 10);
6901Out.write(I.base(), I - BufferRef.rbegin());
6906voidCXXNameMangler::mangleExistingSubstitution(
TemplateNametname) {
6907 boolresult = mangleSubstitution(tname);
6908assert(result &&
"no existing substitution for template name");
6914boolCXXNameMangler::mangleSubstitution(
const NamedDecl*ND) {
6916 if(mangleStandardSubstitution(ND))
6920 returnmangleSubstitution(
reinterpret_cast<uintptr_t>(ND));
6925 "mangleSubstitution(NestedNameSpecifier *) is only used for " 6926 "identifier nested name specifiers.");
6928 returnmangleSubstitution(
reinterpret_cast<uintptr_t>(NNS));
6938boolCXXNameMangler::mangleSubstitution(
QualType T) {
6941 returnmangleSubstitution(RT->getDecl());
6946 returnmangleSubstitution(TypePtr);
6949boolCXXNameMangler::mangleSubstitution(
TemplateNameTemplate) {
6951 returnmangleSubstitution(TD);
6954 returnmangleSubstitution(
6958boolCXXNameMangler::mangleSubstitution(
uintptr_tPtr) {
6959llvm::DenseMap<uintptr_t, unsigned>::iterator I = Substitutions.find(Ptr);
6960 if(I == Substitutions.end())
6963 unsignedSeqID = I->second;
6972boolCXXNameMangler::isSpecializedAs(
QualTypeS, llvm::StringRef Name,
6982dyn_cast<ClassTemplateSpecializationDecl>(RT->
getDecl());
6986 if(!isStdNamespace(Context.getEffectiveDeclContext(SD)))
6990 if(TemplateArgs.
size() != 1)
6993 if(TemplateArgs[0].getAsType() != A)
7005boolCXXNameMangler::isStdCharSpecialization(
7007 boolHasAllocator) {
7012 if(TemplateArgs.
size() != (HasAllocator ? 3 : 2))
7015 QualTypeA = TemplateArgs[0].getAsType();
7023 if(!isSpecializedAs(TemplateArgs[1].getAsType(),
"char_traits", A))
7027!isSpecializedAs(TemplateArgs[2].getAsType(),
"allocator", A))
7036boolCXXNameMangler::mangleStandardSubstitution(
const NamedDecl*ND) {
7038 if(
const NamespaceDecl*NS = dyn_cast<NamespaceDecl>(ND)) {
7047 if(!isStdNamespace(Context.getEffectiveDeclContext(TD)))
7068dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
7069 if(!isStdNamespace(Context.getEffectiveDeclContext(SD)))
7078 if(isStdCharSpecialization(SD,
"basic_string",
true)) {
7085 if(isStdCharSpecialization(SD,
"basic_istream",
false)) {
7092 if(isStdCharSpecialization(SD,
"basic_ostream",
false)) {
7099 if(isStdCharSpecialization(SD,
"basic_iostream",
false)) {
7109voidCXXNameMangler::addSubstitution(
QualType T) {
7112addSubstitution(RT->
getDecl());
7118addSubstitution(TypePtr);
7121voidCXXNameMangler::addSubstitution(
TemplateNameTemplate) {
7123 returnaddSubstitution(TD);
7129voidCXXNameMangler::addSubstitution(
uintptr_tPtr) {
7130assert(!Substitutions.count(Ptr) &&
"Substitution already exists!");
7131Substitutions[Ptr] = SeqID++;
7134voidCXXNameMangler::extendSubstitutions(CXXNameMangler*
Other) {
7135assert(
Other->SeqID >= SeqID &&
"Must be superset of substitutions!");
7136 if(
Other->SeqID > SeqID) {
7137Substitutions.swap(
Other->Substitutions);
7138SeqID =
Other->SeqID;
7143CXXNameMangler::makeFunctionReturnTypeTags(
const FunctionDecl*FD) {
7145 if(DisableDerivedAbiTags)
7146 returnAbiTagList();
7148llvm::raw_null_ostream NullOutStream;
7149CXXNameMangler TrackReturnTypeTags(*
this, NullOutStream);
7150TrackReturnTypeTags.disableDerivedAbiTags();
7154FunctionTypeDepthState saved = TrackReturnTypeTags.FunctionTypeDepth.push();
7155TrackReturnTypeTags.FunctionTypeDepth.enterResultType();
7157TrackReturnTypeTags.FunctionTypeDepth.leaveResultType();
7158TrackReturnTypeTags.FunctionTypeDepth.pop(saved);
7160 returnTrackReturnTypeTags.AbiTagsRoot.getSortedUniqueUsedAbiTags();
7164CXXNameMangler::makeVariableTypeTags(
const VarDecl*VD) {
7166 if(DisableDerivedAbiTags)
7167 returnAbiTagList();
7169llvm::raw_null_ostream NullOutStream;
7170CXXNameMangler TrackVariableType(*
this, NullOutStream);
7171TrackVariableType.disableDerivedAbiTags();
7173TrackVariableType.mangleType(VD->
getType());
7175 returnTrackVariableType.AbiTagsRoot.getSortedUniqueUsedAbiTags();
7178boolCXXNameMangler::shouldHaveAbiTags(ItaniumMangleContextImpl &
C,
7180llvm::raw_null_ostream NullOutStream;
7181CXXNameMangler TrackAbiTags(
C, NullOutStream,
nullptr,
true);
7182TrackAbiTags.mangle(VD);
7183 returnTrackAbiTags.AbiTagsRoot.getUsedAbiTags().size();
7196voidItaniumMangleContextImpl::mangleCXXName(
GlobalDeclGD,
7199assert((isa<FunctionDecl, VarDecl, TemplateParamObjectDecl>(
D)) &&
7200 "Invalid mangleName() call, argument is not a variable or function!");
7203getASTContext().getSourceManager(),
7204 "Mangling declaration");
7206 if(
auto*CD = dyn_cast<CXXConstructorDecl>(
D)) {
7208CXXNameMangler Mangler(*
this, Out, CD,
Type);
7212 if(
auto*DD = dyn_cast<CXXDestructorDecl>(
D)) {
7214CXXNameMangler Mangler(*
this, Out, DD,
Type);
7218CXXNameMangler Mangler(*
this, Out,
D);
7224CXXNameMangler Mangler(*
this, Out,
D,
Ctor_Comdat);
7230CXXNameMangler Mangler(*
this, Out,
D,
Dtor_Comdat);
7256 unsignedTypedDiscriminator =
7258Mangler.mangleVendorQualifier(
"__vtptrauth");
7259 auto&ManglerStream = Mangler.getStream();
7260ManglerStream <<
"I";
7261 if(
const auto*ExplicitAuth =
7262PtrauthClassRD->
getAttr<VTablePointerAuthenticationAttr>()) {
7263ManglerStream <<
"Lj"<< ExplicitAuth->getKey();
7265 if(ExplicitAuth->getAddressDiscrimination() ==
7266VTablePointerAuthenticationAttr::DefaultAddressDiscrimination)
7267ManglerStream <<
"Lb"<< LangOpts.PointerAuthVTPtrAddressDiscrimination;
7269ManglerStream <<
"Lb" 7270<< (ExplicitAuth->getAddressDiscrimination() ==
7271VTablePointerAuthenticationAttr::AddressDiscrimination);
7273 switch(ExplicitAuth->getExtraDiscrimination()) {
7274 caseVTablePointerAuthenticationAttr::DefaultExtraDiscrimination: {
7275 if(LangOpts.PointerAuthVTPtrTypeDiscrimination)
7276ManglerStream <<
"Lj"<< TypedDiscriminator;
7278ManglerStream <<
"Lj"<< 0;
7281 caseVTablePointerAuthenticationAttr::TypeDiscrimination:
7282ManglerStream <<
"Lj"<< TypedDiscriminator;
7284 caseVTablePointerAuthenticationAttr::CustomDiscrimination:
7285ManglerStream <<
"Lj"<< ExplicitAuth->getCustomDiscriminationValue();
7287 caseVTablePointerAuthenticationAttr::NoExtraDiscrimination:
7288ManglerStream <<
"Lj"<< 0;
7292ManglerStream <<
"Lj" 7293<< (
unsigned)VTablePointerAuthenticationAttr::DefaultKey;
7294ManglerStream <<
"Lb"<< LangOpts.PointerAuthVTPtrAddressDiscrimination;
7295 if(LangOpts.PointerAuthVTPtrTypeDiscrimination)
7296ManglerStream <<
"Lj"<< TypedDiscriminator;
7298ManglerStream <<
"Lj"<< 0;
7300ManglerStream <<
"E";
7303voidItaniumMangleContextImpl::mangleThunk(
const CXXMethodDecl*MD,
7305 boolElideOverrideInfo,
7314assert(!isa<CXXDestructorDecl>(MD) &&
7315 "Use mangleCXXDtor for destructor decls!");
7316CXXNameMangler Mangler(*
this, Out);
7317Mangler.getStream() <<
"_ZT";
7319Mangler.getStream() <<
'c';
7330Mangler.mangleFunctionEncoding(MD);
7331 if(!ElideOverrideInfo)
7338 boolElideOverrideInfo,
7342CXXNameMangler Mangler(*
this, Out, DD,
Type);
7343Mangler.getStream() <<
"_ZT";
7351 if(!ElideOverrideInfo)
7356voidItaniumMangleContextImpl::mangleStaticGuardVariable(
const VarDecl*
D,
7360CXXNameMangler Mangler(*
this, Out);
7363Mangler.getStream() <<
"_ZGV";
7364Mangler.mangleName(
D);
7367voidItaniumMangleContextImpl::mangleDynamicInitializer(
const VarDecl*MD,
7372Out <<
"__cxx_global_var_init";
7375voidItaniumMangleContextImpl::mangleDynamicAtExitDestructor(
const VarDecl*
D,
7378CXXNameMangler Mangler(*
this, Out);
7379Mangler.getStream() <<
"__dtor_";
7380 if(shouldMangleDeclName(
D))
7381Mangler.mangle(
D);
7383Mangler.getStream() <<
D->getName();
7386voidItaniumMangleContextImpl::mangleDynamicStermFinalizer(
const VarDecl*
D,
7390CXXNameMangler Mangler(*
this, Out);
7391Mangler.getStream() <<
"__finalize_";
7392 if(shouldMangleDeclName(
D))
7393Mangler.mangle(
D);
7395Mangler.getStream() <<
D->getName();
7398voidItaniumMangleContextImpl::mangleSEHFilterExpression(
7399 GlobalDeclEnclosingDecl, raw_ostream &Out) {
7400CXXNameMangler Mangler(*
this, Out);
7401Mangler.getStream() <<
"__filt_";
7402 auto*EnclosingFD = cast<FunctionDecl>(EnclosingDecl.
getDecl());
7403 if(shouldMangleDeclName(EnclosingFD))
7404Mangler.mangle(EnclosingDecl);
7406Mangler.getStream() << EnclosingFD->getName();
7409voidItaniumMangleContextImpl::mangleSEHFinallyBlock(
7410 GlobalDeclEnclosingDecl, raw_ostream &Out) {
7411CXXNameMangler Mangler(*
this, Out);
7412Mangler.getStream() <<
"__fin_";
7413 auto*EnclosingFD = cast<FunctionDecl>(EnclosingDecl.
getDecl());
7414 if(shouldMangleDeclName(EnclosingFD))
7415Mangler.mangle(EnclosingDecl);
7417Mangler.getStream() << EnclosingFD->getName();
7420voidItaniumMangleContextImpl::mangleItaniumThreadLocalInit(
const VarDecl*
D,
7423CXXNameMangler Mangler(*
this, Out);
7424Mangler.getStream() <<
"_ZTH";
7425Mangler.mangleName(
D);
7429ItaniumMangleContextImpl::mangleItaniumThreadLocalWrapper(
const VarDecl*
D,
7432CXXNameMangler Mangler(*
this, Out);
7433Mangler.getStream() <<
"_ZTW";
7434Mangler.mangleName(
D);
7437voidItaniumMangleContextImpl::mangleReferenceTemporary(
const VarDecl*
D,
7438 unsignedManglingNumber,
7442CXXNameMangler Mangler(*
this, Out);
7443Mangler.getStream() <<
"_ZGR";
7444Mangler.mangleName(
D);
7445assert(ManglingNumber > 0 &&
"Reference temporary mangling number is zero!");
7446Mangler.mangleSeqID(ManglingNumber - 1);
7449voidItaniumMangleContextImpl::mangleCXXVTable(
const CXXRecordDecl*RD,
7452CXXNameMangler Mangler(*
this, Out);
7453Mangler.getStream() <<
"_ZTV";
7454Mangler.mangleCXXRecordDecl(RD);
7457voidItaniumMangleContextImpl::mangleCXXVTT(
const CXXRecordDecl*RD,
7460CXXNameMangler Mangler(*
this, Out);
7461Mangler.getStream() <<
"_ZTT";
7462Mangler.mangleCXXRecordDecl(RD);
7465voidItaniumMangleContextImpl::mangleCXXCtorVTable(
const CXXRecordDecl*RD,
7470CXXNameMangler Mangler(*
this, Out);
7471Mangler.getStream() <<
"_ZTC";
7472Mangler.mangleCXXRecordDecl(RD);
7473Mangler.getStream() << Offset;
7474Mangler.getStream() <<
'_';
7475Mangler.mangleCXXRecordDecl(
Type);
7478voidItaniumMangleContextImpl::mangleCXXRTTI(
QualTypeTy, raw_ostream &Out) {
7480assert(!Ty.
hasQualifiers() &&
"RTTI info cannot have top-level qualifiers");
7481CXXNameMangler Mangler(*
this, Out);
7482Mangler.getStream() <<
"_ZTI";
7483Mangler.mangleType(Ty);
7486voidItaniumMangleContextImpl::mangleCXXRTTIName(
7487 QualTypeTy, raw_ostream &Out,
boolNormalizeIntegers =
false) {
7489CXXNameMangler Mangler(*
this, Out, NormalizeIntegers);
7490Mangler.getStream() <<
"_ZTS";
7491Mangler.mangleType(Ty);
7494voidItaniumMangleContextImpl::mangleCanonicalTypeName(
7495 QualTypeTy, raw_ostream &Out,
boolNormalizeIntegers =
false) {
7496mangleCXXRTTIName(Ty, Out, NormalizeIntegers);
7499voidItaniumMangleContextImpl::mangleStringLiteral(
const StringLiteral*, raw_ostream &) {
7500llvm_unreachable(
"Can't mangle string literals");
7503voidItaniumMangleContextImpl::mangleLambdaSig(
const CXXRecordDecl*Lambda,
7505CXXNameMangler Mangler(*
this, Out);
7506Mangler.mangleLambdaSig(Lambda);
7509voidItaniumMangleContextImpl::mangleModuleInitializer(
const Module*M,
7512CXXNameMangler Mangler(*
this, Out);
7513Mangler.getStream() <<
"_ZGI";
7517 autoPartition = M->
Name.find(
':');
7518Mangler.mangleModuleNamePrefix(
7519StringRef(&M->
Name[Partition + 1], M->
Name.size() - Partition - 1),
7527 return newItaniumMangleContextImpl(
7530 returnstd::nullopt;
7539 return newItaniumMangleContextImpl(Context, Diags, DiscriminatorOverride,
Enums/classes describing ABI related information about constructors, destructors and thunks.
Defines the clang::ASTContext interface.
enum clang::sema::@1704::IndirectLocalPathEntry::EntryKind Kind
@ LLVM_MARK_AS_BITMASK_ENUM
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)
@ ArmAgnosticSMEZAStateBit
@ ArmStreamingCompatibleBit
static AAPCSBitmaskSME encodeAAPCSZAState(unsigned SMEAttrs)
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)
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
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
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.
TemplateName getCanonicalTemplateName(TemplateName Name, bool IgnoreDeduced=false) const
Retrieves the "canonical" template name that refers to a given template.
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...
bool hasSimilarType(QualType T1, QualType T2) const
Determine if two types are similar, according to the C++ rules.
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...
bool isTypeOperand() const
QualType getTypeOperand(const ASTContext &Context) const
Retrieves the type operand of this typeid() expression after various required adjustments (removing r...
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.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
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
unsigned getAArch64SMEAttributes() const
Return a bitmask describing the SME attributes on the function type, see AArch64SMETypeAttributes for...
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
static ArmStateValue getArmZT0State(unsigned AttrBits)
static ArmStateValue getArmZAState(unsigned AttrBits)
QualType getReturnType() const
@ SME_PStateSMEnabledMask
@ SME_PStateSMCompatibleMask
@ SME_AgnosticZAStateMask
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(bool IgnoreDeduced=false) 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,...
@ DeducedTemplate
A template name that refers to another TemplateName with deduced default arguments.
@ 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.
std::pair< TemplateDecl *, DefaultArguments > getTemplateDeclAndDefaultArgs() const
Retrieves the underlying template declaration that this template name refers to, along with the deduc...
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.
bool isPointerOrReferenceType() const
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 unary type transform, which is a type constructed from another.
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)
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
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
const Expr * RHS
The original right-hand side.
BinaryOperatorKind Opcode
The original opcode, prior to rewriting.
const Expr * LHS
The original left-hand side.
llvm::dxil::ResourceClass ResourceClass
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::@192 Itanium
int64_t VBaseOffsetOffset
The offset (in bytes), relative to the address point of the virtual base class offset.
int64_t VCallOffsetOffset
The offset (in bytes), relative to the address point, of the virtual call offset.
struct clang::ThisAdjustment::VirtualAdjustment::@194 Itanium
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4