67#include "llvm/ADT/APFixedPoint.h"
68#include "llvm/ADT/APInt.h"
69#include "llvm/ADT/APSInt.h"
70#include "llvm/ADT/ArrayRef.h"
71#include "llvm/ADT/DenseMap.h"
72#include "llvm/ADT/DenseSet.h"
73#include "llvm/ADT/FoldingSet.h"
74#include "llvm/ADT/PointerUnion.h"
75#include "llvm/ADT/STLExtras.h"
76#include "llvm/ADT/SmallPtrSet.h"
77#include "llvm/ADT/SmallVector.h"
78#include "llvm/ADT/StringExtras.h"
79#include "llvm/ADT/StringRef.h"
80#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
81#include "llvm/Support/Capacity.h"
82#include "llvm/Support/Compiler.h"
83#include "llvm/Support/ErrorHandling.h"
84#include "llvm/Support/MD5.h"
85#include "llvm/Support/MathExtras.h"
86#include "llvm/Support/SipHash.h"
87#include "llvm/Support/raw_ostream.h"
88#include "llvm/TargetParser/AArch64TargetParser.h"
89#include "llvm/TargetParser/Triple.h"
102using namespace clang;
115template <>
struct llvm::DenseMapInfo<
llvm::FoldingSetNodeID> {
116 static FoldingSetNodeID
getEmptyKey() {
return FoldingSetNodeID{}; }
120 for (
size_t i = 0; i <
sizeof(id) /
sizeof(
unsigned); ++i) {
121 id.AddInteger(std::numeric_limits<unsigned>::max());
127 return Val.ComputeHash();
130 static bool isEqual(
const FoldingSetNodeID &LHS,
131 const FoldingSetNodeID &RHS) {
147 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
152 if (
const auto *VD = dyn_cast<VarDecl>(
D)) {
153 if (VD->isStaticDataMember() &&
158 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(
D)) {
163 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(
D)) {
170 if (
const auto *ED = dyn_cast<EnumDecl>(
D)) {
174 if (
const auto *TD = dyn_cast<TagDecl>(
D)) {
177 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
181 if (isa<ParmVarDecl>(
D))
186 if (isa<TemplateTypeParmDecl>(
D) ||
187 isa<NonTypeTemplateParmDecl>(
D) ||
188 isa<TemplateTemplateParmDecl>(
D))
199 if (isa<ObjCMethodDecl>(
D) || isa<ObjCContainerDecl>(
D) ||
200 isa<ObjCPropertyDecl>(
D) || isa<RedeclarableTemplateDecl>(
D) ||
201 isa<ClassTemplateSpecializationDecl>(
D) ||
209 Locations.emplace_back(BaseLocation);
237 const std::map<unsigned, RawComment *> &CommentsInTheFile)
const {
240 if (RepresentativeLocForDecl.
isInvalid() ||
241 !RepresentativeLocForDecl.
isFileID())
245 if (CommentsInTheFile.empty())
250 const std::pair<FileID, unsigned> DeclLocDecomp =
254 auto OffsetCommentBehindDecl =
255 CommentsInTheFile.lower_bound(DeclLocDecomp.second);
258 if (OffsetCommentBehindDecl != CommentsInTheFile.end()) {
259 RawComment *CommentBehindDecl = OffsetCommentBehindDecl->second;
263 (isa<FieldDecl>(
D) || isa<EnumConstantDecl>(
D) || isa<VarDecl>(
D) ||
264 isa<ObjCMethodDecl>(
D) || isa<ObjCPropertyDecl>(
D))) {
268 if (SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second) ==
270 OffsetCommentBehindDecl->first)) {
271 return CommentBehindDecl;
278 if (OffsetCommentBehindDecl == CommentsInTheFile.begin())
281 auto OffsetCommentBeforeDecl = --OffsetCommentBehindDecl;
282 RawComment *CommentBeforeDecl = OffsetCommentBeforeDecl->second;
291 const unsigned CommentEndOffset =
296 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
302 StringRef
Text(Buffer + CommentEndOffset,
303 DeclLocDecomp.second - CommentEndOffset);
307 if (
Text.find_last_of(
";{}#@") != StringRef::npos)
310 return CommentBeforeDecl;
316 for (
const auto DeclLoc : DeclLocs) {
319 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
335 if (!CommentsInThisFile || CommentsInThisFile->empty())
347 assert(LangOpts.RetainCommentsFromSystemHeaders ||
356 if (
const auto *FD = dyn_cast<FunctionDecl>(&
D)) {
376 if (
const auto *VD = dyn_cast<VarDecl>(&
D)) {
379 if (VD->isStaticDataMember())
385 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(&
D)) {
392 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
398 return isa<ClassTemplateDecl *>(PU)
399 ? *
static_cast<const Decl *
>(cast<ClassTemplateDecl *>(PU))
400 : *
static_cast<const Decl *
>(
401 cast<ClassTemplatePartialSpecializationDecl *>(PU));
406 CRD->getMemberSpecializationInfo())
407 return *Info->getInstantiatedFrom();
411 if (
const auto *ED = dyn_cast<EnumDecl>(&
D)) {
424 const Decl **OriginalDecl)
const {
427 OriginalDecl =
nullptr;
439 return DeclComment->second;
452 *OriginalDecl = RedeclComment->second;
455 "This decl is supposed to have comment attached.");
456 return CommentAtRedecl->second;
461 const Decl *LastCheckedRedecl = [&]() {
463 bool CanUseCommentlessCache =
false;
465 for (
auto *Redecl : CanonicalD->
redecls()) {
467 CanUseCommentlessCache =
true;
470 if (Redecl == LastChecked)
477 return CanUseCommentlessCache ? LastChecked :
nullptr;
483 if (LastCheckedRedecl) {
484 if (LastCheckedRedecl == Redecl) {
485 LastCheckedRedecl =
nullptr;
493 *OriginalDecl = Redecl;
494 return RedeclComment;
500 *OriginalDecl =
nullptr;
516 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
521 for (
const auto *Ext : ID->known_extensions()) {
525 Redeclared.push_back(RedeclaredMethod);
536 for (
const Decl *
D : Decls) {
550 if (
File.isInvalid())
554 if (!CommentsInThisFile || CommentsInThisFile->empty() ||
555 CommentsInThisFile->rbegin()->second->isAttached())
565 for (
const Decl *
D : Decls) {
577 for (
const auto DeclLoc : DeclLocs) {
578 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
582 D, DeclLoc, *CommentsInThisFile)) {
593 const Decl *
D)
const {
596 ThisDeclInfo->IsFilled =
false;
597 ThisDeclInfo->fill();
598 ThisDeclInfo->CommentDecl = FC->
getDecl();
599 if (!ThisDeclInfo->TemplateParameters)
609 return RC ? RC->
parse(*
this,
nullptr,
D) :
nullptr;
620 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
624 if (Canonical !=
D) {
632 const Decl *OriginalDecl =
nullptr;
636 if (isa<ObjCMethodDecl>(
D) || isa<FunctionDecl>(
D)) {
638 const auto *OMD = dyn_cast<ObjCMethodDecl>(
D);
639 if (OMD && OMD->isPropertyAccessor())
646 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
650 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(
D)) {
653 QualType QT = TD->getUnderlyingType();
655 if (
const Decl *TD = TT->getDecl())
659 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(
D)) {
660 while (IC->getSuperClass()) {
661 IC = IC->getSuperClass();
666 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(
D)) {
671 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(
D)) {
672 if (!(RD = RD->getDefinition()))
675 for (
const auto &I : RD->bases()) {
676 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
690 for (
const auto &I : RD->vbases()) {
711 if (
D != OriginalDecl && OriginalDecl)
720ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &ID,
728 ID.AddInteger(Params->
size());
730 PEnd = Params->
end();
732 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
734 ID.AddBoolean(TTP->isParameterPack());
735 if (TTP->isExpandedParameterPack()) {
737 ID.AddInteger(TTP->getNumExpansionParameters());
739 ID.AddBoolean(
false);
743 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
745 ID.AddBoolean(NTTP->isParameterPack());
746 ID.AddPointer(
C.getUnconstrainedType(
C.getCanonicalType(NTTP->getType()))
748 if (NTTP->isExpandedParameterPack()) {
750 ID.AddInteger(NTTP->getNumExpansionTypes());
751 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
753 ID.AddPointer(
T.getCanonicalType().getAsOpaquePtr());
756 ID.AddBoolean(
false);
760 auto *TTP = cast<TemplateTemplateParmDecl>(*
P);
767ASTContext::getCanonicalTemplateTemplateParmDecl(
770 llvm::FoldingSetNodeID
ID;
771 CanonicalTemplateTemplateParm::Profile(ID, *
this, TTP);
772 void *InsertPos =
nullptr;
773 CanonicalTemplateTemplateParm *Canonical
774 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
776 return Canonical->getParam();
781 CanonParams.reserve(Params->
size());
783 PEnd = Params->
end();
787 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
793 ? std::optional<unsigned>(TTP->getNumExpansionParameters())
795 CanonParams.push_back(NewTTP);
796 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
800 if (NTTP->isExpandedParameterPack()) {
803 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
805 ExpandedTInfos.push_back(
813 NTTP->getPosition(),
nullptr,
823 NTTP->getPosition(),
nullptr,
825 NTTP->isParameterPack(),
828 CanonParams.push_back(Param);
830 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
831 cast<TemplateTemplateParmDecl>(*
P)));
842 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
843 assert(!Canonical &&
"Shouldn't be in the map!");
847 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
848 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
857 return NoSanitizeL->containsType(Mask, TyName) &&
858 !NoSanitizeL->containsType(Mask, TyName,
"sanitize");
867 if (!LangOpts.CPlusPlus)
return nullptr;
870 case TargetCXXABI::AppleARM64:
871 case TargetCXXABI::Fuchsia:
872 case TargetCXXABI::GenericARM:
873 case TargetCXXABI::iOS:
874 case TargetCXXABI::WatchOS:
875 case TargetCXXABI::GenericAArch64:
876 case TargetCXXABI::GenericMIPS:
877 case TargetCXXABI::GenericItanium:
878 case TargetCXXABI::WebAssembly:
879 case TargetCXXABI::XL:
881 case TargetCXXABI::Microsoft:
884 llvm_unreachable(
"Invalid CXXABI type!");
888 if (!InterpContext) {
891 return *InterpContext.get();
897 return *ParentMapCtx.get();
902 switch (LangOpts.getAddressSpaceMapMangling()) {
910 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
916 : ConstantArrayTypes(this_(), ConstantArrayTypesLog2InitSize),
917 DependentSizedArrayTypes(this_()), DependentSizedExtVectorTypes(this_()),
918 DependentAddressSpaceTypes(this_()), DependentVectorTypes(this_()),
919 DependentSizedMatrixTypes(this_()),
920 FunctionProtoTypes(this_(), FunctionProtoTypesLog2InitSize),
921 DependentTypeOfExprTypes(this_()), DependentDecltypeTypes(this_()),
922 TemplateSpecializationTypes(this_()),
923 DependentTemplateSpecializationTypes(this_()),
924 DependentBitIntTypes(this_()), SubstTemplateTemplateParmPacks(this_()),
925 DeducedTemplates(this_()), ArrayParameterTypes(this_()),
926 CanonTemplateTemplateParms(this_()), SourceMgr(
SM), LangOpts(LOpts),
929 LangOpts.XRayNeverInstrumentFiles,
930 LangOpts.XRayAttrListFiles,
SM)),
933 BuiltinInfo(builtins), TUKind(TUKind), DeclarationNames(*this),
934 Comments(
SM), CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
935 CompCategories(this_()), LastSDM(nullptr, 0) {
942 ReleaseDeclContextMaps();
945 for (
auto &Pair : Deallocations)
946 (Pair.first)(Pair.second);
947 Deallocations.clear();
953 I = ObjCLayouts.begin(),
E = ObjCLayouts.end(); I !=
E; )
959 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
960 I = ASTRecordLayouts.begin(),
E = ASTRecordLayouts.end(); I !=
E; ) {
965 ASTRecordLayouts.clear();
967 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
968 AEnd = DeclAttrs.end();
970 A->second->~AttrVec();
973 for (
const auto &
Value : ModuleInitializers)
974 Value.second->~PerModuleInitializers();
975 ModuleInitializers.
clear();
981 TraversalScope = TopLevelDecls;
986 Deallocations.push_back({Callback,
Data});
995 llvm::errs() <<
"\n*** AST Context Stats:\n";
996 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
998 unsigned counts[] = {
999#define TYPE(Name, Parent) 0,
1000#define ABSTRACT_TYPE(Name, Parent)
1001#include "clang/AST/TypeNodes.inc"
1005 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
1011 unsigned TotalBytes = 0;
1012#define TYPE(Name, Parent) \
1014 llvm::errs() << " " << counts[Idx] << " " << #Name \
1015 << " types, " << sizeof(Name##Type) << " each " \
1016 << "(" << counts[Idx] * sizeof(Name##Type) \
1018 TotalBytes += counts[Idx] * sizeof(Name##Type); \
1020#define ABSTRACT_TYPE(Name, Parent)
1021#include "clang/AST/TypeNodes.inc"
1023 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
1028 <<
" implicit default constructors created\n";
1031 <<
" implicit copy constructors created\n";
1035 <<
" implicit move constructors created\n";
1038 <<
" implicit copy assignment operators created\n";
1042 <<
" implicit move assignment operators created\n";
1045 <<
" implicit destructors created\n";
1048 llvm::errs() <<
"\n";
1052 BumpAlloc.PrintStats();
1056 bool NotifyListeners) {
1057 if (NotifyListeners)
1066 if (It == MergedDefModules.end())
1069 auto &Merged = It->second;
1070 llvm::DenseSet<Module*>
Found;
1071 for (
Module *&M : Merged)
1072 if (!
Found.insert(M).second)
1074 llvm::erase(Merged,
nullptr);
1081 if (MergedIt == MergedDefModules.end())
1083 return MergedIt->second;
1086void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1087 if (LazyInitializers.empty())
1091 assert(Source &&
"lazy initializers but no external source");
1093 auto LazyInits = std::move(LazyInitializers);
1094 LazyInitializers.clear();
1096 for (
auto ID : LazyInits)
1097 Initializers.push_back(Source->GetExternalDecl(ID));
1099 assert(LazyInitializers.empty() &&
1100 "GetExternalDecl for lazy module initializer added more inits");
1106 if (
const auto *ID = dyn_cast<ImportDecl>(
D)) {
1107 auto It = ModuleInitializers.find(ID->getImportedModule());
1110 if (It == ModuleInitializers.end())
1114 auto &Imported = *It->second;
1115 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1116 Imported.resolve(*
this);
1117 auto *OnlyDecl = Imported.Initializers.front();
1118 if (isa<ImportDecl>(OnlyDecl))
1123 auto *&Inits = ModuleInitializers[M];
1125 Inits =
new (*this) PerModuleInitializers;
1126 Inits->Initializers.push_back(
D);
1131 auto *&Inits = ModuleInitializers[M];
1133 Inits =
new (*this) PerModuleInitializers;
1134 Inits->LazyInitializers.insert(Inits->LazyInitializers.end(),
1135 IDs.begin(), IDs.end());
1139 auto It = ModuleInitializers.find(M);
1140 if (It == ModuleInitializers.end())
1143 auto *Inits = It->second;
1144 Inits->resolve(*
this);
1145 return Inits->Initializers;
1150 assert(!CurrentCXXNamedModule &&
1151 "We should set named module for ASTContext for only once");
1152 CurrentCXXNamedModule = M;
1164 auto GetRepresentativeModule = [
this](
const Module *M) {
1165 auto Iter = SameModuleLookupSet.find(M);
1166 if (
Iter != SameModuleLookupSet.end())
1167 return Iter->second;
1169 const Module *RepresentativeModule =
1170 PrimaryModuleNameMap.try_emplace(M->getPrimaryModuleInterfaceName(), M)
1172 SameModuleLookupSet[M] = RepresentativeModule;
1173 return RepresentativeModule;
1176 assert(M1 &&
"Shouldn't call `isInSameModule` if both M1 and M2 are none.");
1177 return GetRepresentativeModule(M1) == GetRepresentativeModule(M2);
1181 if (!ExternCContext)
1184 return ExternCContext;
1190 auto *BuiltinTemplate =
1192 BuiltinTemplate->setImplicit();
1195 return BuiltinTemplate;
1200 if (!MakeIntegerSeqDecl)
1203 return MakeIntegerSeqDecl;
1208 if (!TypePackElementDecl)
1211 return TypePackElementDecl;
1215 if (!BuiltinCommonTypeDecl)
1218 return BuiltinCommonTypeDecl;
1232 NewDecl->
addAttr(TypeVisibilityAttr::CreateImplicit(
1233 const_cast<ASTContext &
>(*
this), TypeVisibilityAttr::Default));
1238 StringRef Name)
const {
1262 Types.push_back(Ty);
1267 assert((!this->Target || this->Target == &
Target) &&
1268 "Incorrect target reinitialization");
1272 this->AuxTarget = AuxTarget;
1274 ABI.reset(createCXXABI(
Target));
1278 InitBuiltinType(
VoidTy, BuiltinType::Void);
1281 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1283 if (LangOpts.CharIsSigned)
1284 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1286 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1289 InitBuiltinType(
ShortTy, BuiltinType::Short);
1290 InitBuiltinType(
IntTy, BuiltinType::Int);
1291 InitBuiltinType(
LongTy, BuiltinType::Long);
1292 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1302 InitBuiltinType(
FloatTy, BuiltinType::Float);
1303 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1304 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1307 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1310 InitBuiltinType(
Ibm128Ty, BuiltinType::Ibm128);
1313 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1316 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1317 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1318 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1322 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1323 InitBuiltinType(
FractTy, BuiltinType::Fract);
1324 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1329 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1335 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1342 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1347 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1349 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1350 if (LangOpts.CPlusPlus && LangOpts.WChar)
1360 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1362 if (LangOpts.CPlusPlus)
1363 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1367 if (LangOpts.CPlusPlus)
1368 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1377 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1380 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1392 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1398 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1401 if (LangOpts.OpenMP) {
1408 if (LangOpts.OpenACC && !LangOpts.OpenMP) {
1411 if (LangOpts.MatrixTypes)
1419 if (LangOpts.OpenCL) {
1420#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1421 InitBuiltinType(SingletonId, BuiltinType::Id);
1422#include "clang/Basic/OpenCLImageTypes.def"
1424 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1425 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1427 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1430#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1431 InitBuiltinType(Id##Ty, BuiltinType::Id);
1432#include "clang/Basic/OpenCLExtensionTypes.def"
1435 if (LangOpts.HLSL) {
1436#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
1437 InitBuiltinType(SingletonId, BuiltinType::Id);
1438#include "clang/Basic/HLSLIntangibleTypes.def"
1441 if (
Target.hasAArch64SVETypes() ||
1443#define SVE_TYPE(Name, Id, SingletonId) \
1444 InitBuiltinType(SingletonId, BuiltinType::Id);
1445#include "clang/Basic/AArch64SVEACLETypes.def"
1448 if (
Target.getTriple().isPPC64()) {
1449#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \
1450 InitBuiltinType(Id##Ty, BuiltinType::Id);
1451#include "clang/Basic/PPCTypes.def"
1452#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \
1453 InitBuiltinType(Id##Ty, BuiltinType::Id);
1454#include "clang/Basic/PPCTypes.def"
1457 if (
Target.hasRISCVVTypes()) {
1458#define RVV_TYPE(Name, Id, SingletonId) \
1459 InitBuiltinType(SingletonId, BuiltinType::Id);
1460#include "clang/Basic/RISCVVTypes.def"
1463 if (
Target.getTriple().isWasm() &&
Target.hasFeature(
"reference-types")) {
1464#define WASM_TYPE(Name, Id, SingletonId) \
1465 InitBuiltinType(SingletonId, BuiltinType::Id);
1466#include "clang/Basic/WebAssemblyReferenceTypes.def"
1469 if (
Target.getTriple().isAMDGPU() ||
1470 (AuxTarget && AuxTarget->
getTriple().isAMDGPU())) {
1471#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \
1472 InitBuiltinType(SingletonId, BuiltinType::Id);
1473#include "clang/Basic/AMDGPUTypes.def"
1480 ObjCConstantStringType =
QualType();
1485 if (LangOpts.OpenCLGenericAddressSpace) {
1495 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1498 InitBuiltinType(
HalfTy, BuiltinType::Half);
1500 InitBuiltinType(
BFloat16Ty, BuiltinType::BFloat16);
1506 if (LangOpts.MicrosoftExt || LangOpts.Borland) {
1528 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(
D);
1529 if (Pos != DeclAttrs.end()) {
1530 Pos->second->~AttrVec();
1531 DeclAttrs.erase(Pos);
1545 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1546 TemplateOrInstantiation.find(Var);
1547 if (Pos == TemplateOrInstantiation.end())
1560 Tmpl, TSK, PointOfInstantiation));
1566 assert(!TemplateOrInstantiation[Inst] &&
1567 "Already noted what the variable was instantiated from");
1568 TemplateOrInstantiation[Inst] = TSI;
1573 return InstantiatedFromUsingDecl.lookup(UUD);
1578 assert((isa<UsingDecl>(Pattern) ||
1579 isa<UnresolvedUsingValueDecl>(Pattern) ||
1580 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1581 "pattern decl is not a using decl");
1582 assert((isa<UsingDecl>(Inst) ||
1583 isa<UnresolvedUsingValueDecl>(Inst) ||
1584 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1585 "instantiation did not produce a using decl");
1586 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1587 InstantiatedFromUsingDecl[Inst] = Pattern;
1592 return InstantiatedFromUsingEnumDecl.lookup(UUD);
1597 assert(!InstantiatedFromUsingEnumDecl[Inst] &&
"pattern already exists");
1598 InstantiatedFromUsingEnumDecl[Inst] = Pattern;
1603 return InstantiatedFromUsingShadowDecl.lookup(Inst);
1609 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1610 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1615 return InstantiatedFromUnnamedFieldDecl.lookup(Field);
1621 "Instantiated field decl is not unnamed");
1623 "Template field decl is not unnamed");
1624 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1625 "Already noted what unnamed field was instantiated from");
1627 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1648 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1650 if (Pos == OverriddenMethods.end())
1658 OverriddenMethods[Method].push_back(Overridden);
1666 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(
D)) {
1672 const auto *Method = dyn_cast<ObjCMethodDecl>(
D);
1677 Method->getOverriddenMethods(OverDecls);
1678 Overridden.append(OverDecls.begin(), OverDecls.end());
1682 assert(!Import->getNextLocalImport() &&
1683 "Import declaration already in the chain");
1684 assert(!Import->isFromASTFile() &&
"Non-local import declaration");
1685 if (!FirstLocalImport) {
1686 FirstLocalImport = Import;
1687 LastLocalImport = Import;
1691 LastLocalImport->setNextLocalImport(Import);
1692 LastLocalImport = Import;
1704 llvm_unreachable(
"Not a floating point type!");
1705 case BuiltinType::BFloat16:
1706 return Target->getBFloat16Format();
1707 case BuiltinType::Float16:
1708 return Target->getHalfFormat();
1709 case BuiltinType::Half:
1710 return Target->getHalfFormat();
1711 case BuiltinType::Float:
return Target->getFloatFormat();
1712 case BuiltinType::Double:
return Target->getDoubleFormat();
1713 case BuiltinType::Ibm128:
1714 return Target->getIbm128Format();
1715 case BuiltinType::LongDouble:
1718 return Target->getLongDoubleFormat();
1719 case BuiltinType::Float128:
1722 return Target->getFloat128Format();
1727 unsigned Align =
Target->getCharWidth();
1731 Align = AlignFromAttr;
1739 bool UseAlignAttrOnly;
1740 if (
const FieldDecl *FD = dyn_cast<FieldDecl>(
D))
1742 FD->hasAttr<PackedAttr>() || FD->getParent()->hasAttr<PackedAttr>();
1744 UseAlignAttrOnly = AlignFromAttr != 0;
1747 if (UseAlignAttrOnly) {
1749 }
else if (
const auto *VD = dyn_cast<ValueDecl>(
D)) {
1759 Align = getTypeInfoImpl(
T.getTypePtr()).
Align;
1764 unsigned MinWidth =
Target->getLargeArrayMinWidth();
1765 if (!ForAlignof && MinWidth) {
1767 Align = std::max(Align,
Target->getLargeArrayAlign());
1768 else if (isa<ConstantArrayType>(
arrayType) &&
1770 Align = std::max(Align,
Target->getLargeArrayAlign());
1775 Align =
Target->getCharWidth();
1779 if (
const auto *VD = dyn_cast<VarDecl>(
D))
1780 if (VD->hasGlobalStorage() && !ForAlignof) {
1791 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1794 if (!
Parent->isInvalidDecl()) {
1805 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1806 if (LowBitOfOffset < FieldAlign)
1807 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1810 Align = std::min(Align, FieldAlign);
1818 const auto *VD = dyn_cast<VarDecl>(
D);
1819 if (MaxAlignedAttr && VD && VD->getStorageClass() ==
SC_Static)
1820 Align = std::min(Align, MaxAlignedAttr);
1858 (uint64_t)(-1)/Size) &&
1859 "Overflow in array type char size evaluation");
1864 Width = llvm::alignTo(Width, Align);
1871 if (
const auto *CAT = dyn_cast<ConstantArrayType>(
T))
1889 switch (BT->getKind()) {
1890 case BuiltinType::Bool:
1891 case BuiltinType::Char_S:
1892 case BuiltinType::Char_U:
1893 case BuiltinType::SChar:
1894 case BuiltinType::UChar:
1895 case BuiltinType::Short:
1896 case BuiltinType::UShort:
1897 case BuiltinType::WChar_S:
1898 case BuiltinType::WChar_U:
1899 case BuiltinType::Char8:
1900 case BuiltinType::Char16:
1901 case BuiltinType::Char32:
1911 ET->getDecl()->isScoped())
1929 bool NeedsPreferredAlignment)
const {
1932 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1943 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1948 return TT->getDecl()->getMaxAlignment();
1954 TypeInfoMap::iterator I = MemoizedTypeInfo.find(
T);
1955 if (I != MemoizedTypeInfo.end())
1960 MemoizedTypeInfo[
T] = TI;
1976#define TYPE(Class, Base)
1977#define ABSTRACT_TYPE(Class, Base)
1978#define NON_CANONICAL_TYPE(Class, Base)
1979#define DEPENDENT_TYPE(Class, Base) case Type::Class:
1980#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \
1982 assert(!T->isDependentType() && "should not see dependent types here"); \
1983 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr());
1984#include "clang/AST/TypeNodes.inc"
1985 llvm_unreachable(
"Should not see dependent types");
1987 case Type::FunctionNoProto:
1988 case Type::FunctionProto:
1994 case Type::IncompleteArray:
1995 case Type::VariableArray:
1996 case Type::ConstantArray:
1997 case Type::ArrayParameter: {
2000 if (
const auto *CAT = dyn_cast<ConstantArrayType>(
T))
2001 Size = CAT->getZExtSize();
2004 assert((Size == 0 || EltInfo.
Width <= (uint64_t)(-1) / Size) &&
2005 "Overflow in array type bit size evaluation");
2006 Width = EltInfo.
Width * Size;
2007 Align = EltInfo.
Align;
2011 Width = llvm::alignTo(Width, Align);
2015 case Type::ExtVector:
2016 case Type::Vector: {
2017 const auto *VT = cast<VectorType>(
T);
2019 Width = VT->isExtVectorBoolType() ? VT->getNumElements()
2020 : EltInfo.
Width * VT->getNumElements();
2022 Width = std::max<unsigned>(8, Width);
2023 Align = std::max<unsigned>(8, Width);
2027 if (Align & (Align-1)) {
2028 Align = llvm::bit_ceil(Align);
2029 Width = llvm::alignTo(Width, Align);
2033 if (TargetVectorAlign && TargetVectorAlign < Align)
2034 Align = TargetVectorAlign;
2048 Align = std::min<unsigned>(64, Width);
2052 case Type::ConstantMatrix: {
2053 const auto *MT = cast<ConstantMatrixType>(
T);
2058 Width = ElementInfo.
Width * MT->getNumRows() * MT->getNumColumns();
2059 Align = ElementInfo.
Align;
2064 switch (cast<BuiltinType>(
T)->
getKind()) {
2065 default: llvm_unreachable(
"Unknown builtin type!");
2066 case BuiltinType::Void:
2071 case BuiltinType::Bool:
2072 Width =
Target->getBoolWidth();
2073 Align =
Target->getBoolAlign();
2075 case BuiltinType::Char_S:
2076 case BuiltinType::Char_U:
2077 case BuiltinType::UChar:
2078 case BuiltinType::SChar:
2079 case BuiltinType::Char8:
2080 Width =
Target->getCharWidth();
2081 Align =
Target->getCharAlign();
2083 case BuiltinType::WChar_S:
2084 case BuiltinType::WChar_U:
2085 Width =
Target->getWCharWidth();
2086 Align =
Target->getWCharAlign();
2088 case BuiltinType::Char16:
2089 Width =
Target->getChar16Width();
2090 Align =
Target->getChar16Align();
2092 case BuiltinType::Char32:
2093 Width =
Target->getChar32Width();
2094 Align =
Target->getChar32Align();
2096 case BuiltinType::UShort:
2097 case BuiltinType::Short:
2098 Width =
Target->getShortWidth();
2099 Align =
Target->getShortAlign();
2101 case BuiltinType::UInt:
2102 case BuiltinType::Int:
2103 Width =
Target->getIntWidth();
2104 Align =
Target->getIntAlign();
2106 case BuiltinType::ULong:
2107 case BuiltinType::Long:
2108 Width =
Target->getLongWidth();
2109 Align =
Target->getLongAlign();
2111 case BuiltinType::ULongLong:
2112 case BuiltinType::LongLong:
2113 Width =
Target->getLongLongWidth();
2114 Align =
Target->getLongLongAlign();
2116 case BuiltinType::Int128:
2117 case BuiltinType::UInt128:
2119 Align =
Target->getInt128Align();
2121 case BuiltinType::ShortAccum:
2122 case BuiltinType::UShortAccum:
2123 case BuiltinType::SatShortAccum:
2124 case BuiltinType::SatUShortAccum:
2125 Width =
Target->getShortAccumWidth();
2126 Align =
Target->getShortAccumAlign();
2128 case BuiltinType::Accum:
2129 case BuiltinType::UAccum:
2130 case BuiltinType::SatAccum:
2131 case BuiltinType::SatUAccum:
2132 Width =
Target->getAccumWidth();
2133 Align =
Target->getAccumAlign();
2135 case BuiltinType::LongAccum:
2136 case BuiltinType::ULongAccum:
2137 case BuiltinType::SatLongAccum:
2138 case BuiltinType::SatULongAccum:
2139 Width =
Target->getLongAccumWidth();
2140 Align =
Target->getLongAccumAlign();
2142 case BuiltinType::ShortFract:
2143 case BuiltinType::UShortFract:
2144 case BuiltinType::SatShortFract:
2145 case BuiltinType::SatUShortFract:
2146 Width =
Target->getShortFractWidth();
2147 Align =
Target->getShortFractAlign();
2149 case BuiltinType::Fract:
2150 case BuiltinType::UFract:
2151 case BuiltinType::SatFract:
2152 case BuiltinType::SatUFract:
2153 Width =
Target->getFractWidth();
2154 Align =
Target->getFractAlign();
2156 case BuiltinType::LongFract:
2157 case BuiltinType::ULongFract:
2158 case BuiltinType::SatLongFract:
2159 case BuiltinType::SatULongFract:
2160 Width =
Target->getLongFractWidth();
2161 Align =
Target->getLongFractAlign();
2163 case BuiltinType::BFloat16:
2164 if (
Target->hasBFloat16Type()) {
2165 Width =
Target->getBFloat16Width();
2166 Align =
Target->getBFloat16Align();
2175 case BuiltinType::Float16:
2176 case BuiltinType::Half:
2179 Width =
Target->getHalfWidth();
2180 Align =
Target->getHalfAlign();
2183 "Expected OpenMP device compilation.");
2188 case BuiltinType::Float:
2189 Width =
Target->getFloatWidth();
2190 Align =
Target->getFloatAlign();
2192 case BuiltinType::Double:
2193 Width =
Target->getDoubleWidth();
2194 Align =
Target->getDoubleAlign();
2196 case BuiltinType::Ibm128:
2197 Width =
Target->getIbm128Width();
2198 Align =
Target->getIbm128Align();
2200 case BuiltinType::LongDouble:
2207 Width =
Target->getLongDoubleWidth();
2208 Align =
Target->getLongDoubleAlign();
2211 case BuiltinType::Float128:
2214 Width =
Target->getFloat128Width();
2215 Align =
Target->getFloat128Align();
2218 "Expected OpenMP device compilation.");
2223 case BuiltinType::NullPtr:
2228 case BuiltinType::ObjCId:
2229 case BuiltinType::ObjCClass:
2230 case BuiltinType::ObjCSel:
2234 case BuiltinType::OCLSampler:
2235 case BuiltinType::OCLEvent:
2236 case BuiltinType::OCLClkEvent:
2237 case BuiltinType::OCLQueue:
2238 case BuiltinType::OCLReserveID:
2239#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2240 case BuiltinType::Id:
2241#include "clang/Basic/OpenCLImageTypes.def"
2242#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2243 case BuiltinType::Id:
2244#include "clang/Basic/OpenCLExtensionTypes.def"
2246 Width =
Target->getPointerWidth(AS);
2247 Align =
Target->getPointerAlign(AS);
2257#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \
2258 case BuiltinType::Id: \
2262#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \
2263 case BuiltinType::Id: \
2267#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2268 case BuiltinType::Id: \
2272#define AARCH64_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
2274 case BuiltinType::Id: \
2275 Width = NumEls * ElBits * NF; \
2276 Align = NumEls * ElBits; \
2278#include "clang/Basic/AArch64SVEACLETypes.def"
2279#define PPC_VECTOR_TYPE(Name, Id, Size) \
2280 case BuiltinType::Id: \
2284#include "clang/Basic/PPCTypes.def"
2285#define RVV_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, NF, IsSigned, \
2287 case BuiltinType::Id: \
2291#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) \
2292 case BuiltinType::Id: \
2296#include "clang/Basic/RISCVVTypes.def"
2297#define WASM_TYPE(Name, Id, SingletonId) \
2298 case BuiltinType::Id: \
2302#include "clang/Basic/WebAssemblyReferenceTypes.def"
2303#define AMDGPU_TYPE(NAME, ID, SINGLETONID, WIDTH, ALIGN) \
2304 case BuiltinType::ID: \
2308#include "clang/Basic/AMDGPUTypes.def"
2309#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
2310#include "clang/Basic/HLSLIntangibleTypes.def"
2316 case Type::ObjCObjectPointer:
2320 case Type::BlockPointer:
2321 AS = cast<BlockPointerType>(
T)->getPointeeType().getAddressSpace();
2322 Width =
Target->getPointerWidth(AS);
2323 Align =
Target->getPointerAlign(AS);
2325 case Type::LValueReference:
2326 case Type::RValueReference:
2329 AS = cast<ReferenceType>(
T)->getPointeeType().getAddressSpace();
2330 Width =
Target->getPointerWidth(AS);
2331 Align =
Target->getPointerAlign(AS);
2334 AS = cast<PointerType>(
T)->getPointeeType().getAddressSpace();
2335 Width =
Target->getPointerWidth(AS);
2336 Align =
Target->getPointerAlign(AS);
2338 case Type::MemberPointer: {
2339 const auto *MPT = cast<MemberPointerType>(
T);
2345 case Type::Complex: {
2349 Width = EltInfo.
Width * 2;
2350 Align = EltInfo.
Align;
2353 case Type::ObjCObject:
2354 return getTypeInfo(cast<ObjCObjectType>(
T)->getBaseType().getTypePtr());
2355 case Type::Adjusted:
2358 case Type::ObjCInterface: {
2359 const auto *ObjCI = cast<ObjCInterfaceType>(
T);
2360 if (ObjCI->getDecl()->isInvalidDecl()) {
2370 case Type::BitInt: {
2371 const auto *EIT = cast<BitIntType>(
T);
2372 Align =
Target->getBitIntAlign(EIT->getNumBits());
2373 Width =
Target->getBitIntWidth(EIT->getNumBits());
2378 const auto *TT = cast<TagType>(
T);
2380 if (TT->getDecl()->isInvalidDecl()) {
2386 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
2387 const EnumDecl *ED = ET->getDecl();
2391 Info.
Align = AttrAlign;
2397 const auto *RT = cast<RecordType>(TT);
2402 AlignRequirement = RD->
hasAttr<AlignedAttr>()
2408 case Type::SubstTemplateTypeParm:
2409 return getTypeInfo(cast<SubstTemplateTypeParmType>(
T)->
2410 getReplacementType().getTypePtr());
2413 case Type::DeducedTemplateSpecialization: {
2414 const auto *A = cast<DeducedType>(
T);
2415 assert(!A->getDeducedType().isNull() &&
2416 "cannot request the size of an undeduced or dependent auto type");
2417 return getTypeInfo(A->getDeducedType().getTypePtr());
2421 return getTypeInfo(cast<ParenType>(
T)->getInnerType().getTypePtr());
2423 case Type::MacroQualified:
2427 case Type::ObjCTypeParam:
2428 return getTypeInfo(cast<ObjCTypeParamType>(
T)->desugar().getTypePtr());
2431 return getTypeInfo(cast<UsingType>(
T)->desugar().getTypePtr());
2433 case Type::Typedef: {
2434 const auto *TT = cast<TypedefType>(
T);
2439 if (
unsigned AttrAlign = TT->getDecl()->getMaxAlignment()) {
2450 case Type::Elaborated:
2451 return getTypeInfo(cast<ElaboratedType>(
T)->getNamedType().getTypePtr());
2453 case Type::Attributed:
2455 cast<AttributedType>(
T)->getEquivalentType().getTypePtr());
2457 case Type::CountAttributed:
2458 return getTypeInfo(cast<CountAttributedType>(
T)->desugar().getTypePtr());
2460 case Type::BTFTagAttributed:
2462 cast<BTFTagAttributedType>(
T)->getWrappedType().getTypePtr());
2464 case Type::HLSLAttributedResource:
2466 cast<HLSLAttributedResourceType>(
T)->getWrappedType().getTypePtr());
2468 case Type::Atomic: {
2477 Width =
Target->getCharWidth();
2479 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2485 Width = llvm::bit_ceil(Width);
2488 Align =
static_cast<unsigned>(Width);
2499 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2500 return TypeInfo(Width, Align, AlignRequirement);
2504 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(
T);
2505 if (I != MemoizedUnadjustedAlign.end())
2508 unsigned UnadjustedAlign;
2520 MemoizedUnadjustedAlign[
T] = UnadjustedAlign;
2521 return UnadjustedAlign;
2525 unsigned SimdAlign = llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(
2575 unsigned ABIAlign = TI.
Align;
2583 if (!
Target->allowsLargerPreferedTypeAlignment())
2597 unsigned PreferredAlign =
static_cast<unsigned>(
2599 assert(PreferredAlign >= ABIAlign &&
2600 "PreferredAlign should be at least as large as ABIAlign.");
2601 return PreferredAlign;
2608 T = CT->getElementType().getTypePtr();
2610 T = ET->getDecl()->getIntegerType().getTypePtr();
2615 Target->defaultsToAIXPowerAlignment()))
2670 for (
unsigned I = 0, N =
Path.size(); I != N; ++I) {
2674 std::swap(
Base, Derived);
2694 llvm::append_range(Ivars, OI->
ivars());
2697 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2699 Ivars.push_back(Iv);
2707 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2710 for (
auto *Proto : OI->all_referenced_protocols()) {
2715 for (
const auto *Cat : OI->visible_categories())
2721 SD = SD->getSuperClass();
2723 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2724 for (
auto *Proto : OC->protocols()) {
2727 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2729 if (!Protocols.insert(
2733 for (
auto *Proto : OP->protocols())
2740 bool CheckIfTriviallyCopyable) {
2741 assert(RD->
isUnion() &&
"Must be union type");
2744 for (
const auto *Field : RD->
fields()) {
2746 CheckIfTriviallyCopyable))
2749 if (FieldSize != UnionSize)
2767static std::optional<int64_t>
2770 bool CheckIfTriviallyCopyable);
2772static std::optional<int64_t>
2774 bool CheckIfTriviallyCopyable) {
2775 if (Field->getType()->isRecordType()) {
2776 const RecordDecl *RD = Field->getType()->getAsRecordDecl();
2779 CheckIfTriviallyCopyable);
2784 bool IsBitIntType = Field->getType()->isBitIntType();
2785 if (!Field->getType()->isReferenceType() && !IsBitIntType &&
2787 CheckIfTriviallyCopyable))
2788 return std::nullopt;
2790 int64_t FieldSizeInBits =
2792 if (Field->isBitField()) {
2795 if (Field->isUnnamedBitField())
2798 int64_t BitfieldSize = Field->getBitWidthValue();
2800 if ((
unsigned)BitfieldSize >
2801 cast<BitIntType>(Field->getType())->getNumBits())
2802 return std::nullopt;
2803 }
else if (BitfieldSize > FieldSizeInBits) {
2804 return std::nullopt;
2806 FieldSizeInBits = BitfieldSize;
2808 Field->getType(), CheckIfTriviallyCopyable)) {
2809 return std::nullopt;
2811 return FieldSizeInBits;
2814static std::optional<int64_t>
2816 bool CheckIfTriviallyCopyable) {
2818 CheckIfTriviallyCopyable);
2821template <
typename RangeT>
2823 const RangeT &Subobjects, int64_t CurOffsetInBits,
2825 bool CheckIfTriviallyCopyable) {
2826 for (
const auto *Subobject : Subobjects) {
2827 std::optional<int64_t> SizeInBits =
2830 return std::nullopt;
2831 if (*SizeInBits != 0) {
2833 if (Offset != CurOffsetInBits)
2834 return std::nullopt;
2835 CurOffsetInBits += *SizeInBits;
2838 return CurOffsetInBits;
2841static std::optional<int64_t>
2844 bool CheckIfTriviallyCopyable) {
2845 assert(!RD->
isUnion() &&
"Must be struct/class type");
2848 int64_t CurOffsetInBits = 0;
2849 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2850 if (ClassDecl->isDynamicClass())
2851 return std::nullopt;
2854 for (
const auto &
Base : ClassDecl->bases()) {
2857 Bases.emplace_back(
Base.getType()->getAsCXXRecordDecl());
2861 return Layout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R);
2864 std::optional<int64_t> OffsetAfterBases =
2866 Bases, CurOffsetInBits, Context, Layout, CheckIfTriviallyCopyable);
2867 if (!OffsetAfterBases)
2868 return std::nullopt;
2869 CurOffsetInBits = *OffsetAfterBases;
2872 std::optional<int64_t> OffsetAfterFields =
2874 RD->
fields(), CurOffsetInBits, Context, Layout,
2875 CheckIfTriviallyCopyable);
2876 if (!OffsetAfterFields)
2877 return std::nullopt;
2878 CurOffsetInBits = *OffsetAfterFields;
2880 return CurOffsetInBits;
2884 QualType Ty,
bool CheckIfTriviallyCopyable)
const {
2901 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2906 CheckIfTriviallyCopyable);
2909 "hasUniqueObjectRepresentations should not be called with an "
2930 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2935 if (
Record->isInvalidDecl())
2940 CheckIfTriviallyCopyable);
2943 *
this,
Record, CheckIfTriviallyCopyable);
2945 return StructSize && *StructSize ==
static_cast<int64_t
>(
getTypeSize(Ty));
2966 count += Ext->ivar_size();
2971 count += ImplDecl->ivar_size();
2989 if (isa<GNUNullExpr>(
E))
return true;
2997 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2998 I = ObjCImpls.find(
D);
2999 if (I != ObjCImpls.end())
3000 return cast<ObjCImplementationDecl>(I->second);
3007 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
3008 I = ObjCImpls.find(
D);
3009 if (I != ObjCImpls.end())
3010 return cast<ObjCCategoryImplDecl>(I->second);
3017 assert(IFaceD && ImplD &&
"Passed null params");
3018 ObjCImpls[IFaceD] = ImplD;
3024 assert(CatD && ImplD &&
"Passed null params");
3025 ObjCImpls[CatD] = ImplD;
3030 return ObjCMethodRedecls.lookup(MD);
3036 ObjCMethodRedecls[MD] = Redecl;
3041 if (
const auto *ID = dyn_cast<ObjCInterfaceDecl>(ND->
getDeclContext()))
3043 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
3044 return CD->getClassInterface();
3045 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
3046 return IMD->getClassInterface();
3054 assert(VD &&
"Passed null params");
3055 assert(VD->
hasAttr<BlocksAttr>() &&
3056 "getBlockVarCopyInits - not __block var");
3057 auto I = BlockVarCopyInits.find(VD);
3058 if (I != BlockVarCopyInits.end())
3060 return {
nullptr,
false};
3066 assert(VD && CopyExpr &&
"Passed null params");
3067 assert(VD->
hasAttr<BlocksAttr>() &&
3068 "setBlockVarCopyInits - not __block var");
3069 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr,
CanThrow);
3073 unsigned DataSize)
const {
3078 "incorrect data size provided to CreateTypeSourceInfo!");
3095 return getObjCLayout(
D,
nullptr);
3101 return getObjCLayout(
D->getClassInterface(),
D);
3106 bool &AnyNonCanonArgs) {
3108 for (
auto &Arg : CanonArgs) {
3110 Arg =
C.getCanonicalTemplateArgument(Arg);
3111 AnyNonCanonArgs |= !Arg.structurallyEquals(OrigArg);
3121ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
3126 llvm::FoldingSetNodeID
ID;
3128 void *insertPos =
nullptr;
3129 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
3130 assert(eq->getQualifiers() == quals);
3139 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
3142 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
3145 auto *eq =
new (*
this,
alignof(
ExtQuals))
ExtQuals(baseType, canon, quals);
3146 ExtQualNodes.InsertNode(eq, insertPos);
3151 LangAS AddressSpace)
const {
3164 "Type cannot be in multiple addr spaces!");
3167 return getExtQualType(TypeNode, Quals);
3173 if (!
T.hasAddressSpace())
3177 const Type *TypeNode;
3182 TypeNode =
T.getTypePtr();
3186 while (
T.hasAddressSpace()) {
3187 TypeNode = Quals.
strip(
T);
3191 if (!
QualType(TypeNode, 0).hasAddressSpace())
3195 T =
T.getSingleStepDesugaredType(*
this);
3205 return getExtQualType(TypeNode, Quals);
3213 "Attempted to get vtable pointer discriminator on a monomorphic type");
3216 llvm::raw_svector_ostream Out(Str);
3217 MC->mangleCXXVTable(RD, Out);
3218 return llvm::getPointerAuthStableSipHash(Str);
3247 Ctx, OS, cast<AtomicType>(
T)->getValueType());
3249 case Type::LValueReference:
3254 case Type::RValueReference:
3268 case Type::ObjCObjectPointer:
3269 case Type::BlockPointer:
3276 Ctx, OS, cast<ComplexType>(
T)->getElementType());
3278 case Type::VariableArray:
3279 case Type::ConstantArray:
3280 case Type::IncompleteArray:
3281 case Type::ArrayParameter:
3292 Ctx, OS, cast<ArrayType>(
T)->getElementType());
3294 case Type::ObjCInterface:
3295 case Type::ObjCObject:
3296 OS <<
"<objc_object>";
3305 QualType UnderlyingType = cast<EnumType>(
T)->getDecl()->getIntegerType();
3307 Ctx, OS, UnderlyingType.
isNull() ? Ctx.
IntTy : UnderlyingType);
3310 case Type::FunctionNoProto:
3311 case Type::FunctionProto: {
3325 const auto *FuncType = cast<FunctionType>(
T);
3327 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FuncType)) {
3328 for (
QualType Param : FPT->param_types()) {
3332 if (FPT->isVariadic())
3339 case Type::MemberPointer: {
3346 case Type::ExtVector:
3354 case Type::ConstantMatrix:
3358 case Type::Builtin: {
3360 switch (BTy->getKind()) {
3361#define SIGNED_TYPE(Id, SingletonId) \
3362 case BuiltinType::Id: \
3365#define UNSIGNED_TYPE(Id, SingletonId) \
3366 case BuiltinType::Id: \
3369#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
3370#define BUILTIN_TYPE(Id, SingletonId)
3371#include "clang/AST/BuiltinTypes.def"
3372 llvm_unreachable(
"placeholder types should not appear here.");
3374 case BuiltinType::Half:
3377 case BuiltinType::Float:
3380 case BuiltinType::Double:
3383 case BuiltinType::LongDouble:
3386 case BuiltinType::Float16:
3389 case BuiltinType::Float128:
3393 case BuiltinType::Void:
3397 case BuiltinType::ObjCId:
3398 case BuiltinType::ObjCClass:
3399 case BuiltinType::ObjCSel:
3400 case BuiltinType::NullPtr:
3405 case BuiltinType::OCLSampler:
3406 case BuiltinType::OCLEvent:
3407 case BuiltinType::OCLClkEvent:
3408 case BuiltinType::OCLQueue:
3409 case BuiltinType::OCLReserveID:
3410 case BuiltinType::BFloat16:
3411 case BuiltinType::VectorQuad:
3412 case BuiltinType::VectorPair:
3417 case BuiltinType::Ibm128:
3419#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3420 case BuiltinType::Id: \
3422#include "clang/Basic/OpenCLImageTypes.def"
3423#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
3424 case BuiltinType::Id: \
3426#include "clang/Basic/OpenCLExtensionTypes.def"
3427#define SVE_TYPE(Name, Id, SingletonId) \
3428 case BuiltinType::Id: \
3430#include "clang/Basic/AArch64SVEACLETypes.def"
3431#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \
3432 case BuiltinType::Id: \
3434#include "clang/Basic/HLSLIntangibleTypes.def"
3435 case BuiltinType::Dependent:
3436 llvm_unreachable(
"should never get here");
3437#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id:
3438#include "clang/Basic/AMDGPUTypes.def"
3439 case BuiltinType::WasmExternRef:
3440#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
3441#include "clang/Basic/RISCVVTypes.def"
3442 llvm_unreachable(
"not yet implemented");
3444 llvm_unreachable(
"should never get here");
3446 case Type::Record: {
3467 II = Typedef->getDeclName().getAsIdentifierInfo();
3470 OS <<
"<anonymous_record>";
3476 case Type::HLSLAttributedResource:
3477 llvm_unreachable(
"should never get here");
3479 case Type::DeducedTemplateSpecialization:
3481#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
3482#define DEPENDENT_TYPE(Class, Base) case Type::Class:
3483#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
3484#define ABSTRACT_TYPE(Class, Base)
3485#define TYPE(Class, Base)
3486#include "clang/AST/TypeNodes.inc"
3487 llvm_unreachable(
"unexpected non-canonical or dependent type!");
3494 "cannot compute type discriminator of a dependent type");
3497 llvm::raw_svector_ostream Out(Str);
3505 T =
T.getUnqualifiedType();
3526 if (MPT->isMemberFunctionPointer()) {
3535 MC->mangleCanonicalTypeName(
T, Out);
3538 return llvm::getPointerAuthStableSipHash(Str);
3563 "Type cannot have multiple ObjCGCs!");
3566 return getExtQualType(TypeNode, Quals);
3580 QualType WrappedTy,
Expr *CountExpr,
bool CountInBytes,
bool OrNull,
3584 llvm::FoldingSetNodeID ID;
3587 void *InsertPos =
nullptr;
3589 CountAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
3594 size_t Size = CountAttributedType::totalSizeToAlloc<TypeCoupledDeclRefInfo>(
3595 DependentDecls.size());
3598 OrNull, DependentDecls);
3599 Types.push_back(CATy);
3600 CountAttributedTypes.InsertNode(CATy, InsertPos);
3609 case Type::Attributed: {
3610 const auto *AT = cast<AttributedType>(Orig);
3617 case Type::BTFTagAttributed: {
3618 const auto *BTFT = dyn_cast<BTFTagAttributedType>(Orig);
3623 case Type::Elaborated: {
3624 const auto *ET = cast<ElaboratedType>(Orig);
3631 adjustType(cast<ParenType>(Orig)->getInnerType(), Adjust));
3633 case Type::Adjusted: {
3634 const auto *AT = cast<AdjustedType>(Orig);
3639 case Type::MacroQualified: {
3640 const auto *MQT = cast<MacroQualifiedType>(Orig);
3642 MQT->getMacroIdentifier());
3646 return Adjust(Orig);
3656 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(
T)) {
3659 const auto *FPT = cast<FunctionProtoType>(
T);
3665 return cast<FunctionType>(
Result.getTypePtr());
3676 FPT->getExtProtoInfo());
3691 L->DeducedReturnType(FD, ResultType);
3702 return getFunctionType(Proto->getReturnType(), Proto->getParamTypes(),
3703 Proto->getExtProtoInfo().withExceptionSpec(ESI));
3719 for (
unsigned i = 0, n = Args.size(); i != n; ++i)
3742 return getFunctionType(Proto->getReturnType(), Proto->param_types(), EPI);
3768 if (TSInfo->getType() != FD->
getType())
3776 "TypeLoc size mismatch from updating exception specification");
3777 TSInfo->overrideType(Updated);
3786 llvm::FoldingSetNodeID ID;
3789 void *InsertPos =
nullptr;
3790 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
3796 if (!
T.isCanonical()) {
3800 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
3801 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3804 Types.push_back(New);
3805 ComplexTypes.InsertNode(New, InsertPos);
3814 llvm::FoldingSetNodeID ID;
3817 void *InsertPos =
nullptr;
3818 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3824 if (!
T.isCanonical()) {
3828 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3829 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3832 Types.push_back(New);
3833 PointerTypes.InsertNode(New, InsertPos);
3838 llvm::FoldingSetNodeID ID;
3840 void *InsertPos =
nullptr;
3841 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3848 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3849 assert(!AT &&
"Shouldn't be in the map!");
3853 Types.push_back(AT);
3854 AdjustedTypes.InsertNode(AT, InsertPos);
3859 llvm::FoldingSetNodeID ID;
3861 void *InsertPos =
nullptr;
3862 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3869 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3870 assert(!AT &&
"Shouldn't be in the map!");
3873 Types.push_back(AT);
3874 AdjustedTypes.InsertNode(AT, InsertPos);
3905 const auto *ATy = cast<ConstantArrayType>(Ty);
3906 llvm::FoldingSetNodeID ID;
3907 ATy->Profile(ID, *
this, ATy->getElementType(), ATy->getZExtSize(),
3908 ATy->getSizeExpr(), ATy->getSizeModifier(),
3909 ATy->getIndexTypeQualifiers().getAsOpaqueValue());
3910 void *InsertPos =
nullptr;
3912 ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3921 AT = ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3922 assert(!AT &&
"Shouldn't be in the map!");
3927 Types.push_back(AT);
3928 ArrayParameterTypes.InsertNode(AT, InsertPos);
3938 llvm::FoldingSetNodeID ID;
3941 void *InsertPos =
nullptr;
3943 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3949 if (!
T.isCanonical()) {
3954 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3955 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3959 Types.push_back(New);
3960 BlockPointerTypes.InsertNode(New, InsertPos);
3970 "Unresolved placeholder type");
3974 llvm::FoldingSetNodeID ID;
3977 void *InsertPos =
nullptr;
3979 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3987 if (!SpelledAsLValue || InnerRef || !
T.isCanonical()) {
3988 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
3993 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3994 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3999 Types.push_back(New);
4000 LValueReferenceTypes.InsertNode(New, InsertPos);
4010 "Unresolved placeholder type");
4014 llvm::FoldingSetNodeID ID;
4017 void *InsertPos =
nullptr;
4019 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
4027 if (InnerRef || !
T.isCanonical()) {
4028 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
4033 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
4034 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4039 Types.push_back(New);
4040 RValueReferenceTypes.InsertNode(New, InsertPos);
4049 llvm::FoldingSetNodeID ID;
4052 void *InsertPos =
nullptr;
4054 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4065 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4066 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4070 Types.push_back(New);
4071 MemberPointerTypes.InsertNode(New, InsertPos);
4078 const llvm::APInt &ArySizeIn,
4079 const Expr *SizeExpr,
4081 unsigned IndexTypeQuals)
const {
4084 "Constant array of VLAs is illegal!");
4092 llvm::APInt ArySize(ArySizeIn);
4093 ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
4095 llvm::FoldingSetNodeID ID;
4097 ASM, IndexTypeQuals);
4099 void *InsertPos =
nullptr;
4101 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
4112 ASM, IndexTypeQuals);
4117 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
4118 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4121 auto *New = ConstantArrayType::Create(*
this, EltTy, Canon, ArySize, SizeExpr,
4122 ASM, IndexTypeQuals);
4123 ConstantArrayTypes.InsertNode(New, InsertPos);
4124 Types.push_back(New);
4133 if (!
type->isVariablyModifiedType())
return type;
4138 const Type *ty = split.
Ty;
4140#define TYPE(Class, Base)
4141#define ABSTRACT_TYPE(Class, Base)
4142#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
4143#include "clang/AST/TypeNodes.inc"
4144 llvm_unreachable(
"didn't desugar past all non-canonical types?");
4150 case Type::DependentVector:
4151 case Type::ExtVector:
4152 case Type::DependentSizedExtVector:
4153 case Type::ConstantMatrix:
4154 case Type::DependentSizedMatrix:
4155 case Type::DependentAddressSpace:
4156 case Type::ObjCObject:
4157 case Type::ObjCInterface:
4158 case Type::ObjCObjectPointer:
4161 case Type::UnresolvedUsing:
4162 case Type::TypeOfExpr:
4164 case Type::Decltype:
4165 case Type::UnaryTransform:
4166 case Type::DependentName:
4167 case Type::InjectedClassName:
4168 case Type::TemplateSpecialization:
4169 case Type::DependentTemplateSpecialization:
4170 case Type::TemplateTypeParm:
4171 case Type::SubstTemplateTypeParmPack:
4173 case Type::DeducedTemplateSpecialization:
4174 case Type::PackExpansion:
4175 case Type::PackIndexing:
4177 case Type::DependentBitInt:
4178 case Type::ArrayParameter:
4179 case Type::HLSLAttributedResource:
4180 llvm_unreachable(
"type should never be variably-modified");
4184 case Type::FunctionNoProto:
4185 case Type::FunctionProto:
4186 case Type::BlockPointer:
4187 case Type::MemberPointer:
4200 case Type::LValueReference: {
4201 const auto *lv = cast<LValueReferenceType>(ty);
4204 lv->isSpelledAsLValue());
4208 case Type::RValueReference: {
4209 const auto *lv = cast<RValueReferenceType>(ty);
4215 case Type::Atomic: {
4216 const auto *at = cast<AtomicType>(ty);
4221 case Type::ConstantArray: {
4222 const auto *cat = cast<ConstantArrayType>(ty);
4227 cat->getSizeModifier(),
4228 cat->getIndexTypeCVRQualifiers());
4232 case Type::DependentSizedArray: {
4233 const auto *dat = cast<DependentSizedArrayType>(ty);
4237 dat->getSizeModifier(),
4238 dat->getIndexTypeCVRQualifiers(),
4239 dat->getBracketsRange());
4244 case Type::IncompleteArray: {
4245 const auto *iat = cast<IncompleteArrayType>(ty);
4254 case Type::VariableArray: {
4255 const auto *vat = cast<VariableArrayType>(ty);
4259 vat->getIndexTypeCVRQualifiers(), vat->getBracketsRange());
4272 unsigned IndexTypeQuals,
4283 IndexTypeQuals, Brackets);
4290 VariableArrayTypes.push_back(New);
4291 Types.push_back(New);
4301 unsigned elementTypeQuals,
4305 "Size must be type- or value-dependent!");
4309 void *insertPos =
nullptr;
4310 llvm::FoldingSetNodeID ID;
4312 ID, *
this, numElements ?
QualType(canonElementType.
Ty, 0) : elementType,
4313 ASM, elementTypeQuals, numElements);
4317 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
4328 elementTypeQuals, brackets);
4329 DependentSizedArrayTypes.InsertNode(newType, insertPos);
4330 Types.push_back(newType);
4338 numElements, ASM, elementTypeQuals, brackets);
4339 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
4340 Types.push_back(canonTy);
4345 canonElementType.
Quals);
4349 if (
QualType(canonElementType.
Ty, 0) == elementType &&
4357 elementTypeQuals, brackets);
4358 Types.push_back(sugaredType);
4364 unsigned elementTypeQuals)
const {
4365 llvm::FoldingSetNodeID ID;
4368 void *insertPos =
nullptr;
4370 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
4382 ASM, elementTypeQuals);
4387 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
4388 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
4394 IncompleteArrayTypes.InsertNode(newType, insertPos);
4395 Types.push_back(newType);
4401#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS) \
4402 {getIntTypeForBitwidth(BITS, SIGNED), llvm::ElementCount::getScalable(ELTS), \
4405#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS) \
4406 {ELTTY, llvm::ElementCount::getScalable(ELTS), NUMVECTORS};
4410 llvm_unreachable(
"Unsupported builtin vector type");
4412#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \
4413 ElBits, NF, IsSigned) \
4414 case BuiltinType::Id: \
4415 return {getIntTypeForBitwidth(ElBits, IsSigned), \
4416 llvm::ElementCount::getScalable(NumEls), NF};
4417#define SVE_VECTOR_TYPE_FLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4419 case BuiltinType::Id: \
4420 return {ElBits == 16 ? HalfTy : (ElBits == 32 ? FloatTy : DoubleTy), \
4421 llvm::ElementCount::getScalable(NumEls), NF};
4422#define SVE_VECTOR_TYPE_BFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4424 case BuiltinType::Id: \
4425 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
4426#define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \
4427 case BuiltinType::Id: \
4428 return {BoolTy, llvm::ElementCount::getScalable(NumEls), NF};
4429#define AARCH64_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4431 case BuiltinType::Id: \
4432 return {getIntTypeForBitwidth(ElBits, false), \
4433 llvm::ElementCount::getFixed(NumEls), NF};
4434#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId)
4435#include "clang/Basic/AArch64SVEACLETypes.def"
4437#define RVV_VECTOR_TYPE_INT(Name, Id, SingletonId, NumEls, ElBits, NF, \
4439 case BuiltinType::Id: \
4440 return {getIntTypeForBitwidth(ElBits, IsSigned), \
4441 llvm::ElementCount::getScalable(NumEls), NF};
4442#define RVV_VECTOR_TYPE_FLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4443 case BuiltinType::Id: \
4444 return {ElBits == 16 ? Float16Ty : (ElBits == 32 ? FloatTy : DoubleTy), \
4445 llvm::ElementCount::getScalable(NumEls), NF};
4446#define RVV_VECTOR_TYPE_BFLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4447 case BuiltinType::Id: \
4448 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
4449#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4450 case BuiltinType::Id: \
4451 return {BoolTy, llvm::ElementCount::getScalable(NumEls), 1};
4452#include "clang/Basic/RISCVVTypes.def"
4459 if (
Target->getTriple().isWasm() &&
Target->hasFeature(
"reference-types")) {
4460#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
4461 if (BuiltinType::Id == BuiltinType::WasmExternRef) \
4463#include "clang/Basic/WebAssemblyReferenceTypes.def"
4466 "shouldn't try to generate type externref outside WebAssembly target");
4473 unsigned NumFields)
const {
4474 if (
Target->hasAArch64SVETypes()) {
4477#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \
4478 ElBits, NF, IsSigned) \
4479 if (EltTy->hasIntegerRepresentation() && !EltTy->isBooleanType() && \
4480 EltTy->hasSignedIntegerRepresentation() == IsSigned && \
4481 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4482 return SingletonId; \
4484#define SVE_VECTOR_TYPE_FLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4486 if (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4487 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4488 return SingletonId; \
4490#define SVE_VECTOR_TYPE_BFLOAT(Name, MangledName, Id, SingletonId, NumEls, \
4492 if (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4493 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \
4494 return SingletonId; \
4496#define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \
4497 if (EltTy->isBooleanType() && NumElts == (NumEls * NF) && NumFields == 1) \
4499#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId)
4500#define AARCH64_VECTOR_TYPE(Name, MangledName, Id, SingletonId)
4501#include "clang/Basic/AArch64SVEACLETypes.def"
4502 }
else if (
Target->hasRISCVVTypes()) {
4504#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
4506 if (!EltTy->isBooleanType() && \
4507 ((EltTy->hasIntegerRepresentation() && \
4508 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4509 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4511 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4512 IsBF && !IsFP)) && \
4513 EltTySize == ElBits && NumElts == NumEls && NumFields == NF) \
4515#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4516 if (EltTy->isBooleanType() && NumElts == NumEls) \
4518#include "clang/Basic/RISCVVTypes.def"
4534 llvm::FoldingSetNodeID ID;
4537 void *InsertPos =
nullptr;
4538 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4548 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4549 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4552 VectorType(vecType, NumElts, Canonical, VecKind);
4553 VectorTypes.InsertNode(New, InsertPos);
4554 Types.push_back(New);
4561 llvm::FoldingSetNodeID ID;
4564 void *InsertPos =
nullptr;
4566 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4571 VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
4574 if (CanonVecTy == VecType) {
4579 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4580 assert(!CanonCheck &&
4581 "Dependent-sized vector_size canonical type broken");
4583 DependentVectorTypes.InsertNode(New, InsertPos);
4592 Types.push_back(New);
4599 unsigned NumElts)
const {
4607 llvm::FoldingSetNodeID ID;
4610 void *InsertPos =
nullptr;
4611 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4621 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4622 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4626 VectorTypes.InsertNode(New, InsertPos);
4627 Types.push_back(New);
4635 llvm::FoldingSetNodeID ID;
4639 void *InsertPos =
nullptr;
4641 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4651 if (CanonVecTy == vecType) {
4656 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4657 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
4659 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
4668 Types.push_back(New);
4673 unsigned NumColumns)
const {
4674 llvm::FoldingSetNodeID ID;
4676 Type::ConstantMatrix);
4679 "need a valid element type");
4682 "need valid matrix dimensions");
4683 void *InsertPos =
nullptr;
4693 assert(!NewIP &&
"Matrix type shouldn't already exist in the map");
4699 MatrixTypes.InsertNode(New, InsertPos);
4700 Types.push_back(New);
4709 llvm::FoldingSetNodeID ID;
4713 void *InsertPos =
nullptr;
4715 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4720 ColumnExpr, AttrLoc);
4723 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4724 assert(!CanonCheck &&
"Dependent-sized matrix canonical type broken");
4726 DependentSizedMatrixTypes.InsertNode(Canon, InsertPos);
4727 Types.push_back(Canon);
4740 ColumnExpr, AttrLoc);
4741 Types.push_back(New);
4746 Expr *AddrSpaceExpr,
4752 void *insertPos =
nullptr;
4753 llvm::FoldingSetNodeID ID;
4758 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
4764 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
4765 Types.push_back(canonTy);
4768 if (canonPointeeType == PointeeType &&
4774 AddrSpaceExpr, AttrLoc);
4775 Types.push_back(sugaredType);
4781 return T.isCanonical() &&
4799 llvm::FoldingSetNodeID ID;
4802 void *InsertPos =
nullptr;
4804 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
4814 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4815 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4820 Types.push_back(New);
4821 FunctionNoProtoTypes.InsertNode(New, InsertPos);
4837 return CanResultType;
4844 if (!NoexceptInType)
4861 bool AnyPackExpansions =
false;
4866 AnyPackExpansions =
true;
4868 return AnyPackExpansions;
4874QualType ASTContext::getFunctionTypeInternal(
4877 size_t NumArgs = ArgArray.size();
4881 llvm::FoldingSetNodeID
ID;
4886 bool Unique =
false;
4888 void *InsertPos =
nullptr;
4890 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4910 bool IsCanonicalExceptionSpec =
4914 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
4916 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
4917 if (!ArgArray[i].isCanonicalAsParam())
4918 isCanonical =
false;
4920 if (OnlyWantCanonical)
4921 assert(isCanonical &&
4922 "given non-canonical parameters constructing canonical type");
4927 if (!isCanonical && Canonical.
isNull()) {
4929 CanonicalArgs.reserve(NumArgs);
4930 for (
unsigned i = 0; i != NumArgs; ++i)
4937 if (IsCanonicalExceptionSpec) {
4939 }
else if (NoexceptInType) {
4952 bool AnyPacks =
false;
4975 llvm_unreachable(
"dependent noexcept is already canonical");
4984 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
4988 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4989 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4994 auto ESH = FunctionProtoType::getExceptionSpecSize(
4996 size_t Size = FunctionProtoType::totalSizeToAlloc<
5003 ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
5011 Types.push_back(FTP);
5013 FunctionProtoTypes.InsertNode(FTP, InsertPos);
5015 AnyFunctionEffects =
true;
5020 llvm::FoldingSetNodeID
ID;
5023 void *InsertPos =
nullptr;
5024 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
5030 if (!
T.isCanonical()) {
5034 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
5035 assert(!NewIP &&
"Shouldn't be in the map!");
5039 Types.push_back(New);
5040 PipeTypes.InsertNode(New, InsertPos);
5051 return getPipeType(
T,
true);
5055 return getPipeType(
T,
false);
5059 llvm::FoldingSetNodeID ID;
5062 void *InsertPos =
nullptr;
5063 if (
BitIntType *EIT = BitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
5067 BitIntTypes.InsertNode(New, InsertPos);
5068 Types.push_back(New);
5073 Expr *NumBitsExpr)
const {
5075 llvm::FoldingSetNodeID ID;
5078 void *InsertPos =
nullptr;
5080 DependentBitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
5085 DependentBitIntTypes.InsertNode(New, InsertPos);
5087 Types.push_back(New);
5093 if (!isa<CXXRecordDecl>(
D))
return false;
5094 const auto *RD = cast<CXXRecordDecl>(
D);
5095 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
5097 if (RD->getDescribedClassTemplate() &&
5098 !isa<ClassTemplateSpecializationDecl>(RD))
5109 if (
Decl->TypeForDecl) {
5110 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
5112 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
5113 Decl->TypeForDecl = PrevDecl->TypeForDecl;
5114 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
5118 Decl->TypeForDecl = newType;
5119 Types.push_back(newType);
5127 assert(
Decl &&
"Passed null for Decl param");
5128 assert(!
Decl->TypeForDecl &&
"TypeForDecl present in slow case");
5130 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(
Decl))
5133 assert(!isa<TemplateTypeParmDecl>(
Decl) &&
5134 "Template type parameter types are always available.");
5136 if (
const auto *
Record = dyn_cast<RecordDecl>(
Decl)) {
5137 assert(
Record->isFirstDecl() &&
"struct/union has previous declaration");
5140 }
else if (
const auto *
Enum = dyn_cast<EnumDecl>(
Decl)) {
5141 assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
5143 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(
Decl)) {
5146 llvm_unreachable(
"TypeDecl without a type?");
5155 if (!
Decl->TypeForDecl) {
5157 Underlying =
Decl->getUnderlyingType();
5160 Decl->TypeForDecl = NewType;
5161 Types.push_back(NewType);
5164 if (Underlying.
isNull() ||
Decl->getUnderlyingType() == Underlying)
5168 llvm::FoldingSetNodeID ID;
5171 void *InsertPos =
nullptr;
5172 if (
TypedefType *
T = TypedefTypes.FindNodeOrInsertPos(ID, InsertPos)) {
5173 assert(!
T->typeMatchesDecl() &&
5174 "non-divergent case should be handled with TypeDecl");
5178 void *Mem =
Allocate(TypedefType::totalSizeToAlloc<QualType>(
true),
5180 auto *NewType =
new (Mem)
TypedefType(Type::Typedef,
Decl, Underlying,
5182 TypedefTypes.InsertNode(NewType, InsertPos);
5183 Types.push_back(NewType);
5189 llvm::FoldingSetNodeID ID;
5192 void *InsertPos =
nullptr;
5193 if (
UsingType *
T = UsingTypes.FindNodeOrInsertPos(ID, InsertPos))
5196 const Type *TypeForDecl =
5197 cast<TypeDecl>(
Found->getTargetDecl())->getTypeForDecl();
5206 Allocate(UsingType::totalSizeToAlloc<QualType>(!Underlying.
isNull()),
5209 Types.push_back(NewType);
5210 UsingTypes.InsertNode(NewType, InsertPos);
5218 if (PrevDecl->TypeForDecl)
5219 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
5222 Decl->TypeForDecl = newType;
5223 Types.push_back(newType);
5231 if (PrevDecl->TypeForDecl)
5232 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
5235 Decl->TypeForDecl = newType;
5236 Types.push_back(newType);
5241 unsigned NumPositiveBits,
5244 unsigned IntWidth =
Target->getIntWidth();
5245 unsigned CharWidth =
Target->getCharWidth();
5246 unsigned ShortWidth =
Target->getShortWidth();
5247 bool EnumTooLarge =
false;
5249 if (NumNegativeBits) {
5253 if (IsPacked && NumNegativeBits <= CharWidth &&
5254 NumPositiveBits < CharWidth) {
5256 BestWidth = CharWidth;
5257 }
else if (IsPacked && NumNegativeBits <= ShortWidth &&
5258 NumPositiveBits < ShortWidth) {
5260 BestWidth = ShortWidth;
5261 }
else if (NumNegativeBits <= IntWidth && NumPositiveBits < IntWidth) {
5263 BestWidth = IntWidth;
5265 BestWidth =
Target->getLongWidth();
5267 if (NumNegativeBits <= BestWidth && NumPositiveBits < BestWidth) {
5270 BestWidth =
Target->getLongLongWidth();
5272 if (NumNegativeBits > BestWidth || NumPositiveBits >= BestWidth)
5273 EnumTooLarge =
true;
5277 BestPromotionType = (BestWidth <= IntWidth ?
IntTy : BestType);
5282 if (IsPacked && NumPositiveBits <= CharWidth) {
5284 BestPromotionType =
IntTy;
5285 BestWidth = CharWidth;
5286 }
else if (IsPacked && NumPositiveBits <= ShortWidth) {
5288 BestPromotionType =
IntTy;
5289 BestWidth = ShortWidth;
5290 }
else if (NumPositiveBits <= IntWidth) {
5292 BestWidth = IntWidth;
5293 BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5296 }
else if (NumPositiveBits <= (BestWidth =
Target->getLongWidth())) {
5298 BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5302 BestWidth =
Target->getLongLongWidth();
5303 if (NumPositiveBits > BestWidth) {
5308 EnumTooLarge =
true;
5311 BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5316 return EnumTooLarge;
5321 if (
Decl->TypeForDecl)
5326 if (CanonicalDecl->TypeForDecl)
5327 return QualType(
Decl->TypeForDecl = CanonicalDecl->TypeForDecl, 0);
5331 Decl->TypeForDecl = newType;
5332 Types.push_back(newType);
5339 const Attr *attr)
const {
5340 llvm::FoldingSetNodeID id;
5343 void *insertPos =
nullptr;
5347 assert(!
attr ||
attr->getKind() == attrKind);
5353 Types.push_back(
type);
5354 AttributedTypes.InsertNode(
type, insertPos);
5367 switch (nullability) {
5383 llvm_unreachable(
"Unknown nullability kind");
5388 llvm::FoldingSetNodeID ID;
5391 void *InsertPos =
nullptr;
5393 BTFTagAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
5401 Types.push_back(Ty);
5402 BTFTagAttributedTypes.InsertNode(Ty, InsertPos);
5411 llvm::FoldingSetNodeID ID;
5414 void *InsertPos =
nullptr;
5416 HLSLAttributedResourceTypes.FindNodeOrInsertPos(ID, InsertPos);
5423 Types.push_back(Ty);
5424 HLSLAttributedResourceTypes.InsertNode(Ty, InsertPos);
5430 QualType Replacement,
Decl *AssociatedDecl,
unsigned Index,
5431 std::optional<unsigned> PackIndex,
5433 llvm::FoldingSetNodeID ID;
5436 void *InsertPos =
nullptr;
5438 SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5441 void *Mem =
Allocate(SubstTemplateTypeParmType::totalSizeToAlloc<QualType>(
5442 !Replacement.isCanonical()),
5445 Index, PackIndex, Flag);
5446 Types.push_back(SubstParm);
5447 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
5456 unsigned Index,
bool Final,
5463 llvm::FoldingSetNodeID ID;
5466 void *InsertPos =
nullptr;
5468 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
5478 [[maybe_unused]]
const auto *Nothing =
5479 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
5487 Types.push_back(SubstParm);
5488 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
5498 llvm::FoldingSetNodeID ID;
5500 void *InsertPos =
nullptr;
5502 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5513 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5514 assert(!TypeCheck &&
"Template type parameter canonical type broken");
5518 Depth, Index, ParameterPack,
nullptr,
QualType());
5520 Types.push_back(TypeParm);
5521 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
5531 assert(!Name.getAsDependentTemplateName() &&
5532 "No dependent template names here!");
5543 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
5553 "No dependent template names here!");
5556 ArgVec.reserve(Args.size());
5558 ArgVec.push_back(Arg.getArgument());
5566 if (Arg.isPackExpansion())
5578 "No dependent template names here!");
5583 if (!Underlying.
isNull())
5589 "Caller must compute aliased type");
5590 IsTypeAlias =
false;
5599 (IsTypeAlias ?
sizeof(
QualType) : 0),
5603 IsTypeAlias ? Underlying :
QualType());
5605 Types.push_back(Spec);
5612 "No dependent template names here!");
5621 bool AnyNonCanonArgs =
false;
5627 llvm::FoldingSetNodeID ID;
5631 void *InsertPos =
nullptr;
5633 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5643 Types.push_back(Spec);
5644 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
5648 "Non-dependent template-id type must have a canonical type");
5655 TagDecl *OwnedTagDecl)
const {
5656 llvm::FoldingSetNodeID ID;
5659 void *InsertPos =
nullptr;
5660 ElaboratedType *
T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5667 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5668 assert(!CheckT &&
"Elaborated canonical type broken");
5673 Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
5675 T =
new (Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
5678 ElaboratedTypes.InsertNode(
T, InsertPos);
5684 llvm::FoldingSetNodeID ID;
5687 void *InsertPos =
nullptr;
5688 ParenType *
T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5695 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5696 assert(!CheckT &&
"Paren canonical type broken");
5702 ParenTypes.InsertNode(
T, InsertPos);
5715 Types.push_back(newType);
5725 if (CanonNNS != NNS)
5729 llvm::FoldingSetNodeID ID;
5732 void *InsertPos =
nullptr;
5734 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
5741 DependentNameTypes.InsertNode(
T, InsertPos);
5750 for (
unsigned I = 0,
E = Args.size(); I !=
E; ++I)
5762 "nested-name-specifier must be dependent");
5764 llvm::FoldingSetNodeID ID;
5768 void *InsertPos =
nullptr;
5770 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5780 bool AnyNonCanonArgs =
false;
5785 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
5791 [[maybe_unused]]
auto *Nothing =
5792 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5793 assert(!Nothing &&
"canonical type broken");
5802 DependentTemplateSpecializationTypes.InsertNode(
T, InsertPos);
5808 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
5814 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
5816 NTTP->getType().getNonPackExpansionType().getNonLValueExprType(*
this);
5831 Expr *
E =
new (*this)
5833 T, VK, NTTP->getLocation());
5835 if (NTTP->isParameterPack())
5840 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
5857 std::optional<unsigned> NumExpansions,
5858 bool ExpectPackInType)
const {
5860 "Pack expansions must expand one or more parameter packs");
5862 llvm::FoldingSetNodeID ID;
5865 void *InsertPos =
nullptr;
5877 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
5883 PackExpansionTypes.InsertNode(
T, InsertPos);
5895 if (Protocols.empty())
return true;
5900 for (
unsigned i = 1; i != Protocols.size(); ++i)
5910 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
5914 P =
P->getCanonicalDecl();
5917 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
5918 Protocols.erase(ProtocolsEnd, Protocols.end());
5923 unsigned NumProtocols)
const {
5933 bool isKindOf)
const {
5936 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
5937 isa<ObjCInterfaceType>(baseType))
5941 llvm::FoldingSetNodeID ID;
5943 void *InsertPos =
nullptr;
5944 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
5951 if (effectiveTypeArgs.empty()) {
5953 effectiveTypeArgs = baseObject->getTypeArgs();
5960 bool typeArgsAreCanonical = llvm::all_of(
5963 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
5967 if (!typeArgsAreCanonical) {
5968 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
5969 for (
auto typeArg : effectiveTypeArgs)
5971 canonTypeArgs = canonTypeArgsVec;
5973 canonTypeArgs = effectiveTypeArgs;
5978 if (!protocolsSorted) {
5979 canonProtocolsVec.append(protocols.begin(), protocols.end());
5981 canonProtocols = canonProtocolsVec;
5983 canonProtocols = protocols;
5987 canonProtocols, isKindOf);
5990 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
5994 size += typeArgs.size() *
sizeof(
QualType);
6002 ObjCObjectTypes.InsertNode(
T, InsertPos);
6012 bool allowOnPointerType)
const {
6015 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(
type.getTypePtr())) {
6020 if (allowOnPointerType) {
6021 if (
const auto *objPtr =
6022 dyn_cast<ObjCObjectPointerType>(
type.getTypePtr())) {
6028 protocolsVec.append(protocols.begin(), protocols.end());
6040 if (
const auto *objT = dyn_cast<ObjCObjectType>(
type.getTypePtr())){
6045 objT->getTypeArgsAsWritten(),
6047 objT->isKindOfTypeAsWritten());
6051 if (
type->isObjCObjectType()) {
6061 if (
type->isObjCIdType()) {
6064 objPtr->isKindOfType());
6069 if (
type->isObjCClassType()) {
6072 objPtr->isKindOfType());
6084 llvm::FoldingSetNodeID ID;
6086 void *InsertPos =
nullptr;
6088 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
6093 if (!protocols.empty()) {
6097 Canonical, protocols, hasError,
true ));
6098 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
6106 Types.push_back(newType);
6107 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
6115 auto NewTypeParamTy = cast<ObjCTypeParamType>(New->
getTypeForDecl());
6117 protocols.append(NewTypeParamTy->qual_begin(), NewTypeParamTy->qual_end());
6132 for (
auto *Proto : OPT->quals()) {
6155 if (InheritedProtocols.empty())
6159 bool Conforms =
false;
6160 for (
auto *Proto : OPT->quals()) {
6162 for (
auto *PI : InheritedProtocols) {
6174 for (
auto *PI : InheritedProtocols) {
6176 bool Adopts =
false;
6177 for (
auto *Proto : OPT->quals()) {
6191 llvm::FoldingSetNodeID ID;
6194 void *InsertPos =
nullptr;
6196 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
6205 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
6214 Types.push_back(QType);
6215 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
6223 if (
Decl->TypeForDecl)
6227 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
6228 Decl->TypeForDecl = PrevDecl->TypeForDecl;
6229 return QualType(PrevDecl->TypeForDecl, 0);
6238 Decl->TypeForDecl =
T;
6251 llvm::FoldingSetNodeID ID;
6255 void *InsertPos =
nullptr;
6257 DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
6267 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
6275 Types.push_back(toe);
6288 Types.push_back(tot);
6312 llvm_unreachable(
"Unknown value kind");
6327 llvm::FoldingSetNodeID ID;
6330 void *InsertPos =
nullptr;
6332 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
6337 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
6345 Types.push_back(dt);
6350 bool FullySubstituted,
6354 if (FullySubstituted && Index != -1) {
6357 llvm::FoldingSetNodeID ID;
6360 void *InsertPos =
nullptr;
6362 DependentPackIndexingTypes.FindNodeOrInsertPos(ID, InsertPos);
6365 PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
6369 IndexExpr, FullySubstituted, Expansions);
6370 DependentPackIndexingTypes.InsertNode(Canon, InsertPos);
6376 Allocate(PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
6379 FullySubstituted, Expansions);
6394 llvm::FoldingSetNodeID ID;
6397 void *InsertPos =
nullptr;
6399 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
6405 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
6414 Types.push_back(ut);
6418QualType ASTContext::getAutoTypeInternal(
6423 !TypeConstraintConcept && !IsDependent)
6427 llvm::FoldingSetNodeID ID;
6428 bool IsDeducedDependent =
6431 IsDependent || IsDeducedDependent, TypeConstraintConcept,
6432 TypeConstraintArgs);
6433 if (
auto const AT_iter = AutoTypes.find(ID); AT_iter != AutoTypes.end())
6434 return QualType(AT_iter->getSecond(), 0);
6440 }
else if (TypeConstraintConcept) {
6441 bool AnyNonCanonArgs =
false;
6444 *
this, TypeConstraintArgs, AnyNonCanonArgs);
6445 if (CanonicalConcept != TypeConstraintConcept || AnyNonCanonArgs) {
6447 getAutoTypeInternal(
QualType(), Keyword, IsDependent, IsPack,
6448 CanonicalConcept, CanonicalConceptArgs,
true);
6458 (IsDependent ? TypeDependence::DependentInstantiation
6459 : TypeDependence::None) |
6460 (IsPack ? TypeDependence::UnexpandedPack : TypeDependence::None),
6461 Canon, TypeConstraintConcept, TypeConstraintArgs);
6463 llvm::FoldingSetNodeID InsertedID;
6464 AT->
Profile(InsertedID, *
this);
6465 assert(InsertedID == ID &&
"ID does not match");
6467 Types.push_back(AT);
6468 AutoTypes.try_emplace(ID, AT);
6477 bool IsDependent,
bool IsPack,
6480 assert((!IsPack || IsDependent) &&
"only use IsPack for a dependent pack");
6482 "A dependent auto should be undeduced");
6483 return getAutoTypeInternal(
DeducedType, Keyword, IsDependent, IsPack,
6484 TypeConstraintConcept, TypeConstraintArgs);
6488 QualType CanonT =
T.getNonPackExpansionType().getCanonicalType();
6492 if (!AT->isConstrained())
6496 AT->containsUnexpandedParameterPack()),
6508QualType ASTContext::getDeducedTemplateSpecializationTypeInternal(
6512 void *InsertPos =
nullptr;
6513 llvm::FoldingSetNodeID ID;
6517 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
6523 llvm::FoldingSetNodeID TempID;
6524 DTST->Profile(TempID);
6525 assert(ID == TempID &&
"ID does not match");
6526 Types.push_back(DTST);
6527 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
6537 ? getDeducedTemplateSpecializationTypeInternal(
6541 return getDeducedTemplateSpecializationTypeInternal(Template,
DeducedType,
6542 IsDependent, Canon);
6550 llvm::FoldingSetNodeID ID;
6553 void *InsertPos =
nullptr;
6554 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
6560 if (!
T.isCanonical()) {
6564 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
6565 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
6568 Types.push_back(New);
6569 AtomicTypes.InsertNode(New, InsertPos);
6605 return getFromTargetType(
Target->getSizeType());
6611 return getFromTargetType(
Target->getSignedSizeType());
6616 return getFromTargetType(
Target->getIntMaxType());
6621 return getFromTargetType(
Target->getUIntMaxType());
6639 return getFromTargetType(
Target->getIntPtrType());
6662 return getFromTargetType(
Target->getProcessIDType());
6674 const Type *Ty =
T.getTypePtr();
6678 }
else if (isa<ArrayType>(Ty)) {
6680 }
else if (isa<FunctionType>(Ty)) {
6702 quals = splitType.
Quals;
6707 QualType elementType = AT->getElementType();
6712 if (elementType == unqualElementType) {
6713 assert(quals.
empty());
6714 quals = splitType.
Quals;
6722 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
6724 CAT->getSizeExpr(), CAT->getSizeModifier(), 0);
6727 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
6731 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
6734 VAT->getSizeModifier(),
6735 VAT->getIndexTypeCVRQualifiers(),
6736 VAT->getBracketsRange());
6739 const auto *DSAT = cast<DependentSizedArrayType>(AT);
6741 DSAT->getSizeModifier(), 0,
6752 bool AllowPiMismatch)
const {
6767 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
6768 auto *CAT2 = dyn_cast<ConstantArrayType>(AT2);
6769 if (!((CAT2 && CAT1->getSize() == CAT2->getSize()) ||
6771 isa<IncompleteArrayType>(AT2))))
6773 }
else if (isa<IncompleteArrayType>(AT1)) {
6774 if (!(isa<IncompleteArrayType>(AT2) ||
6776 isa<ConstantArrayType>(AT2))))
6782 T1 = AT1->getElementType();
6783 T2 = AT2->getElementType();
6803 bool AllowPiMismatch)
const {
6808 if (T1PtrType && T2PtrType) {
6816 if (T1MPType && T2MPType &&
6827 if (T1OPType && T2OPType) {
6859 if (Quals1 != Quals2)
6873 switch (Name.getKind()) {
6908 = Name.getAsSubstTemplateTemplateParm();
6915 = Name.getAsSubstTemplateTemplateParmPack();
6928 llvm_unreachable(
"bad template name kind!");
6934 if (!TP->hasDefaultArgument())
6936 return &TP->getDefaultArgument().getArgument();
6938 switch (
P->getKind()) {
6939 case NamedDecl::TemplateTypeParm:
6940 return handleParam(cast<TemplateTypeParmDecl>(
P));
6941 case NamedDecl::NonTypeTemplateParm:
6942 return handleParam(cast<NonTypeTemplateParmDecl>(
P));
6943 case NamedDecl::TemplateTemplateParm:
6944 return handleParam(cast<TemplateTemplateParmDecl>(
P));
6946 llvm_unreachable(
"Unexpected template parameter kind");
6951 bool IgnoreDeduced)
const {
6952 while (std::optional<TemplateName> UnderlyingOrNone =
6953 Name.desugar(IgnoreDeduced))
6954 Name = *UnderlyingOrNone;
6956 switch (Name.getKind()) {
6959 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
6960 Template = getCanonicalTemplateTemplateParmDecl(TTP);
6968 llvm_unreachable(
"cannot canonicalize unresolved template");
6972 assert(DTN &&
"Non-dependent template names must refer to template decls.");
6973 return DTN->CanonicalTemplateName;
6978 Name.getAsSubstTemplateTemplateParmPack();
6986 assert(IgnoreDeduced ==
false);
6993 bool NonCanonical = CanonUnderlying != Underlying;
6999 assert(CanonArgs.size() <= Params.size());
7005 for (
int I = CanonArgs.size() - 1; I >= 0; --I) {
7014 if (I ==
int(CanonArgs.size() - 1))
7015 CanonArgs.pop_back();
7016 NonCanonical =
true;
7026 llvm_unreachable(
"always sugar node");
7029 llvm_unreachable(
"bad template name!");
7034 bool IgnoreDeduced)
const {
7046 llvm::FoldingSetNodeID XCEID, YCEID;
7047 XCE->
Profile(XCEID, *
this,
true,
true);
7048 YCE->
Profile(YCEID, *
this,
true,
true);
7049 return XCEID == YCEID;
7098 if (
auto *TX = dyn_cast<TemplateTypeParmDecl>(
X)) {
7099 auto *TY = cast<TemplateTypeParmDecl>(Y);
7100 if (TX->isParameterPack() != TY->isParameterPack())
7102 if (TX->hasTypeConstraint() != TY->hasTypeConstraint())
7105 TY->getTypeConstraint());
7108 if (
auto *TX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
7109 auto *TY = cast<NonTypeTemplateParmDecl>(Y);
7110 return TX->isParameterPack() == TY->isParameterPack() &&
7111 TX->getASTContext().hasSameType(TX->getType(), TY->getType()) &&
7113 TY->getPlaceholderTypeConstraint());
7116 auto *TX = cast<TemplateTemplateParmDecl>(
X);
7117 auto *TY = cast<TemplateTemplateParmDecl>(Y);
7118 return TX->isParameterPack() == TY->isParameterPack() &&
7120 TY->getTemplateParameters());
7125 if (
X->size() != Y->
size())
7128 for (
unsigned I = 0, N =
X->size(); I != N; ++I)
7142 if (
auto *TTPX = dyn_cast<TemplateTypeParmDecl>(
X)) {
7143 auto *TTPY = cast<TemplateTypeParmDecl>(Y);
7144 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
7147 return hasSameType(TTPX->getDefaultArgument().getArgument().getAsType(),
7148 TTPY->getDefaultArgument().getArgument().getAsType());
7151 if (
auto *NTTPX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
7152 auto *NTTPY = cast<NonTypeTemplateParmDecl>(Y);
7153 if (!NTTPX->hasDefaultArgument() || !NTTPY->hasDefaultArgument())
7156 Expr *DefaultArgumentX =
7157 NTTPX->getDefaultArgument().getArgument().getAsExpr()->
IgnoreImpCasts();
7158 Expr *DefaultArgumentY =
7159 NTTPY->getDefaultArgument().getArgument().getAsExpr()->
IgnoreImpCasts();
7160 llvm::FoldingSetNodeID XID, YID;
7161 DefaultArgumentX->
Profile(XID, *
this,
true);
7162 DefaultArgumentY->
Profile(YID, *
this,
true);
7166 auto *TTPX = cast<TemplateTemplateParmDecl>(
X);
7167 auto *TTPY = cast<TemplateTemplateParmDecl>(Y);
7169 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
7178 if (
auto *NS =
X->getAsNamespace())
7180 if (
auto *NAS =
X->getAsNamespaceAlias())
7181 return NAS->getNamespace();
7189 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
7191 }
else if (
X->getKind() != Y->
getKind())
7196 switch (
X->getKind()) {
7207 if (
X->getAsType()->getCanonicalTypeInternal() !=
7217 auto *PX =
X->getPrefix();
7231 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
7235 for (
auto Pair : zip_longest(AEnableIfAttrs, BEnableIfAttrs)) {
7236 std::optional<EnableIfAttr *> Cand1A = std::get<0>(Pair);
7237 std::optional<EnableIfAttr *> Cand2A = std::get<1>(Pair);
7240 if (!Cand1A || !Cand2A)
7246 (*Cand1A)->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
7247 (*Cand2A)->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
7251 if (Cand1ID != Cand2ID)
7279 if (
const auto *TypedefX = dyn_cast<TypedefNameDecl>(
X))
7280 if (
const auto *TypedefY = dyn_cast<TypedefNameDecl>(Y))
7282 TypedefY->getUnderlyingType());
7289 if (isa<ObjCInterfaceDecl>(
X) || isa<ObjCProtocolDecl>(
X))
7292 if (isa<ClassTemplateSpecializationDecl>(
X)) {
7299 if (
const auto *TagX = dyn_cast<TagDecl>(
X)) {
7300 const auto *TagY = cast<TagDecl>(Y);
7301 return (TagX->getTagKind() == TagY->getTagKind()) ||
7313 if (
const auto *FuncX = dyn_cast<FunctionDecl>(
X)) {
7314 const auto *FuncY = cast<FunctionDecl>(Y);
7315 if (
const auto *CtorX = dyn_cast<CXXConstructorDecl>(
X)) {
7316 const auto *CtorY = cast<CXXConstructorDecl>(Y);
7317 if (CtorX->getInheritedConstructor() &&
7318 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
7319 CtorY->getInheritedConstructor().getConstructor()))
7323 if (FuncX->isMultiVersion() != FuncY->isMultiVersion())
7328 if (FuncX->isMultiVersion()) {
7329 const auto *TAX = FuncX->getAttr<TargetAttr>();
7330 const auto *TAY = FuncY->getAttr<TargetAttr>();
7331 assert(TAX && TAY &&
"Multiversion Function without target attribute");
7333 if (TAX->getFeaturesStr() != TAY->getFeaturesStr())
7339 if ((FuncX->isMemberLikeConstrainedFriend() ||
7340 FuncY->isMemberLikeConstrainedFriend()) &&
7341 !FuncX->getLexicalDeclContext()->Equals(
7342 FuncY->getLexicalDeclContext())) {
7347 FuncY->getTrailingRequiresClause()))
7355 FD = FD->getCanonicalDecl();
7356 return FD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType()
7359 QualType XT = GetTypeAsWritten(FuncX), YT = GetTypeAsWritten(FuncY);
7374 return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() &&
7379 if (
const auto *VarX = dyn_cast<VarDecl>(
X)) {
7380 const auto *VarY = cast<VarDecl>(Y);
7381 if (VarX->getLinkageInternal() == VarY->getLinkageInternal()) {
7384 if (VarX->getType().isNull() || VarY->getType().isNull())
7387 if (
hasSameType(VarX->getType(), VarY->getType()))
7397 if (!VarXTy || !VarYTy)
7406 if (
const auto *NamespaceX = dyn_cast<NamespaceDecl>(
X)) {
7407 const auto *NamespaceY = cast<NamespaceDecl>(Y);
7408 return NamespaceX->isInline() == NamespaceY->isInline();
7413 if (
const auto *TemplateX = dyn_cast<TemplateDecl>(
X)) {
7414 const auto *TemplateY = cast<TemplateDecl>(Y);
7417 if (
const auto *ConceptX = dyn_cast<ConceptDecl>(
X)) {
7418 const auto *ConceptY = cast<ConceptDecl>(Y);
7420 ConceptY->getConstraintExpr()))
7425 TemplateY->getTemplatedDecl()) &&
7427 TemplateY->getTemplateParameters());
7431 if (
const auto *FDX = dyn_cast<FieldDecl>(
X)) {
7432 const auto *FDY = cast<FieldDecl>(Y);
7434 return hasSameType(FDX->getType(), FDY->getType());
7438 if (
const auto *IFDX = dyn_cast<IndirectFieldDecl>(
X)) {
7439 const auto *IFDY = cast<IndirectFieldDecl>(Y);
7440 return IFDX->getAnonField()->getCanonicalDecl() ==
7441 IFDY->getAnonField()->getCanonicalDecl();
7445 if (isa<EnumConstantDecl>(
X))
7450 if (
const auto *USX = dyn_cast<UsingShadowDecl>(
X)) {
7451 const auto *USY = cast<UsingShadowDecl>(Y);
7457 if (
const auto *UX = dyn_cast<UsingDecl>(
X)) {
7458 const auto *UY = cast<UsingDecl>(Y);
7460 UX->hasTypename() == UY->hasTypename() &&
7461 UX->isAccessDeclaration() == UY->isAccessDeclaration();
7463 if (
const auto *UX = dyn_cast<UnresolvedUsingValueDecl>(
X)) {
7464 const auto *UY = cast<UnresolvedUsingValueDecl>(Y);
7466 UX->isAccessDeclaration() == UY->isAccessDeclaration();
7468 if (
const auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(
X)) {
7471 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
7476 if (
const auto *UX = dyn_cast<UsingPackDecl>(
X)) {
7478 UX->getInstantiatedFromUsingDecl(),
7479 cast<UsingPackDecl>(Y)->getInstantiatedFromUsingDecl());
7483 if (
const auto *NAX = dyn_cast<NamespaceAliasDecl>(
X)) {
7484 const auto *NAY = cast<NamespaceAliasDecl>(Y);
7485 return NAX->getNamespace()->Equals(NAY->getNamespace());
7532 bool AnyNonCanonArgs =
false;
7535 if (!AnyNonCanonArgs)
7545 llvm_unreachable(
"Unhandled template argument kind");
7588 DNT->getIdentifier());
7602 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
7607 if (!
T.hasLocalQualifiers()) {
7609 if (
const auto *AT = dyn_cast<ArrayType>(
T))
7614 if (!isa<ArrayType>(
T.getCanonicalType()))
7629 const auto *ATy = dyn_cast<ArrayType>(split.
Ty);
7630 if (!ATy || qs.
empty())
7637 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
7640 CAT->getSizeModifier(),
7641 CAT->getIndexTypeCVRQualifiers()));
7642 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
7644 IAT->getSizeModifier(),
7645 IAT->getIndexTypeCVRQualifiers()));
7647 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
7648 return cast<ArrayType>(
7650 DSAT->getSizeExpr(),
7651 DSAT->getSizeModifier(),
7652 DSAT->getIndexTypeCVRQualifiers(),
7653 DSAT->getBracketsRange()));
7655 const auto *VAT = cast<VariableArrayType>(ATy);
7658 VAT->getSizeModifier(),
7659 VAT->getIndexTypeCVRQualifiers(),
7660 VAT->getBracketsRange()));
7674 return T.getUnqualifiedType();
7687 return T.getUnqualifiedType();
7702 assert(PrettyArrayType &&
"Not an array type!");
7739 uint64_t ElementCount = 1;
7742 CA = dyn_cast_or_null<ConstantArrayType>(
7745 return ElementCount;
7753 uint64_t ElementCount = 1;
7757 AILE = dyn_cast<ArrayInitLoopExpr>(AILE->
getSubExpr());
7760 return ElementCount;
7770 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
7772 case BuiltinType::Half:
return HalfRank;
7773 case BuiltinType::Float:
return FloatRank;
7806unsigned ASTContext::getIntegerRank(
const Type *
T)
const {
7811 if (
const auto *EIT = dyn_cast<BitIntType>(
T))
7812 return 0 + (EIT->getNumBits() << 3);
7814 switch (cast<BuiltinType>(
T)->getKind()) {
7815 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
7816 case BuiltinType::Bool:
7818 case BuiltinType::Char_S:
7819 case BuiltinType::Char_U:
7820 case BuiltinType::SChar:
7821 case BuiltinType::UChar:
7823 case BuiltinType::Short:
7824 case BuiltinType::UShort:
7826 case BuiltinType::Int:
7827 case BuiltinType::UInt:
7829 case BuiltinType::Long:
7830 case BuiltinType::ULong:
7832 case BuiltinType::LongLong:
7833 case BuiltinType::ULongLong:
7835 case BuiltinType::Int128:
7836 case BuiltinType::UInt128:
7841 case BuiltinType::Char8:
7843 case BuiltinType::Char16:
7844 return getIntegerRank(
7846 case BuiltinType::Char32:
7847 return getIntegerRank(
7849 case BuiltinType::WChar_S:
7850 case BuiltinType::WChar_U:
7851 return getIntegerRank(
7881 uint64_t BitWidth = Field->getBitWidthValue();
7904 if (
QualType QT = Field->getType(); QT->isBitIntType())
7907 if (BitWidth < IntSize)
7910 if (BitWidth == IntSize)
7925 assert(!Promotable.
isNull());
7928 return ET->getDecl()->getPromotionType();
7937 if (BT->getKind() == BuiltinType::WChar_S ||
7938 BT->getKind() == BuiltinType::WChar_U ||
7939 BT->getKind() == BuiltinType::Char8 ||
7940 BT->getKind() == BuiltinType::Char16 ||
7941 BT->getKind() == BuiltinType::Char32) {
7942 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
7946 for (
const auto &PT : PromoteTypes) {
7948 if (FromSize < ToSize ||
7949 (FromSize == ToSize && FromIsSigned == PT->isSignedIntegerType()))
7952 llvm_unreachable(
"char type should fit into long long");
7959 uint64_t PromotableSize =
getIntWidth(Promotable);
7968 while (!
T.isNull()) {
7970 return T.getObjCLifetime();
8000 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
8002 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
8005 if (LHSC == RHSC)
return 0;
8010 unsigned LHSRank = getIntegerRank(LHSC);
8011 unsigned RHSRank = getIntegerRank(RHSC);
8013 if (LHSUnsigned == RHSUnsigned) {
8014 if (LHSRank == RHSRank)
return 0;
8015 return LHSRank > RHSRank ? 1 : -1;
8021 if (LHSRank >= RHSRank)
8031 if (RHSRank >= LHSRank)
8041 if (CFConstantStringTypeDecl)
8042 return CFConstantStringTypeDecl;
8044 assert(!CFConstantStringTagDecl &&
8045 "tag and typedef should be initialized together");
8085 if (
static_cast<unsigned>(CFRuntime) <
8088 Fields[Count++] = {
IntTy,
"flags" };
8090 Fields[Count++] = {
LongTy,
"length" };
8094 Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc" };
8098 Fields[Count++] = {
IntTy,
"_ptr" };
8104 for (
unsigned i = 0; i < Count; ++i) {
8108 Fields[i].Type,
nullptr,
8111 CFConstantStringTagDecl->
addDecl(Field);
8118 CFConstantStringTypeDecl =
8121 return CFConstantStringTypeDecl;
8125 if (!CFConstantStringTagDecl)
8127 return CFConstantStringTagDecl;
8136 if (ObjCSuperType.
isNull()) {
8141 return ObjCSuperType;
8146 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
8153 if (BlockDescriptorType)
8166 static const char *
const FieldNames[] = {
8171 for (
size_t i = 0; i < 2; ++i) {
8174 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
8182 BlockDescriptorType = RD;
8188 if (BlockDescriptorExtendedType)
8203 static const char *
const FieldNames[] = {
8210 for (
size_t i = 0; i < 4; ++i) {
8213 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
8222 BlockDescriptorExtendedType = RD;
8227 const auto *BT = dyn_cast<BuiltinType>(
T);
8230 if (isa<PipeType>(
T))
8236 switch (BT->getKind()) {
8237#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8238 case BuiltinType::Id: \
8240#include "clang/Basic/OpenCLImageTypes.def"
8242 case BuiltinType::OCLClkEvent:
8245 case BuiltinType::OCLEvent:
8248 case BuiltinType::OCLQueue:
8251 case BuiltinType::OCLReserveID:
8254 case BuiltinType::OCLSampler:
8273 if (!copyExpr && record->hasTrivialDestructor())
return false;
8301 llvm_unreachable(
"impossible");
8303 llvm_unreachable(
"fell out of lifetime switch!");
8311 bool &HasByrefExtendedLayout)
const {
8316 HasByrefExtendedLayout =
false;
8318 HasByrefExtendedLayout =
true;
8332 assert(
Target &&
"Expected target to be initialized");
8333 const llvm::Triple &
T =
Target->getTriple();
8335 if (
T.isOSWindows() &&
T.isArch64Bit())
8341 assert(
Target &&
"Expected target to be initialized");
8342 const llvm::Triple &
T =
Target->getTriple();
8344 if (
T.isOSWindows() &&
T.isArch64Bit())
8350 if (!ObjCInstanceTypeDecl)
8351 ObjCInstanceTypeDecl =
8353 return ObjCInstanceTypeDecl;
8359 if (
const auto *TT = dyn_cast<TypedefType>(
T))
8361 return II->isStr(
"BOOL");
8369 if (!
type->isIncompleteArrayType() &&
type->isIncompleteType())
8378 else if (
type->isArrayType())
8397 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
8404 !
D->isInlineSpecified() && (
D->isConstexpr() ||
First->isConstexpr()))
8435 for (
auto *PI :
Decl->parameters()) {
8440 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
8449 ParmOffset = PtrSize;
8450 for (
auto *PVDecl :
Decl->parameters()) {
8451 QualType PType = PVDecl->getOriginalType();
8452 if (
const auto *AT =
8456 if (!isa<ConstantArrayType>(AT))
8457 PType = PVDecl->getType();
8459 PType = PVDecl->getType();
8479 for (
auto *PI :
Decl->parameters()) {
8486 "getObjCEncodingForFunctionDecl - Incomplete param type");
8493 for (
auto *PVDecl :
Decl->parameters()) {
8494 QualType PType = PVDecl->getOriginalType();
8495 if (
const auto *AT =
8499 if (!isa<ConstantArrayType>(AT))
8500 PType = PVDecl->getType();
8502 PType = PVDecl->getType();
8516 bool Extended)
const {
8520 ObjCEncOptions Options = ObjCEncOptions()
8521 .setExpandPointedToStructures()
8522 .setExpandStructures()
8523 .setIsOutermostType();
8525 Options.setEncodeBlockParameters().setEncodeClassNames();
8526 getObjCEncodingForTypeImpl(
T, S, Options,
nullptr);
8532 bool Extended)
const {
8537 Decl->getReturnType(), S, Extended);
8546 E =
Decl->sel_param_end(); PI !=
E; ++PI) {
8553 "getObjCEncodingForMethodDecl - Incomplete param type");
8561 ParmOffset = 2 * PtrSize;
8563 E =
Decl->sel_param_end(); PI !=
E; ++PI) {
8566 if (
const auto *AT =
8570 if (!isa<ConstantArrayType>(AT))
8575 PType, S, Extended);
8586 const Decl *Container)
const {
8589 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
8590 for (
auto *PID : CID->property_impls())
8591 if (PID->getPropertyDecl() == PD)
8594 const auto *OID = cast<ObjCImplementationDecl>(Container);
8595 for (
auto *PID : OID->property_impls())
8596 if (PID->getPropertyDecl() == PD)
8630 const Decl *Container)
const {
8632 bool Dynamic =
false;
8640 SynthesizePID = PropertyImpDecl;
8644 std::string S =
"T";
8689 if (SynthesizePID) {
8706 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
8709 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
8722 getObjCEncodingForTypeImpl(
T, S,
8724 .setExpandPointedToStructures()
8725 .setExpandStructures()
8726 .setIsOutermostType(),
8727 Field, NotEncodedT);
8731 std::string& S)
const {
8735 getObjCEncodingForTypeImpl(
T, S,
8737 .setExpandPointedToStructures()
8738 .setExpandStructures()
8739 .setIsOutermostType()
8740 .setEncodingProperty(),
8748 case BuiltinType::Void:
return 'v';
8749 case BuiltinType::Bool:
return 'B';
8750 case BuiltinType::Char8:
8751 case BuiltinType::Char_U:
8752 case BuiltinType::UChar:
return 'C';
8753 case BuiltinType::Char16:
8754 case BuiltinType::UShort:
return 'S';
8755 case BuiltinType::Char32:
8756 case BuiltinType::UInt:
return 'I';
8757 case BuiltinType::ULong:
8758 return C->getTargetInfo().getLongWidth() == 32 ?
'L' :
'Q';
8759 case BuiltinType::UInt128:
return 'T';
8760 case BuiltinType::ULongLong:
return 'Q';
8761 case BuiltinType::Char_S:
8762 case BuiltinType::SChar:
return 'c';
8763 case BuiltinType::Short:
return 's';
8764 case BuiltinType::WChar_S:
8765 case BuiltinType::WChar_U:
8766 case BuiltinType::Int:
return 'i';
8767 case BuiltinType::Long:
8768 return C->getTargetInfo().getLongWidth() == 32 ?
'l' :
'q';
8769 case BuiltinType::LongLong:
return 'q';
8770 case BuiltinType::Int128:
return 't';
8771 case BuiltinType::Float:
return 'f';
8772 case BuiltinType::Double:
return 'd';
8773 case BuiltinType::LongDouble:
return 'D';
8774 case BuiltinType::NullPtr:
return '*';
8776 case BuiltinType::BFloat16:
8777 case BuiltinType::Float16:
8778 case BuiltinType::Float128:
8779 case BuiltinType::Ibm128:
8780 case BuiltinType::Half:
8781 case BuiltinType::ShortAccum:
8782 case BuiltinType::Accum:
8783 case BuiltinType::LongAccum:
8784 case BuiltinType::UShortAccum:
8785 case BuiltinType::UAccum:
8786 case BuiltinType::ULongAccum:
8787 case BuiltinType::ShortFract:
8788 case BuiltinType::Fract:
8789 case BuiltinType::LongFract:
8790 case BuiltinType::UShortFract:
8791 case BuiltinType::UFract:
8792 case BuiltinType::ULongFract:
8793 case BuiltinType::SatShortAccum:
8794 case BuiltinType::SatAccum:
8795 case BuiltinType::SatLongAccum:
8796 case BuiltinType::SatUShortAccum:
8797 case BuiltinType::SatUAccum:
8798 case BuiltinType::SatULongAccum:
8799 case BuiltinType::SatShortFract:
8800 case BuiltinType::SatFract:
8801 case BuiltinType::SatLongFract:
8802 case BuiltinType::SatUShortFract:
8803 case BuiltinType::SatUFract:
8804 case BuiltinType::SatULongFract:
8808#define SVE_TYPE(Name, Id, SingletonId) \
8809 case BuiltinType::Id:
8810#include "clang/Basic/AArch64SVEACLETypes.def"
8811#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8812#include "clang/Basic/RISCVVTypes.def"
8813#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8814#include "clang/Basic/WebAssemblyReferenceTypes.def"
8815#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id:
8816#include "clang/Basic/AMDGPUTypes.def"
8820 "cannot yet @encode type %0");
8825 case BuiltinType::ObjCId:
8826 case BuiltinType::ObjCClass:
8827 case BuiltinType::ObjCSel:
8828 llvm_unreachable(
"@encoding ObjC primitive type");
8831#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8832 case BuiltinType::Id:
8833#include "clang/Basic/OpenCLImageTypes.def"
8834#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8835 case BuiltinType::Id:
8836#include "clang/Basic/OpenCLExtensionTypes.def"
8837 case BuiltinType::OCLEvent:
8838 case BuiltinType::OCLClkEvent:
8839 case BuiltinType::OCLQueue:
8840 case BuiltinType::OCLReserveID:
8841 case BuiltinType::OCLSampler:
8842 case BuiltinType::Dependent:
8843#define PPC_VECTOR_TYPE(Name, Id, Size) \
8844 case BuiltinType::Id:
8845#include "clang/Basic/PPCTypes.def"
8846#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8847#include "clang/Basic/HLSLIntangibleTypes.def"
8848#define BUILTIN_TYPE(KIND, ID)
8849#define PLACEHOLDER_TYPE(KIND, ID) \
8850 case BuiltinType::KIND:
8851#include "clang/AST/BuiltinTypes.def"
8852 llvm_unreachable(
"invalid builtin type for @encode");
8854 llvm_unreachable(
"invalid BuiltinType::Kind value");
8861 if (!
Enum->isFixed())
8871 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
8891 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
8900 S += llvm::utostr(Offset);
8915 bool VisitBasesAndFields) {
8920 PT->getPointeeType().getTypePtr(),
false);
8927 if (isa<ClassTemplateSpecializationDecl>(CXXRD))
8930 if (!CXXRD->hasDefinition() || !VisitBasesAndFields)
8933 for (
const auto &B : CXXRD->bases())
8938 for (
auto *FD : CXXRD->fields())
8947void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string &S,
8948 const ObjCEncOptions Options,
8952 switch (CT->getTypeClass()) {
8957 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
8979 case Type::LValueReference:
8980 case Type::RValueReference: {
8982 if (isa<PointerType>(CT)) {
8984 if (PT->isObjCSelType()) {
8993 bool isReadOnly =
false;
8999 if (Options.IsOutermostType() &&
T.isConstQualified()) {
9003 }
else if (Options.IsOutermostType()) {
9006 P = PT->getPointeeType();
9007 if (
P.isConstQualified()) {
9016 if (StringRef(S).ends_with(
"nr"))
9017 S.replace(S.end()-2, S.end(),
"rn");
9029 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
9034 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
9043 RTy, Options.ExpandPointedToStructures()))) {
9052 ObjCEncOptions NewOptions;
9053 if (Options.ExpandPointedToStructures())
9054 NewOptions.setExpandStructures();
9055 getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
9056 nullptr, NotEncodedT);
9060 case Type::ConstantArray:
9061 case Type::IncompleteArray:
9062 case Type::VariableArray: {
9063 const auto *AT = cast<ArrayType>(CT);
9065 if (isa<IncompleteArrayType>(AT) && !Options.IsStructField()) {
9069 getObjCEncodingForTypeImpl(
9070 AT->getElementType(), S,
9071 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
9075 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
9076 S += llvm::utostr(CAT->getZExtSize());
9079 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
9080 "Unknown array type!");
9084 getObjCEncodingForTypeImpl(
9085 AT->getElementType(), S,
9086 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
9093 case Type::FunctionNoProto:
9094 case Type::FunctionProto:
9098 case Type::Record: {
9099 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
9100 S += RDecl->
isUnion() ?
'(' :
'{';
9104 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
9106 llvm::raw_string_ostream OS(S);
9113 if (Options.ExpandStructures()) {
9116 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
9118 for (
const auto *Field : RDecl->
fields()) {
9121 S +=
Field->getNameAsString();
9126 if (
Field->isBitField()) {
9127 getObjCEncodingForTypeImpl(
Field->getType(), S,
9128 ObjCEncOptions().setExpandStructures(),
9133 getObjCEncodingForTypeImpl(
9135 ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
9141 S += RDecl->
isUnion() ?
')' :
'}';
9145 case Type::BlockPointer: {
9148 if (Options.EncodeBlockParameters()) {
9149 const auto *FT = BT->getPointeeType()->castAs<
FunctionType>();
9153 getObjCEncodingForTypeImpl(FT->getReturnType(), S,
9154 Options.forComponentType(), FD, NotEncodedT);
9158 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
9159 for (
const auto &I : FPT->param_types())
9160 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
9168 case Type::ObjCObject: {
9172 S +=
"{objc_object=}";
9176 S +=
"{objc_class=}";
9183 case Type::ObjCInterface: {
9189 if (Options.ExpandStructures()) {
9193 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
9195 if (
Field->isBitField())
9196 getObjCEncodingForTypeImpl(
Field->getType(), S,
9197 ObjCEncOptions().setExpandStructures(),
9200 getObjCEncodingForTypeImpl(
Field->getType(), S,
9201 ObjCEncOptions().setExpandStructures(), FD,
9209 case Type::ObjCObjectPointer: {
9211 if (OPT->isObjCIdType()) {
9216 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
9224 if (OPT->isObjCQualifiedIdType()) {
9225 getObjCEncodingForTypeImpl(
9227 Options.keepingOnly(ObjCEncOptions()
9228 .setExpandPointedToStructures()
9229 .setExpandStructures()),
9231 if (FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
9235 for (
const auto *I : OPT->quals()) {
9237 S += I->getObjCRuntimeNameAsString();
9246 if (OPT->getInterfaceDecl() &&
9247 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
9249 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
9250 for (
const auto *I : OPT->quals()) {
9252 S += I->getObjCRuntimeNameAsString();
9262 case Type::MemberPointer:
9266 case Type::ExtVector:
9272 case Type::ConstantMatrix:
9285 case Type::DeducedTemplateSpecialization:
9288 case Type::HLSLAttributedResource:
9289 llvm_unreachable(
"unexpected type");
9291 case Type::ArrayParameter:
9293#define ABSTRACT_TYPE(KIND, BASE)
9294#define TYPE(KIND, BASE)
9295#define DEPENDENT_TYPE(KIND, BASE) \
9297#define NON_CANONICAL_TYPE(KIND, BASE) \
9299#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \
9301#include "clang/AST/TypeNodes.inc"
9302 llvm_unreachable(
"@encode for dependent type!");
9304 llvm_unreachable(
"bad type kind!");
9307void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
9312 assert(RDecl &&
"Expected non-null RecordDecl");
9313 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
9317 const auto *CXXRec = dyn_cast<CXXRecordDecl>(RDecl);
9318 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
9322 for (
const auto &BI : CXXRec->bases()) {
9323 if (!BI.isVirtual()) {
9328 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9329 std::make_pair(offs, base));
9335 if (!
Field->isZeroLengthBitField() &&
Field->isZeroSize(*
this))
9338 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9339 std::make_pair(offs, Field));
9342 if (CXXRec && includeVBases) {
9343 for (
const auto &BI : CXXRec->vbases()) {
9349 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
9350 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
9351 std::make_pair(offs, base));
9365 std::multimap<uint64_t, NamedDecl *>::iterator
9366 CurLayObj = FieldOrBaseOffsets.begin();
9368 if (CXXRec && CXXRec->isDynamicClass() &&
9369 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
9372 std::string recname = CXXRec->getNameAsString();
9373 if (recname.empty()) recname =
"?";
9386 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9387 std::make_pair(offs,
nullptr));
9390 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
9392 assert(CurOffs <= CurLayObj->first);
9393 if (CurOffs < CurLayObj->first) {
9394 uint64_t padding = CurLayObj->first - CurOffs;
9410 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
9415 getObjCEncodingForStructureImpl(base, S, FD,
false,
9422 const auto *field = cast<FieldDecl>(dcl);
9425 S += field->getNameAsString();
9429 if (field->isBitField()) {
9432 CurOffs += field->getBitWidthValue();
9437 getObjCEncodingForTypeImpl(
9438 qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
9449 std::string& S)
const {
9482 if (!ObjCClassDecl) {
9487 return ObjCClassDecl;
9491 if (!ObjCProtocolClassDecl) {
9492 ObjCProtocolClassDecl
9501 return ObjCProtocolClassDecl;
9546 const size_t NumFields = 5;
9548 const char *FieldNames[NumFields];
9552 FieldNames[0] =
"__stack";
9556 FieldNames[1] =
"__gr_top";
9560 FieldNames[2] =
"__vr_top";
9563 FieldTypes[3] = Context->
IntTy;
9564 FieldNames[3] =
"__gr_offs";
9567 FieldTypes[4] = Context->
IntTy;
9568 FieldNames[4] =
"__vr_offs";
9571 for (
unsigned i = 0; i < NumFields; ++i) {
9577 FieldTypes[i],
nullptr,
9582 VaListTagDecl->
addDecl(Field);
9599 const size_t NumFields = 5;
9601 const char *FieldNames[NumFields];
9605 FieldNames[0] =
"gpr";
9609 FieldNames[1] =
"fpr";
9613 FieldNames[2] =
"reserved";
9617 FieldNames[3] =
"overflow_arg_area";
9621 FieldNames[4] =
"reg_save_area";
9624 for (
unsigned i = 0; i < NumFields; ++i) {
9629 FieldTypes[i],
nullptr,
9634 VaListTagDecl->
addDecl(Field);
9661 const size_t NumFields = 4;
9663 const char *FieldNames[NumFields];
9667 FieldNames[0] =
"gp_offset";
9671 FieldNames[1] =
"fp_offset";
9675 FieldNames[2] =
"overflow_arg_area";
9679 FieldNames[3] =
"reg_save_area";
9682 for (
unsigned i = 0; i < NumFields; ++i) {
9688 FieldTypes[i],
nullptr,
9693 VaListTagDecl->
addDecl(Field);
9764 const size_t NumFields = 4;
9766 const char *FieldNames[NumFields];
9769 FieldTypes[0] = Context->
LongTy;
9770 FieldNames[0] =
"__gpr";
9773 FieldTypes[1] = Context->
LongTy;
9774 FieldNames[1] =
"__fpr";
9778 FieldNames[2] =
"__overflow_arg_area";
9782 FieldNames[3] =
"__reg_save_area";
9785 for (
unsigned i = 0; i < NumFields; ++i) {
9791 FieldTypes[i],
nullptr,
9796 VaListTagDecl->
addDecl(Field);
9818 const size_t NumFields = 3;
9820 const char *FieldNames[NumFields];
9824 FieldNames[0] =
"__current_saved_reg_area_pointer";
9828 FieldNames[1] =
"__saved_reg_area_end_pointer";
9832 FieldNames[2] =
"__overflow_area_pointer";
9835 for (
unsigned i = 0; i < NumFields; ++i) {
9843 VaListTagDecl->
addDecl(Field);
9873 constexpr size_t NumFields = 3;
9877 const char *FieldNames[NumFields] = {
"__va_stk",
"__va_reg",
"__va_ndx"};
9880 for (
unsigned i = 0; i < NumFields; ++i) {
9883 &Context->
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
9887 VaListTagDecl->
addDecl(Field);
9897 return VaListTagTypedefDecl;
9925 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
9929 if (!BuiltinVaListDecl) {
9934 return BuiltinVaListDecl;
9947 if (!BuiltinMSVaListDecl)
9950 return BuiltinMSVaListDecl;
9962 assert(ObjCConstantStringType.
isNull() &&
9963 "'NSConstantString' type already set!");
9973 unsigned size = End -
Begin;
9974 assert(size > 1 &&
"set is not overloaded!");
9983 assert(isa<FunctionTemplateDecl>(
D) ||
9984 isa<UnresolvedUsingValueDecl>(
D) ||
9985 (isa<UsingShadowDecl>(
D) &&
9986 isa<FunctionTemplateDecl>(
D->getUnderlyingDecl())));
10003 bool TemplateKeyword,
10009 llvm::FoldingSetNodeID ID;
10012 void *InsertPos =
nullptr;
10014 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10018 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
10030 "Nested name specifier must be dependent");
10032 llvm::FoldingSetNodeID ID;
10035 void *InsertPos =
nullptr;
10037 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10043 if (CanonNNS == NNS) {
10051 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10052 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
10056 DependentTemplateNames.InsertNode(QTN, InsertPos);
10066 "Nested name specifier must be dependent");
10068 llvm::FoldingSetNodeID ID;
10071 void *InsertPos =
nullptr;
10073 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10079 if (CanonNNS == NNS) {
10088 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10089 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
10093 DependentTemplateNames.InsertNode(QTN, InsertPos);
10099 std::optional<unsigned> PackIndex)
const {
10100 llvm::FoldingSetNodeID ID;
10104 void *insertPos =
nullptr;
10106 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
10110 Replacement, AssociatedDecl, Index, PackIndex);
10111 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
10119 Decl *AssociatedDecl,
10120 unsigned Index,
bool Final)
const {
10122 llvm::FoldingSetNodeID ID;
10124 AssociatedDecl, Index, Final);
10126 void *InsertPos =
nullptr;
10128 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
10133 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
10147 llvm::FoldingSetNodeID ID;
10150 void *InsertPos =
nullptr;
10152 DeducedTemplates.FindNodeOrInsertPos(ID, InsertPos);
10158 DeducedTemplates.InsertNode(DTS, InsertPos);
10181 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
10211 while (
const auto *AT = dyn_cast<ArrayType>(CT))
10212 CT = AT->getElementType();
10244 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
10245 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
10282 if (Ty->
getKind() == BuiltinType::SveBool ||
10283 Ty->
getKind() == BuiltinType::SveCount)
10296 return BT->getKind() == BuiltinType::SveBool;
10298 return VT->getElementType().getCanonicalType() ==
10309 return IsValidCast(FirstType, SecondType) ||
10310 IsValidCast(SecondType, FirstType);
10328 if (BT->getKind() == BuiltinType::SveBool &&
10349 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
10356 return IsLaxCompatible(FirstType, SecondType) ||
10357 IsLaxCompatible(SecondType, FirstType);
10373 uint64_t MinElts = Info.
EC.getKnownMinValue();
10374 return VScale->first * MinElts * EltSize;
10382 "Expected RVV builtin type and vector type!");
10422 return IsValidCast(FirstType, SecondType) ||
10423 IsValidCast(SecondType, FirstType);
10431 "Expected RVV builtin type and vector type!");
10438 if (!BT->isRVVVLSBuiltinType())
10458 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
10465 return IsLaxCompatible(FirstType, SecondType) ||
10466 IsLaxCompatible(SecondType, FirstType);
10473 if (
Attr->getAttrKind() == attr::ObjCOwnership)
10476 Ty =
Attr->getModifiedType();
10480 Ty =
Paren->getInnerType();
10512 for (
auto *lhsProto : lhs->
quals()) {
10513 bool match =
false;
10514 for (
auto *rhsProto : rhs->
quals()) {
10545 for (
auto *I : lhs->
quals()) {
10549 if (!rhsID->ClassImplementsProtocol(I,
true))
10557 for (
auto *lhsProto : lhs->
quals()) {
10558 bool match =
false;
10563 for (
auto *rhsProto : rhs->
quals()) {
10573 for (
auto *I : lhs->
quals()) {
10577 if (rhsID->ClassImplementsProtocol(I,
true)) {
10594 for (
auto *lhsProto : lhs->
quals()) {
10595 bool match =
false;
10602 for (
auto *rhsProto : rhs->
quals()) {
10621 if (LHSInheritedProtocols.empty() && lhs->
qual_empty())
10623 for (
auto *lhsProto : LHSInheritedProtocols) {
10624 bool match =
false;
10625 for (
auto *rhsProto : rhs->
quals()) {
10655 auto finish = [&](
bool succeeded) ->
bool {
10700 bool BlockReturnType) {
10704 auto finish = [&](
bool succeeded) ->
bool {
10729 if (
getLangOpts().CompatibilityQualifiedIdBlockParamTypeChecking)
10733 (!BlockReturnType &&
10737 (BlockReturnType ? LHSOPT : RHSOPT),
10738 (BlockReturnType ? RHSOPT : LHSOPT),
false));
10746 return finish(BlockReturnType);
10748 return finish(!BlockReturnType);
10760 return (*lhs)->getName().compare((*rhs)->getName());
10777 assert(LHS->
getInterface() &&
"LHS must have an interface base");
10778 assert(RHS->
getInterface() &&
"RHS must have an interface base");
10784 for (
auto *proto : LHS->
quals()) {
10795 for (
auto *proto : RHS->
quals()) {
10803 for (
auto *proto : LHSProtocolSet) {
10804 if (RHSProtocolSet.count(proto))
10805 IntersectionSet.push_back(proto);
10814 if (!ImpliedProtocols.empty()) {
10816 return ImpliedProtocols.contains(proto);
10821 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
10831 if (lhsOPT && rhsOPT)
10837 if (lhsBlock && rhsBlock)
10842 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
10854 bool stripKindOf) {
10855 if (lhsArgs.size() != rhsArgs.size())
10862 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
10868 if (!stripKindOf ||
10869 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
10870 rhsArgs[i].stripObjCKindOfType(ctx))) {
10898 if (!LDecl || !RDecl)
10908 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
10918 bool anyChanges =
false;
10936 if (!Protocols.empty())
10954 if (LHSSuperType.
isNull())
10964 if (KnownLHS != LHSAncestors.end()) {
10965 LHS = KnownLHS->second;
10969 bool anyChanges =
false;
10987 if (!Protocols.empty())
11004 if (RHSSuperType.
isNull())
11015 assert(LHS->
getInterface() &&
"LHS is not an interface type");
11016 assert(RHS->
getInterface() &&
"RHS is not an interface type");
11037 for (
auto *RHSPI : RHS->
quals())
11040 if (SuperClassInheritedProtocols.empty())
11043 for (
const auto *LHSProto : LHS->
quals()) {
11044 bool SuperImplementsProtocol =
false;
11045 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
11046 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
11047 SuperImplementsProtocol =
true;
11050 if (!SuperImplementsProtocol)
11080 if (!LHSOPT || !RHSOPT)
11098 bool CompareUnqualified) {
11117 bool OfBlockPointer,
11121 if (UD->
hasAttr<TransparentUnionAttr>()) {
11122 for (
const auto *I : UD->
fields()) {
11123 QualType ET = I->getType().getUnqualifiedType();
11137 bool OfBlockPointer,
11158 bool IsConditionalOperator) {
11161 const auto *lproto = dyn_cast<FunctionProtoType>(lbase);
11162 const auto *rproto = dyn_cast<FunctionProtoType>(rbase);
11163 bool allLTypes =
true;
11164 bool allRTypes =
true;
11168 if (OfBlockPointer) {
11170 QualType LHS = lbase->getReturnType();
11172 if (!UnqualifiedResult)
11174 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
11239 bool NoReturn = IsConditionalOperator
11249 std::optional<FunctionEffectSet> MergedFX;
11251 if (lproto && rproto) {
11252 assert((AllowCXX ||
11253 (!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec())) &&
11254 "C++ shouldn't be here");
11256 if (lproto->getNumParams() != rproto->getNumParams())
11260 if (lproto->isVariadic() != rproto->isVariadic())
11263 if (lproto->getMethodQuals() != rproto->getMethodQuals())
11269 if (LHSFX != RHSFX) {
11270 if (IsConditionalOperator)
11279 if (*MergedFX != LHSFX)
11281 if (*MergedFX != RHSFX)
11286 bool canUseLeft, canUseRight;
11298 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
11299 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
11300 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
11302 lParamType, rParamType, OfBlockPointer,
Unqualified);
11309 types.push_back(paramType);
11321 if (allLTypes)
return lhs;
11322 if (allRTypes)
return rhs;
11327 newParamInfos.empty() ? nullptr : newParamInfos.data();
11333 if (lproto) allRTypes =
false;
11334 if (rproto) allLTypes =
false;
11338 assert((AllowCXX || !proto->
hasExceptionSpec()) &&
"C++ shouldn't be here");
11346 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
11352 paramTy =
Enum->getDecl()->getIntegerType();
11362 if (allLTypes)
return lhs;
11363 if (allRTypes)
return rhs;
11372 if (allLTypes)
return lhs;
11373 if (allRTypes)
return rhs;
11379 QualType other,
bool isBlockReturnType) {
11385 if (underlyingType.
isNull())
11401 bool IsConditionalOperator) {
11412 if (LangOpts.OpenMP && LHSRefTy && RHSRefTy &&
11416 if (LHSRefTy || RHSRefTy)
11428 if (LHSCan == RHSCan)
11433 Qualifiers RQuals = RHSCan.getLocalQualifiers();
11434 if (LQuals != RQuals) {
11450 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11471 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
11472 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
11475 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
11476 LHSClass = Type::ConstantArray;
11477 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
11478 RHSClass = Type::ConstantArray;
11481 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
11482 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
11485 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
11486 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
11489 if (LHSClass != RHSClass) {
11499 if (OfBlockPointer && !BlockReturnType) {
11508 if (!AT->isDeduced() && AT->isGNUAutoType())
11512 if (!AT->isDeduced() && AT->isGNUAutoType())
11519 switch (LHSClass) {
11520#define TYPE(Class, Base)
11521#define ABSTRACT_TYPE(Class, Base)
11522#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
11523#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
11524#define DEPENDENT_TYPE(Class, Base) case Type::Class:
11525#include "clang/AST/TypeNodes.inc"
11526 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
11529 case Type::DeducedTemplateSpecialization:
11530 case Type::LValueReference:
11531 case Type::RValueReference:
11532 case Type::MemberPointer:
11533 llvm_unreachable(
"C++ should never be in mergeTypes");
11535 case Type::ObjCInterface:
11536 case Type::IncompleteArray:
11537 case Type::VariableArray:
11538 case Type::FunctionProto:
11539 case Type::ExtVector:
11540 llvm_unreachable(
"Types are eliminated above");
11542 case Type::Pointer:
11553 if (ResultType.
isNull())
11561 case Type::BlockPointer:
11586 if (ResultType.
isNull())
11605 if (ResultType.
isNull())
11613 case Type::ConstantArray:
11628 if (ResultType.
isNull())
11636 if (LVAT || RVAT) {
11639 -> std::pair<bool,llvm::APInt> {
11641 std::optional<llvm::APSInt> TheInt;
11644 return std::make_pair(
true, *TheInt);
11645 return std::make_pair(
false, llvm::APSInt());
11648 return std::make_pair(
true, CAT->getSize());
11649 return std::make_pair(
false, llvm::APInt());
11652 bool HaveLSize, HaveRSize;
11653 llvm::APInt LSize, RSize;
11654 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
11655 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
11656 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
11690 case Type::FunctionNoProto:
11692 false, IsConditionalOperator);
11696 case Type::Builtin:
11699 case Type::Complex:
11708 case Type::ConstantMatrix:
11713 case Type::ObjCObject: {
11722 case Type::ObjCObjectPointer:
11723 if (OfBlockPointer) {
11735 assert(LHS != RHS &&
11736 "Equivalent pipe types should have already been handled!");
11738 case Type::ArrayParameter:
11739 assert(LHS != RHS &&
11740 "Equivalent ArrayParameter types should have already been handled!");
11742 case Type::BitInt: {
11750 if (LHSUnsigned != RHSUnsigned)
11753 if (LHSBits != RHSBits)
11757 case Type::HLSLAttributedResource: {
11764 "HLSLAttributedResourceType should always wrap __hlsl_resource_t");
11766 if (LHSTy->
getAttrs() == RHSTy->getAttrs() &&
11773 llvm_unreachable(
"Invalid Type::Class!");
11778 bool &CanUseFirst,
bool &CanUseSecond,
11780 assert(NewParamInfos.empty() &&
"param info list not empty");
11781 CanUseFirst = CanUseSecond =
true;
11787 if (!FirstHasInfo && !SecondHasInfo)
11790 bool NeedParamInfo =
false;
11794 for (
size_t I = 0; I <
E; ++I) {
11805 bool FirstNoEscape = FirstParam.
isNoEscape();
11806 bool SecondNoEscape = SecondParam.
isNoEscape();
11807 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
11809 if (NewParamInfos.back().getOpaqueValue())
11810 NeedParamInfo =
true;
11811 if (FirstNoEscape != IsNoEscape)
11812 CanUseFirst =
false;
11813 if (SecondNoEscape != IsNoEscape)
11814 CanUseSecond =
false;
11817 if (!NeedParamInfo)
11818 NewParamInfos.clear();
11824 ObjCLayouts[CD] =
nullptr;
11834 if (LHSCan == RHSCan)
11836 if (RHSCan->isFunctionType()) {
11840 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
11842 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
11845 if (ResReturnType.
isNull())
11847 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
11851 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
11864 Qualifiers RQuals = RHSCan.getLocalQualifiers();
11865 if (LQuals != RQuals) {
11878 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11894 if (ResQT == LHSBaseQT)
11896 if (ResQT == RHSBaseQT)
11908 T = ET->getDecl()->getIntegerType();
11912 return EIT->getNumBits();
11920 "Unexpected type");
11925 VTy->getNumElements(), VTy->getVectorKind());
11934 T = ETy->getDecl()->getIntegerType();
11937 case BuiltinType::Char_U:
11939 case BuiltinType::Char_S:
11940 case BuiltinType::SChar:
11941 case BuiltinType::Char8:
11943 case BuiltinType::Short:
11945 case BuiltinType::Int:
11947 case BuiltinType::Long:
11949 case BuiltinType::LongLong:
11951 case BuiltinType::Int128:
11956 case BuiltinType::WChar_S:
11959 case BuiltinType::ShortAccum:
11961 case BuiltinType::Accum:
11963 case BuiltinType::LongAccum:
11965 case BuiltinType::SatShortAccum:
11967 case BuiltinType::SatAccum:
11969 case BuiltinType::SatLongAccum:
11971 case BuiltinType::ShortFract:
11973 case BuiltinType::Fract:
11975 case BuiltinType::LongFract:
11977 case BuiltinType::SatShortFract:
11979 case BuiltinType::SatFract:
11981 case BuiltinType::SatLongFract:
11986 "Unexpected signed integer or fixed point type");
11994 "Unexpected type");
11999 VTy->getNumElements(), VTy->getVectorKind());
12008 T = ETy->getDecl()->getIntegerType();
12011 case BuiltinType::Char_S:
12013 case BuiltinType::Char_U:
12014 case BuiltinType::UChar:
12015 case BuiltinType::Char8:
12017 case BuiltinType::UShort:
12019 case BuiltinType::UInt:
12021 case BuiltinType::ULong:
12023 case BuiltinType::ULongLong:
12025 case BuiltinType::UInt128:
12030 case BuiltinType::WChar_U:
12033 case BuiltinType::UShortAccum:
12035 case BuiltinType::UAccum:
12037 case BuiltinType::ULongAccum:
12039 case BuiltinType::SatUShortAccum:
12041 case BuiltinType::SatUAccum:
12043 case BuiltinType::SatULongAccum:
12045 case BuiltinType::UShortFract:
12047 case BuiltinType::UFract:
12049 case BuiltinType::ULongFract:
12051 case BuiltinType::SatUShortFract:
12053 case BuiltinType::SatUFract:
12055 case BuiltinType::SatULongFract:
12060 "Unexpected signed integer or fixed point type");
12085 bool AllowTypeModifiers) {
12089 RequiresICE =
false;
12094 bool IsSpecial =
false;
12098 default: Done =
true; --Str;
break;
12100 RequiresICE =
true;
12103 assert(!
Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
12104 assert(!
Signed &&
"Can't use 'S' modifier multiple times!");
12108 assert(!
Signed &&
"Can't use both 'S' and 'U' modifiers!");
12109 assert(!
Unsigned &&
"Can't use 'U' modifier multiple times!");
12113 assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
12114 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
12119 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12120 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
12129 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12130 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
12136 llvm_unreachable(
"Unexpected integer type");
12147 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12148 assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
12154 llvm_unreachable(
"Unexpected integer type");
12167 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12168 assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
12184 default: llvm_unreachable(
"Unknown builtin type letter!");
12187 "Bad modifiers used with 'x'!");
12192 "Bad modifiers used with 'y'!");
12197 "Bad modifiers used with 'v'!");
12202 "Bad modifiers used with 'h'!");
12207 "Bad modifiers used with 'f'!");
12212 "Bad modifiers used with 'd'!");
12215 else if (HowLong == 2)
12221 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
12230 else if (HowLong == 2)
12232 else if (HowLong == 1)
12238 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
12247 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'b'!");
12251 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'z'!");
12255 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'w'!");
12272 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
12284 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
12292 unsigned NumElements = strtoul(Str, &End, 10);
12293 assert(End != Str &&
"Missing vector size");
12297 RequiresICE,
false);
12298 assert(!RequiresICE &&
"Can't require vector ICE");
12306 Type = Context.SveCountTy;
12310 Type = Context.AMDGPUBufferRsrcTy;
12314 llvm_unreachable(
"Unexpected target builtin type");
12320 unsigned NumElements = strtoul(Str, &End, 10);
12321 assert(End != Str &&
"Missing vector size");
12325 RequiresICE,
false);
12326 assert(!RequiresICE &&
"Can't require vector ICE");
12335 unsigned NumElements = strtoul(Str, &End, 10);
12336 assert(End != Str &&
"Missing vector size");
12348 assert(!RequiresICE &&
"Can't require complex ICE");
12357 if (
Type.isNull()) {
12368 if (
Type.isNull()) {
12374 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'K'!");
12377 if (
Type.isNull()) {
12388 Done = !AllowTypeModifiers;
12390 switch (
char c = *Str++) {
12391 default: Done =
true; --Str;
break;
12397 unsigned AddrSpace = strtoul(Str, &End, 10);
12425 "Integer constant 'I' type must be an integer");
12438 bool AllowTypeModifiers)
const {
12445 unsigned *IntegerConstantArgs)
const {
12447 if (TypeStr[0] ==
'\0') {
12454 bool RequiresICE =
false;
12457 RequiresICE,
true);
12461 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
12463 while (TypeStr[0] && TypeStr[0] !=
'.') {
12470 if (RequiresICE && IntegerConstantArgs)
12471 *IntegerConstantArgs |= 1 << ArgTypes.size();
12477 ArgTypes.push_back(Ty);
12480 if (
Id == Builtin::BI__GetExceptionInfo)
12483 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
12484 "'.' should only occur at end of builtin type list!");
12486 bool Variadic = (TypeStr[0] ==
'.');
12489 Variadic,
false,
true));
12494 if (ArgTypes.empty() && Variadic && !
getLangOpts().requiresStrictPrototypes())
12546 !FD->
hasAttr<DLLExportAttr>()) ||
12547 FD->
hasAttr<GNUInlineAttr>()) {
12566 isa<CXXConstructorDecl>(FD) &&
12567 cast<CXXConstructorDecl>(FD)->isInheritingConstructor())
12580 if (
D->
hasAttr<DLLImportAttr>()) {
12583 }
else if (
D->
hasAttr<DLLExportAttr>()) {
12589 if (
D->
hasAttr<CUDAGlobalAttr>() &&
12652 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
12657 if (!LexicalContext)
12662 auto StaticLocalLinkage =
12674 return StaticLocalLinkage;
12701 return StrongLinkage;
12719 llvm_unreachable(
"Invalid Linkage!");
12729 if (
const auto *VD = dyn_cast<VarDecl>(
D)) {
12730 if (!VD->isFileVarDecl())
12735 if (VD->getDescribedVarTemplate() ||
12736 isa<VarTemplatePartialSpecializationDecl>(VD))
12738 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
12742 }
else if (isa<PragmaCommentDecl>(
D))
12744 else if (isa<PragmaDetectMismatchDecl>(
D))
12746 else if (isa<OMPRequiresDecl>(
D))
12748 else if (isa<OMPThreadPrivateDecl>(
D))
12750 else if (isa<OMPAllocateDecl>(
D))
12752 else if (isa<OMPDeclareReductionDecl>(
D) || isa<OMPDeclareMapperDecl>(
D))
12754 else if (isa<ImportDecl>(
D))
12771 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
12773 if (!FD->doesThisDeclarationHaveABody())
12774 return FD->doesDeclarationForceExternallyVisibleDefinition();
12777 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
12782 if (
getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {
12783 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
12801 const auto *VD = cast<VarDecl>(
D);
12802 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
12806 if (LangOpts.OpenMP &&
12807 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
12814 if (VD->shouldEmitInExternalSource())
12827 if (VD->needsDestruction(*
this))
12831 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
12833 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
12838 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
12839 for (
const auto *BD : DD->bindings())
12840 if (
const auto *BindingVD = BD->getHoldingVar())
12849 llvm::function_ref<
void(
FunctionDecl *)> Pred)
const {
12850 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
12851 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
12856 for (
auto *CurDecl :
12860 SeenDecls.insert(CurFD).second) {
12868 bool IsBuiltin)
const {
12871 return ABI->getDefaultMethodCallConv(IsVariadic);
12876 switch (LangOpts.getDefaultCallingConv()) {
12905 return Target->getDefaultCallingConv();
12910 return ABI->isNearlyEmpty(RD);
12914 if (!VTContext.get()) {
12915 auto ABI =
Target->getCXXABI();
12916 if (ABI.isMicrosoft())
12919 auto ComponentLayout =
getLangOpts().RelativeCXXABIVTables
12925 return VTContext.get();
12931 switch (
T->getCXXABI().getKind()) {
12932 case TargetCXXABI::AppleARM64:
12933 case TargetCXXABI::Fuchsia:
12934 case TargetCXXABI::GenericAArch64:
12935 case TargetCXXABI::GenericItanium:
12936 case TargetCXXABI::GenericARM:
12937 case TargetCXXABI::GenericMIPS:
12938 case TargetCXXABI::iOS:
12939 case TargetCXXABI::WebAssembly:
12940 case TargetCXXABI::WatchOS:
12941 case TargetCXXABI::XL:
12943 case TargetCXXABI::Microsoft:
12946 llvm_unreachable(
"Unsupported ABI");
12950 assert(
T.getCXXABI().getKind() != TargetCXXABI::Microsoft &&
12951 "Device mangle context does not support Microsoft mangling.");
12952 switch (
T.getCXXABI().getKind()) {
12953 case TargetCXXABI::AppleARM64:
12954 case TargetCXXABI::Fuchsia:
12955 case TargetCXXABI::GenericAArch64:
12956 case TargetCXXABI::GenericItanium:
12957 case TargetCXXABI::GenericARM:
12958 case TargetCXXABI::GenericMIPS:
12959 case TargetCXXABI::iOS:
12960 case TargetCXXABI::WebAssembly:
12961 case TargetCXXABI::WatchOS:
12962 case TargetCXXABI::XL:
12966 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND))
12967 return RD->getDeviceLambdaManglingNumber();
12968 return std::nullopt;
12971 case TargetCXXABI::Microsoft:
12975 llvm_unreachable(
"Unsupported ABI");
12981 return ASTRecordLayouts.getMemorySize() +
12982 llvm::capacity_in_bytes(ObjCLayouts) +
12983 llvm::capacity_in_bytes(KeyFunctions) +
12984 llvm::capacity_in_bytes(ObjCImpls) +
12985 llvm::capacity_in_bytes(BlockVarCopyInits) +
12986 llvm::capacity_in_bytes(DeclAttrs) +
12987 llvm::capacity_in_bytes(TemplateOrInstantiation) +
12988 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
12989 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
12990 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
12991 llvm::capacity_in_bytes(OverriddenMethods) +
12992 llvm::capacity_in_bytes(Types) +
12993 llvm::capacity_in_bytes(VariableArrayTypes);
13001 unsigned Signed)
const {
13004 if (!QualTy && DestWidth == 128)
13033 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
13040 MangleNumbers[ND] = Number;
13047 bool ForAuxTarget)
const {
13048 auto I = MangleNumbers.find(ND);
13049 unsigned Res = I != MangleNumbers.end() ? I->second : 1;
13052 if (LangOpts.CUDA && !LangOpts.CUDAIsDevice) {
13053 Res = ForAuxTarget ? Res >> 16 : Res & 0xFFFF;
13055 assert(!ForAuxTarget &&
"Only CUDA/HIP host compilation supports mangling "
13056 "number for aux target");
13058 return Res > 1 ? Res : 1;
13065 StaticLocalNumbers[VD] = Number;
13072 auto I = StaticLocalNumbers.find(VD);
13073 return I != StaticLocalNumbers.end() ? I->second : 1;
13078 assert(LangOpts.CPlusPlus);
13079 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
13087 assert(LangOpts.CPlusPlus);
13088 std::unique_ptr<MangleNumberingContext> &MCtx =
13089 ExtraMangleNumberingContexts[
D];
13095std::unique_ptr<MangleNumberingContext>
13097 return ABI->createMangleNumberingContext();
13102 return ABI->getCopyConstructorForExceptionObject(
13108 return ABI->addCopyConstructorForExceptionObject(
13115 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
13120 return ABI->getTypedefNameForUnnamedTagDecl(TD);
13125 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
13129 return ABI->getDeclaratorForUnnamedTagDecl(TD);
13133 ParamIndices[
D] = index;
13137 ParameterIndexTable::const_iterator I = ParamIndices.find(
D);
13138 assert(I != ParamIndices.end() &&
13139 "ParmIndices lacks entry set by ParmVarDecl");
13144 unsigned Length)
const {
13170 assert(
MSGuidTagDecl &&
"building MS GUID without MS extensions?");
13172 llvm::FoldingSetNodeID ID;
13176 if (
MSGuidDecl *Existing = MSGuidDecls.FindNodeOrInsertPos(ID, InsertPos))
13180 MSGuidDecl *New = MSGuidDecl::Create(*
this, GUIDType, Parts);
13181 MSGuidDecls.InsertNode(New, InsertPos);
13187 const APValue &APVal)
const {
13188 llvm::FoldingSetNodeID ID;
13193 UnnamedGlobalConstantDecls.FindNodeOrInsertPos(ID, InsertPos))
13197 UnnamedGlobalConstantDecl::Create(*
this, Ty, APVal);
13198 UnnamedGlobalConstantDecls.InsertNode(New, InsertPos);
13204 assert(
T->
isRecordType() &&
"template param object of unexpected type");
13210 llvm::FoldingSetNodeID ID;
13215 TemplateParamObjectDecls.FindNodeOrInsertPos(ID, InsertPos))
13219 TemplateParamObjectDecls.InsertNode(New, InsertPos);
13225 if (!
T.isOSDarwin())
13228 if (!(
T.isiOS() &&
T.isOSVersionLT(7)) &&
13229 !(
T.isMacOSX() &&
T.isOSVersionLT(10, 9)))
13238 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
13245 if (MethodDecl->
hasAttr<UnavailableAttr>()
13246 || MethodDecl->
hasAttr<DeprecatedAttr>())
13260 IM != EM && IF != EF; ++IM, ++IF) {
13291 llvm::FoldingSetNodeID IDX, IDY;
13292 X->Profile(IDX, *
this,
true);
13293 Y->
Profile(IDY, *
this,
true);
13307 for (
const Decl *DX :
X->redecls()) {
13312 if (DX->isFirstDecl())
13315 llvm_unreachable(
"Corrupt redecls chain");
13318template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
13320 return cast_or_null<T>(
13322 const_cast<Decl *
>(cast_or_null<Decl>(Y))));
13325template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
13328 const_cast<Decl *
>(cast<Decl>(Y))));
13333 bool IgnoreDeduced =
false) {
13348 bool IgnoreDeduced) {
13356 assert(Xs.size() == Ys.size());
13358 for (
size_t I = 0; I < Rs.size(); ++I)
13365 return X->getAttributeLoc() == Y->getAttributeLoc() ?
X->getAttributeLoc()
13375 switch (
X.getKind()) {
13405 auto NExpX =
X.getNumTemplateExpansions();
13419 if (Xs.size() != Ys.size())
13421 R.resize(Xs.size());
13422 for (
size_t I = 0; I < R.size(); ++I) {
13435 assert(!Different);
13442 return X->getKeyword() == Y->getKeyword() ?
X->getKeyword()
13450 return X->getQualifier() == Y->getQualifier()
13451 ?
X->getQualifier()
13464 QualType EX =
X->getElementType(), EY = Y->getElementType();
13469 QY += EY.getQualifiers() - RQ;
13479 assert(Ctx.
hasSameExpr(
X->getSizeExpr(), Y->getSizeExpr()));
13480 return X->getSizeExpr();
13485 return X->getSizeModifier();
13491 return X->getIndexTypeCVRQualifiers();
13500 llvm::DenseMap<QualType, unsigned>
Found;
13501 for (
auto Ts : {
X, Y}) {
13508 Out.emplace_back(
T);
13518 bool AcceptDependent) {
13544 assert(AcceptDependent &&
13545 "computing composite pointer type of dependent types");
13560 llvm_unreachable(
"These ESTs should be handled above");
13565 assert(EST2 ==
EST_Dynamic &&
"other cases should already be handled");
13569 Result.Exceptions = ExceptionTypeStorage;
13576 llvm_unreachable(
"shouldn't see unresolved exception specifications here");
13579 llvm_unreachable(
"invalid ExceptionSpecificationType");
13588#define UNEXPECTED_TYPE(Class, Kind) \
13589 case Type::Class: \
13590 llvm_unreachable("Unexpected " Kind ": " #Class);
13592#define NON_CANONICAL_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "non-canonical")
13593#define TYPE(Class, Base)
13594#include "clang/AST/TypeNodes.inc"
13596#define SUGAR_FREE_TYPE(Class) UNEXPECTED_TYPE(Class, "sugar-free")
13607#undef SUGAR_FREE_TYPE
13608#define NON_UNIQUE_TYPE(Class) UNEXPECTED_TYPE(Class, "non-unique")
13611#undef NON_UNIQUE_TYPE
13615#undef UNEXPECTED_TYPE
13618 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
13619 assert(AX->getDeducedType().isNull());
13620 assert(AY->getDeducedType().isNull());
13621 assert(AX->getKeyword() == AY->getKeyword());
13622 assert(AX->isInstantiationDependentType() ==
13623 AY->isInstantiationDependentType());
13625 AY->getTypeConstraintArguments());
13628 AX->containsUnexpandedParameterPack(),
13630 AY->getTypeConstraintConcept()),
13633 case Type::IncompleteArray: {
13634 const auto *AX = cast<IncompleteArrayType>(
X),
13635 *AY = cast<IncompleteArrayType>(Y);
13640 case Type::DependentSizedArray: {
13641 const auto *AX = cast<DependentSizedArrayType>(
X),
13642 *AY = cast<DependentSizedArrayType>(Y);
13647 AX->getBracketsRange() == AY->getBracketsRange()
13648 ? AX->getBracketsRange()
13651 case Type::ConstantArray: {
13652 const auto *AX = cast<ConstantArrayType>(
X),
13653 *AY = cast<ConstantArrayType>(Y);
13654 assert(AX->getSize() == AY->getSize());
13655 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
13656 ? AX->getSizeExpr()
13662 case Type::ArrayParameter: {
13663 const auto *AX = cast<ArrayParameterType>(
X),
13664 *AY = cast<ArrayParameterType>(Y);
13665 assert(AX->getSize() == AY->getSize());
13666 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
13667 ? AX->getSizeExpr()
13674 case Type::Atomic: {
13675 const auto *AX = cast<AtomicType>(
X), *AY = cast<AtomicType>(Y);
13679 case Type::Complex: {
13680 const auto *CX = cast<ComplexType>(
X), *CY = cast<ComplexType>(Y);
13683 case Type::Pointer: {
13684 const auto *PX = cast<PointerType>(
X), *PY = cast<PointerType>(Y);
13687 case Type::BlockPointer: {
13688 const auto *PX = cast<BlockPointerType>(
X), *PY = cast<BlockPointerType>(Y);
13691 case Type::ObjCObjectPointer: {
13692 const auto *PX = cast<ObjCObjectPointerType>(
X),
13693 *PY = cast<ObjCObjectPointerType>(Y);
13696 case Type::MemberPointer: {
13697 const auto *PX = cast<MemberPointerType>(
X),
13698 *PY = cast<MemberPointerType>(Y);
13705 case Type::LValueReference: {
13706 const auto *PX = cast<LValueReferenceType>(
X),
13707 *PY = cast<LValueReferenceType>(Y);
13710 PX->isSpelledAsLValue() ||
13711 PY->isSpelledAsLValue());
13713 case Type::RValueReference: {
13714 const auto *PX = cast<RValueReferenceType>(
X),
13715 *PY = cast<RValueReferenceType>(Y);
13719 case Type::DependentAddressSpace: {
13720 const auto *PX = cast<DependentAddressSpaceType>(
X),
13721 *PY = cast<DependentAddressSpaceType>(Y);
13722 assert(Ctx.
hasSameExpr(PX->getAddrSpaceExpr(), PY->getAddrSpaceExpr()));
13724 PX->getAddrSpaceExpr(),
13727 case Type::FunctionNoProto: {
13728 const auto *FX = cast<FunctionNoProtoType>(
X),
13729 *FY = cast<FunctionNoProtoType>(Y);
13730 assert(FX->getExtInfo() == FY->getExtInfo());
13735 case Type::FunctionProto: {
13736 const auto *FX = cast<FunctionProtoType>(
X),
13737 *FY = cast<FunctionProtoType>(Y);
13739 EPIY = FY->getExtProtoInfo();
13740 assert(EPIX.
ExtInfo == EPIY.ExtInfo);
13743 assert(EPIX.
TypeQuals == EPIY.TypeQuals);
13744 assert(EPIX.
Variadic == EPIY.Variadic);
13761 case Type::ObjCObject: {
13762 const auto *OX = cast<ObjCObjectType>(
X), *OY = cast<ObjCObjectType>(Y);
13764 std::equal(OX->getProtocols().begin(), OX->getProtocols().end(),
13765 OY->getProtocols().begin(), OY->getProtocols().end(),
13767 return P0->getCanonicalDecl() == P1->getCanonicalDecl();
13769 "protocol lists must be the same");
13771 OY->getTypeArgsAsWritten());
13774 OX->getProtocols(),
13775 OX->isKindOfTypeAsWritten() && OY->isKindOfTypeAsWritten());
13777 case Type::ConstantMatrix: {
13778 const auto *MX = cast<ConstantMatrixType>(
X),
13779 *MY = cast<ConstantMatrixType>(Y);
13780 assert(MX->getNumRows() == MY->getNumRows());
13781 assert(MX->getNumColumns() == MY->getNumColumns());
13783 MX->getNumRows(), MX->getNumColumns());
13785 case Type::DependentSizedMatrix: {
13786 const auto *MX = cast<DependentSizedMatrixType>(
X),
13787 *MY = cast<DependentSizedMatrixType>(Y);
13788 assert(Ctx.
hasSameExpr(MX->getRowExpr(), MY->getRowExpr()));
13789 assert(Ctx.
hasSameExpr(MX->getColumnExpr(), MY->getColumnExpr()));
13794 case Type::Vector: {
13795 const auto *VX = cast<VectorType>(
X), *VY = cast<VectorType>(Y);
13796 assert(VX->getNumElements() == VY->getNumElements());
13797 assert(VX->getVectorKind() == VY->getVectorKind());
13799 VX->getNumElements(), VX->getVectorKind());
13801 case Type::ExtVector: {
13802 const auto *VX = cast<ExtVectorType>(
X), *VY = cast<ExtVectorType>(Y);
13803 assert(VX->getNumElements() == VY->getNumElements());
13805 VX->getNumElements());
13807 case Type::DependentSizedExtVector: {
13808 const auto *VX = cast<DependentSizedExtVectorType>(
X),
13809 *VY = cast<DependentSizedExtVectorType>(Y);
13814 case Type::DependentVector: {
13815 const auto *VX = cast<DependentVectorType>(
X),
13816 *VY = cast<DependentVectorType>(Y);
13817 assert(VX->getVectorKind() == VY->getVectorKind());
13822 case Type::InjectedClassName: {
13823 const auto *IX = cast<InjectedClassNameType>(
X),
13824 *IY = cast<InjectedClassNameType>(Y);
13828 IY->getInjectedSpecializationType()));
13830 case Type::TemplateSpecialization: {
13831 const auto *TX = cast<TemplateSpecializationType>(
X),
13832 *TY = cast<TemplateSpecializationType>(Y);
13834 TY->template_arguments());
13837 TY->getTemplateName(),
13839 As,
X->getCanonicalTypeInternal());
13841 case Type::Decltype: {
13842 const auto *DX = cast<DecltypeType>(
X);
13843 [[maybe_unused]]
const auto *DY = cast<DecltypeType>(Y);
13844 assert(DX->isDependentType());
13845 assert(DY->isDependentType());
13846 assert(Ctx.
hasSameExpr(DX->getUnderlyingExpr(), DY->getUnderlyingExpr()));
13850 case Type::PackIndexing: {
13851 const auto *DX = cast<PackIndexingType>(
X);
13852 [[maybe_unused]]
const auto *DY = cast<PackIndexingType>(Y);
13853 assert(DX->isDependentType());
13854 assert(DY->isDependentType());
13855 assert(Ctx.
hasSameExpr(DX->getIndexExpr(), DY->getIndexExpr()));
13858 case Type::DependentName: {
13859 const auto *NX = cast<DependentNameType>(
X),
13860 *NY = cast<DependentNameType>(Y);
13861 assert(NX->getIdentifier() == NY->getIdentifier());
13864 NX->getIdentifier(), NX->getCanonicalTypeInternal());
13866 case Type::DependentTemplateSpecialization: {
13867 const auto *TX = cast<DependentTemplateSpecializationType>(
X),
13868 *TY = cast<DependentTemplateSpecializationType>(Y);
13869 assert(TX->getIdentifier() == TY->getIdentifier());
13871 TY->template_arguments());
13874 TX->getIdentifier(), As);
13876 case Type::UnaryTransform: {
13877 const auto *TX = cast<UnaryTransformType>(
X),
13878 *TY = cast<UnaryTransformType>(Y);
13879 assert(TX->getUTTKind() == TY->getUTTKind());
13883 TY->getUnderlyingType()),
13886 case Type::PackExpansion: {
13887 const auto *PX = cast<PackExpansionType>(
X),
13888 *PY = cast<PackExpansionType>(Y);
13889 assert(PX->getNumExpansions() == PY->getNumExpansions());
13892 PX->getNumExpansions(),
false);
13895 const auto *PX = cast<PipeType>(
X), *PY = cast<PipeType>(Y);
13896 assert(PX->isReadOnly() == PY->isReadOnly());
13901 case Type::TemplateTypeParm: {
13902 const auto *TX = cast<TemplateTypeParmType>(
X),
13903 *TY = cast<TemplateTypeParmType>(Y);
13904 assert(TX->getDepth() == TY->getDepth());
13905 assert(TX->getIndex() == TY->getIndex());
13906 assert(TX->isParameterPack() == TY->isParameterPack());
13908 TX->getDepth(), TX->getIndex(), TX->isParameterPack(),
13912 llvm_unreachable(
"Unknown Type Class");
13922#define UNEXPECTED_TYPE(Class, Kind) \
13923 case Type::Class: \
13924 llvm_unreachable("Unexpected " Kind ": " #Class);
13925#define TYPE(Class, Base)
13926#define DEPENDENT_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "dependent")
13927#include "clang/AST/TypeNodes.inc"
13929#define CANONICAL_TYPE(Class) UNEXPECTED_TYPE(Class, "canonical")
13955#undef CANONICAL_TYPE
13957#undef UNEXPECTED_TYPE
13959 case Type::Adjusted: {
13960 const auto *AX = cast<AdjustedType>(
X), *AY = cast<AdjustedType>(Y);
13961 QualType OX = AX->getOriginalType(), OY = AY->getOriginalType();
13968 case Type::Decayed: {
13969 const auto *DX = cast<DecayedType>(
X), *DY = cast<DecayedType>(Y);
13970 QualType OX = DX->getOriginalType(), OY = DY->getOriginalType();
13977 case Type::Attributed: {
13978 const auto *AX = cast<AttributedType>(
X), *AY = cast<AttributedType>(Y);
13980 if (Kind != AY->getAttrKind())
13982 QualType MX = AX->getModifiedType(), MY = AY->getModifiedType();
13990 case Type::BTFTagAttributed: {
13991 const auto *BX = cast<BTFTagAttributedType>(
X);
13992 const BTFTypeTagAttr *AX = BX->getAttr();
13994 if (AX->getBTFTypeTag() !=
13995 cast<BTFTagAttributedType>(Y)->getAttr()->getBTFTypeTag())
14000 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
14003 if (KW != AY->getKeyword())
14007 AY->getTypeConstraintConcept());
14011 AY->getTypeConstraintArguments())) {
14019 false,
false, CD, As);
14021 case Type::PackIndexing:
14022 case Type::Decltype:
14024 case Type::DeducedTemplateSpecialization:
14028 case Type::Elaborated: {
14029 const auto *EX = cast<ElaboratedType>(
X), *EY = cast<ElaboratedType>(Y);
14035 case Type::MacroQualified: {
14036 const auto *MX = cast<MacroQualifiedType>(
X),
14037 *MY = cast<MacroQualifiedType>(Y);
14039 if (IX != MY->getMacroIdentifier())
14043 case Type::SubstTemplateTypeParm: {
14044 const auto *SX = cast<SubstTemplateTypeParmType>(
X),
14045 *SY = cast<SubstTemplateTypeParmType>(Y);
14050 unsigned Index = SX->getIndex();
14051 if (Index != SY->getIndex())
14053 auto PackIndex = SX->getPackIndex();
14054 if (PackIndex != SY->getPackIndex())
14057 CD, Index, PackIndex);
14059 case Type::ObjCTypeParam:
14065 case Type::TemplateSpecialization: {
14066 const auto *TX = cast<TemplateSpecializationType>(
X),
14067 *TY = cast<TemplateSpecializationType>(Y);
14070 TY->getTemplateName(),
true);
14075 TY->template_arguments()))
14080 case Type::Typedef: {
14081 const auto *TX = cast<TypedefType>(
X), *TY = cast<TypedefType>(Y);
14087 case Type::TypeOf: {
14093 if (cast<TypeOfType>(
X)->
getKind() == cast<TypeOfType>(Y)->
getKind() &&
14098 case Type::TypeOfExpr:
14101 case Type::UnaryTransform: {
14102 const auto *UX = cast<UnaryTransformType>(
X),
14103 *UY = cast<UnaryTransformType>(Y);
14105 if (KX != UY->getUTTKind())
14107 QualType BX = UX->getBaseType(), BY = UY->getBaseType();
14114 case Type::Using: {
14115 const auto *UX = cast<UsingType>(
X), *UY = cast<UsingType>(Y);
14122 case Type::CountAttributed: {
14123 const auto *DX = cast<CountAttributedType>(
X),
14124 *DY = cast<CountAttributedType>(Y);
14125 if (DX->isCountInBytes() != DY->isCountInBytes())
14127 if (DX->isOrNull() != DY->isOrNull())
14129 Expr *CEX = DX->getCountExpr();
14130 Expr *CEY = DY->getCountExpr();
14134 DX->isCountInBytes(), DX->isOrNull(),
14145 DX->isCountInBytes(), DX->isOrNull(),
14149 llvm_unreachable(
"Unhandled Type Class");
14171 if (
X.isCanonical())
14184 if (SX.
Ty != SY.Ty) {
14192 while (!Xs.empty() && !Ys.empty() && Xs.back().Ty == Ys.back().Ty) {
14195 SX = Xs.pop_back_val();
14196 SY = Ys.pop_back_val();
14206 while (!Xs.empty() && !Ys.empty()) {
14209 SX = Xs.pop_back_val();
14210 SY = Ys.pop_back_val();
14215 SX.
Ty = Underlying.Ty;
14218 QX -= Underlying.Quals;
14236 llvm_unreachable(
"Not a saturated fixed point type!");
14237 case BuiltinType::SatShortAccum:
14239 case BuiltinType::SatAccum:
14241 case BuiltinType::SatLongAccum:
14243 case BuiltinType::SatUShortAccum:
14245 case BuiltinType::SatUAccum:
14247 case BuiltinType::SatULongAccum:
14249 case BuiltinType::SatShortFract:
14251 case BuiltinType::SatFract:
14253 case BuiltinType::SatLongFract:
14255 case BuiltinType::SatUShortFract:
14257 case BuiltinType::SatUFract:
14259 case BuiltinType::SatULongFract:
14271 llvm_unreachable(
"Not a fixed point type!");
14272 case BuiltinType::ShortAccum:
14274 case BuiltinType::Accum:
14276 case BuiltinType::LongAccum:
14278 case BuiltinType::UShortAccum:
14280 case BuiltinType::UAccum:
14282 case BuiltinType::ULongAccum:
14284 case BuiltinType::ShortFract:
14286 case BuiltinType::Fract:
14288 case BuiltinType::LongFract:
14290 case BuiltinType::UShortFract:
14292 case BuiltinType::UFract:
14294 case BuiltinType::ULongFract:
14300 if (LangOpts.OpenCL)
14324 llvm_unreachable(
"Not a fixed point type!");
14325 case BuiltinType::ShortAccum:
14326 case BuiltinType::SatShortAccum:
14327 return Target.getShortAccumScale();
14328 case BuiltinType::Accum:
14329 case BuiltinType::SatAccum:
14330 return Target.getAccumScale();
14331 case BuiltinType::LongAccum:
14332 case BuiltinType::SatLongAccum:
14333 return Target.getLongAccumScale();
14334 case BuiltinType::UShortAccum:
14335 case BuiltinType::SatUShortAccum:
14336 return Target.getUnsignedShortAccumScale();
14337 case BuiltinType::UAccum:
14338 case BuiltinType::SatUAccum:
14339 return Target.getUnsignedAccumScale();
14340 case BuiltinType::ULongAccum:
14341 case BuiltinType::SatULongAccum:
14342 return Target.getUnsignedLongAccumScale();
14343 case BuiltinType::ShortFract:
14344 case BuiltinType::SatShortFract:
14345 return Target.getShortFractScale();
14346 case BuiltinType::Fract:
14347 case BuiltinType::SatFract:
14348 return Target.getFractScale();
14349 case BuiltinType::LongFract:
14350 case BuiltinType::SatLongFract:
14351 return Target.getLongFractScale();
14352 case BuiltinType::UShortFract:
14353 case BuiltinType::SatUShortFract:
14354 return Target.getUnsignedShortFractScale();
14355 case BuiltinType::UFract:
14356 case BuiltinType::SatUFract:
14357 return Target.getUnsignedFractScale();
14358 case BuiltinType::ULongFract:
14359 case BuiltinType::SatULongFract:
14360 return Target.getUnsignedLongFractScale();
14370 llvm_unreachable(
"Not a fixed point type!");
14371 case BuiltinType::ShortAccum:
14372 case BuiltinType::SatShortAccum:
14373 return Target.getShortAccumIBits();
14374 case BuiltinType::Accum:
14375 case BuiltinType::SatAccum:
14376 return Target.getAccumIBits();
14377 case BuiltinType::LongAccum:
14378 case BuiltinType::SatLongAccum:
14379 return Target.getLongAccumIBits();
14380 case BuiltinType::UShortAccum:
14381 case BuiltinType::SatUShortAccum:
14382 return Target.getUnsignedShortAccumIBits();
14383 case BuiltinType::UAccum:
14384 case BuiltinType::SatUAccum:
14385 return Target.getUnsignedAccumIBits();
14386 case BuiltinType::ULongAccum:
14387 case BuiltinType::SatULongAccum:
14388 return Target.getUnsignedLongAccumIBits();
14389 case BuiltinType::ShortFract:
14390 case BuiltinType::SatShortFract:
14391 case BuiltinType::Fract:
14392 case BuiltinType::SatFract:
14393 case BuiltinType::LongFract:
14394 case BuiltinType::SatLongFract:
14395 case BuiltinType::UShortFract:
14396 case BuiltinType::SatUShortFract:
14397 case BuiltinType::UFract:
14398 case BuiltinType::SatUFract:
14399 case BuiltinType::ULongFract:
14400 case BuiltinType::SatULongFract:
14405llvm::FixedPointSemantics
14408 "Can only get the fixed point semantics for a "
14409 "fixed point or integer type.");
14411 return llvm::FixedPointSemantics::GetIntegerSemantics(
14415 return llvm::FixedPointSemantics(
14418 !isSigned &&
getTargetInfo().doUnsignedFixedPointTypesHavePadding());
14433 "Expected unsigned fixed point type");
14436 case BuiltinType::UShortAccum:
14438 case BuiltinType::UAccum:
14440 case BuiltinType::ULongAccum:
14442 case BuiltinType::SatUShortAccum:
14444 case BuiltinType::SatUAccum:
14446 case BuiltinType::SatULongAccum:
14448 case BuiltinType::UShortFract:
14450 case BuiltinType::UFract:
14452 case BuiltinType::ULongFract:
14454 case BuiltinType::SatUShortFract:
14456 case BuiltinType::SatUFract:
14458 case BuiltinType::SatULongFract:
14461 llvm_unreachable(
"Unexpected unsigned fixed point type");
14469 std::vector<std::string> BackendFeats;
14470 llvm::AArch64::ExtensionSet FeatureBits;
14471 for (StringRef F : FMVFeatStrings)
14472 if (
auto FMVExt = llvm::AArch64::parseFMVExtension(F))
14474 FeatureBits.enable(*FMVExt->ID);
14475 FeatureBits.toLLVMFeatureList(BackendFeats);
14476 return BackendFeats;
14481 assert(TD !=
nullptr);
14484 llvm::erase_if(
ParsedAttr.Features, [&](
const std::string &Feat) {
14485 return !Target->isValidFeatureName(StringRef{Feat}.substr(1));
14496 Target->getTargetOpts().CPU,
14497 Target->getTargetOpts().Features);
14504 StringRef TargetCPU =
Target->getTargetOpts().CPU;
14506 if (
const auto *TD = FD->
getAttr<TargetAttr>()) {
14512 if (!
Target->getTriple().isAArch64())
14515 Target->getTargetOpts().FeaturesAsWritten.begin(),
14516 Target->getTargetOpts().FeaturesAsWritten.end());
14527 }
else if (
const auto *SD = FD->
getAttr<CPUSpecificAttr>()) {
14529 Target->getCPUSpecificCPUDispatchFeatures(
14531 std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
14532 Features.insert(Features.begin(),
14533 Target->getTargetOpts().FeaturesAsWritten.begin(),
14534 Target->getTargetOpts().FeaturesAsWritten.end());
14536 }
else if (
const auto *TC = FD->
getAttr<TargetClonesAttr>()) {
14537 if (
Target->getTriple().isAArch64()) {
14541 Features.insert(Features.begin(),
14542 Target->getTargetOpts().FeaturesAsWritten.begin(),
14543 Target->getTargetOpts().FeaturesAsWritten.end());
14545 }
else if (
Target->getTriple().isRISCV()) {
14547 std::vector<std::string> Features;
14548 if (VersionStr !=
"default") {
14550 Features.insert(Features.begin(),
ParsedAttr.Features.begin(),
14553 Features.insert(Features.begin(),
14554 Target->getTargetOpts().FeaturesAsWritten.begin(),
14555 Target->getTargetOpts().FeaturesAsWritten.end());
14558 std::vector<std::string> Features;
14560 if (VersionStr.starts_with(
"arch="))
14561 TargetCPU = VersionStr.drop_front(
sizeof(
"arch=") - 1);
14562 else if (VersionStr !=
"default")
14563 Features.push_back((StringRef{
"+"} + VersionStr).str());
14566 }
else if (
const auto *TV = FD->
getAttr<TargetVersionAttr>()) {
14567 std::vector<std::string> Features;
14568 if (
Target->getTriple().isRISCV()) {
14570 Features.insert(Features.begin(),
ParsedAttr.Features.begin(),
14573 assert(
Target->getTriple().isAArch64());
14575 TV->getFeatures(Feats);
14578 Features.insert(Features.begin(),
14579 Target->getTargetOpts().FeaturesAsWritten.begin(),
14580 Target->getTargetOpts().FeaturesAsWritten.end());
14583 FeatureMap =
Target->getTargetOpts().FeatureMap;
14589 return {KernelNameType, FD};
14598 const auto *SKEPAttr = FD->
getAttr<SYCLKernelEntryPointAttr>();
14599 assert(SKEPAttr &&
"Missing sycl_kernel_entry_point attribute");
14608 "SYCL kernel name conflict");
14623 return &IT->second;
14629 return *OMPTraitInfoVector.back();
14636 return DB << Section.
Decl;
14637 return DB <<
"a prior #pragma section";
14641 bool IsInternalVar =
14644 bool IsExplicitDeviceVar = (
D->
hasAttr<CUDADeviceAttr>() &&
14645 !
D->
getAttr<CUDADeviceAttr>()->isImplicit()) ||
14646 (
D->
hasAttr<CUDAConstantAttr>() &&
14647 !
D->
getAttr<CUDAConstantAttr>()->isImplicit());
14651 return (IsInternalVar &&
14652 (
D->
hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) ||
14665 if (!CUIDHash.empty())
14667 if (LangOpts.
CUID.empty())
14668 return StringRef();
14669 CUIDHash = llvm::utohexstr(llvm::MD5Hash(LangOpts.
CUID),
true);
14679 assert(PrimaryBase);
14682 auto Base = Layout.getPrimaryBase();
14683 if (!
Base ||
Base == PrimaryBase || !
Base->isPolymorphic())
14685 PrimaryBase =
Base;
14687 return PrimaryBase;
14691 StringRef MangledName) {
14692 auto *Method = cast<CXXMethodDecl>(VirtualMethodDecl.
getDecl());
14693 assert(Method->isVirtual());
14694 bool DefaultIncludesPointerAuth =
14695 LangOpts.PointerAuthCalls || LangOpts.PointerAuthIntrinsics;
14697 if (!DefaultIncludesPointerAuth)
14700 auto Existing = ThunksToBeAbbreviated.find(VirtualMethodDecl);
14701 if (Existing != ThunksToBeAbbreviated.end())
14702 return Existing->second.contains(MangledName.str());
14705 llvm::StringMap<llvm::SmallVector<std::string, 2>> Thunks;
14707 if (
const auto *ThunkInfos = VtableContext->getThunkInfo(VirtualMethodDecl)) {
14708 auto *
Destructor = dyn_cast<CXXDestructorDecl>(Method);
14709 for (
const auto &Thunk : *ThunkInfos) {
14711 llvm::raw_svector_ostream ElidedNameStream(ElidedName);
14717 Mangler->mangleThunk(Method, Thunk,
true,
14720 llvm::raw_svector_ostream mangledNameStream(MangledName);
14724 mangledNameStream);
14726 Mangler->mangleThunk(Method, Thunk,
false,
14727 mangledNameStream);
14729 Thunks[ElidedName].push_back(std::string(MangledName));
14732 llvm::StringSet<> SimplifiedThunkNames;
14733 for (
auto &ThunkList : Thunks) {
14734 llvm::sort(ThunkList.second);
14735 SimplifiedThunkNames.insert(ThunkList.second[0]);
14737 bool Result = SimplifiedThunkNames.contains(MangledName);
14738 ThunksToBeAbbreviated[VirtualMethodDecl] = std::move(SimplifiedThunkNames);
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 getCommonTypes(ASTContext &Ctx, ArrayRef< QualType > Xs, ArrayRef< QualType > Ys, bool Unqualified=false)
static auto getCanonicalTemplateArguments(const ASTContext &C, ArrayRef< TemplateArgument > Args, bool &AnyNonCanonArgs)
static char getObjCEncodingForPrimitiveType(const ASTContext *C, const BuiltinType *BT)
static bool NeedsInjectedClassNameType(const RecordDecl *D)
static bool unionHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static NamespaceDecl * getNamespace(const NestedNameSpecifier *X)
static TypedefDecl * CreateHexagonBuiltinVaListDecl(const ASTContext *Context)
#define CANONICAL_TYPE(Class)
static NestedNameSpecifier * getCommonNNS(ASTContext &Ctx, const T *X, const T *Y)
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 const TemplateArgument * getDefaultTemplateArgumentOrNone(const NamedDecl *P)
static uint64_t getSVETypeSize(ASTContext &Context, const BuiltinType *Ty)
getSVETypeSize - Return SVE vector or predicate register size.
#define SUGAR_FREE_TYPE(Class)
static bool getCommonTemplateArguments(ASTContext &Ctx, SmallVectorImpl< TemplateArgument > &R, ArrayRef< TemplateArgument > Xs, ArrayRef< TemplateArgument > Ys)
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 const Decl & adjustDeclToTemplate(const Decl &D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template.
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
static QualType getCommonElementType(ASTContext &Ctx, const T *X, const T *Y)
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
static auto getCommonSizeModifier(const ArrayType *X, const ArrayType *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 TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
static int64_t getSubobjectOffset(const FieldDecl *Field, const ASTContext &Context, const clang::ASTRecordLayout &)
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
static TypedefDecl * CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context)
static TemplateName getCommonTemplateNameChecked(ASTContext &Ctx, TemplateName X, TemplateName Y, bool IgnoreDeduced)
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 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 void mergeTypeLists(ASTContext &Ctx, SmallVectorImpl< QualType > &Out, ArrayRef< QualType > X, ArrayRef< QualType > Y)
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 TypedefDecl * CreateXtensaABIBuiltinVaListDecl(const ASTContext *Context)
static TemplateArgument getCommonTemplateArgument(ASTContext &Ctx, const TemplateArgument &X, const TemplateArgument &Y)
static auto * getCommonSizeExpr(ASTContext &Ctx, T *X, T *Y)
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 char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
static QualType getCommonArrayElementType(ASTContext &Ctx, const T *X, Qualifiers &QX, const T *Y, Qualifiers &QY)
static QualType getCommonPointeeType(ASTContext &Ctx, const T *X, const T *Y)
static uint64_t getRVVTypeSize(ASTContext &Context, const BuiltinType *Ty)
getRVVTypeSize - Return RVV vector register size.
static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal)
static SYCLKernelInfo BuildSYCLKernelInfo(CanQualType KernelNameType, const FunctionDecl *FD)
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
static QualType getCommonNonSugarTypeNode(ASTContext &Ctx, const Type *X, Qualifiers &QX, const Type *Y, Qualifiers &QY)
static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, const Type *Y, SplitQualType Underlying)
static bool isSameQualifier(const NestedNameSpecifier *X, const NestedNameSpecifier *Y)
static std::string charUnitsToString(const CharUnits &CU)
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl * > &Redeclared)
static SmallVector< SourceLocation, 2 > getDeclLocsForCommentSearch(const Decl *D, SourceManager &SourceMgr)
static TemplateName getCommonTemplateName(ASTContext &Ctx, TemplateName X, TemplateName Y, bool IgnoreDeduced=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)
#define UNEXPECTED_TYPE(Class, Kind)
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
static std::vector< std::string > getFMVBackendFeaturesFor(const llvm::SmallVectorImpl< StringRef > &FMVFeatStrings)
static ElaboratedTypeKeyword getCommonTypeKeyword(const T *X, const T *Y)
Defines the clang::ASTContext interface.
Provides definitions for the various language-specific address spaces.
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
static constexpr Builtin::Info BuiltinInfo[]
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.
Defines types useful for describing an Objective-C runtime.
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.
static const TemplateArgument & getArgument(const TemplateArgument &A)
C Language Family Type Representation.
__device__ __2f16 float c
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.
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
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.
bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible SVE vector types, false otherwise.
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
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.
BuiltinTemplateDecl * getBuiltinCommonTypeDecl() const
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.
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
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
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 getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
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.
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) 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 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 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.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list 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
QualType getUnresolvedUsingType(const UnresolvedUsingTypenameDecl *Decl) 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.
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.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
QualType getRecordType(const RecordDecl *Decl) const
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 getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type.
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.
IdentifierInfo * getBuiltinCommonTypeName() const
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 getCorrespondingSignedFixedPointType(QualType Ty) const
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,...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
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 hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
bool propertyTypesAreCompatible(QualType, QualType)
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
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.
QualType getFILEType() const
Retrieve the C FILE type.
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...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=RecordDecl::TagKind::Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex, SubstTemplateTypeParmTypeFlag Flag=SubstTemplateTypeParmTypeFlag::None) const
Retrieve a substitution-result type.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getMSGuidType() const
Retrieve the implicitly-predeclared 'struct _GUID' 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...
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
CanQualType UnsignedLongFractTy
QualType getEnumType(const EnumDecl *Decl) const
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
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.
IdentifierInfo * getMakeIntegerSeqName() const
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
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...
IdentifierInfo * getTypePackElementName() const
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
CanQualType OMPIteratorTy
TemplateName getSubstTemplateTemplateParm(TemplateName replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
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...
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
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 alignement 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.
bool canBindObjCObjectType(QualType To, QualType From)
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...
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....
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 getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
CanQualType ArraySectionTy
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) const
CanQualType ObjCBuiltinIdTy
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
VTableContextBase * getVTableContext()
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
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
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
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
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
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
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
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.
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...
CanQualType UnsignedLongAccumTy
QualType AutoRRefDeductTy
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
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 isSameEntity(const NamedDecl *X, const NamedDecl *Y) const
Determine whether the two declarations refer to the same entity.
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
QualType getSubstTemplateTypeParmPackType(Decl *AssociatedDecl, unsigned Index, bool Final, const TemplateArgument &ArgPack)
Retrieve a.
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.
unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
llvm::DenseSet< const VarDecl * > CUDADeviceVarODRUsedByHost
Keep track of CUDA/HIP device-side variables ODR-used by host code.
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.
unsigned getAlignOfGlobalVar(QualType T, const VarDecl *VD) const
Return the alignment in bits that should be given to a global variable with type T.
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.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
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
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
CanQualType ObjCBuiltinBoolTy
TypeInfoChars getTypeInfoInChars(const Type *T) 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.
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.
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.
const clang::PrintingPolicy & getPrintingPolicy() const
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
llvm::FixedPointSemantics getFixedPointSemantics(QualType Ty) const
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
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.
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
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...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getCorrespondingUnsaturatedType(QualType Ty) const
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
FunctionProtoType::ExceptionSpecInfo mergeExceptionSpecs(FunctionProtoType::ExceptionSpecInfo ESI1, FunctionProtoType::ExceptionSpecInfo ESI2, SmallVectorImpl< QualType > &ExceptionTypeStorage, bool AcceptDependent)
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.
const CXXRecordDecl * baseForVTableAuthentication(const CXXRecordDecl *ThisClass)
Resolve the root record to be used to derive the vtable pointer authentication policy for the specifi...
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.
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 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
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply.
unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl * > protocols) const
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
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.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
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.
QualType getCommonSugaredType(QualType X, QualType Y, bool Unqualified=false)
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
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 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.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
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
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType getPackIndexingType(QualType Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< QualType > Expansions={}, int Index=-1) const
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache.
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
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...
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 areCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an SVE builtin and a VectorType that is a fixed-length representat...
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)
DiagnosticsEngine & getDiagnostics() const
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
void ResetObjCLayout(const ObjCContainerDecl *CD)
interp::Context & getInterpContext()
Returns the clang bytecode interpreter context.
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.
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)
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.
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 ...
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.
BuiltinTemplateDecl * getTypePackElementDecl() const
CanQualType SatUnsignedLongAccumTy
QualType getUnconstrainedType(QualType T) const
Remove any type constraints from a template parameter type, for equivalence comparison of template pa...
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.
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
unsigned getTargetAddressSpace(LangAS AS) const
QualType getWideCharType() const
Return the type of wide characters.
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...
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.
CanQualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t.
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.
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Underlying=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
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...
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_stdio
Missing a type from <stdio.h>
@ GE_Missing_type
Missing a type.
@ GE_Missing_ucontext
Missing a type from <ucontext.h>
@ GE_Missing_setjmp
Missing a type from <setjmp.h>
QualType adjustStringLiteralBaseType(QualType StrLTy) const
uint16_t getPointerAuthTypeDiscriminator(QualType T)
Return the "other" type-specific discriminator for the given type.
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const
C23 feature and GCC extension.
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.
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
bool isInSameModule(const Module *M1, const Module *M2)
If the two module M1 and M2 are in the same module.
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...
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.
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
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 void AddedStaticLocalNumbers(const Decl *D, unsigned Number)
An static local number was added to a Decl.
virtual ~ASTMutationListener()
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
virtual void AddedManglingNumber(const Decl *D, unsigned Number)
An mangling number was added to a Decl.
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 adjustement.
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,...
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
void Profile(llvm::FoldingSetNodeID &ID)
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
bool isConstrained() const
void Profile(llvm::FoldingSetNodeID &ID)
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'.
StringRef getName(const PrintingPolicy &Policy) const
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
bool hasCustomTypechecking(unsigned ID) const
Determines whether this builtin has custom typechecking.
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
Implements C++ ABI-specific semantic analysis functions.
Represents a C++ constructor within a class.
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.
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
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)
Builds a canonical type from a QualType.
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.
Declaration of a class template.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
Complex values, per C99 6.2.5p11.
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a C++20 concept.
ConceptDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
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.
static constexpr bool isDimensionValid(size_t NumElements)
Returns true if NumElements is a valid matrix dimension.
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.
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
const DeclContext * getParentFunctionOrMethod(bool LexicalParent=false) const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...
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,...
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.
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
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack.
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
Represents the type decltype(expr) (C++11).
Represents a C++17 deduced template specialization type.
void Profile(llvm::FoldingSetNodeID &ID) const
TemplateName getUnderlying() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const
DefaultArguments getDefaultArguments() const
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
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)
Internal representation of canonical, dependent decltype(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a qualified type name for which the type name is dependent.
void Profile(llvm::FoldingSetNodeID &ID)
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.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a template specialization type whose template cannot be resolved, e.g.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
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.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
void Profile(llvm::FoldingSetNodeID &ID)
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.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
EnumDecl * getDecl() const
This represents one expression.
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.
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.
bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
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.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
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 ExtKind hasExternalDefinitions(const Decl *D)
virtual void ReadComments()
Loads comment ranges.
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration.
virtual void PrintStats()
Print any statistics that have been gathered regarding the external AST source.
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.
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.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization,...
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
static FunctionEffectSet getIntersection(FunctionEffectsRef LHS, FunctionEffectsRef RHS)
static FunctionEffectSet getUnion(FunctionEffectsRef LHS, FunctionEffectsRef RHS, Conflicts &Errs)
Represents an abstract function effect, using just an enumeration describing its kind.
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
QualType getWrappedType() const
const Attributes & getAttrs() const
QualType getContainedType() const
void Profile(llvm::FoldingSetNodeID &ID)
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.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
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)
The injected class name of a C++ class template or class template partial specialization.
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
@ Relative
Components in the vtable are relative offsets between the vtable and the other structs/functions.
@ Pointer
Components in the vtable are pointers to other structs/functions.
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.
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
CommentOptions CommentOpts
Options for parsing comments.
std::string CUID
The user provided compilation unit ID, if non-empty.
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...
QualType getElementType() const
Returns type of the elements being stored in the matrix.
static bool isValidElementType(QualType T)
Valid elements types are the following:
A pointer to member type per C++ 8.3.3 - Pointers to members.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
const Type * getClass() const
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.
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
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Represent a C++ namespace.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
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)
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCContainerDecl - Represents a container for method declarations.
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 * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
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
Interfaces are the core concept in Objective-C for object oriented design.
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.
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
void Profile(llvm::FoldingSetNodeID &ID)
Represents a class type in Objective C.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
bool isObjCQualifiedClass() const
QualType getBaseType() const
Gets the base type of this object type.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
bool isObjCQualifiedId() const
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
bool isObjCUnqualifiedId() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
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
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
qual_iterator qual_end() const
qual_iterator qual_begin() 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...
Represents a type parameter type in Objective C.
void Profile(llvm::FoldingSetNodeID &ID)
A structure for storing the information associated with an overloaded template name.
Represents a C++11 pack expansion that produces a sequence of expressions.
Represents a pack expansion of types.
void Profile(llvm::FoldingSetNodeID &ID)
void Profile(llvm::FoldingSetNodeID &ID)
Sugar for parentheses used when specifying types.
void Profile(llvm::FoldingSetNodeID &ID)
void clear()
Clear parent maps.
Represents a parameter to a function.
ObjCDeclQualifier getObjCDeclQualifier() const
QualType getOriginalType() const
ParsedAttr - Represents a syntactic attribute.
void Profile(llvm::FoldingSetNodeID &ID)
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 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 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.
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()
void setAddressSpace(LangAS space)
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 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)
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.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
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.
DiagnosticsEngine & getDiagnostics() const
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID.
unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid=nullptr) const
Given a SourceLocation, return the spelling line number for the position indicated.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
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, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
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 result of substituting a set of types for a template type parameter pack.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the declaration of a struct/union/class/enum.
TypedefNameDecl * getTypedefNameForAnonDecl() const
void startDefinition()
Starts the definition of this tag declaration.
TagDecl * getDecl() 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.
TargetOptions & getTargetOpts() const
Retrieve the target options.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
IntType getInt64Type() const
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...
unsigned getBFloat16Width() const
getBFloat16Width/Align/Format - Return the size/align/format of '__bf16'.
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....
@ PNaClABIBuiltinVaList
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
@ 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.
uint64_t getPointerWidth(LangAS AddrSpace) const
Return the width of pointers on this target, for the specified address space.
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
unsigned getHalfAlign() const
unsigned getBFloat16Align() 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 getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of 'half'.
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
unsigned getFloat128Width() const
getFloat128Width/Align/Format - Return the size/align/format of '__float128'.
const llvm::fltSemantics & getLongDoubleFormat() const
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool hasAArch64SVETypes() const
Returns whether or not the AArch64 SVE built-in types are available on this target.
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target,...
unsigned getFloat128Align() const
virtual bool hasBFloat16Type() const
Determine whether the _BFloat16 type is supported on this target.
const llvm::fltSemantics & getFloat128Format() const
unsigned getLongDoubleWidth() const
getLongDoubleWidth/Align/Format - Return the size/align/format of 'long double'.
unsigned getLongDoubleAlign() const
virtual std::optional< std::pair< unsigned, unsigned > > getVScaleRange(const LangOptions &LangOpts) const
Returns target-specific min and max values VScale_Range.
llvm::StringMap< bool > FeatureMap
The map of which features have been enabled disabled based on the command line.
A convenient class for passing around template argument information.
SourceLocation getRAngleLoc() const
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
SourceLocation getLAngleLoc() const
A template argument list.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
std::optional< unsigned > 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.
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.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ DeducedTemplate
A template name that refers to another TemplateName with deduced default arguments.
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
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()
unsigned getNumArgs() const
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
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.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, bool Typename, TemplateParameterList *Params)
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, std::optional< unsigned > NumExpanded=std::nullopt)
void Profile(llvm::FoldingSetNodeID &ID)
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
ConceptDecl * getNamedConcept() const
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
ConceptReference * getConceptReference() const
Represents a declaration of a type.
void setTypeForDecl(const Type *TD)
const Type * getTypeForDecl() const
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...
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
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.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isBooleanType() const
bool isFunctionReferenceType() const
bool isObjCBuiltinType() const
QualType getRVVEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an RVV builtin type.
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
bool isIncompleteArrayType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isConstantArrayType() const
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
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 isFunctionPointerType() const
bool isPointerType() const
bool isArrayParameterType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder 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 isSveVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'arm_sve_vector_bits' type attribute,...
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.
bool hasUnsignedIntegerRepresentation() const
Determine whether this type has an unsigned integer representation of some sort, e....
QualType getSveEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an SVE builtin type.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isBitIntType() const
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
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...
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g....
QualType getCanonicalTypeInternal() const
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isMemberPointerType() const
bool isObjCIdType() 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.
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.
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
std::optional< NullabilityKind > 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
void setTypeSourceInfo(TypeSourceInfo *newType)
void Profile(llvm::FoldingSetNodeID &ID)
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,...
Represents a dependent using declaration which was marked with typename.
Represents a C++ using-enum-declaration.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
void Profile(llvm::FoldingSetNodeID &ID)
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.
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization,...
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.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
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
Matches all kinds of arrays.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
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.
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.
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
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.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
SubstTemplateTypeParmTypeFlag
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
bool isDiscardableGVALinkage(GVALinkage L)
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
@ BTK__builtin_common_type
This names the __builtin_common_type BuiltinTemplateDecl.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.
LangAS
Defines the address space values used by the address space qualifier of QualType.
TranslationUnitKind
Describes the kind of translation unit being processed.
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.
const FunctionProtoType * T
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, const TemplateParameterList *TPL=nullptr)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
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
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...
@ None
No keyword precedes the qualified type name.
@ 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)
Diagnostic wrappers for TextAPI types for error reporting.
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
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
unsigned HasTrailingReturn
bool requiresFunctionProtoTypeExtraBitfields() const
FunctionType::ExtInfo ExtInfo
A simple holder for a QualType representing a type in an exception specification.
A holder for Arm type attributes as described in the Arm C/C++ Language extensions which are not part...
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
Parts of a decomposed MSGuidDecl.
Contains information gathered from parsing the contents of TargetAttr.
Describes how types, statements, expressions, and declarations should be printed.
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.
A this pointer adjustment.
IntType
===-— Target Data Type Query Methods ----------------------------—===//
AlignRequirementKind AlignRequirement
AlignRequirementKind AlignRequirement
static bool isEqual(const FoldingSetNodeID &LHS, const FoldingSetNodeID &RHS)
static FoldingSetNodeID getTombstoneKey()
static FoldingSetNodeID getEmptyKey()
static unsigned getHashValue(const FoldingSetNodeID &Val)