69#include "llvm/ADT/APFixedPoint.h"
70#include "llvm/ADT/APInt.h"
71#include "llvm/ADT/APSInt.h"
72#include "llvm/ADT/ArrayRef.h"
73#include "llvm/ADT/DenseMap.h"
74#include "llvm/ADT/DenseSet.h"
75#include "llvm/ADT/FoldingSet.h"
76#include "llvm/ADT/PointerUnion.h"
77#include "llvm/ADT/STLExtras.h"
78#include "llvm/ADT/SmallPtrSet.h"
79#include "llvm/ADT/SmallVector.h"
80#include "llvm/ADT/StringExtras.h"
81#include "llvm/ADT/StringRef.h"
82#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
83#include "llvm/Support/Capacity.h"
84#include "llvm/Support/Casting.h"
85#include "llvm/Support/Compiler.h"
86#include "llvm/Support/ErrorHandling.h"
87#include "llvm/Support/MD5.h"
88#include "llvm/Support/MathExtras.h"
89#include "llvm/Support/SipHash.h"
90#include "llvm/Support/raw_ostream.h"
91#include "llvm/TargetParser/AArch64TargetParser.h"
92#include "llvm/TargetParser/Triple.h"
105using namespace clang;
129 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
134 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
135 if (VD->isStaticDataMember() &&
140 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
145 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
152 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
156 if (
const auto *TD = dyn_cast<TagDecl>(D)) {
159 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
191 Locations.emplace_back(BaseLocation);
204 Locations.emplace_back(SourceMgr.getExpansionLoc(BaseLocation));
211 Locations.emplace_back(SourceMgr.getSpellingLoc(D->
getBeginLoc()));
219 const std::map<unsigned, RawComment *> &CommentsInTheFile)
const {
222 if (RepresentativeLocForDecl.
isInvalid() ||
223 !RepresentativeLocForDecl.
isFileID())
227 if (CommentsInTheFile.empty())
233 SourceMgr.getDecomposedLoc(RepresentativeLocForDecl);
236 auto OffsetCommentBehindDecl =
237 CommentsInTheFile.lower_bound(DeclLocDecomp.second);
240 if (OffsetCommentBehindDecl != CommentsInTheFile.end()) {
241 RawComment *CommentBehindDecl = OffsetCommentBehindDecl->second;
243 LangOpts.CommentOpts.ParseAllComments) &&
250 if (SourceMgr.getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second) ==
251 Comments.getCommentBeginLine(CommentBehindDecl, DeclLocDecomp.first,
252 OffsetCommentBehindDecl->first)) {
253 return CommentBehindDecl;
260 if (OffsetCommentBehindDecl == CommentsInTheFile.begin())
263 auto OffsetCommentBeforeDecl = --OffsetCommentBehindDecl;
264 RawComment *CommentBeforeDecl = OffsetCommentBeforeDecl->second;
268 LangOpts.CommentOpts.ParseAllComments) ||
273 const unsigned CommentEndOffset =
274 Comments.getCommentEndOffset(CommentBeforeDecl);
278 const char *Buffer = SourceMgr.getBufferData(DeclLocDecomp.first,
284 StringRef
Text(Buffer + CommentEndOffset,
285 DeclLocDecomp.second - CommentEndOffset);
289 if (
Text.find_last_of(
";{}#@") != StringRef::npos)
292 return CommentBeforeDecl;
298 for (
const auto DeclLoc : DeclLocs) {
301 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
312 const FileID File = SourceMgr.getDecomposedLoc(DeclLoc).first;
316 const auto CommentsInThisFile =
Comments.getCommentsInFile(
File);
317 if (!CommentsInThisFile || CommentsInThisFile->empty())
329 assert(LangOpts.RetainCommentsFromSystemHeaders ||
331 Comments.addComment(RC, LangOpts.CommentOpts, BumpAlloc);
336 const Decl **OriginalDecl)
const {
339 OriginalDecl =
nullptr;
351 return DeclComment->second;
364 *OriginalDecl = RedeclComment->second;
367 "This decl is supposed to have comment attached.");
368 return CommentAtRedecl->second;
373 const Decl *LastCheckedRedecl = [&]() {
375 bool CanUseCommentlessCache =
false;
377 for (
auto *Redecl : CanonicalD->
redecls()) {
379 CanUseCommentlessCache =
true;
382 if (Redecl == LastChecked)
389 return CanUseCommentlessCache ? LastChecked :
nullptr;
395 if (LastCheckedRedecl) {
396 if (LastCheckedRedecl == Redecl) {
397 LastCheckedRedecl =
nullptr;
405 *OriginalDecl = Redecl;
406 return RedeclComment;
412 *OriginalDecl =
nullptr;
418 assert(Comment.
isDocumentation() || LangOpts.CommentOpts.ParseAllComments);
428 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
433 for (
const auto *Ext : ID->known_extensions()) {
437 Redeclared.push_back(RedeclaredMethod);
444 if (
Comments.empty() || Decls.empty())
448 for (
const Decl *D : Decls) {
449 if (D->isInvalidDecl())
457 File = SourceMgr.getDecomposedLoc(Loc).first;
462 if (
File.isInvalid())
465 auto CommentsInThisFile =
Comments.getCommentsInFile(
File);
466 if (!CommentsInThisFile || CommentsInThisFile->empty() ||
467 CommentsInThisFile->rbegin()->second->isAttached())
477 for (
const Decl *D : Decls) {
479 if (D->isInvalidDecl())
489 for (
const auto DeclLoc : DeclLocs) {
490 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
494 D, DeclLoc, *CommentsInThisFile)) {
505 const Decl *D)
const {
508 ThisDeclInfo->IsFilled =
false;
509 ThisDeclInfo->fill();
510 ThisDeclInfo->CommentDecl = FC->
getDecl();
511 if (!ThisDeclInfo->TemplateParameters)
521 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
532 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
536 if (Canonical != D) {
544 const Decl *OriginalDecl =
nullptr;
550 const auto *OMD = dyn_cast<ObjCMethodDecl>(D);
551 if (OMD && OMD->isPropertyAccessor())
558 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
562 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(D)) {
565 QualType QT = TD->getUnderlyingType();
566 if (
const auto *TT = QT->
getAs<TagType>())
570 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(D)) {
571 while (IC->getSuperClass()) {
572 IC = IC->getSuperClass();
577 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(D)) {
582 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
583 if (!(RD = RD->getDefinition()))
586 for (
const auto &I : RD->bases()) {
587 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
601 for (
const auto &I : RD->vbases()) {
622 if (D != OriginalDecl && OriginalDecl)
630void ASTContext::CanonicalTemplateTemplateParm::Profile(
639 ID.AddInteger(Params->
size());
641 PEnd = Params->
end();
643 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*P)) {
645 ID.AddBoolean(TTP->isParameterPack());
647 TTP->getNumExpansionParameters().toInternalRepresentation());
651 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) {
653 ID.AddBoolean(NTTP->isParameterPack());
654 ID.AddPointer(
C.getUnconstrainedType(
C.getCanonicalType(NTTP->getType()))
656 if (NTTP->isExpandedParameterPack()) {
658 ID.AddInteger(NTTP->getNumExpansionTypes());
659 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
660 QualType T = NTTP->getExpansionType(I);
661 ID.AddPointer(T.getCanonicalType().getAsOpaquePtr());
664 ID.AddBoolean(
false);
674TemplateTemplateParmDecl *
678 llvm::FoldingSetNodeID ID;
679 CanonicalTemplateTemplateParm::Profile(ID, *
this, TTP);
680 void *InsertPos =
nullptr;
681 CanonicalTemplateTemplateParm *Canonical
682 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
684 return Canonical->getParam();
689 CanonParams.reserve(Params->
size());
691 PEnd = Params->
end();
695 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*P)) {
700 TTP->getNumExpansionParameters());
701 CanonParams.push_back(NewTTP);
702 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) {
706 if (NTTP->isExpandedParameterPack()) {
709 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
711 ExpandedTInfos.push_back(
719 NTTP->getPosition(),
nullptr,
729 NTTP->getPosition(),
nullptr,
731 NTTP->isParameterPack(),
734 CanonParams.push_back(Param);
750 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
751 assert(!Canonical &&
"Shouldn't be in the map!");
755 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
756 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
763 llvm::FoldingSetNodeID ID;
764 CanonicalTemplateTemplateParm::Profile(ID, *
this, TTP);
765 void *InsertPos =
nullptr;
766 CanonicalTemplateTemplateParm *Canonical =
767 CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
768 return Canonical ? Canonical->getParam() :
nullptr;
774 llvm::FoldingSetNodeID ID;
775 CanonicalTemplateTemplateParm::Profile(ID, *
this, CanonTTP);
776 void *InsertPos =
nullptr;
778 CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos))
779 return Existing->getParam();
780 CanonTemplateTemplateParms.InsertNode(
781 new (*
this) CanonicalTemplateTemplateParm(CanonTTP), InsertPos);
802 [](
const DynTypedNode &P) { return P.get<WhileStmt>() != nullptr; });
826 return NoSanitizeL->containsType(Mask, TyName);
835 if (!LangOpts.CPlusPlus)
return nullptr;
838 case TargetCXXABI::AppleARM64:
839 case TargetCXXABI::Fuchsia:
840 case TargetCXXABI::GenericARM:
841 case TargetCXXABI::iOS:
842 case TargetCXXABI::WatchOS:
843 case TargetCXXABI::GenericAArch64:
844 case TargetCXXABI::GenericMIPS:
845 case TargetCXXABI::GenericItanium:
846 case TargetCXXABI::WebAssembly:
847 case TargetCXXABI::XL:
849 case TargetCXXABI::Microsoft:
852 llvm_unreachable(
"Invalid CXXABI type!");
856 if (!InterpContext) {
859 return *InterpContext;
865 return *ParentMapCtx;
870 switch (LangOpts.getAddressSpaceMapMangling()) {
878 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
884 : ConstantArrayTypes(this_(), ConstantArrayTypesLog2InitSize),
885 DependentSizedArrayTypes(this_()), DependentSizedExtVectorTypes(this_()),
886 DependentAddressSpaceTypes(this_()), DependentVectorTypes(this_()),
887 DependentSizedMatrixTypes(this_()),
888 FunctionProtoTypes(this_(), FunctionProtoTypesLog2InitSize),
889 DependentTypeOfExprTypes(this_()), DependentDecltypeTypes(this_()),
890 DependentPackIndexingTypes(this_()), TemplateSpecializationTypes(this_()),
891 DependentBitIntTypes(this_()), SubstTemplateTemplateParmPacks(this_()),
892 DeducedTemplates(this_()), ArrayParameterTypes(this_()),
893 CanonTemplateTemplateParms(this_()), SourceMgr(
SM), LangOpts(LOpts),
896 LangOpts.XRayNeverInstrumentFiles,
897 LangOpts.XRayAttrListFiles,
SM)),
901 Comments(
SM), CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
909 ReleaseDeclContextMaps();
912 for (
auto &Pair : Deallocations)
913 (Pair.first)(Pair.second);
914 Deallocations.clear();
920 I = ObjCLayouts.begin(),
921 E = ObjCLayouts.end();
928 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
929 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
934 ASTRecordLayouts.clear();
936 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
937 AEnd = DeclAttrs.end();
939 A->second->~AttrVec();
942 for (
const auto &
Value : ModuleInitializers)
943 Value.second->~PerModuleInitializers();
944 ModuleInitializers.
clear();
954 TraversalScope = TopLevelDecls;
959 Deallocations.push_back({Callback,
Data});
968 llvm::errs() <<
"\n*** AST Context Stats:\n";
969 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
971 unsigned counts[] = {
972#define TYPE(Name, Parent) 0,
973#define ABSTRACT_TYPE(Name, Parent)
974#include "clang/AST/TypeNodes.inc"
978 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
980 counts[(
unsigned)T->getTypeClass()]++;
984 unsigned TotalBytes = 0;
985#define TYPE(Name, Parent) \
987 llvm::errs() << " " << counts[Idx] << " " << #Name \
988 << " types, " << sizeof(Name##Type) << " each " \
989 << "(" << counts[Idx] * sizeof(Name##Type) \
991 TotalBytes += counts[Idx] * sizeof(Name##Type); \
993#define ABSTRACT_TYPE(Name, Parent)
994#include "clang/AST/TypeNodes.inc"
996 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
1001 <<
" implicit default constructors created\n";
1004 <<
" implicit copy constructors created\n";
1008 <<
" implicit move constructors created\n";
1011 <<
" implicit copy assignment operators created\n";
1015 <<
" implicit move assignment operators created\n";
1018 <<
" implicit destructors created\n";
1021 llvm::errs() <<
"\n";
1025 BumpAlloc.PrintStats();
1029 bool NotifyListeners) {
1030 if (NotifyListeners)
1033 Listener->RedefinedHiddenDefinition(ND, M);
1040 if (It == MergedDefModules.end())
1043 auto &Merged = It->second;
1044 llvm::DenseSet<Module*>
Found;
1045 for (
Module *&M : Merged)
1046 if (!
Found.insert(M).second)
1048 llvm::erase(Merged,
nullptr);
1055 if (MergedIt == MergedDefModules.end())
1057 return MergedIt->second;
1060void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1061 if (LazyInitializers.empty())
1065 assert(Source &&
"lazy initializers but no external source");
1067 auto LazyInits = std::move(LazyInitializers);
1068 LazyInitializers.clear();
1070 for (
auto ID : LazyInits)
1071 Initializers.push_back(Source->GetExternalDecl(ID));
1073 assert(LazyInitializers.empty() &&
1074 "GetExternalDecl for lazy module initializer added more inits");
1080 if (
const auto *ID = dyn_cast<ImportDecl>(D)) {
1081 auto It = ModuleInitializers.find(ID->getImportedModule());
1084 if (It == ModuleInitializers.end())
1088 auto &Imported = *It->second;
1089 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1090 Imported.resolve(*
this);
1091 auto *OnlyDecl = Imported.Initializers.front();
1097 auto *&
Inits = ModuleInitializers[M];
1099 Inits =
new (*this) PerModuleInitializers;
1100 Inits->Initializers.push_back(D);
1105 auto *&
Inits = ModuleInitializers[M];
1107 Inits =
new (*this) PerModuleInitializers;
1108 Inits->LazyInitializers.insert(
Inits->LazyInitializers.end(),
1109 IDs.begin(), IDs.end());
1113 auto It = ModuleInitializers.find(M);
1114 if (It == ModuleInitializers.end())
1117 auto *
Inits = It->second;
1118 Inits->resolve(*
this);
1119 return Inits->Initializers;
1124 assert(!CurrentCXXNamedModule &&
1125 "We should set named module for ASTContext for only once");
1126 CurrentCXXNamedModule = M;
1138 auto GetRepresentativeModule = [
this](
const Module *M) {
1139 auto Iter = SameModuleLookupSet.find(M);
1140 if (Iter != SameModuleLookupSet.end())
1141 return Iter->second;
1143 const Module *RepresentativeModule =
1144 PrimaryModuleNameMap.try_emplace(M->getPrimaryModuleInterfaceName(), M)
1146 SameModuleLookupSet[M] = RepresentativeModule;
1147 return RepresentativeModule;
1150 assert(M1 &&
"Shouldn't call `isInSameModule` if both M1 and M2 are none.");
1151 return GetRepresentativeModule(M1) == GetRepresentativeModule(M2);
1155 if (!ExternCContext)
1158 return ExternCContext;
1172#define BuiltinTemplate(BTName) \
1173 BuiltinTemplateDecl *ASTContext::get##BTName##Decl() const { \
1174 if (!Decl##BTName) \
1176 buildBuiltinTemplateDecl(BTK##BTName, get##BTName##Name()); \
1177 return Decl##BTName; \
1179#include "clang/Basic/BuiltinTemplates.inc"
1192 NewDecl->
addAttr(TypeVisibilityAttr::CreateImplicit(
1193 const_cast<ASTContext &
>(*
this), TypeVisibilityAttr::Default));
1198 StringRef Name)
const {
1222 Types.push_back(Ty);
1227 assert((!this->Target || this->Target == &Target) &&
1228 "Incorrect target reinitialization");
1229 assert(
VoidTy.isNull() &&
"Context reinitialized?");
1231 this->Target = &Target;
1232 this->AuxTarget = AuxTarget;
1234 ABI.reset(createCXXABI(Target));
1238 InitBuiltinType(
VoidTy, BuiltinType::Void);
1241 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1243 if (LangOpts.CharIsSigned)
1244 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1246 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1249 InitBuiltinType(
ShortTy, BuiltinType::Short);
1250 InitBuiltinType(
IntTy, BuiltinType::Int);
1251 InitBuiltinType(
LongTy, BuiltinType::Long);
1252 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1262 InitBuiltinType(
FloatTy, BuiltinType::Float);
1263 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1264 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1267 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1270 InitBuiltinType(
Ibm128Ty, BuiltinType::Ibm128);
1273 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1276 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1277 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1278 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1282 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1283 InitBuiltinType(
FractTy, BuiltinType::Fract);
1284 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1289 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1295 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1302 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1307 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1309 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1310 if (LangOpts.CPlusPlus && LangOpts.WChar)
1314 WideCharTy = getFromTargetType(Target.getWCharType());
1317 WIntTy = getFromTargetType(Target.getWIntType());
1320 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1322 if (LangOpts.CPlusPlus)
1323 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1325 Char16Ty = getFromTargetType(Target.getChar16Type());
1327 if (LangOpts.CPlusPlus)
1328 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1330 Char32Ty = getFromTargetType(Target.getChar32Type());
1337 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1340 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1352 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1358 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1361 if (LangOpts.OpenMP) {
1368 if (LangOpts.OpenACC && !LangOpts.OpenMP) {
1371 if (LangOpts.MatrixTypes)
1379 if (LangOpts.OpenCL) {
1380#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1381 InitBuiltinType(SingletonId, BuiltinType::Id);
1382#include "clang/Basic/OpenCLImageTypes.def"
1384 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1385 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1387 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1390#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1391 InitBuiltinType(Id##Ty, BuiltinType::Id);
1392#include "clang/Basic/OpenCLExtensionTypes.def"
1395 if (LangOpts.HLSL) {
1396#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
1397 InitBuiltinType(SingletonId, BuiltinType::Id);
1398#include "clang/Basic/HLSLIntangibleTypes.def"
1401 if (Target.hasAArch64ACLETypes() ||
1402 (AuxTarget && AuxTarget->hasAArch64ACLETypes())) {
1403#define SVE_TYPE(Name, Id, SingletonId) \
1404 InitBuiltinType(SingletonId, BuiltinType::Id);
1405#include "clang/Basic/AArch64ACLETypes.def"
1408 if (Target.getTriple().isPPC64()) {
1409#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \
1410 InitBuiltinType(Id##Ty, BuiltinType::Id);
1411#include "clang/Basic/PPCTypes.def"
1412#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \
1413 InitBuiltinType(Id##Ty, BuiltinType::Id);
1414#include "clang/Basic/PPCTypes.def"
1417 if (Target.hasRISCVVTypes()) {
1418#define RVV_TYPE(Name, Id, SingletonId) \
1419 InitBuiltinType(SingletonId, BuiltinType::Id);
1420#include "clang/Basic/RISCVVTypes.def"
1423 if (Target.getTriple().isWasm() && Target.hasFeature(
"reference-types")) {
1424#define WASM_TYPE(Name, Id, SingletonId) \
1425 InitBuiltinType(SingletonId, BuiltinType::Id);
1426#include "clang/Basic/WebAssemblyReferenceTypes.def"
1429 if (Target.getTriple().isAMDGPU() ||
1430 (Target.getTriple().isSPIRV() &&
1431 Target.getTriple().getVendor() == llvm::Triple::AMD) ||
1433 (AuxTarget->getTriple().isAMDGPU() ||
1434 ((AuxTarget->getTriple().isSPIRV() &&
1435 AuxTarget->getTriple().getVendor() == llvm::Triple::AMD))))) {
1436#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
1437 InitBuiltinType(SingletonId, BuiltinType::Id);
1438#include "clang/Basic/AMDGPUTypes.def"
1445 ObjCConstantStringType =
QualType();
1450 if (LangOpts.OpenCLGenericAddressSpace) {
1451 auto Q =
VoidTy.getQualifiers();
1460 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1463 InitBuiltinType(
HalfTy, BuiltinType::Half);
1465 InitBuiltinType(
BFloat16Ty, BuiltinType::BFloat16);
1471 if (LangOpts.MicrosoftExt || LangOpts.Borland) {
1478 return SourceMgr.getDiagnostics();
1493 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1494 if (Pos != DeclAttrs.end()) {
1495 Pos->second->~AttrVec();
1496 DeclAttrs.erase(Pos);
1510 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1511 TemplateOrInstantiation.find(Var);
1512 if (Pos == TemplateOrInstantiation.end())
1525 Tmpl, TSK, PointOfInstantiation));
1531 assert(!TemplateOrInstantiation[Inst] &&
1532 "Already noted what the variable was instantiated from");
1533 TemplateOrInstantiation[Inst] = TSI;
1538 return InstantiatedFromUsingDecl.lookup(UUD);
1546 "pattern decl is not a using decl");
1550 "instantiation did not produce a using decl");
1551 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1552 InstantiatedFromUsingDecl[Inst] = Pattern;
1557 return InstantiatedFromUsingEnumDecl.lookup(UUD);
1562 assert(!InstantiatedFromUsingEnumDecl[Inst] &&
"pattern already exists");
1563 InstantiatedFromUsingEnumDecl[Inst] = Pattern;
1568 return InstantiatedFromUsingShadowDecl.lookup(Inst);
1574 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1575 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1580 return InstantiatedFromUnnamedFieldDecl.lookup(Field);
1586 "Instantiated field decl is not unnamed");
1588 "Template field decl is not unnamed");
1589 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1590 "Already noted what unnamed field was instantiated from");
1592 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1608 return Range.end() - Range.begin();
1613 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1614 OverriddenMethods.find(
Method->getCanonicalDecl());
1615 if (Pos == OverriddenMethods.end())
1623 OverriddenMethods[
Method].push_back(Overridden);
1631 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1637 const auto *
Method = dyn_cast<ObjCMethodDecl>(D);
1642 Method->getOverriddenMethods(OverDecls);
1643 Overridden.append(OverDecls.begin(), OverDecls.end());
1646std::optional<ASTContext::CXXRecordDeclRelocationInfo>
1650 auto it = RelocatableClasses.find(D);
1651 if (it != RelocatableClasses.end())
1652 return it->getSecond();
1653 return std::nullopt;
1660 assert(RelocatableClasses.find(D) == RelocatableClasses.end());
1661 RelocatableClasses.insert({D, Info});
1666 if (!Class->isPolymorphic())
1668 const CXXRecordDecl *BaseType = Context.baseForVTableAuthentication(Class);
1669 using AuthAttr = VTablePointerAuthenticationAttr;
1670 const AuthAttr *ExplicitAuth = BaseType->
getAttr<AuthAttr>();
1672 return Context.getLangOpts().PointerAuthVTPtrAddressDiscrimination;
1673 AuthAttr::AddressDiscriminationMode AddressDiscrimination =
1674 ExplicitAuth->getAddressDiscrimination();
1675 if (AddressDiscrimination == AuthAttr::DefaultAddressDiscrimination)
1676 return Context.getLangOpts().PointerAuthVTPtrAddressDiscrimination;
1677 return AddressDiscrimination == AuthAttr::AddressDiscrimination;
1680ASTContext::PointerAuthContent
1681ASTContext::findPointerAuthContent(QualType T)
const {
1682 assert(isPointerAuthenticationAvailable());
1686 return PointerAuthContent::None;
1689 return PointerAuthContent::AddressDiscriminatedData;
1692 return PointerAuthContent::None;
1695 return PointerAuthContent::None;
1697 if (
auto Existing = RecordContainsAddressDiscriminatedPointerAuth.find(RD);
1698 Existing != RecordContainsAddressDiscriminatedPointerAuth.end())
1699 return Existing->second;
1701 PointerAuthContent
Result = PointerAuthContent::None;
1703 auto SaveResultAndReturn = [&]() -> PointerAuthContent {
1704 auto [ResultIter, DidAdd] =
1705 RecordContainsAddressDiscriminatedPointerAuth.try_emplace(RD,
Result);
1711 auto ShouldContinueAfterUpdate = [&](PointerAuthContent NewResult) {
1712 static_assert(PointerAuthContent::None <
1713 PointerAuthContent::AddressDiscriminatedVTable);
1714 static_assert(PointerAuthContent::AddressDiscriminatedVTable <
1715 PointerAuthContent::AddressDiscriminatedData);
1718 return Result != PointerAuthContent::AddressDiscriminatedData;
1720 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD)) {
1722 !ShouldContinueAfterUpdate(
1723 PointerAuthContent::AddressDiscriminatedVTable))
1724 return SaveResultAndReturn();
1725 for (
auto Base : CXXRD->bases()) {
1726 if (!ShouldContinueAfterUpdate(findPointerAuthContent(
Base.getType())))
1727 return SaveResultAndReturn();
1730 for (
auto *FieldDecl : RD->
fields()) {
1731 if (!ShouldContinueAfterUpdate(
1732 findPointerAuthContent(FieldDecl->getType())))
1733 return SaveResultAndReturn();
1735 return SaveResultAndReturn();
1739 assert(!Import->getNextLocalImport() &&
1740 "Import declaration already in the chain");
1741 assert(!Import->isFromASTFile() &&
"Non-local import declaration");
1742 if (!FirstLocalImport) {
1743 FirstLocalImport = Import;
1744 LastLocalImport = Import;
1748 LastLocalImport->setNextLocalImport(Import);
1749 LastLocalImport = Import;
1761 llvm_unreachable(
"Not a floating point type!");
1762 case BuiltinType::BFloat16:
1763 return Target->getBFloat16Format();
1764 case BuiltinType::Float16:
1765 return Target->getHalfFormat();
1766 case BuiltinType::Half:
1767 return Target->getHalfFormat();
1768 case BuiltinType::Float:
return Target->getFloatFormat();
1769 case BuiltinType::Double:
return Target->getDoubleFormat();
1770 case BuiltinType::Ibm128:
1771 return Target->getIbm128Format();
1772 case BuiltinType::LongDouble:
1774 return AuxTarget->getLongDoubleFormat();
1775 return Target->getLongDoubleFormat();
1776 case BuiltinType::Float128:
1778 return AuxTarget->getFloat128Format();
1779 return Target->getFloat128Format();
1784 unsigned Align = Target->getCharWidth();
1788 Align = AlignFromAttr;
1796 bool UseAlignAttrOnly;
1797 if (
const FieldDecl *FD = dyn_cast<FieldDecl>(D))
1799 FD->hasAttr<PackedAttr>() || FD->getParent()->hasAttr<PackedAttr>();
1801 UseAlignAttrOnly = AlignFromAttr != 0;
1804 if (UseAlignAttrOnly) {
1806 }
else if (
const auto *VD = dyn_cast<ValueDecl>(D)) {
1810 T = RT->getPointeeType();
1815 if (T->isFunctionType())
1816 Align = getTypeInfoImpl(T.getTypePtr()).Align;
1821 unsigned MinWidth = Target->getLargeArrayMinWidth();
1822 if (!ForAlignof && MinWidth) {
1824 Align = std::max(Align, Target->getLargeArrayAlign());
1827 Align = std::max(Align, Target->getLargeArrayAlign());
1832 Align = Target->getCharWidth();
1836 if (
const auto *VD = dyn_cast<VarDecl>(D))
1837 if (VD->hasGlobalStorage() && !ForAlignof) {
1848 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1862 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1863 if (LowBitOfOffset < FieldAlign)
1864 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1867 Align = std::min(Align, FieldAlign);
1875 const auto *VD = dyn_cast<VarDecl>(D);
1876 if (MaxAlignedAttr && VD && VD->getStorageClass() ==
SC_Static)
1877 Align = std::min(Align, MaxAlignedAttr);
1897 if (
const auto *RD = T->getAsCXXRecordDecl(); RD && !RD->
isInvalidDecl()) {
1914 (uint64_t)(-1)/Size) &&
1915 "Overflow in array type char size evaluation");
1918 if (!Context.getTargetInfo().getCXXABI().isMicrosoft() ||
1920 Width = llvm::alignTo(Width, Align);
1927 if (
const auto *CAT = dyn_cast<ConstantArrayType>(T))
1945 switch (BT->getKind()) {
1946 case BuiltinType::Bool:
1947 case BuiltinType::Char_S:
1948 case BuiltinType::Char_U:
1949 case BuiltinType::SChar:
1950 case BuiltinType::UChar:
1951 case BuiltinType::Short:
1952 case BuiltinType::UShort:
1953 case BuiltinType::WChar_S:
1954 case BuiltinType::WChar_U:
1955 case BuiltinType::Char8:
1956 case BuiltinType::Char16:
1957 case BuiltinType::Char32:
1965 if (
const auto *ED = T->getAsEnumDecl()) {
1966 if (T->isDependentType() || ED->getPromotionType().isNull() ||
1974 if (
const auto *OBT = T->getAs<OverflowBehaviorType>()) {
1990 bool NeedsPreferredAlignment)
const {
1993 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1998 if (!T->isIncompleteType())
2004 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
2008 if (
const auto *TD = T->getAsTagDecl())
2009 return TD->getMaxAlignment();
2015 TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
2016 if (I != MemoizedTypeInfo.end())
2021 MemoizedTypeInfo[T] = TI;
2031TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
2036 switch (T->getTypeClass()) {
2037#define TYPE(Class, Base)
2038#define ABSTRACT_TYPE(Class, Base)
2039#define NON_CANONICAL_TYPE(Class, Base)
2040#define DEPENDENT_TYPE(Class, Base) case Type::Class:
2041#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \
2043 assert(!T->isDependentType() && "should not see dependent types here"); \
2044 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr());
2045#include "clang/AST/TypeNodes.inc"
2046 llvm_unreachable(
"Should not see dependent types");
2048 case Type::FunctionNoProto:
2049 case Type::FunctionProto:
2055 case Type::IncompleteArray:
2056 case Type::VariableArray:
2057 case Type::ConstantArray:
2058 case Type::ArrayParameter: {
2061 if (
const auto *CAT = dyn_cast<ConstantArrayType>(T))
2062 Size = CAT->getZExtSize();
2065 assert((Size == 0 || EltInfo.
Width <= (uint64_t)(-1) / Size) &&
2066 "Overflow in array type bit size evaluation");
2067 Width = EltInfo.
Width * Size;
2068 Align = EltInfo.
Align;
2072 Width = llvm::alignTo(Width, Align);
2076 case Type::ExtVector:
2077 case Type::Vector: {
2080 Width = VT->isPackedVectorBoolType(*
this)
2081 ? VT->getNumElements()
2082 : EltInfo.
Width * VT->getNumElements();
2084 Width = std::max<unsigned>(8, Width);
2085 Align = std::max<unsigned>(
2086 8,
Target->vectorsAreElementAligned() ? EltInfo.
Width : Width);
2090 if (Align & (Align-1)) {
2091 Align = llvm::bit_ceil(Align);
2092 Width = llvm::alignTo(Width, Align);
2095 uint64_t TargetVectorAlign = Target->getMaxVectorAlign();
2096 if (TargetVectorAlign && TargetVectorAlign < Align)
2097 Align = TargetVectorAlign;
2111 Align = std::min<unsigned>(64, Width);
2115 case Type::ConstantMatrix: {
2117 TypeInfo ElementInfo =
getTypeInfo(MT->getElementType());
2121 Width = ElementInfo.
Width * MT->getNumRows() * MT->getNumColumns();
2122 Align = ElementInfo.
Align;
2128 default: llvm_unreachable(
"Unknown builtin type!");
2129 case BuiltinType::Void:
2134 case BuiltinType::Bool:
2135 Width = Target->getBoolWidth();
2136 Align = Target->getBoolAlign();
2138 case BuiltinType::Char_S:
2139 case BuiltinType::Char_U:
2140 case BuiltinType::UChar:
2141 case BuiltinType::SChar:
2142 case BuiltinType::Char8:
2143 Width = Target->getCharWidth();
2144 Align = Target->getCharAlign();
2146 case BuiltinType::WChar_S:
2147 case BuiltinType::WChar_U:
2148 Width = Target->getWCharWidth();
2149 Align = Target->getWCharAlign();
2151 case BuiltinType::Char16:
2152 Width = Target->getChar16Width();
2153 Align = Target->getChar16Align();
2155 case BuiltinType::Char32:
2156 Width = Target->getChar32Width();
2157 Align = Target->getChar32Align();
2159 case BuiltinType::UShort:
2160 case BuiltinType::Short:
2161 Width = Target->getShortWidth();
2162 Align = Target->getShortAlign();
2164 case BuiltinType::UInt:
2165 case BuiltinType::Int:
2166 Width = Target->getIntWidth();
2167 Align = Target->getIntAlign();
2169 case BuiltinType::ULong:
2170 case BuiltinType::Long:
2171 Width = Target->getLongWidth();
2172 Align = Target->getLongAlign();
2174 case BuiltinType::ULongLong:
2175 case BuiltinType::LongLong:
2176 Width = Target->getLongLongWidth();
2177 Align = Target->getLongLongAlign();
2179 case BuiltinType::Int128:
2180 case BuiltinType::UInt128:
2182 Align = Target->getInt128Align();
2184 case BuiltinType::ShortAccum:
2185 case BuiltinType::UShortAccum:
2186 case BuiltinType::SatShortAccum:
2187 case BuiltinType::SatUShortAccum:
2188 Width = Target->getShortAccumWidth();
2189 Align = Target->getShortAccumAlign();
2191 case BuiltinType::Accum:
2192 case BuiltinType::UAccum:
2193 case BuiltinType::SatAccum:
2194 case BuiltinType::SatUAccum:
2195 Width = Target->getAccumWidth();
2196 Align = Target->getAccumAlign();
2198 case BuiltinType::LongAccum:
2199 case BuiltinType::ULongAccum:
2200 case BuiltinType::SatLongAccum:
2201 case BuiltinType::SatULongAccum:
2202 Width = Target->getLongAccumWidth();
2203 Align = Target->getLongAccumAlign();
2205 case BuiltinType::ShortFract:
2206 case BuiltinType::UShortFract:
2207 case BuiltinType::SatShortFract:
2208 case BuiltinType::SatUShortFract:
2209 Width = Target->getShortFractWidth();
2210 Align = Target->getShortFractAlign();
2212 case BuiltinType::Fract:
2213 case BuiltinType::UFract:
2214 case BuiltinType::SatFract:
2215 case BuiltinType::SatUFract:
2216 Width = Target->getFractWidth();
2217 Align = Target->getFractAlign();
2219 case BuiltinType::LongFract:
2220 case BuiltinType::ULongFract:
2221 case BuiltinType::SatLongFract:
2222 case BuiltinType::SatULongFract:
2223 Width = Target->getLongFractWidth();
2224 Align = Target->getLongFractAlign();
2226 case BuiltinType::BFloat16:
2227 if (Target->hasBFloat16Type()) {
2228 Width = Target->getBFloat16Width();
2229 Align = Target->getBFloat16Align();
2233 AuxTarget->hasBFloat16Type()) {
2234 Width = AuxTarget->getBFloat16Width();
2235 Align = AuxTarget->getBFloat16Align();
2238 case BuiltinType::Float16:
2239 case BuiltinType::Half:
2240 if (Target->hasFloat16Type() || !
getLangOpts().OpenMP ||
2242 Width = Target->getHalfWidth();
2243 Align = Target->getHalfAlign();
2246 "Expected OpenMP device compilation.");
2247 Width = AuxTarget->getHalfWidth();
2248 Align = AuxTarget->getHalfAlign();
2251 case BuiltinType::Float:
2252 Width = Target->getFloatWidth();
2253 Align = Target->getFloatAlign();
2255 case BuiltinType::Double:
2256 Width = Target->getDoubleWidth();
2257 Align = Target->getDoubleAlign();
2259 case BuiltinType::Ibm128:
2260 Width = Target->getIbm128Width();
2261 Align = Target->getIbm128Align();
2263 case BuiltinType::LongDouble:
2265 (Target->getLongDoubleWidth() != AuxTarget->getLongDoubleWidth() ||
2266 Target->getLongDoubleAlign() != AuxTarget->getLongDoubleAlign())) {
2267 Width = AuxTarget->getLongDoubleWidth();
2268 Align = AuxTarget->getLongDoubleAlign();
2270 Width = Target->getLongDoubleWidth();
2271 Align = Target->getLongDoubleAlign();
2274 case BuiltinType::Float128:
2275 if (Target->hasFloat128Type() || !
getLangOpts().OpenMP ||
2277 Width = Target->getFloat128Width();
2278 Align = Target->getFloat128Align();
2281 "Expected OpenMP device compilation.");
2282 Width = AuxTarget->getFloat128Width();
2283 Align = AuxTarget->getFloat128Align();
2286 case BuiltinType::NullPtr:
2291 case BuiltinType::ObjCId:
2292 case BuiltinType::ObjCClass:
2293 case BuiltinType::ObjCSel:
2297 case BuiltinType::OCLSampler:
2298 case BuiltinType::OCLEvent:
2299 case BuiltinType::OCLClkEvent:
2300 case BuiltinType::OCLQueue:
2301 case BuiltinType::OCLReserveID:
2302#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2303 case BuiltinType::Id:
2304#include "clang/Basic/OpenCLImageTypes.def"
2305#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2306 case BuiltinType::Id:
2307#include "clang/Basic/OpenCLExtensionTypes.def"
2309 Width = Target->getPointerWidth(AS);
2310 Align = Target->getPointerAlign(AS);
2320#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
2321 case BuiltinType::Id: \
2325#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \
2326 case BuiltinType::Id: \
2330#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2331 case BuiltinType::Id: \
2335#define SVE_SCALAR_TYPE(Name, MangledName, Id, SingletonId, Bits) \
2336 case BuiltinType::Id: \
2340#include "clang/Basic/AArch64ACLETypes.def"
2341#define PPC_VECTOR_TYPE(Name, Id, Size) \
2342 case BuiltinType::Id: \
2346#include "clang/Basic/PPCTypes.def"
2347#define RVV_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, NF, IsSigned, \
2349 case BuiltinType::Id: \
2353#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) \
2354 case BuiltinType::Id: \
2358#include "clang/Basic/RISCVVTypes.def"
2359#define WASM_TYPE(Name, Id, SingletonId) \
2360 case BuiltinType::Id: \
2364#include "clang/Basic/WebAssemblyReferenceTypes.def"
2365#define AMDGPU_TYPE(NAME, ID, SINGLETONID, WIDTH, ALIGN) \
2366 case BuiltinType::ID: \
2370#include "clang/Basic/AMDGPUTypes.def"
2371#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2372#include "clang/Basic/HLSLIntangibleTypes.def"
2378 case Type::ObjCObjectPointer:
2382 case Type::BlockPointer:
2384 Width = Target->getPointerWidth(AS);
2385 Align = Target->getPointerAlign(AS);
2387 case Type::LValueReference:
2388 case Type::RValueReference:
2392 Width = Target->getPointerWidth(AS);
2393 Align = Target->getPointerAlign(AS);
2397 Width = Target->getPointerWidth(AS);
2398 Align = Target->getPointerAlign(AS);
2400 case Type::MemberPointer: {
2402 CXXABI::MemberPointerInfo MPI = ABI->getMemberPointerInfo(MPT);
2407 case Type::Complex: {
2411 Width = EltInfo.
Width * 2;
2412 Align = EltInfo.
Align;
2415 case Type::ObjCObject:
2417 case Type::Adjusted:
2420 case Type::ObjCInterface: {
2422 if (ObjCI->getDecl()->isInvalidDecl()) {
2432 case Type::BitInt: {
2434 Align = Target->getBitIntAlign(EIT->getNumBits());
2435 Width = Target->getBitIntWidth(EIT->getNumBits());
2441 const TagDecl *TD = TT->getDecl()->getDefinitionOrSelf();
2454 Info.
Align = AttrAlign;
2464 AlignRequirement = RD->
hasAttr<AlignedAttr>()
2470 case Type::SubstTemplateTypeParm:
2472 getReplacementType().getTypePtr());
2475 case Type::DeducedTemplateSpecialization: {
2477 assert(!A->getDeducedType().isNull() &&
2478 "cannot request the size of an undeduced or dependent auto type");
2479 return getTypeInfo(A->getDeducedType().getTypePtr());
2485 case Type::MacroQualified:
2489 case Type::ObjCTypeParam:
2495 case Type::Typedef: {
2497 TypeInfo Info =
getTypeInfo(TT->desugar().getTypePtr());
2501 if (
unsigned AttrAlign = TT->getDecl()->getMaxAlignment()) {
2512 case Type::Attributed:
2516 case Type::CountAttributed:
2519 case Type::BTFTagAttributed:
2523 case Type::OverflowBehavior:
2527 case Type::HLSLAttributedResource:
2531 case Type::HLSLInlineSpirv: {
2534 Width = ST->getSize() * 8;
2535 Align = ST->getAlignment();
2536 if (Width == 0 && Align == 0) {
2544 case Type::Atomic: {
2553 Width = Target->getCharWidth();
2555 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2561 Width = llvm::bit_ceil(Width);
2564 Align =
static_cast<unsigned>(Width);
2569 case Type::PredefinedSugar:
2578 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2579 return TypeInfo(Width, Align, AlignRequirement);
2583 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(T);
2584 if (I != MemoizedUnadjustedAlign.end())
2587 unsigned UnadjustedAlign;
2588 if (
const auto *RT = T->getAsCanonical<RecordType>()) {
2595 UnadjustedAlign =
getTypeAlign(T->getUnqualifiedDesugaredType());
2598 MemoizedUnadjustedAlign[T] = UnadjustedAlign;
2599 return UnadjustedAlign;
2603 unsigned SimdAlign = llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(
2653 unsigned ABIAlign = TI.
Align;
2655 T = T->getBaseElementTypeUnsafe();
2658 if (T->isMemberPointerType())
2661 if (!Target->allowsLargerPreferedTypeAlignment())
2664 if (
const auto *RD = T->getAsRecordDecl()) {
2673 unsigned PreferredAlign =
static_cast<unsigned>(
2675 assert(PreferredAlign >= ABIAlign &&
2676 "PreferredAlign should be at least as large as ABIAlign.");
2677 return PreferredAlign;
2684 T = CT->getElementType().getTypePtr();
2685 if (
const auto *ED = T->getAsEnumDecl())
2686 T = ED->getIntegerType().getTypePtr();
2687 if (T->isSpecificBuiltinType(BuiltinType::Double) ||
2688 T->isSpecificBuiltinType(BuiltinType::LongLong) ||
2689 T->isSpecificBuiltinType(BuiltinType::ULongLong) ||
2690 (T->isSpecificBuiltinType(BuiltinType::LongDouble) &&
2691 Target->defaultsToAIXPowerAlignment()))
2695 return std::max(ABIAlign, (
unsigned)
getTypeSize(T));
2746 for (
unsigned I = 0, N = Path.size(); I != N; ++I) {
2750 std::swap(
Base, Derived);
2770 llvm::append_range(Ivars, OI->
ivars());
2773 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2775 Ivars.push_back(Iv);
2783 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2786 for (
auto *Proto : OI->all_referenced_protocols()) {
2791 for (
const auto *Cat : OI->visible_categories())
2797 SD = SD->getSuperClass();
2799 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2800 for (
auto *Proto : OC->protocols()) {
2803 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2805 if (!Protocols.insert(
2809 for (
auto *Proto : OP->protocols())
2816 bool CheckIfTriviallyCopyable) {
2817 assert(RD->
isUnion() &&
"Must be union type");
2819 Context.getTypeSizeInChars(Context.getCanonicalTagType(RD));
2821 for (
const auto *Field : RD->
fields()) {
2822 if (!Context.hasUniqueObjectRepresentations(Field->getType(),
2823 CheckIfTriviallyCopyable))
2825 CharUnits FieldSize = Context.getTypeSizeInChars(Field->getType());
2826 if (FieldSize != UnionSize)
2835 return Context.getFieldOffset(Field);
2844static std::optional<int64_t>
2846 const RecordDecl *RD,
2847 bool CheckIfTriviallyCopyable);
2849static std::optional<int64_t>
2851 bool CheckIfTriviallyCopyable) {
2852 if (
const auto *RD = Field->getType()->getAsRecordDecl();
2855 CheckIfTriviallyCopyable);
2859 bool IsBitIntType = Field->getType()->isBitIntType();
2860 if (!Field->getType()->isReferenceType() && !IsBitIntType &&
2861 !Context.hasUniqueObjectRepresentations(Field->getType(),
2862 CheckIfTriviallyCopyable))
2863 return std::nullopt;
2865 int64_t FieldSizeInBits =
2866 Context.toBits(Context.getTypeSizeInChars(Field->getType()));
2867 if (Field->isBitField()) {
2870 if (Field->isUnnamedBitField())
2873 int64_t BitfieldSize = Field->getBitWidthValue();
2875 if ((
unsigned)BitfieldSize >
2877 return std::nullopt;
2878 }
else if (BitfieldSize > FieldSizeInBits) {
2879 return std::nullopt;
2881 FieldSizeInBits = BitfieldSize;
2882 }
else if (IsBitIntType && !Context.hasUniqueObjectRepresentations(
2883 Field->getType(), CheckIfTriviallyCopyable)) {
2884 return std::nullopt;
2886 return FieldSizeInBits;
2889static std::optional<int64_t>
2891 bool CheckIfTriviallyCopyable) {
2893 CheckIfTriviallyCopyable);
2896template <
typename RangeT>
2898 const RangeT &Subobjects, int64_t CurOffsetInBits,
2900 bool CheckIfTriviallyCopyable) {
2901 for (
const auto *Subobject : Subobjects) {
2902 std::optional<int64_t> SizeInBits =
2905 return std::nullopt;
2906 if (*SizeInBits != 0) {
2908 if (Offset != CurOffsetInBits)
2909 return std::nullopt;
2910 CurOffsetInBits += *SizeInBits;
2913 return CurOffsetInBits;
2916static std::optional<int64_t>
2919 bool CheckIfTriviallyCopyable) {
2920 assert(!RD->
isUnion() &&
"Must be struct/class type");
2921 const auto &Layout = Context.getASTRecordLayout(RD);
2923 int64_t CurOffsetInBits = 0;
2924 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2925 if (ClassDecl->isDynamicClass())
2926 return std::nullopt;
2929 for (
const auto &
Base : ClassDecl->bases()) {
2932 Bases.emplace_back(
Base.getType()->getAsCXXRecordDecl());
2936 return Layout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R);
2939 std::optional<int64_t> OffsetAfterBases =
2941 Bases, CurOffsetInBits, Context, Layout, CheckIfTriviallyCopyable);
2942 if (!OffsetAfterBases)
2943 return std::nullopt;
2944 CurOffsetInBits = *OffsetAfterBases;
2947 std::optional<int64_t> OffsetAfterFields =
2949 RD->
fields(), CurOffsetInBits, Context, Layout,
2950 CheckIfTriviallyCopyable);
2951 if (!OffsetAfterFields)
2952 return std::nullopt;
2953 CurOffsetInBits = *OffsetAfterFields;
2955 return CurOffsetInBits;
2959 QualType Ty,
bool CheckIfTriviallyCopyable)
const {
2976 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2981 CheckIfTriviallyCopyable);
2984 "hasUniqueObjectRepresentations should not be called with an "
3008 return !ABI->getMemberPointerInfo(MPT).HasPadding;
3011 if (
Record->isInvalidDecl())
3016 CheckIfTriviallyCopyable);
3019 *
this,
Record, CheckIfTriviallyCopyable);
3021 return StructSize && *StructSize ==
static_cast<int64_t
>(
getTypeSize(Ty));
3042 count += Ext->ivar_size();
3047 count += ImplDecl->ivar_size();
3073 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
3074 I = ObjCImpls.find(D);
3075 if (I != ObjCImpls.end())
3083 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
3084 I = ObjCImpls.find(D);
3085 if (I != ObjCImpls.end())
3093 assert(IFaceD && ImplD &&
"Passed null params");
3094 ObjCImpls[IFaceD] = ImplD;
3100 assert(CatD && ImplD &&
"Passed null params");
3101 ObjCImpls[CatD] = ImplD;
3106 return ObjCMethodRedecls.
lookup(MD);
3112 ObjCMethodRedecls[MD] = Redecl;
3117 if (
const auto *ID = dyn_cast<ObjCInterfaceDecl>(ND->
getDeclContext()))
3119 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
3120 return CD->getClassInterface();
3121 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
3122 return IMD->getClassInterface();
3130 assert(VD &&
"Passed null params");
3131 assert(VD->
hasAttr<BlocksAttr>() &&
3132 "getBlockVarCopyInits - not __block var");
3133 auto I = BlockVarCopyInits.find(VD);
3134 if (I != BlockVarCopyInits.end())
3136 return {
nullptr,
false};
3142 assert(VD && CopyExpr &&
"Passed null params");
3143 assert(VD->
hasAttr<BlocksAttr>() &&
3144 "setBlockVarCopyInits - not __block var");
3145 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr,
CanThrow);
3149 unsigned DataSize)
const {
3154 "incorrect data size provided to CreateTypeSourceInfo!");
3171 return getObjCLayout(D);
3176 bool &AnyNonCanonArgs) {
3178 AnyNonCanonArgs |=
C.canonicalizeTemplateArguments(CanonArgs);
3184 bool AnyNonCanonArgs =
false;
3185 for (
auto &Arg : Args) {
3188 AnyNonCanonArgs |= !Arg.structurallyEquals(OrigArg);
3190 return AnyNonCanonArgs;
3198ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
3203 llvm::FoldingSetNodeID ID;
3205 void *insertPos =
nullptr;
3206 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
3207 assert(eq->getQualifiers() == quals);
3216 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
3219 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
3222 auto *eq =
new (*
this,
alignof(ExtQuals)) ExtQuals(baseType, canon, quals);
3223 ExtQualNodes.InsertNode(eq, insertPos);
3224 return QualType(eq, fastQuals);
3228 LangAS AddressSpace)
const {
3241 "Type cannot be in multiple addr spaces!");
3244 return getExtQualType(TypeNode, Quals);
3250 if (!T.hasAddressSpace())
3254 const Type *TypeNode;
3257 if (T.getTypePtr()->isArrayType()) {
3259 TypeNode = T.getTypePtr();
3263 while (T.hasAddressSpace()) {
3264 TypeNode = Quals.
strip(T);
3268 if (!
QualType(TypeNode, 0).hasAddressSpace())
3272 T = T.getSingleStepDesugaredType(*
this);
3282 return getExtQualType(TypeNode, Quals);
3290 "Attempted to get vtable pointer discriminator on a monomorphic type");
3293 llvm::raw_svector_ostream Out(Str);
3294 MC->mangleCXXVTable(RD, Out);
3295 return llvm::getPointerAuthStableSipHash(Str);
3321 switch (T->getTypeClass()) {
3326 case Type::LValueReference:
3331 case Type::RValueReference:
3345 case Type::ObjCObjectPointer:
3346 case Type::BlockPointer:
3355 case Type::VariableArray:
3356 case Type::ConstantArray:
3357 case Type::IncompleteArray:
3358 case Type::ArrayParameter:
3371 case Type::ObjCInterface:
3372 case Type::ObjCObject:
3373 OS <<
"<objc_object>";
3384 Ctx, OS, UnderlyingType.
isNull() ? Ctx.
IntTy : UnderlyingType);
3387 case Type::FunctionNoProto:
3388 case Type::FunctionProto: {
3404 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FuncType)) {
3405 for (
QualType Param : FPT->param_types()) {
3409 if (FPT->isVariadic())
3416 case Type::MemberPointer: {
3420 Ctx, OS,
QualType(MPT->getQualifier().getAsType(), 0));
3424 case Type::ExtVector:
3432 case Type::ConstantMatrix:
3436 case Type::Builtin: {
3438 switch (BTy->getKind()) {
3439#define SIGNED_TYPE(Id, SingletonId) \
3440 case BuiltinType::Id: \
3443#define UNSIGNED_TYPE(Id, SingletonId) \
3444 case BuiltinType::Id: \
3447#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
3448#define BUILTIN_TYPE(Id, SingletonId)
3449#include "clang/AST/BuiltinTypes.def"
3450 llvm_unreachable(
"placeholder types should not appear here.");
3452 case BuiltinType::Half:
3455 case BuiltinType::Float:
3458 case BuiltinType::Double:
3461 case BuiltinType::LongDouble:
3464 case BuiltinType::Float16:
3467 case BuiltinType::Float128:
3471 case BuiltinType::Void:
3475 case BuiltinType::ObjCId:
3476 case BuiltinType::ObjCClass:
3477 case BuiltinType::ObjCSel:
3478 case BuiltinType::NullPtr:
3483 case BuiltinType::OCLSampler:
3484 case BuiltinType::OCLEvent:
3485 case BuiltinType::OCLClkEvent:
3486 case BuiltinType::OCLQueue:
3487 case BuiltinType::OCLReserveID:
3488 case BuiltinType::BFloat16:
3489 case BuiltinType::VectorQuad:
3490 case BuiltinType::VectorPair:
3491 case BuiltinType::DMR1024:
3492 case BuiltinType::DMR2048:
3497 case BuiltinType::Ibm128:
3499#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3500 case BuiltinType::Id: \
3502#include "clang/Basic/OpenCLImageTypes.def"
3503#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
3504 case BuiltinType::Id: \
3506#include "clang/Basic/OpenCLExtensionTypes.def"
3507#define SVE_TYPE(Name, Id, SingletonId) \
3508 case BuiltinType::Id: \
3510#include "clang/Basic/AArch64ACLETypes.def"
3511#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
3512 case BuiltinType::Id: \
3514#include "clang/Basic/HLSLIntangibleTypes.def"
3515 case BuiltinType::Dependent:
3516 llvm_unreachable(
"should never get here");
3517#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id:
3518#include "clang/Basic/AMDGPUTypes.def"
3519 case BuiltinType::WasmExternRef:
3520#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
3521#include "clang/Basic/RISCVVTypes.def"
3522 llvm_unreachable(
"not yet implemented");
3524 llvm_unreachable(
"should never get here");
3526 case Type::Record: {
3527 const RecordDecl *RD = T->castAsCanonical<RecordType>()->getDecl();
3547 II = Typedef->getDeclName().getAsIdentifierInfo();
3550 OS <<
"<anonymous_record>";
3556 case Type::HLSLAttributedResource:
3557 case Type::HLSLInlineSpirv:
3558 llvm_unreachable(
"should never get here");
3560 case Type::OverflowBehavior:
3561 llvm_unreachable(
"should never get here");
3563 case Type::DeducedTemplateSpecialization:
3565#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
3566#define DEPENDENT_TYPE(Class, Base) case Type::Class:
3567#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
3568#define ABSTRACT_TYPE(Class, Base)
3569#define TYPE(Class, Base)
3570#include "clang/AST/TypeNodes.inc"
3571 llvm_unreachable(
"unexpected non-canonical or dependent type!");
3577 assert(!T->isDependentType() &&
3578 "cannot compute type discriminator of a dependent type");
3580 llvm::raw_svector_ostream Out(Str);
3582 if (T->isFunctionPointerType() || T->isFunctionReferenceType())
3583 T = T->getPointeeType();
3585 if (T->isFunctionType()) {
3588 T = T.getUnqualifiedType();
3609 if (MPT->isMemberFunctionPointer()) {
3615 MPT->getMostRecentCXXRecordDecl());
3619 MC->mangleCanonicalTypeName(T, Out);
3622 return llvm::getPointerAuthStableSipHash(Str);
3647 "Type cannot have multiple ObjCGCs!");
3650 return getExtQualType(TypeNode, Quals);
3664 QualType WrappedTy,
Expr *CountExpr,
bool CountInBytes,
bool OrNull,
3668 llvm::FoldingSetNodeID ID;
3671 void *InsertPos =
nullptr;
3673 CountAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
3678 size_t Size = CountAttributedType::totalSizeToAlloc<TypeCoupledDeclRefInfo>(
3679 DependentDecls.size());
3682 OrNull, DependentDecls);
3683 Types.push_back(CATy);
3684 CountAttributedTypes.InsertNode(CATy, InsertPos);
3693 case Type::Attributed: {
3701 case Type::BTFTagAttributed: {
3702 const auto *BTFT = dyn_cast<BTFTagAttributedType>(Orig);
3707 case Type::OverflowBehavior: {
3708 const auto *OB = dyn_cast<OverflowBehaviorType>(Orig);
3710 adjustType(OB->getUnderlyingType(), Adjust));
3717 case Type::Adjusted: {
3723 case Type::MacroQualified: {
3726 MQT->getMacroIdentifier());
3730 return Adjust(Orig);
3736 if (T->getExtInfo() == Info)
3740 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(T)) {
3760 FPT->getExtProtoInfo());
3775 L->DeducedReturnType(FD, ResultType);
3786 return getFunctionType(Proto->getReturnType(), Proto->getParamTypes(),
3787 Proto->getExtProtoInfo().withExceptionSpec(ESI));
3803 for (
unsigned i = 0, n = Args.size(); i != n; ++i)
3826 return getFunctionType(Proto->getReturnType(), Proto->param_types(), EPI);
3852 if (TSInfo->getType() != FD->
getType())
3860 "TypeLoc size mismatch from updating exception specification");
3861 TSInfo->overrideType(Updated);
3870 llvm::FoldingSetNodeID ID;
3873 void *InsertPos =
nullptr;
3874 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
3880 if (!T.isCanonical()) {
3884 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
3885 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3888 Types.push_back(
New);
3889 ComplexTypes.InsertNode(
New, InsertPos);
3898 llvm::FoldingSetNodeID ID;
3901 void *InsertPos =
nullptr;
3902 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3908 if (!T.isCanonical()) {
3912 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3913 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3916 Types.push_back(
New);
3917 PointerTypes.InsertNode(
New, InsertPos);
3922 llvm::FoldingSetNodeID ID;
3924 void *InsertPos =
nullptr;
3925 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3932 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3933 assert(!AT &&
"Shouldn't be in the map!");
3937 Types.push_back(AT);
3938 AdjustedTypes.InsertNode(AT, InsertPos);
3943 llvm::FoldingSetNodeID ID;
3945 void *InsertPos =
nullptr;
3946 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3953 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3954 assert(!AT &&
"Shouldn't be in the map!");
3957 Types.push_back(AT);
3958 AdjustedTypes.InsertNode(AT, InsertPos);
3963 assert((T->isArrayType() || T->isFunctionType()) &&
"T does not decay");
3972 if (T->isArrayType())
3979 if (T->isFunctionType())
3991 llvm::FoldingSetNodeID ID;
3992 ATy->Profile(ID, *
this, ATy->getElementType(), ATy->getZExtSize(),
3993 ATy->getSizeExpr(), ATy->getSizeModifier(),
3994 ATy->getIndexTypeQualifiers().getAsOpaqueValue());
3995 void *InsertPos =
nullptr;
3997 ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
4006 AT = ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
4007 assert(!AT &&
"Shouldn't be in the map!");
4012 Types.push_back(AT);
4013 ArrayParameterTypes.InsertNode(AT, InsertPos);
4020 assert(T->isFunctionType() &&
"block of function types only");
4023 llvm::FoldingSetNodeID ID;
4026 void *InsertPos =
nullptr;
4028 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4034 if (!T.isCanonical()) {
4039 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4040 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4044 Types.push_back(
New);
4045 BlockPointerTypes.InsertNode(
New, InsertPos);
4053 assert((!T->isPlaceholderType() ||
4054 T->isSpecificPlaceholderType(BuiltinType::UnknownAny)) &&
4055 "Unresolved placeholder type");
4059 llvm::FoldingSetNodeID ID;
4062 void *InsertPos =
nullptr;
4064 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
4072 if (!SpelledAsLValue || InnerRef || !T.isCanonical()) {
4073 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
4078 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
4079 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4084 Types.push_back(
New);
4085 LValueReferenceTypes.InsertNode(
New, InsertPos);
4093 assert((!T->isPlaceholderType() ||
4094 T->isSpecificPlaceholderType(BuiltinType::UnknownAny)) &&
4095 "Unresolved placeholder type");
4099 llvm::FoldingSetNodeID ID;
4102 void *InsertPos =
nullptr;
4104 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
4112 if (InnerRef || !T.isCanonical()) {
4113 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
4118 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
4119 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4124 Types.push_back(
New);
4125 RValueReferenceTypes.InsertNode(
New, InsertPos);
4133 assert(Cls &&
"At least one of Qualifier or Cls must be provided");
4136 Cls = Qualifier.getAsRecordDecl();
4140 llvm::FoldingSetNodeID ID;
4143 void *InsertPos =
nullptr;
4145 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4150 return Qualifier.getCanonical();
4152 assert(R.isCanonical());
4158 if (!T.isCanonical() || Qualifier != CanonicalQualifier) {
4164 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4165 assert(!NewIP &&
"Shouldn't be in the map!");
4169 Types.push_back(
New);
4170 MemberPointerTypes.InsertNode(
New, InsertPos);
4177 const llvm::APInt &ArySizeIn,
4178 const Expr *SizeExpr,
4180 unsigned IndexTypeQuals)
const {
4183 "Constant array of VLAs is illegal!");
4191 llvm::APInt ArySize(ArySizeIn);
4192 ArySize = ArySize.zextOrTrunc(Target->getMaxPointerWidth());
4194 llvm::FoldingSetNodeID ID;
4196 ASM, IndexTypeQuals);
4198 void *InsertPos =
nullptr;
4200 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
4211 ASM, IndexTypeQuals);
4216 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
4217 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4220 auto *
New = ConstantArrayType::Create(*
this, EltTy, Canon, ArySize, SizeExpr,
4221 ASM, IndexTypeQuals);
4222 ConstantArrayTypes.InsertNode(
New, InsertPos);
4223 Types.push_back(
New);
4232 if (!
type->isVariablyModifiedType())
return type;
4237 const Type *ty = split.
Ty;
4239#define TYPE(Class, Base)
4240#define ABSTRACT_TYPE(Class, Base)
4241#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
4242#include "clang/AST/TypeNodes.inc"
4243 llvm_unreachable(
"didn't desugar past all non-canonical types?");
4249 case Type::DependentVector:
4250 case Type::ExtVector:
4251 case Type::DependentSizedExtVector:
4252 case Type::ConstantMatrix:
4253 case Type::DependentSizedMatrix:
4254 case Type::DependentAddressSpace:
4255 case Type::ObjCObject:
4256 case Type::ObjCInterface:
4257 case Type::ObjCObjectPointer:
4260 case Type::UnresolvedUsing:
4261 case Type::TypeOfExpr:
4263 case Type::Decltype:
4264 case Type::UnaryTransform:
4265 case Type::DependentName:
4266 case Type::InjectedClassName:
4267 case Type::TemplateSpecialization:
4268 case Type::TemplateTypeParm:
4269 case Type::SubstTemplateTypeParmPack:
4270 case Type::SubstBuiltinTemplatePack:
4272 case Type::DeducedTemplateSpecialization:
4273 case Type::PackExpansion:
4274 case Type::PackIndexing:
4276 case Type::DependentBitInt:
4277 case Type::ArrayParameter:
4278 case Type::HLSLAttributedResource:
4279 case Type::HLSLInlineSpirv:
4280 case Type::OverflowBehavior:
4281 llvm_unreachable(
"type should never be variably-modified");
4285 case Type::FunctionNoProto:
4286 case Type::FunctionProto:
4287 case Type::BlockPointer:
4288 case Type::MemberPointer:
4301 case Type::LValueReference: {
4305 lv->isSpelledAsLValue());
4309 case Type::RValueReference: {
4316 case Type::Atomic: {
4322 case Type::ConstantArray: {
4328 cat->getSizeModifier(),
4329 cat->getIndexTypeCVRQualifiers());
4333 case Type::DependentSizedArray: {
4337 dat->getSizeModifier(), dat->getIndexTypeCVRQualifiers());
4342 case Type::IncompleteArray: {
4347 iat->getIndexTypeCVRQualifiers());
4352 case Type::VariableArray: {
4357 vat->getIndexTypeCVRQualifiers());
4370 unsigned IndexTypeQuals)
const {
4387 VariableArrayTypes.push_back(
New);
4388 Types.push_back(
New);
4398 unsigned elementTypeQuals)
const {
4401 "Size must be type- or value-dependent!");
4405 void *insertPos =
nullptr;
4406 llvm::FoldingSetNodeID ID;
4408 ID, *
this, numElements ?
QualType(canonElementType.
Ty, 0) : elementType,
4409 ASM, elementTypeQuals, numElements);
4413 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
4425 DependentSizedArrayTypes.InsertNode(newType, insertPos);
4426 Types.push_back(newType);
4434 numElements, ASM, elementTypeQuals);
4435 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
4436 Types.push_back(canonTy);
4441 canonElementType.
Quals);
4445 if (
QualType(canonElementType.
Ty, 0) == elementType &&
4454 Types.push_back(sugaredType);
4460 unsigned elementTypeQuals)
const {
4461 llvm::FoldingSetNodeID ID;
4464 void *insertPos =
nullptr;
4466 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
4478 ASM, elementTypeQuals);
4483 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
4484 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
4490 IncompleteArrayTypes.InsertNode(newType, insertPos);
4491 Types.push_back(newType);
4497#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS) \
4498 {getIntTypeForBitwidth(BITS, SIGNED), llvm::ElementCount::getScalable(ELTS), \
4501#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS) \
4502 {ELTTY, llvm::ElementCount::getScalable(ELTS), NUMVECTORS};
4506 llvm_unreachable(
"Unsupported builtin vector type");
4508#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \
4509 ElBits, NF, IsSigned) \
4510 case BuiltinType::Id: \
4511 return {getIntTypeForBitwidth(ElBits, IsSigned), \
4512 llvm::ElementCount::getScalable(NumEls), NF};
4513#define SVE_VECTOR_TYPE_FLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4515 case BuiltinType::Id: \
4516 return {ElBits == 16 ? HalfTy : (ElBits == 32 ? FloatTy : DoubleTy), \
4517 llvm::ElementCount::getScalable(NumEls), NF};
4518#define SVE_VECTOR_TYPE_BFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4520 case BuiltinType::Id: \
4521 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
4522#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4524 case BuiltinType::Id: \
4525 return {MFloat8Ty, llvm::ElementCount::getScalable(NumEls), NF};
4526#define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \
4527 case BuiltinType::Id: \
4528 return {BoolTy, llvm::ElementCount::getScalable(NumEls), NF};
4529#include "clang/Basic/AArch64ACLETypes.def"
4531#define RVV_VECTOR_TYPE_INT(Name, Id, SingletonId, NumEls, ElBits, NF, \
4533 case BuiltinType::Id: \
4534 return {getIntTypeForBitwidth(ElBits, IsSigned), \
4535 llvm::ElementCount::getScalable(NumEls), NF};
4536#define RVV_VECTOR_TYPE_FLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4537 case BuiltinType::Id: \
4538 return {ElBits == 16 ? Float16Ty : (ElBits == 32 ? FloatTy : DoubleTy), \
4539 llvm::ElementCount::getScalable(NumEls), NF};
4540#define RVV_VECTOR_TYPE_BFLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4541 case BuiltinType::Id: \
4542 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
4543#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4544 case BuiltinType::Id: \
4545 return {BoolTy, llvm::ElementCount::getScalable(NumEls), 1};
4546#include "clang/Basic/RISCVVTypes.def"
4553 if (Target->getTriple().isWasm() && Target->hasFeature(
"reference-types")) {
4554#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
4555 if (BuiltinType::Id == BuiltinType::WasmExternRef) \
4557#include "clang/Basic/WebAssemblyReferenceTypes.def"
4560 "shouldn't try to generate type externref outside WebAssembly target");
4567 unsigned NumFields)
const {
4569 if (
auto It = ScalableVecTyMap.find(K); It != ScalableVecTyMap.end())
4572 if (Target->hasAArch64ACLETypes()) {
4575#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \
4576 ElBits, NF, IsSigned) \
4577 if (EltTy->hasIntegerRepresentation() && !EltTy->isBooleanType() && \
4578 EltTy->hasSignedIntegerRepresentation() == IsSigned && \
4579 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4580 return ScalableVecTyMap[K] = SingletonId; \
4582#define SVE_VECTOR_TYPE_FLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4584 if (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4585 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4586 return ScalableVecTyMap[K] = SingletonId; \
4588#define SVE_VECTOR_TYPE_BFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4590 if (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4591 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4592 return ScalableVecTyMap[K] = SingletonId; \
4594#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4596 if (EltTy->isMFloat8Type() && EltTySize == ElBits && \
4597 NumElts == (NumEls * NF) && NumFields == 1) { \
4598 return ScalableVecTyMap[K] = SingletonId; \
4600#define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \
4601 if (EltTy->isBooleanType() && NumElts == (NumEls * NF) && NumFields == 1) \
4602 return ScalableVecTyMap[K] = SingletonId;
4603#include "clang/Basic/AArch64ACLETypes.def"
4604 }
else if (Target->hasRISCVVTypes()) {
4606#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
4608 if (!EltTy->isBooleanType() && \
4609 ((EltTy->hasIntegerRepresentation() && \
4610 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4611 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4613 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4614 IsBF && !IsFP)) && \
4615 EltTySize == ElBits && NumElts == NumEls && NumFields == NF) \
4616 return ScalableVecTyMap[K] = SingletonId;
4617#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4618 if (EltTy->isBooleanType() && NumElts == NumEls) \
4619 return ScalableVecTyMap[K] = SingletonId;
4620#include "clang/Basic/RISCVVTypes.def"
4635 llvm::FoldingSetNodeID ID;
4638 void *InsertPos =
nullptr;
4639 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4649 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4650 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4653 VectorType(vecType, NumElts, Canonical, VecKind);
4654 VectorTypes.InsertNode(
New, InsertPos);
4655 Types.push_back(
New);
4662 llvm::FoldingSetNodeID ID;
4665 void *InsertPos =
nullptr;
4667 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4672 VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
4675 if (CanonVecTy == VecType) {
4680 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4681 assert(!CanonCheck &&
4682 "Dependent-sized vector_size canonical type broken");
4684 DependentVectorTypes.InsertNode(
New, InsertPos);
4693 Types.push_back(
New);
4700 unsigned NumElts)
const {
4707 llvm::FoldingSetNodeID ID;
4710 void *InsertPos =
nullptr;
4711 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4721 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4722 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4726 VectorTypes.InsertNode(
New, InsertPos);
4727 Types.push_back(
New);
4735 llvm::FoldingSetNodeID ID;
4739 void *InsertPos =
nullptr;
4741 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4751 if (CanonVecTy == vecType) {
4756 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4757 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
4759 DependentSizedExtVectorTypes.InsertNode(
New, InsertPos);
4768 Types.push_back(
New);
4773 unsigned NumColumns)
const {
4774 llvm::FoldingSetNodeID ID;
4776 Type::ConstantMatrix);
4779 "need a valid element type");
4780 assert(NumRows > 0 && NumRows <= LangOpts.MaxMatrixDimension &&
4781 NumColumns > 0 && NumColumns <= LangOpts.MaxMatrixDimension &&
4782 "need valid matrix dimensions");
4783 void *InsertPos =
nullptr;
4793 assert(!NewIP &&
"Matrix type shouldn't already exist in the map");
4799 MatrixTypes.InsertNode(
New, InsertPos);
4800 Types.push_back(
New);
4809 llvm::FoldingSetNodeID ID;
4813 void *InsertPos =
nullptr;
4815 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4820 ColumnExpr, AttrLoc);
4823 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4824 assert(!CanonCheck &&
"Dependent-sized matrix canonical type broken");
4826 DependentSizedMatrixTypes.InsertNode(Canon, InsertPos);
4827 Types.push_back(Canon);
4840 ColumnExpr, AttrLoc);
4841 Types.push_back(
New);
4846 Expr *AddrSpaceExpr,
4852 void *insertPos =
nullptr;
4853 llvm::FoldingSetNodeID ID;
4858 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
4864 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
4865 Types.push_back(canonTy);
4868 if (canonPointeeType == PointeeType &&
4874 AddrSpaceExpr, AttrLoc);
4875 Types.push_back(sugaredType);
4881 return T.isCanonical() &&
4899 llvm::FoldingSetNodeID ID;
4902 void *InsertPos =
nullptr;
4904 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
4914 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4915 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4920 Types.push_back(
New);
4921 FunctionNoProtoTypes.InsertNode(
New, InsertPos);
4937 return CanResultType;
4944 if (!NoexceptInType)
4961 bool AnyPackExpansions =
false;
4965 if (ET->
getAs<PackExpansionType>())
4966 AnyPackExpansions =
true;
4968 return AnyPackExpansions;
4974QualType ASTContext::getFunctionTypeInternal(
4975 QualType ResultTy, ArrayRef<QualType> ArgArray,
4976 const FunctionProtoType::ExtProtoInfo &EPI,
bool OnlyWantCanonical)
const {
4977 size_t NumArgs = ArgArray.size();
4981 llvm::FoldingSetNodeID
ID;
4986 bool Unique =
false;
4988 void *InsertPos =
nullptr;
4989 if (FunctionProtoType *FPT =
4990 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4991 QualType Existing = QualType(FPT, 0);
5010 bool IsCanonicalExceptionSpec =
5014 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
5016 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
5017 if (!ArgArray[i].isCanonicalAsParam())
5018 isCanonical =
false;
5020 if (OnlyWantCanonical)
5021 assert(isCanonical &&
5022 "given non-canonical parameters constructing canonical type");
5027 if (!isCanonical && Canonical.
isNull()) {
5028 SmallVector<QualType, 16> CanonicalArgs;
5029 CanonicalArgs.reserve(NumArgs);
5030 for (
unsigned i = 0; i != NumArgs; ++i)
5033 llvm::SmallVector<QualType, 8> ExceptionTypeStorage;
5034 FunctionProtoType::ExtProtoInfo CanonicalEPI = EPI;
5037 if (IsCanonicalExceptionSpec) {
5039 }
else if (NoexceptInType) {
5052 bool AnyPacks =
false;
5054 if (ET->
getAs<PackExpansionType>())
5075 llvm_unreachable(
"dependent noexcept is already canonical");
5078 CanonicalEPI.
ExceptionSpec = FunctionProtoType::ExceptionSpecInfo();
5084 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
5087 FunctionProtoType *NewIP =
5088 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
5089 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
5094 auto ESH = FunctionProtoType::getExceptionSpecSize(
5096 size_t Size = FunctionProtoType::totalSizeToAlloc<
5097 QualType, SourceLocation, FunctionType::FunctionTypeExtraBitfields,
5098 FunctionType::FunctionTypeExtraAttributeInfo,
5099 FunctionType::FunctionTypeArmAttributes, FunctionType::ExceptionType,
5100 Expr *, FunctionDecl *, FunctionProtoType::ExtParameterInfo, Qualifiers,
5101 FunctionEffect, EffectConditionExpr>(
5105 ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
5110 auto *FTP = (FunctionProtoType *)
Allocate(Size,
alignof(FunctionProtoType));
5111 FunctionProtoType::ExtProtoInfo newEPI = EPI;
5112 new (FTP) FunctionProtoType(ResultTy, ArgArray, Canonical, newEPI);
5113 Types.push_back(FTP);
5115 FunctionProtoTypes.InsertNode(FTP, InsertPos);
5117 AnyFunctionEffects =
true;
5118 return QualType(FTP, 0);
5121QualType ASTContext::getPipeType(QualType T,
bool ReadOnly)
const {
5122 llvm::FoldingSetNodeID
ID;
5125 void *InsertPos =
nullptr;
5126 if (PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
5127 return QualType(PT, 0);
5136 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
5137 assert(!NewIP &&
"Shouldn't be in the map!");
5140 auto *
New =
new (*
this,
alignof(PipeType)) PipeType(T, Canonical, ReadOnly);
5141 Types.push_back(
New);
5142 PipeTypes.InsertNode(
New, InsertPos);
5143 return QualType(
New, 0);
5153 return getPipeType(T,
true);
5157 return getPipeType(T,
false);
5161 llvm::FoldingSetNodeID ID;
5164 void *InsertPos =
nullptr;
5165 if (
BitIntType *EIT = BitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
5169 BitIntTypes.InsertNode(
New, InsertPos);
5170 Types.push_back(
New);
5175 Expr *NumBitsExpr)
const {
5177 llvm::FoldingSetNodeID ID;
5180 void *InsertPos =
nullptr;
5182 DependentBitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
5187 DependentBitIntTypes.InsertNode(
New, InsertPos);
5189 Types.push_back(
New);
5197 if (
auto *Target = PredefinedSugarTypes[llvm::to_underlying(KD)];
5209 return Ctx.getFromTargetType(Ctx.Target->
getSizeType());
5210 case Kind::SignedSizeT:
5212 case Kind::PtrdiffT:
5215 llvm_unreachable(
"unexpected kind");
5220 Types.push_back(
New);
5221 PredefinedSugarTypes[llvm::to_underlying(KD)] =
New;
5228 if (
auto *Tag = dyn_cast<TagDecl>(
Decl))
5231 if (
auto *
Typedef = dyn_cast<TypedefNameDecl>(
Decl))
5233 if (
auto *UD = dyn_cast<UnresolvedUsingTypenameDecl>(
Decl))
5242 if (
auto *Tag = dyn_cast<TagDecl>(TD))
5244 if (
auto *TN = dyn_cast<TypedefNameDecl>(TD))
5246 if (
const auto *UD = dyn_cast<UnresolvedUsingTypenameDecl>(TD))
5248 assert(TD->TypeForDecl);
5253 if (
const auto *TD = dyn_cast<TagDecl>(
Decl))
5255 if (
const auto *TD = dyn_cast<TypedefNameDecl>(
Decl);
5256 isa_and_nonnull<TypedefDecl, TypeAliasDecl>(TD))
5259 if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(
Decl))
5262 assert(
Decl->TypeForDecl);
5272 std::optional<bool> TypeMatchesDeclOrNone)
const {
5273 if (!TypeMatchesDeclOrNone) {
5274 QualType DeclUnderlyingType =
Decl->getUnderlyingType();
5275 assert(!DeclUnderlyingType.
isNull());
5276 if (UnderlyingType.
isNull())
5277 UnderlyingType = DeclUnderlyingType;
5279 assert(
hasSameType(UnderlyingType, DeclUnderlyingType));
5280 TypeMatchesDeclOrNone = UnderlyingType == DeclUnderlyingType;
5284 assert(!UnderlyingType.
isNull());
5288 *TypeMatchesDeclOrNone) {
5289 if (
Decl->TypeForDecl)
5294 !*TypeMatchesDeclOrNone);
5296 Types.push_back(NewType);
5297 Decl->TypeForDecl = NewType;
5301 llvm::FoldingSetNodeID ID;
5303 *TypeMatchesDeclOrNone ?
QualType() : UnderlyingType);
5305 void *InsertPos =
nullptr;
5307 TypedefTypes.FindNodeOrInsertPos(ID, InsertPos))
5308 return QualType(Placeholder->getType(), 0);
5313 1, !!Qualifier, !*TypeMatchesDeclOrNone),
5317 UnderlyingType, !*TypeMatchesDeclOrNone);
5318 auto *Placeholder =
new (NewType->getFoldingSetPlaceholder())
5320 TypedefTypes.InsertNode(Placeholder, InsertPos);
5321 Types.push_back(NewType);
5330 if (UnderlyingType.
isNull()) {
5338 llvm::FoldingSetNodeID ID;
5341 void *InsertPos =
nullptr;
5342 if (
const UsingType *T = UsingTypes.FindNodeOrInsertPos(ID, InsertPos))
5352 Allocate(UsingType::totalSizeToAlloc<NestedNameSpecifier>(!!Qualifier),
5356 UsingTypes.InsertNode(T, InsertPos);
5362 const TagDecl *TD,
bool OwnsTag,
5364 const Type *CanonicalType,
5365 bool WithFoldingSetNode)
const {
5366 auto [TC, Size] = [&] {
5369 static_assert(
alignof(EnumType) ==
alignof(TagType));
5370 return std::make_tuple(Type::Enum,
sizeof(EnumType));
5371 case Decl::ClassTemplatePartialSpecialization:
5372 case Decl::ClassTemplateSpecialization:
5373 case Decl::CXXRecord:
5374 static_assert(
alignof(RecordType) ==
alignof(TagType));
5375 static_assert(
alignof(InjectedClassNameType) ==
alignof(TagType));
5377 return std::make_tuple(Type::InjectedClassName,
5378 sizeof(InjectedClassNameType));
5381 return std::make_tuple(Type::Record,
sizeof(RecordType));
5383 llvm_unreachable(
"unexpected decl kind");
5393 if (WithFoldingSetNode) {
5401 sizeof(TagTypeFoldingSetPlaceholder) +
5402 TagTypeFoldingSetPlaceholder::getOffset() + Size,
5403 std::max(
alignof(TagTypeFoldingSetPlaceholder),
alignof(TagType)));
5404 auto *T =
new (Mem) TagTypeFoldingSetPlaceholder();
5405 Mem = T->getTagType();
5407 Mem =
Allocate(Size,
alignof(TagType));
5410 auto *T = [&, TC = TC]() -> TagType * {
5414 auto *T =
new (Mem) EnumType(TC,
Keyword, Qualifier, TD, OwnsTag,
5415 IsInjected, CanonicalType);
5416 assert(
reinterpret_cast<void *
>(T) ==
5417 reinterpret_cast<void *
>(
static_cast<TagType *
>(T)) &&
5418 "TagType must be the first base of EnumType");
5421 case Type::Record: {
5423 auto *T =
new (Mem) RecordType(TC,
Keyword, Qualifier, TD, OwnsTag,
5424 IsInjected, CanonicalType);
5425 assert(
reinterpret_cast<void *
>(T) ==
5426 reinterpret_cast<void *
>(
static_cast<TagType *
>(T)) &&
5427 "TagType must be the first base of RecordType");
5430 case Type::InjectedClassName: {
5431 auto *T =
new (Mem) InjectedClassNameType(
Keyword, Qualifier, TD,
5432 IsInjected, CanonicalType);
5433 assert(
reinterpret_cast<void *
>(T) ==
5434 reinterpret_cast<void *
>(
static_cast<TagType *
>(T)) &&
5435 "TagType must be the first base of InjectedClassNameType");
5439 llvm_unreachable(
"unexpected type class");
5442 assert(T->getKeyword() ==
Keyword);
5443 assert(T->getQualifier() == Qualifier);
5444 assert(T->getDecl() == TD);
5445 assert(T->isInjected() == IsInjected);
5446 assert(T->isTagOwned() == OwnsTag);
5455 if (
const auto *RD = dyn_cast<CXXRecordDecl>(TD);
5456 RD && RD->isInjectedClassName())
5463 if (TD->TypeForDecl)
5464 return TD->TypeForDecl->getCanonicalTypeUnqualified();
5466 const Type *CanonicalType = getTagTypeInternal(
5469 false,
false,
nullptr,
5471 TD->TypeForDecl = CanonicalType;
5477 const TagDecl *TD,
bool OwnsTag)
const {
5480 bool IsInjected = TD != NonInjectedTD;
5487 if (
Keyword == PreferredKeyword && !Qualifier && !OwnsTag) {
5488 if (
const Type *T = TD->TypeForDecl; T && !T->isCanonicalUnqualified())
5494 std::nullopt, NonInjectedTD,
5495 false, IsInjected, CanonicalType,
5497 TD->TypeForDecl = T;
5501 llvm::FoldingSetNodeID ID;
5502 TagTypeFoldingSetPlaceholder::Profile(ID,
Keyword, Qualifier, NonInjectedTD,
5503 OwnsTag, IsInjected);
5505 void *InsertPos =
nullptr;
5506 if (TagTypeFoldingSetPlaceholder *T =
5507 TagTypes.FindNodeOrInsertPos(ID, InsertPos))
5508 return QualType(T->getTagType(), 0);
5512 getTagTypeInternal(
Keyword, Qualifier, NonInjectedTD, OwnsTag, IsInjected,
5513 CanonicalType,
true);
5514 TagTypes.InsertNode(TagTypeFoldingSetPlaceholder::fromTagType(T), InsertPos);
5519 unsigned NumPositiveBits,
5522 unsigned IntWidth = Target->getIntWidth();
5523 unsigned CharWidth = Target->getCharWidth();
5524 unsigned ShortWidth = Target->getShortWidth();
5525 bool EnumTooLarge =
false;
5527 if (NumNegativeBits) {
5531 if (IsPacked && NumNegativeBits <= CharWidth &&
5532 NumPositiveBits < CharWidth) {
5534 BestWidth = CharWidth;
5535 }
else if (IsPacked && NumNegativeBits <= ShortWidth &&
5536 NumPositiveBits < ShortWidth) {
5538 BestWidth = ShortWidth;
5539 }
else if (NumNegativeBits <= IntWidth && NumPositiveBits < IntWidth) {
5541 BestWidth = IntWidth;
5543 BestWidth = Target->getLongWidth();
5545 if (NumNegativeBits <= BestWidth && NumPositiveBits < BestWidth) {
5548 BestWidth = Target->getLongLongWidth();
5550 if (NumNegativeBits > BestWidth || NumPositiveBits >= BestWidth)
5551 EnumTooLarge =
true;
5555 BestPromotionType = (BestWidth <= IntWidth ?
IntTy : BestType);
5560 if (IsPacked && NumPositiveBits <= CharWidth) {
5562 BestPromotionType =
IntTy;
5563 BestWidth = CharWidth;
5564 }
else if (IsPacked && NumPositiveBits <= ShortWidth) {
5566 BestPromotionType =
IntTy;
5567 BestWidth = ShortWidth;
5568 }
else if (NumPositiveBits <= IntWidth) {
5570 BestWidth = IntWidth;
5571 BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5574 }
else if (NumPositiveBits <= (BestWidth = Target->getLongWidth())) {
5576 BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5580 BestWidth = Target->getLongLongWidth();
5581 if (NumPositiveBits > BestWidth) {
5586 EnumTooLarge =
true;
5589 BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5594 return EnumTooLarge;
5598 assert((T->isIntegralType(*
this) || T->isEnumeralType()) &&
5599 "Integral type required!");
5602 if (
Value.isUnsigned() ||
Value.isNonNegative()) {
5603 if (T->isSignedIntegerOrEnumerationType())
5605 return Value.getActiveBits() <= BitWidth;
5607 return Value.getSignificantBits() <= BitWidth;
5613 const Type *CanonicalType)
const {
5615 UnresolvedUsingType::totalSizeToAlloc<
5617 !!InsertPos, !!Qualifier),
5621 auto *Placeholder =
new (T->getFoldingSetPlaceholder())
5623 TypedefTypes.InsertNode(Placeholder, InsertPos);
5633 return D->TypeForDecl->getCanonicalTypeUnqualified();
5635 const Type *CanonicalType = getUnresolvedUsingTypeInternal(
5639 D->TypeForDecl = CanonicalType;
5648 if (
const Type *T = D->TypeForDecl; T && !T->isCanonicalUnqualified())
5655 nullptr, CanonicalType);
5660 llvm::FoldingSetNodeID ID;
5663 void *InsertPos =
nullptr;
5665 UnresolvedUsingTypes.FindNodeOrInsertPos(ID, InsertPos))
5666 return QualType(Placeholder->getType(), 0);
5670 const Type *T = getUnresolvedUsingTypeInternal(
Keyword, Qualifier, D,
5671 InsertPos, CanonicalType);
5679 llvm::FoldingSetNodeID id;
5680 AttributedType::Profile(
id, attrKind, modifiedType, equivalentType,
attr);
5682 void *insertPos =
nullptr;
5683 AttributedType *
type = AttributedTypes.FindNodeOrInsertPos(
id, insertPos);
5686 assert(!
attr ||
attr->getKind() == attrKind);
5689 type =
new (*
this,
alignof(AttributedType))
5690 AttributedType(canon, attrKind,
attr, modifiedType, equivalentType);
5692 Types.push_back(
type);
5693 AttributedTypes.InsertNode(
type, insertPos);
5706 switch (nullability) {
5722 llvm_unreachable(
"Unknown nullability kind");
5727 llvm::FoldingSetNodeID ID;
5728 BTFTagAttributedType::Profile(ID, Wrapped, BTFAttr);
5730 void *InsertPos =
nullptr;
5731 BTFTagAttributedType *Ty =
5732 BTFTagAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
5737 Ty =
new (*
this,
alignof(BTFTagAttributedType))
5738 BTFTagAttributedType(Canon, Wrapped, BTFAttr);
5740 Types.push_back(Ty);
5741 BTFTagAttributedTypes.InsertNode(Ty, InsertPos);
5749 StringRef IdentName = II->
getName();
5750 OverflowBehaviorType::OverflowBehaviorKind Kind;
5751 if (IdentName ==
"wrap") {
5752 Kind = OverflowBehaviorType::OverflowBehaviorKind::Wrap;
5753 }
else if (IdentName ==
"trap") {
5754 Kind = OverflowBehaviorType::OverflowBehaviorKind::Trap;
5763 OverflowBehaviorType::OverflowBehaviorKind Kind,
5766 "Cannot have underlying types that are themselves OBTs");
5767 llvm::FoldingSetNodeID ID;
5768 OverflowBehaviorType::Profile(ID, Underlying, Kind);
5769 void *InsertPos =
nullptr;
5771 if (OverflowBehaviorType *OBT =
5772 OverflowBehaviorTypes.FindNodeOrInsertPos(ID, InsertPos)) {
5781 assert(!OverflowBehaviorTypes.FindNodeOrInsertPos(ID, InsertPos) &&
5782 "Shouldn't be in the map");
5785 OverflowBehaviorType *Ty =
new (*
this,
alignof(OverflowBehaviorType))
5786 OverflowBehaviorType(Canonical, Underlying, Kind);
5788 Types.push_back(Ty);
5789 OverflowBehaviorTypes.InsertNode(Ty, InsertPos);
5795 const HLSLAttributedResourceType::Attributes &Attrs) {
5797 llvm::FoldingSetNodeID ID;
5798 HLSLAttributedResourceType::Profile(ID, Wrapped, Contained, Attrs);
5800 void *InsertPos =
nullptr;
5801 HLSLAttributedResourceType *Ty =
5802 HLSLAttributedResourceTypes.FindNodeOrInsertPos(ID, InsertPos);
5806 Ty =
new (*
this,
alignof(HLSLAttributedResourceType))
5807 HLSLAttributedResourceType(Wrapped, Contained, Attrs);
5809 Types.push_back(Ty);
5810 HLSLAttributedResourceTypes.InsertNode(Ty, InsertPos);
5818 llvm::FoldingSetNodeID ID;
5819 HLSLInlineSpirvType::Profile(ID, Opcode, Size, Alignment, Operands);
5821 void *InsertPos =
nullptr;
5822 HLSLInlineSpirvType *Ty =
5823 HLSLInlineSpirvTypes.FindNodeOrInsertPos(ID, InsertPos);
5828 HLSLInlineSpirvType::totalSizeToAlloc<SpirvOperand>(Operands.size()),
5829 alignof(HLSLInlineSpirvType));
5831 Ty =
new (Mem) HLSLInlineSpirvType(Opcode, Size, Alignment, Operands);
5833 Types.push_back(Ty);
5834 HLSLInlineSpirvTypes.InsertNode(Ty, InsertPos);
5841 Decl *AssociatedDecl,
5845 llvm::FoldingSetNodeID ID;
5846 SubstTemplateTypeParmType::Profile(ID, Replacement, AssociatedDecl, Index,
5848 void *InsertPos =
nullptr;
5849 SubstTemplateTypeParmType *SubstParm =
5850 SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5853 void *Mem =
Allocate(SubstTemplateTypeParmType::totalSizeToAlloc<QualType>(
5854 !Replacement.isCanonical()),
5855 alignof(SubstTemplateTypeParmType));
5856 SubstParm =
new (Mem) SubstTemplateTypeParmType(Replacement, AssociatedDecl,
5857 Index, PackIndex, Final);
5858 Types.push_back(SubstParm);
5859 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
5867 unsigned Index,
bool Final,
5874 llvm::FoldingSetNodeID ID;
5875 SubstTemplateTypeParmPackType::Profile(ID, AssociatedDecl, Index, Final,
5877 void *InsertPos =
nullptr;
5878 if (SubstTemplateTypeParmPackType *SubstParm =
5879 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
5889 [[maybe_unused]]
const auto *Nothing =
5890 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
5895 auto *SubstParm =
new (*
this,
alignof(SubstTemplateTypeParmPackType))
5896 SubstTemplateTypeParmPackType(Canon, AssociatedDecl, Index, Final,
5898 Types.push_back(SubstParm);
5899 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
5907 return P.getKind() == TemplateArgument::Type;
5909 "Pack contains a non-type");
5911 llvm::FoldingSetNodeID ID;
5912 SubstBuiltinTemplatePackType::Profile(ID, ArgPack);
5914 void *InsertPos =
nullptr;
5916 SubstBuiltinTemplatePackTypes.FindNodeOrInsertPos(ID, InsertPos))
5925 [[maybe_unused]]
const auto *Nothing =
5926 SubstBuiltinTemplatePackTypes.FindNodeOrInsertPos(ID, InsertPos);
5930 auto *PackType =
new (*
this,
alignof(SubstBuiltinTemplatePackType))
5931 SubstBuiltinTemplatePackType(Canon, ArgPack);
5932 Types.push_back(PackType);
5933 SubstBuiltinTemplatePackTypes.InsertNode(PackType, InsertPos);
5943 llvm::FoldingSetNodeID ID;
5944 TemplateTypeParmType::Profile(ID, Depth, Index, ParameterPack, TTPDecl);
5945 void *InsertPos =
nullptr;
5946 TemplateTypeParmType *TypeParm
5947 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5954 TypeParm =
new (*
this,
alignof(TemplateTypeParmType))
5955 TemplateTypeParmType(Depth, Index, ParameterPack, TTPDecl, Canon);
5957 TemplateTypeParmType *TypeCheck
5958 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5959 assert(!TypeCheck &&
"Template type parameter canonical type broken");
5962 TypeParm =
new (*
this,
alignof(TemplateTypeParmType)) TemplateTypeParmType(
5963 Depth, Index, ParameterPack,
nullptr,
QualType());
5965 Types.push_back(TypeParm);
5966 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
5992 llvm_unreachable(
"unexpected keyword kind");
6006 ElaboratedKeywordLoc, QualifierLoc, TemplateKeywordLoc, NameLoc,
6016 SpecifiedArgVec.reserve(SpecifiedArgs.size());
6018 SpecifiedArgVec.push_back(Arg.getArgument());
6021 CanonicalArgs, Underlying);
6024[[maybe_unused]]
static bool
6027 if (Arg.isPackExpansion())
6038 Template.getAsDependentTemplateName()));
6040 for (
const auto &Arg : Args)
6044 llvm::FoldingSetNodeID ID;
6047 void *InsertPos =
nullptr;
6048 if (
auto *T = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
6051 void *Mem =
Allocate(
sizeof(TemplateSpecializationType) +
6053 alignof(TemplateSpecializationType));
6057 assert(Spec->isDependentType() &&
6058 "canonical template specialization must be dependent");
6059 Types.push_back(Spec);
6060 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
6068 const auto *TD =
Template.getAsTemplateDecl(
true);
6069 bool IsTypeAlias = TD && TD->isTypeAlias();
6070 if (Underlying.
isNull()) {
6077 bool NonCanonical =
Template != CanonTemplate ||
Keyword != CanonKeyword;
6079 if (CanonicalArgs.empty()) {
6082 CanonicalArgs = CanonArgsVec;
6084 NonCanonical |= !llvm::equal(
6085 SpecifiedArgs, CanonicalArgs,
6094 assert((!isa_and_nonnull<TypeAliasTemplateDecl>(TD) ||
6096 "Caller must compute aliased type");
6097 IsTypeAlias =
false;
6100 CanonKeyword, CanonTemplate, CanonicalArgs);
6104 void *Mem =
Allocate(
sizeof(TemplateSpecializationType) +
6106 (IsTypeAlias ?
sizeof(
QualType) : 0),
6107 alignof(TemplateSpecializationType));
6108 auto *Spec =
new (Mem) TemplateSpecializationType(
6110 Types.push_back(Spec);
6116 llvm::FoldingSetNodeID ID;
6119 void *InsertPos =
nullptr;
6120 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
6127 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
6128 assert(!CheckT &&
"Paren canonical type broken");
6134 ParenTypes.InsertNode(T, InsertPos);
6147 Types.push_back(newType);
6154 llvm::FoldingSetNodeID ID;
6155 DependentNameType::Profile(ID,
Keyword, NNS, Name);
6157 void *InsertPos =
nullptr;
6158 if (DependentNameType *T =
6159 DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos))
6167 if (CanonKeyword !=
Keyword || CanonNNS != NNS) {
6169 [[maybe_unused]] DependentNameType *T =
6170 DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
6171 assert(!T &&
"broken canonicalization");
6175 DependentNameType *T =
new (*
this,
alignof(DependentNameType))
6176 DependentNameType(
Keyword, NNS, Name, Canon);
6178 DependentNameTypes.InsertNode(T, InsertPos);
6184 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
6186 if (TTP->isParameterPack())
6190 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
6192 NTTP->getType().getNonPackExpansionType().getNonLValueExprType(*
this);
6198 if (T->isRecordType()) {
6207 Expr *E =
new (*this)
6209 T,
VK, NTTP->getLocation());
6211 if (NTTP->isParameterPack())
6217 std::nullopt,
false,
6219 if (TTP->isParameterPack())
6225 if (Param->isTemplateParameterPack())
6234 bool ExpectPackInType)
const {
6236 "Pack expansions must expand one or more parameter packs");
6238 llvm::FoldingSetNodeID ID;
6239 PackExpansionType::Profile(ID, Pattern, NumExpansions);
6241 void *InsertPos =
nullptr;
6242 PackExpansionType *T = PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
6253 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
6256 T =
new (*
this,
alignof(PackExpansionType))
6257 PackExpansionType(Pattern, Canon, NumExpansions);
6259 PackExpansionTypes.InsertNode(T, InsertPos);
6271 if (Protocols.empty())
return true;
6276 for (
unsigned i = 1; i != Protocols.size(); ++i)
6286 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
6290 P = P->getCanonicalDecl();
6293 auto ProtocolsEnd = llvm::unique(Protocols);
6294 Protocols.erase(ProtocolsEnd, Protocols.end());
6299 unsigned NumProtocols)
const {
6308 bool isKindOf)
const {
6311 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
6316 llvm::FoldingSetNodeID ID;
6317 ObjCObjectTypeImpl::Profile(ID, baseType, typeArgs, protocols, isKindOf);
6318 void *InsertPos =
nullptr;
6319 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
6326 if (effectiveTypeArgs.empty()) {
6328 effectiveTypeArgs = baseObject->getTypeArgs();
6335 bool typeArgsAreCanonical = llvm::all_of(
6338 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
6342 if (!typeArgsAreCanonical) {
6343 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
6344 for (
auto typeArg : effectiveTypeArgs)
6346 canonTypeArgs = canonTypeArgsVec;
6348 canonTypeArgs = effectiveTypeArgs;
6353 if (!protocolsSorted) {
6354 canonProtocolsVec.append(protocols.begin(), protocols.end());
6356 canonProtocols = canonProtocolsVec;
6358 canonProtocols = protocols;
6362 canonProtocols, isKindOf);
6365 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
6368 unsigned size =
sizeof(ObjCObjectTypeImpl);
6369 size += typeArgs.size() *
sizeof(
QualType);
6371 void *mem =
Allocate(size,
alignof(ObjCObjectTypeImpl));
6373 new (mem) ObjCObjectTypeImpl(canonical, baseType, typeArgs, protocols,
6377 ObjCObjectTypes.InsertNode(T, InsertPos);
6387 bool allowOnPointerType)
const {
6390 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(
type.getTypePtr())) {
6395 if (allowOnPointerType) {
6396 if (
const auto *objPtr =
6397 dyn_cast<ObjCObjectPointerType>(
type.getTypePtr())) {
6401 protocolsVec.append(objT->qual_begin(),
6403 protocolsVec.append(protocols.begin(), protocols.end());
6406 objT->getBaseType(),
6407 objT->getTypeArgsAsWritten(),
6409 objT->isKindOfTypeAsWritten());
6415 if (
const auto *objT = dyn_cast<ObjCObjectType>(
type.getTypePtr())){
6420 objT->getTypeArgsAsWritten(),
6422 objT->isKindOfTypeAsWritten());
6426 if (
type->isObjCObjectType()) {
6436 if (
type->isObjCIdType()) {
6439 objPtr->isKindOfType());
6444 if (
type->isObjCClassType()) {
6447 objPtr->isKindOfType());
6459 llvm::FoldingSetNodeID ID;
6460 ObjCTypeParamType::Profile(ID,
Decl,
Decl->getUnderlyingType(), protocols);
6461 void *InsertPos =
nullptr;
6462 if (ObjCTypeParamType *TypeParam =
6463 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
6468 if (!protocols.empty()) {
6472 Canonical, protocols, hasError,
true ));
6473 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
6476 unsigned size =
sizeof(ObjCTypeParamType);
6478 void *mem =
Allocate(size,
alignof(ObjCTypeParamType));
6479 auto *newType =
new (mem) ObjCTypeParamType(
Decl, Canonical, protocols);
6481 Types.push_back(newType);
6482 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
6492 protocols.append(NewTypeParamTy->qual_begin(), NewTypeParamTy->qual_end());
6507 for (
auto *Proto : OPT->quals()) {
6530 if (InheritedProtocols.empty())
6534 bool Conforms =
false;
6535 for (
auto *Proto : OPT->quals()) {
6537 for (
auto *PI : InheritedProtocols) {
6549 for (
auto *PI : InheritedProtocols) {
6551 bool Adopts =
false;
6552 for (
auto *Proto : OPT->quals()) {
6566 llvm::FoldingSetNodeID ID;
6569 void *InsertPos =
nullptr;
6571 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
6580 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
6589 Types.push_back(QType);
6590 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
6598 if (
Decl->TypeForDecl)
6602 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
6603 Decl->TypeForDecl = PrevDecl->TypeForDecl;
6604 return QualType(PrevDecl->TypeForDecl, 0);
6613 Decl->TypeForDecl = T;
6626 llvm::FoldingSetNodeID ID;
6630 void *InsertPos =
nullptr;
6632 DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
6642 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
6650 Types.push_back(toe);
6661 auto *tot =
new (*
this,
alignof(TypeOfType))
6662 TypeOfType(*
this, tofType, Canonical, Kind);
6663 Types.push_back(tot);
6687 llvm_unreachable(
"Unknown value kind");
6702 }
else if (!UnderlyingType.
isNull()) {
6705 llvm::FoldingSetNodeID ID;
6706 DependentDecltypeType::Profile(ID, *
this, E);
6708 void *InsertPos =
nullptr;
6709 if (DependentDecltypeType *Canon =
6710 DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos))
6715 new (*
this,
alignof(DependentDecltypeType)) DependentDecltypeType(E);
6716 DependentDecltypeTypes.InsertNode(DT, InsertPos);
6717 Types.push_back(DT);
6720 auto *DT =
new (*
this,
alignof(DecltypeType))
6721 DecltypeType(E, UnderlyingType, CanonType);
6722 Types.push_back(DT);
6727 bool FullySubstituted,
6731 if (FullySubstituted && Index) {
6734 llvm::FoldingSetNodeID ID;
6735 PackIndexingType::Profile(ID, *
this, Pattern.
getCanonicalType(), IndexExpr,
6736 FullySubstituted, Expansions);
6737 void *InsertPos =
nullptr;
6738 PackIndexingType *Canon =
6739 DependentPackIndexingTypes.FindNodeOrInsertPos(ID, InsertPos);
6742 PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
6746 IndexExpr, FullySubstituted, Expansions);
6747 DependentPackIndexingTypes.InsertNode(Canon, InsertPos);
6753 Allocate(PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
6755 auto *T =
new (Mem) PackIndexingType(Canonical, Pattern, IndexExpr,
6756 FullySubstituted, Expansions);
6765 UnaryTransformType::UTTKind Kind)
const {
6767 llvm::FoldingSetNodeID ID;
6768 UnaryTransformType::Profile(ID, BaseType, UnderlyingType, Kind);
6770 void *InsertPos =
nullptr;
6771 if (UnaryTransformType *UT =
6772 UnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos))
6776 if (!BaseType->isDependentType()) {
6779 assert(UnderlyingType.
isNull() || BaseType == UnderlyingType);
6782 BaseType != CanonBase) {
6787 [[maybe_unused]] UnaryTransformType *UT =
6788 UnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
6789 assert(!UT &&
"broken canonicalization");
6793 auto *UT =
new (*
this,
alignof(UnaryTransformType))
6794 UnaryTransformType(BaseType, UnderlyingType, Kind, CanonType);
6795 UnaryTransformTypes.InsertNode(UT, InsertPos);
6796 Types.push_back(UT);
6809 !TypeConstraintConcept) {
6810 assert(DeducedAsType.
isNull() &&
"");
6811 assert(TypeConstraintArgs.empty() &&
"");
6816 llvm::FoldingSetNodeID ID;
6817 AutoType::Profile(ID, *
this, DK, DeducedAsType,
Keyword,
6818 TypeConstraintConcept, TypeConstraintArgs);
6819 if (
auto const AT_iter = AutoTypes.find(ID); AT_iter != AutoTypes.end())
6820 return QualType(AT_iter->getSecond(), 0);
6823 assert(!DeducedAsType.
isNull() &&
"deduced type must be provided");
6825 assert(DeducedAsType.
isNull() &&
"deduced type must not be provided");
6826 if (TypeConstraintConcept) {
6827 bool AnyNonCanonArgs =
false;
6828 auto *CanonicalConcept =
6831 *
this, TypeConstraintArgs, AnyNonCanonArgs);
6832 if (TypeConstraintConcept != CanonicalConcept || AnyNonCanonArgs)
6834 CanonicalConceptArgs);
6838 void *Mem =
Allocate(
sizeof(AutoType) +
6841 auto *AT =
new (Mem) AutoType(DK, DeducedAsType,
Keyword,
6842 TypeConstraintConcept, TypeConstraintArgs);
6844 llvm::FoldingSetNodeID InsertedID;
6845 AT->Profile(InsertedID, *
this);
6846 assert(InsertedID == ID &&
"ID does not match");
6848 Types.push_back(AT);
6849 AutoTypes.try_emplace(ID, AT);
6857 if (
auto *AT = CanonT->
getAs<AutoType>()) {
6858 if (!AT->isConstrained())
6882 "unexpected DeducedAsPack for DeducedTemplateSpecializationType");
6885 void *InsertPos =
nullptr;
6886 llvm::FoldingSetNodeID ID;
6887 DeducedTemplateSpecializationType::Profile(ID, DK, DeducedAsType,
Keyword,
6889 if (DeducedTemplateSpecializationType *DTST =
6890 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
6894 assert(!DeducedAsType.
isNull() &&
"deduced type must be provided");
6896 assert(DeducedAsType.
isNull() &&
"deduced type must not be provided");
6905 [[maybe_unused]] DeducedTemplateSpecializationType *DTST =
6906 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
6907 assert(!DTST &&
"broken canonicalization");
6911 auto *DTST =
new (*
this,
alignof(DeducedTemplateSpecializationType))
6912 DeducedTemplateSpecializationType(DK, DeducedAsType,
Keyword,
Template);
6915 llvm::FoldingSetNodeID TempID;
6916 DTST->Profile(TempID);
6917 assert(ID == TempID &&
"ID does not match");
6919 Types.push_back(DTST);
6920 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
6929 llvm::FoldingSetNodeID ID;
6932 void *InsertPos =
nullptr;
6933 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
6939 if (!T.isCanonical()) {
6943 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
6944 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
6947 Types.push_back(
New);
6948 AtomicTypes.InsertNode(
New, InsertPos);
6980 return getFromTargetType(Target->getSizeType());
6999 return getFromTargetType(Target->getUnsignedPtrDiffType(
LangAS::Default));
7004 return getFromTargetType(Target->getIntMaxType());
7009 return getFromTargetType(Target->getUIntMaxType());
7027 return getFromTargetType(Target->getIntPtrType());
7037 return getFromTargetType(Target->getProcessIDType());
7049 const Type *Ty = T.getTypePtr();
7077 quals = splitType.
Quals;
7082 QualType elementType = AT->getElementType();
7087 if (elementType == unqualElementType) {
7088 assert(quals.
empty());
7089 quals = splitType.
Quals;
7097 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
7099 CAT->getSizeExpr(), CAT->getSizeModifier(), 0);
7102 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
7106 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
7108 VAT->getSizeModifier(),
7109 VAT->getIndexTypeCVRQualifiers());
7114 DSAT->getSizeModifier(), 0);
7124 bool AllowPiMismatch)
const {
7139 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
7140 auto *CAT2 = dyn_cast<ConstantArrayType>(AT2);
7141 if (!((CAT2 && CAT1->getSize() == CAT2->getSize()) ||
7154 T1 = AT1->getElementType();
7155 T2 = AT2->getElementType();
7175 bool AllowPiMismatch)
const {
7180 if (T1PtrType && T2PtrType) {
7188 T1MPType && T2MPType) {
7189 if (
auto *RD1 = T1MPType->getMostRecentCXXRecordDecl(),
7190 *RD2 = T2MPType->getMostRecentCXXRecordDecl();
7191 RD1 != RD2 && RD1->getCanonicalDecl() != RD2->getCanonicalDecl())
7193 if (T1MPType->getQualifier().getCanonical() !=
7194 T2MPType->getQualifier().getCanonical())
7204 if (T1OPType && T2OPType) {
7236 if (Quals1 != Quals2)
7306 llvm_unreachable(
"bad template name kind!");
7312 if (!TP->hasDefaultArgument())
7314 return &TP->getDefaultArgument().getArgument();
7317 case NamedDecl::TemplateTypeParm:
7319 case NamedDecl::NonTypeTemplateParm:
7321 case NamedDecl::TemplateTemplateParm:
7324 llvm_unreachable(
"Unexpected template parameter kind");
7329 bool IgnoreDeduced)
const {
7330 while (std::optional<TemplateName> UnderlyingOrNone =
7332 Name = *UnderlyingOrNone;
7337 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(
Template))
7349 llvm_unreachable(
"cannot canonicalize overloaded template");
7353 assert(DTN &&
"Non-dependent template names must refer to template decls.");
7372 assert(IgnoreDeduced ==
false);
7379 bool NonCanonical = CanonUnderlying != Underlying;
7385 assert(CanonArgs.size() <= Params.size());
7391 for (
int I = CanonArgs.size() - 1; I >= 0; --I) {
7400 if (I ==
int(CanonArgs.size() - 1))
7401 CanonArgs.pop_back();
7402 NonCanonical =
true;
7412 llvm_unreachable(
"always sugar node");
7415 llvm_unreachable(
"bad template name!");
7420 bool IgnoreDeduced)
const {
7441 llvm::FoldingSetNodeID XCEID, YCEID;
7442 XCE->
Profile(XCEID, *
this,
true,
true);
7443 YCE->
Profile(YCEID, *
this,
true,
true);
7444 return XCEID == YCEID;
7493 if (
auto *TX = dyn_cast<TemplateTypeParmDecl>(
X)) {
7495 if (TX->isParameterPack() != TY->isParameterPack())
7497 if (TX->hasTypeConstraint() != TY->hasTypeConstraint())
7500 TY->getTypeConstraint());
7503 if (
auto *TX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
7505 return TX->isParameterPack() == TY->isParameterPack() &&
7506 TX->getASTContext().hasSameType(TX->getType(), TY->getType()) &&
7508 TY->getPlaceholderTypeConstraint());
7513 return TX->isParameterPack() == TY->isParameterPack() &&
7515 TY->getTemplateParameters());
7520 if (
X->size() != Y->
size())
7523 for (
unsigned I = 0, N =
X->size(); I != N; ++I)
7537 if (
auto *TTPX = dyn_cast<TemplateTypeParmDecl>(
X)) {
7539 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
7542 return hasSameType(TTPX->getDefaultArgument().getArgument().getAsType(),
7543 TTPY->getDefaultArgument().getArgument().getAsType());
7546 if (
auto *NTTPX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
7548 if (!NTTPX->hasDefaultArgument() || !NTTPY->hasDefaultArgument())
7551 Expr *DefaultArgumentX =
7552 NTTPX->getDefaultArgument().getArgument().getAsExpr()->
IgnoreImpCasts();
7553 Expr *DefaultArgumentY =
7554 NTTPY->getDefaultArgument().getArgument().getAsExpr()->
IgnoreImpCasts();
7555 llvm::FoldingSetNodeID XID, YID;
7556 DefaultArgumentX->
Profile(XID, *
this,
true);
7557 DefaultArgumentY->
Profile(YID, *
this,
true);
7564 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
7579 auto Kind =
X.getKind();
7587 auto [NamespaceX, PrefixX] =
X.getAsNamespaceAndPrefix();
7590 NamespaceY->getNamespace()))
7595 const auto *TX =
X.getAsType(), *TY = Y.
getAsType();
7596 if (TX->getCanonicalTypeInternal() != TY->getCanonicalTypeInternal())
7605 llvm_unreachable(
"unhandled qualifier kind");
7611 if (A->
hasAttr<CUDADeviceAttr>() != B->
hasAttr<CUDADeviceAttr>())
7613 if (A->
hasAttr<CUDADeviceAttr>() && B->
hasAttr<CUDADeviceAttr>())
7625 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
7629 for (
auto Pair : zip_longest(AEnableIfAttrs, BEnableIfAttrs)) {
7630 std::optional<EnableIfAttr *> Cand1A = std::get<0>(Pair);
7631 std::optional<EnableIfAttr *> Cand2A = std::get<1>(Pair);
7634 if (!Cand1A || !Cand2A)
7640 (*Cand1A)->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
7641 (*Cand2A)->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
7645 if (Cand1ID != Cand2ID)
7679 if (
const auto *TypedefX = dyn_cast<TypedefNameDecl>(
X))
7680 if (
const auto *TypedefY = dyn_cast<TypedefNameDecl>(Y))
7682 TypedefY->getUnderlyingType());
7699 if (
const auto *TagX = dyn_cast<TagDecl>(
X)) {
7701 return (TagX->getTagKind() == TagY->getTagKind()) ||
7713 if (
const auto *FuncX = dyn_cast<FunctionDecl>(
X)) {
7715 if (
const auto *CtorX = dyn_cast<CXXConstructorDecl>(
X)) {
7717 if (CtorX->getInheritedConstructor() &&
7718 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
7719 CtorY->getInheritedConstructor().getConstructor()))
7723 if (FuncX->isMultiVersion() != FuncY->isMultiVersion())
7728 if (FuncX->isMultiVersion()) {
7729 const auto *TAX = FuncX->getAttr<TargetAttr>();
7730 const auto *TAY = FuncY->getAttr<TargetAttr>();
7731 assert(TAX && TAY &&
"Multiversion Function without target attribute");
7733 if (TAX->getFeaturesStr() != TAY->getFeaturesStr())
7739 if ((FuncX->isMemberLikeConstrainedFriend() ||
7740 FuncY->isMemberLikeConstrainedFriend()) &&
7741 !FuncX->getLexicalDeclContext()->Equals(
7742 FuncY->getLexicalDeclContext())) {
7747 FuncY->getTrailingRequiresClause()))
7755 FD = FD->getCanonicalDecl();
7756 return FD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType()
7759 QualType XT = GetTypeAsWritten(FuncX), YT = GetTypeAsWritten(FuncY);
7774 return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() &&
7779 if (
const auto *VarX = dyn_cast<VarDecl>(
X)) {
7781 if (VarX->getLinkageInternal() == VarY->getLinkageInternal()) {
7784 if (VarX->getType().isNull() || VarY->getType().isNull())
7787 if (
hasSameType(VarX->getType(), VarY->getType()))
7797 if (!VarXTy || !VarYTy)
7806 if (
const auto *NamespaceX = dyn_cast<NamespaceDecl>(
X)) {
7808 return NamespaceX->isInline() == NamespaceY->isInline();
7813 if (
const auto *TemplateX = dyn_cast<TemplateDecl>(
X)) {
7817 if (
const auto *ConceptX = dyn_cast<ConceptDecl>(
X)) {
7820 ConceptY->getConstraintExpr()))
7825 TemplateY->getTemplatedDecl()) &&
7827 TemplateY->getTemplateParameters());
7831 if (
const auto *FDX = dyn_cast<FieldDecl>(
X)) {
7834 return hasSameType(FDX->getType(), FDY->getType());
7838 if (
const auto *IFDX = dyn_cast<IndirectFieldDecl>(
X)) {
7840 return IFDX->getAnonField()->getCanonicalDecl() ==
7841 IFDY->getAnonField()->getCanonicalDecl();
7850 if (
const auto *USX = dyn_cast<UsingShadowDecl>(
X)) {
7857 if (
const auto *UX = dyn_cast<UsingDecl>(
X)) {
7860 UX->hasTypename() == UY->hasTypename() &&
7861 UX->isAccessDeclaration() == UY->isAccessDeclaration();
7863 if (
const auto *UX = dyn_cast<UnresolvedUsingValueDecl>(
X)) {
7866 UX->isAccessDeclaration() == UY->isAccessDeclaration();
7868 if (
const auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(
X)) {
7876 if (
const auto *UX = dyn_cast<UsingPackDecl>(
X)) {
7878 UX->getInstantiatedFromUsingDecl(),
7883 if (
const auto *NAX = dyn_cast<NamespaceAliasDecl>(
X)) {
7885 return NAX->getNamespace()->Equals(NAY->getNamespace());
7933 bool AnyNonCanonArgs =
false;
7936 if (!AnyNonCanonArgs)
7946 llvm_unreachable(
"Unhandled template argument kind");
7956 llvm_unreachable(
"Comparing NULL template argument");
7981 llvm::FoldingSetNodeID ID1, ID2;
7991 return isSameTemplateArgument(Arg1, Arg2);
7995 llvm_unreachable(
"Unhandled template argument kind");
8000 if (!T.hasLocalQualifiers()) {
8002 if (
const auto *AT = dyn_cast<ArrayType>(T))
8022 const auto *ATy = dyn_cast<ArrayType>(split.
Ty);
8023 if (!ATy || qs.
empty())
8030 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
8033 CAT->getSizeModifier(),
8034 CAT->getIndexTypeCVRQualifiers()));
8035 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
8037 IAT->getSizeModifier(),
8038 IAT->getIndexTypeCVRQualifiers()));
8040 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
8042 NewEltTy, DSAT->getSizeExpr(), DSAT->getSizeModifier(),
8043 DSAT->getIndexTypeCVRQualifiers()));
8048 VAT->getIndexTypeCVRQualifiers()));
8056 if (T->isArrayType() || T->isFunctionType())
8064 return T.getUnqualifiedType();
8075 if (T->isArrayType() || T->isFunctionType())
8077 return T.getUnqualifiedType();
8092 assert(PrettyArrayType &&
"Not an array type!");
8129 uint64_t ElementCount = 1;
8132 CA = dyn_cast_or_null<ConstantArrayType>(
8135 return ElementCount;
8143 uint64_t ElementCount = 1;
8147 AILE = dyn_cast<ArrayInitLoopExpr>(AILE->
getSubExpr());
8150 return ElementCount;
8160 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
8162 case BuiltinType::Half:
return HalfRank;
8163 case BuiltinType::Float:
return FloatRank;
8196unsigned ASTContext::getIntegerRank(
const Type *T)
const {
8197 assert(T->isCanonicalUnqualified() &&
"T should be canonicalized");
8201 if (
const auto *EIT = dyn_cast<BitIntType>(T))
8202 return 0 + (EIT->getNumBits() << 3);
8204 if (
const auto *OBT = dyn_cast<OverflowBehaviorType>(T))
8205 return getIntegerRank(OBT->getUnderlyingType().getTypePtr());
8208 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
8209 case BuiltinType::Bool:
8211 case BuiltinType::Char_S:
8212 case BuiltinType::Char_U:
8213 case BuiltinType::SChar:
8214 case BuiltinType::UChar:
8216 case BuiltinType::Short:
8217 case BuiltinType::UShort:
8219 case BuiltinType::Int:
8220 case BuiltinType::UInt:
8222 case BuiltinType::Long:
8223 case BuiltinType::ULong:
8225 case BuiltinType::LongLong:
8226 case BuiltinType::ULongLong:
8228 case BuiltinType::Int128:
8229 case BuiltinType::UInt128:
8234 case BuiltinType::Char8:
8236 case BuiltinType::Char16:
8237 return getIntegerRank(
8239 case BuiltinType::Char32:
8240 return getIntegerRank(
8242 case BuiltinType::WChar_S:
8243 case BuiltinType::WChar_U:
8244 return getIntegerRank(
8274 uint64_t BitWidth = Field->getBitWidthValue();
8300 if (BitWidth < IntSize)
8303 if (BitWidth == IntSize)
8318 assert(!Promotable.
isNull());
8321 return ED->getPromotionType();
8325 if (
const auto *OBT = Promotable->
getAs<OverflowBehaviorType>()) {
8338 if (BT->getKind() == BuiltinType::WChar_S ||
8339 BT->getKind() == BuiltinType::WChar_U ||
8340 BT->getKind() == BuiltinType::Char8 ||
8341 BT->getKind() == BuiltinType::Char16 ||
8342 BT->getKind() == BuiltinType::Char32) {
8343 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
8347 for (
const auto &PT : PromoteTypes) {
8349 if (FromSize < ToSize ||
8350 (FromSize == ToSize && FromIsSigned == PT->isSignedIntegerType()))
8353 llvm_unreachable(
"char type should fit into long long");
8360 uint64_t PromotableSize =
getIntWidth(Promotable);
8369 while (!T.isNull()) {
8371 return T.getObjCLifetime();
8372 if (T->isArrayType())
8374 else if (
const auto *PT = T->getAs<
PointerType>())
8375 T = PT->getPointeeType();
8377 T = RT->getPointeeType();
8402 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
8404 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
8407 if (LHSC == RHSC)
return 0;
8412 unsigned LHSRank = getIntegerRank(LHSC);
8413 unsigned RHSRank = getIntegerRank(RHSC);
8415 if (LHSUnsigned == RHSUnsigned) {
8416 if (LHSRank == RHSRank)
return 0;
8417 return LHSRank > RHSRank ? 1 : -1;
8423 if (LHSRank >= RHSRank)
8433 if (RHSRank >= LHSRank)
8443 if (CFConstantStringTypeDecl)
8444 return CFConstantStringTypeDecl;
8446 assert(!CFConstantStringTagDecl &&
8447 "tag and typedef should be initialized together");
8449 CFConstantStringTagDecl->startDefinition();
8487 if (
static_cast<unsigned>(CFRuntime) <
8490 Fields[Count++] = {
IntTy,
"flags" };
8492 Fields[Count++] = {
LongTy,
"length" };
8496 Fields[Count++] = { getFromTargetType(Target->getUInt64Type()),
"_swift_rc" };
8500 Fields[Count++] = {
IntTy,
"_ptr" };
8506 for (
unsigned i = 0; i < Count; ++i) {
8510 Fields[i].Type,
nullptr,
8513 CFConstantStringTagDecl->addDecl(Field);
8516 CFConstantStringTagDecl->completeDefinition();
8520 CFConstantStringTypeDecl =
8523 return CFConstantStringTypeDecl;
8527 if (!CFConstantStringTagDecl)
8529 return CFConstantStringTagDecl;
8539 if (ObjCSuperType.isNull()) {
8544 return ObjCSuperType;
8550 CFConstantStringTagDecl = TT->castAsRecordDecl();
8554 if (BlockDescriptorType)
8567 static const char *
const FieldNames[] = {
8572 for (
size_t i = 0; i < 2; ++i) {
8575 &
Idents.get(FieldNames[i]), FieldTypes[i],
nullptr,
8583 BlockDescriptorType = RD;
8589 if (BlockDescriptorExtendedType)
8604 static const char *
const FieldNames[] = {
8611 for (
size_t i = 0; i < 4; ++i) {
8614 &
Idents.get(FieldNames[i]), FieldTypes[i],
nullptr,
8623 BlockDescriptorExtendedType = RD;
8628 const auto *BT = dyn_cast<BuiltinType>(T);
8637 switch (BT->getKind()) {
8638#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8639 case BuiltinType::Id: \
8641#include "clang/Basic/OpenCLImageTypes.def"
8643 case BuiltinType::OCLClkEvent:
8646 case BuiltinType::OCLEvent:
8649 case BuiltinType::OCLQueue:
8652 case BuiltinType::OCLReserveID:
8655 case BuiltinType::OCLSampler:
8674 if (!copyExpr && record->hasTrivialDestructor())
return false;
8705 llvm_unreachable(
"impossible");
8707 llvm_unreachable(
"fell out of lifetime switch!");
8715 bool &HasByrefExtendedLayout)
const {
8720 HasByrefExtendedLayout =
false;
8722 HasByrefExtendedLayout =
true;
8736 assert(Target &&
"Expected target to be initialized");
8737 const llvm::Triple &T = Target->getTriple();
8739 if (T.isOSWindows() && T.isArch64Bit())
8745 assert(Target &&
"Expected target to be initialized");
8746 const llvm::Triple &T = Target->getTriple();
8748 if (T.isOSWindows() && T.isArch64Bit())
8754 if (!ObjCInstanceTypeDecl)
8755 ObjCInstanceTypeDecl =
8757 return ObjCInstanceTypeDecl;
8763 if (
const auto *TT = dyn_cast<TypedefType>(T))
8765 return II->isStr(
"BOOL");
8773 if (!
type->isIncompleteArrayType() &&
type->isIncompleteType())
8782 else if (
type->isArrayType())
8801 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
8808 !D->isInlineSpecified() && (D->isConstexpr() ||
First->isConstexpr()))
8839 for (
auto *PI :
Decl->parameters()) {
8844 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
8853 ParmOffset = PtrSize;
8854 for (
auto *PVDecl :
Decl->parameters()) {
8855 QualType PType = PVDecl->getOriginalType();
8856 if (
const auto *AT =
8861 PType = PVDecl->getType();
8863 PType = PVDecl->getType();
8883 for (
auto *PI :
Decl->parameters()) {
8890 "getObjCEncodingForFunctionDecl - Incomplete param type");
8897 for (
auto *PVDecl :
Decl->parameters()) {
8898 QualType PType = PVDecl->getOriginalType();
8899 if (
const auto *AT =
8904 PType = PVDecl->getType();
8906 PType = PVDecl->getType();
8920 bool Extended)
const {
8924 ObjCEncOptions Options = ObjCEncOptions()
8925 .setExpandPointedToStructures()
8926 .setExpandStructures()
8927 .setIsOutermostType();
8929 Options.setEncodeBlockParameters().setEncodeClassNames();
8930 getObjCEncodingForTypeImpl(T, S, Options,
nullptr);
8936 bool Extended)
const {
8941 Decl->getReturnType(), S, Extended);
8950 E =
Decl->sel_param_end(); PI != E; ++PI) {
8957 "getObjCEncodingForMethodDecl - Incomplete param type");
8965 ParmOffset = 2 * PtrSize;
8967 E =
Decl->sel_param_end(); PI != E; ++PI) {
8970 if (
const auto *AT =
8979 PType, S, Extended);
8990 const Decl *Container)
const {
8993 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
8994 for (
auto *PID : CID->property_impls())
8995 if (PID->getPropertyDecl() == PD)
8999 for (
auto *PID : OID->property_impls())
9000 if (PID->getPropertyDecl() == PD)
9034 const Decl *Container)
const {
9036 bool Dynamic =
false;
9044 SynthesizePID = PropertyImpDecl;
9048 std::string S =
"T";
9093 if (SynthesizePID) {
9110 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
9113 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
9126 getObjCEncodingForTypeImpl(T, S,
9128 .setExpandPointedToStructures()
9129 .setExpandStructures()
9130 .setIsOutermostType(),
9131 Field, NotEncodedT);
9135 std::string& S)
const {
9139 getObjCEncodingForTypeImpl(T, S,
9141 .setExpandPointedToStructures()
9142 .setExpandStructures()
9143 .setIsOutermostType()
9144 .setEncodingProperty(),
9152 case BuiltinType::Void:
return 'v';
9153 case BuiltinType::Bool:
return 'B';
9154 case BuiltinType::Char8:
9155 case BuiltinType::Char_U:
9156 case BuiltinType::UChar:
return 'C';
9157 case BuiltinType::Char16:
9158 case BuiltinType::UShort:
return 'S';
9159 case BuiltinType::Char32:
9160 case BuiltinType::UInt:
return 'I';
9161 case BuiltinType::ULong:
9162 return C->getTargetInfo().getLongWidth() == 32 ?
'L' :
'Q';
9163 case BuiltinType::UInt128:
return 'T';
9164 case BuiltinType::ULongLong:
return 'Q';
9165 case BuiltinType::Char_S:
9166 case BuiltinType::SChar:
return 'c';
9167 case BuiltinType::Short:
return 's';
9168 case BuiltinType::WChar_S:
9169 case BuiltinType::WChar_U:
9170 case BuiltinType::Int:
return 'i';
9171 case BuiltinType::Long:
9172 return C->getTargetInfo().getLongWidth() == 32 ?
'l' :
'q';
9173 case BuiltinType::LongLong:
return 'q';
9174 case BuiltinType::Int128:
return 't';
9175 case BuiltinType::Float:
return 'f';
9176 case BuiltinType::Double:
return 'd';
9177 case BuiltinType::LongDouble:
return 'D';
9178 case BuiltinType::NullPtr:
return '*';
9180 case BuiltinType::BFloat16:
9181 case BuiltinType::Float16:
9182 case BuiltinType::Float128:
9183 case BuiltinType::Ibm128:
9184 case BuiltinType::Half:
9185 case BuiltinType::ShortAccum:
9186 case BuiltinType::Accum:
9187 case BuiltinType::LongAccum:
9188 case BuiltinType::UShortAccum:
9189 case BuiltinType::UAccum:
9190 case BuiltinType::ULongAccum:
9191 case BuiltinType::ShortFract:
9192 case BuiltinType::Fract:
9193 case BuiltinType::LongFract:
9194 case BuiltinType::UShortFract:
9195 case BuiltinType::UFract:
9196 case BuiltinType::ULongFract:
9197 case BuiltinType::SatShortAccum:
9198 case BuiltinType::SatAccum:
9199 case BuiltinType::SatLongAccum:
9200 case BuiltinType::SatUShortAccum:
9201 case BuiltinType::SatUAccum:
9202 case BuiltinType::SatULongAccum:
9203 case BuiltinType::SatShortFract:
9204 case BuiltinType::SatFract:
9205 case BuiltinType::SatLongFract:
9206 case BuiltinType::SatUShortFract:
9207 case BuiltinType::SatUFract:
9208 case BuiltinType::SatULongFract:
9212#define SVE_TYPE(Name, Id, SingletonId) \
9213 case BuiltinType::Id:
9214#include "clang/Basic/AArch64ACLETypes.def"
9215#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
9216#include "clang/Basic/RISCVVTypes.def"
9217#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
9218#include "clang/Basic/WebAssemblyReferenceTypes.def"
9219#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id:
9220#include "clang/Basic/AMDGPUTypes.def"
9223 Diags.
Report(diag::err_unsupported_objc_primitive_encoding)
9228 case BuiltinType::ObjCId:
9229 case BuiltinType::ObjCClass:
9230 case BuiltinType::ObjCSel:
9231 llvm_unreachable(
"@encoding ObjC primitive type");
9234#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
9235 case BuiltinType::Id:
9236#include "clang/Basic/OpenCLImageTypes.def"
9237#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
9238 case BuiltinType::Id:
9239#include "clang/Basic/OpenCLExtensionTypes.def"
9240 case BuiltinType::OCLEvent:
9241 case BuiltinType::OCLClkEvent:
9242 case BuiltinType::OCLQueue:
9243 case BuiltinType::OCLReserveID:
9244 case BuiltinType::OCLSampler:
9245 case BuiltinType::Dependent:
9246#define PPC_VECTOR_TYPE(Name, Id, Size) \
9247 case BuiltinType::Id:
9248#include "clang/Basic/PPCTypes.def"
9249#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
9250#include "clang/Basic/HLSLIntangibleTypes.def"
9251#define BUILTIN_TYPE(KIND, ID)
9252#define PLACEHOLDER_TYPE(KIND, ID) \
9253 case BuiltinType::KIND:
9254#include "clang/AST/BuiltinTypes.def"
9255 llvm_unreachable(
"invalid builtin type for @encode");
9257 llvm_unreachable(
"invalid BuiltinType::Kind value");
9264 if (!
Enum->isFixed())
9274 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
9294 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
9302 S += llvm::utostr(Offset);
9317 bool VisitBasesAndFields) {
9318 T = T->getBaseElementTypeUnsafe();
9322 PT->getPointeeType().getTypePtr(),
false);
9324 auto *CXXRD = T->getAsCXXRecordDecl();
9332 if (!CXXRD->hasDefinition() || !VisitBasesAndFields)
9335 for (
const auto &B : CXXRD->bases())
9340 for (
auto *FD : CXXRD->fields())
9349void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string &S,
9350 const ObjCEncOptions Options,
9351 const FieldDecl *FD,
9352 QualType *NotEncodedT)
const {
9354 switch (CT->getTypeClass()) {
9359 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
9367 getObjCEncodingForTypeImpl(T->
castAs<ComplexType>()->getElementType(), S,
9374 getObjCEncodingForTypeImpl(T->
castAs<AtomicType>()->getValueType(), S,
9381 case Type::LValueReference:
9382 case Type::RValueReference: {
9385 const auto *PT = T->
castAs<PointerType>();
9386 if (PT->isObjCSelType()) {
9395 bool isReadOnly =
false;
9400 if (T->
getAs<TypedefType>()) {
9405 }
else if (Options.IsOutermostType()) {
9406 QualType P = PointeeTy;
9407 while (
auto PT = P->
getAs<PointerType>())
9418 if (StringRef(S).ends_with(
"nr"))
9419 S.replace(S.end()-2, S.end(),
"rn");
9429 }
else if (
const auto *RTy = PointeeTy->
getAsCanonical<RecordType>()) {
9430 const IdentifierInfo *II = RTy->getDecl()->getIdentifier();
9432 if (II == &
Idents.get(
"objc_class")) {
9437 if (II == &
Idents.get(
"objc_object")) {
9446 RTy, Options.ExpandPointedToStructures()))) {
9455 ObjCEncOptions NewOptions;
9456 if (Options.ExpandPointedToStructures())
9457 NewOptions.setExpandStructures();
9458 getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
9459 nullptr, NotEncodedT);
9463 case Type::ConstantArray:
9464 case Type::IncompleteArray:
9465 case Type::VariableArray: {
9472 getObjCEncodingForTypeImpl(
9473 AT->getElementType(), S,
9474 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
9478 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
9479 S += llvm::utostr(CAT->getZExtSize());
9483 "Unknown array type!");
9487 getObjCEncodingForTypeImpl(
9488 AT->getElementType(), S,
9489 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
9496 case Type::FunctionNoProto:
9497 case Type::FunctionProto:
9501 case Type::Record: {
9503 S += RDecl->
isUnion() ?
'(' :
'{';
9507 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
9508 const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
9509 llvm::raw_string_ostream
OS(S);
9510 printTemplateArgumentList(OS, TemplateArgs.
asArray(),
9516 if (Options.ExpandStructures()) {
9519 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
9521 for (
const auto *Field : RDecl->
fields()) {
9524 S +=
Field->getNameAsString();
9529 if (
Field->isBitField()) {
9530 getObjCEncodingForTypeImpl(
Field->getType(), S,
9531 ObjCEncOptions().setExpandStructures(),
9534 QualType qt =
Field->getType();
9536 getObjCEncodingForTypeImpl(
9538 ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
9544 S += RDecl->
isUnion() ?
')' :
'}';
9548 case Type::BlockPointer: {
9549 const auto *BT = T->
castAs<BlockPointerType>();
9551 if (Options.EncodeBlockParameters()) {
9552 const auto *FT = BT->getPointeeType()->castAs<FunctionType>();
9556 getObjCEncodingForTypeImpl(FT->getReturnType(), S,
9557 Options.forComponentType(), FD, NotEncodedT);
9561 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
9562 for (
const auto &I : FPT->param_types())
9563 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
9571 case Type::ObjCObject: {
9575 S +=
"{objc_object=}";
9579 S +=
"{objc_class=}";
9586 case Type::ObjCInterface: {
9589 ObjCInterfaceDecl *OI = T->
castAs<ObjCObjectType>()->getInterface();
9592 if (Options.ExpandStructures()) {
9594 SmallVector<const ObjCIvarDecl*, 32> Ivars;
9596 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
9597 const FieldDecl *
Field = Ivars[i];
9598 if (
Field->isBitField())
9599 getObjCEncodingForTypeImpl(
Field->getType(), S,
9600 ObjCEncOptions().setExpandStructures(),
9603 getObjCEncodingForTypeImpl(
Field->getType(), S,
9604 ObjCEncOptions().setExpandStructures(), FD,
9612 case Type::ObjCObjectPointer: {
9613 const auto *OPT = T->
castAs<ObjCObjectPointerType>();
9614 if (OPT->isObjCIdType()) {
9619 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
9627 if (OPT->isObjCQualifiedIdType()) {
9628 getObjCEncodingForTypeImpl(
9630 Options.keepingOnly(ObjCEncOptions()
9631 .setExpandPointedToStructures()
9632 .setExpandStructures()),
9634 if (FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
9638 for (
const auto *I : OPT->quals()) {
9640 S += I->getObjCRuntimeNameAsString();
9649 if (OPT->getInterfaceDecl() &&
9650 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
9652 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
9653 for (
const auto *I : OPT->quals()) {
9655 S += I->getObjCRuntimeNameAsString();
9665 case Type::MemberPointer:
9669 case Type::ExtVector:
9675 case Type::ConstantMatrix:
9688 case Type::DeducedTemplateSpecialization:
9691 case Type::HLSLAttributedResource:
9692 case Type::HLSLInlineSpirv:
9693 case Type::OverflowBehavior:
9694 llvm_unreachable(
"unexpected type");
9696 case Type::ArrayParameter:
9698#define ABSTRACT_TYPE(KIND, BASE)
9699#define TYPE(KIND, BASE)
9700#define DEPENDENT_TYPE(KIND, BASE) \
9702#define NON_CANONICAL_TYPE(KIND, BASE) \
9704#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \
9706#include "clang/AST/TypeNodes.inc"
9707 llvm_unreachable(
"@encode for dependent type!");
9709 llvm_unreachable(
"bad type kind!");
9712void ASTContext::getObjCEncodingForStructureImpl(RecordDecl *RDecl,
9714 const FieldDecl *FD,
9716 QualType *NotEncodedT)
const {
9717 assert(RDecl &&
"Expected non-null RecordDecl");
9718 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
9722 const auto *CXXRec = dyn_cast<CXXRecordDecl>(RDecl);
9723 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
9727 for (
const auto &BI : CXXRec->bases()) {
9728 if (!BI.isVirtual()) {
9733 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9734 std::make_pair(offs, base));
9739 for (FieldDecl *Field : RDecl->
fields()) {
9740 if (!
Field->isZeroLengthBitField() &&
Field->isZeroSize(*
this))
9743 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9744 std::make_pair(offs, Field));
9747 if (CXXRec && includeVBases) {
9748 for (
const auto &BI : CXXRec->vbases()) {
9754 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
9755 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
9756 std::make_pair(offs, base));
9770 std::multimap<uint64_t, NamedDecl *>::iterator
9771 CurLayObj = FieldOrBaseOffsets.begin();
9773 if (CXXRec && CXXRec->isDynamicClass() &&
9774 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
9777 std::string recname = CXXRec->getNameAsString();
9778 if (recname.empty()) recname =
"?";
9791 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9792 std::make_pair(offs,
nullptr));
9795 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
9797 assert(CurOffs <= CurLayObj->first);
9798 if (CurOffs < CurLayObj->first) {
9799 uint64_t padding = CurLayObj->first - CurOffs;
9811 NamedDecl *dcl = CurLayObj->second;
9815 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
9820 getObjCEncodingForStructureImpl(base, S, FD,
false,
9830 S += field->getNameAsString();
9834 if (field->isBitField()) {
9837 CurOffs += field->getBitWidthValue();
9840 QualType qt = field->getType();
9842 getObjCEncodingForTypeImpl(
9843 qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
9854 std::string& S)
const {
9887 if (!ObjCClassDecl) {
9892 return ObjCClassDecl;
9896 if (!ObjCProtocolClassDecl) {
9897 ObjCProtocolClassDecl
9906 return ObjCProtocolClassDecl;
9927 QualType T = Context->getPointerType(Context->CharTy);
9928 return Context->buildImplicitTypedef(T, Name);
9941 QualType T = Context->getPointerType(Context->VoidTy);
9942 return Context->buildImplicitTypedef(T,
"__builtin_va_list");
9949 if (Context->getLangOpts().CPlusPlus) {
9954 &Context->Idents.get(
"std"),
9962 const size_t NumFields = 5;
9964 const char *FieldNames[NumFields];
9967 FieldTypes[0] = Context->getPointerType(Context->VoidTy);
9968 FieldNames[0] =
"__stack";
9971 FieldTypes[1] = Context->getPointerType(Context->VoidTy);
9972 FieldNames[1] =
"__gr_top";
9975 FieldTypes[2] = Context->getPointerType(Context->VoidTy);
9976 FieldNames[2] =
"__vr_top";
9979 FieldTypes[3] = Context->IntTy;
9980 FieldNames[3] =
"__gr_offs";
9983 FieldTypes[4] = Context->IntTy;
9984 FieldNames[4] =
"__vr_offs";
9987 for (
unsigned i = 0; i < NumFields; ++i) {
9992 &Context->Idents.get(FieldNames[i]),
9993 FieldTypes[i],
nullptr,
10005 return Context->buildImplicitTypedef(VaListTagType,
"__builtin_va_list");
10012 VaListTagDecl = Context->buildImplicitRecord(
"__va_list_tag");
10015 const size_t NumFields = 5;
10017 const char *FieldNames[NumFields];
10020 FieldTypes[0] = Context->UnsignedCharTy;
10021 FieldNames[0] =
"gpr";
10024 FieldTypes[1] = Context->UnsignedCharTy;
10025 FieldNames[1] =
"fpr";
10028 FieldTypes[2] = Context->UnsignedShortTy;
10029 FieldNames[2] =
"reserved";
10032 FieldTypes[3] = Context->getPointerType(Context->VoidTy);
10033 FieldNames[3] =
"overflow_arg_area";
10036 FieldTypes[4] = Context->getPointerType(Context->VoidTy);
10037 FieldNames[4] =
"reg_save_area";
10040 for (
unsigned i = 0; i < NumFields; ++i) {
10044 &Context->Idents.get(FieldNames[i]),
10045 FieldTypes[i],
nullptr,
10058 Context->buildImplicitTypedef(VaListTagType,
"__va_list_tag");
10062 std::nullopt, VaListTagTypedefDecl);
10065 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1);
10066 QualType VaListTagArrayType = Context->getConstantArrayType(
10068 return Context->buildImplicitTypedef(VaListTagArrayType,
"__builtin_va_list");
10071static TypedefDecl *
10075 VaListTagDecl = Context->buildImplicitRecord(
"__va_list_tag");
10078 const size_t NumFields = 4;
10080 const char *FieldNames[NumFields];
10083 FieldTypes[0] = Context->UnsignedIntTy;
10084 FieldNames[0] =
"gp_offset";
10087 FieldTypes[1] = Context->UnsignedIntTy;
10088 FieldNames[1] =
"fp_offset";
10091 FieldTypes[2] = Context->getPointerType(Context->VoidTy);
10092 FieldNames[2] =
"overflow_arg_area";
10095 FieldTypes[3] = Context->getPointerType(Context->VoidTy);
10096 FieldNames[3] =
"reg_save_area";
10099 for (
unsigned i = 0; i < NumFields; ++i) {
10104 &Context->Idents.get(FieldNames[i]),
10105 FieldTypes[i],
nullptr,
10119 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1);
10120 QualType VaListTagArrayType = Context->getConstantArrayType(
10122 return Context->buildImplicitTypedef(VaListTagArrayType,
"__builtin_va_list");
10125static TypedefDecl *
10128 RecordDecl *VaListDecl = Context->buildImplicitRecord(
"__va_list");
10129 if (Context->getLangOpts().CPlusPlus) {
10148 &Context->Idents.get(
"__ap"),
10149 Context->getPointerType(Context->VoidTy),
10159 Context->VaListTagDecl = VaListDecl;
10162 CanQualType T = Context->getCanonicalTagType(VaListDecl);
10163 return Context->buildImplicitTypedef(T,
"__builtin_va_list");
10166static TypedefDecl *
10170 VaListTagDecl = Context->buildImplicitRecord(
"__va_list_tag");
10173 const size_t NumFields = 4;
10175 const char *FieldNames[NumFields];
10178 FieldTypes[0] = Context->LongTy;
10179 FieldNames[0] =
"__gpr";
10182 FieldTypes[1] = Context->LongTy;
10183 FieldNames[1] =
"__fpr";
10186 FieldTypes[2] = Context->getPointerType(Context->VoidTy);
10187 FieldNames[2] =
"__overflow_arg_area";
10190 FieldTypes[3] = Context->getPointerType(Context->VoidTy);
10191 FieldNames[3] =
"__reg_save_area";
10194 for (
unsigned i = 0; i < NumFields; ++i) {
10199 &Context->Idents.get(FieldNames[i]),
10200 FieldTypes[i],
nullptr,
10214 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1);
10215 QualType VaListTagArrayType = Context->getConstantArrayType(
10218 return Context->buildImplicitTypedef(VaListTagArrayType,
"__builtin_va_list");
10224 VaListTagDecl = Context->buildImplicitRecord(
"__va_list_tag");
10227 const size_t NumFields = 3;
10229 const char *FieldNames[NumFields];
10232 FieldTypes[0] = Context->getPointerType(Context->VoidTy);
10233 FieldNames[0] =
"__current_saved_reg_area_pointer";
10236 FieldTypes[1] = Context->getPointerType(Context->VoidTy);
10237 FieldNames[1] =
"__saved_reg_area_end_pointer";
10240 FieldTypes[2] = Context->getPointerType(Context->VoidTy);
10241 FieldNames[2] =
"__overflow_area_pointer";
10244 for (
unsigned i = 0; i < NumFields; ++i) {
10247 SourceLocation(), &Context->Idents.get(FieldNames[i]), FieldTypes[i],
10260 Context->buildImplicitTypedef(VaListTagType,
"__va_list_tag");
10264 std::nullopt, VaListTagTypedefDecl);
10267 llvm::APInt Size(Context->getTypeSize(Context->getSizeType()), 1);
10268 QualType VaListTagArrayType = Context->getConstantArrayType(
10271 return Context->buildImplicitTypedef(VaListTagArrayType,
"__builtin_va_list");
10274static TypedefDecl *
10284 constexpr size_t NumFields = 3;
10285 QualType FieldTypes[NumFields] = {Context->getPointerType(Context->IntTy),
10286 Context->getPointerType(Context->IntTy),
10288 const char *FieldNames[NumFields] = {
"__va_stk",
"__va_reg",
"__va_ndx"};
10291 for (
unsigned i = 0; i < NumFields; ++i) {
10294 &Context->Idents.get(FieldNames[i]), FieldTypes[i],
nullptr,
10306 Context->buildImplicitTypedef(VaListTagType,
"__builtin_va_list");
10308 return VaListTagTypedefDecl;
10334 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
10338 if (!BuiltinVaListDecl) {
10339 BuiltinVaListDecl =
CreateVaListDecl(
this, Target->getBuiltinVaListKind());
10340 assert(BuiltinVaListDecl->isImplicit());
10343 return BuiltinVaListDecl;
10356 if (!BuiltinMSVaListDecl)
10359 return BuiltinMSVaListDecl;
10376 assert(ObjCConstantStringType.isNull() &&
10377 "'NSConstantString' type already set!");
10387 unsigned size = End - Begin;
10388 assert(size > 1 &&
"set is not overloaded!");
10394 NamedDecl **Storage = OT->getStorage();
10417 bool TemplateKeyword,
10422 if (
Template.getAsTemplateDecl()->getKind() == Decl::TemplateTemplateParm) {
10423 assert(!Qualifier &&
"unexpected qualified template template parameter");
10424 assert(TemplateKeyword ==
false);
10429 llvm::FoldingSetNodeID ID;
10432 void *InsertPos =
nullptr;
10434 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10438 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
10448 llvm::FoldingSetNodeID ID;
10451 void *InsertPos =
nullptr;
10453 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos))
10458 DependentTemplateNames.InsertNode(QTN, InsertPos);
10463 Decl *AssociatedDecl,
10466 bool Final)
const {
10467 llvm::FoldingSetNodeID ID;
10469 Index, PackIndex, Final);
10471 void *insertPos =
nullptr;
10473 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
10477 Replacement, AssociatedDecl, Index, PackIndex, Final);
10478 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
10486 Decl *AssociatedDecl,
10487 unsigned Index,
bool Final)
const {
10489 llvm::FoldingSetNodeID ID;
10491 AssociatedDecl, Index, Final);
10493 void *InsertPos =
nullptr;
10495 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
10500 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
10514 llvm::FoldingSetNodeID ID;
10517 void *InsertPos =
nullptr;
10519 DeducedTemplates.FindNodeOrInsertPos(ID, InsertPos);
10525 DeducedTemplates.InsertNode(DTS, InsertPos);
10548 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
10578 while (
const auto *AT = dyn_cast<ArrayType>(CT))
10579 CT = AT->getElementType();
10611 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
10612 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
10669 const auto *LHSOBT = LHS->
getAs<OverflowBehaviorType>();
10670 const auto *RHSOBT = RHS->
getAs<OverflowBehaviorType>();
10672 if (!LHSOBT && !RHSOBT)
10675 if (LHSOBT && RHSOBT) {
10676 if (LHSOBT->getBehaviorKind() != RHSOBT->getBehaviorKind())
10681 QualType LHSUnderlying = LHSOBT ? LHSOBT->desugar() : LHS;
10682 QualType RHSUnderlying = RHSOBT ? RHSOBT->desugar() : RHS;
10684 if (RHSOBT && !LHSOBT) {
10695 auto VScale = Context.getTargetInfo().getVScaleRange(
10702 uint64_t EltSize = Context.getTypeSize(Info.
ElementType);
10706 uint64_t MinElts = Info.
EC.getKnownMinValue();
10707 return VScale->first * MinElts * EltSize;
10715 "Expected RVV builtin type and vector type!");
10755 return IsValidCast(FirstType, SecondType) ||
10756 IsValidCast(SecondType, FirstType);
10764 "Expected RVV builtin type and vector type!");
10771 if (!BT->isRVVVLSBuiltinType())
10791 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
10798 return IsLaxCompatible(FirstType, SecondType) ||
10799 IsLaxCompatible(SecondType, FirstType);
10805 if (
const AttributedType *
Attr = dyn_cast<AttributedType>(Ty)) {
10806 if (
Attr->getAttrKind() == attr::ObjCOwnership)
10809 Ty =
Attr->getModifiedType();
10813 Ty =
Paren->getInnerType();
10845 for (
auto *lhsProto : lhs->
quals()) {
10846 bool match =
false;
10847 for (
auto *rhsProto : rhs->
quals()) {
10878 for (
auto *I : lhs->
quals()) {
10882 if (!rhsID->ClassImplementsProtocol(I,
true))
10890 for (
auto *lhsProto : lhs->
quals()) {
10891 bool match =
false;
10896 for (
auto *rhsProto : rhs->
quals()) {
10906 for (
auto *I : lhs->
quals()) {
10910 if (rhsID->ClassImplementsProtocol(I,
true)) {
10927 for (
auto *lhsProto : lhs->
quals()) {
10928 bool match =
false;
10935 for (
auto *rhsProto : rhs->
quals()) {
10954 if (LHSInheritedProtocols.empty() && lhs->
qual_empty())
10956 for (
auto *lhsProto : LHSInheritedProtocols) {
10957 bool match =
false;
10958 for (
auto *rhsProto : rhs->
quals()) {
10983 if (LHS->isObjCUnqualifiedId() || RHS->isObjCUnqualifiedId())
10988 auto finish = [&](
bool succeeded) ->
bool {
10992 if (!RHS->isKindOfType())
11003 if (LHS->isObjCQualifiedId() || RHS->isObjCQualifiedId()) {
11008 if (LHS->isObjCQualifiedClass() && RHS->isObjCQualifiedClass()) {
11013 if (LHS->isObjCClass() && RHS->isObjCClass()) {
11018 if (LHS->getInterface() && RHS->getInterface()) {
11033 bool BlockReturnType) {
11037 auto finish = [&](
bool succeeded) ->
bool {
11062 if (
getLangOpts().CompatibilityQualifiedIdBlockParamTypeChecking)
11066 (!BlockReturnType &&
11070 (BlockReturnType ? LHSOPT : RHSOPT),
11071 (BlockReturnType ? RHSOPT : LHSOPT),
false));
11079 return finish(BlockReturnType);
11081 return finish(!BlockReturnType);
11093 return (*lhs)->getName().compare((*rhs)->getName());
11110 assert(LHS->getInterface() &&
"LHS must have an interface base");
11111 assert(RHS->getInterface() &&
"RHS must have an interface base");
11117 for (
auto *proto : LHS->quals()) {
11118 Context.CollectInheritedProtocols(proto, LHSProtocolSet);
11122 Context.CollectInheritedProtocols(LHS->getInterface(), LHSProtocolSet);
11128 for (
auto *proto : RHS->quals()) {
11129 Context.CollectInheritedProtocols(proto, RHSProtocolSet);
11133 Context.CollectInheritedProtocols(RHS->getInterface(), RHSProtocolSet);
11136 for (
auto *proto : LHSProtocolSet) {
11137 if (RHSProtocolSet.count(proto))
11138 IntersectionSet.push_back(proto);
11144 Context.CollectInheritedProtocols(CommonBase, ImpliedProtocols);
11147 if (!ImpliedProtocols.empty()) {
11149 return ImpliedProtocols.contains(proto);
11154 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
11164 if (lhsOPT && rhsOPT)
11170 if (lhsBlock && rhsBlock)
11175 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
11187 bool stripKindOf) {
11188 if (lhsArgs.size() != rhsArgs.size())
11195 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
11201 if (!stripKindOf ||
11202 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
11203 rhsArgs[i].stripObjCKindOfType(ctx))) {
11231 if (!LDecl || !RDecl)
11237 bool anyKindOf = LHS->isKindOfType() || RHS->isKindOfType();
11241 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
11246 LHSAncestors[LHS->getInterface()->getCanonicalDecl()] = LHS;
11251 bool anyChanges =
false;
11252 if (LHS->isSpecialized() && RHS->isSpecialized()) {
11255 LHS->getTypeArgs(), RHS->getTypeArgs(),
11258 }
else if (LHS->isSpecialized() != RHS->isSpecialized()) {
11269 if (!Protocols.empty())
11275 if (anyChanges || LHS->isKindOfType() != anyKindOf) {
11278 anyKindOf || LHS->isKindOfType());
11286 QualType LHSSuperType = LHS->getSuperClassType();
11287 if (LHSSuperType.
isNull())
11296 auto KnownLHS = LHSAncestors.find(RHS->getInterface()->getCanonicalDecl());
11297 if (KnownLHS != LHSAncestors.end()) {
11298 LHS = KnownLHS->second;
11302 bool anyChanges =
false;
11303 if (LHS->isSpecialized() && RHS->isSpecialized()) {
11306 LHS->getTypeArgs(), RHS->getTypeArgs(),
11309 }
else if (LHS->isSpecialized() != RHS->isSpecialized()) {
11320 if (!Protocols.empty())
11325 if (anyChanges || RHS->isKindOfType() != anyKindOf) {
11328 anyKindOf || RHS->isKindOfType());
11336 QualType RHSSuperType = RHS->getSuperClassType();
11337 if (RHSSuperType.
isNull())
11348 assert(LHS->getInterface() &&
"LHS is not an interface type");
11349 assert(RHS->getInterface() &&
"RHS is not an interface type");
11354 bool IsSuperClass = LHSInterface->
isSuperClassOf(RHS->getInterface());
11361 if (LHS->getNumProtocols() > 0) {
11370 for (
auto *RHSPI : RHS->quals())
11373 if (SuperClassInheritedProtocols.empty())
11376 for (
const auto *LHSProto : LHS->quals()) {
11377 bool SuperImplementsProtocol =
false;
11378 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
11379 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
11380 SuperImplementsProtocol =
true;
11383 if (!SuperImplementsProtocol)
11389 if (LHS->isSpecialized()) {
11394 RHSSuper = RHSSuper->getSuperClassType()->castAs<
ObjCObjectType>();
11397 if (RHSSuper->isSpecialized() &&
11399 LHS->getTypeArgs(), RHSSuper->getTypeArgs(),
11413 if (!LHSOPT || !RHSOPT)
11431 bool CompareUnqualified) {
11450 bool OfBlockPointer,
11452 if (
const RecordType *UT = T->getAsUnionType()) {
11454 if (UD->
hasAttr<TransparentUnionAttr>()) {
11455 for (
const auto *I : UD->
fields()) {
11456 QualType ET = I->getType().getUnqualifiedType();
11470 bool OfBlockPointer,
11491 bool IsConditionalOperator) {
11494 const auto *lproto = dyn_cast<FunctionProtoType>(lbase);
11495 const auto *rproto = dyn_cast<FunctionProtoType>(rbase);
11496 bool allLTypes =
true;
11497 bool allRTypes =
true;
11501 if (OfBlockPointer) {
11503 QualType LHS = lbase->getReturnType();
11505 if (!UnqualifiedResult)
11507 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
11572 bool NoReturn = IsConditionalOperator
11582 std::optional<FunctionEffectSet> MergedFX;
11584 if (lproto && rproto) {
11585 assert((AllowCXX ||
11586 (!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec())) &&
11587 "C++ shouldn't be here");
11589 if (lproto->getNumParams() != rproto->getNumParams())
11593 if (lproto->isVariadic() != rproto->isVariadic())
11596 if (lproto->getMethodQuals() != rproto->getMethodQuals())
11600 if (lproto->getExtraAttributeInfo().CFISalt !=
11601 rproto->getExtraAttributeInfo().CFISalt)
11607 if (LHSFX != RHSFX) {
11608 if (IsConditionalOperator)
11617 if (*MergedFX != LHSFX)
11619 if (*MergedFX != RHSFX)
11624 bool canUseLeft, canUseRight;
11636 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
11637 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
11638 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
11640 lParamType, rParamType, OfBlockPointer,
Unqualified);
11647 types.push_back(paramType);
11659 if (allLTypes)
return lhs;
11660 if (allRTypes)
return rhs;
11665 newParamInfos.empty() ?
nullptr : newParamInfos.data();
11671 if (lproto) allRTypes =
false;
11672 if (rproto) allLTypes =
false;
11676 assert((AllowCXX || !proto->
hasExceptionSpec()) &&
"C++ shouldn't be here");
11684 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
11690 paramTy = ED->getIntegerType();
11700 if (allLTypes)
return lhs;
11701 if (allRTypes)
return rhs;
11710 if (allLTypes)
return lhs;
11711 if (allRTypes)
return rhs;
11717 QualType other,
bool isBlockReturnType) {
11723 ET->getDecl()->getDefinitionOrSelf()->getIntegerType();
11724 if (underlyingType.
isNull())
11726 if (Context.hasSameType(underlyingType, other))
11732 Context.getTypeSize(underlyingType) == Context.getTypeSize(other))
11741 if (LangOpts.CPlusPlus || !LangOpts.C23)
11762 bool BlockReturnType,
bool IsConditionalOperator) {
11763 const auto *LHSOBT = LHS->
getAs<OverflowBehaviorType>();
11764 const auto *RHSOBT = RHS->
getAs<OverflowBehaviorType>();
11766 if (!LHSOBT && !RHSOBT)
11767 return std::nullopt;
11771 if (LHSOBT->getBehaviorKind() != RHSOBT->getBehaviorKind())
11775 LHSOBT->getUnderlyingType(), RHSOBT->getUnderlyingType(),
11776 OfBlockPointer,
Unqualified, BlockReturnType, IsConditionalOperator);
11778 if (MergedUnderlying.
isNull())
11782 if (LHSOBT->getUnderlyingType() == RHSOBT->getUnderlyingType())
11785 LHSOBT->getBehaviorKind(),
11794 return mergeTypes(LHSOBT->getUnderlyingType(), RHS, OfBlockPointer,
11795 Unqualified, BlockReturnType, IsConditionalOperator);
11798 return mergeTypes(LHS, RHSOBT->getUnderlyingType(), OfBlockPointer,
11799 Unqualified, BlockReturnType, IsConditionalOperator);
11804 bool IsConditionalOperator) {
11815 if (LangOpts.OpenMP && LHSRefTy && RHSRefTy &&
11819 if (LHSRefTy || RHSRefTy)
11822 if (std::optional<QualType> MergedOBT =
11824 BlockReturnType, IsConditionalOperator))
11836 if (LHSCan == RHSCan)
11841 Qualifiers RQuals = RHSCan.getLocalQualifiers();
11842 if (LQuals != RQuals) {
11859 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11880 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
11881 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
11884 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
11885 LHSClass = Type::ConstantArray;
11886 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
11887 RHSClass = Type::ConstantArray;
11890 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
11891 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
11894 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
11895 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
11898 if (LHSClass != RHSClass) {
11908 if (OfBlockPointer && !BlockReturnType) {
11916 if (
const auto *AT = LHS->
getAs<AutoType>()) {
11917 if (!AT->isDeduced() && AT->isGNUAutoType())
11920 if (
const auto *AT = RHS->
getAs<AutoType>()) {
11921 if (!AT->isDeduced() && AT->isGNUAutoType())
11928 switch (LHSClass) {
11929#define TYPE(Class, Base)
11930#define ABSTRACT_TYPE(Class, Base)
11931#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
11932#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
11933#define DEPENDENT_TYPE(Class, Base) case Type::Class:
11934#include "clang/AST/TypeNodes.inc"
11935 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
11938 case Type::DeducedTemplateSpecialization:
11939 case Type::LValueReference:
11940 case Type::RValueReference:
11941 case Type::MemberPointer:
11942 llvm_unreachable(
"C++ should never be in mergeTypes");
11944 case Type::ObjCInterface:
11945 case Type::IncompleteArray:
11946 case Type::VariableArray:
11947 case Type::FunctionProto:
11948 case Type::ExtVector:
11949 case Type::OverflowBehavior:
11950 llvm_unreachable(
"Types are eliminated above");
11952 case Type::Pointer:
11963 if (ResultType.
isNull())
11971 case Type::BlockPointer:
11996 if (ResultType.
isNull())
12015 if (ResultType.
isNull())
12023 case Type::ConstantArray:
12038 if (ResultType.
isNull())
12046 if (LVAT || RVAT) {
12049 -> std::pair<bool,llvm::APInt> {
12051 std::optional<llvm::APSInt> TheInt;
12054 return std::make_pair(
true, *TheInt);
12055 return std::make_pair(
false, llvm::APSInt());
12058 return std::make_pair(
true, CAT->getSize());
12059 return std::make_pair(
false, llvm::APInt());
12062 bool HaveLSize, HaveRSize;
12063 llvm::APInt LSize, RSize;
12064 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
12065 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
12066 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
12100 case Type::FunctionNoProto:
12102 false, IsConditionalOperator);
12106 case Type::Builtin:
12109 case Type::Complex:
12118 case Type::ConstantMatrix:
12123 case Type::ObjCObject: {
12132 case Type::ObjCObjectPointer:
12133 if (OfBlockPointer) {
12145 assert(LHS != RHS &&
12146 "Equivalent pipe types should have already been handled!");
12148 case Type::ArrayParameter:
12149 assert(LHS != RHS &&
12150 "Equivalent ArrayParameter types should have already been handled!");
12152 case Type::BitInt: {
12160 if (LHSUnsigned != RHSUnsigned)
12163 if (LHSBits != RHSBits)
12167 case Type::HLSLAttributedResource: {
12168 const HLSLAttributedResourceType *LHSTy =
12169 LHS->
castAs<HLSLAttributedResourceType>();
12170 const HLSLAttributedResourceType *RHSTy =
12171 RHS->
castAs<HLSLAttributedResourceType>();
12172 assert(LHSTy->getWrappedType() == RHSTy->getWrappedType() &&
12173 LHSTy->getWrappedType()->isHLSLResourceType() &&
12174 "HLSLAttributedResourceType should always wrap __hlsl_resource_t");
12176 if (LHSTy->getAttrs() == RHSTy->getAttrs() &&
12177 LHSTy->getContainedType() == RHSTy->getContainedType())
12181 case Type::HLSLInlineSpirv:
12182 const HLSLInlineSpirvType *LHSTy = LHS->
castAs<HLSLInlineSpirvType>();
12183 const HLSLInlineSpirvType *RHSTy = RHS->
castAs<HLSLInlineSpirvType>();
12185 if (LHSTy->getOpcode() == RHSTy->getOpcode() &&
12186 LHSTy->getSize() == RHSTy->getSize() &&
12187 LHSTy->getAlignment() == RHSTy->getAlignment()) {
12188 for (
size_t I = 0; I < LHSTy->getOperands().size(); I++)
12189 if (LHSTy->getOperands()[I] != RHSTy->getOperands()[I])
12197 llvm_unreachable(
"Invalid Type::Class!");
12202 bool &CanUseFirst,
bool &CanUseSecond,
12204 assert(NewParamInfos.empty() &&
"param info list not empty");
12205 CanUseFirst = CanUseSecond =
true;
12211 if (!FirstHasInfo && !SecondHasInfo)
12214 bool NeedParamInfo =
false;
12218 for (
size_t I = 0; I < E; ++I) {
12229 bool FirstNoEscape = FirstParam.
isNoEscape();
12230 bool SecondNoEscape = SecondParam.
isNoEscape();
12231 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
12233 if (NewParamInfos.back().getOpaqueValue())
12234 NeedParamInfo =
true;
12235 if (FirstNoEscape != IsNoEscape)
12236 CanUseFirst =
false;
12237 if (SecondNoEscape != IsNoEscape)
12238 CanUseSecond =
false;
12241 if (!NeedParamInfo)
12242 NewParamInfos.clear();
12248 if (
auto It = ObjCLayouts.find(D); It != ObjCLayouts.end()) {
12249 It->second =
nullptr;
12250 for (
auto *SubClass : ObjCSubClasses.lookup(D))
12262 if (LHSCan == RHSCan)
12264 if (RHSCan->isFunctionType()) {
12273 if (ResReturnType.
isNull())
12275 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
12292 Qualifiers RQuals = RHSCan.getLocalQualifiers();
12293 if (LQuals != RQuals) {
12306 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
12322 if (ResQT == LHSBaseQT)
12324 if (ResQT == RHSBaseQT)
12335 if (
const auto *ED = T->getAsEnumDecl())
12336 T = ED->getIntegerType();
12337 if (T->isBooleanType())
12339 if (
const auto *EIT = T->getAs<
BitIntType>())
12340 return EIT->getNumBits();
12346 assert((T->hasIntegerRepresentation() || T->isEnumeralType() ||
12347 T->isFixedPointType()) &&
12348 "Unexpected type");
12351 if (
const auto *VTy = T->getAs<
VectorType>())
12353 VTy->getNumElements(), VTy->getVectorKind());
12356 if (
const auto *EITy = T->getAs<
BitIntType>())
12360 if (
const auto *OBT = T->getAs<OverflowBehaviorType>())
12362 OBT->getBehaviorKind(),
12367 if (
const auto *ED = T->getAsEnumDecl())
12368 T = ED->getIntegerType();
12371 case BuiltinType::Char_U:
12373 case BuiltinType::Char_S:
12374 case BuiltinType::SChar:
12375 case BuiltinType::Char8:
12377 case BuiltinType::Short:
12379 case BuiltinType::Int:
12381 case BuiltinType::Long:
12383 case BuiltinType::LongLong:
12385 case BuiltinType::Int128:
12390 case BuiltinType::WChar_S:
12393 case BuiltinType::ShortAccum:
12395 case BuiltinType::Accum:
12397 case BuiltinType::LongAccum:
12399 case BuiltinType::SatShortAccum:
12401 case BuiltinType::SatAccum:
12403 case BuiltinType::SatLongAccum:
12405 case BuiltinType::ShortFract:
12407 case BuiltinType::Fract:
12409 case BuiltinType::LongFract:
12411 case BuiltinType::SatShortFract:
12413 case BuiltinType::SatFract:
12415 case BuiltinType::SatLongFract:
12418 assert((T->hasUnsignedIntegerRepresentation() ||
12419 T->isUnsignedFixedPointType()) &&
12420 "Unexpected signed integer or fixed point type");
12426 assert((T->hasIntegerRepresentation() || T->isEnumeralType() ||
12427 T->isFixedPointType()) &&
12428 "Unexpected type");
12431 if (
const auto *VTy = T->getAs<
VectorType>())
12433 VTy->getNumElements(), VTy->getVectorKind());
12436 if (
const auto *EITy = T->getAs<
BitIntType>())
12441 if (
const auto *ED = T->getAsEnumDecl())
12442 T = ED->getIntegerType();
12445 case BuiltinType::Char_S:
12447 case BuiltinType::Char_U:
12448 case BuiltinType::UChar:
12449 case BuiltinType::Char8:
12451 case BuiltinType::UShort:
12453 case BuiltinType::UInt:
12455 case BuiltinType::ULong:
12457 case BuiltinType::ULongLong:
12459 case BuiltinType::UInt128:
12464 case BuiltinType::WChar_U:
12467 case BuiltinType::UShortAccum:
12469 case BuiltinType::UAccum:
12471 case BuiltinType::ULongAccum:
12473 case BuiltinType::SatUShortAccum:
12475 case BuiltinType::SatUAccum:
12477 case BuiltinType::SatULongAccum:
12479 case BuiltinType::UShortFract:
12481 case BuiltinType::UFract:
12483 case BuiltinType::ULongFract:
12485 case BuiltinType::SatUShortFract:
12487 case BuiltinType::SatUFract:
12489 case BuiltinType::SatULongFract:
12493 (T->hasSignedIntegerRepresentation() || T->isSignedFixedPointType()) &&
12494 "Unexpected signed integer or fixed point type");
12519 bool AllowTypeModifiers) {
12523 RequiresICE =
false;
12528 bool IsSpecial =
false;
12532 default: Done =
true; --Str;
break;
12534 RequiresICE =
true;
12537 assert(!
Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
12538 assert(!
Signed &&
"Can't use 'S' modifier multiple times!");
12542 assert(!
Signed &&
"Can't use both 'S' and 'U' modifiers!");
12543 assert(!
Unsigned &&
"Can't use 'U' modifier multiple times!");
12547 assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
12548 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
12553 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12554 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
12558 if (Context.getTargetInfo().getLongWidth() == 32)
12563 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12564 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
12568 switch (Context.getTargetInfo().getInt64Type()) {
12570 llvm_unreachable(
"Unexpected integer type");
12581 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12582 assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
12586 switch (Context.getTargetInfo().getIntTypeByWidth(32,
true)) {
12588 llvm_unreachable(
"Unexpected integer type");
12601 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12602 assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
12606 if (Context.getLangOpts().OpenCL)
12619 llvm_unreachable(
"Unknown builtin type letter!");
12622 "Bad modifiers used with 'x'!");
12623 Type = Context.Float16Ty;
12627 "Bad modifiers used with 'y'!");
12628 Type = Context.BFloat16Ty;
12632 "Bad modifiers used with 'v'!");
12633 Type = Context.VoidTy;
12637 "Bad modifiers used with 'h'!");
12638 Type = Context.HalfTy;
12642 "Bad modifiers used with 'f'!");
12643 Type = Context.FloatTy;
12647 "Bad modifiers used with 'd'!");
12649 Type = Context.LongDoubleTy;
12650 else if (HowLong == 2)
12651 Type = Context.Float128Ty;
12653 Type = Context.DoubleTy;
12656 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
12658 Type = Context.UnsignedShortTy;
12660 Type = Context.ShortTy;
12664 Type =
Unsigned ? Context.UnsignedInt128Ty : Context.Int128Ty;
12665 else if (HowLong == 2)
12666 Type =
Unsigned ? Context.UnsignedLongLongTy : Context.LongLongTy;
12667 else if (HowLong == 1)
12668 Type =
Unsigned ? Context.UnsignedLongTy : Context.LongTy;
12670 Type =
Unsigned ? Context.UnsignedIntTy : Context.IntTy;
12673 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
12675 Type = Context.SignedCharTy;
12677 Type = Context.UnsignedCharTy;
12679 Type = Context.CharTy;
12682 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'b'!");
12683 Type = Context.BoolTy;
12686 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'z'!");
12687 Type = Context.getSizeType();
12690 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'w'!");
12691 Type = Context.getWideCharType();
12694 Type = Context.getCFConstantStringType();
12697 Type = Context.getObjCIdType();
12700 Type = Context.getObjCSelType();
12703 Type = Context.getObjCSuperType();
12706 Type = Context.getBuiltinVaListType();
12707 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
12718 Type = Context.getBuiltinVaListType();
12719 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
12721 Type = Context.getArrayDecayedType(
Type);
12723 Type = Context.getLValueReferenceType(
Type);
12727 unsigned NumElements = strtoul(Str, &End, 10);
12728 assert(End != Str &&
"Missing vector size");
12732 RequiresICE,
false);
12733 assert(!RequiresICE &&
"Can't require vector ICE");
12735 Type = Context.getScalableVectorType(ElementType, NumElements);
12741 Type = Context.SveCountTy;
12745 Type = Context.AMDGPUBufferRsrcTy;
12749 Type = Context.AMDGPUFeaturePredicateTy;
12753 Type = Context.AMDGPUTextureTy;
12757 Type = Context.HLSLResourceTy;
12761 llvm_unreachable(
"Unexpected target builtin type");
12767 unsigned NumElements = strtoul(Str, &End, 10);
12768 assert(End != Str &&
"Missing vector size");
12772 RequiresICE,
false);
12773 assert(!RequiresICE &&
"Can't require vector ICE");
12782 unsigned NumElements = strtoul(Str, &End, 10);
12783 assert(End != Str &&
"Missing vector size");
12789 Type = Context.getExtVectorType(ElementType, NumElements);
12795 assert(!RequiresICE &&
"Can't require complex ICE");
12796 Type = Context.getComplexType(ElementType);
12800 Type = Context.getPointerDiffType();
12803 Type = Context.getFILEType();
12804 if (
Type.isNull()) {
12811 Type = Context.getsigjmp_bufType();
12813 Type = Context.getjmp_bufType();
12815 if (
Type.isNull()) {
12821 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'K'!");
12822 Type = Context.getucontext_tType();
12824 if (
Type.isNull()) {
12830 Type = Context.getProcessIDType();
12833 Type = Context.MFloat8Ty;
12838 Done = !AllowTypeModifiers;
12840 switch (
char c = *Str++) {
12841 default: Done =
true; --Str;
break;
12847 unsigned AddrSpace = strtoul(Str, &End, 10);
12850 Type = Context.getAddrSpaceQualType(
12852 Context.getLangASForBuiltinAddressSpace(AddrSpace));
12856 Type = Context.getPointerType(
Type);
12858 Type = Context.getLValueReferenceType(
Type);
12866 Type = Context.getVolatileType(
Type);
12875 "Integer constant 'I' type must be an integer");
12888 bool AllowTypeModifiers)
const {
12895 unsigned *IntegerConstantArgs)
const {
12896 const char *TypeStr =
BuiltinInfo.getTypeString(Id);
12897 if (TypeStr[0] ==
'\0') {
12904 bool RequiresICE =
false;
12907 RequiresICE,
true);
12911 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
12913 while (TypeStr[0] && TypeStr[0] !=
'.') {
12920 if (RequiresICE && IntegerConstantArgs)
12921 *IntegerConstantArgs |= 1 << ArgTypes.size();
12927 ArgTypes.push_back(Ty);
12930 if (Id == Builtin::BI__GetExceptionInfo)
12933 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
12934 "'.' should only occur at end of builtin type list!");
12936 bool Variadic = (TypeStr[0] ==
'.');
12943 if (ArgTypes.empty() && Variadic && !
getLangOpts().requiresStrictPrototypes())
12993 if ((!Context.getLangOpts().CPlusPlus &&
12994 !Context.getTargetInfo().getCXXABI().isMicrosoft() &&
12995 !FD->
hasAttr<DLLExportAttr>()) ||
12996 FD->
hasAttr<GNUInlineAttr>()) {
13014 if (Context.getTargetInfo().getCXXABI().isMicrosoft() &&
13017 !FD->
hasAttr<DLLExportAttr>()) {
13038 if (D->
hasAttr<DLLImportAttr>()) {
13041 }
else if (D->
hasAttr<DLLExportAttr>()) {
13044 }
else if (Context.getLangOpts().CUDA && Context.getLangOpts().CUDAIsDevice) {
13047 if (D->
hasAttr<CUDAGlobalAttr>() &&
13056 if (Context.shouldExternalize(D))
13071 switch (Source->hasExternalDefinitions(D)) {
13098 if (Context.getLangOpts().CPlusPlus &&
13099 Context.getLangOpts().IncrementalExtensions &&
13115 if (!LexicalContext)
13120 auto StaticLocalLinkage =
13132 return StaticLocalLinkage;
13138 if (Context.isMSStaticDataMemberInlineDefinition(VD))
13144 switch (Context.getInlineVariableDefinitionKind(VD)) {
13159 return StrongLinkage;
13162 return Context.getTargetInfo().getCXXABI().isMicrosoft() &&
13177 llvm_unreachable(
"Invalid Linkage!");
13187 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
13188 if (!VD->isFileVarDecl())
13193 if (VD->getDescribedVarTemplate() ||
13196 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
13222 if (D->
hasAttr<WeakRefAttr>())
13229 if (LangOpts.SYCLIsDevice)
13231 D->
hasAttr<SYCLExternalAttr>());
13237 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
13239 if (!FD->doesThisDeclarationHaveABody())
13240 return FD->doesDeclarationForceExternallyVisibleDefinition();
13243 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
13248 if (
getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {
13249 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
13268 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
13272 if (LangOpts.OpenMP &&
13273 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
13280 if (VD->shouldEmitInExternalSource())
13293 if (VD->needsDestruction(*
this))
13297 if (VD->hasInitWithSideEffects())
13302 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD)) {
13303 for (
const auto *BD : DD->flat_bindings())
13304 if (
const auto *BindingVD = BD->getHoldingVar())
13314 llvm::function_ref<
void(
FunctionDecl *)> Pred)
const {
13315 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
13316 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
13321 for (
auto *CurDecl :
13325 SeenDecls.insert(CurFD).second) {
13332 bool IsCXXMethod)
const {
13335 return ABI->getDefaultMethodCallConv(IsVariadic);
13337 switch (LangOpts.getDefaultCallingConv()) {
13365 return Target->getDefaultCallingConv();
13370 return ABI->isNearlyEmpty(RD);
13375 auto ABI = Target->getCXXABI();
13376 if (ABI.isMicrosoft())
13382 return VTContext.get();
13388 switch (T->getCXXABI().getKind()) {
13389 case TargetCXXABI::AppleARM64:
13390 case TargetCXXABI::Fuchsia:
13391 case TargetCXXABI::GenericAArch64:
13392 case TargetCXXABI::GenericItanium:
13393 case TargetCXXABI::GenericARM:
13394 case TargetCXXABI::GenericMIPS:
13395 case TargetCXXABI::iOS:
13396 case TargetCXXABI::WebAssembly:
13397 case TargetCXXABI::WatchOS:
13398 case TargetCXXABI::XL:
13400 case TargetCXXABI::Microsoft:
13403 llvm_unreachable(
"Unsupported ABI");
13407 assert(T.getCXXABI().getKind() != TargetCXXABI::Microsoft &&
13408 "Device mangle context does not support Microsoft mangling.");
13409 switch (T.getCXXABI().getKind()) {
13410 case TargetCXXABI::AppleARM64:
13411 case TargetCXXABI::Fuchsia:
13412 case TargetCXXABI::GenericAArch64:
13413 case TargetCXXABI::GenericItanium:
13414 case TargetCXXABI::GenericARM:
13415 case TargetCXXABI::GenericMIPS:
13416 case TargetCXXABI::iOS:
13417 case TargetCXXABI::WebAssembly:
13418 case TargetCXXABI::WatchOS:
13419 case TargetCXXABI::XL:
13423 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND))
13424 return RD->getDeviceLambdaManglingNumber();
13425 return std::nullopt;
13428 case TargetCXXABI::Microsoft:
13432 llvm_unreachable(
"Unsupported ABI");
13450 return ASTRecordLayouts.getMemorySize() +
13451 llvm::capacity_in_bytes(ObjCLayouts) +
13452 llvm::capacity_in_bytes(KeyFunctions) +
13453 llvm::capacity_in_bytes(ObjCImpls) +
13454 llvm::capacity_in_bytes(BlockVarCopyInits) +
13455 llvm::capacity_in_bytes(DeclAttrs) +
13456 llvm::capacity_in_bytes(TemplateOrInstantiation) +
13457 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
13458 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
13459 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
13460 llvm::capacity_in_bytes(OverriddenMethods) +
13461 llvm::capacity_in_bytes(Types) +
13462 llvm::capacity_in_bytes(VariableArrayTypes);
13470 unsigned Signed)
const {
13473 if (!QualTy && DestWidth == 128)
13502 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
13509 MangleNumbers[ND] = Number;
13512 Listener->AddedManglingNumber(ND, Number);
13516 bool ForAuxTarget)
const {
13517 auto I = MangleNumbers.find(ND);
13518 unsigned Res = I != MangleNumbers.end() ? I->second : 1;
13521 if (LangOpts.CUDA && !LangOpts.CUDAIsDevice) {
13522 Res = ForAuxTarget ? Res >> 16 : Res & 0xFFFF;
13524 assert(!ForAuxTarget &&
"Only CUDA/HIP host compilation supports mangling "
13525 "number for aux target");
13527 return Res > 1 ? Res : 1;
13534 StaticLocalNumbers[VD] = Number;
13537 Listener->AddedStaticLocalNumbers(VD, Number);
13541 auto I = StaticLocalNumbers.find(VD);
13542 return I != StaticLocalNumbers.end() ? I->second : 1;
13546 bool IsDestroying) {
13547 if (!IsDestroying) {
13559 bool IsTypeAware) {
13560 if (!IsTypeAware) {
13599 return GlobalOperatorDeletesForVirtualDtor.contains(
13602 return ArrayOperatorDeletesForVirtualDtor.contains(
13605 return GlobalArrayOperatorDeletesForVirtualDtor.contains(
13617 if (OperatorDeletesForVirtualDtor.contains(Canon))
13618 return OperatorDeletesForVirtualDtor[Canon];
13621 if (GlobalOperatorDeletesForVirtualDtor.contains(Canon))
13622 return GlobalOperatorDeletesForVirtualDtor[Canon];
13625 if (ArrayOperatorDeletesForVirtualDtor.contains(Canon))
13626 return ArrayOperatorDeletesForVirtualDtor[Canon];
13629 if (GlobalArrayOperatorDeletesForVirtualDtor.contains(Canon))
13630 return GlobalArrayOperatorDeletesForVirtualDtor[Canon];
13641 return MaybeRequireVectorDeletingDtor.count(RD);
13649 MaybeRequireVectorDeletingDtor.insert(RD);
13654 assert(LangOpts.CPlusPlus);
13655 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
13663 assert(LangOpts.CPlusPlus);
13664 std::unique_ptr<MangleNumberingContext> &MCtx =
13665 ExtraMangleNumberingContexts[D];
13671std::unique_ptr<MangleNumberingContext>
13673 return ABI->createMangleNumberingContext();
13678 return ABI->getCopyConstructorForExceptionObject(
13684 return ABI->addCopyConstructorForExceptionObject(
13691 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
13696 return ABI->getTypedefNameForUnnamedTagDecl(TD);
13701 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
13705 return ABI->getDeclaratorForUnnamedTagDecl(TD);
13709 ParamIndices[D] =
index;
13713 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
13714 assert(I != ParamIndices.end() &&
13715 "ParmIndices lacks entry set by ParmVarDecl");
13720 unsigned Length)
const {
13746 assert(
MSGuidTagDecl &&
"building MS GUID without MS extensions?");
13748 llvm::FoldingSetNodeID ID;
13752 if (
MSGuidDecl *Existing = MSGuidDecls.FindNodeOrInsertPos(ID, InsertPos))
13756 MSGuidDecl *
New = MSGuidDecl::Create(*
this, GUIDType, Parts);
13757 MSGuidDecls.InsertNode(
New, InsertPos);
13763 const APValue &APVal)
const {
13764 llvm::FoldingSetNodeID ID;
13769 UnnamedGlobalConstantDecls.FindNodeOrInsertPos(ID, InsertPos))
13773 UnnamedGlobalConstantDecl::Create(*
this, Ty, APVal);
13774 UnnamedGlobalConstantDecls.InsertNode(
New, InsertPos);
13780 assert(T->isRecordType() &&
"template param object of unexpected type");
13786 llvm::FoldingSetNodeID ID;
13791 TemplateParamObjectDecls.FindNodeOrInsertPos(ID, InsertPos))
13795 TemplateParamObjectDecls.InsertNode(
New, InsertPos);
13801 if (!T.isOSDarwin())
13804 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
13805 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
13814 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
13821 if (MethodDecl->
hasAttr<UnavailableAttr>()
13822 || MethodDecl->
hasAttr<DeprecatedAttr>())
13836 IM != EM && IF != EF; ++IM, ++IF) {
13867 llvm::FoldingSetNodeID IDX, IDY;
13868 X->Profile(IDX, *
this,
true);
13869 Y->
Profile(IDY, *
this,
true);
13883 for (
const Decl *DX :
X->redecls()) {
13888 if (DX->isFirstDecl())
13891 llvm_unreachable(
"Corrupt redecls chain");
13894template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
13896 return cast_or_null<T>(
13898 const_cast<Decl *
>(cast_or_null<Decl>(Y))));
13901template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
13909 bool IgnoreDeduced =
false) {
13924 bool IgnoreDeduced) {
13926 assert(R.getAsVoidPointer() !=
nullptr);
13932 assert(Xs.size() == Ys.size());
13934 for (
size_t I = 0; I < Rs.size(); ++I)
13941 return X->getAttributeLoc() == Y->getAttributeLoc() ?
X->getAttributeLoc()
13951 switch (
X.getKind()) {
13981 auto NExpX =
X.getNumTemplateExpansions();
13995 if (Xs.size() != Ys.size())
13997 R.resize(Xs.size());
13998 for (
size_t I = 0; I < R.size(); ++I) {
14011 assert(!Different);
14039 assert(!IsSame &&
"Should be the same NestedNameSpecifier");
14041 return std::nullopt;
14046 assert(Kind == NNS2.
getKind());
14051 auto Kind = Namespace1->getKind();
14052 if (Kind != Namespace2->getKind() ||
14053 (Kind == Decl::NamespaceAlias &&
14058 Namespace2->getNamespace()),
14092 llvm_unreachable(
"singletons did not compare equal");
14094 assert(R.getCanonical() == Canon);
14100 const T *Y,
bool IsSame) {
14101 return ::getCommonNNS(Ctx,
X->getQualifier(), Y->getQualifier(), IsSame);
14121 QX +=
X.getQualifiers() - RQ;
14131 Y->getElementType(), QX, QY);
14142 assert(Ctx.
hasSameExpr(
X->getSizeExpr(), Y->getSizeExpr()));
14143 return X->getSizeExpr();
14148 return X->getSizeModifier();
14154 return X->getIndexTypeCVRQualifiers();
14164 llvm::DenseMap<QualType, unsigned>
Found;
14165 for (
auto Ts : {
X, Y}) {
14172 Out.emplace_back(T);
14178FunctionProtoType::ExceptionSpecInfo
14182 bool AcceptDependent)
const {
14208 assert(AcceptDependent &&
14209 "computing composite pointer type of dependent types");
14224 llvm_unreachable(
"These ESTs should be handled above");
14229 assert(EST2 ==
EST_Dynamic &&
"other cases should already be handled");
14233 Result.Exceptions = ExceptionTypeStorage;
14240 llvm_unreachable(
"shouldn't see unresolved exception specifications here");
14243 llvm_unreachable(
"invalid ExceptionSpecificationType");
14252#define UNEXPECTED_TYPE(Class, Kind) \
14253 case Type::Class: \
14254 llvm_unreachable("Unexpected " Kind ": " #Class);
14256#define NON_CANONICAL_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "non-canonical")
14257#define TYPE(Class, Base)
14258#include "clang/AST/TypeNodes.inc"
14260#define SUGAR_FREE_TYPE(Class) UNEXPECTED_TYPE(Class, "sugar-free")
14271#undef SUGAR_FREE_TYPE
14272#define NON_UNIQUE_TYPE(Class) UNEXPECTED_TYPE(Class, "non-unique")
14275#undef NON_UNIQUE_TYPE
14279#undef UNEXPECTED_TYPE
14283 assert(AX->getDeducedKind() == AY->getDeducedKind());
14285 assert(AX->getKeyword() == AY->getKeyword());
14287 AY->getTypeConstraintConcept());
14291 AY->getTypeConstraintArguments())) {
14298 case Type::IncompleteArray: {
14305 case Type::DependentSizedArray: {
14313 case Type::ConstantArray: {
14316 assert(AX->getSize() == AY->getSize());
14317 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
14318 ? AX->getSizeExpr()
14324 case Type::ArrayParameter: {
14327 assert(AX->getSize() == AY->getSize());
14328 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
14329 ? AX->getSizeExpr()
14336 case Type::Atomic: {
14341 case Type::Complex: {
14345 case Type::Pointer: {
14349 case Type::BlockPointer: {
14353 case Type::ObjCObjectPointer: {
14358 case Type::MemberPointer: {
14362 PY->getMostRecentCXXRecordDecl()));
14366 PX->getMostRecentCXXRecordDecl());
14368 case Type::LValueReference: {
14373 PX->isSpelledAsLValue() ||
14374 PY->isSpelledAsLValue());
14376 case Type::RValueReference: {
14382 case Type::DependentAddressSpace: {
14385 assert(Ctx.
hasSameExpr(PX->getAddrSpaceExpr(), PY->getAddrSpaceExpr()));
14387 PX->getAddrSpaceExpr(),
14390 case Type::FunctionNoProto: {
14393 assert(FX->getExtInfo() == FY->getExtInfo());
14398 case Type::FunctionProto: {
14402 EPIY = FY->getExtProtoInfo();
14403 assert(EPIX.
ExtInfo == EPIY.ExtInfo);
14410 assert(EPIX.
TypeQuals == EPIY.TypeQuals);
14411 assert(EPIX.
Variadic == EPIY.Variadic);
14420 auto P =
getCommonTypes(Ctx, FX->param_types(), FY->param_types(),
14428 case Type::ObjCObject: {
14431 std::equal(OX->getProtocols().begin(), OX->getProtocols().end(),
14432 OY->getProtocols().begin(), OY->getProtocols().end(),
14434 return P0->getCanonicalDecl() == P1->getCanonicalDecl();
14436 "protocol lists must be the same");
14438 OY->getTypeArgsAsWritten());
14441 OX->getProtocols(),
14442 OX->isKindOfTypeAsWritten() && OY->isKindOfTypeAsWritten());
14444 case Type::ConstantMatrix: {
14447 assert(MX->getNumRows() == MY->getNumRows());
14448 assert(MX->getNumColumns() == MY->getNumColumns());
14450 MX->getNumRows(), MX->getNumColumns());
14452 case Type::DependentSizedMatrix: {
14455 assert(Ctx.
hasSameExpr(MX->getRowExpr(), MY->getRowExpr()));
14456 assert(Ctx.
hasSameExpr(MX->getColumnExpr(), MY->getColumnExpr()));
14461 case Type::Vector: {
14463 assert(VX->getNumElements() == VY->getNumElements());
14464 assert(VX->getVectorKind() == VY->getVectorKind());
14466 VX->getNumElements(), VX->getVectorKind());
14468 case Type::ExtVector: {
14470 assert(VX->getNumElements() == VY->getNumElements());
14472 VX->getNumElements());
14474 case Type::DependentSizedExtVector: {
14481 case Type::DependentVector: {
14484 assert(VX->getVectorKind() == VY->getVectorKind());
14491 case Type::InjectedClassName: {
14498 case Type::TemplateSpecialization: {
14502 TY->template_arguments());
14506 TY->getTemplateName(),
14508 As, {},
X->getCanonicalTypeInternal());
14510 case Type::Decltype: {
14513 assert(DX->isDependentType());
14514 assert(DY->isDependentType());
14515 assert(Ctx.
hasSameExpr(DX->getUnderlyingExpr(), DY->getUnderlyingExpr()));
14519 case Type::PackIndexing: {
14522 assert(DX->isDependentType());
14523 assert(DY->isDependentType());
14524 assert(Ctx.
hasSameExpr(DX->getIndexExpr(), DY->getIndexExpr()));
14527 case Type::DependentName: {
14530 assert(NX->getIdentifier() == NY->getIdentifier());
14535 case Type::OverflowBehavior: {
14538 assert(NX->getBehaviorKind() == NY->getBehaviorKind());
14540 NX->getBehaviorKind(),
14542 NY->getUnderlyingType(), QX, QY));
14544 case Type::UnaryTransform: {
14547 assert(TX->getUTTKind() == TY->getUTTKind());
14551 TY->getUnderlyingType()),
14554 case Type::PackExpansion: {
14557 assert(PX->getNumExpansions() == PY->getNumExpansions());
14560 PX->getNumExpansions(),
false);
14564 assert(PX->isReadOnly() == PY->isReadOnly());
14569 case Type::TemplateTypeParm: {
14572 assert(TX->getDepth() == TY->getDepth());
14573 assert(TX->getIndex() == TY->getIndex());
14574 assert(TX->isParameterPack() == TY->isParameterPack());
14576 TX->getDepth(), TX->getIndex(), TX->isParameterPack(),
14580 llvm_unreachable(
"Unknown Type Class");
14590#define UNEXPECTED_TYPE(Class, Kind) \
14591 case Type::Class: \
14592 llvm_unreachable("Unexpected " Kind ": " #Class);
14593#define TYPE(Class, Base)
14594#define DEPENDENT_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "dependent")
14595#include "clang/AST/TypeNodes.inc"
14597#define CANONICAL_TYPE(Class) UNEXPECTED_TYPE(Class, "canonical")
14624#undef CANONICAL_TYPE
14626#undef UNEXPECTED_TYPE
14628 case Type::Adjusted: {
14630 QualType OX = AX->getOriginalType(), OY = AY->getOriginalType();
14637 case Type::Decayed: {
14639 QualType OX = DX->getOriginalType(), OY = DY->getOriginalType();
14646 case Type::Attributed: {
14648 AttributedType::Kind Kind = AX->getAttrKind();
14649 if (Kind != AY->getAttrKind())
14651 QualType MX = AX->getModifiedType(), MY = AY->getModifiedType();
14659 case Type::BTFTagAttributed: {
14661 const BTFTypeTagAttr *AX = BX->getAttr();
14663 if (AX->getBTFTypeTag() !=
14674 if (KW != AY->getKeyword())
14678 AY->getTypeConstraintConcept());
14682 AY->getTypeConstraintArguments())) {
14693 case Type::PackIndexing:
14694 case Type::Decltype:
14696 case Type::DeducedTemplateSpecialization:
14699 case Type::MacroQualified: {
14703 if (IX != MY->getMacroIdentifier())
14707 case Type::SubstTemplateTypeParm: {
14714 unsigned Index = SX->getIndex();
14715 if (Index != SY->getIndex())
14717 auto PackIndex = SX->getPackIndex();
14718 if (PackIndex != SY->getPackIndex())
14721 CD, Index, PackIndex,
14722 SX->getFinal() && SY->getFinal());
14724 case Type::ObjCTypeParam:
14730 case Type::TemplateSpecialization: {
14735 TY->getTemplateName(),
true);
14740 TY->template_arguments()))
14746 case Type::Typedef: {
14756 case Type::TypeOf: {
14767 case Type::TypeOfExpr:
14770 case Type::UnaryTransform: {
14773 UnaryTransformType::UTTKind KX = UX->getUTTKind();
14774 if (KX != UY->getUTTKind())
14776 QualType BX = UX->getBaseType(), BY = UY->getBaseType();
14783 case Type::Using: {
14792 case Type::MemberPointer: {
14796 assert(Cls == PY->getMostRecentCXXRecordDecl());
14801 case Type::CountAttributed: {
14804 if (DX->isCountInBytes() != DY->isCountInBytes())
14806 if (DX->isOrNull() != DY->isOrNull())
14808 Expr *CEX = DX->getCountExpr();
14809 Expr *CEY = DY->getCountExpr();
14813 DX->isCountInBytes(), DX->isOrNull(),
14824 DX->isCountInBytes(), DX->isOrNull(),
14827 case Type::PredefinedSugar:
14832 llvm_unreachable(
"Unhandled Type Class");
14854 if (
X.isCanonical())
14881 bool KeepCommonQualifiers =
14884 if (SX.
Ty != SY.Ty) {
14892 while (!Xs.empty() && !Ys.empty() && Xs.back().Ty == Ys.back().Ty) {
14895 SX = Xs.pop_back_val();
14896 SY = Ys.pop_back_val();
14899 if (KeepCommonQualifiers)
14906 while (!Xs.empty() && !Ys.empty()) {
14909 SX = Xs.pop_back_val();
14910 SY = Ys.pop_back_val();
14915 SX.
Ty = Underlying.Ty;
14918 QX -= Underlying.Quals;
14936 llvm_unreachable(
"Not a saturated fixed point type!");
14937 case BuiltinType::SatShortAccum:
14939 case BuiltinType::SatAccum:
14941 case BuiltinType::SatLongAccum:
14943 case BuiltinType::SatUShortAccum:
14945 case BuiltinType::SatUAccum:
14947 case BuiltinType::SatULongAccum:
14949 case BuiltinType::SatShortFract:
14951 case BuiltinType::SatFract:
14953 case BuiltinType::SatLongFract:
14955 case BuiltinType::SatUShortFract:
14957 case BuiltinType::SatUFract:
14959 case BuiltinType::SatULongFract:
14971 llvm_unreachable(
"Not a fixed point type!");
14972 case BuiltinType::ShortAccum:
14974 case BuiltinType::Accum:
14976 case BuiltinType::LongAccum:
14978 case BuiltinType::UShortAccum:
14980 case BuiltinType::UAccum:
14982 case BuiltinType::ULongAccum:
14984 case BuiltinType::ShortFract:
14986 case BuiltinType::Fract:
14988 case BuiltinType::LongFract:
14990 case BuiltinType::UShortFract:
14992 case BuiltinType::UFract:
14994 case BuiltinType::ULongFract:
15000 if (LangOpts.OpenCL)
15024 llvm_unreachable(
"Not a fixed point type!");
15025 case BuiltinType::ShortAccum:
15026 case BuiltinType::SatShortAccum:
15027 return Target.getShortAccumScale();
15028 case BuiltinType::Accum:
15029 case BuiltinType::SatAccum:
15030 return Target.getAccumScale();
15031 case BuiltinType::LongAccum:
15032 case BuiltinType::SatLongAccum:
15033 return Target.getLongAccumScale();
15034 case BuiltinType::UShortAccum:
15035 case BuiltinType::SatUShortAccum:
15036 return Target.getUnsignedShortAccumScale();
15037 case BuiltinType::UAccum:
15038 case BuiltinType::SatUAccum:
15039 return Target.getUnsignedAccumScale();
15040 case BuiltinType::ULongAccum:
15041 case BuiltinType::SatULongAccum:
15042 return Target.getUnsignedLongAccumScale();
15043 case BuiltinType::ShortFract:
15044 case BuiltinType::SatShortFract:
15045 return Target.getShortFractScale();
15046 case BuiltinType::Fract:
15047 case BuiltinType::SatFract:
15048 return Target.getFractScale();
15049 case BuiltinType::LongFract:
15050 case BuiltinType::SatLongFract:
15051 return Target.getLongFractScale();
15052 case BuiltinType::UShortFract:
15053 case BuiltinType::SatUShortFract:
15054 return Target.getUnsignedShortFractScale();
15055 case BuiltinType::UFract:
15056 case BuiltinType::SatUFract:
15057 return Target.getUnsignedFractScale();
15058 case BuiltinType::ULongFract:
15059 case BuiltinType::SatULongFract:
15060 return Target.getUnsignedLongFractScale();
15070 llvm_unreachable(
"Not a fixed point type!");
15071 case BuiltinType::ShortAccum:
15072 case BuiltinType::SatShortAccum:
15073 return Target.getShortAccumIBits();
15074 case BuiltinType::Accum:
15075 case BuiltinType::SatAccum:
15076 return Target.getAccumIBits();
15077 case BuiltinType::LongAccum:
15078 case BuiltinType::SatLongAccum:
15079 return Target.getLongAccumIBits();
15080 case BuiltinType::UShortAccum:
15081 case BuiltinType::SatUShortAccum:
15082 return Target.getUnsignedShortAccumIBits();
15083 case BuiltinType::UAccum:
15084 case BuiltinType::SatUAccum:
15085 return Target.getUnsignedAccumIBits();
15086 case BuiltinType::ULongAccum:
15087 case BuiltinType::SatULongAccum:
15088 return Target.getUnsignedLongAccumIBits();
15089 case BuiltinType::ShortFract:
15090 case BuiltinType::SatShortFract:
15091 case BuiltinType::Fract:
15092 case BuiltinType::SatFract:
15093 case BuiltinType::LongFract:
15094 case BuiltinType::SatLongFract:
15095 case BuiltinType::UShortFract:
15096 case BuiltinType::SatUShortFract:
15097 case BuiltinType::UFract:
15098 case BuiltinType::SatUFract:
15099 case BuiltinType::ULongFract:
15100 case BuiltinType::SatULongFract:
15105llvm::FixedPointSemantics
15108 "Can only get the fixed point semantics for a "
15109 "fixed point or integer type.");
15111 return llvm::FixedPointSemantics::GetIntegerSemantics(
15115 return llvm::FixedPointSemantics(
15118 !isSigned &&
getTargetInfo().doUnsignedFixedPointTypesHavePadding());
15133 "Expected unsigned fixed point type");
15136 case BuiltinType::UShortAccum:
15138 case BuiltinType::UAccum:
15140 case BuiltinType::ULongAccum:
15142 case BuiltinType::SatUShortAccum:
15144 case BuiltinType::SatUAccum:
15146 case BuiltinType::SatULongAccum:
15148 case BuiltinType::UShortFract:
15150 case BuiltinType::UFract:
15152 case BuiltinType::ULongFract:
15154 case BuiltinType::SatUShortFract:
15156 case BuiltinType::SatUFract:
15158 case BuiltinType::SatULongFract:
15161 llvm_unreachable(
"Unexpected unsigned fixed point type");
15169 std::vector<std::string> BackendFeats;
15170 llvm::AArch64::ExtensionSet FeatureBits;
15171 for (StringRef F : FMVFeatStrings)
15172 if (
auto FMVExt = llvm::AArch64::parseFMVExtension(F))
15174 FeatureBits.enable(*FMVExt->ID);
15175 FeatureBits.toLLVMFeatureList(BackendFeats);
15176 return BackendFeats;
15181 assert(TD !=
nullptr);
15184 llvm::erase_if(
ParsedAttr.Features, [&](
const std::string &Feat) {
15185 return !Target->isValidFeatureName(StringRef{Feat}.substr(1));
15196 Target->getTargetOpts().CPU,
15197 Target->getTargetOpts().Features);
15204 StringRef TargetCPU = Target->getTargetOpts().CPU;
15206 if (
const auto *TD = FD->
getAttr<TargetAttr>()) {
15212 if (!Target->getTriple().isAArch64())
15215 Target->getTargetOpts().FeaturesAsWritten.begin(),
15216 Target->getTargetOpts().FeaturesAsWritten.end());
15227 }
else if (
const auto *SD = FD->
getAttr<CPUSpecificAttr>()) {
15229 Target->getCPUSpecificCPUDispatchFeatures(
15231 std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
15232 Features.insert(Features.begin(),
15233 Target->getTargetOpts().FeaturesAsWritten.begin(),
15234 Target->getTargetOpts().FeaturesAsWritten.end());
15235 Target->initFeatureMap(FeatureMap,
getDiagnostics(), TargetCPU, Features);
15236 }
else if (
const auto *TC = FD->
getAttr<TargetClonesAttr>()) {
15237 if (Target->getTriple().isAArch64()) {
15241 Features.insert(Features.begin(),
15242 Target->getTargetOpts().FeaturesAsWritten.begin(),
15243 Target->getTargetOpts().FeaturesAsWritten.end());
15244 Target->initFeatureMap(FeatureMap,
getDiagnostics(), TargetCPU, Features);
15245 }
else if (Target->getTriple().isRISCV()) {
15247 std::vector<std::string> Features;
15248 if (VersionStr !=
"default") {
15250 Features.insert(Features.begin(),
ParsedAttr.Features.begin(),
15253 Features.insert(Features.begin(),
15254 Target->getTargetOpts().FeaturesAsWritten.begin(),
15255 Target->getTargetOpts().FeaturesAsWritten.end());
15256 Target->initFeatureMap(FeatureMap,
getDiagnostics(), TargetCPU, Features);
15257 }
else if (Target->getTriple().isOSAIX()) {
15258 std::vector<std::string> Features;
15260 if (VersionStr.starts_with(
"cpu="))
15261 TargetCPU = VersionStr.drop_front(
sizeof(
"cpu=") - 1);
15263 assert(VersionStr ==
"default");
15264 Target->initFeatureMap(FeatureMap,
getDiagnostics(), TargetCPU, Features);
15266 std::vector<std::string> Features;
15268 if (VersionStr.starts_with(
"arch="))
15269 TargetCPU = VersionStr.drop_front(
sizeof(
"arch=") - 1);
15270 else if (VersionStr !=
"default")
15271 Features.push_back((StringRef{
"+"} + VersionStr).str());
15272 Target->initFeatureMap(FeatureMap,
getDiagnostics(), TargetCPU, Features);
15274 }
else if (
const auto *TV = FD->
getAttr<TargetVersionAttr>()) {
15275 std::vector<std::string> Features;
15276 if (Target->getTriple().isRISCV()) {
15278 Features.insert(Features.begin(),
ParsedAttr.Features.begin(),
15281 assert(Target->getTriple().isAArch64());
15283 TV->getFeatures(Feats);
15286 Features.insert(Features.begin(),
15287 Target->getTargetOpts().FeaturesAsWritten.begin(),
15288 Target->getTargetOpts().FeaturesAsWritten.end());
15289 Target->initFeatureMap(FeatureMap,
getDiagnostics(), TargetCPU, Features);
15291 FeatureMap = Target->getTargetOpts().FeatureMap;
15302 auto DeviceDiscriminatorOverrider =
15304 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND))
15306 return RD->getDeviceLambdaManglingNumber();
15307 return std::nullopt;
15310 Context, Context.getDiagnostics(), DeviceDiscriminatorOverrider)};
15318 std::string Buffer;
15319 Buffer.reserve(128);
15320 llvm::raw_string_ostream Out(Buffer);
15321 MC->mangleCanonicalTypeName(KernelNameType, Out);
15322 std::string KernelName = Out.str();
15324 return {KernelNameType, FD, KernelName};
15333 const auto *SKEPAttr = FD->
getAttr<SYCLKernelEntryPointAttr>();
15334 assert(SKEPAttr &&
"Missing sycl_kernel_entry_point attribute");
15343 "SYCL kernel name conflict");
15358 return &IT->second;
15364 return *OMPTraitInfoVector.back();
15371 return DB << Section.
Decl;
15372 return DB <<
"a prior #pragma section";
15376 bool IsInternalVar =
15379 bool IsExplicitDeviceVar = (D->
hasAttr<CUDADeviceAttr>() &&
15380 !D->
getAttr<CUDADeviceAttr>()->isImplicit()) ||
15381 (D->
hasAttr<CUDAConstantAttr>() &&
15382 !D->
getAttr<CUDAConstantAttr>()->isImplicit());
15386 return (IsInternalVar &&
15387 (D->
hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) ||
15388 (D->
hasAttr<CUDAGlobalAttr>() &&
15395 (D->
hasAttr<HIPManagedAttr>() || D->
hasAttr<CUDAGlobalAttr>() ||
15400 if (!CUIDHash.empty())
15402 if (LangOpts.CUID.empty())
15403 return StringRef();
15404 CUIDHash = llvm::utohexstr(llvm::MD5Hash(LangOpts.CUID),
true);
15414 assert(PrimaryBase);
15417 auto Base = Layout.getPrimaryBase();
15418 if (!
Base ||
Base == PrimaryBase || !
Base->isPolymorphic())
15420 PrimaryBase =
Base;
15422 return PrimaryBase;
15426 StringRef MangledName) {
15428 assert(
Method->isVirtual());
15429 bool DefaultIncludesPointerAuth =
15430 LangOpts.PointerAuthCalls || LangOpts.PointerAuthIntrinsics;
15432 if (!DefaultIncludesPointerAuth)
15435 auto Existing = ThunksToBeAbbreviated.find(VirtualMethodDecl);
15436 if (Existing != ThunksToBeAbbreviated.end())
15437 return Existing->second.contains(MangledName.str());
15440 llvm::StringMap<llvm::SmallVector<std::string, 2>> Thunks;
15442 if (
const auto *ThunkInfos = VtableContext->getThunkInfo(VirtualMethodDecl)) {
15444 for (
const auto &Thunk : *ThunkInfos) {
15446 llvm::raw_svector_ostream ElidedNameStream(ElidedName);
15452 Mangler->mangleThunk(
Method, Thunk,
true,
15455 llvm::raw_svector_ostream mangledNameStream(MangledName);
15459 mangledNameStream);
15461 Mangler->mangleThunk(
Method, Thunk,
false,
15462 mangledNameStream);
15464 Thunks[ElidedName].push_back(std::string(MangledName));
15467 llvm::StringSet<> SimplifiedThunkNames;
15468 for (
auto &ThunkList : Thunks) {
15469 llvm::sort(ThunkList.second);
15470 SimplifiedThunkNames.insert(ThunkList.second[0]);
15472 bool Result = SimplifiedThunkNames.contains(MangledName);
15473 ThunksToBeAbbreviated[VirtualMethodDecl] = std::move(SimplifiedThunkNames);
15491 std::vector<PFPField> &Fields,
bool IncludeVBases) {
15493 if (
auto *ElemDecl = AT->getElementType()->getAsCXXRecordDecl()) {
15495 for (
unsigned i = 0; i != AT->getSize(); ++i)
15512 Fields.push_back({FieldOffset, Field});
15519 if (
Base.isVirtual())
15526 if (IncludeVBases) {
15537 std::vector<PFPField> PFPFields;
15547 if (
auto *RD = dyn_cast<CXXRecordDecl>(FD->
getParent()))
15549 !FD->
hasAttr<NoFieldProtectionAttr>();
15554 auto *FD = dyn_cast<FieldDecl>(VD);
This file provides AST data structures related to concepts.
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl * > &Protocols)
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
static SourceLocation getCommonAttrLoc(const T *X, const T *Y)
static auto getCanonicalTemplateArguments(const ASTContext &C, ArrayRef< TemplateArgument > Args, bool &AnyNonCanonArgs)
static char getObjCEncodingForPrimitiveType(const ASTContext *C, const BuiltinType *BT)
static bool isSameQualifier(const NestedNameSpecifier X, const NestedNameSpecifier Y)
static bool unionHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static TypedefDecl * CreateHexagonBuiltinVaListDecl(const ASTContext *Context)
#define CANONICAL_TYPE(Class)
static ElaboratedTypeKeyword getCommonTypeKeyword(const T *X, const T *Y, bool IsSame)
static Decl * getCommonDecl(Decl *X, Decl *Y)
static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context, const Decl *D, GVALinkage L)
static bool isTypeTypedefedAsBOOL(QualType T)
static void EncodeBitField(const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
static QualType getCommonArrayElementType(const ASTContext &Ctx, const T *X, Qualifiers &QX, const T *Y, Qualifiers &QY)
#define SUGAR_FREE_TYPE(Class)
static SYCLKernelInfo BuildSYCLKernelInfo(ASTContext &Context, CanQualType KernelNameType, const FunctionDecl *FD)
static bool hasTemplateSpecializationInEncodedString(const Type *T, bool VisitBasesAndFields)
static void getIntersectionOfProtocols(ASTContext &Context, const ObjCInterfaceDecl *CommonBase, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, SmallVectorImpl< ObjCProtocolDecl * > &IntersectionSet)
getIntersectionOfProtocols - This routine finds the intersection of set of protocols inherited from t...
static bool areCompatMatrixTypes(const ConstantMatrixType *LHS, const ConstantMatrixType *RHS)
areCompatMatrixTypes - Return true if the two specified matrix types are compatible.
static TypedefDecl * CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context)
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
static bool canAssignObjCObjectTypes(ASTContext &ctx, QualType lhs, QualType rhs)
Determine whether the first type is a subtype of the second.
static const Type * getIntegerTypeForEnum(const EnumType *ET)
static bool hasSameCudaAttrs(const FunctionDecl *A, const FunctionDecl *B)
static TemplateName getCommonTemplateName(const ASTContext &Ctx, TemplateName X, TemplateName Y, bool IgnoreDeduced=false)
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
static auto * getCommonSizeExpr(const ASTContext &Ctx, T *X, T *Y)
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
static auto getCommonSizeModifier(const ArrayType *X, const ArrayType *Y)
static TemplateArgument getCommonTemplateArgument(const ASTContext &Ctx, const TemplateArgument &X, const TemplateArgument &Y)
static std::optional< int64_t > structHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static bool hasSameOverloadableAttrs(const FunctionDecl *A, const FunctionDecl *B)
Determine whether the attributes we can overload on are identical for A and B.
static T * getCommonDeclChecked(T *X, T *Y)
static NestedNameSpecifier getCommonNNS(const ASTContext &Ctx, NestedNameSpecifier NNS1, NestedNameSpecifier NNS2, bool IsSame)
Returns a NestedNameSpecifier which has only the common sugar present in both NNS1 and NNS2.
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
static int64_t getSubobjectOffset(const FieldDecl *Field, const ASTContext &Context, const clang::ASTRecordLayout &)
static QualType getCommonSugarTypeNode(const ASTContext &Ctx, const Type *X, const Type *Y, SplitQualType Underlying)
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
static QualType getCommonNonSugarTypeNode(const ASTContext &Ctx, const Type *X, Qualifiers &QX, const Type *Y, Qualifiers &QY)
static QualType mergeEnumWithInteger(ASTContext &Context, const EnumType *ET, QualType other, bool isBlockReturnType)
Given that we have an enum type and a non-enum type, try to merge them.
static GVALinkage adjustGVALinkageForExternalDefinitionKind(const ASTContext &Ctx, const Decl *D, GVALinkage L)
Adjust the GVALinkage for a declaration based on what an external AST source knows about whether ther...
static TypedefDecl * CreateSystemZBuiltinVaListDecl(const ASTContext *Context)
static std::optional< int64_t > getSubobjectSizeInBits(const FieldDecl *Field, const ASTContext &Context, bool CheckIfTriviallyCopyable)
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
#define NON_UNIQUE_TYPE(Class)
static TypedefDecl * CreateX86_64ABIBuiltinVaListDecl(const ASTContext *Context)
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
static ElaboratedTypeKeyword getCanonicalElaboratedTypeKeyword(ElaboratedTypeKeyword Keyword)
static QualType getCommonPointeeType(const ASTContext &Ctx, const T *X, const T *Y)
static auto getCommonIndexTypeCVRQualifiers(const ArrayType *X, const ArrayType *Y)
static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)
DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the pointer over the consume...
static TypedefDecl * CreateCharPtrBuiltinVaListDecl(const ASTContext *Context)
static bool areSortedAndUniqued(ArrayRef< ObjCProtocolDecl * > Protocols)
static TypeInfoChars getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
getConstantArrayInfoInChars - Performing the computation in CharUnits instead of in bits prevents ove...
static FloatingRank getFloatingRank(QualType T)
getFloatingRank - Return a relative rank for floating point types.
static bool getCommonTemplateArguments(const ASTContext &Ctx, SmallVectorImpl< TemplateArgument > &R, ArrayRef< TemplateArgument > Xs, ArrayRef< TemplateArgument > Ys)
static TypedefDecl * CreateXtensaABIBuiltinVaListDecl(const ASTContext *Context)
static QualType getCommonElementType(const ASTContext &Ctx, const T *X, const T *Y)
static void mergeTypeLists(const ASTContext &Ctx, SmallVectorImpl< QualType > &Out, ArrayRef< QualType > X, ArrayRef< QualType > Y)
static bool matchesPostDecrInWhile(const UnaryOperator *UO, ASTContext &Ctx)
For the purposes of overflow pattern exclusion, does this match the while(i–) pattern?
static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx, raw_ostream &OS, QualType QT)
Encode a function type for use in the discriminator of a function pointer type.
static std::optional< int64_t > structSubobjectsHaveUniqueObjectRepresentations(const RangeT &Subobjects, int64_t CurOffsetInBits, const ASTContext &Context, const clang::ASTRecordLayout &Layout, bool CheckIfTriviallyCopyable)
static uint64_t getRVVTypeSize(ASTContext &Context, const BuiltinType *Ty)
getRVVTypeSize - Return RVV vector register size.
static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal)
static TemplateName getCommonTemplateNameChecked(const ASTContext &Ctx, TemplateName X, TemplateName Y, bool IgnoreDeduced)
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
static std::string charUnitsToString(const CharUnits &CU)
static const TagDecl * getNonInjectedClassName(const TagDecl *TD)
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
static char ObjCEncodingForEnumDecl(const ASTContext *C, const EnumDecl *ED)
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl * > &Redeclared)
static QualType getCommonTypeWithQualifierLifting(const ASTContext &Ctx, QualType X, QualType Y, Qualifiers &QX, Qualifiers &QY)
static SmallVector< SourceLocation, 2 > getDeclLocsForCommentSearch(const Decl *D, SourceManager &SourceMgr)
static auto getCommonTypes(const ASTContext &Ctx, ArrayRef< QualType > Xs, ArrayRef< QualType > Ys, bool Unqualified=false)
static bool isCanonicalResultType(QualType T)
Determine whether T is canonical as the result type of a function.
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
static bool areCompatVectorTypes(const VectorType *LHS, const VectorType *RHS)
areCompatVectorTypes - Return true if the two specified vector types are compatible.
static TypedefDecl * CreateCharPtrNamedVaListDecl(const ASTContext *Context, StringRef Name)
static NestedNameSpecifier getCommonQualifier(const ASTContext &Ctx, const T *X, const T *Y, bool IsSame)
#define UNEXPECTED_TYPE(Class, Kind)
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
static bool primaryBaseHaseAddressDiscriminatedVTableAuthentication(const ASTContext &Context, const CXXRecordDecl *Class)
static std::vector< std::string > getFMVBackendFeaturesFor(const llvm::SmallVectorImpl< StringRef > &FMVFeatStrings)
Defines the clang::ASTContext interface.
#define BuiltinTemplate(BTName)
Provides definitions for the various language-specific address spaces.
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
Defines enum values for all the target-independent builtin functions.
static bool CanThrow(Expr *E, ASTContext &Ctx)
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 ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static const Decl * getCanonicalDecl(const Decl *D)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
llvm::MachO::Record Record
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Defines the clang::Module class, which describes a module in the source code.
static StringRef getTriple(const Command &Job)
Defines types useful for describing an Objective-C runtime.
*collection of selector each with an associated kind and an ordered *collection of selectors A selector has a kind
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
static QualType getUnderlyingType(const SubRegion *R)
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
static QualType getPointeeType(const MemRegion *R)
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
Defines the clang::TypeLoc interface and its subclasses.
C Language Family Type Representation.
__device__ __2f16 float c
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
@ GE_Missing_stdio
Missing a type from <stdio.h>
@ GE_Missing_ucontext
Missing a type from <ucontext.h>
@ GE_Missing_setjmp
Missing a type from <setjmp.h>
RawComment * getRawCommentForDeclNoCacheImpl(const Decl *D, const SourceLocation RepresentativeLocForDecl, const std::map< unsigned, RawComment * > &CommentsInFile) const
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
bool isMemberPointerToDerivedMember() const
const ValueDecl * getMemberPointerDecl() const
ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
MSGuidDecl * getMSGuidDecl(MSGuidDeclParts Parts) const
Return a declaration for the global GUID object representing the given GUID value.
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
CanQualType ObjCBuiltinSelTy
TranslationUnitDecl * getTranslationUnitDecl() const
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
void InitBuiltinTypes(const TargetInfo &Target, const TargetInfo *AuxTarget=nullptr)
Initialize built-in types.
ParentMapContext & getParentMapContext()
Returns the dynamic AST node parent map context.
QualType getParenType(QualType NamedType) const
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization,...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
CanQualType ARCUnbridgedCastTy
QualType getDependentSizedMatrixType(QualType ElementType, Expr *RowExpr, Expr *ColumnExpr, SourceLocation AttrLoc) const
Return the unique reference to the matrix type of the specified element type and size.
QualType getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, QualType Wrapped) const
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
unsigned getManglingNumber(const NamedDecl *ND, bool ForAuxTarget=false) const
unsigned getIntWidth(QualType T) const
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one.
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
InlineVariableDefinitionKind
@ None
Not an inline variable.
@ Weak
Weak definition of inline variable.
@ Strong
Strong definition.
@ WeakUnknown
Weak for now, might become strong later in this TU.
bool dtorHasOperatorDelete(const CXXDestructorDecl *Dtor, OperatorDeleteKind K) const
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
TypedefDecl * getCFConstantStringDecl() const
CanQualType SatUnsignedFractTy
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template.
bool areCompatibleRVVTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an RISC-V vector builtin type and a VectorType that is a fixed-len...
ExternCContextDecl * getExternCContextDecl() const
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const
Parses the target attributes passed in, and returns only the ones that are valid feature names.
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
CanQualType UnsignedShortAccumTy
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
bool isPFPField(const FieldDecl *Field) const
QualType adjustFunctionResultType(QualType FunctionType, QualType NewResultType)
Change the result type of a function type, preserving sugar such as attributed types.
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
bool isTypeAwareOperatorNewOrDelete(const FunctionDecl *FD) const
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
QualType getCanonicalTemplateSpecializationType(ElaboratedTypeKeyword Keyword, TemplateName T, ArrayRef< TemplateArgument > CanonicalArgs) const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
void adjustObjCTypeParamBoundType(const ObjCTypeParamDecl *Orig, ObjCTypeParamDecl *New) const
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.
bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
static CanQualType getCanonicalType(QualType T)
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool AllowCXX=false, bool IsConditionalOperator=false)
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
DeclarationNameTable DeclarationNames
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
const TemplateArgument * getDefaultTemplateArgumentOrNone(const NamedDecl *P) const
Return the default argument of a template parameter, if one exists.
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
void setCurrentNamedModule(Module *M)
Set the (C++20) module we are building.
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>.
CharUnits getMemberPointerPathAdjustment(const APValue &MP) const
Find the 'this' offset for the member path in a pointer-to-member APValue.
bool mayExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel may be externalized.
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
QualType getScalableVectorType(QualType EltTy, unsigned NumElts, unsigned NumFields=1) const
Return the unique reference to a scalable vector type of the specified element type and scalable numb...
bool hasSameExpr(const Expr *X, const Expr *Y) const
Determine whether the given expressions X and Y are equivalent.
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
QualType getRealTypeForBitwidth(unsigned DestWidth, FloatModeKind ExplicitType) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any.
unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built.
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
unsigned getTypeUnadjustedAlign(QualType T) const
Return the ABI-specified natural alignment of a (complete) type T, before alignment adjustments,...
unsigned char getFixedPointIBits(QualType Ty) const
QualType getSubstBuiltinTemplatePack(const TemplateArgument &ArgPack)
QualType getCorrespondingSignedFixedPointType(QualType Ty) const
IntrusiveRefCntPtr< ExternalASTSource > ExternalSource
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getCountAttributedType(QualType T, Expr *CountExpr, bool CountInBytes, bool OrNull, ArrayRef< TypeCoupledDeclRefInfo > DependentDecls) const
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
bool mergeExtParameterInfo(const FunctionProtoType *FirstFnType, const FunctionProtoType *SecondFnType, bool &CanUseFirst, bool &CanUseSecond, SmallVectorImpl< FunctionProtoType::ExtParameterInfo > &NewParamInfos)
This function merges the ExtParameterInfo lists of two functions.
bool ObjCQualifiedClassTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>.
bool shouldExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel should be externalized.
bool propertyTypesAreCompatible(QualType, QualType)
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc, VectorKind VecKind) const
Return the unique reference to the type for a dependently sized vector of the specified element type.
CanQualType SatLongAccumTy
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
OpenCLTypeKind getOpenCLTypeKind(const Type *T) const
Map an AST Type to an OpenCLTypeKind enum value.
TemplateName getDependentTemplateName(const DependentTemplateStorage &Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template operat...
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
unsigned getPreferredTypeAlign(QualType T) const
Return the "preferred" alignment of the specified type T for the current target, in bits.
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
CanQualType OMPArrayShapingTy
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins, TranslationUnitKind TUKind)
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
TemplateName getCanonicalTemplateName(TemplateName Name, bool IgnoreDeduced=false) const
Retrieves the "canonical" template name that refers to a given template.
unsigned getStaticLocalNumber(const VarDecl *VD) const
void addComment(const RawComment &RC)
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
bool isSameTypeConstraint(const TypeConstraint *XTC, const TypeConstraint *YTC) const
Determine whether two type contraint are similar enough that they could used in declarations of the s...
void setRelocationInfoForCXXRecord(const CXXRecordDecl *, CXXRecordDeclRelocationInfo)
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
Retrieve a substitution-result type.
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=RecordDecl::TagKind::Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
CanQualType UnsignedLongFractTy
QualType mergeTagDefinitions(QualType, QualType)
void setClassMaybeNeedsVectorDeletingDestructor(const CXXRecordDecl *RD)
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
void setIsTypeAwareOperatorNewOrDelete(const FunctionDecl *FD, bool IsTypeAware)
QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const
Return a dependent bit-precise integer type with the specified signedness and bit count.
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
StringRef getCUIDHash() const
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
QualType getReferenceQualifiedType(const Expr *e) const
getReferenceQualifiedType - Given an expr, will return the type for that expression,...
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U) const
Determine whether two function types are the same, ignoring exception specifications in cases where t...
QualType getBlockDescriptorExtendedType() const
Gets the struct used to keep track of the extended descriptor for pointer to blocks.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
FunctionProtoType::ExceptionSpecInfo mergeExceptionSpecs(FunctionProtoType::ExceptionSpecInfo ESI1, FunctionProtoType::ExceptionSpecInfo ESI2, SmallVectorImpl< QualType > &ExceptionTypeStorage, bool AcceptDependent) const
void addLazyModuleInitializers(Module *M, ArrayRef< GlobalDeclID > IDs)
bool isSameConstraintExpr(const Expr *XCE, const Expr *YCE) const
Determine whether two 'requires' expressions are similar enough that they may be used in re-declarati...
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
QualType getUsingType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UsingShadowDecl *D, QualType UnderlyingType=QualType()) const
std::optional< QualType > tryMergeOverflowBehaviorTypes(QualType LHS, QualType RHS, bool OfBlockPointer, bool Unqualified, bool BlockReturnType, bool IsConditionalOperator)
Attempts to merge two types that may be OverflowBehaviorTypes.
CanQualType OMPIteratorTy
Builtin::Context & BuiltinInfo
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
void addModuleInitializer(Module *M, Decl *Init)
Add a declaration to the list of declarations that are initialized for a module.
const LangOptions & getLangOpts() const
QualType getFunctionTypeWithoutPtrSizes(QualType T)
Get a function type and produce the equivalent function type where pointer size address spaces in the...
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
SelectorTable & Selectors
bool isTypeIgnoredBySanitizer(const SanitizerMask &Mask, const QualType &Ty) const
Check if a type can have its sanitizer instrumentation elided based on its presence within an ignorel...
unsigned getMinGlobalAlignOfVar(uint64_t Size, const VarDecl *VD) const
Return the minimum alignment as specified by the target.
RawCommentList Comments
All comments in this translation unit.
bool isSameDefaultTemplateArgument(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two default template arguments are similar enough that they may be used in declarat...
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType removePtrSizeAddrSpace(QualType T) const
Remove the existing address space on the type if it is a pointer size address space and return the ty...
bool areLaxCompatibleRVVTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible RISC-V vector types as defined by -flax-vect...
CanQualType SatShortFractTy
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod) const
Retrieves the default calling convention for the current context.
bool canBindObjCObjectType(QualType To, QualType From)
TemplateTemplateParmDecl * insertCanonicalTemplateTemplateParmDeclInternal(TemplateTemplateParmDecl *CanonTTP) const
int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const
Compare the rank of two floating point types as above, but compare equal if both types have the same ...
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
void setParameterIndex(const ParmVarDecl *D, unsigned index)
Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...
QualType getFunctionTypeWithExceptionSpec(QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI) const
Get a function type and produce the equivalent function type with the specified exception specificati...
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier NNS, const IdentifierInfo *Name) const
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool hasUniqueObjectRepresentations(QualType Ty, bool CheckIfTriviallyCopyable=true) const
Return true if the specified type has unique object representations according to (C++17 [meta....
CanQualType getCanonicalSizeType() const
bool typesAreBlockPointerCompatible(QualType, QualType)
CanQualType SatUnsignedAccumTy
bool useAbbreviatedThunkName(GlobalDecl VirtualMethodDecl, StringRef MangledName)
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
void forEachMultiversionedFunctionVersion(const FunctionDecl *FD, llvm::function_ref< void(FunctionDecl *)> Pred) const
Visits all versions of a multiversioned function with the passed predicate.
void setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst, UsingEnumDecl *Pattern)
Remember that the using enum decl Inst is an instantiation of the using enum decl Pattern of a class ...
QualType getAutoType(DeducedKind DK, QualType DeducedAsType, AutoTypeKeyword Keyword, TemplateDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
llvm::SetVector< const VarDecl * > CUDADeviceVarODRUsedByHost
Keep track of CUDA/HIP device-side variables ODR-used by host code.
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...
CanQualType ArraySectionTy
CanQualType ObjCBuiltinIdTy
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
VTableContextBase * getVTableContext()
ComparisonCategories CompCategories
Types and expressions required to build C++2a three-way comparisons using operator<=>,...
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i....
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
bool isNearlyEmpty(const CXXRecordDecl *RD) const
PointerAuthQualifier getObjCMemberSelTypePtrAuth()
void cacheRawCommentForDecl(const Decl &OriginalD, const RawComment &Comment) const
Attaches Comment to OriginalD and to its redeclaration chain and removes the redeclaration chain from...
void attachCommentsToJustParsedDecls(ArrayRef< Decl * > Decls, const Preprocessor *PP)
Searches existing comments for doc comments that should be attached to Decls.
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth,...
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
UsingEnumDecl * getInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst)
If the given using-enum decl Inst is an instantiation of another using-enum decl, return it.
RecordDecl * getCFConstantStringTagDecl() const
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
TypeSourceInfo * getTemplateSpecializationTypeInfo(ElaboratedTypeKeyword Keyword, SourceLocation ElaboratedKeywordLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKeywordLoc, TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &SpecifiedArgs, ArrayRef< TemplateArgument > CanonicalArgs, QualType Canon=QualType()) const
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
CanQualType UnsignedFractTy
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
TemplateTemplateParmDecl * findCanonicalTemplateTemplateParmDeclInternal(TemplateTemplateParmDecl *TTP) const
const TargetInfo * getAuxTargetInfo() const
CanQualType ObjCBuiltinClassTy
unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built.
CanQualType UnresolvedTemplateTy
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
friend class CXXRecordDecl
CanQualType UnsignedLongTy
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized,...
bool computeBestEnumTypes(bool IsPacked, unsigned NumNegativeBits, unsigned NumPositiveBits, QualType &BestType, QualType &BestPromotionType)
Compute BestType and BestPromotionType for an enum based on the highest number of negative and positi...
llvm::APFixedPoint getFixedPointMin(QualType Ty) const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
QualType adjustType(QualType OldType, llvm::function_ref< QualType(QualType)> Adjust) const
Rebuild a type, preserving any existing type sugar.
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
const TranslationUnitKind TUKind
CanQualType UnsignedLongAccumTy
QualType AutoRRefDeductTy
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const
Return a type for a constant array for a string literal of the specified element type and length.
QualType getCorrespondingSaturatedType(QualType Ty) const
bool arePFPFieldsTriviallyCopyable(const RecordDecl *RD) const
Returns whether this record's PFP fields (if any) are trivially copyable (i.e.
bool isSameEntity(const NamedDecl *X, const NamedDecl *Y) const
Determine whether the two declarations refer to the same entity.
QualType getSubstTemplateTypeParmPackType(Decl *AssociatedDecl, unsigned Index, bool Final, const TemplateArgument &ArgPack)
CanQualType BoundMemberTy
CanQualType SatUnsignedShortFractTy
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
bool hasSameFunctionTypeIgnoringParamABI(QualType T, QualType U) const
Determine if two function types are the same, ignoring parameter ABI annotations.
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
QualType getBlockDescriptorType() const
Gets the struct used to keep track of the descriptor for pointer to blocks.
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
QualType getHLSLInlineSpirvType(uint32_t Opcode, uint32_t Size, uint32_t Alignment, ArrayRef< SpirvOperand > Operands)
unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
bool isInSameModule(const Module *M1, const Module *M2) const
If the two module M1 and M2 are in the same module.
unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
CanQualType PseudoObjectTy
QualType getWebAssemblyExternrefType() const
Return a WebAssembly externref type.
void setTraversalScope(const std::vector< Decl * > &)
CharUnits getTypeUnadjustedAlignInChars(QualType T) const
getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type, in characters,...
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
friend class NestedNameSpecifier
MangleContext * cudaNVInitDeviceMC()
unsigned getAlignOfGlobalVar(QualType T, const VarDecl *VD) const
Return the alignment in bits that should be given to a global variable with type T.
bool areCompatibleOverflowBehaviorTypes(QualType LHS, QualType RHS)
Return true if two OverflowBehaviorTypes are compatible for assignment.
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
MangleContext * createDeviceMangleContext(const TargetInfo &T)
Creates a device mangle context to correctly mangle lambdas in a mixed architecture compile by settin...
CharUnits getExnObjectAlignment() const
Return the alignment (in bytes) of the thrown exception object.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
ASTMutationListener * Listener
CanQualType ObjCBuiltinBoolTy
TypeInfoChars getTypeInfoInChars(const Type *T) const
QualType getPredefinedSugarType(PredefinedSugarType::Kind KD) const
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
TemplateParamObjectDecl * getTemplateParamObjectDecl(QualType T, const APValue &V) const
Return the template parameter object of the given type with the given value.
interp::Context & getInterpContext() const
Returns the clang bytecode interpreter context.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
TemplateTemplateParmDecl * getCanonicalTemplateTemplateParmDecl(TemplateTemplateParmDecl *TTP) const
Canonicalize the given TemplateTemplateParmDecl.
CanQualType OCLClkEventTy
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
bool hasPFPFields(QualType Ty) const
const clang::PrintingPolicy & getPrintingPolicy() const
void ResetObjCLayout(const ObjCInterfaceDecl *D)
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
llvm::FixedPointSemantics getFixedPointSemantics(QualType Ty) const
CanQualType SatUnsignedShortAccumTy
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false, bool IsConditionalOperator=false)
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
CharUnits getAlignOfGlobalVarInChars(QualType T, const VarDecl *VD) const
Return the alignment in characters that should be given to a global variable with type T.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
QualType getPackIndexingType(QualType Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< QualType > Expansions={}, UnsignedOrNone Index=std::nullopt) const
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a non-unique reference to the type for a variable array of the specified element type.
QualType getObjCIdType() const
Represents the Objective-CC id type.
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
QualType getFunctionTypeWithoutParamABIs(QualType T) const
Get or construct a function type that is equivalent to the input type except that the parameter ABI a...
QualType getCorrespondingUnsaturatedType(QualType Ty) const
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl) const
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
llvm::DenseMap< CanQualType, SYCLKernelInfo > SYCLKernels
Map of SYCL kernels indexed by the unique type used to name the kernel.
bool isSameTemplateParameterList(const TemplateParameterList *X, const TemplateParameterList *Y) const
Determine whether two template parameter lists are similar enough that they may be used in declaratio...
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
QualType getTypeDeclType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypeDecl *Decl) const
bool isDestroyingOperatorDelete(const FunctionDecl *FD) const
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CanQualType UnsignedInt128Ty
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.
unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built.
void setManglingNumber(const NamedDecl *ND, unsigned Number)
llvm::DenseMap< const Decl *, const RawComment * > DeclRawComments
Mapping from declaration to directly attached comment.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
CanQualType getCanonicalTypeDeclType(const TypeDecl *TD) const
QualType getPackExpansionType(QualType Pattern, UnsignedOrNone NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
CanQualType UnsignedCharTy
CanQualType UnsignedShortFractTy
BuiltinTemplateDecl * buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, const IdentifierInfo *II) const
void * Allocate(size_t Size, unsigned Align=8) const
bool canBuiltinBeRedeclared(const FunctionDecl *) const
Return whether a declaration to a builtin is allowed to be overloaded/redeclared.
CanQualType UnsignedIntTy
unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
QualType getTypedefType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypedefNameDecl *Decl, QualType UnderlyingType=QualType(), std::optional< bool > TypeMatchesDeclOrNone=std::nullopt) const
Return the unique reference to the type for the specified typedef-name decl.
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl * > protocols) const
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
getObjCEncodingForMethodParameter - Return the encoded type for a single method parameter or return t...
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
QualType getTemplateSpecializationType(ElaboratedTypeKeyword Keyword, TemplateName T, ArrayRef< TemplateArgument > SpecifiedArgs, ArrayRef< TemplateArgument > CanonicalArgs, QualType Underlying=QualType()) const
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
TemplateName getQualifiedTemplateName(NestedNameSpecifier Qualifier, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
bool isSameAssociatedConstraint(const AssociatedConstraint &ACX, const AssociatedConstraint &ACY) const
Determine whether two 'requires' expressions are similar enough that they may be used in re-declarati...
QualType getExceptionObjectType(QualType T) const
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field) const
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
CanQualType UnsignedLongLongTy
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
CanQualType OCLReserveIDTy
bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two template parameters are similar enough that they may be used in declarations of...
void registerSYCLEntryPointFunction(FunctionDecl *FD)
Generates and stores SYCL kernel metadata for the provided SYCL kernel entry point function.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
CanQualType UnsignedShortTy
FunctionDecl * getOperatorDeleteForVDtor(const CXXDestructorDecl *Dtor, OperatorDeleteKind K) const
unsigned getTypeAlignIfKnown(QualType T, bool NeedsPreferredAlignment=false) const
Return the alignment of a type, in bits, or 0 if the type is incomplete and we cannot determine the a...
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true) const
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
bool isRepresentableIntegerValue(llvm::APSInt &Value, QualType T)
Determine whether the given integral value is representable within the given type T.
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
const SYCLKernelInfo & getSYCLKernelInfo(QualType T) const
Given a type used as a SYCL kernel name, returns a reference to the metadata generated from the corre...
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
canAssignObjCInterfacesInBlockPointer - This routine is specifically written for providing type-safet...
CanQualType SatUnsignedLongFractTy
QualType getMemberPointerType(QualType T, NestedNameSpecifier Qualifier, const CXXRecordDecl *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
static bool hasSameType(QualType T1, QualType T2)
Determine whether the given types T1 and T2 are equivalent.
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache.
QualType getTagType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TagDecl *TD, bool OwnsTag) const
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
CanQualType getMSGuidType() const
Retrieve the implicitly-predeclared 'struct _GUID' type.
const VariableArrayType * getAsVariableArrayType(QualType T) const
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
StringLiteral * getPredefinedStringLiteralFromCache(StringRef Key) const
Return a string representing the human readable name for the specified function declaration or file n...
CanQualType getCanonicalUnresolvedUsingType(const UnresolvedUsingTypenameDecl *D) const
bool hasSimilarType(QualType T1, QualType T2) const
Determine if two types are similar, according to the C++ rules.
llvm::APFixedPoint getFixedPointMax(QualType Ty) const
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
bool classMaybeNeedsVectorDeletingDestructor(const CXXRecordDecl *RD)
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
void deduplicateMergedDefinitionsFor(NamedDecl *ND)
Clean up the merged definition list.
DiagnosticsEngine & getDiagnostics() const
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
void recordOffsetOfEvaluation(const OffsetOfExpr *E)
QualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
UnnamedGlobalConstantDecl * getUnnamedGlobalConstantDecl(QualType Ty, const APValue &Value) const
Return a declaration for a uniquified anonymous global constant corresponding to a given APValue.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
QualType getUnresolvedUsingType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UnresolvedUsingTypenameDecl *D) const
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl * > &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
bool hasSameTemplateName(const TemplateName &X, const TemplateName &Y, bool IgnoreDeduced=false) const
Determine whether the given template names refer to the same template.
CanQualType SatLongFractTy
const TargetInfo & getTargetInfo() const
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
OBTAssignResult checkOBTAssignmentCompatibility(QualType LHS, QualType RHS)
Check overflow behavior type compatibility for assignments.
CanQualType SatShortAccumTy
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
QualType getOverflowBehaviorType(const OverflowBehaviorAttr *Attr, QualType Wrapped) const
CanQualType IncompleteMatrixIdxTy
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
CanQualType getNSIntegerType() const
QualType getCorrespondingUnsignedType(QualType T) const
void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)
Set the copy initialization expression of a block var decl.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
TargetCXXABI::Kind getCXXABIKind() const
Return the C++ ABI kind that should be used.
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
bool UnwrapSimilarTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true) const
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
CanQualType SatUnsignedLongAccumTy
QualType getUnconstrainedType(QualType T) const
Remove any type constraints from a template parameter type, for equivalence comparison of template pa...
CanQualType getCanonicalTagType(const TagDecl *TD) const
bool isSameTemplateArgument(const TemplateArgument &Arg1, const TemplateArgument &Arg2) const
Determine whether the given template arguments Arg1 and Arg2 are equivalent.
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getCorrespondingSignedType(QualType T) const
QualType mergeObjCGCQualifiers(QualType, QualType)
mergeObjCGCQualifiers - This routine merges ObjC's GC attribute of 'LHS' and 'RHS' attributes and ret...
llvm::DenseMap< const Decl *, const Decl * > CommentlessRedeclChains
Keeps track of redeclaration chains that don't have any comment attached.
uint64_t getArrayInitLoopExprElementCount(const ArrayInitLoopExpr *AILE) const
Return number of elements initialized in an ArrayInitLoopExpr.
unsigned getTargetAddressSpace(LangAS AS) const
std::vector< PFPField > findPFPFields(QualType Ty) const
Returns a list of PFP fields for the given type, including subfields in bases or other fields,...
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
void addTranslationUnitDecl()
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it.
bool isPromotableIntegerType(QualType T) const
More type predicates useful for type checking/promotion.
llvm::DenseMap< const Decl *, const Decl * > RedeclChainComments
Mapping from canonical declaration to the first redeclaration in chain that has a comment attached.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
std::optional< CXXRecordDeclRelocationInfo > getRelocationInfoForCXXRecord(const CXXRecordDecl *) const
static bool hasSameUnqualifiedType(QualType T1, QualType T2)
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
TemplateName getSubstTemplateTemplateParm(TemplateName replacement, Decl *AssociatedDecl, unsigned Index, UnsignedOrNone PackIndex, bool Final) const
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
uint16_t getPointerAuthVTablePointerDiscriminator(const CXXRecordDecl *RD)
Return the "other" discriminator used for the pointer auth schema used for vtable pointers in instanc...
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
Loading virtual member pointers using the virtual inheritance model always results in an adjustment u...
LangAS getLangASForBuiltinAddressSpace(unsigned AS) const
bool hasSameFunctionTypeIgnoringPtrSizes(QualType T, QualType U)
Determine whether two function types are the same, ignoring pointer sizes in the return type and para...
void addOperatorDeleteForVDtor(const CXXDestructorDecl *Dtor, FunctionDecl *OperatorDelete, OperatorDeleteKind K) const
unsigned char getFixedPointScale(QualType Ty) const
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
QualType DecodeTypeStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequireICE, bool AllowTypeModifiers) const
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
@ GE_Missing_type
Missing a type.
QualType adjustStringLiteralBaseType(QualType StrLTy) const
uint16_t getPointerAuthTypeDiscriminator(QualType T)
Return the "other" type-specific discriminator for the given type.
llvm::SetVector< const FieldDecl * > PFPFieldsWithEvaluatedOffset
bool canonicalizeTemplateArguments(MutableArrayRef< TemplateArgument > Args) const
Canonicalize the given template argument list.
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const
C23 feature and GCC extension.
bool isUnaryOverflowPatternExcluded(const UnaryOperator *UO)
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals) const
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
bool hasCvrSimilarType(QualType T1, QualType T2)
Determine if two types are similar, ignoring only CVR qualifiers.
TemplateName getDeducedTemplateName(TemplateName Underlying, DefaultArguments DefaultArgs) const
Represents a TemplateName which had some of its default arguments deduced.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or nullptr if none exists.
CanQualType UnsignedAccumTy
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
const CXXRecordDecl * baseForVTableAuthentication(const CXXRecordDecl *ThisClass) const
Resolve the root record to be used to derive the vtable pointer authentication policy for the specifi...
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
void setCFConstantStringType(QualType T)
const SYCLKernelInfo * findSYCLKernelInfo(QualType T) const
Returns a pointer to the metadata generated from the corresponding SYCLkernel entry point if the prov...
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
QualType getCommonSugaredType(QualType X, QualType Y, bool Unqualified=false) const
void AddDeallocation(void(*Callback)(void *), void *Data) const
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
QualType getDeducedTemplateSpecializationType(DeducedKind DK, QualType DeducedAsType, ElaboratedTypeKeyword Keyword, TemplateName Template) const
C++17 deduced class template specialization type.
CXXMethodVector::const_iterator overridden_cxx_method_iterator
RawComment * getRawCommentForDeclNoCacheImpl(const Decl *D, const SourceLocation RepresentativeLocForDecl, const std::map< unsigned, RawComment * > &CommentsInFile) const
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeTransparentUnionType - if T is a transparent union type and a member of T is compatible with Sub...
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
bool isSentinelNullExpr(const Expr *E)
CanQualType getNSUIntegerType() const
void setIsDestroyingOperatorDelete(const FunctionDecl *FD, bool IsDestroying)
void recordMemberDataPointerEvaluation(const ValueDecl *VD)
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getBitIntType(bool Unsigned, unsigned NumBits) const
Return a bit-precise integer type with the specified signedness and bit count.
unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
virtual ~ASTMutationListener()
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
const CXXRecordDecl * getBaseSharingVBPtr() const
CharUnits getSize() const
getSize - Get the record size in characters.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
CharUnits getDataSize() const
getDataSize() - Get the record data size, which is the record size without tail padding,...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
CharUnits getUnadjustedAlignment() const
getUnadjustedAlignment - Get the record alignment in characters, before alignment adjustment.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a loop initializing the elements of an array.
llvm::APInt getArraySize() const
Expr * getSubExpr() const
Get the initializer to use for each array element.
Represents a constant array type that does not decay to a pointer when used as a function parameter.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
A structure for storing the information associated with a name that has been assumed to be a template...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
void Profile(llvm::FoldingSetNodeID &ID)
Attr - This represents one attribute.
A fixed int type of a specified bitwidth.
void Profile(llvm::FoldingSetNodeID &ID) const
unsigned getNumBits() const
Represents a block literal declaration, which is like an unnamed FunctionDecl.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
This class is used for builtin types like 'int'.
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
Implements C++ ABI-specific semantic analysis functions.
Represents a base class of a C++ class.
Represents a C++ constructor within a class.
Represents a C++ destructor within a class.
CXXDestructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a static or instance method of a struct/union/class.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a C++ struct/union/class.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr)
CXXRecordDecl * getDefinition() const
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
bool isDynamicClass() const
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
SplitQualType split() const
static CanQual< Type > CreateUnsafe(QualType Other)
QualType withConst() const
Retrieves a version of this type with const applied.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Qualifiers getQualifiers() const
Retrieve all qualifiers.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
CharUnits - This is an opaque type for sizes expressed in character units.
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
bool isZero() const
isZero - Test whether the quantity equals zero.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Complex values, per C99 6.2.5p11.
void Profile(llvm::FoldingSetNodeID &ID)
bool hasExplicitTemplateArgs() const
Whether or not template arguments were explicitly specified in the concept reference (they might not ...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Represents the canonical version of C arrays with a specified constant size.
const Expr * getSizeExpr() const
Return a pointer to the size expression.
llvm::APInt getSize() const
Return the constant array size as an APInt.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
uint64_t getZExtSize() const
Return the size zero-extended as a uint64_t.
Represents a concrete matrix type with constant number of rows and columns.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getNumRows() const
Returns the number of rows in the matrix.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
void Profile(llvm::FoldingSetNodeID &ID)
Represents a pointer type decayed from an array or function type.
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 isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
Decl::Kind getDeclKind() const
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
const DeclContext * getParentFunctionOrMethod(bool LexicalParent=false) const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...
bool isModuleLocal() const
Whether this declaration was a local declaration to a C++20 named module.
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
unsigned getMaxAlignment() const
getMaxAlignment - return the maximum alignment specified by attributes on this decl,...
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
static Decl * castFromDeclContext(const DeclContext *)
bool isTemplated() const
Determine whether this declaration is a templated entity (whether it is.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
bool isInvalidDecl() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
SourceLocation getLocation() const
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
SourceLocation getBeginLoc() const LLVM_READONLY
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
DeclarationNameLoc - Additional source/type location info for a declaration name.
static DeclarationNameLoc makeCXXOperatorNameLoc(SourceLocation BeginLoc, SourceLocation EndLoc)
Construct location information for a non-literal C++ operator.
The name of a declaration.
static int compare(DeclarationName LHS, DeclarationName RHS)
Represents a ValueDecl that came out of a declarator.
TypeSourceInfo * getTypeSourceInfo() const
TemplateName getUnderlying() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const
DefaultArguments getDefaultArguments() const
Represents an extended address space qualifier where the input address space value is dependent.
Expr * getAddrSpaceExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents an array type in C++ whose size is a value-dependent expression.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Expr * getSizeExpr() const
Represents an extended vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Expr * getRowExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a dependent template name that cannot be resolved prior to template instantiation.
void Profile(llvm::FoldingSetNodeID &ID) const
IdentifierOrOverloadedOperator getName() const
NestedNameSpecifier getQualifier() const
Return the nested name specifier that qualifies this name.
bool hasTemplateKeyword() const
Was this template name was preceeded by the template keyword?
Internal representation of canonical, dependent typeof(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
A dynamically typed AST node container.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
bool isComplete() const
Returns true if this can be considered a complete type.
EnumDecl * getDefinitionOrSelf() const
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
This represents one expression.
bool isIntegerConstantExpr(const ASTContext &Ctx) const
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
void Profile(llvm::FoldingSetNodeID &ID) const
ExtVectorType - Extended vector type.
Declaration context for names declared as extern "C" in C++.
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
Abstract interface for external sources of AST nodes.
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
unsigned getBitWidthValue() const
Computes the bit width of this field, if this is a bit field.
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.
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a function declaration or definition.
bool isMultiVersion() const
True if this function is considered a multiversioned function.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required.
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
FunctionDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
FunctionDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
SmallVector< Conflict > Conflicts
static FunctionEffectSet getIntersection(FunctionEffectsRef LHS, FunctionEffectsRef RHS)
static FunctionEffectSet getUnion(FunctionEffectsRef LHS, FunctionEffectsRef RHS, Conflicts &Errs)
An immutable set of FunctionEffects and possibly conditions attached to them.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
void Profile(llvm::FoldingSetNodeID &ID)
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
QualType getParamType(unsigned i) const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
bool isVariadic() const
Whether this function prototype is variadic.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type?
Declaration of a template function.
A class which abstracts out some details necessary for making a call.
CallingConv getCC() const
bool getNoCfCheck() const
unsigned getRegParm() const
bool getNoCallerSavedRegs() const
ExtInfo withNoReturn(bool noReturn) const
bool getHasRegParm() const
bool getProducesResult() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
ExtParameterInfo withIsNoEscape(bool NoEscape) const
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
QualType getReturnType() const
GlobalDecl - represents a global declaration.
unsigned getMultiVersionIndex() const
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.
StringRef getName() const
Return the actual identifier string.
Implements an efficient mapping from strings to IdentifierInfo nodes.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a C array with an unspecified size.
void Profile(llvm::FoldingSetNodeID &ID)
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
An lvalue reference type, per C++11 [dcl.ref].
@ Swift
Interoperability with the latest known version of the Swift runtime.
@ Swift4_2
Interoperability with the Swift 4.2 runtime.
@ Swift4_1
Interoperability with the Swift 4.1 runtime.
@ Integer
Permit vector bitcasts between integer vectors with different numbers of elements but the same total ...
@ All
Permit vector bitcasts between all vectors with the same total bit-width.
@ PostDecrInWhile
while (count–)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
std::optional< TargetCXXABI::Kind > CXXABI
C++ ABI to compile with, if specified by the frontend through -fc++-abi=.
clang::ObjCRuntime ObjCRuntime
CoreFoundationABI CFRuntime
bool isOverflowPatternExcluded(OverflowPatternExclusionKind Kind) const
static void Profile(llvm::FoldingSetNodeID &ID, Parts P)
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
static bool isValidElementType(QualType T, const LangOptions &LangOpts)
Valid elements types are the following:
QualType getElementType() const
Returns type of the elements being stored in the matrix.
A pointer to member type per C++ 8.3.3 - Pointers to members.
void Profile(llvm::FoldingSetNodeID &ID)
Provides information a specialization of a member of a class template, which may be a member function...
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
Describes a module or submodule.
bool isNamedModule() const
Does this Module is a named module of a standard named module?
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool isPlaceholderVar(const LangOptions &LangOpts) const
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
bool isExternallyVisible() const
Represent a C++ namespace.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NestedNameSpecifier getCanonical() const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
CXXRecordDecl * getAsMicrosoftSuper() const
NamespaceAndPrefix getAsNamespaceAndPrefix() const
const Type * getAsType() const
Kind
The kind of specifier that completes this nested name specifier.
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, const IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
bool hasDefinition() const
Determine whether this class has been defined.
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class,...
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
ObjCImplementationDecl * getImplementation() const
ObjCInterfaceDecl * getSuperClass() const
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
known_extensions_range known_extensions() const
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getNextIvar()
ObjCMethodDecl - Represents an instance or class method declaration.
ObjCDeclQualifier getObjCDeclQualifier() const
unsigned param_size() const
param_const_iterator param_end() const
param_const_iterator param_begin() const
const ParmVarDecl *const * param_const_iterator
Selector getSelector() const
bool isInstanceMethod() const
QualType getReturnType() const
Represents a pointer to an Objective C object.
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
Represents one property declaration in an Objective-C interface.
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID, ObjCPropertyQueryKind queryKind)
Lookup a property by name in the specified DeclContext.
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
Selector getSetterName() const
Selector getGetterName() const
ObjCPropertyAttribute::Kind getPropertyAttributes() const
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCIvarDecl * getPropertyIvarDecl() const
Represents an Objective-C protocol declaration.
protocol_range protocols() const
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
Represents the declaration of an Objective-C type parameter.
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type,...
const OffsetOfNode & getComponent(unsigned Idx) const
unsigned getNumComponents() const
Helper class for OffsetOfExpr.
A structure for storing the information associated with an overloaded template name.
Represents a C++11 pack expansion that produces a sequence of expressions.
Sugar for parentheses used when specifying types.
void Profile(llvm::FoldingSetNodeID &ID)
void clear()
Clear parent maps.
DynTypedNodeList getParents(const NodeT &Node)
Returns the parents of the given node (within the traversal scope).
Represents a parameter to a function.
ObjCDeclQualifier getObjCDeclQualifier() const
QualType getOriginalType() const
ParsedAttr - Represents a syntactic attribute.
void Profile(llvm::FoldingSetNodeID &ID)
Pointer-authentication qualifiers.
static PointerAuthQualifier Create(unsigned Key, bool IsAddressDiscriminated, unsigned ExtraDiscriminator, PointerAuthenticationMode AuthenticationMode, bool IsIsaPointer, bool AuthenticatesNullValues)
bool isEquivalent(PointerAuthQualifier Other) const
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
A (possibly-)qualified type.
bool hasAddressDiscriminatedPointerAuth() const
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QualType getDesugaredType(const ASTContext &Context) const
Return the specified type with any "sugar" removed from the type.
QualType withConst() const
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
QualType getNonPackExpansionType() const
Remove an outer pack expansion type (if any) from this type.
bool isConstQualified() const
Determine whether this type is const-qualified.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
const Type * getTypePtrOrNull() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
void Profile(llvm::FoldingSetNodeID &ID)
A qualifier set is used to build a set of qualifiers.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeCVRQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
@ 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 hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
void removeFastQualifiers(unsigned mask)
bool hasUnaligned() const
bool hasAddressSpace() const
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Returns true if address space A is equal to or a superset of B.
unsigned getFastQualifiers() const
void removeAddressSpace()
PointerAuthQualifier getPointerAuth() const
bool hasObjCGCAttr() const
uint64_t getAsOpaqueValue() const
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
void addObjCGCAttr(GC type)
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.
bool hasFlexibleArrayMember() const
field_range fields() const
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
RecordDecl * getMostRecentDecl()
virtual void completeDefinition()
Note that the definition of this type is now complete.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
This table allows us to fully hide how we implement multi-keyword caching.
std::string getAsString() const
Derive the full selector name (e.g.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
StringLiteral - This represents a string literal expression, e.g.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringLiteralKind Kind, bool Pascal, QualType Ty, ArrayRef< SourceLocation > Locs)
This is the "fully general" constructor that allows representation of strings formed from one or more...
A structure for storing an already-substituted template template parameter pack.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
A structure for storing the information associated with a substituted template template parameter.
void Profile(llvm::FoldingSetNodeID &ID)
TemplateTemplateParmDecl * getParameter() const
Represents the declaration of a struct/union/class/enum.
TypedefNameDecl * getTypedefNameForAnonDecl() const
void startDefinition()
Starts the definition of this tag declaration.
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
TagKind getTagKind() const
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Kind
The basic C++ ABI kind.
static Kind getKind(StringRef Name)
Exposes information about the current target.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
@ AArch64ABIBuiltinVaList
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com....
@ PowerABIBuiltinVaList
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
@ AAPCSABIBuiltinVaList
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
@ X86_64ABIBuiltinVaList
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0....
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
IntType getPtrDiffType(LangAS AddrSpace) const
IntType getSizeType() const
FloatModeKind getRealTypeByWidth(unsigned BitWidth, FloatModeKind ExplicitType) const
Return floating point type with specified width.
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
unsigned getMaxAlignedAttribute() const
Get the maximum alignment in bits for a static variable with aligned attribute.
virtual unsigned getMinGlobalAlign(uint64_t Size, bool HasNonWeakDef) const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
unsigned getTargetAddressSpace(LangAS AS) const
IntType getSignedSizeType() const
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
A convenient class for passing around template argument information.
ArrayRef< TemplateArgumentLoc > arguments() const
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Location wrapper for a TemplateArgument.
Represents a template argument.
ArrayRef< TemplateArgument > getPackAsArray() const
Return the array of arguments in this template argument pack.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
UnsignedOrNone getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce,...
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.
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
QualType getIntegralType() const
Retrieve the type of the integral value.
bool getIsDefaulted() const
If returns 'true', this TemplateArgument corresponds to a default template parameter.
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.
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.).
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.
DeducedTemplateStorage * getAsDeducedTemplateName() const
Retrieve the deduced template info, if any.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
std::optional< TemplateName > desugar(bool IgnoreDeduced) const
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to,...
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
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.
UsingShadowDecl * getAsUsingShadowDecl() const
Retrieve the using shadow declaration through which the underlying template declaration is introduced...
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
A template parameter object.
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, const APValue &V)
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
ArrayRef< NamedDecl * > asArray()
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
TemplateNameKind templateParameterKind() const
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateNameKind ParameterKind, bool Typename, TemplateParameterList *Params)
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
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.
Declaration of a template type parameter.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, UnsignedOrNone NumExpanded=std::nullopt)
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
TemplateDecl * getNamedConcept() const
ConceptReference * getConceptReference() const
Represents a declaration of a type.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
The base class of the type hierarchy.
bool isBlockPointerType() const
bool isObjCBuiltinType() const
QualType getRVVEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an RVV builtin type.
bool isIncompleteArrayType() const
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isFloat16Type() const
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isConstantArrayType() const
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6....
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
bool isPointerType() const
TagDecl * castAsTagDecl() const
bool isArrayParameterType() const
CanQualType getCanonicalTypeUnqualified() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isSignedFixedPointType() const
Return true if this is a fixed point type that is signed according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isEnumeralType() const
bool isObjCQualifiedIdType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isBitIntType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
QualType getCanonicalTypeInternal() const
@ PtrdiffT
The "ptrdiff_t" type.
@ SizeT
The "size_t" type.
@ SignedSizeT
The signed integer type corresponding to "size_t".
bool isObjCIdType() const
bool isOverflowBehaviorType() const
EnumDecl * castAsEnumDecl() const
bool isUnsaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
EnumDecl * getAsEnumDecl() const
Retrieves the EnumDecl this type refers to.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isObjCObjectPointerType() const
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isVectorType() const
bool isObjCClassType() const
bool isRVVVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'riscv_rvv_vector_bits' type attribute,...
bool isRVVSizelessBuiltinType() const
Returns true for RVV scalable vector types.
const T * getAsCanonical() const
If this type is canonically the specified type, return its canonical type cast to that specified type...
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
bool isAnyPointerType() const
TypeClass getTypeClass() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isNullPtrType() const
bool isRecordType() const
bool isObjCRetainableType() const
NullabilityKindOrNone getNullability() const
Determine the nullability of the given type.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const TypedefNameDecl *Decl, QualType Underlying)
UnaryOperator - This represents the unary-expression's (except sizeof and alignof),...
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Ty, const APValue &APVal)
The iterator over UnresolvedSets.
Represents the dependent type named by a dependently-scoped typename using declaration,...
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UnresolvedUsingTypenameDecl *D)
Represents a dependent using declaration which was marked with typename.
UnresolvedUsingTypenameDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this declaration.
Represents a C++ using-enum-declaration.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
BaseUsingDecl * getIntroducer() const
Gets the (written or instantiated) using declaration that introduced this declaration.
static void Profile(llvm::FoldingSetNodeID &ID, ElaboratedTypeKeyword Keyword, NestedNameSpecifier Qualifier, const UsingShadowDecl *D, QualType UnderlyingType)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr.
Represents a variable declaration or definition.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member.
bool isStaticDataMember() const
Determines whether this is a static data member.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
bool isInline() const
Whether this variable is (C++1z) inline.
@ DeclarationOnly
This declaration is only a declaration.
DefinitionKind hasDefinition(ASTContext &) const
Check whether this variable is defined in this translation unit.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getSizeExpr() const
Represents a GCC generic vector type.
unsigned getNumElements() const
void Profile(llvm::FoldingSetNodeID &ID)
VectorKind getVectorKind() const
QualType getElementType() const
Holds all information required to evaluate constexpr code in a module.
Defines the Linkage enumeration and various utility functions.
Defines the clang::TargetInfo interface.
mlir::Type getBaseType(mlir::Value varPtr)
const AstTypeMatcher< TagType > tagType
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
The JSON file list parser is used to communicate input to InstallAPI.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
bool isa(CodeGen::Address addr)
GVALinkage
A more specific kind of linkage than enum Linkage.
@ GVA_AvailableExternally
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenCLTypeKind
OpenCL type kinds.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
NullabilityKind
Describes the nullability of a particular type.
@ Nullable
Values of this type can be null.
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
@ NonNull
Values of this type can never be null.
@ ICIS_NoInit
No in-class initializer.
@ TemplateName
The identifier is a template name. FIXME: Add an annotation for that.
std::pair< FileID, unsigned > FileIDAndOffset
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
TypeOfKind
The kind of 'typeof' expression we're after.
SmallVector< Attr *, 4 > AttrVec
AttrVec - A vector of Attr, which is how they are stored on the AST.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
@ Result
The result type of a method or function.
ArraySizeModifier
Capture whether this is a normal array (e.g.
OptionalUnsigned< unsigned > UnsignedOrNone
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
@ Template
We are parsing a template declaration.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
constexpr uint16_t SelPointerConstantDiscriminator
Constant discriminator to be used with objective-c sel pointers.
bool isDiscardableGVALinkage(GVALinkage L)
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
@ Keyword
The name has been typo-corrected to a keyword.
LangAS
Defines the address space values used by the address space qualifier of QualType.
TranslationUnitKind
Describes the kind of translation unit being processed.
@ Deduced
The normal deduced case.
@ Undeduced
Not deduced yet. This is for example an 'auto' which was just parsed.
@ DeducedAsPack
Same as above, but additionally this represents a case where the deduced entity itself is a pack.
const Decl & adjustDeclToTemplate(const Decl &D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template.
bool isPtrSizeAddressSpace(LangAS AS)
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ConceptReference *C)
Insertion operator for diagnostics.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ Invariant
The parameter is invariant: must match exactly.
@ Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X when the type parameter is covariant and...
@ Covariant
The parameter is covariant, e.g., X<T> is a subtype of X when the type parameter is covariant and T i...
@ AltiVecBool
is AltiVec 'vector bool ...'
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ Generic
not a target-specific vector type
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
U cast(CodeGen::Address addr)
LangAS getLangASFromTargetAS(unsigned TargetAS)
@ None
The alignment was not explicit in code.
@ RequiredByEnum
The alignment comes from an alignment attribute on a enum type.
@ RequiredByTypedef
The alignment comes from an alignment attribute on a typedef.
@ RequiredByRecord
The alignment comes from an alignment attribute on a record type.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ Interface
The "__interface" keyword introduces the elaborated-type-specifier.
@ None
No keyword precedes the qualified type name.
@ Struct
The "struct" keyword introduces the elaborated-type-specifier.
@ Class
The "class" keyword introduces the elaborated-type-specifier.
@ Union
The "union" keyword introduces the elaborated-type-specifier.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
const Expr * ConstraintExpr
UnsignedOrNone ArgPackSubstIndex
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Expr * getCopyExpr() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
ArrayRef< TemplateArgument > Args
Holds information about the various types of exception specification.
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
bool requiresFunctionProtoTypeArmAttributes() const
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
RefQualifierKind RefQualifier
bool requiresFunctionProtoTypeExtraAttributeInfo() const
unsigned HasTrailingReturn
bool requiresFunctionProtoTypeExtraBitfields() const
FunctionType::ExtInfo ExtInfo
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
static ElaboratedTypeKeyword getKeywordForTagTypeKind(TagTypeKind Tag)
Converts a TagTypeKind into an elaborated type keyword.
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
Contains information gathered from parsing the contents of TargetAttr.
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.
llvm::DenseSet< std::tuple< Decl *, Decl *, int > > NonEquivalentDeclSet
Store declaration pairs already found to be non-equivalent.
bool IsEquivalent(Decl *D1, Decl *D2)
Determine whether the two declarations are structurally equivalent.
A this pointer adjustment.
IntType
===-— Target Data Type Query Methods ----------------------------—===//
AlignRequirementKind AlignRequirement
AlignRequirementKind AlignRequirement