69#include "llvm/ADT/APFixedPoint.h"
70#include "llvm/ADT/APInt.h"
71#include "llvm/ADT/APSInt.h"
72#include "llvm/ADT/ArrayRef.h"
73#include "llvm/ADT/DenseMap.h"
74#include "llvm/ADT/DenseSet.h"
75#include "llvm/ADT/FoldingSet.h"
76#include "llvm/ADT/PointerUnion.h"
77#include "llvm/ADT/STLExtras.h"
78#include "llvm/ADT/SmallPtrSet.h"
79#include "llvm/ADT/SmallVector.h"
80#include "llvm/ADT/StringExtras.h"
81#include "llvm/ADT/StringRef.h"
82#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
83#include "llvm/Support/Capacity.h"
84#include "llvm/Support/Casting.h"
85#include "llvm/Support/Compiler.h"
86#include "llvm/Support/ErrorHandling.h"
87#include "llvm/Support/MD5.h"
88#include "llvm/Support/MathExtras.h"
89#include "llvm/Support/SipHash.h"
90#include "llvm/Support/raw_ostream.h"
91#include "llvm/TargetParser/AArch64TargetParser.h"
92#include "llvm/TargetParser/Triple.h"
105using namespace clang;
129 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
134 if (
const auto *VD = dyn_cast<VarDecl>(
D)) {
135 if (VD->isStaticDataMember() &&
140 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(
D)) {
145 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(
D)) {
152 if (
const auto *ED = dyn_cast<EnumDecl>(
D)) {
156 if (
const auto *TD = dyn_cast<TagDecl>(
D)) {
159 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
163 if (isa<ParmVarDecl>(
D))
168 if (isa<TemplateTypeParmDecl>(
D) ||
169 isa<NonTypeTemplateParmDecl>(
D) ||
170 isa<TemplateTemplateParmDecl>(
D))
181 if (isa<ObjCMethodDecl>(
D) || isa<ObjCContainerDecl>(
D) ||
182 isa<ObjCPropertyDecl>(
D) || isa<RedeclarableTemplateDecl>(
D) ||
183 isa<ClassTemplateSpecializationDecl>(
D) ||
191 Locations.emplace_back(BaseLocation);
219 const std::map<unsigned, RawComment *> &CommentsInTheFile)
const {
222 if (RepresentativeLocForDecl.
isInvalid() ||
223 !RepresentativeLocForDecl.
isFileID())
227 if (CommentsInTheFile.empty())
232 const std::pair<FileID, unsigned> DeclLocDecomp =
236 auto OffsetCommentBehindDecl =
237 CommentsInTheFile.lower_bound(DeclLocDecomp.second);
240 if (OffsetCommentBehindDecl != CommentsInTheFile.end()) {
241 RawComment *CommentBehindDecl = OffsetCommentBehindDecl->second;
245 (isa<FieldDecl>(
D) || isa<EnumConstantDecl>(
D) || isa<VarDecl>(
D) ||
246 isa<ObjCMethodDecl>(
D) || isa<ObjCPropertyDecl>(
D))) {
250 if (SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second) ==
252 OffsetCommentBehindDecl->first)) {
253 return CommentBehindDecl;
260 if (OffsetCommentBehindDecl == CommentsInTheFile.begin())
263 auto OffsetCommentBeforeDecl = --OffsetCommentBehindDecl;
264 RawComment *CommentBeforeDecl = OffsetCommentBeforeDecl->second;
273 const unsigned CommentEndOffset =
278 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
284 StringRef
Text(Buffer + CommentEndOffset,
285 DeclLocDecomp.second - CommentEndOffset);
289 if (
Text.find_last_of(
";{}#@") != StringRef::npos)
292 return CommentBeforeDecl;
298 for (
const auto DeclLoc : DeclLocs) {
301 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
317 if (!CommentsInThisFile || CommentsInThisFile->empty())
329 assert(LangOpts.RetainCommentsFromSystemHeaders ||
338 if (
const auto *FD = dyn_cast<FunctionDecl>(&
D)) {
358 if (
const auto *VD = dyn_cast<VarDecl>(&
D)) {
361 if (VD->isStaticDataMember())
367 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(&
D)) {
374 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
382 : *
static_cast<const Decl *
>(
388 CRD->getMemberSpecializationInfo())
389 return *Info->getInstantiatedFrom();
393 if (
const auto *ED = dyn_cast<EnumDecl>(&
D)) {
406 const Decl **OriginalDecl)
const {
409 OriginalDecl =
nullptr;
421 return DeclComment->second;
434 *OriginalDecl = RedeclComment->second;
437 "This decl is supposed to have comment attached.");
438 return CommentAtRedecl->second;
444 auto LastCheckedRedecl = [
this, CanonicalD]() ->
const Decl * {
448 for (
const auto Redecl :
D->
redecls()) {
451 if (LastCheckedRedecl) {
452 if (LastCheckedRedecl == Redecl) {
453 LastCheckedRedecl =
nullptr;
461 *OriginalDecl = Redecl;
462 return RedeclComment;
468 *OriginalDecl =
nullptr;
484 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
489 for (
const auto *Ext : ID->known_extensions()) {
493 Redeclared.push_back(RedeclaredMethod);
504 for (
const Decl *
D : Decls) {
518 if (
File.isInvalid())
522 if (!CommentsInThisFile || CommentsInThisFile->empty() ||
523 CommentsInThisFile->rbegin()->second->isAttached())
533 for (
const Decl *
D : Decls) {
545 for (
const auto DeclLoc : DeclLocs) {
546 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
550 D, DeclLoc, *CommentsInThisFile)) {
561 const Decl *
D)
const {
564 ThisDeclInfo->IsFilled =
false;
565 ThisDeclInfo->fill();
566 ThisDeclInfo->CommentDecl = FC->
getDecl();
567 if (!ThisDeclInfo->TemplateParameters)
577 return RC ? RC->
parse(*
this,
nullptr,
D) :
nullptr;
588 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
592 if (Canonical !=
D) {
600 const Decl *OriginalDecl =
nullptr;
604 if (isa<ObjCMethodDecl>(
D) || isa<FunctionDecl>(
D)) {
606 const auto *OMD = dyn_cast<ObjCMethodDecl>(
D);
607 if (OMD && OMD->isPropertyAccessor())
614 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
618 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(
D)) {
621 QualType QT = TD->getUnderlyingType();
623 if (
const Decl *TD = TT->getDecl())
627 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(
D)) {
628 while (IC->getSuperClass()) {
629 IC = IC->getSuperClass();
634 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(
D)) {
639 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(
D)) {
640 if (!(RD = RD->getDefinition()))
643 for (
const auto &I : RD->bases()) {
644 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
658 for (
const auto &I : RD->vbases()) {
679 if (
D != OriginalDecl && OriginalDecl)
688ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &ID,
696 ID.AddInteger(Params->
size());
698 PEnd = Params->
end();
700 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
702 ID.AddBoolean(TTP->isParameterPack());
703 if (TTP->isExpandedParameterPack()) {
705 ID.AddInteger(TTP->getNumExpansionParameters());
707 ID.AddBoolean(
false);
711 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
713 ID.AddBoolean(NTTP->isParameterPack());
714 ID.AddPointer(
C.getUnconstrainedType(
C.getCanonicalType(NTTP->getType()))
716 if (NTTP->isExpandedParameterPack()) {
718 ID.AddInteger(NTTP->getNumExpansionTypes());
719 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
721 ID.AddPointer(
T.getCanonicalType().getAsOpaquePtr());
724 ID.AddBoolean(
false);
728 auto *TTP = cast<TemplateTemplateParmDecl>(*
P);
735ASTContext::getCanonicalTemplateTemplateParmDecl(
738 llvm::FoldingSetNodeID
ID;
739 CanonicalTemplateTemplateParm::Profile(ID, *
this, TTP);
740 void *InsertPos =
nullptr;
741 CanonicalTemplateTemplateParm *Canonical
742 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
744 return Canonical->getParam();
749 CanonParams.reserve(Params->
size());
751 PEnd = Params->
end();
755 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
761 ? std::optional<unsigned>(TTP->getNumExpansionParameters())
763 CanonParams.push_back(NewTTP);
764 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
768 if (NTTP->isExpandedParameterPack()) {
771 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
773 ExpandedTInfos.push_back(
781 NTTP->getPosition(),
nullptr,
791 NTTP->getPosition(),
nullptr,
793 NTTP->isParameterPack(),
796 CanonParams.push_back(Param);
798 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
799 cast<TemplateTemplateParmDecl>(*
P)));
810 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
811 assert(!Canonical &&
"Shouldn't be in the map!");
815 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
816 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
826 if (!LangOpts.CPlusPlus)
return nullptr;
829 case TargetCXXABI::AppleARM64:
830 case TargetCXXABI::Fuchsia:
831 case TargetCXXABI::GenericARM:
832 case TargetCXXABI::iOS:
833 case TargetCXXABI::WatchOS:
834 case TargetCXXABI::GenericAArch64:
835 case TargetCXXABI::GenericMIPS:
836 case TargetCXXABI::GenericItanium:
837 case TargetCXXABI::WebAssembly:
838 case TargetCXXABI::XL:
840 case TargetCXXABI::Microsoft:
843 llvm_unreachable(
"Invalid CXXABI type!");
847 if (!InterpContext) {
850 return *InterpContext.get();
856 return *ParentMapCtx.get();
861 switch (LangOpts.getAddressSpaceMapMangling()) {
869 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
875 : ConstantArrayTypes(this_(), ConstantArrayTypesLog2InitSize),
876 DependentSizedArrayTypes(this_()), DependentSizedExtVectorTypes(this_()),
877 DependentAddressSpaceTypes(this_()), DependentVectorTypes(this_()),
878 DependentSizedMatrixTypes(this_()),
879 FunctionProtoTypes(this_(), FunctionProtoTypesLog2InitSize),
880 DependentTypeOfExprTypes(this_()), DependentDecltypeTypes(this_()),
881 TemplateSpecializationTypes(this_()),
882 DependentTemplateSpecializationTypes(this_()), AutoTypes(this_()),
883 DependentBitIntTypes(this_()), SubstTemplateTemplateParmPacks(this_()),
884 ArrayParameterTypes(this_()), CanonTemplateTemplateParms(this_()),
885 SourceMgr(
SM), LangOpts(LOpts),
888 LangOpts.XRayNeverInstrumentFiles,
889 LangOpts.XRayAttrListFiles,
SM)),
892 BuiltinInfo(builtins), TUKind(TUKind), DeclarationNames(*this),
893 Comments(
SM), CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
894 CompCategories(this_()), LastSDM(nullptr, 0) {
901 ReleaseDeclContextMaps();
904 for (
auto &Pair : Deallocations)
905 (Pair.first)(Pair.second);
906 Deallocations.clear();
912 I = ObjCLayouts.begin(),
E = ObjCLayouts.end(); I !=
E; )
918 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
919 I = ASTRecordLayouts.begin(),
E = ASTRecordLayouts.end(); I !=
E; ) {
924 ASTRecordLayouts.clear();
926 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
927 AEnd = DeclAttrs.end();
929 A->second->~AttrVec();
932 for (
const auto &
Value : ModuleInitializers)
933 Value.second->~PerModuleInitializers();
934 ModuleInitializers.
clear();
940 TraversalScope = TopLevelDecls;
945 Deallocations.push_back({Callback,
Data});
954 llvm::errs() <<
"\n*** AST Context Stats:\n";
955 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
957 unsigned counts[] = {
958#define TYPE(Name, Parent) 0,
959#define ABSTRACT_TYPE(Name, Parent)
960#include "clang/AST/TypeNodes.inc"
964 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
970 unsigned TotalBytes = 0;
971#define TYPE(Name, Parent) \
973 llvm::errs() << " " << counts[Idx] << " " << #Name \
974 << " types, " << sizeof(Name##Type) << " each " \
975 << "(" << counts[Idx] * sizeof(Name##Type) \
977 TotalBytes += counts[Idx] * sizeof(Name##Type); \
979#define ABSTRACT_TYPE(Name, Parent)
980#include "clang/AST/TypeNodes.inc"
982 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
987 <<
" implicit default constructors created\n";
990 <<
" implicit copy constructors created\n";
994 <<
" implicit move constructors created\n";
997 <<
" implicit copy assignment operators created\n";
1001 <<
" implicit move assignment operators created\n";
1004 <<
" implicit destructors created\n";
1007 llvm::errs() <<
"\n";
1011 BumpAlloc.PrintStats();
1015 bool NotifyListeners) {
1016 if (NotifyListeners)
1025 if (It == MergedDefModules.end())
1028 auto &Merged = It->second;
1030 for (
Module *&M : Merged)
1031 if (!
Found.insert(M).second)
1033 llvm::erase(Merged,
nullptr);
1040 if (MergedIt == MergedDefModules.end())
1041 return std::nullopt;
1042 return MergedIt->second;
1045void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1046 if (LazyInitializers.empty())
1050 assert(Source &&
"lazy initializers but no external source");
1052 auto LazyInits = std::move(LazyInitializers);
1053 LazyInitializers.clear();
1055 for (
auto ID : LazyInits)
1056 Initializers.push_back(Source->GetExternalDecl(ID));
1058 assert(LazyInitializers.empty() &&
1059 "GetExternalDecl for lazy module initializer added more inits");
1065 if (
const auto *ID = dyn_cast<ImportDecl>(
D)) {
1066 auto It = ModuleInitializers.find(ID->getImportedModule());
1069 if (It == ModuleInitializers.end())
1073 auto &Imported = *It->second;
1074 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1075 Imported.resolve(*
this);
1076 auto *OnlyDecl = Imported.Initializers.front();
1077 if (isa<ImportDecl>(OnlyDecl))
1082 auto *&Inits = ModuleInitializers[M];
1084 Inits =
new (*this) PerModuleInitializers;
1085 Inits->Initializers.push_back(
D);
1090 auto *&Inits = ModuleInitializers[M];
1092 Inits =
new (*this) PerModuleInitializers;
1093 Inits->LazyInitializers.insert(Inits->LazyInitializers.end(),
1094 IDs.begin(), IDs.end());
1098 auto It = ModuleInitializers.find(M);
1099 if (It == ModuleInitializers.end())
1100 return std::nullopt;
1102 auto *Inits = It->second;
1103 Inits->resolve(*
this);
1104 return Inits->Initializers;
1109 assert(!CurrentCXXNamedModule &&
1110 "We should set named module for ASTContext for only once");
1111 CurrentCXXNamedModule = M;
1123 auto GetRepresentativeModule = [
this](
const Module *M) {
1124 auto Iter = SameModuleLookupSet.find(M);
1125 if (
Iter != SameModuleLookupSet.end())
1126 return Iter->second;
1128 const Module *RepresentativeModule =
1129 PrimaryModuleNameMap.try_emplace(M->getPrimaryModuleInterfaceName(), M)
1131 SameModuleLookupSet[M] = RepresentativeModule;
1132 return RepresentativeModule;
1135 assert(M1 &&
"Shouldn't call `isInSameModule` if both M1 and M2 are none.");
1136 return GetRepresentativeModule(M1) == GetRepresentativeModule(M2);
1140 if (!ExternCContext)
1143 return ExternCContext;
1149 auto *BuiltinTemplate =
1151 BuiltinTemplate->setImplicit();
1154 return BuiltinTemplate;
1159 if (!MakeIntegerSeqDecl)
1162 return MakeIntegerSeqDecl;
1167 if (!TypePackElementDecl)
1170 return TypePackElementDecl;
1184 NewDecl->
addAttr(TypeVisibilityAttr::CreateImplicit(
1185 const_cast<ASTContext &
>(*
this), TypeVisibilityAttr::Default));
1190 StringRef Name)
const {
1214 Types.push_back(Ty);
1219 assert((!this->Target || this->Target == &
Target) &&
1220 "Incorrect target reinitialization");
1224 this->AuxTarget = AuxTarget;
1226 ABI.reset(createCXXABI(
Target));
1230 InitBuiltinType(
VoidTy, BuiltinType::Void);
1233 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1235 if (LangOpts.CharIsSigned)
1236 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1238 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1241 InitBuiltinType(
ShortTy, BuiltinType::Short);
1242 InitBuiltinType(
IntTy, BuiltinType::Int);
1243 InitBuiltinType(
LongTy, BuiltinType::Long);
1244 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1254 InitBuiltinType(
FloatTy, BuiltinType::Float);
1255 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1256 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1259 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1262 InitBuiltinType(
Ibm128Ty, BuiltinType::Ibm128);
1265 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1268 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1269 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1270 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1274 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1275 InitBuiltinType(
FractTy, BuiltinType::Fract);
1276 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1281 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1287 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1294 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1299 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1301 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1302 if (LangOpts.CPlusPlus && LangOpts.WChar)
1312 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1314 if (LangOpts.CPlusPlus)
1315 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1319 if (LangOpts.CPlusPlus)
1320 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1329 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1332 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1344 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1350 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1353 if (LangOpts.OpenMP) {
1360 if (LangOpts.OpenACC && !LangOpts.OpenMP) {
1363 if (LangOpts.MatrixTypes)
1371 if (LangOpts.OpenCL) {
1372#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1373 InitBuiltinType(SingletonId, BuiltinType::Id);
1374#include "clang/Basic/OpenCLImageTypes.def"
1376 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1377 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1379 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1382#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1383 InitBuiltinType(Id##Ty, BuiltinType::Id);
1384#include "clang/Basic/OpenCLExtensionTypes.def"
1387 if (
Target.hasAArch64SVETypes() ||
1389#define SVE_TYPE(Name, Id, SingletonId) \
1390 InitBuiltinType(SingletonId, BuiltinType::Id);
1391#include "clang/Basic/AArch64SVEACLETypes.def"
1394 if (
Target.getTriple().isPPC64()) {
1395#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \
1396 InitBuiltinType(Id##Ty, BuiltinType::Id);
1397#include "clang/Basic/PPCTypes.def"
1398#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \
1399 InitBuiltinType(Id##Ty, BuiltinType::Id);
1400#include "clang/Basic/PPCTypes.def"
1403 if (
Target.hasRISCVVTypes()) {
1404#define RVV_TYPE(Name, Id, SingletonId) \
1405 InitBuiltinType(SingletonId, BuiltinType::Id);
1406#include "clang/Basic/RISCVVTypes.def"
1409 if (
Target.getTriple().isWasm() &&
Target.hasFeature(
"reference-types")) {
1410#define WASM_TYPE(Name, Id, SingletonId) \
1411 InitBuiltinType(SingletonId, BuiltinType::Id);
1412#include "clang/Basic/WebAssemblyReferenceTypes.def"
1415 if (
Target.getTriple().isAMDGPU() ||
1416 (AuxTarget && AuxTarget->
getTriple().isAMDGPU())) {
1417#define AMDGPU_TYPE(Name, Id, SingletonId) \
1418 InitBuiltinType(SingletonId, BuiltinType::Id);
1419#include "clang/Basic/AMDGPUTypes.def"
1426 ObjCConstantStringType =
QualType();
1431 if (LangOpts.OpenCLGenericAddressSpace) {
1441 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1444 InitBuiltinType(
HalfTy, BuiltinType::Half);
1446 InitBuiltinType(
BFloat16Ty, BuiltinType::BFloat16);
1452 if (LangOpts.MicrosoftExt || LangOpts.Borland) {
1474 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(
D);
1475 if (Pos != DeclAttrs.end()) {
1476 Pos->second->~AttrVec();
1477 DeclAttrs.erase(Pos);
1491 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1492 TemplateOrInstantiation.find(Var);
1493 if (Pos == TemplateOrInstantiation.end())
1506 Tmpl, TSK, PointOfInstantiation));
1512 assert(!TemplateOrInstantiation[Inst] &&
1513 "Already noted what the variable was instantiated from");
1514 TemplateOrInstantiation[Inst] = TSI;
1519 return InstantiatedFromUsingDecl.lookup(UUD);
1524 assert((isa<UsingDecl>(Pattern) ||
1525 isa<UnresolvedUsingValueDecl>(Pattern) ||
1526 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1527 "pattern decl is not a using decl");
1528 assert((isa<UsingDecl>(Inst) ||
1529 isa<UnresolvedUsingValueDecl>(Inst) ||
1530 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1531 "instantiation did not produce a using decl");
1532 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1533 InstantiatedFromUsingDecl[Inst] = Pattern;
1538 return InstantiatedFromUsingEnumDecl.lookup(UUD);
1543 assert(!InstantiatedFromUsingEnumDecl[Inst] &&
"pattern already exists");
1544 InstantiatedFromUsingEnumDecl[Inst] = Pattern;
1549 return InstantiatedFromUsingShadowDecl.lookup(Inst);
1555 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1556 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1560 return InstantiatedFromUnnamedFieldDecl.lookup(Field);
1565 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1566 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1567 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1568 "Already noted what unnamed field was instantiated from");
1570 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1591 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1593 if (Pos == OverriddenMethods.end())
1601 OverriddenMethods[Method].push_back(Overridden);
1609 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(
D)) {
1615 const auto *Method = dyn_cast<ObjCMethodDecl>(
D);
1620 Method->getOverriddenMethods(OverDecls);
1621 Overridden.append(OverDecls.begin(), OverDecls.end());
1625 assert(!Import->getNextLocalImport() &&
1626 "Import declaration already in the chain");
1627 assert(!Import->isFromASTFile() &&
"Non-local import declaration");
1628 if (!FirstLocalImport) {
1629 FirstLocalImport = Import;
1630 LastLocalImport = Import;
1634 LastLocalImport->setNextLocalImport(Import);
1635 LastLocalImport = Import;
1647 llvm_unreachable(
"Not a floating point type!");
1648 case BuiltinType::BFloat16:
1649 return Target->getBFloat16Format();
1650 case BuiltinType::Float16:
1651 return Target->getHalfFormat();
1652 case BuiltinType::Half:
1653 return Target->getHalfFormat();
1654 case BuiltinType::Float:
return Target->getFloatFormat();
1655 case BuiltinType::Double:
return Target->getDoubleFormat();
1656 case BuiltinType::Ibm128:
1657 return Target->getIbm128Format();
1658 case BuiltinType::LongDouble:
1661 return Target->getLongDoubleFormat();
1662 case BuiltinType::Float128:
1665 return Target->getFloat128Format();
1670 unsigned Align =
Target->getCharWidth();
1674 Align = AlignFromAttr;
1682 bool UseAlignAttrOnly;
1683 if (
const FieldDecl *FD = dyn_cast<FieldDecl>(
D))
1685 FD->hasAttr<PackedAttr>() || FD->getParent()->hasAttr<PackedAttr>();
1687 UseAlignAttrOnly = AlignFromAttr != 0;
1690 if (UseAlignAttrOnly) {
1692 }
else if (
const auto *VD = dyn_cast<ValueDecl>(
D)) {
1702 Align = getTypeInfoImpl(
T.getTypePtr()).
Align;
1707 unsigned MinWidth =
Target->getLargeArrayMinWidth();
1708 if (!ForAlignof && MinWidth) {
1710 Align = std::max(Align,
Target->getLargeArrayAlign());
1711 else if (isa<ConstantArrayType>(
arrayType) &&
1713 Align = std::max(Align,
Target->getLargeArrayAlign());
1718 Align =
Target->getCharWidth();
1722 if (
const auto *VD = dyn_cast<VarDecl>(
D))
1723 if (VD->hasGlobalStorage() && !ForAlignof) {
1734 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1737 if (!
Parent->isInvalidDecl()) {
1748 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1749 if (LowBitOfOffset < FieldAlign)
1750 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1753 Align = std::min(Align, FieldAlign);
1761 const auto *VD = dyn_cast<VarDecl>(
D);
1762 if (MaxAlignedAttr && VD && VD->getStorageClass() ==
SC_Static)
1763 Align = std::min(Align, MaxAlignedAttr);
1801 (uint64_t)(-1)/Size) &&
1802 "Overflow in array type char size evaluation");
1807 Width = llvm::alignTo(Width, Align);
1814 if (
const auto *CAT = dyn_cast<ConstantArrayType>(
T))
1832 switch (BT->getKind()) {
1833 case BuiltinType::Bool:
1834 case BuiltinType::Char_S:
1835 case BuiltinType::Char_U:
1836 case BuiltinType::SChar:
1837 case BuiltinType::UChar:
1838 case BuiltinType::Short:
1839 case BuiltinType::UShort:
1840 case BuiltinType::WChar_S:
1841 case BuiltinType::WChar_U:
1842 case BuiltinType::Char8:
1843 case BuiltinType::Char16:
1844 case BuiltinType::Char32:
1854 ET->getDecl()->isScoped())
1872 bool NeedsPreferredAlignment)
const {
1875 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1886 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1891 return TT->getDecl()->getMaxAlignment();
1897 TypeInfoMap::iterator I = MemoizedTypeInfo.find(
T);
1898 if (I != MemoizedTypeInfo.end())
1903 MemoizedTypeInfo[
T] = TI;
1919#define TYPE(Class, Base)
1920#define ABSTRACT_TYPE(Class, Base)
1921#define NON_CANONICAL_TYPE(Class, Base)
1922#define DEPENDENT_TYPE(Class, Base) case Type::Class:
1923#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \
1925 assert(!T->isDependentType() && "should not see dependent types here"); \
1926 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr());
1927#include "clang/AST/TypeNodes.inc"
1928 llvm_unreachable(
"Should not see dependent types");
1930 case Type::FunctionNoProto:
1931 case Type::FunctionProto:
1937 case Type::IncompleteArray:
1938 case Type::VariableArray:
1939 case Type::ConstantArray:
1940 case Type::ArrayParameter: {
1943 if (
const auto *CAT = dyn_cast<ConstantArrayType>(
T))
1944 Size = CAT->getZExtSize();
1947 assert((Size == 0 || EltInfo.
Width <= (uint64_t)(-1) / Size) &&
1948 "Overflow in array type bit size evaluation");
1949 Width = EltInfo.
Width * Size;
1950 Align = EltInfo.
Align;
1954 Width = llvm::alignTo(Width, Align);
1958 case Type::ExtVector:
1959 case Type::Vector: {
1960 const auto *VT = cast<VectorType>(
T);
1962 Width = VT->isExtVectorBoolType() ? VT->getNumElements()
1963 : EltInfo.
Width * VT->getNumElements();
1965 Width = std::max<unsigned>(8, Width);
1966 Align = std::max<unsigned>(8, Width);
1970 if (Align & (Align-1)) {
1971 Align = llvm::bit_ceil(Align);
1972 Width = llvm::alignTo(Width, Align);
1976 if (TargetVectorAlign && TargetVectorAlign < Align)
1977 Align = TargetVectorAlign;
1988 Align = std::min<unsigned>(64, Width);
1992 case Type::ConstantMatrix: {
1993 const auto *MT = cast<ConstantMatrixType>(
T);
1998 Width = ElementInfo.
Width * MT->getNumRows() * MT->getNumColumns();
1999 Align = ElementInfo.
Align;
2004 switch (cast<BuiltinType>(
T)->
getKind()) {
2005 default: llvm_unreachable(
"Unknown builtin type!");
2006 case BuiltinType::Void:
2011 case BuiltinType::Bool:
2012 Width =
Target->getBoolWidth();
2013 Align =
Target->getBoolAlign();
2015 case BuiltinType::Char_S:
2016 case BuiltinType::Char_U:
2017 case BuiltinType::UChar:
2018 case BuiltinType::SChar:
2019 case BuiltinType::Char8:
2020 Width =
Target->getCharWidth();
2021 Align =
Target->getCharAlign();
2023 case BuiltinType::WChar_S:
2024 case BuiltinType::WChar_U:
2025 Width =
Target->getWCharWidth();
2026 Align =
Target->getWCharAlign();
2028 case BuiltinType::Char16:
2029 Width =
Target->getChar16Width();
2030 Align =
Target->getChar16Align();
2032 case BuiltinType::Char32:
2033 Width =
Target->getChar32Width();
2034 Align =
Target->getChar32Align();
2036 case BuiltinType::UShort:
2037 case BuiltinType::Short:
2038 Width =
Target->getShortWidth();
2039 Align =
Target->getShortAlign();
2041 case BuiltinType::UInt:
2042 case BuiltinType::Int:
2043 Width =
Target->getIntWidth();
2044 Align =
Target->getIntAlign();
2046 case BuiltinType::ULong:
2047 case BuiltinType::Long:
2048 Width =
Target->getLongWidth();
2049 Align =
Target->getLongAlign();
2051 case BuiltinType::ULongLong:
2052 case BuiltinType::LongLong:
2053 Width =
Target->getLongLongWidth();
2054 Align =
Target->getLongLongAlign();
2056 case BuiltinType::Int128:
2057 case BuiltinType::UInt128:
2059 Align =
Target->getInt128Align();
2061 case BuiltinType::ShortAccum:
2062 case BuiltinType::UShortAccum:
2063 case BuiltinType::SatShortAccum:
2064 case BuiltinType::SatUShortAccum:
2065 Width =
Target->getShortAccumWidth();
2066 Align =
Target->getShortAccumAlign();
2068 case BuiltinType::Accum:
2069 case BuiltinType::UAccum:
2070 case BuiltinType::SatAccum:
2071 case BuiltinType::SatUAccum:
2072 Width =
Target->getAccumWidth();
2073 Align =
Target->getAccumAlign();
2075 case BuiltinType::LongAccum:
2076 case BuiltinType::ULongAccum:
2077 case BuiltinType::SatLongAccum:
2078 case BuiltinType::SatULongAccum:
2079 Width =
Target->getLongAccumWidth();
2080 Align =
Target->getLongAccumAlign();
2082 case BuiltinType::ShortFract:
2083 case BuiltinType::UShortFract:
2084 case BuiltinType::SatShortFract:
2085 case BuiltinType::SatUShortFract:
2086 Width =
Target->getShortFractWidth();
2087 Align =
Target->getShortFractAlign();
2089 case BuiltinType::Fract:
2090 case BuiltinType::UFract:
2091 case BuiltinType::SatFract:
2092 case BuiltinType::SatUFract:
2093 Width =
Target->getFractWidth();
2094 Align =
Target->getFractAlign();
2096 case BuiltinType::LongFract:
2097 case BuiltinType::ULongFract:
2098 case BuiltinType::SatLongFract:
2099 case BuiltinType::SatULongFract:
2100 Width =
Target->getLongFractWidth();
2101 Align =
Target->getLongFractAlign();
2103 case BuiltinType::BFloat16:
2104 if (
Target->hasBFloat16Type()) {
2105 Width =
Target->getBFloat16Width();
2106 Align =
Target->getBFloat16Align();
2115 case BuiltinType::Float16:
2116 case BuiltinType::Half:
2119 Width =
Target->getHalfWidth();
2120 Align =
Target->getHalfAlign();
2123 "Expected OpenMP device compilation.");
2128 case BuiltinType::Float:
2129 Width =
Target->getFloatWidth();
2130 Align =
Target->getFloatAlign();
2132 case BuiltinType::Double:
2133 Width =
Target->getDoubleWidth();
2134 Align =
Target->getDoubleAlign();
2136 case BuiltinType::Ibm128:
2137 Width =
Target->getIbm128Width();
2138 Align =
Target->getIbm128Align();
2140 case BuiltinType::LongDouble:
2147 Width =
Target->getLongDoubleWidth();
2148 Align =
Target->getLongDoubleAlign();
2151 case BuiltinType::Float128:
2154 Width =
Target->getFloat128Width();
2155 Align =
Target->getFloat128Align();
2158 "Expected OpenMP device compilation.");
2163 case BuiltinType::NullPtr:
2168 case BuiltinType::ObjCId:
2169 case BuiltinType::ObjCClass:
2170 case BuiltinType::ObjCSel:
2174 case BuiltinType::OCLSampler:
2175 case BuiltinType::OCLEvent:
2176 case BuiltinType::OCLClkEvent:
2177 case BuiltinType::OCLQueue:
2178 case BuiltinType::OCLReserveID:
2179#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2180 case BuiltinType::Id:
2181#include "clang/Basic/OpenCLImageTypes.def"
2182#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2183 case BuiltinType::Id:
2184#include "clang/Basic/OpenCLExtensionTypes.def"
2186 Width =
Target->getPointerWidth(AS);
2187 Align =
Target->getPointerAlign(AS);
2197#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId, NumEls, ElBits, \
2198 IsSigned, IsFP, IsBF) \
2199 case BuiltinType::Id: \
2203#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId, NumEls) \
2204 case BuiltinType::Id: \
2208#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2209 case BuiltinType::Id: \
2213#include "clang/Basic/AArch64SVEACLETypes.def"
2214#define PPC_VECTOR_TYPE(Name, Id, Size) \
2215 case BuiltinType::Id: \
2219#include "clang/Basic/PPCTypes.def"
2220#define RVV_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, NF, IsSigned, \
2222 case BuiltinType::Id: \
2226#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) \
2227 case BuiltinType::Id: \
2231#include "clang/Basic/RISCVVTypes.def"
2232#define WASM_TYPE(Name, Id, SingletonId) \
2233 case BuiltinType::Id: \
2237#include "clang/Basic/WebAssemblyReferenceTypes.def"
2238#define AMDGPU_OPAQUE_PTR_TYPE(NAME, MANGLEDNAME, AS, WIDTH, ALIGN, ID, \
2240 case BuiltinType::ID: \
2244#include "clang/Basic/AMDGPUTypes.def"
2247 case Type::ObjCObjectPointer:
2251 case Type::BlockPointer:
2252 AS = cast<BlockPointerType>(
T)->getPointeeType().getAddressSpace();
2253 Width =
Target->getPointerWidth(AS);
2254 Align =
Target->getPointerAlign(AS);
2256 case Type::LValueReference:
2257 case Type::RValueReference:
2260 AS = cast<ReferenceType>(
T)->getPointeeType().getAddressSpace();
2261 Width =
Target->getPointerWidth(AS);
2262 Align =
Target->getPointerAlign(AS);
2265 AS = cast<PointerType>(
T)->getPointeeType().getAddressSpace();
2266 Width =
Target->getPointerWidth(AS);
2267 Align =
Target->getPointerAlign(AS);
2269 case Type::MemberPointer: {
2270 const auto *MPT = cast<MemberPointerType>(
T);
2276 case Type::Complex: {
2280 Width = EltInfo.
Width * 2;
2281 Align = EltInfo.
Align;
2284 case Type::ObjCObject:
2285 return getTypeInfo(cast<ObjCObjectType>(
T)->getBaseType().getTypePtr());
2286 case Type::Adjusted:
2289 case Type::ObjCInterface: {
2290 const auto *ObjCI = cast<ObjCInterfaceType>(
T);
2291 if (ObjCI->getDecl()->isInvalidDecl()) {
2301 case Type::BitInt: {
2302 const auto *EIT = cast<BitIntType>(
T);
2303 Align =
Target->getBitIntAlign(EIT->getNumBits());
2304 Width =
Target->getBitIntWidth(EIT->getNumBits());
2309 const auto *TT = cast<TagType>(
T);
2311 if (TT->getDecl()->isInvalidDecl()) {
2317 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
2318 const EnumDecl *ED = ET->getDecl();
2322 Info.
Align = AttrAlign;
2328 const auto *RT = cast<RecordType>(TT);
2333 AlignRequirement = RD->
hasAttr<AlignedAttr>()
2339 case Type::SubstTemplateTypeParm:
2340 return getTypeInfo(cast<SubstTemplateTypeParmType>(
T)->
2341 getReplacementType().getTypePtr());
2344 case Type::DeducedTemplateSpecialization: {
2345 const auto *A = cast<DeducedType>(
T);
2346 assert(!A->getDeducedType().isNull() &&
2347 "cannot request the size of an undeduced or dependent auto type");
2348 return getTypeInfo(A->getDeducedType().getTypePtr());
2352 return getTypeInfo(cast<ParenType>(
T)->getInnerType().getTypePtr());
2354 case Type::MacroQualified:
2358 case Type::ObjCTypeParam:
2359 return getTypeInfo(cast<ObjCTypeParamType>(
T)->desugar().getTypePtr());
2362 return getTypeInfo(cast<UsingType>(
T)->desugar().getTypePtr());
2364 case Type::Typedef: {
2365 const auto *TT = cast<TypedefType>(
T);
2370 if (
unsigned AttrAlign = TT->getDecl()->getMaxAlignment()) {
2381 case Type::Elaborated:
2382 return getTypeInfo(cast<ElaboratedType>(
T)->getNamedType().getTypePtr());
2384 case Type::Attributed:
2386 cast<AttributedType>(
T)->getEquivalentType().getTypePtr());
2388 case Type::CountAttributed:
2389 return getTypeInfo(cast<CountAttributedType>(
T)->desugar().getTypePtr());
2391 case Type::BTFTagAttributed:
2393 cast<BTFTagAttributedType>(
T)->getWrappedType().getTypePtr());
2395 case Type::Atomic: {
2404 Width =
Target->getCharWidth();
2406 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2412 Width = llvm::bit_ceil(Width);
2415 Align =
static_cast<unsigned>(Width);
2426 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2427 return TypeInfo(Width, Align, AlignRequirement);
2431 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(
T);
2432 if (I != MemoizedUnadjustedAlign.end())
2435 unsigned UnadjustedAlign;
2447 MemoizedUnadjustedAlign[
T] = UnadjustedAlign;
2448 return UnadjustedAlign;
2452 unsigned SimdAlign = llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(
2502 unsigned ABIAlign = TI.
Align;
2510 if (!
Target->allowsLargerPreferedTypeAlignment())
2524 unsigned PreferredAlign =
static_cast<unsigned>(
2526 assert(PreferredAlign >= ABIAlign &&
2527 "PreferredAlign should be at least as large as ABIAlign.");
2528 return PreferredAlign;
2535 T = CT->getElementType().getTypePtr();
2537 T = ET->getDecl()->getIntegerType().getTypePtr();
2542 Target->defaultsToAIXPowerAlignment()))
2597 for (
unsigned I = 0, N =
Path.size(); I != N; ++I) {
2601 std::swap(
Base, Derived);
2621 llvm::append_range(Ivars, OI->
ivars());
2624 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2626 Ivars.push_back(Iv);
2634 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2637 for (
auto *Proto : OI->all_referenced_protocols()) {
2642 for (
const auto *Cat : OI->visible_categories())
2648 SD = SD->getSuperClass();
2650 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2651 for (
auto *Proto : OC->protocols()) {
2654 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2656 if (!Protocols.insert(
2660 for (
auto *Proto : OP->protocols())
2667 bool CheckIfTriviallyCopyable) {
2668 assert(RD->
isUnion() &&
"Must be union type");
2671 for (
const auto *Field : RD->
fields()) {
2673 CheckIfTriviallyCopyable))
2676 if (FieldSize != UnionSize)
2694static std::optional<int64_t>
2697 bool CheckIfTriviallyCopyable);
2699static std::optional<int64_t>
2701 bool CheckIfTriviallyCopyable) {
2702 if (Field->getType()->isRecordType()) {
2703 const RecordDecl *RD = Field->getType()->getAsRecordDecl();
2706 CheckIfTriviallyCopyable);
2711 bool IsBitIntType = Field->getType()->isBitIntType();
2712 if (!Field->getType()->isReferenceType() && !IsBitIntType &&
2714 CheckIfTriviallyCopyable))
2715 return std::nullopt;
2717 int64_t FieldSizeInBits =
2719 if (Field->isBitField()) {
2722 if (Field->isUnnamedBitField())
2725 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2727 if ((
unsigned)BitfieldSize >
2728 cast<BitIntType>(Field->getType())->getNumBits())
2729 return std::nullopt;
2730 }
else if (BitfieldSize > FieldSizeInBits) {
2731 return std::nullopt;
2733 FieldSizeInBits = BitfieldSize;
2735 Field->getType(), CheckIfTriviallyCopyable)) {
2736 return std::nullopt;
2738 return FieldSizeInBits;
2741static std::optional<int64_t>
2743 bool CheckIfTriviallyCopyable) {
2745 CheckIfTriviallyCopyable);
2748template <
typename RangeT>
2750 const RangeT &Subobjects, int64_t CurOffsetInBits,
2752 bool CheckIfTriviallyCopyable) {
2753 for (
const auto *Subobject : Subobjects) {
2754 std::optional<int64_t> SizeInBits =
2757 return std::nullopt;
2758 if (*SizeInBits != 0) {
2760 if (Offset != CurOffsetInBits)
2761 return std::nullopt;
2762 CurOffsetInBits += *SizeInBits;
2765 return CurOffsetInBits;
2768static std::optional<int64_t>
2771 bool CheckIfTriviallyCopyable) {
2772 assert(!RD->
isUnion() &&
"Must be struct/class type");
2775 int64_t CurOffsetInBits = 0;
2776 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2777 if (ClassDecl->isDynamicClass())
2778 return std::nullopt;
2781 for (
const auto &
Base : ClassDecl->bases()) {
2784 Bases.emplace_back(
Base.getType()->getAsCXXRecordDecl());
2788 return Layout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R);
2791 std::optional<int64_t> OffsetAfterBases =
2793 Bases, CurOffsetInBits, Context, Layout, CheckIfTriviallyCopyable);
2794 if (!OffsetAfterBases)
2795 return std::nullopt;
2796 CurOffsetInBits = *OffsetAfterBases;
2799 std::optional<int64_t> OffsetAfterFields =
2801 RD->
fields(), CurOffsetInBits, Context, Layout,
2802 CheckIfTriviallyCopyable);
2803 if (!OffsetAfterFields)
2804 return std::nullopt;
2805 CurOffsetInBits = *OffsetAfterFields;
2807 return CurOffsetInBits;
2811 QualType Ty,
bool CheckIfTriviallyCopyable)
const {
2828 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2833 CheckIfTriviallyCopyable);
2836 "hasUniqueObjectRepresentations should not be called with an "
2857 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2862 if (
Record->isInvalidDecl())
2867 CheckIfTriviallyCopyable);
2870 *
this,
Record, CheckIfTriviallyCopyable);
2872 return StructSize && *StructSize ==
static_cast<int64_t
>(
getTypeSize(Ty));
2893 count += Ext->ivar_size();
2898 count += ImplDecl->ivar_size();
2916 if (isa<GNUNullExpr>(
E))
return true;
2924 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2925 I = ObjCImpls.find(
D);
2926 if (I != ObjCImpls.end())
2927 return cast<ObjCImplementationDecl>(I->second);
2934 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2935 I = ObjCImpls.find(
D);
2936 if (I != ObjCImpls.end())
2937 return cast<ObjCCategoryImplDecl>(I->second);
2944 assert(IFaceD && ImplD &&
"Passed null params");
2945 ObjCImpls[IFaceD] = ImplD;
2951 assert(CatD && ImplD &&
"Passed null params");
2952 ObjCImpls[CatD] = ImplD;
2957 return ObjCMethodRedecls.lookup(MD);
2963 ObjCMethodRedecls[MD] = Redecl;
2968 if (
const auto *ID = dyn_cast<ObjCInterfaceDecl>(ND->
getDeclContext()))
2970 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
2971 return CD->getClassInterface();
2972 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
2973 return IMD->getClassInterface();
2981 assert(VD &&
"Passed null params");
2982 assert(VD->
hasAttr<BlocksAttr>() &&
2983 "getBlockVarCopyInits - not __block var");
2984 auto I = BlockVarCopyInits.find(VD);
2985 if (I != BlockVarCopyInits.end())
2987 return {
nullptr,
false};
2993 assert(VD && CopyExpr &&
"Passed null params");
2994 assert(VD->
hasAttr<BlocksAttr>() &&
2995 "setBlockVarCopyInits - not __block var");
2996 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr,
CanThrow);
3000 unsigned DataSize)
const {
3005 "incorrect data size provided to CreateTypeSourceInfo!");
3022 return getObjCLayout(
D,
nullptr);
3028 return getObjCLayout(
D->getClassInterface(),
D);
3033 bool &AnyNonCanonArgs) {
3035 for (
auto &Arg : CanonArgs) {
3037 Arg =
C.getCanonicalTemplateArgument(Arg);
3038 AnyNonCanonArgs |= !Arg.structurallyEquals(OrigArg);
3048ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
3053 llvm::FoldingSetNodeID
ID;
3055 void *insertPos =
nullptr;
3056 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
3057 assert(eq->getQualifiers() == quals);
3066 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
3069 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
3072 auto *eq =
new (*
this,
alignof(
ExtQuals))
ExtQuals(baseType, canon, quals);
3073 ExtQualNodes.InsertNode(eq, insertPos);
3078 LangAS AddressSpace)
const {
3091 "Type cannot be in multiple addr spaces!");
3094 return getExtQualType(TypeNode, Quals);
3100 if (!
T.hasAddressSpace())
3104 const Type *TypeNode;
3109 TypeNode =
T.getTypePtr();
3113 while (
T.hasAddressSpace()) {
3114 TypeNode = Quals.
strip(
T);
3118 if (!
QualType(TypeNode, 0).hasAddressSpace())
3122 T =
T.getSingleStepDesugaredType(*
this);
3132 return getExtQualType(TypeNode, Quals);
3140 "Attempted to get vtable pointer discriminator on a monomorphic type");
3143 llvm::raw_svector_ostream Out(Str);
3144 MC->mangleCXXVTable(RD, Out);
3145 return llvm::getPointerAuthStableSipHash(Str);
3174 Ctx, OS, cast<AtomicType>(
T)->getValueType());
3176 case Type::LValueReference:
3181 case Type::RValueReference:
3195 case Type::ObjCObjectPointer:
3196 case Type::BlockPointer:
3203 Ctx, OS, cast<ComplexType>(
T)->getElementType());
3205 case Type::VariableArray:
3206 case Type::ConstantArray:
3207 case Type::IncompleteArray:
3208 case Type::ArrayParameter:
3219 Ctx, OS, cast<ArrayType>(
T)->getElementType());
3221 case Type::ObjCInterface:
3222 case Type::ObjCObject:
3223 OS <<
"<objc_object>";
3232 QualType UnderlyingType = cast<EnumType>(
T)->getDecl()->getIntegerType();
3234 Ctx, OS, UnderlyingType.
isNull() ? Ctx.
IntTy : UnderlyingType);
3237 case Type::FunctionNoProto:
3238 case Type::FunctionProto: {
3252 const auto *FuncType = cast<FunctionType>(
T);
3254 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FuncType)) {
3255 for (
QualType Param : FPT->param_types()) {
3259 if (FPT->isVariadic())
3266 case Type::MemberPointer: {
3273 case Type::ExtVector:
3281 case Type::ConstantMatrix:
3285 case Type::Builtin: {
3287 switch (BTy->getKind()) {
3288#define SIGNED_TYPE(Id, SingletonId) \
3289 case BuiltinType::Id: \
3292#define UNSIGNED_TYPE(Id, SingletonId) \
3293 case BuiltinType::Id: \
3296#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id:
3297#define BUILTIN_TYPE(Id, SingletonId)
3298#include "clang/AST/BuiltinTypes.def"
3299 llvm_unreachable(
"placeholder types should not appear here.");
3301 case BuiltinType::Half:
3304 case BuiltinType::Float:
3307 case BuiltinType::Double:
3310 case BuiltinType::LongDouble:
3313 case BuiltinType::Float16:
3316 case BuiltinType::Float128:
3320 case BuiltinType::Void:
3324 case BuiltinType::ObjCId:
3325 case BuiltinType::ObjCClass:
3326 case BuiltinType::ObjCSel:
3327 case BuiltinType::NullPtr:
3332 case BuiltinType::OCLSampler:
3333 case BuiltinType::OCLEvent:
3334 case BuiltinType::OCLClkEvent:
3335 case BuiltinType::OCLQueue:
3336 case BuiltinType::OCLReserveID:
3337 case BuiltinType::BFloat16:
3338 case BuiltinType::VectorQuad:
3339 case BuiltinType::VectorPair:
3344 case BuiltinType::Ibm128:
3346#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
3347 case BuiltinType::Id: \
3349#include "clang/Basic/OpenCLImageTypes.def"
3350#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
3351 case BuiltinType::Id: \
3353#include "clang/Basic/OpenCLExtensionTypes.def"
3354#define SVE_TYPE(Name, Id, SingletonId) \
3355 case BuiltinType::Id: \
3357#include "clang/Basic/AArch64SVEACLETypes.def"
3358 case BuiltinType::Dependent:
3359 llvm_unreachable(
"should never get here");
3360 case BuiltinType::AMDGPUBufferRsrc:
3361 case BuiltinType::WasmExternRef:
3362#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
3363#include "clang/Basic/RISCVVTypes.def"
3364 llvm_unreachable(
"not yet implemented");
3366 llvm_unreachable(
"should never get here");
3368 case Type::Record: {
3389 II = Typedef->getDeclName().getAsIdentifierInfo();
3392 OS <<
"<anonymous_record>";
3398 case Type::DeducedTemplateSpecialization:
3400#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
3401#define DEPENDENT_TYPE(Class, Base) case Type::Class:
3402#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
3403#define ABSTRACT_TYPE(Class, Base)
3404#define TYPE(Class, Base)
3405#include "clang/AST/TypeNodes.inc"
3406 llvm_unreachable(
"unexpected non-canonical or dependent type!");
3413 "cannot compute type discriminator of a dependent type");
3416 llvm::raw_svector_ostream Out(Str);
3424 T =
T.getUnqualifiedType();
3426 MC->mangleCanonicalTypeName(
T, Out);
3429 return llvm::getPointerAuthStableSipHash(Str);
3454 "Type cannot have multiple ObjCGCs!");
3457 return getExtQualType(TypeNode, Quals);
3471 QualType WrappedTy,
Expr *CountExpr,
bool CountInBytes,
bool OrNull,
3475 llvm::FoldingSetNodeID ID;
3478 void *InsertPos =
nullptr;
3480 CountAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
3485 size_t Size = CountAttributedType::totalSizeToAlloc<TypeCoupledDeclRefInfo>(
3486 DependentDecls.size());
3489 OrNull, DependentDecls);
3490 Types.push_back(CATy);
3491 CountAttributedTypes.InsertNode(CATy, InsertPos);
3502 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(
T)) {
3505 const auto *FPT = cast<FunctionProtoType>(
T);
3511 return cast<FunctionType>(
Result.getTypePtr());
3527 L->DeducedReturnType(FD, ResultType);
3537 if (
const auto *PT = dyn_cast<ParenType>(Orig))
3542 if (
const auto *MQT = dyn_cast<MacroQualifiedType>(Orig))
3545 MQT->getMacroIdentifier());
3548 if (
const auto *AT = dyn_cast<AttributedType>(Orig))
3558 Proto->getReturnType(), Proto->getParamTypes(),
3559 Proto->getExtProtoInfo().withExceptionSpec(ESI));
3574 for (
unsigned i = 0, n = Args.size(); i != n; ++i)
3608 if (TSInfo->getType() != FD->
getType())
3616 "TypeLoc size mismatch from updating exception specification");
3617 TSInfo->overrideType(Updated);
3626 llvm::FoldingSetNodeID ID;
3629 void *InsertPos =
nullptr;
3630 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
3636 if (!
T.isCanonical()) {
3640 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
3641 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3644 Types.push_back(New);
3645 ComplexTypes.InsertNode(New, InsertPos);
3654 llvm::FoldingSetNodeID ID;
3657 void *InsertPos =
nullptr;
3658 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3664 if (!
T.isCanonical()) {
3668 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3669 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3672 Types.push_back(New);
3673 PointerTypes.InsertNode(New, InsertPos);
3678 llvm::FoldingSetNodeID ID;
3680 void *InsertPos =
nullptr;
3681 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3688 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3689 assert(!AT &&
"Shouldn't be in the map!");
3693 Types.push_back(AT);
3694 AdjustedTypes.InsertNode(AT, InsertPos);
3699 llvm::FoldingSetNodeID ID;
3701 void *InsertPos =
nullptr;
3702 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3709 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3710 assert(!AT &&
"Shouldn't be in the map!");
3713 Types.push_back(AT);
3714 AdjustedTypes.InsertNode(AT, InsertPos);
3745 const auto *ATy = cast<ConstantArrayType>(Ty);
3746 llvm::FoldingSetNodeID ID;
3747 ATy->Profile(ID, *
this, ATy->getElementType(), ATy->getZExtSize(),
3748 ATy->getSizeExpr(), ATy->getSizeModifier(),
3749 ATy->getIndexTypeQualifiers().getAsOpaqueValue());
3750 void *InsertPos =
nullptr;
3752 ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3761 AT = ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3762 assert(!AT &&
"Shouldn't be in the map!");
3767 Types.push_back(AT);
3768 ArrayParameterTypes.InsertNode(AT, InsertPos);
3778 llvm::FoldingSetNodeID ID;
3781 void *InsertPos =
nullptr;
3783 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3789 if (!
T.isCanonical()) {
3794 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3795 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3799 Types.push_back(New);
3800 BlockPointerTypes.InsertNode(New, InsertPos);
3810 "Unresolved placeholder type");
3814 llvm::FoldingSetNodeID ID;
3817 void *InsertPos =
nullptr;
3819 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3827 if (!SpelledAsLValue || InnerRef || !
T.isCanonical()) {
3828 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
3833 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3834 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3839 Types.push_back(New);
3840 LValueReferenceTypes.InsertNode(New, InsertPos);
3850 "Unresolved placeholder type");
3854 llvm::FoldingSetNodeID ID;
3857 void *InsertPos =
nullptr;
3859 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3867 if (InnerRef || !
T.isCanonical()) {
3868 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
3873 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3874 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3879 Types.push_back(New);
3880 RValueReferenceTypes.InsertNode(New, InsertPos);
3889 llvm::FoldingSetNodeID ID;
3892 void *InsertPos =
nullptr;
3894 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3905 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3906 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3910 Types.push_back(New);
3911 MemberPointerTypes.InsertNode(New, InsertPos);
3918 const llvm::APInt &ArySizeIn,
3919 const Expr *SizeExpr,
3921 unsigned IndexTypeQuals)
const {
3924 "Constant array of VLAs is illegal!");
3932 llvm::APInt ArySize(ArySizeIn);
3933 ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
3935 llvm::FoldingSetNodeID ID;
3937 ASM, IndexTypeQuals);
3939 void *InsertPos =
nullptr;
3941 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
3952 ASM, IndexTypeQuals);
3957 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
3958 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3961 auto *New = ConstantArrayType::Create(*
this, EltTy, Canon, ArySize, SizeExpr,
3962 ASM, IndexTypeQuals);
3963 ConstantArrayTypes.InsertNode(New, InsertPos);
3964 Types.push_back(New);
3973 if (!
type->isVariablyModifiedType())
return type;
3978 const Type *ty = split.
Ty;
3980#define TYPE(Class, Base)
3981#define ABSTRACT_TYPE(Class, Base)
3982#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
3983#include "clang/AST/TypeNodes.inc"
3984 llvm_unreachable(
"didn't desugar past all non-canonical types?");
3990 case Type::DependentVector:
3991 case Type::ExtVector:
3992 case Type::DependentSizedExtVector:
3993 case Type::ConstantMatrix:
3994 case Type::DependentSizedMatrix:
3995 case Type::DependentAddressSpace:
3996 case Type::ObjCObject:
3997 case Type::ObjCInterface:
3998 case Type::ObjCObjectPointer:
4001 case Type::UnresolvedUsing:
4002 case Type::TypeOfExpr:
4004 case Type::Decltype:
4005 case Type::UnaryTransform:
4006 case Type::DependentName:
4007 case Type::InjectedClassName:
4008 case Type::TemplateSpecialization:
4009 case Type::DependentTemplateSpecialization:
4010 case Type::TemplateTypeParm:
4011 case Type::SubstTemplateTypeParmPack:
4013 case Type::DeducedTemplateSpecialization:
4014 case Type::PackExpansion:
4015 case Type::PackIndexing:
4017 case Type::DependentBitInt:
4018 case Type::ArrayParameter:
4019 llvm_unreachable(
"type should never be variably-modified");
4023 case Type::FunctionNoProto:
4024 case Type::FunctionProto:
4025 case Type::BlockPointer:
4026 case Type::MemberPointer:
4039 case Type::LValueReference: {
4040 const auto *lv = cast<LValueReferenceType>(ty);
4043 lv->isSpelledAsLValue());
4047 case Type::RValueReference: {
4048 const auto *lv = cast<RValueReferenceType>(ty);
4054 case Type::Atomic: {
4055 const auto *at = cast<AtomicType>(ty);
4060 case Type::ConstantArray: {
4061 const auto *cat = cast<ConstantArrayType>(ty);
4066 cat->getSizeModifier(),
4067 cat->getIndexTypeCVRQualifiers());
4071 case Type::DependentSizedArray: {
4072 const auto *dat = cast<DependentSizedArrayType>(ty);
4076 dat->getSizeModifier(),
4077 dat->getIndexTypeCVRQualifiers(),
4078 dat->getBracketsRange());
4083 case Type::IncompleteArray: {
4084 const auto *iat = cast<IncompleteArrayType>(ty);
4093 case Type::VariableArray: {
4094 const auto *vat = cast<VariableArrayType>(ty);
4098 vat->getIndexTypeCVRQualifiers(), vat->getBracketsRange());
4111 unsigned IndexTypeQuals,
4122 IndexTypeQuals, Brackets);
4129 VariableArrayTypes.push_back(New);
4130 Types.push_back(New);
4140 unsigned elementTypeQuals,
4144 "Size must be type- or value-dependent!");
4148 void *insertPos =
nullptr;
4149 llvm::FoldingSetNodeID ID;
4151 ID, *
this, numElements ?
QualType(canonElementType.
Ty, 0) : elementType,
4152 ASM, elementTypeQuals, numElements);
4156 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
4167 elementTypeQuals, brackets);
4168 DependentSizedArrayTypes.InsertNode(newType, insertPos);
4169 Types.push_back(newType);
4177 numElements, ASM, elementTypeQuals, brackets);
4178 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
4179 Types.push_back(canonTy);
4184 canonElementType.
Quals);
4188 if (
QualType(canonElementType.
Ty, 0) == elementType &&
4196 elementTypeQuals, brackets);
4197 Types.push_back(sugaredType);
4203 unsigned elementTypeQuals)
const {
4204 llvm::FoldingSetNodeID ID;
4207 void *insertPos =
nullptr;
4209 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
4221 ASM, elementTypeQuals);
4226 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
4227 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
4233 IncompleteArrayTypes.InsertNode(newType, insertPos);
4234 Types.push_back(newType);
4240#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS) \
4241 {getIntTypeForBitwidth(BITS, SIGNED), llvm::ElementCount::getScalable(ELTS), \
4244#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS) \
4245 {ELTTY, llvm::ElementCount::getScalable(ELTS), NUMVECTORS};
4249 llvm_unreachable(
"Unsupported builtin vector type");
4250 case BuiltinType::SveInt8:
4252 case BuiltinType::SveUint8:
4254 case BuiltinType::SveInt8x2:
4256 case BuiltinType::SveUint8x2:
4258 case BuiltinType::SveInt8x3:
4260 case BuiltinType::SveUint8x3:
4262 case BuiltinType::SveInt8x4:
4264 case BuiltinType::SveUint8x4:
4266 case BuiltinType::SveInt16:
4268 case BuiltinType::SveUint16:
4270 case BuiltinType::SveInt16x2:
4272 case BuiltinType::SveUint16x2:
4274 case BuiltinType::SveInt16x3:
4276 case BuiltinType::SveUint16x3:
4278 case BuiltinType::SveInt16x4:
4280 case BuiltinType::SveUint16x4:
4282 case BuiltinType::SveInt32:
4284 case BuiltinType::SveUint32:
4286 case BuiltinType::SveInt32x2:
4288 case BuiltinType::SveUint32x2:
4290 case BuiltinType::SveInt32x3:
4292 case BuiltinType::SveUint32x3:
4294 case BuiltinType::SveInt32x4:
4296 case BuiltinType::SveUint32x4:
4298 case BuiltinType::SveInt64:
4300 case BuiltinType::SveUint64:
4302 case BuiltinType::SveInt64x2:
4304 case BuiltinType::SveUint64x2:
4306 case BuiltinType::SveInt64x3:
4308 case BuiltinType::SveUint64x3:
4310 case BuiltinType::SveInt64x4:
4312 case BuiltinType::SveUint64x4:
4314 case BuiltinType::SveBool:
4316 case BuiltinType::SveBoolx2:
4318 case BuiltinType::SveBoolx4:
4320 case BuiltinType::SveFloat16:
4322 case BuiltinType::SveFloat16x2:
4324 case BuiltinType::SveFloat16x3:
4326 case BuiltinType::SveFloat16x4:
4328 case BuiltinType::SveFloat32:
4330 case BuiltinType::SveFloat32x2:
4332 case BuiltinType::SveFloat32x3:
4334 case BuiltinType::SveFloat32x4:
4336 case BuiltinType::SveFloat64:
4338 case BuiltinType::SveFloat64x2:
4340 case BuiltinType::SveFloat64x3:
4342 case BuiltinType::SveFloat64x4:
4344 case BuiltinType::SveBFloat16:
4346 case BuiltinType::SveBFloat16x2:
4348 case BuiltinType::SveBFloat16x3:
4350 case BuiltinType::SveBFloat16x4:
4352#define RVV_VECTOR_TYPE_INT(Name, Id, SingletonId, NumEls, ElBits, NF, \
4354 case BuiltinType::Id: \
4355 return {getIntTypeForBitwidth(ElBits, IsSigned), \
4356 llvm::ElementCount::getScalable(NumEls), NF};
4357#define RVV_VECTOR_TYPE_FLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4358 case BuiltinType::Id: \
4359 return {ElBits == 16 ? Float16Ty : (ElBits == 32 ? FloatTy : DoubleTy), \
4360 llvm::ElementCount::getScalable(NumEls), NF};
4361#define RVV_VECTOR_TYPE_BFLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4362 case BuiltinType::Id: \
4363 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
4364#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4365 case BuiltinType::Id: \
4366 return {BoolTy, llvm::ElementCount::getScalable(NumEls), 1};
4367#include "clang/Basic/RISCVVTypes.def"
4374 if (
Target->getTriple().isWasm() &&
Target->hasFeature(
"reference-types")) {
4375#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
4376 if (BuiltinType::Id == BuiltinType::WasmExternRef) \
4378#include "clang/Basic/WebAssemblyReferenceTypes.def"
4381 "shouldn't try to generate type externref outside WebAssembly target");
4388 unsigned NumFields)
const {
4389 if (
Target->hasAArch64SVETypes()) {
4391#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId, NumEls, ElBits, \
4392 IsSigned, IsFP, IsBF) \
4393 if (!EltTy->isBooleanType() && \
4394 ((EltTy->hasIntegerRepresentation() && \
4395 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4396 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4398 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4399 IsBF && !IsFP)) && \
4400 EltTySize == ElBits && NumElts == NumEls) { \
4401 return SingletonId; \
4403#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId, NumEls) \
4404 if (EltTy->isBooleanType() && NumElts == NumEls) \
4406#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingleTonId)
4407#include "clang/Basic/AArch64SVEACLETypes.def"
4408 }
else if (
Target->hasRISCVVTypes()) {
4410#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
4412 if (!EltTy->isBooleanType() && \
4413 ((EltTy->hasIntegerRepresentation() && \
4414 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4415 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4417 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4418 IsBF && !IsFP)) && \
4419 EltTySize == ElBits && NumElts == NumEls && NumFields == NF) \
4421#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4422 if (EltTy->isBooleanType() && NumElts == NumEls) \
4424#include "clang/Basic/RISCVVTypes.def"
4440 llvm::FoldingSetNodeID ID;
4443 void *InsertPos =
nullptr;
4444 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4454 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4455 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4458 VectorType(vecType, NumElts, Canonical, VecKind);
4459 VectorTypes.InsertNode(New, InsertPos);
4460 Types.push_back(New);
4467 llvm::FoldingSetNodeID ID;
4470 void *InsertPos =
nullptr;
4472 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4477 VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
4480 if (CanonVecTy == VecType) {
4485 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4486 assert(!CanonCheck &&
4487 "Dependent-sized vector_size canonical type broken");
4489 DependentVectorTypes.InsertNode(New, InsertPos);
4498 Types.push_back(New);
4505 unsigned NumElts)
const {
4513 llvm::FoldingSetNodeID ID;
4516 void *InsertPos =
nullptr;
4517 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4527 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4528 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4532 VectorTypes.InsertNode(New, InsertPos);
4533 Types.push_back(New);
4541 llvm::FoldingSetNodeID ID;
4545 void *InsertPos =
nullptr;
4547 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4557 if (CanonVecTy == vecType) {
4562 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4563 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
4565 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
4574 Types.push_back(New);
4579 unsigned NumColumns)
const {
4580 llvm::FoldingSetNodeID ID;
4582 Type::ConstantMatrix);
4585 "need a valid element type");
4588 "need valid matrix dimensions");
4589 void *InsertPos =
nullptr;
4599 assert(!NewIP &&
"Matrix type shouldn't already exist in the map");
4605 MatrixTypes.InsertNode(New, InsertPos);
4606 Types.push_back(New);
4615 llvm::FoldingSetNodeID ID;
4619 void *InsertPos =
nullptr;
4621 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4626 ColumnExpr, AttrLoc);
4629 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4630 assert(!CanonCheck &&
"Dependent-sized matrix canonical type broken");
4632 DependentSizedMatrixTypes.InsertNode(Canon, InsertPos);
4633 Types.push_back(Canon);
4646 ColumnExpr, AttrLoc);
4647 Types.push_back(New);
4652 Expr *AddrSpaceExpr,
4658 void *insertPos =
nullptr;
4659 llvm::FoldingSetNodeID ID;
4664 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
4670 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
4671 Types.push_back(canonTy);
4674 if (canonPointeeType == PointeeType &&
4680 AddrSpaceExpr, AttrLoc);
4681 Types.push_back(sugaredType);
4687 return T.isCanonical() &&
4705 llvm::FoldingSetNodeID ID;
4708 void *InsertPos =
nullptr;
4710 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
4720 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4721 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4726 Types.push_back(New);
4727 FunctionNoProtoTypes.InsertNode(New, InsertPos);
4743 return CanResultType;
4750 if (!NoexceptInType)
4767 bool AnyPackExpansions =
false;
4772 AnyPackExpansions =
true;
4774 return AnyPackExpansions;
4780QualType ASTContext::getFunctionTypeInternal(
4783 size_t NumArgs = ArgArray.size();
4787 llvm::FoldingSetNodeID
ID;
4792 bool Unique =
false;
4794 void *InsertPos =
nullptr;
4796 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4816 bool IsCanonicalExceptionSpec =
4820 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
4822 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
4823 if (!ArgArray[i].isCanonicalAsParam())
4824 isCanonical =
false;
4826 if (OnlyWantCanonical)
4827 assert(isCanonical &&
4828 "given non-canonical parameters constructing canonical type");
4833 if (!isCanonical && Canonical.
isNull()) {
4835 CanonicalArgs.reserve(NumArgs);
4836 for (
unsigned i = 0; i != NumArgs; ++i)
4843 if (IsCanonicalExceptionSpec) {
4845 }
else if (NoexceptInType) {
4858 bool AnyPacks =
false;
4881 llvm_unreachable(
"dependent noexcept is already canonical");
4890 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
4894 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4895 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4900 auto ESH = FunctionProtoType::getExceptionSpecSize(
4902 size_t Size = FunctionProtoType::totalSizeToAlloc<
4909 ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
4917 Types.push_back(FTP);
4919 FunctionProtoTypes.InsertNode(FTP, InsertPos);
4921 AnyFunctionEffects =
true;
4926 llvm::FoldingSetNodeID
ID;
4929 void *InsertPos =
nullptr;
4930 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
4936 if (!
T.isCanonical()) {
4940 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
4941 assert(!NewIP &&
"Shouldn't be in the map!");
4945 Types.push_back(New);
4946 PipeTypes.InsertNode(New, InsertPos);
4957 return getPipeType(
T,
true);
4961 return getPipeType(
T,
false);
4965 llvm::FoldingSetNodeID ID;
4968 void *InsertPos =
nullptr;
4969 if (
BitIntType *EIT = BitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
4973 BitIntTypes.InsertNode(New, InsertPos);
4974 Types.push_back(New);
4979 Expr *NumBitsExpr)
const {
4981 llvm::FoldingSetNodeID ID;
4984 void *InsertPos =
nullptr;
4986 DependentBitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
4991 DependentBitIntTypes.InsertNode(New, InsertPos);
4993 Types.push_back(New);
4999 if (!isa<CXXRecordDecl>(
D))
return false;
5000 const auto *RD = cast<CXXRecordDecl>(
D);
5001 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
5003 if (RD->getDescribedClassTemplate() &&
5004 !isa<ClassTemplateSpecializationDecl>(RD))
5015 if (
Decl->TypeForDecl) {
5016 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
5018 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
5019 Decl->TypeForDecl = PrevDecl->TypeForDecl;
5020 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
5024 Decl->TypeForDecl = newType;
5025 Types.push_back(newType);
5033 assert(
Decl &&
"Passed null for Decl param");
5034 assert(!
Decl->TypeForDecl &&
"TypeForDecl present in slow case");
5036 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(
Decl))
5039 assert(!isa<TemplateTypeParmDecl>(
Decl) &&
5040 "Template type parameter types are always available.");
5042 if (
const auto *
Record = dyn_cast<RecordDecl>(
Decl)) {
5043 assert(
Record->isFirstDecl() &&
"struct/union has previous declaration");
5046 }
else if (
const auto *
Enum = dyn_cast<EnumDecl>(
Decl)) {
5047 assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
5049 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(
Decl)) {
5052 llvm_unreachable(
"TypeDecl without a type?");
5061 if (!
Decl->TypeForDecl) {
5063 Underlying =
Decl->getUnderlyingType();
5066 Decl->TypeForDecl = NewType;
5067 Types.push_back(NewType);
5070 if (Underlying.
isNull() ||
Decl->getUnderlyingType() == Underlying)
5074 llvm::FoldingSetNodeID ID;
5077 void *InsertPos =
nullptr;
5078 if (
TypedefType *
T = TypedefTypes.FindNodeOrInsertPos(ID, InsertPos)) {
5079 assert(!
T->typeMatchesDecl() &&
5080 "non-divergent case should be handled with TypeDecl");
5084 void *Mem =
Allocate(TypedefType::totalSizeToAlloc<QualType>(
true),
5086 auto *NewType =
new (Mem)
TypedefType(Type::Typedef,
Decl, Underlying,
5088 TypedefTypes.InsertNode(NewType, InsertPos);
5089 Types.push_back(NewType);
5095 llvm::FoldingSetNodeID ID;
5098 void *InsertPos =
nullptr;
5099 if (
UsingType *
T = UsingTypes.FindNodeOrInsertPos(ID, InsertPos))
5102 const Type *TypeForDecl =
5103 cast<TypeDecl>(
Found->getTargetDecl())->getTypeForDecl();
5112 Allocate(UsingType::totalSizeToAlloc<QualType>(!Underlying.
isNull()),
5115 Types.push_back(NewType);
5116 UsingTypes.InsertNode(NewType, InsertPos);
5124 if (PrevDecl->TypeForDecl)
5125 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
5128 Decl->TypeForDecl = newType;
5129 Types.push_back(newType);
5137 if (PrevDecl->TypeForDecl)
5138 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
5141 Decl->TypeForDecl = newType;
5142 Types.push_back(newType);
5148 if (
Decl->TypeForDecl)
5153 if (CanonicalDecl->TypeForDecl)
5154 return QualType(
Decl->TypeForDecl = CanonicalDecl->TypeForDecl, 0);
5158 Decl->TypeForDecl = newType;
5159 Types.push_back(newType);
5166 llvm::FoldingSetNodeID id;
5169 void *insertPos =
nullptr;
5177 Types.push_back(
type);
5178 AttributedTypes.InsertNode(
type, insertPos);
5185 llvm::FoldingSetNodeID ID;
5188 void *InsertPos =
nullptr;
5190 BTFTagAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
5198 Types.push_back(Ty);
5199 BTFTagAttributedTypes.InsertNode(Ty, InsertPos);
5206 QualType Replacement,
Decl *AssociatedDecl,
unsigned Index,
5207 std::optional<unsigned> PackIndex)
const {
5208 llvm::FoldingSetNodeID ID;
5211 void *InsertPos =
nullptr;
5213 SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5216 void *Mem =
Allocate(SubstTemplateTypeParmType::totalSizeToAlloc<QualType>(
5217 !Replacement.isCanonical()),
5221 Types.push_back(SubstParm);
5222 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
5231 unsigned Index,
bool Final,
5238 llvm::FoldingSetNodeID ID;
5241 void *InsertPos =
nullptr;
5243 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
5253 [[maybe_unused]]
const auto *Nothing =
5254 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
5262 Types.push_back(SubstParm);
5263 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
5273 llvm::FoldingSetNodeID ID;
5275 void *InsertPos =
nullptr;
5277 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5288 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5289 assert(!TypeCheck &&
"Template type parameter canonical type broken");
5295 Types.push_back(TypeParm);
5296 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
5306 assert(!Name.getAsDependentTemplateName() &&
5307 "No dependent template names here!");
5318 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
5328 "No dependent template names here!");
5331 ArgVec.reserve(Args.size());
5333 ArgVec.push_back(Arg.getArgument());
5341 if (Arg.isPackExpansion())
5353 "No dependent template names here!");
5358 if (!Underlying.
isNull())
5364 "Caller must compute aliased type");
5365 IsTypeAlias =
false;
5374 (IsTypeAlias ?
sizeof(
QualType) : 0),
5378 IsTypeAlias ? Underlying :
QualType());
5380 Types.push_back(Spec);
5387 "No dependent template names here!");
5391 bool AnyNonCanonArgs =
false;
5397 llvm::FoldingSetNodeID ID;
5401 void *InsertPos =
nullptr;
5403 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5413 Types.push_back(Spec);
5414 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
5418 "Non-dependent template-id type must have a canonical type");
5425 TagDecl *OwnedTagDecl)
const {
5426 llvm::FoldingSetNodeID ID;
5429 void *InsertPos =
nullptr;
5430 ElaboratedType *
T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5437 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5438 assert(!CheckT &&
"Elaborated canonical type broken");
5443 Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
5445 T =
new (Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
5448 ElaboratedTypes.InsertNode(
T, InsertPos);
5454 llvm::FoldingSetNodeID ID;
5457 void *InsertPos =
nullptr;
5458 ParenType *
T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5465 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5466 assert(!CheckT &&
"Paren canonical type broken");
5472 ParenTypes.InsertNode(
T, InsertPos);
5485 Types.push_back(newType);
5495 if (CanonNNS != NNS)
5499 llvm::FoldingSetNodeID ID;
5502 void *InsertPos =
nullptr;
5504 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
5511 DependentNameTypes.InsertNode(
T, InsertPos);
5520 for (
unsigned I = 0,
E = Args.size(); I !=
E; ++I)
5532 "nested-name-specifier must be dependent");
5534 llvm::FoldingSetNodeID ID;
5538 void *InsertPos =
nullptr;
5540 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5550 bool AnyNonCanonArgs =
false;
5555 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
5561 [[maybe_unused]]
auto *Nothing =
5562 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5563 assert(!Nothing &&
"canonical type broken");
5572 DependentTemplateSpecializationTypes.InsertNode(
T, InsertPos);
5578 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
5584 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
5586 NTTP->getType().getNonPackExpansionType().getNonLValueExprType(*
this);
5594 *
this, NTTP,
false,
T,
5597 if (NTTP->isParameterPack())
5602 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
5620 Args.reserve(Args.size() + Params->
size());
5627 std::optional<unsigned> NumExpansions,
5628 bool ExpectPackInType) {
5630 "Pack expansions must expand one or more parameter packs");
5632 llvm::FoldingSetNodeID ID;
5635 void *InsertPos =
nullptr;
5647 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
5653 PackExpansionTypes.InsertNode(
T, InsertPos);
5665 if (Protocols.empty())
return true;
5670 for (
unsigned i = 1; i != Protocols.size(); ++i)
5680 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
5684 P =
P->getCanonicalDecl();
5687 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
5688 Protocols.erase(ProtocolsEnd, Protocols.end());
5693 unsigned NumProtocols)
const {
5703 bool isKindOf)
const {
5706 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
5707 isa<ObjCInterfaceType>(baseType))
5711 llvm::FoldingSetNodeID ID;
5713 void *InsertPos =
nullptr;
5714 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
5721 if (effectiveTypeArgs.empty()) {
5723 effectiveTypeArgs = baseObject->getTypeArgs();
5730 bool typeArgsAreCanonical = llvm::all_of(
5733 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
5737 if (!typeArgsAreCanonical) {
5738 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
5739 for (
auto typeArg : effectiveTypeArgs)
5741 canonTypeArgs = canonTypeArgsVec;
5743 canonTypeArgs = effectiveTypeArgs;
5748 if (!protocolsSorted) {
5749 canonProtocolsVec.append(protocols.begin(), protocols.end());
5751 canonProtocols = canonProtocolsVec;
5753 canonProtocols = protocols;
5757 canonProtocols, isKindOf);
5760 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
5764 size += typeArgs.size() *
sizeof(
QualType);
5772 ObjCObjectTypes.InsertNode(
T, InsertPos);
5782 bool allowOnPointerType)
const {
5785 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(
type.getTypePtr())) {
5790 if (allowOnPointerType) {
5791 if (
const auto *objPtr =
5792 dyn_cast<ObjCObjectPointerType>(
type.getTypePtr())) {
5798 protocolsVec.append(protocols.begin(), protocols.end());
5810 if (
const auto *objT = dyn_cast<ObjCObjectType>(
type.getTypePtr())){
5815 objT->getTypeArgsAsWritten(),
5817 objT->isKindOfTypeAsWritten());
5821 if (
type->isObjCObjectType()) {
5831 if (
type->isObjCIdType()) {
5834 objPtr->isKindOfType());
5839 if (
type->isObjCClassType()) {
5842 objPtr->isKindOfType());
5854 llvm::FoldingSetNodeID ID;
5856 void *InsertPos =
nullptr;
5858 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
5863 if (!protocols.empty()) {
5867 Canonical, protocols, hasError,
true ));
5868 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
5876 Types.push_back(newType);
5877 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
5885 auto NewTypeParamTy = cast<ObjCTypeParamType>(New->
getTypeForDecl());
5887 protocols.append(NewTypeParamTy->qual_begin(), NewTypeParamTy->qual_end());
5902 for (
auto *Proto : OPT->quals()) {
5925 if (InheritedProtocols.empty())
5929 bool Conforms =
false;
5930 for (
auto *Proto : OPT->quals()) {
5932 for (
auto *PI : InheritedProtocols) {
5944 for (
auto *PI : InheritedProtocols) {
5946 bool Adopts =
false;
5947 for (
auto *Proto : OPT->quals()) {
5961 llvm::FoldingSetNodeID ID;
5964 void *InsertPos =
nullptr;
5966 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
5975 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
5984 Types.push_back(QType);
5985 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
5993 if (
Decl->TypeForDecl)
5997 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
5998 Decl->TypeForDecl = PrevDecl->TypeForDecl;
5999 return QualType(PrevDecl->TypeForDecl, 0);
6008 Decl->TypeForDecl =
T;
6021 llvm::FoldingSetNodeID ID;
6025 void *InsertPos =
nullptr;
6027 DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
6037 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
6045 Types.push_back(toe);
6058 Types.push_back(tot);
6082 llvm_unreachable(
"Unknown value kind");
6097 llvm::FoldingSetNodeID ID;
6100 void *InsertPos =
nullptr;
6102 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
6107 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
6115 Types.push_back(dt);
6120 bool FullySubstituted,
6124 if (FullySubstituted && Index != -1) {
6127 llvm::FoldingSetNodeID ID;
6129 void *InsertPos =
nullptr;
6131 DependentPackIndexingTypes.FindNodeOrInsertPos(ID, InsertPos);
6134 PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
6138 DependentPackIndexingTypes.InsertNode(Canon, InsertPos);
6144 Allocate(PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
6162 llvm::FoldingSetNodeID ID;
6165 void *InsertPos =
nullptr;
6167 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
6173 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
6182 Types.push_back(ut);
6186QualType ASTContext::getAutoTypeInternal(
6191 !TypeConstraintConcept && !IsDependent)
6195 void *InsertPos =
nullptr;
6196 llvm::FoldingSetNodeID ID;
6198 TypeConstraintConcept, TypeConstraintArgs);
6199 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
6206 }
else if (TypeConstraintConcept) {
6207 bool AnyNonCanonArgs =
false;
6210 *
this, TypeConstraintArgs, AnyNonCanonArgs);
6211 if (CanonicalConcept != TypeConstraintConcept || AnyNonCanonArgs) {
6213 getAutoTypeInternal(
QualType(), Keyword, IsDependent, IsPack,
6214 CanonicalConcept, CanonicalConceptArgs,
true);
6216 [[maybe_unused]]
auto *Nothing =
6217 AutoTypes.FindNodeOrInsertPos(ID, InsertPos);
6218 assert(!Nothing &&
"canonical type broken");
6228 (IsDependent ? TypeDependence::DependentInstantiation
6229 : TypeDependence::None) |
6230 (IsPack ? TypeDependence::UnexpandedPack : TypeDependence::None),
6231 Canon, TypeConstraintConcept, TypeConstraintArgs);
6232 Types.push_back(AT);
6233 AutoTypes.InsertNode(AT, InsertPos);
6242 bool IsDependent,
bool IsPack,
6245 assert((!IsPack || IsDependent) &&
"only use IsPack for a dependent pack");
6247 "A dependent auto should be undeduced");
6248 return getAutoTypeInternal(
DeducedType, Keyword, IsDependent, IsPack,
6249 TypeConstraintConcept, TypeConstraintArgs);
6257 if (!AT->isConstrained())
6261 AT->containsUnexpandedParameterPack()),
6273QualType ASTContext::getDeducedTemplateSpecializationTypeInternal(
6277 void *InsertPos =
nullptr;
6278 llvm::FoldingSetNodeID ID;
6282 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
6288 llvm::FoldingSetNodeID TempID;
6289 DTST->Profile(TempID);
6290 assert(ID == TempID &&
"ID does not match");
6291 Types.push_back(DTST);
6292 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
6302 ? getDeducedTemplateSpecializationTypeInternal(
6306 return getDeducedTemplateSpecializationTypeInternal(Template,
DeducedType,
6307 IsDependent, Canon);
6315 llvm::FoldingSetNodeID ID;
6318 void *InsertPos =
nullptr;
6319 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
6325 if (!
T.isCanonical()) {
6329 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
6330 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
6333 Types.push_back(New);
6334 AtomicTypes.InsertNode(New, InsertPos);
6370 return getFromTargetType(
Target->getSizeType());
6376 return getFromTargetType(
Target->getSignedSizeType());
6381 return getFromTargetType(
Target->getIntMaxType());
6386 return getFromTargetType(
Target->getUIntMaxType());
6404 return getFromTargetType(
Target->getIntPtrType());
6427 return getFromTargetType(
Target->getProcessIDType());
6439 const Type *Ty =
T.getTypePtr();
6443 }
else if (isa<ArrayType>(Ty)) {
6445 }
else if (isa<FunctionType>(Ty)) {
6467 quals = splitType.
Quals;
6472 QualType elementType = AT->getElementType();
6477 if (elementType == unqualElementType) {
6478 assert(quals.
empty());
6479 quals = splitType.
Quals;
6487 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
6489 CAT->getSizeExpr(), CAT->getSizeModifier(), 0);
6492 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
6496 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
6499 VAT->getSizeModifier(),
6500 VAT->getIndexTypeCVRQualifiers(),
6501 VAT->getBracketsRange());
6504 const auto *DSAT = cast<DependentSizedArrayType>(AT);
6506 DSAT->getSizeModifier(), 0,
6517 bool AllowPiMismatch) {
6532 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
6533 auto *CAT2 = dyn_cast<ConstantArrayType>(AT2);
6534 if (!((CAT2 && CAT1->getSize() == CAT2->getSize()) ||
6536 isa<IncompleteArrayType>(AT2))))
6538 }
else if (isa<IncompleteArrayType>(AT1)) {
6539 if (!(isa<IncompleteArrayType>(AT2) ||
6541 isa<ConstantArrayType>(AT2))))
6547 T1 = AT1->getElementType();
6548 T2 = AT2->getElementType();
6568 bool AllowPiMismatch) {
6573 if (T1PtrType && T2PtrType) {
6581 if (T1MPType && T2MPType &&
6592 if (T1OPType && T2OPType) {
6624 if (Quals1 != Quals2)
6638 switch (Name.getKind()) {
6673 = Name.getAsSubstTemplateTemplateParm();
6680 = Name.getAsSubstTemplateTemplateParmPack();
6689 llvm_unreachable(
"bad template name kind!");
6694 switch (Name.getKind()) {
6699 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
6700 Template = getCanonicalTemplateTemplateParmDecl(TTP);
6708 llvm_unreachable(
"cannot canonicalize unresolved template");
6712 assert(DTN &&
"Non-dependent template names must refer to template decls.");
6713 return DTN->CanonicalTemplateName;
6718 = Name.getAsSubstTemplateTemplateParm();
6724 Name.getAsSubstTemplateTemplateParmPack();
6733 llvm_unreachable(
"bad template name!");
6749 llvm::FoldingSetNodeID XCEID, YCEID;
6750 XCE->
Profile(XCEID, *
this,
true,
true);
6751 YCE->
Profile(YCEID, *
this,
true,
true);
6752 return XCEID == YCEID;
6801 if (
auto *TX = dyn_cast<TemplateTypeParmDecl>(
X)) {
6802 auto *TY = cast<TemplateTypeParmDecl>(Y);
6803 if (TX->isParameterPack() != TY->isParameterPack())
6805 if (TX->hasTypeConstraint() != TY->hasTypeConstraint())
6808 TY->getTypeConstraint());
6811 if (
auto *TX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
6812 auto *TY = cast<NonTypeTemplateParmDecl>(Y);
6813 return TX->isParameterPack() == TY->isParameterPack() &&
6814 TX->getASTContext().hasSameType(TX->getType(), TY->getType()) &&
6816 TY->getPlaceholderTypeConstraint());
6819 auto *TX = cast<TemplateTemplateParmDecl>(
X);
6820 auto *TY = cast<TemplateTemplateParmDecl>(Y);
6821 return TX->isParameterPack() == TY->isParameterPack() &&
6823 TY->getTemplateParameters());
6828 if (
X->size() != Y->
size())
6831 for (
unsigned I = 0, N =
X->size(); I != N; ++I)
6845 if (
auto *TTPX = dyn_cast<TemplateTypeParmDecl>(
X)) {
6846 auto *TTPY = cast<TemplateTypeParmDecl>(Y);
6847 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
6850 return hasSameType(TTPX->getDefaultArgument().getArgument().getAsType(),
6851 TTPY->getDefaultArgument().getArgument().getAsType());
6854 if (
auto *NTTPX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
6855 auto *NTTPY = cast<NonTypeTemplateParmDecl>(Y);
6856 if (!NTTPX->hasDefaultArgument() || !NTTPY->hasDefaultArgument())
6859 Expr *DefaultArgumentX =
6860 NTTPX->getDefaultArgument().getArgument().getAsExpr()->
IgnoreImpCasts();
6861 Expr *DefaultArgumentY =
6862 NTTPY->getDefaultArgument().getArgument().getAsExpr()->
IgnoreImpCasts();
6863 llvm::FoldingSetNodeID XID, YID;
6864 DefaultArgumentX->
Profile(XID, *
this,
true);
6865 DefaultArgumentY->
Profile(YID, *
this,
true);
6869 auto *TTPX = cast<TemplateTemplateParmDecl>(
X);
6870 auto *TTPY = cast<TemplateTemplateParmDecl>(Y);
6872 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
6881 if (
auto *NS =
X->getAsNamespace())
6883 if (
auto *NAS =
X->getAsNamespaceAlias())
6884 return NAS->getNamespace();
6892 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
6894 }
else if (
X->getKind() != Y->
getKind())
6899 switch (
X->getKind()) {
6910 if (
X->getAsType()->getCanonicalTypeInternal() !=
6920 auto *PX =
X->getPrefix();
6934 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
6938 for (
auto Pair : zip_longest(AEnableIfAttrs, BEnableIfAttrs)) {
6939 std::optional<EnableIfAttr *> Cand1A = std::get<0>(Pair);
6940 std::optional<EnableIfAttr *> Cand2A = std::get<1>(Pair);
6943 if (!Cand1A || !Cand2A)
6949 (*Cand1A)->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
6950 (*Cand2A)->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
6954 if (Cand1ID != Cand2ID)
6982 if (
const auto *TypedefX = dyn_cast<TypedefNameDecl>(
X))
6983 if (
const auto *TypedefY = dyn_cast<TypedefNameDecl>(Y))
6985 TypedefY->getUnderlyingType());
6992 if (isa<ObjCInterfaceDecl>(
X) || isa<ObjCProtocolDecl>(
X))
6995 if (isa<ClassTemplateSpecializationDecl>(
X)) {
7002 if (
const auto *TagX = dyn_cast<TagDecl>(
X)) {
7003 const auto *TagY = cast<TagDecl>(Y);
7004 return (TagX->getTagKind() == TagY->getTagKind()) ||
7016 if (
const auto *FuncX = dyn_cast<FunctionDecl>(
X)) {
7017 const auto *FuncY = cast<FunctionDecl>(Y);
7018 if (
const auto *CtorX = dyn_cast<CXXConstructorDecl>(
X)) {
7019 const auto *CtorY = cast<CXXConstructorDecl>(Y);
7020 if (CtorX->getInheritedConstructor() &&
7021 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
7022 CtorY->getInheritedConstructor().getConstructor()))
7026 if (FuncX->isMultiVersion() != FuncY->isMultiVersion())
7031 if (FuncX->isMultiVersion()) {
7032 const auto *TAX = FuncX->getAttr<TargetAttr>();
7033 const auto *TAY = FuncY->getAttr<TargetAttr>();
7034 assert(TAX && TAY &&
"Multiversion Function without target attribute");
7036 if (TAX->getFeaturesStr() != TAY->getFeaturesStr())
7042 if ((FuncX->isMemberLikeConstrainedFriend() ||
7043 FuncY->isMemberLikeConstrainedFriend()) &&
7044 !FuncX->getLexicalDeclContext()->Equals(
7045 FuncY->getLexicalDeclContext())) {
7050 FuncY->getTrailingRequiresClause()))
7058 FD = FD->getCanonicalDecl();
7059 return FD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType()
7062 QualType XT = GetTypeAsWritten(FuncX), YT = GetTypeAsWritten(FuncY);
7077 return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() &&
7082 if (
const auto *VarX = dyn_cast<VarDecl>(
X)) {
7083 const auto *VarY = cast<VarDecl>(Y);
7084 if (VarX->getLinkageInternal() == VarY->getLinkageInternal()) {
7087 if (VarX->getType().isNull() || VarY->getType().isNull())
7090 if (
hasSameType(VarX->getType(), VarY->getType()))
7100 if (!VarXTy || !VarYTy)
7109 if (
const auto *NamespaceX = dyn_cast<NamespaceDecl>(
X)) {
7110 const auto *NamespaceY = cast<NamespaceDecl>(Y);
7111 return NamespaceX->isInline() == NamespaceY->isInline();
7116 if (
const auto *TemplateX = dyn_cast<TemplateDecl>(
X)) {
7117 const auto *TemplateY = cast<TemplateDecl>(Y);
7120 if (
const auto *ConceptX = dyn_cast<ConceptDecl>(
X)) {
7121 const auto *ConceptY = cast<ConceptDecl>(Y);
7123 ConceptY->getConstraintExpr()))
7128 TemplateY->getTemplatedDecl()) &&
7130 TemplateY->getTemplateParameters());
7134 if (
const auto *FDX = dyn_cast<FieldDecl>(
X)) {
7135 const auto *FDY = cast<FieldDecl>(Y);
7137 return hasSameType(FDX->getType(), FDY->getType());
7141 if (
const auto *IFDX = dyn_cast<IndirectFieldDecl>(
X)) {
7142 const auto *IFDY = cast<IndirectFieldDecl>(Y);
7143 return IFDX->getAnonField()->getCanonicalDecl() ==
7144 IFDY->getAnonField()->getCanonicalDecl();
7148 if (isa<EnumConstantDecl>(
X))
7153 if (
const auto *USX = dyn_cast<UsingShadowDecl>(
X)) {
7154 const auto *USY = cast<UsingShadowDecl>(Y);
7160 if (
const auto *UX = dyn_cast<UsingDecl>(
X)) {
7161 const auto *UY = cast<UsingDecl>(Y);
7163 UX->hasTypename() == UY->hasTypename() &&
7164 UX->isAccessDeclaration() == UY->isAccessDeclaration();
7166 if (
const auto *UX = dyn_cast<UnresolvedUsingValueDecl>(
X)) {
7167 const auto *UY = cast<UnresolvedUsingValueDecl>(Y);
7169 UX->isAccessDeclaration() == UY->isAccessDeclaration();
7171 if (
const auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(
X)) {
7174 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
7179 if (
const auto *UX = dyn_cast<UsingPackDecl>(
X)) {
7181 UX->getInstantiatedFromUsingDecl(),
7182 cast<UsingPackDecl>(Y)->getInstantiatedFromUsingDecl());
7186 if (
const auto *NAX = dyn_cast<NamespaceAliasDecl>(
X)) {
7187 const auto *NAY = cast<NamespaceAliasDecl>(Y);
7188 return NAX->getNamespace()->Equals(NAY->getNamespace());
7235 bool AnyNonCanonArgs =
false;
7238 if (!AnyNonCanonArgs)
7246 llvm_unreachable(
"Unhandled template argument kind");
7289 DNT->getIdentifier());
7303 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
7308 if (!
T.hasLocalQualifiers()) {
7310 if (
const auto *AT = dyn_cast<ArrayType>(
T))
7315 if (!isa<ArrayType>(
T.getCanonicalType()))
7330 const auto *ATy = dyn_cast<ArrayType>(split.
Ty);
7331 if (!ATy || qs.
empty())
7338 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
7341 CAT->getSizeModifier(),
7342 CAT->getIndexTypeCVRQualifiers()));
7343 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
7345 IAT->getSizeModifier(),
7346 IAT->getIndexTypeCVRQualifiers()));
7348 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
7349 return cast<ArrayType>(
7351 DSAT->getSizeExpr(),
7352 DSAT->getSizeModifier(),
7353 DSAT->getIndexTypeCVRQualifiers(),
7354 DSAT->getBracketsRange()));
7356 const auto *VAT = cast<VariableArrayType>(ATy);
7359 VAT->getSizeModifier(),
7360 VAT->getIndexTypeCVRQualifiers(),
7361 VAT->getBracketsRange()));
7375 return T.getUnqualifiedType();
7388 return T.getUnqualifiedType();
7403 assert(PrettyArrayType &&
"Not an array type!");
7440 uint64_t ElementCount = 1;
7443 CA = dyn_cast_or_null<ConstantArrayType>(
7446 return ElementCount;
7454 uint64_t ElementCount = 1;
7458 AILE = dyn_cast<ArrayInitLoopExpr>(AILE->
getSubExpr());
7461 return ElementCount;
7471 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
7473 case BuiltinType::Half:
return HalfRank;
7474 case BuiltinType::Float:
return FloatRank;
7507unsigned ASTContext::getIntegerRank(
const Type *
T)
const {
7512 if (
const auto *EIT = dyn_cast<BitIntType>(
T))
7513 return 0 + (EIT->getNumBits() << 3);
7515 switch (cast<BuiltinType>(
T)->getKind()) {
7516 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
7517 case BuiltinType::Bool:
7519 case BuiltinType::Char_S:
7520 case BuiltinType::Char_U:
7521 case BuiltinType::SChar:
7522 case BuiltinType::UChar:
7524 case BuiltinType::Short:
7525 case BuiltinType::UShort:
7527 case BuiltinType::Int:
7528 case BuiltinType::UInt:
7530 case BuiltinType::Long:
7531 case BuiltinType::ULong:
7533 case BuiltinType::LongLong:
7534 case BuiltinType::ULongLong:
7536 case BuiltinType::Int128:
7537 case BuiltinType::UInt128:
7542 case BuiltinType::Char8:
7544 case BuiltinType::Char16:
7545 return getIntegerRank(
7547 case BuiltinType::Char32:
7548 return getIntegerRank(
7550 case BuiltinType::WChar_S:
7551 case BuiltinType::WChar_U:
7552 return getIntegerRank(
7582 uint64_t BitWidth = Field->getBitWidthValue(*
this);
7605 if (
QualType QT = Field->getType(); QT->isBitIntType())
7608 if (BitWidth < IntSize)
7611 if (BitWidth == IntSize)
7626 assert(!Promotable.
isNull());
7629 return ET->getDecl()->getPromotionType();
7638 if (BT->getKind() == BuiltinType::WChar_S ||
7639 BT->getKind() == BuiltinType::WChar_U ||
7640 BT->getKind() == BuiltinType::Char8 ||
7641 BT->getKind() == BuiltinType::Char16 ||
7642 BT->getKind() == BuiltinType::Char32) {
7643 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
7647 for (
const auto &PT : PromoteTypes) {
7649 if (FromSize < ToSize ||
7650 (FromSize == ToSize && FromIsSigned == PT->isSignedIntegerType()))
7653 llvm_unreachable(
"char type should fit into long long");
7660 uint64_t PromotableSize =
getIntWidth(Promotable);
7669 while (!
T.isNull()) {
7671 return T.getObjCLifetime();
7701 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
7703 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
7706 if (LHSC == RHSC)
return 0;
7711 unsigned LHSRank = getIntegerRank(LHSC);
7712 unsigned RHSRank = getIntegerRank(RHSC);
7714 if (LHSUnsigned == RHSUnsigned) {
7715 if (LHSRank == RHSRank)
return 0;
7716 return LHSRank > RHSRank ? 1 : -1;
7722 if (LHSRank >= RHSRank)
7732 if (RHSRank >= LHSRank)
7742 if (CFConstantStringTypeDecl)
7743 return CFConstantStringTypeDecl;
7745 assert(!CFConstantStringTagDecl &&
7746 "tag and typedef should be initialized together");
7786 if (
static_cast<unsigned>(CFRuntime) <
7789 Fields[Count++] = {
IntTy,
"flags" };
7791 Fields[Count++] = {
LongTy,
"length" };
7795 Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc" };
7799 Fields[Count++] = {
IntTy,
"_ptr" };
7805 for (
unsigned i = 0; i < Count; ++i) {
7809 Fields[i].Type,
nullptr,
7812 CFConstantStringTagDecl->
addDecl(Field);
7819 CFConstantStringTypeDecl =
7822 return CFConstantStringTypeDecl;
7826 if (!CFConstantStringTagDecl)
7828 return CFConstantStringTagDecl;
7837 if (ObjCSuperType.
isNull()) {
7842 return ObjCSuperType;
7847 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
7854 if (BlockDescriptorType)
7867 static const char *
const FieldNames[] = {
7872 for (
size_t i = 0; i < 2; ++i) {
7875 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
7883 BlockDescriptorType = RD;
7889 if (BlockDescriptorExtendedType)
7904 static const char *
const FieldNames[] = {
7911 for (
size_t i = 0; i < 4; ++i) {
7914 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
7923 BlockDescriptorExtendedType = RD;
7928 const auto *BT = dyn_cast<BuiltinType>(
T);
7931 if (isa<PipeType>(
T))
7937 switch (BT->getKind()) {
7938#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7939 case BuiltinType::Id: \
7941#include "clang/Basic/OpenCLImageTypes.def"
7943 case BuiltinType::OCLClkEvent:
7946 case BuiltinType::OCLEvent:
7949 case BuiltinType::OCLQueue:
7952 case BuiltinType::OCLReserveID:
7955 case BuiltinType::OCLSampler:
7974 if (!copyExpr && record->hasTrivialDestructor())
return false;
8002 llvm_unreachable(
"impossible");
8004 llvm_unreachable(
"fell out of lifetime switch!");
8012 bool &HasByrefExtendedLayout)
const {
8017 HasByrefExtendedLayout =
false;
8019 HasByrefExtendedLayout =
true;
8033 assert(
Target &&
"Expected target to be initialized");
8034 const llvm::Triple &
T =
Target->getTriple();
8036 if (
T.isOSWindows() &&
T.isArch64Bit())
8042 assert(
Target &&
"Expected target to be initialized");
8043 const llvm::Triple &
T =
Target->getTriple();
8045 if (
T.isOSWindows() &&
T.isArch64Bit())
8051 if (!ObjCInstanceTypeDecl)
8052 ObjCInstanceTypeDecl =
8054 return ObjCInstanceTypeDecl;
8060 if (
const auto *TT = dyn_cast<TypedefType>(
T))
8062 return II->isStr(
"BOOL");
8070 if (!
type->isIncompleteArrayType() &&
type->isIncompleteType())
8079 else if (
type->isArrayType())
8098 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
8105 !
D->isInlineSpecified() && (
D->isConstexpr() ||
First->isConstexpr()))
8136 for (
auto *PI :
Decl->parameters()) {
8141 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
8150 ParmOffset = PtrSize;
8151 for (
auto *PVDecl :
Decl->parameters()) {
8152 QualType PType = PVDecl->getOriginalType();
8153 if (
const auto *AT =
8157 if (!isa<ConstantArrayType>(AT))
8158 PType = PVDecl->getType();
8160 PType = PVDecl->getType();
8180 for (
auto *PI :
Decl->parameters()) {
8187 "getObjCEncodingForFunctionDecl - Incomplete param type");
8194 for (
auto *PVDecl :
Decl->parameters()) {
8195 QualType PType = PVDecl->getOriginalType();
8196 if (
const auto *AT =
8200 if (!isa<ConstantArrayType>(AT))
8201 PType = PVDecl->getType();
8203 PType = PVDecl->getType();
8217 bool Extended)
const {
8221 ObjCEncOptions Options = ObjCEncOptions()
8222 .setExpandPointedToStructures()
8223 .setExpandStructures()
8224 .setIsOutermostType();
8226 Options.setEncodeBlockParameters().setEncodeClassNames();
8227 getObjCEncodingForTypeImpl(
T, S, Options,
nullptr);
8233 bool Extended)
const {
8238 Decl->getReturnType(), S, Extended);
8247 E =
Decl->sel_param_end(); PI !=
E; ++PI) {
8254 "getObjCEncodingForMethodDecl - Incomplete param type");
8262 ParmOffset = 2 * PtrSize;
8264 E =
Decl->sel_param_end(); PI !=
E; ++PI) {
8267 if (
const auto *AT =
8271 if (!isa<ConstantArrayType>(AT))
8276 PType, S, Extended);
8287 const Decl *Container)
const {
8290 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
8291 for (
auto *PID : CID->property_impls())
8292 if (PID->getPropertyDecl() == PD)
8295 const auto *OID = cast<ObjCImplementationDecl>(Container);
8296 for (
auto *PID : OID->property_impls())
8297 if (PID->getPropertyDecl() == PD)
8331 const Decl *Container)
const {
8333 bool Dynamic =
false;
8341 SynthesizePID = PropertyImpDecl;
8345 std::string S =
"T";
8390 if (SynthesizePID) {
8407 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
8410 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
8423 getObjCEncodingForTypeImpl(
T, S,
8425 .setExpandPointedToStructures()
8426 .setExpandStructures()
8427 .setIsOutermostType(),
8428 Field, NotEncodedT);
8432 std::string& S)
const {
8436 getObjCEncodingForTypeImpl(
T, S,
8438 .setExpandPointedToStructures()
8439 .setExpandStructures()
8440 .setIsOutermostType()
8441 .setEncodingProperty(),
8449 case BuiltinType::Void:
return 'v';
8450 case BuiltinType::Bool:
return 'B';
8451 case BuiltinType::Char8:
8452 case BuiltinType::Char_U:
8453 case BuiltinType::UChar:
return 'C';
8454 case BuiltinType::Char16:
8455 case BuiltinType::UShort:
return 'S';
8456 case BuiltinType::Char32:
8457 case BuiltinType::UInt:
return 'I';
8458 case BuiltinType::ULong:
8459 return C->getTargetInfo().getLongWidth() == 32 ?
'L' :
'Q';
8460 case BuiltinType::UInt128:
return 'T';
8461 case BuiltinType::ULongLong:
return 'Q';
8462 case BuiltinType::Char_S:
8463 case BuiltinType::SChar:
return 'c';
8464 case BuiltinType::Short:
return 's';
8465 case BuiltinType::WChar_S:
8466 case BuiltinType::WChar_U:
8467 case BuiltinType::Int:
return 'i';
8468 case BuiltinType::Long:
8469 return C->getTargetInfo().getLongWidth() == 32 ?
'l' :
'q';
8470 case BuiltinType::LongLong:
return 'q';
8471 case BuiltinType::Int128:
return 't';
8472 case BuiltinType::Float:
return 'f';
8473 case BuiltinType::Double:
return 'd';
8474 case BuiltinType::LongDouble:
return 'D';
8475 case BuiltinType::NullPtr:
return '*';
8477 case BuiltinType::BFloat16:
8478 case BuiltinType::Float16:
8479 case BuiltinType::Float128:
8480 case BuiltinType::Ibm128:
8481 case BuiltinType::Half:
8482 case BuiltinType::ShortAccum:
8483 case BuiltinType::Accum:
8484 case BuiltinType::LongAccum:
8485 case BuiltinType::UShortAccum:
8486 case BuiltinType::UAccum:
8487 case BuiltinType::ULongAccum:
8488 case BuiltinType::ShortFract:
8489 case BuiltinType::Fract:
8490 case BuiltinType::LongFract:
8491 case BuiltinType::UShortFract:
8492 case BuiltinType::UFract:
8493 case BuiltinType::ULongFract:
8494 case BuiltinType::SatShortAccum:
8495 case BuiltinType::SatAccum:
8496 case BuiltinType::SatLongAccum:
8497 case BuiltinType::SatUShortAccum:
8498 case BuiltinType::SatUAccum:
8499 case BuiltinType::SatULongAccum:
8500 case BuiltinType::SatShortFract:
8501 case BuiltinType::SatFract:
8502 case BuiltinType::SatLongFract:
8503 case BuiltinType::SatUShortFract:
8504 case BuiltinType::SatUFract:
8505 case BuiltinType::SatULongFract:
8509#define SVE_TYPE(Name, Id, SingletonId) \
8510 case BuiltinType::Id:
8511#include "clang/Basic/AArch64SVEACLETypes.def"
8512#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8513#include "clang/Basic/RISCVVTypes.def"
8514#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8515#include "clang/Basic/WebAssemblyReferenceTypes.def"
8516#define AMDGPU_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8517#include "clang/Basic/AMDGPUTypes.def"
8521 "cannot yet @encode type %0");
8526 case BuiltinType::ObjCId:
8527 case BuiltinType::ObjCClass:
8528 case BuiltinType::ObjCSel:
8529 llvm_unreachable(
"@encoding ObjC primitive type");
8532#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8533 case BuiltinType::Id:
8534#include "clang/Basic/OpenCLImageTypes.def"
8535#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8536 case BuiltinType::Id:
8537#include "clang/Basic/OpenCLExtensionTypes.def"
8538 case BuiltinType::OCLEvent:
8539 case BuiltinType::OCLClkEvent:
8540 case BuiltinType::OCLQueue:
8541 case BuiltinType::OCLReserveID:
8542 case BuiltinType::OCLSampler:
8543 case BuiltinType::Dependent:
8544#define PPC_VECTOR_TYPE(Name, Id, Size) \
8545 case BuiltinType::Id:
8546#include "clang/Basic/PPCTypes.def"
8547#define BUILTIN_TYPE(KIND, ID)
8548#define PLACEHOLDER_TYPE(KIND, ID) \
8549 case BuiltinType::KIND:
8550#include "clang/AST/BuiltinTypes.def"
8551 llvm_unreachable(
"invalid builtin type for @encode");
8553 llvm_unreachable(
"invalid BuiltinType::Kind value");
8560 if (!
Enum->isFixed())
8570 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
8590 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
8599 S += llvm::utostr(Offset);
8614 bool VisitBasesAndFields) {
8619 PT->getPointeeType().getTypePtr(),
false);
8626 if (isa<ClassTemplateSpecializationDecl>(CXXRD))
8629 if (!CXXRD->hasDefinition() || !VisitBasesAndFields)
8632 for (
const auto &B : CXXRD->bases())
8637 for (
auto *FD : CXXRD->fields())
8646void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string &S,
8647 const ObjCEncOptions Options,
8651 switch (CT->getTypeClass()) {
8656 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
8678 case Type::LValueReference:
8679 case Type::RValueReference: {
8681 if (isa<PointerType>(CT)) {
8683 if (PT->isObjCSelType()) {
8692 bool isReadOnly =
false;
8698 if (Options.IsOutermostType() &&
T.isConstQualified()) {
8702 }
else if (Options.IsOutermostType()) {
8705 P = PT->getPointeeType();
8706 if (
P.isConstQualified()) {
8715 if (StringRef(S).ends_with(
"nr"))
8716 S.replace(S.end()-2, S.end(),
"rn");
8728 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
8733 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
8742 RTy, Options.ExpandPointedToStructures()))) {
8751 ObjCEncOptions NewOptions;
8752 if (Options.ExpandPointedToStructures())
8753 NewOptions.setExpandStructures();
8754 getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
8755 nullptr, NotEncodedT);
8759 case Type::ConstantArray:
8760 case Type::IncompleteArray:
8761 case Type::VariableArray: {
8762 const auto *AT = cast<ArrayType>(CT);
8764 if (isa<IncompleteArrayType>(AT) && !Options.IsStructField()) {
8768 getObjCEncodingForTypeImpl(
8769 AT->getElementType(), S,
8770 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
8774 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
8775 S += llvm::utostr(CAT->getZExtSize());
8778 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
8779 "Unknown array type!");
8783 getObjCEncodingForTypeImpl(
8784 AT->getElementType(), S,
8785 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
8792 case Type::FunctionNoProto:
8793 case Type::FunctionProto:
8797 case Type::Record: {
8798 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
8799 S += RDecl->
isUnion() ?
'(' :
'{';
8803 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
8805 llvm::raw_string_ostream OS(S);
8812 if (Options.ExpandStructures()) {
8815 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
8817 for (
const auto *Field : RDecl->
fields()) {
8820 S +=
Field->getNameAsString();
8825 if (
Field->isBitField()) {
8826 getObjCEncodingForTypeImpl(
Field->getType(), S,
8827 ObjCEncOptions().setExpandStructures(),
8832 getObjCEncodingForTypeImpl(
8834 ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
8840 S += RDecl->
isUnion() ?
')' :
'}';
8844 case Type::BlockPointer: {
8847 if (Options.EncodeBlockParameters()) {
8848 const auto *FT = BT->getPointeeType()->castAs<
FunctionType>();
8852 getObjCEncodingForTypeImpl(FT->getReturnType(), S,
8853 Options.forComponentType(), FD, NotEncodedT);
8857 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
8858 for (
const auto &I : FPT->param_types())
8859 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
8867 case Type::ObjCObject: {
8871 S +=
"{objc_object=}";
8875 S +=
"{objc_class=}";
8882 case Type::ObjCInterface: {
8888 if (Options.ExpandStructures()) {
8892 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
8894 if (
Field->isBitField())
8895 getObjCEncodingForTypeImpl(
Field->getType(), S,
8896 ObjCEncOptions().setExpandStructures(),
8899 getObjCEncodingForTypeImpl(
Field->getType(), S,
8900 ObjCEncOptions().setExpandStructures(), FD,
8908 case Type::ObjCObjectPointer: {
8910 if (OPT->isObjCIdType()) {
8915 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
8923 if (OPT->isObjCQualifiedIdType()) {
8924 getObjCEncodingForTypeImpl(
8926 Options.keepingOnly(ObjCEncOptions()
8927 .setExpandPointedToStructures()
8928 .setExpandStructures()),
8930 if (FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
8934 for (
const auto *I : OPT->quals()) {
8936 S += I->getObjCRuntimeNameAsString();
8945 if (OPT->getInterfaceDecl() &&
8946 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
8948 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
8949 for (
const auto *I : OPT->quals()) {
8951 S += I->getObjCRuntimeNameAsString();
8961 case Type::MemberPointer:
8965 case Type::ExtVector:
8971 case Type::ConstantMatrix:
8984 case Type::DeducedTemplateSpecialization:
8987 case Type::ArrayParameter:
8989#define ABSTRACT_TYPE(KIND, BASE)
8990#define TYPE(KIND, BASE)
8991#define DEPENDENT_TYPE(KIND, BASE) \
8993#define NON_CANONICAL_TYPE(KIND, BASE) \
8995#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \
8997#include "clang/AST/TypeNodes.inc"
8998 llvm_unreachable(
"@encode for dependent type!");
9000 llvm_unreachable(
"bad type kind!");
9003void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
9008 assert(RDecl &&
"Expected non-null RecordDecl");
9009 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
9013 const auto *CXXRec = dyn_cast<CXXRecordDecl>(RDecl);
9014 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
9018 for (
const auto &BI : CXXRec->bases()) {
9019 if (!BI.isVirtual()) {
9024 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9025 std::make_pair(offs, base));
9031 if (!
Field->isZeroLengthBitField(*
this) &&
Field->isZeroSize(*
this))
9034 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9035 std::make_pair(offs, Field));
9038 if (CXXRec && includeVBases) {
9039 for (
const auto &BI : CXXRec->vbases()) {
9045 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
9046 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
9047 std::make_pair(offs, base));
9061 std::multimap<uint64_t, NamedDecl *>::iterator
9062 CurLayObj = FieldOrBaseOffsets.begin();
9064 if (CXXRec && CXXRec->isDynamicClass() &&
9065 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
9068 std::string recname = CXXRec->getNameAsString();
9069 if (recname.empty()) recname =
"?";
9082 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9083 std::make_pair(offs,
nullptr));
9086 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
9088 assert(CurOffs <= CurLayObj->first);
9089 if (CurOffs < CurLayObj->first) {
9090 uint64_t padding = CurLayObj->first - CurOffs;
9106 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
9111 getObjCEncodingForStructureImpl(base, S, FD,
false,
9118 const auto *field = cast<FieldDecl>(dcl);
9121 S += field->getNameAsString();
9125 if (field->isBitField()) {
9128 CurOffs += field->getBitWidthValue(*
this);
9133 getObjCEncodingForTypeImpl(
9134 qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
9145 std::string& S)
const {
9178 if (!ObjCClassDecl) {
9183 return ObjCClassDecl;
9187 if (!ObjCProtocolClassDecl) {
9188 ObjCProtocolClassDecl
9197 return ObjCProtocolClassDecl;
9242 const size_t NumFields = 5;
9244 const char *FieldNames[NumFields];
9248 FieldNames[0] =
"__stack";
9252 FieldNames[1] =
"__gr_top";
9256 FieldNames[2] =
"__vr_top";
9259 FieldTypes[3] = Context->
IntTy;
9260 FieldNames[3] =
"__gr_offs";
9263 FieldTypes[4] = Context->
IntTy;
9264 FieldNames[4] =
"__vr_offs";
9267 for (
unsigned i = 0; i < NumFields; ++i) {
9273 FieldTypes[i],
nullptr,
9278 VaListTagDecl->
addDecl(Field);
9295 const size_t NumFields = 5;
9297 const char *FieldNames[NumFields];
9301 FieldNames[0] =
"gpr";
9305 FieldNames[1] =
"fpr";
9309 FieldNames[2] =
"reserved";
9313 FieldNames[3] =
"overflow_arg_area";
9317 FieldNames[4] =
"reg_save_area";
9320 for (
unsigned i = 0; i < NumFields; ++i) {
9325 FieldTypes[i],
nullptr,
9330 VaListTagDecl->
addDecl(Field);
9357 const size_t NumFields = 4;
9359 const char *FieldNames[NumFields];
9363 FieldNames[0] =
"gp_offset";
9367 FieldNames[1] =
"fp_offset";
9371 FieldNames[2] =
"overflow_arg_area";
9375 FieldNames[3] =
"reg_save_area";
9378 for (
unsigned i = 0; i < NumFields; ++i) {
9384 FieldTypes[i],
nullptr,
9389 VaListTagDecl->
addDecl(Field);
9460 const size_t NumFields = 4;
9462 const char *FieldNames[NumFields];
9465 FieldTypes[0] = Context->
LongTy;
9466 FieldNames[0] =
"__gpr";
9469 FieldTypes[1] = Context->
LongTy;
9470 FieldNames[1] =
"__fpr";
9474 FieldNames[2] =
"__overflow_arg_area";
9478 FieldNames[3] =
"__reg_save_area";
9481 for (
unsigned i = 0; i < NumFields; ++i) {
9487 FieldTypes[i],
nullptr,
9492 VaListTagDecl->
addDecl(Field);
9514 const size_t NumFields = 3;
9516 const char *FieldNames[NumFields];
9520 FieldNames[0] =
"__current_saved_reg_area_pointer";
9524 FieldNames[1] =
"__saved_reg_area_end_pointer";
9528 FieldNames[2] =
"__overflow_area_pointer";
9531 for (
unsigned i = 0; i < NumFields; ++i) {
9539 VaListTagDecl->
addDecl(Field);
9582 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
9586 if (!BuiltinVaListDecl) {
9591 return BuiltinVaListDecl;
9604 if (!BuiltinMSVaListDecl)
9607 return BuiltinMSVaListDecl;
9619 assert(ObjCConstantStringType.
isNull() &&
9620 "'NSConstantString' type already set!");
9630 unsigned size = End -
Begin;
9631 assert(size > 1 &&
"set is not overloaded!");
9640 assert(isa<FunctionTemplateDecl>(
D) ||
9641 isa<UnresolvedUsingValueDecl>(
D) ||
9642 (isa<UsingShadowDecl>(
D) &&
9643 isa<FunctionTemplateDecl>(
D->getUnderlyingDecl())));
9660 bool TemplateKeyword,
9666 llvm::FoldingSetNodeID ID;
9669 void *InsertPos =
nullptr;
9671 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9675 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
9687 "Nested name specifier must be dependent");
9689 llvm::FoldingSetNodeID ID;
9692 void *InsertPos =
nullptr;
9694 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9700 if (CanonNNS == NNS) {
9708 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9709 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
9713 DependentTemplateNames.InsertNode(QTN, InsertPos);
9723 "Nested name specifier must be dependent");
9725 llvm::FoldingSetNodeID ID;
9728 void *InsertPos =
nullptr;
9730 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9736 if (CanonNNS == NNS) {
9745 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9746 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
9750 DependentTemplateNames.InsertNode(QTN, InsertPos);
9756 std::optional<unsigned> PackIndex)
const {
9757 llvm::FoldingSetNodeID ID;
9761 void *insertPos =
nullptr;
9763 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
9767 Replacement, AssociatedDecl, Index, PackIndex);
9768 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
9776 Decl *AssociatedDecl,
9777 unsigned Index,
bool Final)
const {
9779 llvm::FoldingSetNodeID ID;
9781 AssociatedDecl, Index, Final);
9783 void *InsertPos =
nullptr;
9785 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
9790 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
9814 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
9844 while (
const auto *AT = dyn_cast<ArrayType>(CT))
9845 CT = AT->getElementType();
9877 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
9878 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
9909 if (Ty->
getKind() == BuiltinType::SveBool ||
9910 Ty->
getKind() == BuiltinType::SveCount)
9923 return BT->getKind() == BuiltinType::SveBool;
9925 return VT->getElementType().getCanonicalType() ==
9936 return IsValidCast(FirstType, SecondType) ||
9937 IsValidCast(SecondType, FirstType);
9955 if (BT->getKind() == BuiltinType::SveBool &&
9976 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
9983 return IsLaxCompatible(FirstType, SecondType) ||
9984 IsLaxCompatible(SecondType, FirstType);
10000 uint64_t MinElts = Info.
EC.getKnownMinValue();
10001 return VScale->first * MinElts * EltSize;
10009 "Expected RVV builtin type and vector type!");
10031 return IsValidCast(FirstType, SecondType) ||
10032 IsValidCast(SecondType, FirstType);
10040 "Expected RVV builtin type and vector type!");
10047 if (!BT->isRVVVLSBuiltinType())
10067 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
10074 return IsLaxCompatible(FirstType, SecondType) ||
10075 IsLaxCompatible(SecondType, FirstType);
10082 if (
Attr->getAttrKind() == attr::ObjCOwnership)
10085 Ty =
Attr->getModifiedType();
10089 Ty =
Paren->getInnerType();
10121 for (
auto *lhsProto : lhs->
quals()) {
10122 bool match =
false;
10123 for (
auto *rhsProto : rhs->
quals()) {
10154 for (
auto *I : lhs->
quals()) {
10158 if (!rhsID->ClassImplementsProtocol(I,
true))
10166 for (
auto *lhsProto : lhs->
quals()) {
10167 bool match =
false;
10172 for (
auto *rhsProto : rhs->
quals()) {
10182 for (
auto *I : lhs->
quals()) {
10186 if (rhsID->ClassImplementsProtocol(I,
true)) {
10203 for (
auto *lhsProto : lhs->
quals()) {
10204 bool match =
false;
10211 for (
auto *rhsProto : rhs->
quals()) {
10230 if (LHSInheritedProtocols.empty() && lhs->
qual_empty())
10232 for (
auto *lhsProto : LHSInheritedProtocols) {
10233 bool match =
false;
10234 for (
auto *rhsProto : rhs->
quals()) {
10264 auto finish = [&](
bool succeeded) ->
bool {
10309 bool BlockReturnType) {
10313 auto finish = [&](
bool succeeded) ->
bool {
10338 if (
getLangOpts().CompatibilityQualifiedIdBlockParamTypeChecking)
10342 (!BlockReturnType &&
10346 (BlockReturnType ? LHSOPT : RHSOPT),
10347 (BlockReturnType ? RHSOPT : LHSOPT),
false));
10355 return finish(BlockReturnType);
10357 return finish(!BlockReturnType);
10369 return (*lhs)->getName().compare((*rhs)->getName());
10386 assert(LHS->
getInterface() &&
"LHS must have an interface base");
10387 assert(RHS->
getInterface() &&
"RHS must have an interface base");
10393 for (
auto *proto : LHS->
quals()) {
10404 for (
auto *proto : RHS->
quals()) {
10412 for (
auto *proto : LHSProtocolSet) {
10413 if (RHSProtocolSet.count(proto))
10414 IntersectionSet.push_back(proto);
10423 if (!ImpliedProtocols.empty()) {
10425 return ImpliedProtocols.contains(proto);
10430 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
10440 if (lhsOPT && rhsOPT)
10446 if (lhsBlock && rhsBlock)
10451 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
10463 bool stripKindOf) {
10464 if (lhsArgs.size() != rhsArgs.size())
10471 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
10477 if (!stripKindOf ||
10478 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
10479 rhsArgs[i].stripObjCKindOfType(ctx))) {
10507 if (!LDecl || !RDecl)
10517 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
10527 bool anyChanges =
false;
10545 if (!Protocols.empty())
10563 if (LHSSuperType.
isNull())
10573 if (KnownLHS != LHSAncestors.end()) {
10574 LHS = KnownLHS->second;
10578 bool anyChanges =
false;
10596 if (!Protocols.empty())
10613 if (RHSSuperType.
isNull())
10624 assert(LHS->
getInterface() &&
"LHS is not an interface type");
10625 assert(RHS->
getInterface() &&
"RHS is not an interface type");
10646 for (
auto *RHSPI : RHS->
quals())
10649 if (SuperClassInheritedProtocols.empty())
10652 for (
const auto *LHSProto : LHS->
quals()) {
10653 bool SuperImplementsProtocol =
false;
10654 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
10655 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
10656 SuperImplementsProtocol =
true;
10659 if (!SuperImplementsProtocol)
10689 if (!LHSOPT || !RHSOPT)
10707 bool CompareUnqualified) {
10726 bool OfBlockPointer,
10730 if (UD->
hasAttr<TransparentUnionAttr>()) {
10731 for (
const auto *I : UD->
fields()) {
10732 QualType ET = I->getType().getUnqualifiedType();
10746 bool OfBlockPointer,
10767 bool IsConditionalOperator) {
10770 const auto *lproto = dyn_cast<FunctionProtoType>(lbase);
10771 const auto *rproto = dyn_cast<FunctionProtoType>(rbase);
10772 bool allLTypes =
true;
10773 bool allRTypes =
true;
10777 if (OfBlockPointer) {
10779 QualType LHS = lbase->getReturnType();
10781 if (!UnqualifiedResult)
10783 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
10848 bool NoReturn = IsConditionalOperator
10858 std::optional<FunctionEffectSet> MergedFX;
10860 if (lproto && rproto) {
10861 assert((AllowCXX ||
10862 (!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec())) &&
10863 "C++ shouldn't be here");
10865 if (lproto->getNumParams() != rproto->getNumParams())
10869 if (lproto->isVariadic() != rproto->isVariadic())
10872 if (lproto->getMethodQuals() != rproto->getMethodQuals())
10878 if (LHSFX != RHSFX) {
10879 if (IsConditionalOperator)
10888 if (*MergedFX != LHSFX)
10890 if (*MergedFX != RHSFX)
10895 bool canUseLeft, canUseRight;
10907 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
10908 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
10909 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
10911 lParamType, rParamType, OfBlockPointer,
Unqualified);
10918 types.push_back(paramType);
10930 if (allLTypes)
return lhs;
10931 if (allRTypes)
return rhs;
10936 newParamInfos.empty() ? nullptr : newParamInfos.data();
10942 if (lproto) allRTypes =
false;
10943 if (rproto) allLTypes =
false;
10947 assert((AllowCXX || !proto->
hasExceptionSpec()) &&
"C++ shouldn't be here");
10955 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
10961 paramTy =
Enum->getDecl()->getIntegerType();
10971 if (allLTypes)
return lhs;
10972 if (allRTypes)
return rhs;
10981 if (allLTypes)
return lhs;
10982 if (allRTypes)
return rhs;
10988 QualType other,
bool isBlockReturnType) {
10994 if (underlyingType.
isNull())
11010 bool IsConditionalOperator) {
11021 if (LangOpts.OpenMP && LHSRefTy && RHSRefTy &&
11025 if (LHSRefTy || RHSRefTy)
11037 if (LHSCan == RHSCan)
11042 Qualifiers RQuals = RHSCan.getLocalQualifiers();
11043 if (LQuals != RQuals) {
11059 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11080 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
11081 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
11084 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
11085 LHSClass = Type::ConstantArray;
11086 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
11087 RHSClass = Type::ConstantArray;
11090 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
11091 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
11094 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
11095 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
11098 if (LHSClass != RHSClass) {
11108 if (OfBlockPointer && !BlockReturnType) {
11117 if (!AT->isDeduced() && AT->isGNUAutoType())
11121 if (!AT->isDeduced() && AT->isGNUAutoType())
11128 switch (LHSClass) {
11129#define TYPE(Class, Base)
11130#define ABSTRACT_TYPE(Class, Base)
11131#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
11132#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
11133#define DEPENDENT_TYPE(Class, Base) case Type::Class:
11134#include "clang/AST/TypeNodes.inc"
11135 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
11138 case Type::DeducedTemplateSpecialization:
11139 case Type::LValueReference:
11140 case Type::RValueReference:
11141 case Type::MemberPointer:
11142 llvm_unreachable(
"C++ should never be in mergeTypes");
11144 case Type::ObjCInterface:
11145 case Type::IncompleteArray:
11146 case Type::VariableArray:
11147 case Type::FunctionProto:
11148 case Type::ExtVector:
11149 llvm_unreachable(
"Types are eliminated above");
11151 case Type::Pointer:
11162 if (ResultType.
isNull())
11170 case Type::BlockPointer:
11195 if (ResultType.
isNull())
11214 if (ResultType.
isNull())
11222 case Type::ConstantArray:
11237 if (ResultType.
isNull())
11245 if (LVAT || RVAT) {
11248 -> std::pair<bool,llvm::APInt> {
11250 std::optional<llvm::APSInt> TheInt;
11253 return std::make_pair(
true, *TheInt);
11254 return std::make_pair(
false, llvm::APSInt());
11257 return std::make_pair(
true, CAT->getSize());
11258 return std::make_pair(
false, llvm::APInt());
11261 bool HaveLSize, HaveRSize;
11262 llvm::APInt LSize, RSize;
11263 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
11264 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
11265 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
11299 case Type::FunctionNoProto:
11301 false, IsConditionalOperator);
11305 case Type::Builtin:
11308 case Type::Complex:
11317 case Type::ConstantMatrix:
11322 case Type::ObjCObject: {
11331 case Type::ObjCObjectPointer:
11332 if (OfBlockPointer) {
11344 assert(LHS != RHS &&
11345 "Equivalent pipe types should have already been handled!");
11347 case Type::ArrayParameter:
11348 assert(LHS != RHS &&
11349 "Equivalent ArrayParameter types should have already been handled!");
11351 case Type::BitInt: {
11359 if (LHSUnsigned != RHSUnsigned)
11362 if (LHSBits != RHSBits)
11368 llvm_unreachable(
"Invalid Type::Class!");
11373 bool &CanUseFirst,
bool &CanUseSecond,
11375 assert(NewParamInfos.empty() &&
"param info list not empty");
11376 CanUseFirst = CanUseSecond =
true;
11382 if (!FirstHasInfo && !SecondHasInfo)
11385 bool NeedParamInfo =
false;
11389 for (
size_t I = 0; I <
E; ++I) {
11400 bool FirstNoEscape = FirstParam.
isNoEscape();
11401 bool SecondNoEscape = SecondParam.
isNoEscape();
11402 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
11404 if (NewParamInfos.back().getOpaqueValue())
11405 NeedParamInfo =
true;
11406 if (FirstNoEscape != IsNoEscape)
11407 CanUseFirst =
false;
11408 if (SecondNoEscape != IsNoEscape)
11409 CanUseSecond =
false;
11412 if (!NeedParamInfo)
11413 NewParamInfos.clear();
11419 ObjCLayouts[CD] =
nullptr;
11429 if (LHSCan == RHSCan)
11431 if (RHSCan->isFunctionType()) {
11435 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
11437 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
11440 if (ResReturnType.
isNull())
11442 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
11446 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
11459 Qualifiers RQuals = RHSCan.getLocalQualifiers();
11460 if (LQuals != RQuals) {
11473 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11489 if (ResQT == LHSBaseQT)
11491 if (ResQT == RHSBaseQT)
11503 T = ET->getDecl()->getIntegerType();
11507 return EIT->getNumBits();
11515 "Unexpected type");
11520 VTy->getNumElements(), VTy->getVectorKind());
11529 T = ETy->getDecl()->getIntegerType();
11532 case BuiltinType::Char_U:
11534 case BuiltinType::Char_S:
11535 case BuiltinType::SChar:
11536 case BuiltinType::Char8:
11538 case BuiltinType::Short:
11540 case BuiltinType::Int:
11542 case BuiltinType::Long:
11544 case BuiltinType::LongLong:
11546 case BuiltinType::Int128:
11551 case BuiltinType::WChar_S:
11554 case BuiltinType::ShortAccum:
11556 case BuiltinType::Accum:
11558 case BuiltinType::LongAccum:
11560 case BuiltinType::SatShortAccum:
11562 case BuiltinType::SatAccum:
11564 case BuiltinType::SatLongAccum:
11566 case BuiltinType::ShortFract:
11568 case BuiltinType::Fract:
11570 case BuiltinType::LongFract:
11572 case BuiltinType::SatShortFract:
11574 case BuiltinType::SatFract:
11576 case BuiltinType::SatLongFract:
11581 "Unexpected signed integer or fixed point type");
11589 "Unexpected type");
11594 VTy->getNumElements(), VTy->getVectorKind());
11603 T = ETy->getDecl()->getIntegerType();
11606 case BuiltinType::Char_S:
11608 case BuiltinType::Char_U:
11609 case BuiltinType::UChar:
11610 case BuiltinType::Char8:
11612 case BuiltinType::UShort:
11614 case BuiltinType::UInt:
11616 case BuiltinType::ULong:
11618 case BuiltinType::ULongLong:
11620 case BuiltinType::UInt128:
11625 case BuiltinType::WChar_U:
11628 case BuiltinType::UShortAccum:
11630 case BuiltinType::UAccum:
11632 case BuiltinType::ULongAccum:
11634 case BuiltinType::SatUShortAccum:
11636 case BuiltinType::SatUAccum:
11638 case BuiltinType::SatULongAccum:
11640 case BuiltinType::UShortFract:
11642 case BuiltinType::UFract:
11644 case BuiltinType::ULongFract:
11646 case BuiltinType::SatUShortFract:
11648 case BuiltinType::SatUFract:
11650 case BuiltinType::SatULongFract:
11655 "Unexpected signed integer or fixed point type");
11680 bool AllowTypeModifiers) {
11684 RequiresICE =
false;
11689 bool IsSpecial =
false;
11693 default: Done =
true; --Str;
break;
11695 RequiresICE =
true;
11698 assert(!
Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
11699 assert(!
Signed &&
"Can't use 'S' modifier multiple times!");
11703 assert(!
Signed &&
"Can't use both 'S' and 'U' modifiers!");
11704 assert(!
Unsigned &&
"Can't use 'U' modifier multiple times!");
11708 assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
11709 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
11714 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11715 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
11724 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11725 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
11731 llvm_unreachable(
"Unexpected integer type");
11742 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11743 assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
11749 llvm_unreachable(
"Unexpected integer type");
11762 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11763 assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
11779 default: llvm_unreachable(
"Unknown builtin type letter!");
11782 "Bad modifiers used with 'x'!");
11787 "Bad modifiers used with 'y'!");
11792 "Bad modifiers used with 'v'!");
11797 "Bad modifiers used with 'h'!");
11802 "Bad modifiers used with 'f'!");
11807 "Bad modifiers used with 'd'!");
11810 else if (HowLong == 2)
11816 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
11825 else if (HowLong == 2)
11827 else if (HowLong == 1)
11833 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
11842 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'b'!");
11846 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'z'!");
11850 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'w'!");
11867 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
11879 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
11887 unsigned NumElements = strtoul(Str, &End, 10);
11888 assert(End != Str &&
"Missing vector size");
11892 RequiresICE,
false);
11893 assert(!RequiresICE &&
"Can't require vector ICE");
11901 Type = Context.SveCountTy;
11905 Type = Context.AMDGPUBufferRsrcTy;
11909 llvm_unreachable(
"Unexpected target builtin type");
11915 unsigned NumElements = strtoul(Str, &End, 10);
11916 assert(End != Str &&
"Missing vector size");
11920 RequiresICE,
false);
11921 assert(!RequiresICE &&
"Can't require vector ICE");
11930 unsigned NumElements = strtoul(Str, &End, 10);
11931 assert(End != Str &&
"Missing vector size");
11943 assert(!RequiresICE &&
"Can't require complex ICE");
11952 if (
Type.isNull()) {
11963 if (
Type.isNull()) {
11969 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'K'!");
11972 if (
Type.isNull()) {
11983 Done = !AllowTypeModifiers;
11985 switch (
char c = *Str++) {
11986 default: Done =
true; --Str;
break;
11992 unsigned AddrSpace = strtoul(Str, &End, 10);
12020 "Integer constant 'I' type must be an integer");
12033 bool AllowTypeModifiers)
const {
12040 unsigned *IntegerConstantArgs)
const {
12042 if (TypeStr[0] ==
'\0') {
12049 bool RequiresICE =
false;
12052 RequiresICE,
true);
12056 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
12058 while (TypeStr[0] && TypeStr[0] !=
'.') {
12065 if (RequiresICE && IntegerConstantArgs)
12066 *IntegerConstantArgs |= 1 << ArgTypes.size();
12072 ArgTypes.push_back(Ty);
12075 if (
Id == Builtin::BI__GetExceptionInfo)
12078 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
12079 "'.' should only occur at end of builtin type list!");
12081 bool Variadic = (TypeStr[0] ==
'.');
12084 Variadic,
false,
true));
12089 if (ArgTypes.empty() && Variadic && !
getLangOpts().requiresStrictPrototypes())
12141 !FD->
hasAttr<DLLExportAttr>()) ||
12142 FD->
hasAttr<GNUInlineAttr>()) {
12161 isa<CXXConstructorDecl>(FD) &&
12162 cast<CXXConstructorDecl>(FD)->isInheritingConstructor())
12175 if (
D->
hasAttr<DLLImportAttr>()) {
12178 }
else if (
D->
hasAttr<DLLExportAttr>()) {
12184 if (
D->
hasAttr<CUDAGlobalAttr>() &&
12247 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
12252 if (!LexicalContext)
12257 auto StaticLocalLinkage =
12269 return StaticLocalLinkage;
12296 return StrongLinkage;
12314 llvm_unreachable(
"Invalid Linkage!");
12324 if (
const auto *VD = dyn_cast<VarDecl>(
D)) {
12325 if (!VD->isFileVarDecl())
12330 if (VD->getDescribedVarTemplate() ||
12331 isa<VarTemplatePartialSpecializationDecl>(VD))
12333 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
12337 }
else if (isa<PragmaCommentDecl>(
D))
12339 else if (isa<PragmaDetectMismatchDecl>(
D))
12341 else if (isa<OMPRequiresDecl>(
D))
12343 else if (isa<OMPThreadPrivateDecl>(
D))
12345 else if (isa<OMPAllocateDecl>(
D))
12347 else if (isa<OMPDeclareReductionDecl>(
D) || isa<OMPDeclareMapperDecl>(
D))
12349 else if (isa<ImportDecl>(
D))
12366 if (
const auto *FD = dyn_cast<FunctionDecl>(
D)) {
12368 if (!FD->doesThisDeclarationHaveABody())
12369 return FD->doesDeclarationForceExternallyVisibleDefinition();
12372 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
12377 if (
getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {
12378 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
12396 const auto *VD = cast<VarDecl>(
D);
12397 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
12401 if (LangOpts.OpenMP &&
12402 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
12410 if (VD->isInAnotherModuleUnit())
12423 if (VD->needsDestruction(*
this))
12427 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
12429 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
12434 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
12435 for (
const auto *BD : DD->bindings())
12436 if (
const auto *BindingVD = BD->getHoldingVar())
12445 llvm::function_ref<
void(
FunctionDecl *)> Pred)
const {
12446 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
12447 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
12452 for (
auto *CurDecl :
12456 !SeenDecls.contains(CurFD)) {
12457 SeenDecls.insert(CurFD);
12465 bool IsBuiltin)
const {
12468 return ABI->getDefaultMethodCallConv(IsVariadic);
12473 switch (LangOpts.getDefaultCallingConv()) {
12502 return Target->getDefaultCallingConv();
12507 return ABI->isNearlyEmpty(RD);
12511 if (!VTContext.get()) {
12512 auto ABI =
Target->getCXXABI();
12513 if (ABI.isMicrosoft())
12516 auto ComponentLayout =
getLangOpts().RelativeCXXABIVTables
12522 return VTContext.get();
12528 switch (
T->getCXXABI().getKind()) {
12529 case TargetCXXABI::AppleARM64:
12530 case TargetCXXABI::Fuchsia:
12531 case TargetCXXABI::GenericAArch64:
12532 case TargetCXXABI::GenericItanium:
12533 case TargetCXXABI::GenericARM:
12534 case TargetCXXABI::GenericMIPS:
12535 case TargetCXXABI::iOS:
12536 case TargetCXXABI::WebAssembly:
12537 case TargetCXXABI::WatchOS:
12538 case TargetCXXABI::XL:
12540 case TargetCXXABI::Microsoft:
12543 llvm_unreachable(
"Unsupported ABI");
12547 assert(
T.getCXXABI().getKind() != TargetCXXABI::Microsoft &&
12548 "Device mangle context does not support Microsoft mangling.");
12549 switch (
T.getCXXABI().getKind()) {
12550 case TargetCXXABI::AppleARM64:
12551 case TargetCXXABI::Fuchsia:
12552 case TargetCXXABI::GenericAArch64:
12553 case TargetCXXABI::GenericItanium:
12554 case TargetCXXABI::GenericARM:
12555 case TargetCXXABI::GenericMIPS:
12556 case TargetCXXABI::iOS:
12557 case TargetCXXABI::WebAssembly:
12558 case TargetCXXABI::WatchOS:
12559 case TargetCXXABI::XL:
12563 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND))
12564 return RD->getDeviceLambdaManglingNumber();
12565 return std::nullopt;
12568 case TargetCXXABI::Microsoft:
12572 llvm_unreachable(
"Unsupported ABI");
12578 return ASTRecordLayouts.getMemorySize() +
12579 llvm::capacity_in_bytes(ObjCLayouts) +
12580 llvm::capacity_in_bytes(KeyFunctions) +
12581 llvm::capacity_in_bytes(ObjCImpls) +
12582 llvm::capacity_in_bytes(BlockVarCopyInits) +
12583 llvm::capacity_in_bytes(DeclAttrs) +
12584 llvm::capacity_in_bytes(TemplateOrInstantiation) +
12585 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
12586 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
12587 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
12588 llvm::capacity_in_bytes(OverriddenMethods) +
12589 llvm::capacity_in_bytes(Types) +
12590 llvm::capacity_in_bytes(VariableArrayTypes);
12598 unsigned Signed)
const {
12601 if (!QualTy && DestWidth == 128)
12630 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
12637 MangleNumbers[ND] = Number;
12644 bool ForAuxTarget)
const {
12645 auto I = MangleNumbers.find(ND);
12646 unsigned Res = I != MangleNumbers.end() ? I->second : 1;
12649 if (LangOpts.CUDA && !LangOpts.CUDAIsDevice) {
12650 Res = ForAuxTarget ? Res >> 16 : Res & 0xFFFF;
12652 assert(!ForAuxTarget &&
"Only CUDA/HIP host compilation supports mangling "
12653 "number for aux target");
12655 return Res > 1 ? Res : 1;
12662 StaticLocalNumbers[VD] = Number;
12669 auto I = StaticLocalNumbers.find(VD);
12670 return I != StaticLocalNumbers.end() ? I->second : 1;
12675 assert(LangOpts.CPlusPlus);
12676 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
12684 assert(LangOpts.CPlusPlus);
12685 std::unique_ptr<MangleNumberingContext> &MCtx =
12686 ExtraMangleNumberingContexts[
D];
12692std::unique_ptr<MangleNumberingContext>
12694 return ABI->createMangleNumberingContext();
12699 return ABI->getCopyConstructorForExceptionObject(
12705 return ABI->addCopyConstructorForExceptionObject(
12712 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
12717 return ABI->getTypedefNameForUnnamedTagDecl(TD);
12722 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
12726 return ABI->getDeclaratorForUnnamedTagDecl(TD);
12730 ParamIndices[
D] = index;
12734 ParameterIndexTable::const_iterator I = ParamIndices.find(
D);
12735 assert(I != ParamIndices.end() &&
12736 "ParmIndices lacks entry set by ParmVarDecl");
12741 unsigned Length)
const {
12767 assert(
MSGuidTagDecl &&
"building MS GUID without MS extensions?");
12769 llvm::FoldingSetNodeID ID;
12773 if (
MSGuidDecl *Existing = MSGuidDecls.FindNodeOrInsertPos(ID, InsertPos))
12777 MSGuidDecl *New = MSGuidDecl::Create(*
this, GUIDType, Parts);
12778 MSGuidDecls.InsertNode(New, InsertPos);
12784 const APValue &APVal)
const {
12785 llvm::FoldingSetNodeID ID;
12790 UnnamedGlobalConstantDecls.FindNodeOrInsertPos(ID, InsertPos))
12794 UnnamedGlobalConstantDecl::Create(*
this, Ty, APVal);
12795 UnnamedGlobalConstantDecls.InsertNode(New, InsertPos);
12801 assert(
T->
isRecordType() &&
"template param object of unexpected type");
12807 llvm::FoldingSetNodeID ID;
12812 TemplateParamObjectDecls.FindNodeOrInsertPos(ID, InsertPos))
12816 TemplateParamObjectDecls.InsertNode(New, InsertPos);
12822 if (!
T.isOSDarwin())
12825 if (!(
T.isiOS() &&
T.isOSVersionLT(7)) &&
12826 !(
T.isMacOSX() &&
T.isOSVersionLT(10, 9)))
12835 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
12842 if (MethodDecl->
hasAttr<UnavailableAttr>()
12843 || MethodDecl->
hasAttr<DeprecatedAttr>())
12857 IM != EM && IF != EF; ++IM, ++IF) {
12888 llvm::FoldingSetNodeID IDX, IDY;
12889 X->Profile(IDX, *
this,
true);
12890 Y->
Profile(IDY, *
this,
true);
12904 for (
const Decl *DX :
X->redecls()) {
12909 if (DX->isFirstDecl())
12912 llvm_unreachable(
"Corrupt redecls chain");
12915template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
12917 return cast_or_null<T>(
12919 const_cast<Decl *
>(cast_or_null<Decl>(Y))));
12922template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
12925 const_cast<Decl *
>(cast<Decl>(Y))));
12951 assert(Xs.size() == Ys.size());
12953 for (
size_t I = 0; I < Rs.size(); ++I)
12960 return X->getAttributeLoc() == Y->getAttributeLoc() ?
X->getAttributeLoc()
12970 switch (
X.getKind()) {
13000 auto NExpX =
X.getNumTemplateExpansions();
13014 if (Xs.size() != Ys.size())
13016 R.resize(Xs.size());
13017 for (
size_t I = 0; I < R.size(); ++I) {
13030 assert(!Different);
13037 return X->getKeyword() == Y->getKeyword() ?
X->getKeyword()
13045 return X->getQualifier() == Y->getQualifier()
13046 ?
X->getQualifier()
13059 QualType EX =
X->getElementType(), EY = Y->getElementType();
13064 QY += EY.getQualifiers() - RQ;
13074 assert(Ctx.
hasSameExpr(
X->getSizeExpr(), Y->getSizeExpr()));
13075 return X->getSizeExpr();
13080 return X->getSizeModifier();
13086 return X->getIndexTypeCVRQualifiers();
13095 llvm::DenseMap<QualType, unsigned>
Found;
13096 for (
auto Ts : {
X, Y}) {
13103 Out.emplace_back(
T);
13113 bool AcceptDependent) {
13139 assert(AcceptDependent &&
13140 "computing composite pointer type of dependent types");
13155 llvm_unreachable(
"These ESTs should be handled above");
13160 assert(EST2 ==
EST_Dynamic &&
"other cases should already be handled");
13164 Result.Exceptions = ExceptionTypeStorage;
13171 llvm_unreachable(
"shouldn't see unresolved exception specifications here");
13174 llvm_unreachable(
"invalid ExceptionSpecificationType");
13183#define UNEXPECTED_TYPE(Class, Kind) \
13184 case Type::Class: \
13185 llvm_unreachable("Unexpected " Kind ": " #Class);
13187#define NON_CANONICAL_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "non-canonical")
13188#define TYPE(Class, Base)
13189#include "clang/AST/TypeNodes.inc"
13191#define SUGAR_FREE_TYPE(Class) UNEXPECTED_TYPE(Class, "sugar-free")
13201#undef SUGAR_FREE_TYPE
13202#define NON_UNIQUE_TYPE(Class) UNEXPECTED_TYPE(Class, "non-unique")
13205#undef NON_UNIQUE_TYPE
13209#undef UNEXPECTED_TYPE
13212 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
13213 assert(AX->getDeducedType().isNull());
13214 assert(AY->getDeducedType().isNull());
13215 assert(AX->getKeyword() == AY->getKeyword());
13216 assert(AX->isInstantiationDependentType() ==
13217 AY->isInstantiationDependentType());
13219 AY->getTypeConstraintArguments());
13222 AX->containsUnexpandedParameterPack(),
13224 AY->getTypeConstraintConcept()),
13227 case Type::IncompleteArray: {
13228 const auto *AX = cast<IncompleteArrayType>(
X),
13229 *AY = cast<IncompleteArrayType>(Y);
13234 case Type::DependentSizedArray: {
13235 const auto *AX = cast<DependentSizedArrayType>(
X),
13236 *AY = cast<DependentSizedArrayType>(Y);
13241 AX->getBracketsRange() == AY->getBracketsRange()
13242 ? AX->getBracketsRange()
13245 case Type::ConstantArray: {
13246 const auto *AX = cast<ConstantArrayType>(
X),
13247 *AY = cast<ConstantArrayType>(Y);
13248 assert(AX->getSize() == AY->getSize());
13249 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
13250 ? AX->getSizeExpr()
13256 case Type::ArrayParameter: {
13257 const auto *AX = cast<ArrayParameterType>(
X),
13258 *AY = cast<ArrayParameterType>(Y);
13259 assert(AX->getSize() == AY->getSize());
13260 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
13261 ? AX->getSizeExpr()
13268 case Type::Atomic: {
13269 const auto *AX = cast<AtomicType>(
X), *AY = cast<AtomicType>(Y);
13273 case Type::Complex: {
13274 const auto *CX = cast<ComplexType>(
X), *CY = cast<ComplexType>(Y);
13277 case Type::Pointer: {
13278 const auto *PX = cast<PointerType>(
X), *PY = cast<PointerType>(Y);
13281 case Type::BlockPointer: {
13282 const auto *PX = cast<BlockPointerType>(
X), *PY = cast<BlockPointerType>(Y);
13285 case Type::ObjCObjectPointer: {
13286 const auto *PX = cast<ObjCObjectPointerType>(
X),
13287 *PY = cast<ObjCObjectPointerType>(Y);
13290 case Type::MemberPointer: {
13291 const auto *PX = cast<MemberPointerType>(
X),
13292 *PY = cast<MemberPointerType>(Y);
13299 case Type::LValueReference: {
13300 const auto *PX = cast<LValueReferenceType>(
X),
13301 *PY = cast<LValueReferenceType>(Y);
13304 PX->isSpelledAsLValue() ||
13305 PY->isSpelledAsLValue());
13307 case Type::RValueReference: {
13308 const auto *PX = cast<RValueReferenceType>(
X),
13309 *PY = cast<RValueReferenceType>(Y);
13313 case Type::DependentAddressSpace: {
13314 const auto *PX = cast<DependentAddressSpaceType>(
X),
13315 *PY = cast<DependentAddressSpaceType>(Y);
13316 assert(Ctx.
hasSameExpr(PX->getAddrSpaceExpr(), PY->getAddrSpaceExpr()));
13318 PX->getAddrSpaceExpr(),
13321 case Type::FunctionNoProto: {
13322 const auto *FX = cast<FunctionNoProtoType>(
X),
13323 *FY = cast<FunctionNoProtoType>(Y);
13324 assert(FX->getExtInfo() == FY->getExtInfo());
13329 case Type::FunctionProto: {
13330 const auto *FX = cast<FunctionProtoType>(
X),
13331 *FY = cast<FunctionProtoType>(Y);
13333 EPIY = FY->getExtProtoInfo();
13334 assert(EPIX.
ExtInfo == EPIY.ExtInfo);
13337 assert(EPIX.
TypeQuals == EPIY.TypeQuals);
13338 assert(EPIX.
Variadic == EPIY.Variadic);
13355 case Type::ObjCObject: {
13356 const auto *OX = cast<ObjCObjectType>(
X), *OY = cast<ObjCObjectType>(Y);
13358 std::equal(OX->getProtocols().begin(), OX->getProtocols().end(),
13359 OY->getProtocols().begin(), OY->getProtocols().end(),
13361 return P0->getCanonicalDecl() == P1->getCanonicalDecl();
13363 "protocol lists must be the same");
13365 OY->getTypeArgsAsWritten());
13368 OX->getProtocols(),
13369 OX->isKindOfTypeAsWritten() && OY->isKindOfTypeAsWritten());
13371 case Type::ConstantMatrix: {
13372 const auto *MX = cast<ConstantMatrixType>(
X),
13373 *MY = cast<ConstantMatrixType>(Y);
13374 assert(MX->getNumRows() == MY->getNumRows());
13375 assert(MX->getNumColumns() == MY->getNumColumns());
13377 MX->getNumRows(), MX->getNumColumns());
13379 case Type::DependentSizedMatrix: {
13380 const auto *MX = cast<DependentSizedMatrixType>(
X),
13381 *MY = cast<DependentSizedMatrixType>(Y);
13382 assert(Ctx.
hasSameExpr(MX->getRowExpr(), MY->getRowExpr()));
13383 assert(Ctx.
hasSameExpr(MX->getColumnExpr(), MY->getColumnExpr()));
13388 case Type::Vector: {
13389 const auto *VX = cast<VectorType>(
X), *VY = cast<VectorType>(Y);
13390 assert(VX->getNumElements() == VY->getNumElements());
13391 assert(VX->getVectorKind() == VY->getVectorKind());
13393 VX->getNumElements(), VX->getVectorKind());
13395 case Type::ExtVector: {
13396 const auto *VX = cast<ExtVectorType>(
X), *VY = cast<ExtVectorType>(Y);
13397 assert(VX->getNumElements() == VY->getNumElements());
13399 VX->getNumElements());
13401 case Type::DependentSizedExtVector: {
13402 const auto *VX = cast<DependentSizedExtVectorType>(
X),
13403 *VY = cast<DependentSizedExtVectorType>(Y);
13408 case Type::DependentVector: {
13409 const auto *VX = cast<DependentVectorType>(
X),
13410 *VY = cast<DependentVectorType>(Y);
13411 assert(VX->getVectorKind() == VY->getVectorKind());
13416 case Type::InjectedClassName: {
13417 const auto *IX = cast<InjectedClassNameType>(
X),
13418 *IY = cast<InjectedClassNameType>(Y);
13422 IY->getInjectedSpecializationType()));
13424 case Type::TemplateSpecialization: {
13425 const auto *TX = cast<TemplateSpecializationType>(
X),
13426 *TY = cast<TemplateSpecializationType>(Y);
13428 TY->template_arguments());
13431 TY->getTemplateName()),
13432 As,
X->getCanonicalTypeInternal());
13434 case Type::Decltype: {
13435 const auto *DX = cast<DecltypeType>(
X);
13436 [[maybe_unused]]
const auto *DY = cast<DecltypeType>(Y);
13437 assert(DX->isDependentType());
13438 assert(DY->isDependentType());
13439 assert(Ctx.
hasSameExpr(DX->getUnderlyingExpr(), DY->getUnderlyingExpr()));
13443 case Type::PackIndexing: {
13444 const auto *DX = cast<PackIndexingType>(
X);
13445 [[maybe_unused]]
const auto *DY = cast<PackIndexingType>(Y);
13446 assert(DX->isDependentType());
13447 assert(DY->isDependentType());
13448 assert(Ctx.
hasSameExpr(DX->getIndexExpr(), DY->getIndexExpr()));
13451 case Type::DependentName: {
13452 const auto *NX = cast<DependentNameType>(
X),
13453 *NY = cast<DependentNameType>(Y);
13454 assert(NX->getIdentifier() == NY->getIdentifier());
13457 NX->getIdentifier(), NX->getCanonicalTypeInternal());
13459 case Type::DependentTemplateSpecialization: {
13460 const auto *TX = cast<DependentTemplateSpecializationType>(
X),
13461 *TY = cast<DependentTemplateSpecializationType>(Y);
13462 assert(TX->getIdentifier() == TY->getIdentifier());
13464 TY->template_arguments());
13467 TX->getIdentifier(), As);
13469 case Type::UnaryTransform: {
13470 const auto *TX = cast<UnaryTransformType>(
X),
13471 *TY = cast<UnaryTransformType>(Y);
13472 assert(TX->getUTTKind() == TY->getUTTKind());
13476 TY->getUnderlyingType()),
13479 case Type::PackExpansion: {
13480 const auto *PX = cast<PackExpansionType>(
X),
13481 *PY = cast<PackExpansionType>(Y);
13482 assert(PX->getNumExpansions() == PY->getNumExpansions());
13485 PX->getNumExpansions(),
false);
13488 const auto *PX = cast<PipeType>(
X), *PY = cast<PipeType>(Y);
13489 assert(PX->isReadOnly() == PY->isReadOnly());
13494 case Type::TemplateTypeParm: {
13495 const auto *TX = cast<TemplateTypeParmType>(
X),
13496 *TY = cast<TemplateTypeParmType>(Y);
13497 assert(TX->getDepth() == TY->getDepth());
13498 assert(TX->getIndex() == TY->getIndex());
13499 assert(TX->isParameterPack() == TY->isParameterPack());
13501 TX->getDepth(), TX->getIndex(), TX->isParameterPack(),
13505 llvm_unreachable(
"Unknown Type Class");
13515#define UNEXPECTED_TYPE(Class, Kind) \
13516 case Type::Class: \
13517 llvm_unreachable("Unexpected " Kind ": " #Class);
13518#define TYPE(Class, Base)
13519#define DEPENDENT_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "dependent")
13520#include "clang/AST/TypeNodes.inc"
13522#define CANONICAL_TYPE(Class) UNEXPECTED_TYPE(Class, "canonical")
13547#undef CANONICAL_TYPE
13549#undef UNEXPECTED_TYPE
13551 case Type::Adjusted: {
13552 const auto *AX = cast<AdjustedType>(
X), *AY = cast<AdjustedType>(Y);
13553 QualType OX = AX->getOriginalType(), OY = AY->getOriginalType();
13560 case Type::Decayed: {
13561 const auto *DX = cast<DecayedType>(
X), *DY = cast<DecayedType>(Y);
13562 QualType OX = DX->getOriginalType(), OY = DY->getOriginalType();
13569 case Type::Attributed: {
13570 const auto *AX = cast<AttributedType>(
X), *AY = cast<AttributedType>(Y);
13572 if (Kind != AY->getAttrKind())
13574 QualType MX = AX->getModifiedType(), MY = AY->getModifiedType();
13581 case Type::BTFTagAttributed: {
13582 const auto *BX = cast<BTFTagAttributedType>(
X);
13583 const BTFTypeTagAttr *AX = BX->getAttr();
13585 if (AX->getBTFTypeTag() !=
13586 cast<BTFTagAttributedType>(Y)->getAttr()->getBTFTypeTag())
13591 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
13594 if (KW != AY->getKeyword())
13598 AY->getTypeConstraintConcept());
13602 AY->getTypeConstraintArguments())) {
13610 false,
false, CD, As);
13612 case Type::PackIndexing:
13613 case Type::Decltype:
13615 case Type::DeducedTemplateSpecialization:
13619 case Type::Elaborated: {
13620 const auto *EX = cast<ElaboratedType>(
X), *EY = cast<ElaboratedType>(Y);
13626 case Type::MacroQualified: {
13627 const auto *MX = cast<MacroQualifiedType>(
X),
13628 *MY = cast<MacroQualifiedType>(Y);
13630 if (IX != MY->getMacroIdentifier())
13634 case Type::SubstTemplateTypeParm: {
13635 const auto *SX = cast<SubstTemplateTypeParmType>(
X),
13636 *SY = cast<SubstTemplateTypeParmType>(Y);
13641 unsigned Index = SX->getIndex();
13642 if (Index != SY->getIndex())
13644 auto PackIndex = SX->getPackIndex();
13645 if (PackIndex != SY->getPackIndex())
13648 CD, Index, PackIndex);
13650 case Type::ObjCTypeParam:
13656 case Type::TemplateSpecialization: {
13657 const auto *TX = cast<TemplateSpecializationType>(
X),
13658 *TY = cast<TemplateSpecializationType>(Y);
13660 TY->getTemplateName());
13665 TY->template_arguments()))
13670 case Type::Typedef: {
13671 const auto *TX = cast<TypedefType>(
X), *TY = cast<TypedefType>(Y);
13677 case Type::TypeOf: {
13683 if (cast<TypeOfType>(
X)->
getKind() == cast<TypeOfType>(Y)->
getKind() &&
13688 case Type::TypeOfExpr:
13691 case Type::UnaryTransform: {
13692 const auto *UX = cast<UnaryTransformType>(
X),
13693 *UY = cast<UnaryTransformType>(Y);
13695 if (KX != UY->getUTTKind())
13697 QualType BX = UX->getBaseType(), BY = UY->getBaseType();
13704 case Type::Using: {
13705 const auto *UX = cast<UsingType>(
X), *UY = cast<UsingType>(Y);
13712 case Type::CountAttributed: {
13713 const auto *DX = cast<CountAttributedType>(
X),
13714 *DY = cast<CountAttributedType>(Y);
13715 if (DX->isCountInBytes() != DY->isCountInBytes())
13717 if (DX->isOrNull() != DY->isOrNull())
13719 Expr *CEX = DX->getCountExpr();
13720 Expr *CEY = DY->getCountExpr();
13724 DX->isCountInBytes(), DX->isOrNull(),
13735 DX->isCountInBytes(), DX->isOrNull(),
13739 llvm_unreachable(
"Unhandled Type Class");
13761 if (
X.isCanonical())
13774 if (SX.
Ty != SY.Ty) {
13782 while (!Xs.empty() && !Ys.empty() && Xs.back().Ty == Ys.back().Ty) {
13785 SX = Xs.pop_back_val();
13786 SY = Ys.pop_back_val();
13796 while (!Xs.empty() && !Ys.empty()) {
13799 SX = Xs.pop_back_val();
13800 SY = Ys.pop_back_val();
13805 SX.
Ty = Underlying.Ty;
13808 QX -= Underlying.Quals;
13826 llvm_unreachable(
"Not a saturated fixed point type!");
13827 case BuiltinType::SatShortAccum:
13829 case BuiltinType::SatAccum:
13831 case BuiltinType::SatLongAccum:
13833 case BuiltinType::SatUShortAccum:
13835 case BuiltinType::SatUAccum:
13837 case BuiltinType::SatULongAccum:
13839 case BuiltinType::SatShortFract:
13841 case BuiltinType::SatFract:
13843 case BuiltinType::SatLongFract:
13845 case BuiltinType::SatUShortFract:
13847 case BuiltinType::SatUFract:
13849 case BuiltinType::SatULongFract:
13861 llvm_unreachable(
"Not a fixed point type!");
13862 case BuiltinType::ShortAccum:
13864 case BuiltinType::Accum:
13866 case BuiltinType::LongAccum:
13868 case BuiltinType::UShortAccum:
13870 case BuiltinType::UAccum:
13872 case BuiltinType::ULongAccum:
13874 case BuiltinType::ShortFract:
13876 case BuiltinType::Fract:
13878 case BuiltinType::LongFract:
13880 case BuiltinType::UShortFract:
13882 case BuiltinType::UFract:
13884 case BuiltinType::ULongFract:
13890 if (LangOpts.OpenCL)
13914 llvm_unreachable(
"Not a fixed point type!");
13915 case BuiltinType::ShortAccum:
13916 case BuiltinType::SatShortAccum:
13917 return Target.getShortAccumScale();
13918 case BuiltinType::Accum:
13919 case BuiltinType::SatAccum:
13920 return Target.getAccumScale();
13921 case BuiltinType::LongAccum:
13922 case BuiltinType::SatLongAccum:
13923 return Target.getLongAccumScale();
13924 case BuiltinType::UShortAccum:
13925 case BuiltinType::SatUShortAccum:
13926 return Target.getUnsignedShortAccumScale();
13927 case BuiltinType::UAccum:
13928 case BuiltinType::SatUAccum:
13929 return Target.getUnsignedAccumScale();
13930 case BuiltinType::ULongAccum:
13931 case BuiltinType::SatULongAccum:
13932 return Target.getUnsignedLongAccumScale();
13933 case BuiltinType::ShortFract:
13934 case BuiltinType::SatShortFract:
13935 return Target.getShortFractScale();
13936 case BuiltinType::Fract:
13937 case BuiltinType::SatFract:
13938 return Target.getFractScale();
13939 case BuiltinType::LongFract:
13940 case BuiltinType::SatLongFract:
13941 return Target.getLongFractScale();
13942 case BuiltinType::UShortFract:
13943 case BuiltinType::SatUShortFract:
13944 return Target.getUnsignedShortFractScale();
13945 case BuiltinType::UFract:
13946 case BuiltinType::SatUFract:
13947 return Target.getUnsignedFractScale();
13948 case BuiltinType::ULongFract:
13949 case BuiltinType::SatULongFract:
13950 return Target.getUnsignedLongFractScale();
13960 llvm_unreachable(
"Not a fixed point type!");
13961 case BuiltinType::ShortAccum:
13962 case BuiltinType::SatShortAccum:
13963 return Target.getShortAccumIBits();
13964 case BuiltinType::Accum:
13965 case BuiltinType::SatAccum:
13966 return Target.getAccumIBits();
13967 case BuiltinType::LongAccum:
13968 case BuiltinType::SatLongAccum:
13969 return Target.getLongAccumIBits();
13970 case BuiltinType::UShortAccum:
13971 case BuiltinType::SatUShortAccum:
13972 return Target.getUnsignedShortAccumIBits();
13973 case BuiltinType::UAccum:
13974 case BuiltinType::SatUAccum:
13975 return Target.getUnsignedAccumIBits();
13976 case BuiltinType::ULongAccum:
13977 case BuiltinType::SatULongAccum:
13978 return Target.getUnsignedLongAccumIBits();
13979 case BuiltinType::ShortFract:
13980 case BuiltinType::SatShortFract:
13981 case BuiltinType::Fract:
13982 case BuiltinType::SatFract:
13983 case BuiltinType::LongFract:
13984 case BuiltinType::SatLongFract:
13985 case BuiltinType::UShortFract:
13986 case BuiltinType::SatUShortFract:
13987 case BuiltinType::UFract:
13988 case BuiltinType::SatUFract:
13989 case BuiltinType::ULongFract:
13990 case BuiltinType::SatULongFract:
13995llvm::FixedPointSemantics
13998 "Can only get the fixed point semantics for a "
13999 "fixed point or integer type.");
14001 return llvm::FixedPointSemantics::GetIntegerSemantics(
14005 return llvm::FixedPointSemantics(
14008 !isSigned &&
getTargetInfo().doUnsignedFixedPointTypesHavePadding());
14023 "Expected unsigned fixed point type");
14026 case BuiltinType::UShortAccum:
14028 case BuiltinType::UAccum:
14030 case BuiltinType::ULongAccum:
14032 case BuiltinType::SatUShortAccum:
14034 case BuiltinType::SatUAccum:
14036 case BuiltinType::SatULongAccum:
14038 case BuiltinType::UShortFract:
14040 case BuiltinType::UFract:
14042 case BuiltinType::ULongFract:
14044 case BuiltinType::SatUShortFract:
14046 case BuiltinType::SatUFract:
14048 case BuiltinType::SatULongFract:
14051 llvm_unreachable(
"Unexpected unsigned fixed point type");
14059 std::vector<std::string> BackendFeats;
14060 for (StringRef F : FMVFeatStrings)
14061 if (
auto FMVExt = llvm::AArch64::parseFMVExtension(F))
14062 for (StringRef F : FMVExt->getImpliedFeatures())
14063 BackendFeats.push_back(F.str());
14064 return BackendFeats;
14069 assert(TD !=
nullptr);
14072 llvm::erase_if(
ParsedAttr.Features, [&](
const std::string &Feat) {
14073 return !Target->isValidFeatureName(StringRef{Feat}.substr(1));
14084 Target->getTargetOpts().CPU,
14085 Target->getTargetOpts().Features);
14092 StringRef TargetCPU =
Target->getTargetOpts().CPU;
14094 if (
const auto *TD = FD->
getAttr<TargetAttr>()) {
14100 if (!
Target->getTriple().isAArch64())
14103 Target->getTargetOpts().FeaturesAsWritten.begin(),
14104 Target->getTargetOpts().FeaturesAsWritten.end());
14115 }
else if (
const auto *SD = FD->
getAttr<CPUSpecificAttr>()) {
14117 Target->getCPUSpecificCPUDispatchFeatures(
14119 std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
14120 Features.insert(Features.begin(),
14121 Target->getTargetOpts().FeaturesAsWritten.begin(),
14122 Target->getTargetOpts().FeaturesAsWritten.end());
14124 }
else if (
const auto *TC = FD->
getAttr<TargetClonesAttr>()) {
14125 if (
Target->getTriple().isAArch64()) {
14129 Features.insert(Features.begin(),
14130 Target->getTargetOpts().FeaturesAsWritten.begin(),
14131 Target->getTargetOpts().FeaturesAsWritten.end());
14134 std::vector<std::string> Features;
14136 if (VersionStr.starts_with(
"arch="))
14137 TargetCPU = VersionStr.drop_front(
sizeof(
"arch=") - 1);
14138 else if (VersionStr !=
"default")
14139 Features.push_back((StringRef{
"+"} + VersionStr).str());
14142 }
else if (
const auto *TV = FD->
getAttr<TargetVersionAttr>()) {
14144 TV->getFeatures(Feats);
14146 Features.insert(Features.begin(),
14147 Target->getTargetOpts().FeaturesAsWritten.begin(),
14148 Target->getTargetOpts().FeaturesAsWritten.end());
14151 FeatureMap =
Target->getTargetOpts().FeatureMap;
14157 return *OMPTraitInfoVector.back();
14164 return DB << Section.
Decl;
14165 return DB <<
"a prior #pragma section";
14169 bool IsInternalVar =
14172 bool IsExplicitDeviceVar = (
D->
hasAttr<CUDADeviceAttr>() &&
14173 !
D->
getAttr<CUDADeviceAttr>()->isImplicit()) ||
14174 (
D->
hasAttr<CUDAConstantAttr>() &&
14175 !
D->
getAttr<CUDAConstantAttr>()->isImplicit());
14179 return (IsInternalVar &&
14180 (
D->
hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) ||
14193 if (!CUIDHash.empty())
14195 if (LangOpts.
CUID.empty())
14196 return StringRef();
14197 CUIDHash = llvm::utohexstr(llvm::MD5Hash(LangOpts.
CUID),
true);
14207 assert(PrimaryBase);
14210 auto Base = Layout.getPrimaryBase();
14211 if (!
Base ||
Base == PrimaryBase || !
Base->isPolymorphic())
14213 PrimaryBase =
Base;
14215 return PrimaryBase;
14219 StringRef MangledName) {
14220 auto *Method = cast<CXXMethodDecl>(VirtualMethodDecl.
getDecl());
14221 assert(Method->isVirtual());
14222 bool DefaultIncludesPointerAuth =
14223 LangOpts.PointerAuthCalls || LangOpts.PointerAuthIntrinsics;
14225 if (!DefaultIncludesPointerAuth)
14228 auto Existing = ThunksToBeAbbreviated.find(VirtualMethodDecl);
14229 if (Existing != ThunksToBeAbbreviated.end())
14230 return Existing->second.contains(MangledName.str());
14233 llvm::StringMap<llvm::SmallVector<std::string, 2>> Thunks;
14235 if (
const auto *ThunkInfos = VtableContext->getThunkInfo(VirtualMethodDecl)) {
14236 auto *
Destructor = dyn_cast<CXXDestructorDecl>(Method);
14237 for (
const auto &Thunk : *ThunkInfos) {
14239 llvm::raw_svector_ostream ElidedNameStream(ElidedName);
14245 Mangler->mangleThunk(Method, Thunk,
true,
14248 llvm::raw_svector_ostream mangledNameStream(MangledName);
14252 mangledNameStream);
14254 Mangler->mangleThunk(Method, Thunk,
false,
14255 mangledNameStream);
14257 if (Thunks.find(ElidedName) == Thunks.end())
14258 Thunks[ElidedName] = {};
14259 Thunks[ElidedName].push_back(std::string(MangledName));
14262 llvm::StringSet<> SimplifiedThunkNames;
14263 for (
auto &ThunkList : Thunks) {
14264 llvm::sort(ThunkList.second);
14265 SimplifiedThunkNames.insert(ThunkList.second[0]);
14267 bool Result = SimplifiedThunkNames.contains(MangledName);
14268 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)
#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS)
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 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 TemplateName getCommonTemplateNameChecked(ASTContext &Ctx, TemplateName X, TemplateName Y)
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 TemplateName getCommonTemplateName(ASTContext &Ctx, TemplateName X, TemplateName Y)
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 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)
#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS)
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 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 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 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 Expressions and AST nodes for C++2a concepts.
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.
This file defines OpenACC AST classes for statement-level contructs.
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.
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
unsigned getManglingNumber(const NamedDecl *ND, bool ForAuxTarget=false) const
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true)
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
unsigned getIntWidth(QualType T) const
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one.
QualType getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, QualType Wrapped)
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType) const
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
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...
bool hasSimilarType(QualType T1, QualType T2)
Determine if two types are similar, according to the C++ rules.
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
TemplateName getCanonicalTemplateName(const TemplateName &Name) const
Retrieves the "canonical" template name that refers to a given template.
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.
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.
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
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true)
Form a pack expansion type with the given pattern.
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.
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list,...
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.
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 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
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl)
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
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.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
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
bool hasSameTemplateName(const TemplateName &X, const TemplateName &Y) const
Determine whether the given template names refer to the same template.
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized,...
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,...
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 ...
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
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".
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)
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.
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 ...
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...
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...
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
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 UnwrapSimilarTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true)
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
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
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 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>.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Retrieve a substitution-result type.
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.
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)
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.
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
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 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
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 getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
unsigned getBitWidthValue(const ASTContext &Ctx) const
Computes the bit width of this field, if this is a bit field.
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
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.
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
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
unsigned getFastQualifiers() const
void removeAddressSpace()
void setAddressSpace(LangAS space)
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
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.
TemplateName getReplacement() const
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() const
Retrieve the underlying template declaration that this template name refers to, if known.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
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.
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.
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.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
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)
@ ICIS_NoInit
No in-class initializer.
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
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)
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__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)
@ 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)
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...
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