;
115template<>
structllvm::DenseMapInfo<
llvm::FoldingSetNodeID> {
116 staticFoldingSetNodeID
getEmptyKey() {
returnFoldingSetNodeID{}; }
120 for(
size_ti = 0; i <
sizeof(id) /
sizeof(
unsigned); ++i) {
121 id.AddInteger(std::numeric_limits<unsigned>::max());
127 returnVal.ComputeHash();
130 static bool isEqual(
constFoldingSetNodeID &LHS,
131 constFoldingSetNodeID &RHS) {
147 if(
const auto*FD = dyn_cast<FunctionDecl>(
D)) {
152 if(
const auto*VD = dyn_cast<VarDecl>(
D)) {
153 if(VD->isStaticDataMember() &&
158 if(
const auto*CRD = dyn_cast<CXXRecordDecl>(
D)) {
163 if(
const auto*CTSD = dyn_cast<ClassTemplateSpecializationDecl>(
D)) {
170 if(
const auto*ED = dyn_cast<EnumDecl>(
D)) {
174 if(
const auto*TD = dyn_cast<TagDecl>(
D)) {
177 if(TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
181 if(isa<ParmVarDecl>(
D))
186 if(isa<TemplateTypeParmDecl>(
D) ||
187isa<NonTypeTemplateParmDecl>(
D) ||
188isa<TemplateTemplateParmDecl>(
D))
199 if(isa<ObjCMethodDecl>(
D) || isa<ObjCContainerDecl>(
D) ||
200isa<ObjCPropertyDecl>(
D) || isa<RedeclarableTemplateDecl>(
D) ||
201isa<ClassTemplateSpecializationDecl>(
D) ||
203isa<TypedefDecl>(
D))
209Locations.emplace_back(BaseLocation);
237 conststd::map<unsigned, RawComment *> &CommentsInTheFile)
const{
240 if(RepresentativeLocForDecl.
isInvalid() ||
241!RepresentativeLocForDecl.
isFileID())
245 if(CommentsInTheFile.empty())
250 conststd::pair<FileID, unsigned> DeclLocDecomp =
254 autoOffsetCommentBehindDecl =
255CommentsInTheFile.lower_bound(DeclLocDecomp.second);
258 if(OffsetCommentBehindDecl != CommentsInTheFile.end()) {
259 RawComment*CommentBehindDecl = OffsetCommentBehindDecl->second;
263(isa<FieldDecl>(
D) || isa<EnumConstantDecl>(
D) || isa<VarDecl>(
D) ||
264isa<ObjCMethodDecl>(
D) || isa<ObjCPropertyDecl>(
D))) {
268 if(SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second) ==
270OffsetCommentBehindDecl->first)) {
271 returnCommentBehindDecl;
278 if(OffsetCommentBehindDecl == CommentsInTheFile.begin())
281 autoOffsetCommentBeforeDecl = --OffsetCommentBehindDecl;
282 RawComment*CommentBeforeDecl = OffsetCommentBeforeDecl->second;
291 const unsignedCommentEndOffset =
296 const char*Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
302StringRef
Text(Buffer + CommentEndOffset,
303DeclLocDecomp.second - CommentEndOffset);
307 if(
Text.find_last_of(
";{}#@") != StringRef::npos)
310 returnCommentBeforeDecl;
316 for(
const autoDeclLoc : DeclLocs) {
319 if(DeclLoc.isInvalid() || !DeclLoc.isFileID())
331 if(!
File.isValid())
335 if(!CommentsInThisFile || CommentsInThisFile->empty())
347assert(LangOpts.RetainCommentsFromSystemHeaders ||
356 if(
const auto*FD = dyn_cast<FunctionDecl>(&
D)) {
376 if(
const auto*VD = dyn_cast<VarDecl>(&
D)) {
379 if(VD->isStaticDataMember())
385 if(
const auto*CRD = dyn_cast<CXXRecordDecl>(&
D)) {
392 if(
const auto*CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
398 returnisa<ClassTemplateDecl *>(PU)
399? *
static_cast<const Decl*
>(cast<ClassTemplateDecl *>(PU))
400: *
static_cast<const Decl*
>(
401cast<ClassTemplatePartialSpecializationDecl *>(PU));
406CRD->getMemberSpecializationInfo())
407 return*Info->getInstantiatedFrom();
411 if(
const auto*ED = dyn_cast<EnumDecl>(&
D)) {
424 const Decl**OriginalDecl)
const{
427OriginalDecl =
nullptr;
439 returnDeclComment->second;
452*OriginalDecl = RedeclComment->second;
455 "This decl is supposed to have comment attached.");
456 returnCommentAtRedecl->second;
461 const Decl*LastCheckedRedecl = [&]() {
463 boolCanUseCommentlessCache =
false;
465 for(
auto*Redecl : CanonicalD->
redecls()) {
467CanUseCommentlessCache =
true;
470 if(Redecl == LastChecked)
477 returnCanUseCommentlessCache ? LastChecked :
nullptr;
483 if(LastCheckedRedecl) {
484 if(LastCheckedRedecl == Redecl) {
485LastCheckedRedecl =
nullptr;
493*OriginalDecl = Redecl;
494 returnRedeclComment;
500*OriginalDecl =
nullptr;
516 if(
const auto*IMD = dyn_cast<ObjCImplDecl>(DC)) {
521 for(
const auto*Ext : ID->known_extensions()) {
525Redeclared.push_back(RedeclaredMethod);
536 for(
const Decl*
D: Decls) {
550 if(
File.isInvalid())
554 if(!CommentsInThisFile || CommentsInThisFile->empty() ||
555CommentsInThisFile->rbegin()->second->isAttached())
565 for(
const Decl*
D: Decls) {
577 for(
const autoDeclLoc : DeclLocs) {
578 if(DeclLoc.isInvalid() || !DeclLoc.isFileID())
582 D, DeclLoc, *CommentsInThisFile)) {
593 const Decl*
D)
const{
596ThisDeclInfo->IsFilled =
false;
597ThisDeclInfo->fill();
598ThisDeclInfo->CommentDecl = FC->
getDecl();
599 if(!ThisDeclInfo->TemplateParameters)
609 returnRC ? RC->
parse(*
this,
nullptr,
D) :
nullptr;
620llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
624 if(Canonical !=
D) {
632 const Decl*OriginalDecl =
nullptr;
636 if(isa<ObjCMethodDecl>(
D) || isa<FunctionDecl>(
D)) {
638 const auto*OMD = dyn_cast<ObjCMethodDecl>(
D);
639 if(OMD && OMD->isPropertyAccessor())
646 for(
unsignedi = 0, e = Overridden.size(); i < e; i++)
650 else if(
const auto*TD = dyn_cast<TypedefNameDecl>(
D)) {
653 QualTypeQT = TD->getUnderlyingType();
655 if(
const Decl*TD = TT->getDecl())
659 else if(
const auto*IC = dyn_cast<ObjCInterfaceDecl>(
D)) {
660 while(IC->getSuperClass()) {
661IC = IC->getSuperClass();
666 else if(
const auto*CD = dyn_cast<ObjCCategoryDecl>(
D)) {
671 else if(
const auto*RD = dyn_cast<CXXRecordDecl>(
D)) {
672 if(!(RD = RD->getDefinition()))
675 for(
const auto&I : RD->bases()) {
676 if(I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
690 for(
const auto&I : RD->vbases()) {
691 if(I.getAccessSpecifier() !=
AS_public)
711 if(
D!= OriginalDecl && OriginalDecl)
720ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &ID,
728ID.AddInteger(Params->
size());
730PEnd = Params->
end();
732 if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
734ID.AddBoolean(TTP->isParameterPack());
735 if(TTP->isExpandedParameterPack()) {
736ID.AddBoolean(
true);
737ID.AddInteger(TTP->getNumExpansionParameters());
739ID.AddBoolean(
false);
743 if(
const auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
745 ID.AddBoolean(NTTP->isParameterPack());
746 ID.AddPointer(
C.getUnconstrainedType(
C.getCanonicalType(NTTP->getType()))
748 if(NTTP->isExpandedParameterPack()) {
749 ID.AddBoolean(
true);
750 ID.AddInteger(NTTP->getNumExpansionTypes());
751 for(
unsignedI = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
753 ID.AddPointer(
T.getCanonicalType().getAsOpaquePtr());
756 ID.AddBoolean(
false);
760 auto*TTP = cast<TemplateTemplateParmDecl>(*
P);
762Profile(ID,
C, TTP);
767ASTContext::getCanonicalTemplateTemplateParmDecl(
770llvm::FoldingSetNodeID
ID;
771CanonicalTemplateTemplateParm::Profile(ID, *
this, TTP);
772 void*InsertPos =
nullptr;
773CanonicalTemplateTemplateParm *Canonical
774= CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
776 returnCanonical->getParam();
781CanonParams.reserve(Params->
size());
783PEnd = Params->
end();
787 if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
793? std::optional<unsigned>(TTP->getNumExpansionParameters())
795CanonParams.push_back(NewTTP);
796}
else if(
const auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
800 if(NTTP->isExpandedParameterPack()) {
803 for(
unsignedI = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
805ExpandedTInfos.push_back(
813NTTP->getPosition(),
nullptr,
823NTTP->getPosition(),
nullptr,
825NTTP->isParameterPack(),
828CanonParams.push_back(Param);
830CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
831cast<TemplateTemplateParmDecl>(*
P)));
842Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
843assert(!Canonical &&
"Shouldn't be in the map!");
847Canonical =
new(*this) CanonicalTemplateTemplateParm(CanonTTP);
848CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
857 returnNoSanitizeL->containsType(Mask, TyName) &&
858!NoSanitizeL->containsType(Mask, TyName,
"sanitize");
867 if(!LangOpts.CPlusPlus)
return nullptr;
870 caseTargetCXXABI::AppleARM64:
871 caseTargetCXXABI::Fuchsia:
872 caseTargetCXXABI::GenericARM:
873 caseTargetCXXABI::iOS:
874 caseTargetCXXABI::WatchOS:
875 caseTargetCXXABI::GenericAArch64:
876 caseTargetCXXABI::GenericMIPS:
877 caseTargetCXXABI::GenericItanium:
878 caseTargetCXXABI::WebAssembly:
879 caseTargetCXXABI::XL:
881 caseTargetCXXABI::Microsoft:
884llvm_unreachable(
"Invalid CXXABI type!");
888 if(!InterpContext) {
891 return*InterpContext.get();
897 return*ParentMapCtx.get();
902 switch(LangOpts.getAddressSpaceMapMangling()) {
910llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
916: ConstantArrayTypes(this_(), ConstantArrayTypesLog2InitSize),
917DependentSizedArrayTypes(this_()), DependentSizedExtVectorTypes(this_()),
918DependentAddressSpaceTypes(this_()), DependentVectorTypes(this_()),
919DependentSizedMatrixTypes(this_()),
920FunctionProtoTypes(this_(), FunctionProtoTypesLog2InitSize),
921DependentTypeOfExprTypes(this_()), DependentDecltypeTypes(this_()),
922TemplateSpecializationTypes(this_()),
923DependentTemplateSpecializationTypes(this_()),
924DependentBitIntTypes(this_()), SubstTemplateTemplateParmPacks(this_()),
925DeducedTemplates(this_()), ArrayParameterTypes(this_()),
926CanonTemplateTemplateParms(this_()), SourceMgr(
SM), LangOpts(LOpts),
929LangOpts.XRayNeverInstrumentFiles,
930LangOpts.XRayAttrListFiles,
SM)),
933 BuiltinInfo(builtins), TUKind(TUKind), DeclarationNames(*this),
934Comments(
SM), CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
935CompCategories(this_()), LastSDM(nullptr, 0) {
942ReleaseDeclContextMaps();
945 for(
auto&Pair : Deallocations)
946(Pair.first)(Pair.second);
947Deallocations.clear();
953I = ObjCLayouts.begin(),
E= ObjCLayouts.end(); I !=
E; )
959 for(llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
960I = ASTRecordLayouts.begin(),
E= ASTRecordLayouts.end(); I !=
E; ) {
965ASTRecordLayouts.clear();
967 for(llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
968AEnd = DeclAttrs.end();
970A->second->~AttrVec();
973 for(
const auto&
Value: ModuleInitializers)
974 Value.second->~PerModuleInitializers();
975ModuleInitializers.
clear();
981TraversalScope = TopLevelDecls;
986Deallocations.push_back({Callback,
Data});
995llvm::errs() <<
"\n*** AST Context Stats:\n";
996llvm::errs() <<
" "<< Types.size() <<
" types total.\n";
998 unsignedcounts[] = {
999#define TYPE(Name, Parent) 0, 1000#define ABSTRACT_TYPE(Name, Parent) 1001#include "clang/AST/TypeNodes.inc" 1005 for(
unsignedi = 0, e = Types.size(); i != e; ++i) {
1006 Type*
T= Types[i];
1011 unsignedTotalBytes = 0;
1012#define TYPE(Name, Parent) \ 1014 llvm::errs() << " "<< counts[Idx] << " " << #Name \
1015<< " types, " << sizeof(Name##Type) << " each " \
1016<< "(" << counts[Idx] * sizeof(Name##Type) \
1018TotalBytes += counts[Idx] * sizeof(Name##Type); \
1020#define ABSTRACT_TYPE(Name, Parent) 1021#include "clang/AST/TypeNodes.inc" 1023llvm::errs() <<
"Total bytes = "<< TotalBytes <<
"\n";
1028<<
" implicit default constructors created\n";
1031<<
" implicit copy constructors created\n";
1035<<
" implicit move constructors created\n";
1038<<
" implicit copy assignment operators created\n";
1042<<
" implicit move assignment operators created\n";
1045<<
" implicit destructors created\n";
1048llvm::errs() <<
"\n";
1052BumpAlloc.PrintStats();
1056 boolNotifyListeners) {
1057 if(NotifyListeners)
1065 autoIt = MergedDefModules.find(cast<NamedDecl>(ND->
getCanonicalDecl()));
1066 if(It == MergedDefModules.end())
1069 auto&Merged = It->second;
1070llvm::DenseSet<Module*>
Found;
1071 for(
Module*&M : Merged)
1072 if(!
Found.insert(M).second)
1074llvm::erase(Merged,
nullptr);
1081 if(MergedIt == MergedDefModules.end())
1083 returnMergedIt->second;
1086voidASTContext::PerModuleInitializers::resolve(
ASTContext&Ctx) {
1087 if(LazyInitializers.empty())
1091assert(Source &&
"lazy initializers but no external source");
1093 autoLazyInits = std::move(LazyInitializers);
1094LazyInitializers.clear();
1096 for(
autoID : LazyInits)
1097Initializers.push_back(Source->GetExternalDecl(ID));
1099assert(LazyInitializers.empty() &&
1100 "GetExternalDecl for lazy module initializer added more inits");
1106 if(
const auto*ID = dyn_cast<ImportDecl>(
D)) {
1107 autoIt = ModuleInitializers.find(ID->getImportedModule());
1110 if(It == ModuleInitializers.end())
1114 auto&Imported = *It->second;
1115 if(Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1116Imported.resolve(*
this);
1117 auto*OnlyDecl = Imported.Initializers.front();
1118 if(isa<ImportDecl>(OnlyDecl))
1123 auto*&Inits = ModuleInitializers[M];
1125Inits =
new(*this) PerModuleInitializers;
1126Inits->Initializers.push_back(
D);
1131 auto*&Inits = ModuleInitializers[M];
1133Inits =
new(*this) PerModuleInitializers;
1134Inits->LazyInitializers.insert(Inits->LazyInitializers.end(),
1135IDs.begin(), IDs.end());
1139 autoIt = ModuleInitializers.find(M);
1140 if(It == ModuleInitializers.end())
1143 auto*Inits = It->second;
1144Inits->resolve(*
this);
1145 returnInits->Initializers;
1150assert(!CurrentCXXNamedModule &&
1151 "We should set named module for ASTContext for only once");
1152CurrentCXXNamedModule = M;
1164 autoGetRepresentativeModule = [
this](
const Module*M) {
1165 auto Iter= SameModuleLookupSet.find(M);
1166 if(
Iter!= SameModuleLookupSet.end())
1167 return Iter->second;
1169 const Module*RepresentativeModule =
1170PrimaryModuleNameMap.try_emplace(M->getPrimaryModuleInterfaceName(), M)
1172SameModuleLookupSet[M] = RepresentativeModule;
1173 returnRepresentativeModule;
1176assert(M1 &&
"Shouldn't call `isInSameModule` if both M1 and M2 are none.");
1177 returnGetRepresentativeModule(M1) == GetRepresentativeModule(M2);
1181 if(!ExternCContext)
1184 returnExternCContext;
1190 auto*BuiltinTemplate =
1192BuiltinTemplate->setImplicit();
1195 returnBuiltinTemplate;
1200 if(!MakeIntegerSeqDecl)
1203 returnMakeIntegerSeqDecl;
1208 if(!TypePackElementDecl)
1211 returnTypePackElementDecl;
1215 if(!BuiltinCommonTypeDecl)
1218 returnBuiltinCommonTypeDecl;
1232NewDecl->
addAttr(TypeVisibilityAttr::CreateImplicit(
1233 const_cast<ASTContext&
>(*
this), TypeVisibilityAttr::Default));
1238StringRef Name)
const{
1262Types.push_back(Ty);
1267assert((!this->Target || this->Target == &
Target) &&
1268 "Incorrect target reinitialization");
1269assert(
VoidTy.
isNull() &&
"Context reinitialized?");
1271this->Target = &
Target;
1272this->AuxTarget = AuxTarget;
1274ABI.reset(createCXXABI(
Target));
1278InitBuiltinType(
VoidTy, BuiltinType::Void);
1281InitBuiltinType(
BoolTy, BuiltinType::Bool);
1283 if(LangOpts.CharIsSigned)
1284InitBuiltinType(
CharTy, BuiltinType::Char_S);
1286InitBuiltinType(
CharTy, BuiltinType::Char_U);
1289InitBuiltinType(
ShortTy, BuiltinType::Short);
1290InitBuiltinType(
IntTy, BuiltinType::Int);
1291InitBuiltinType(
LongTy, BuiltinType::Long);
1292InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1302InitBuiltinType(
FloatTy, BuiltinType::Float);
1303InitBuiltinType(
DoubleTy, BuiltinType::Double);
1304InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1307InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1310InitBuiltinType(
Ibm128Ty, BuiltinType::Ibm128);
1313InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1316InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1317InitBuiltinType(
AccumTy, BuiltinType::Accum);
1318InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1322InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1323InitBuiltinType(
FractTy, BuiltinType::Fract);
1324InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1329InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1335InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1342InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1347InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1349InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1350 if(LangOpts.CPlusPlus && LangOpts.WChar)
1360InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1362 if(LangOpts.CPlusPlus)
1363InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1367 if(LangOpts.CPlusPlus)
1368InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1377InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1380InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1392InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1398InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1401 if(LangOpts.OpenMP) {
1408 if(LangOpts.OpenACC && !LangOpts.OpenMP) {
1411 if(LangOpts.MatrixTypes)
1419 if(LangOpts.OpenCL) {
1420#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1421 InitBuiltinType(SingletonId, BuiltinType::Id); 1422#include "clang/Basic/OpenCLImageTypes.def" 1424InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1425InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1427InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1430#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 1431 InitBuiltinType(Id##Ty, BuiltinType::Id); 1432#include "clang/Basic/OpenCLExtensionTypes.def" 1435 if(LangOpts.HLSL) {
1436#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ 1437 InitBuiltinType(SingletonId, BuiltinType::Id); 1438#include "clang/Basic/HLSLIntangibleTypes.def" 1441 if(
Target.hasAArch64SVETypes() ||
1443#define SVE_TYPE(Name, Id, SingletonId) \ 1444 InitBuiltinType(SingletonId, BuiltinType::Id); 1445#include "clang/Basic/AArch64SVEACLETypes.def" 1448 if(
Target.getTriple().isPPC64()) {
1449#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \ 1450 InitBuiltinType(Id##Ty, BuiltinType::Id); 1451#include "clang/Basic/PPCTypes.def" 1452#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \ 1453 InitBuiltinType(Id##Ty, BuiltinType::Id); 1454#include "clang/Basic/PPCTypes.def" 1457 if(
Target.hasRISCVVTypes()) {
1458#define RVV_TYPE(Name, Id, SingletonId) \ 1459 InitBuiltinType(SingletonId, BuiltinType::Id); 1460#include "clang/Basic/RISCVVTypes.def" 1463 if(
Target.getTriple().isWasm() &&
Target.hasFeature(
"reference-types")) {
1464#define WASM_TYPE(Name, Id, SingletonId) \ 1465 InitBuiltinType(SingletonId, BuiltinType::Id); 1466#include "clang/Basic/WebAssemblyReferenceTypes.def" 1469 if(
Target.getTriple().isAMDGPU() ||
1470(AuxTarget && AuxTarget->
getTriple().isAMDGPU())) {
1471#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) \ 1472 InitBuiltinType(SingletonId, BuiltinType::Id); 1473#include "clang/Basic/AMDGPUTypes.def" 1480ObjCConstantStringType =
QualType();
1485 if(LangOpts.OpenCLGenericAddressSpace) {
1495InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1498InitBuiltinType(
HalfTy, BuiltinType::Half);
1500InitBuiltinType(
BFloat16Ty, BuiltinType::BFloat16);
1506 if(LangOpts.MicrosoftExt || LangOpts.Borland) {
1528llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(
D);
1529 if(Pos != DeclAttrs.end()) {
1530Pos->second->~AttrVec();
1531DeclAttrs.erase(Pos);
1545llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1546TemplateOrInstantiation.find(Var);
1547 if(Pos == TemplateOrInstantiation.end())
1560Tmpl, TSK, PointOfInstantiation));
1566assert(!TemplateOrInstantiation[Inst] &&
1567 "Already noted what the variable was instantiated from");
1568TemplateOrInstantiation[Inst] = TSI;
1573 returnInstantiatedFromUsingDecl.lookup(UUD);
1578assert((isa<UsingDecl>(Pattern) ||
1579isa<UnresolvedUsingValueDecl>(Pattern) ||
1580isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1581 "pattern decl is not a using decl");
1582assert((isa<UsingDecl>(Inst) ||
1583isa<UnresolvedUsingValueDecl>(Inst) ||
1584isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1585 "instantiation did not produce a using decl");
1586assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1587InstantiatedFromUsingDecl[Inst] = Pattern;
1592 returnInstantiatedFromUsingEnumDecl.lookup(UUD);
1597assert(!InstantiatedFromUsingEnumDecl[Inst] &&
"pattern already exists");
1598InstantiatedFromUsingEnumDecl[Inst] = Pattern;
1603 returnInstantiatedFromUsingShadowDecl.lookup(Inst);
1609assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1610InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1615 returnInstantiatedFromUnnamedFieldDecl.lookup(Field);
1621 "Instantiated field decl is not unnamed");
1623 "Template field decl is not unnamed");
1624assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1625 "Already noted what unnamed field was instantiated from");
1627InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1648llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1650 if(Pos == OverriddenMethods.end())
1658OverriddenMethods[Method].push_back(Overridden);
1666 if(
const auto*CXXMethod = dyn_cast<CXXMethodDecl>(
D)) {
1672 const auto*Method = dyn_cast<ObjCMethodDecl>(
D);
1677Method->getOverriddenMethods(OverDecls);
1678Overridden.append(OverDecls.begin(), OverDecls.end());
1682assert(!Import->getNextLocalImport() &&
1683 "Import declaration already in the chain");
1684assert(!Import->isFromASTFile() &&
"Non-local import declaration");
1685 if(!FirstLocalImport) {
1686FirstLocalImport = Import;
1687LastLocalImport = Import;
1691LastLocalImport->setNextLocalImport(Import);
1692LastLocalImport = Import;
1704llvm_unreachable(
"Not a floating point type!");
1705 caseBuiltinType::BFloat16:
1706 return Target->getBFloat16Format();
1707 caseBuiltinType::Float16:
1708 return Target->getHalfFormat();
1709 caseBuiltinType::Half:
1710 return Target->getHalfFormat();
1711 caseBuiltinType::Float:
return Target->getFloatFormat();
1712 caseBuiltinType::Double:
return Target->getDoubleFormat();
1713 caseBuiltinType::Ibm128:
1714 return Target->getIbm128Format();
1715 caseBuiltinType::LongDouble:
1718 return Target->getLongDoubleFormat();
1719 caseBuiltinType::Float128:
1722 return Target->getFloat128Format();
1727 unsignedAlign =
Target->getCharWidth();
1731Align = AlignFromAttr;
1739 boolUseAlignAttrOnly;
1740 if(
const FieldDecl*FD = dyn_cast<FieldDecl>(
D))
1742FD->hasAttr<PackedAttr>() || FD->getParent()->hasAttr<PackedAttr>();
1744UseAlignAttrOnly = AlignFromAttr != 0;
1747 if(UseAlignAttrOnly) {
1749}
else if(
const auto*VD = dyn_cast<ValueDecl>(
D)) {
1759Align = getTypeInfoImpl(
T.getTypePtr()).
Align;
1764 unsignedMinWidth =
Target->getLargeArrayMinWidth();
1765 if(!ForAlignof && MinWidth) {
1766 if(isa<VariableArrayType>(
arrayType))
1767Align = std::max(Align,
Target->getLargeArrayAlign());
1768 else if(isa<ConstantArrayType>(
arrayType) &&
1770Align = std::max(Align,
Target->getLargeArrayAlign());
1775Align =
Target->getCharWidth();
1779 if(
const auto*VD = dyn_cast<VarDecl>(
D))
1780 if(VD->hasGlobalStorage() && !ForAlignof) {
1791 if(
const auto*Field = dyn_cast<FieldDecl>(VD)) {
1794 if(!
Parent->isInvalidDecl()) {
1801uint64_t Offset = Layout.
getFieldOffset(Field->getFieldIndex());
1805uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1806 if(LowBitOfOffset < FieldAlign)
1807FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1810Align = std::min(Align, FieldAlign);
1818 const auto*VD = dyn_cast<VarDecl>(
D);
1819 if(MaxAlignedAttr && VD && VD->getStorageClass() ==
SC_Static)
1820Align = std::min(Align, MaxAlignedAttr);
1857assert((Size == 0 ||
static_cast<uint64_t
>(EltInfo.
Width.
getQuantity()) <=
1858(uint64_t)(-1)/Size) &&
1859 "Overflow in array type char size evaluation");
1864Width = llvm::alignTo(Width, Align);
1871 if(
const auto*CAT = dyn_cast<ConstantArrayType>(
T))
1889 switch(BT->getKind()) {
1890 caseBuiltinType::Bool:
1891 caseBuiltinType::Char_S:
1892 caseBuiltinType::Char_U:
1893 caseBuiltinType::SChar:
1894 caseBuiltinType::UChar:
1895 caseBuiltinType::Short:
1896 caseBuiltinType::UShort:
1897 caseBuiltinType::WChar_S:
1898 caseBuiltinType::WChar_U:
1899 caseBuiltinType::Char8:
1900 caseBuiltinType::Char16:
1901 caseBuiltinType::Char32:
1910 if(
T->
isDependentType() || ET->getDecl()->getPromotionType().isNull() ||
1911ET->getDecl()->isScoped())
1929 boolNeedsPreferredAlignment)
const{
1932 if(
unsignedAlign = TT->getDecl()->getMaxAlignment())
1943 if(
unsignedAlign = TT->getDecl()->getMaxAlignment())
1948 returnTT->getDecl()->getMaxAlignment();
1954TypeInfoMap::iterator I = MemoizedTypeInfo.find(
T);
1955 if(I != MemoizedTypeInfo.end())
1960MemoizedTypeInfo[
T] = TI;
1970TypeInfoASTContext::getTypeInfoImpl(
const Type*
T)
const{
1976#define TYPE(Class, Base) 1977#define ABSTRACT_TYPE(Class, Base) 1978#define NON_CANONICAL_TYPE(Class, Base) 1979#define DEPENDENT_TYPE(Class, Base) case Type::Class: 1980#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \ 1982 assert(!T->isDependentType() && "should not see dependent types here"); \
1983return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr());
1984#include "clang/AST/TypeNodes.inc" 1985llvm_unreachable(
"Should not see dependent types");
1987 caseType::FunctionNoProto:
1988 caseType::FunctionProto:
1994 caseType::IncompleteArray:
1995 caseType::VariableArray:
1996 caseType::ConstantArray:
1997 caseType::ArrayParameter: {
2000 if(
const auto*CAT = dyn_cast<ConstantArrayType>(
T))
2001Size = CAT->getZExtSize();
2004assert((Size == 0 || EltInfo.
Width<= (uint64_t)(-1) / Size) &&
2005 "Overflow in array type bit size evaluation");
2006Width = EltInfo.
Width* Size;
2007Align = EltInfo.
Align;
2011Width = llvm::alignTo(Width, Align);
2015 caseType::ExtVector:
2016 caseType::Vector: {
2017 const auto*VT = cast<VectorType>(
T);
2019Width = VT->isExtVectorBoolType() ? VT->getNumElements()
2020: EltInfo.
Width* VT->getNumElements();
2022Width = std::max<unsigned>(8, Width);
2023Align = std::max<unsigned>(8, Width);
2027 if(Align & (Align-1)) {
2028Align = llvm::bit_ceil(Align);
2029Width = llvm::alignTo(Width, Align);
2033 if(TargetVectorAlign && TargetVectorAlign < Align)
2034Align = TargetVectorAlign;
2048Align = std::min<unsigned>(64, Width);
2052 caseType::ConstantMatrix: {
2053 const auto*MT = cast<ConstantMatrixType>(
T);
2058Width = ElementInfo.
Width* MT->getNumRows() * MT->getNumColumns();
2059Align = ElementInfo.
Align;
2064 switch(cast<BuiltinType>(
T)->
getKind()) {
2065 default: llvm_unreachable(
"Unknown builtin type!");
2066 caseBuiltinType::Void:
2071 caseBuiltinType::Bool:
2072Width =
Target->getBoolWidth();
2073Align =
Target->getBoolAlign();
2075 caseBuiltinType::Char_S:
2076 caseBuiltinType::Char_U:
2077 caseBuiltinType::UChar:
2078 caseBuiltinType::SChar:
2079 caseBuiltinType::Char8:
2080Width =
Target->getCharWidth();
2081Align =
Target->getCharAlign();
2083 caseBuiltinType::WChar_S:
2084 caseBuiltinType::WChar_U:
2085Width =
Target->getWCharWidth();
2086Align =
Target->getWCharAlign();
2088 caseBuiltinType::Char16:
2089Width =
Target->getChar16Width();
2090Align =
Target->getChar16Align();
2092 caseBuiltinType::Char32:
2093Width =
Target->getChar32Width();
2094Align =
Target->getChar32Align();
2096 caseBuiltinType::UShort:
2097 caseBuiltinType::Short:
2098Width =
Target->getShortWidth();
2099Align =
Target->getShortAlign();
2101 caseBuiltinType::UInt:
2102 caseBuiltinType::Int:
2103Width =
Target->getIntWidth();
2104Align =
Target->getIntAlign();
2106 caseBuiltinType::ULong:
2107 caseBuiltinType::Long:
2108Width =
Target->getLongWidth();
2109Align =
Target->getLongAlign();
2111 caseBuiltinType::ULongLong:
2112 caseBuiltinType::LongLong:
2113Width =
Target->getLongLongWidth();
2114Align =
Target->getLongLongAlign();
2116 caseBuiltinType::Int128:
2117 caseBuiltinType::UInt128:
2119Align =
Target->getInt128Align();
2121 caseBuiltinType::ShortAccum:
2122 caseBuiltinType::UShortAccum:
2123 caseBuiltinType::SatShortAccum:
2124 caseBuiltinType::SatUShortAccum:
2125Width =
Target->getShortAccumWidth();
2126Align =
Target->getShortAccumAlign();
2128 caseBuiltinType::Accum:
2129 caseBuiltinType::UAccum:
2130 caseBuiltinType::SatAccum:
2131 caseBuiltinType::SatUAccum:
2132Width =
Target->getAccumWidth();
2133Align =
Target->getAccumAlign();
2135 caseBuiltinType::LongAccum:
2136 caseBuiltinType::ULongAccum:
2137 caseBuiltinType::SatLongAccum:
2138 caseBuiltinType::SatULongAccum:
2139Width =
Target->getLongAccumWidth();
2140Align =
Target->getLongAccumAlign();
2142 caseBuiltinType::ShortFract:
2143 caseBuiltinType::UShortFract:
2144 caseBuiltinType::SatShortFract:
2145 caseBuiltinType::SatUShortFract:
2146Width =
Target->getShortFractWidth();
2147Align =
Target->getShortFractAlign();
2149 caseBuiltinType::Fract:
2150 caseBuiltinType::UFract:
2151 caseBuiltinType::SatFract:
2152 caseBuiltinType::SatUFract:
2153Width =
Target->getFractWidth();
2154Align =
Target->getFractAlign();
2156 caseBuiltinType::LongFract:
2157 caseBuiltinType::ULongFract:
2158 caseBuiltinType::SatLongFract:
2159 caseBuiltinType::SatULongFract:
2160Width =
Target->getLongFractWidth();
2161Align =
Target->getLongFractAlign();
2163 caseBuiltinType::BFloat16:
2164 if(
Target->hasBFloat16Type()) {
2165Width =
Target->getBFloat16Width();
2166Align =
Target->getBFloat16Align();
2175 caseBuiltinType::Float16:
2176 caseBuiltinType::Half:
2179Width =
Target->getHalfWidth();
2180Align =
Target->getHalfAlign();
2183 "Expected OpenMP device compilation.");
2188 caseBuiltinType::Float:
2189Width =
Target->getFloatWidth();
2190Align =
Target->getFloatAlign();
2192 caseBuiltinType::Double:
2193Width =
Target->getDoubleWidth();
2194Align =
Target->getDoubleAlign();
2196 caseBuiltinType::Ibm128:
2197Width =
Target->getIbm128Width();
2198Align =
Target->getIbm128Align();
2200 caseBuiltinType::LongDouble:
2207Width =
Target->getLongDoubleWidth();
2208Align =
Target->getLongDoubleAlign();
2211 caseBuiltinType::Float128:
2214Width =
Target->getFloat128Width();
2215Align =
Target->getFloat128Align();
2218 "Expected OpenMP device compilation.");
2223 caseBuiltinType::NullPtr:
2228 caseBuiltinType::ObjCId:
2229 caseBuiltinType::ObjCClass:
2230 caseBuiltinType::ObjCSel:
2234 caseBuiltinType::OCLSampler:
2235 caseBuiltinType::OCLEvent:
2236 caseBuiltinType::OCLClkEvent:
2237 caseBuiltinType::OCLQueue:
2238 caseBuiltinType::OCLReserveID:
2239#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 2240 case BuiltinType::Id: 2241#include "clang/Basic/OpenCLImageTypes.def" 2242#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 2243 case BuiltinType::Id: 2244#include "clang/Basic/OpenCLExtensionTypes.def" 2246Width =
Target->getPointerWidth(AS);
2247Align =
Target->getPointerAlign(AS);
2257#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId) \ 2258 case BuiltinType::Id: \ 2262#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId) \ 2263 case BuiltinType::Id: \ 2267#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \ 2268 case BuiltinType::Id: \ 2272#define SVE_SCALAR_TYPE(Name, MangledName, Id, SingletonId, Bits) \ 2273 case BuiltinType::Id: \ 2277#include "clang/Basic/AArch64SVEACLETypes.def" 2278#define PPC_VECTOR_TYPE(Name, Id, Size) \ 2279 case BuiltinType::Id: \ 2283#include "clang/Basic/PPCTypes.def" 2284#define RVV_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, NF, IsSigned, \ 2286 case BuiltinType::Id: \ 2290#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) \ 2291 case BuiltinType::Id: \ 2295#include "clang/Basic/RISCVVTypes.def" 2296#define WASM_TYPE(Name, Id, SingletonId) \ 2297 case BuiltinType::Id: \ 2301#include "clang/Basic/WebAssemblyReferenceTypes.def" 2302#define AMDGPU_TYPE(NAME, ID, SINGLETONID, WIDTH, ALIGN) \ 2303 case BuiltinType::ID: \ 2307#include "clang/Basic/AMDGPUTypes.def" 2308#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id: 2309#include "clang/Basic/HLSLIntangibleTypes.def" 2315 caseType::ObjCObjectPointer:
2319 caseType::BlockPointer:
2320AS = cast<BlockPointerType>(
T)->getPointeeType().getAddressSpace();
2321Width =
Target->getPointerWidth(AS);
2322Align =
Target->getPointerAlign(AS);
2324 caseType::LValueReference:
2325 caseType::RValueReference:
2328AS = cast<ReferenceType>(
T)->getPointeeType().getAddressSpace();
2329Width =
Target->getPointerWidth(AS);
2330Align =
Target->getPointerAlign(AS);
2333AS = cast<PointerType>(
T)->getPointeeType().getAddressSpace();
2334Width =
Target->getPointerWidth(AS);
2335Align =
Target->getPointerAlign(AS);
2337 caseType::MemberPointer: {
2338 const auto*MPT = cast<MemberPointerType>(
T);
2340Width = MPI.
Width;
2341Align = MPI.
Align;
2344 caseType::Complex: {
2348Width = EltInfo.
Width* 2;
2349Align = EltInfo.
Align;
2352 caseType::ObjCObject:
2353 return getTypeInfo(cast<ObjCObjectType>(
T)->getBaseType().getTypePtr());
2354 caseType::Adjusted:
2357 caseType::ObjCInterface: {
2358 const auto*ObjCI = cast<ObjCInterfaceType>(
T);
2359 if(ObjCI->getDecl()->isInvalidDecl()) {
2369 caseType::BitInt: {
2370 const auto*EIT = cast<BitIntType>(
T);
2371Align =
Target->getBitIntAlign(EIT->getNumBits());
2372Width =
Target->getBitIntWidth(EIT->getNumBits());
2377 const auto*TT = cast<TagType>(
T);
2379 if(TT->getDecl()->isInvalidDecl()) {
2385 if(
const auto*ET = dyn_cast<EnumType>(TT)) {
2386 const EnumDecl*ED = ET->getDecl();
2390Info.
Align= AttrAlign;
2396 const auto*RT = cast<RecordType>(TT);
2401AlignRequirement = RD->
hasAttr<AlignedAttr>()
2407 caseType::SubstTemplateTypeParm:
2408 return getTypeInfo(cast<SubstTemplateTypeParmType>(
T)->
2409getReplacementType().getTypePtr());
2412 caseType::DeducedTemplateSpecialization: {
2413 const auto*A = cast<DeducedType>(
T);
2414assert(!A->getDeducedType().isNull() &&
2415 "cannot request the size of an undeduced or dependent auto type");
2416 return getTypeInfo(A->getDeducedType().getTypePtr());
2420 return getTypeInfo(cast<ParenType>(
T)->getInnerType().getTypePtr());
2422 caseType::MacroQualified:
2426 caseType::ObjCTypeParam:
2427 return getTypeInfo(cast<ObjCTypeParamType>(
T)->desugar().getTypePtr());
2430 return getTypeInfo(cast<UsingType>(
T)->desugar().getTypePtr());
2432 caseType::Typedef: {
2433 const auto*TT = cast<TypedefType>(
T);
2438 if(
unsignedAttrAlign = TT->getDecl()->getMaxAlignment()) {
2442Align = Info.
Align;
2445Width = Info.
Width;
2449 caseType::Elaborated:
2450 return getTypeInfo(cast<ElaboratedType>(
T)->getNamedType().getTypePtr());
2452 caseType::Attributed:
2454cast<AttributedType>(
T)->getEquivalentType().getTypePtr());
2456 caseType::CountAttributed:
2457 return getTypeInfo(cast<CountAttributedType>(
T)->desugar().getTypePtr());
2459 caseType::BTFTagAttributed:
2461cast<BTFTagAttributedType>(
T)->getWrappedType().getTypePtr());
2463 caseType::HLSLAttributedResource:
2465cast<HLSLAttributedResourceType>(
T)->getWrappedType().getTypePtr());
2467 caseType::Atomic: {
2470Width = Info.
Width;
2471Align = Info.
Align;
2476Width =
Target->getCharWidth();
2478}
else if(Width <= Target->getMaxAtomicPromoteWidth()) {
2484Width = llvm::bit_ceil(Width);
2487Align =
static_cast<unsigned>(Width);
2498assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2499 return TypeInfo(Width, Align, AlignRequirement);
2503UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(
T);
2504 if(I != MemoizedUnadjustedAlign.end())
2507 unsignedUnadjustedAlign;
2519MemoizedUnadjustedAlign[
T] = UnadjustedAlign;
2520 returnUnadjustedAlign;
2524 unsignedSimdAlign = llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(
2574 unsignedABIAlign = TI.
Align;
2582 if(!
Target->allowsLargerPreferedTypeAlignment())
2596 unsignedPreferredAlign =
static_cast<unsigned>(
2598assert(PreferredAlign >= ABIAlign &&
2599 "PreferredAlign should be at least as large as ABIAlign.");
2600 returnPreferredAlign;
2607 T= CT->getElementType().getTypePtr();
2609 T= ET->getDecl()->getIntegerType().getTypePtr();
2614 Target->defaultsToAIXPowerAlignment()))
2618 returnstd::max(ABIAlign, (
unsigned)
getTypeSize(
T));
2669 for(
unsignedI = 0, N =
Path.size(); I != N; ++I) {
2673std::swap(
Base, Derived);
2693llvm::append_range(Ivars, OI->
ivars());
2696 for(
const ObjCIvarDecl*Iv = IDecl->all_declared_ivar_begin(); Iv;
2698Ivars.push_back(Iv);
2706 if(
const auto*OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2709 for(
auto*Proto : OI->all_referenced_protocols()) {
2714 for(
const auto*Cat : OI->visible_categories())
2720SD = SD->getSuperClass();
2722}
else if(
const auto*OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2723 for(
auto*Proto : OC->protocols()) {
2726}
else if(
const auto*OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2728 if(!Protocols.insert(
2732 for(
auto*Proto : OP->protocols())
2739 boolCheckIfTriviallyCopyable) {
2740assert(RD->
isUnion() &&
"Must be union type");
2743 for(
const auto*Field : RD->
fields()) {
2745CheckIfTriviallyCopyable))
2748 if(FieldSize != UnionSize)
2766staticstd::optional<int64_t>
2769 boolCheckIfTriviallyCopyable);
2771staticstd::optional<int64_t>
2773 boolCheckIfTriviallyCopyable) {
2774 if(Field->getType()->isRecordType()) {
2775 const RecordDecl*RD = Field->getType()->getAsRecordDecl();
2778CheckIfTriviallyCopyable);
2783 boolIsBitIntType = Field->getType()->isBitIntType();
2784 if(!Field->getType()->isReferenceType() && !IsBitIntType &&
2786CheckIfTriviallyCopyable))
2787 returnstd::nullopt;
2789int64_t FieldSizeInBits =
2791 if(Field->isBitField()) {
2794 if(Field->isUnnamedBitField())
2797int64_t BitfieldSize = Field->getBitWidthValue();
2799 if((
unsigned)BitfieldSize >
2800cast<BitIntType>(Field->getType())->getNumBits())
2801 returnstd::nullopt;
2802}
else if(BitfieldSize > FieldSizeInBits) {
2803 returnstd::nullopt;
2805FieldSizeInBits = BitfieldSize;
2807Field->getType(), CheckIfTriviallyCopyable)) {
2808 returnstd::nullopt;
2810 returnFieldSizeInBits;
2813staticstd::optional<int64_t>
2815 boolCheckIfTriviallyCopyable) {
2817CheckIfTriviallyCopyable);
2820template<
typenameRangeT>
2822 constRangeT &Subobjects, int64_t CurOffsetInBits,
2824 boolCheckIfTriviallyCopyable) {
2825 for(
const auto*Subobject : Subobjects) {
2826std::optional<int64_t> SizeInBits =
2829 returnstd::nullopt;
2830 if(*SizeInBits != 0) {
2832 if(Offset != CurOffsetInBits)
2833 returnstd::nullopt;
2834CurOffsetInBits += *SizeInBits;
2837 returnCurOffsetInBits;
2840staticstd::optional<int64_t>
2843 boolCheckIfTriviallyCopyable) {
2844assert(!RD->
isUnion() &&
"Must be struct/class type");
2847int64_t CurOffsetInBits = 0;
2848 if(
const auto*ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2849 if(ClassDecl->isDynamicClass())
2850 returnstd::nullopt;
2853 for(
const auto&
Base: ClassDecl->bases()) {
2856Bases.emplace_back(
Base.getType()->getAsCXXRecordDecl());
2860 returnLayout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R);
2863std::optional<int64_t> OffsetAfterBases =
2865Bases, CurOffsetInBits, Context, Layout, CheckIfTriviallyCopyable);
2866 if(!OffsetAfterBases)
2867 returnstd::nullopt;
2868CurOffsetInBits = *OffsetAfterBases;
2871std::optional<int64_t> OffsetAfterFields =
2873RD->
fields(), CurOffsetInBits, Context, Layout,
2874CheckIfTriviallyCopyable);
2875 if(!OffsetAfterFields)
2876 returnstd::nullopt;
2877CurOffsetInBits = *OffsetAfterFields;
2879 returnCurOffsetInBits;
2883 QualTypeTy,
boolCheckIfTriviallyCopyable)
const{
2900assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2905CheckIfTriviallyCopyable);
2908 "hasUniqueObjectRepresentations should not be called with an " 2909 "incomplete type");
2929 return!ABI->getMemberPointerInfo(MPT).HasPadding;
2934 if(
Record->isInvalidDecl())
2939CheckIfTriviallyCopyable);
2942*
this,
Record, CheckIfTriviallyCopyable);
2944 returnStructSize && *StructSize ==
static_cast<int64_t
>(
getTypeSize(Ty));
2965count += Ext->ivar_size();
2970count += ImplDecl->ivar_size();
2988 if(isa<GNUNullExpr>(
E))
return true;
2996llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2997I = ObjCImpls.find(
D);
2998 if(I != ObjCImpls.end())
2999 returncast<ObjCImplementationDecl>(I->second);
3006llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
3007I = ObjCImpls.find(
D);
3008 if(I != ObjCImpls.end())
3009 returncast<ObjCCategoryImplDecl>(I->second);
3016assert(IFaceD && ImplD &&
"Passed null params");
3017ObjCImpls[IFaceD] = ImplD;
3023assert(CatD && ImplD &&
"Passed null params");
3024ObjCImpls[CatD] = ImplD;
3029 returnObjCMethodRedecls.lookup(MD);
3035ObjCMethodRedecls[MD] = Redecl;
3040 if(
const auto*ID = dyn_cast<ObjCInterfaceDecl>(ND->
getDeclContext()))
3042 if(
const auto*CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
3043 returnCD->getClassInterface();
3044 if(
const auto*IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
3045 returnIMD->getClassInterface();
3053assert(VD &&
"Passed null params");
3054assert(VD->
hasAttr<BlocksAttr>() &&
3055 "getBlockVarCopyInits - not __block var");
3056 autoI = BlockVarCopyInits.find(VD);
3057 if(I != BlockVarCopyInits.end())
3059 return{
nullptr,
false};
3065assert(VD && CopyExpr &&
"Passed null params");
3066assert(VD->
hasAttr<BlocksAttr>() &&
3067 "setBlockVarCopyInits - not __block var");
3068BlockVarCopyInits[VD].setExprAndFlag(CopyExpr,
CanThrow);
3072 unsignedDataSize)
const{
3077 "incorrect data size provided to CreateTypeSourceInfo!");
3094 returngetObjCLayout(
D,
nullptr);
3100 returngetObjCLayout(
D->getClassInterface(),
D);
3105 bool&AnyNonCanonArgs) {
3107 for(
auto&Arg : CanonArgs) {
3109Arg =
C.getCanonicalTemplateArgument(Arg);
3110AnyNonCanonArgs |= !Arg.structurallyEquals(OrigArg);
3120ASTContext::getExtQualType(
const Type*baseType,
Qualifiersquals)
const{
3125llvm::FoldingSetNodeID
ID;
3127 void*insertPos =
nullptr;
3128 if(
ExtQuals*eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
3129assert(eq->getQualifiers() == quals);
3138canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
3141(void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
3144 auto*eq =
new(*
this,
alignof(
ExtQuals))
ExtQuals(baseType, canon, quals);
3145ExtQualNodes.InsertNode(eq, insertPos);
3150 LangASAddressSpace)
const{
3163 "Type cannot be in multiple addr spaces!");
3166 returngetExtQualType(TypeNode, Quals);
3172 if(!
T.hasAddressSpace())
3176 const Type*TypeNode;
3181TypeNode =
T.getTypePtr();
3185 while(
T.hasAddressSpace()) {
3186TypeNode = Quals.
strip(
T);
3190 if(!
QualType(TypeNode, 0).hasAddressSpace())
3194 T=
T.getSingleStepDesugaredType(*
this);
3204 returngetExtQualType(TypeNode, Quals);
3212 "Attempted to get vtable pointer discriminator on a monomorphic type");
3215llvm::raw_svector_ostream Out(Str);
3216MC->mangleCXXVTable(RD, Out);
3217 returnllvm::getPointerAuthStableSipHash(Str);
3246Ctx, OS, cast<AtomicType>(
T)->getValueType());
3248 caseType::LValueReference:
3253 caseType::RValueReference:
3267 caseType::ObjCObjectPointer:
3268 caseType::BlockPointer:
3275Ctx, OS, cast<ComplexType>(
T)->getElementType());
3277 caseType::VariableArray:
3278 caseType::ConstantArray:
3279 caseType::IncompleteArray:
3280 caseType::ArrayParameter:
3291Ctx, OS, cast<ArrayType>(
T)->getElementType());
3293 caseType::ObjCInterface:
3294 caseType::ObjCObject:
3295OS <<
"<objc_object>";
3304 QualTypeUnderlyingType = cast<EnumType>(
T)->getDecl()->getIntegerType();
3306Ctx, OS, UnderlyingType.
isNull() ? Ctx.
IntTy: UnderlyingType);
3309 caseType::FunctionNoProto:
3310 caseType::FunctionProto: {
3324 const auto*FuncType = cast<FunctionType>(
T);
3326 if(
const auto*FPT = dyn_cast<FunctionProtoType>(FuncType)) {
3327 for(
QualTypeParam : FPT->param_types()) {
3331 if(FPT->isVariadic())
3338 caseType::MemberPointer: {
3345 caseType::ExtVector:
3353 caseType::ConstantMatrix:
3357 caseType::Builtin: {
3359 switch(BTy->getKind()) {
3360#define SIGNED_TYPE(Id, SingletonId) \ 3361 case BuiltinType::Id: \ 3364#define UNSIGNED_TYPE(Id, SingletonId) \ 3365 case BuiltinType::Id: \ 3368#define PLACEHOLDER_TYPE(Id, SingletonId) case BuiltinType::Id: 3369#define BUILTIN_TYPE(Id, SingletonId) 3370#include "clang/AST/BuiltinTypes.def" 3371llvm_unreachable(
"placeholder types should not appear here.");
3373 caseBuiltinType::Half:
3376 caseBuiltinType::Float:
3379 caseBuiltinType::Double:
3382 caseBuiltinType::LongDouble:
3385 caseBuiltinType::Float16:
3388 caseBuiltinType::Float128:
3392 caseBuiltinType::Void:
3396 caseBuiltinType::ObjCId:
3397 caseBuiltinType::ObjCClass:
3398 caseBuiltinType::ObjCSel:
3399 caseBuiltinType::NullPtr:
3404 caseBuiltinType::OCLSampler:
3405 caseBuiltinType::OCLEvent:
3406 caseBuiltinType::OCLClkEvent:
3407 caseBuiltinType::OCLQueue:
3408 caseBuiltinType::OCLReserveID:
3409 caseBuiltinType::BFloat16:
3410 caseBuiltinType::VectorQuad:
3411 caseBuiltinType::VectorPair:
3416 caseBuiltinType::Ibm128:
3418#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 3419 case BuiltinType::Id: \ 3421#include "clang/Basic/OpenCLImageTypes.def" 3422#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 3423 case BuiltinType::Id: \ 3425#include "clang/Basic/OpenCLExtensionTypes.def" 3426#define SVE_TYPE(Name, Id, SingletonId) \ 3427 case BuiltinType::Id: \ 3429#include "clang/Basic/AArch64SVEACLETypes.def" 3430#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) \ 3431 case BuiltinType::Id: \ 3433#include "clang/Basic/HLSLIntangibleTypes.def" 3434 caseBuiltinType::Dependent:
3435llvm_unreachable(
"should never get here");
3436#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id: 3437#include "clang/Basic/AMDGPUTypes.def" 3438 caseBuiltinType::WasmExternRef:
3439#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id: 3440#include "clang/Basic/RISCVVTypes.def" 3441llvm_unreachable(
"not yet implemented");
3443llvm_unreachable(
"should never get here");
3445 caseType::Record: {
3466II = Typedef->getDeclName().getAsIdentifierInfo();
3469OS <<
"<anonymous_record>";
3475 caseType::HLSLAttributedResource:
3476llvm_unreachable(
"should never get here");
3478 caseType::DeducedTemplateSpecialization:
3480#define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 3481#define DEPENDENT_TYPE(Class, Base) case Type::Class: 3482#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: 3483#define ABSTRACT_TYPE(Class, Base) 3484#define TYPE(Class, Base) 3485#include "clang/AST/TypeNodes.inc" 3486llvm_unreachable(
"unexpected non-canonical or dependent type!");
3493 "cannot compute type discriminator of a dependent type");
3496llvm::raw_svector_ostream Out(Str);
3504 T=
T.getUnqualifiedType();
3525 if(MPT->isMemberFunctionPointer()) {
3534MC->mangleCanonicalTypeName(
T, Out);
3537 returnllvm::getPointerAuthStableSipHash(Str);
3562 "Type cannot have multiple ObjCGCs!");
3565 returngetExtQualType(TypeNode, Quals);
3579 QualTypeWrappedTy,
Expr*CountExpr,
boolCountInBytes,
boolOrNull,
3583llvm::FoldingSetNodeID ID;
3586 void*InsertPos =
nullptr;
3588CountAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
3593 size_tSize = CountAttributedType::totalSizeToAlloc<TypeCoupledDeclRefInfo>(
3594DependentDecls.size());
3597OrNull, DependentDecls);
3598Types.push_back(CATy);
3599CountAttributedTypes.InsertNode(CATy, InsertPos);
3608 caseType::Attributed: {
3609 const auto*AT = cast<AttributedType>(Orig);
3612 adjustType(AT->getEquivalentType(), Adjust),
3616 caseType::BTFTagAttributed: {
3617 const auto*BTFT = dyn_cast<BTFTagAttributedType>(Orig);
3619 adjustType(BTFT->getWrappedType(), Adjust));
3622 caseType::Elaborated: {
3623 const auto*ET = cast<ElaboratedType>(Orig);
3630 adjustType(cast<ParenType>(Orig)->getInnerType(), Adjust));
3632 caseType::Adjusted: {
3633 const auto*AT = cast<AdjustedType>(Orig);
3638 caseType::MacroQualified: {
3639 const auto*MQT = cast<MacroQualifiedType>(Orig);
3641MQT->getMacroIdentifier());
3645 returnAdjust(Orig);
3655 if(
const auto*FNPT = dyn_cast<FunctionNoProtoType>(
T)) {
3658 const auto*FPT = cast<FunctionProtoType>(
T);
3664 returncast<FunctionType>(
Result.getTypePtr());
3675FPT->getExtProtoInfo());
3690L->DeducedReturnType(FD, ResultType);
3701 return getFunctionType(Proto->getReturnType(), Proto->getParamTypes(),
3702Proto->getExtProtoInfo().withExceptionSpec(ESI));
3718 for(
unsignedi = 0, n = Args.size(); i != n; ++i)
3741 return getFunctionType(Proto->getReturnType(), Proto->param_types(), EPI);
3767 if(TSInfo->getType() != FD->
getType())
3775 "TypeLoc size mismatch from updating exception specification");
3776TSInfo->overrideType(Updated);
3785llvm::FoldingSetNodeID ID;
3788 void*InsertPos =
nullptr;
3789 if(
ComplexType*CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
3795 if(!
T.isCanonical()) {
3799 ComplexType*NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
3800assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3803Types.push_back(New);
3804ComplexTypes.InsertNode(New, InsertPos);
3813llvm::FoldingSetNodeID ID;
3816 void*InsertPos =
nullptr;
3817 if(
PointerType*PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3823 if(!
T.isCanonical()) {
3827 PointerType*NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3828assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3831Types.push_back(New);
3832PointerTypes.InsertNode(New, InsertPos);
3837llvm::FoldingSetNodeID ID;
3839 void*InsertPos =
nullptr;
3840 AdjustedType*AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3847AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3848assert(!AT &&
"Shouldn't be in the map!");
3852Types.push_back(AT);
3853AdjustedTypes.InsertNode(AT, InsertPos);
3858llvm::FoldingSetNodeID ID;
3860 void*InsertPos =
nullptr;
3861 AdjustedType*AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3868AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3869assert(!AT &&
"Shouldn't be in the map!");
3872Types.push_back(AT);
3873AdjustedTypes.InsertNode(AT, InsertPos);
3904 const auto*ATy = cast<ConstantArrayType>(Ty);
3905llvm::FoldingSetNodeID ID;
3906ATy->Profile(ID, *
this, ATy->getElementType(), ATy->getZExtSize(),
3907ATy->getSizeExpr(), ATy->getSizeModifier(),
3908ATy->getIndexTypeQualifiers().getAsOpaqueValue());
3909 void*InsertPos =
nullptr;
3911ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3920AT = ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3921assert(!AT &&
"Shouldn't be in the map!");
3926Types.push_back(AT);
3927ArrayParameterTypes.InsertNode(AT, InsertPos);
3937llvm::FoldingSetNodeID ID;
3940 void*InsertPos =
nullptr;
3942BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3948 if(!
T.isCanonical()) {
3953BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3954assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3958Types.push_back(New);
3959BlockPointerTypes.InsertNode(New, InsertPos);
3969 "Unresolved placeholder type");
3973llvm::FoldingSetNodeID ID;
3976 void*InsertPos =
nullptr;
3978LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3986 if(!SpelledAsLValue || InnerRef || !
T.isCanonical()) {
3987 QualTypePointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
3992LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3993assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3998Types.push_back(New);
3999LValueReferenceTypes.InsertNode(New, InsertPos);
4009 "Unresolved placeholder type");
4013llvm::FoldingSetNodeID ID;
4016 void*InsertPos =
nullptr;
4018RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
4026 if(InnerRef || !
T.isCanonical()) {
4027 QualTypePointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
4032RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
4033assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4038Types.push_back(New);
4039RValueReferenceTypes.InsertNode(New, InsertPos);
4048llvm::FoldingSetNodeID ID;
4051 void*InsertPos =
nullptr;
4053MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4064MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4065assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4069Types.push_back(New);
4070MemberPointerTypes.InsertNode(New, InsertPos);
4077 constllvm::APInt &ArySizeIn,
4078 const Expr*SizeExpr,
4080 unsignedIndexTypeQuals)
const{
4083 "Constant array of VLAs is illegal!");
4087SizeExpr =
nullptr;
4091llvm::APInt ArySize(ArySizeIn);
4092ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
4094llvm::FoldingSetNodeID ID;
4096ASM, IndexTypeQuals);
4098 void*InsertPos =
nullptr;
4100ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
4111ASM, IndexTypeQuals);
4116ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
4117assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4120 auto*New = ConstantArrayType::Create(*
this, EltTy, Canon, ArySize, SizeExpr,
4121ASM, IndexTypeQuals);
4122ConstantArrayTypes.InsertNode(New, InsertPos);
4123Types.push_back(New);
4132 if(!
type->isVariablyModifiedType())
return type;
4137 const Type*ty = split.
Ty;
4139#define TYPE(Class, Base) 4140#define ABSTRACT_TYPE(Class, Base) 4141#define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 4142#include "clang/AST/TypeNodes.inc" 4143llvm_unreachable(
"didn't desugar past all non-canonical types?");
4149 caseType::DependentVector:
4150 caseType::ExtVector:
4151 caseType::DependentSizedExtVector:
4152 caseType::ConstantMatrix:
4153 caseType::DependentSizedMatrix:
4154 caseType::DependentAddressSpace:
4155 caseType::ObjCObject:
4156 caseType::ObjCInterface:
4157 caseType::ObjCObjectPointer:
4160 caseType::UnresolvedUsing:
4161 caseType::TypeOfExpr:
4163 caseType::Decltype:
4164 caseType::UnaryTransform:
4165 caseType::DependentName:
4166 caseType::InjectedClassName:
4167 caseType::TemplateSpecialization:
4168 caseType::DependentTemplateSpecialization:
4169 caseType::TemplateTypeParm:
4170 caseType::SubstTemplateTypeParmPack:
4172 caseType::DeducedTemplateSpecialization:
4173 caseType::PackExpansion:
4174 caseType::PackIndexing:
4176 caseType::DependentBitInt:
4177 caseType::ArrayParameter:
4178 caseType::HLSLAttributedResource:
4179llvm_unreachable(
"type should never be variably-modified");
4183 caseType::FunctionNoProto:
4184 caseType::FunctionProto:
4185 caseType::BlockPointer:
4186 caseType::MemberPointer:
4199 caseType::LValueReference: {
4200 const auto*lv = cast<LValueReferenceType>(ty);
4203lv->isSpelledAsLValue());
4207 caseType::RValueReference: {
4208 const auto*lv = cast<RValueReferenceType>(ty);
4214 caseType::Atomic: {
4215 const auto*at = cast<AtomicType>(ty);
4220 caseType::ConstantArray: {
4221 const auto*cat = cast<ConstantArrayType>(ty);
4226cat->getSizeModifier(),
4227cat->getIndexTypeCVRQualifiers());
4231 caseType::DependentSizedArray: {
4232 const auto*dat = cast<DependentSizedArrayType>(ty);
4236dat->getSizeModifier(),
4237dat->getIndexTypeCVRQualifiers(),
4238dat->getBracketsRange());
4243 caseType::IncompleteArray: {
4244 const auto*iat = cast<IncompleteArrayType>(ty);
4248iat->getIndexTypeCVRQualifiers(),
SourceRange());
4253 caseType::VariableArray: {
4254 const auto*vat = cast<VariableArrayType>(ty);
4258vat->getIndexTypeCVRQualifiers(), vat->getBracketsRange());
4271 unsignedIndexTypeQuals,
4282IndexTypeQuals, Brackets);
4289VariableArrayTypes.push_back(New);
4290Types.push_back(New);
4300 unsignedelementTypeQuals,
4304 "Size must be type- or value-dependent!");
4308 void*insertPos =
nullptr;
4309llvm::FoldingSetNodeID ID;
4311ID, *
this, numElements ?
QualType(canonElementType.
Ty, 0) : elementType,
4312ASM, elementTypeQuals, numElements);
4316DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
4327elementTypeQuals, brackets);
4328DependentSizedArrayTypes.InsertNode(newType, insertPos);
4329Types.push_back(newType);
4337numElements, ASM, elementTypeQuals, brackets);
4338DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
4339Types.push_back(canonTy);
4344canonElementType.
Quals);
4348 if(
QualType(canonElementType.
Ty, 0) == elementType &&
4356elementTypeQuals, brackets);
4357Types.push_back(sugaredType);
4363 unsignedelementTypeQuals)
const{
4364llvm::FoldingSetNodeID ID;
4367 void*insertPos =
nullptr;
4369IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
4381ASM, elementTypeQuals);
4386IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
4387assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
4393IncompleteArrayTypes.InsertNode(newType, insertPos);
4394Types.push_back(newType);
4400#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS) \ 4401 {getIntTypeForBitwidth(BITS, SIGNED), llvm::ElementCount::getScalable(ELTS), \ 4404#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS) \ 4405 {ELTTY, llvm::ElementCount::getScalable(ELTS), NUMVECTORS}; 4409llvm_unreachable(
"Unsupported builtin vector type");
4411#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \ 4412 ElBits, NF, IsSigned) \ 4413 case BuiltinType::Id: \ 4414 return {getIntTypeForBitwidth(ElBits, IsSigned), \ 4415 llvm::ElementCount::getScalable(NumEls), NF}; 4416#define SVE_VECTOR_TYPE_FLOAT(Name, MangledName, Id, SingletonId, NumEls, \ 4418 case BuiltinType::Id: \ 4419 return {ElBits == 16 ? HalfTy : (ElBits == 32 ? FloatTy : DoubleTy), \ 4420 llvm::ElementCount::getScalable(NumEls), NF}; 4421#define SVE_VECTOR_TYPE_BFLOAT(Name, MangledName, Id, SingletonId, NumEls, \ 4423 case BuiltinType::Id: \ 4424 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF}; 4425#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \ 4427 case BuiltinType::Id: \ 4428 return {MFloat8Ty, llvm::ElementCount::getScalable(NumEls), NF}; 4429#define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \ 4430 case BuiltinType::Id: \ 4431 return {BoolTy, llvm::ElementCount::getScalable(NumEls), NF}; 4432#define SVE_TYPE(Name, Id, SingletonId) 4433#include "clang/Basic/AArch64SVEACLETypes.def" 4435#define RVV_VECTOR_TYPE_INT(Name, Id, SingletonId, NumEls, ElBits, NF, \ 4437 case BuiltinType::Id: \ 4438 return {getIntTypeForBitwidth(ElBits, IsSigned), \ 4439 llvm::ElementCount::getScalable(NumEls), NF}; 4440#define RVV_VECTOR_TYPE_FLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \ 4441 case BuiltinType::Id: \ 4442 return {ElBits == 16 ? Float16Ty : (ElBits == 32 ? FloatTy : DoubleTy), \ 4443 llvm::ElementCount::getScalable(NumEls), NF}; 4444#define RVV_VECTOR_TYPE_BFLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \ 4445 case BuiltinType::Id: \ 4446 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF}; 4447#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \ 4448 case BuiltinType::Id: \ 4449 return {BoolTy, llvm::ElementCount::getScalable(NumEls), 1}; 4450#include "clang/Basic/RISCVVTypes.def" 4457 if(
Target->getTriple().isWasm() &&
Target->hasFeature(
"reference-types")) {
4458#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \ 4459 if (BuiltinType::Id == BuiltinType::WasmExternRef) \ 4461#include "clang/Basic/WebAssemblyReferenceTypes.def" 4464 "shouldn't try to generate type externref outside WebAssembly target");
4471 unsignedNumFields)
const{
4472 if(
Target->hasAArch64SVETypes()) {
4475#define SVE_VECTOR_TYPE_INT(Name, MangledName, Id, SingletonId, NumEls, \ 4476 ElBits, NF, IsSigned) \ 4477 if (EltTy->hasIntegerRepresentation() && !EltTy->isBooleanType() && \ 4478 EltTy->hasSignedIntegerRepresentation() == IsSigned && \ 4479 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \ 4480 return SingletonId; \ 4482#define SVE_VECTOR_TYPE_FLOAT(Name, MangledName, Id, SingletonId, NumEls, \ 4484 if (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \ 4485 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \ 4486 return SingletonId; \ 4488#define SVE_VECTOR_TYPE_BFLOAT(Name, MangledName, Id, SingletonId, NumEls, \ 4490 if (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \ 4491 EltTySize == ElBits && NumElts == (NumEls * NF) && NumFields == 1) { \ 4492 return SingletonId; \ 4494#define SVE_VECTOR_TYPE_MFLOAT(Name, MangledName, Id, SingletonId, NumEls, \ 4496 if (EltTy->isMFloat8Type() && EltTySize == ElBits && \ 4497 NumElts == (NumEls * NF) && NumFields == 1) { \ 4498 return SingletonId; \ 4500#define SVE_PREDICATE_TYPE_ALL(Name, MangledName, Id, SingletonId, NumEls, NF) \ 4501 if (EltTy->isBooleanType() && NumElts == (NumEls * NF) && NumFields == 1) \ 4503#define SVE_TYPE(Name, Id, SingletonId) 4504#include "clang/Basic/AArch64SVEACLETypes.def" 4505}
else if(
Target->hasRISCVVTypes()) {
4507#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \ 4509 if (!EltTy->isBooleanType() && \ 4510 ((EltTy->hasIntegerRepresentation() && \ 4511 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \ 4512 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \ 4514 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \ 4515 IsBF && !IsFP)) && \ 4516 EltTySize == ElBits && NumElts == NumEls && NumFields == NF) \ 4518#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \ 4519 if (EltTy->isBooleanType() && NumElts == NumEls) \ 4521#include "clang/Basic/RISCVVTypes.def" 4537llvm::FoldingSetNodeID ID;
4540 void*InsertPos =
nullptr;
4541 if(
VectorType*VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4551 VectorType*NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4552assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4554 auto*New =
new(*
this,
alignof(
VectorType))
4555 VectorType(vecType, NumElts, Canonical, VecKind);
4556VectorTypes.InsertNode(New, InsertPos);
4557Types.push_back(New);
4564llvm::FoldingSetNodeID ID;
4567 void*InsertPos =
nullptr;
4569DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4574VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
4577 if(CanonVecTy == VecType) {
4582DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4583assert(!CanonCheck &&
4584 "Dependent-sized vector_size canonical type broken");
4586DependentVectorTypes.InsertNode(New, InsertPos);
4595Types.push_back(New);
4602 unsignedNumElts)
const{
4610llvm::FoldingSetNodeID ID;
4613 void*InsertPos =
nullptr;
4614 if(
VectorType*VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4624 VectorType*NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4625assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4629VectorTypes.InsertNode(New, InsertPos);
4630Types.push_back(New);
4638llvm::FoldingSetNodeID ID;
4642 void*InsertPos =
nullptr;
4644= DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4654 if(CanonVecTy == vecType) {
4659= DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4660assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
4662DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
4671Types.push_back(New);
4676 unsignedNumColumns)
const{
4677llvm::FoldingSetNodeID ID;
4679Type::ConstantMatrix);
4682 "need a valid element type");
4685 "need valid matrix dimensions");
4686 void*InsertPos =
nullptr;
4696assert(!NewIP &&
"Matrix type shouldn't already exist in the map");
4702MatrixTypes.InsertNode(New, InsertPos);
4703Types.push_back(New);
4712llvm::FoldingSetNodeID ID;
4716 void*InsertPos =
nullptr;
4718DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4723ColumnExpr, AttrLoc);
4726DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4727assert(!CanonCheck &&
"Dependent-sized matrix canonical type broken");
4729DependentSizedMatrixTypes.InsertNode(Canon, InsertPos);
4730Types.push_back(Canon);
4743ColumnExpr, AttrLoc);
4744Types.push_back(New);
4749 Expr*AddrSpaceExpr,
4755 void*insertPos =
nullptr;
4756llvm::FoldingSetNodeID ID;
4761DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
4767DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
4768Types.push_back(canonTy);
4771 if(canonPointeeType == PointeeType &&
4777AddrSpaceExpr, AttrLoc);
4778Types.push_back(sugaredType);
4784 return T.isCanonical() &&
4802llvm::FoldingSetNodeID ID;
4805 void*InsertPos =
nullptr;
4807FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
4817FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4818assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4823Types.push_back(New);
4824FunctionNoProtoTypes.InsertNode(New, InsertPos);
4840 returnCanResultType;
4847 if(!NoexceptInType)
4864 boolAnyPackExpansions =
false;
4869AnyPackExpansions =
true;
4871 returnAnyPackExpansions;
4877QualTypeASTContext::getFunctionTypeInternal(
4880 size_tNumArgs = ArgArray.size();
4884llvm::FoldingSetNodeID
ID;
4889 boolUnique =
false;
4891 void*InsertPos =
nullptr;
4893FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4913 boolIsCanonicalExceptionSpec =
4917 boolisCanonical = !Unique && IsCanonicalExceptionSpec &&
4919 for(
unsignedi = 0; i != NumArgs && isCanonical; ++i)
4920 if(!ArgArray[i].isCanonicalAsParam())
4921isCanonical =
false;
4923 if(OnlyWantCanonical)
4924assert(isCanonical &&
4925 "given non-canonical parameters constructing canonical type");
4930 if(!isCanonical && Canonical.
isNull()) {
4932CanonicalArgs.reserve(NumArgs);
4933 for(
unsignedi = 0; i != NumArgs; ++i)
4940 if(IsCanonicalExceptionSpec) {
4942}
else if(NoexceptInType) {
4955 boolAnyPacks =
false;
4978llvm_unreachable(
"dependent noexcept is already canonical");
4987getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
4991FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4992assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4997 autoESH = FunctionProtoType::getExceptionSpecSize(
4999 size_t Size= FunctionProtoType::totalSizeToAlloc<
5006ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
5014Types.push_back(FTP);
5016FunctionProtoTypes.InsertNode(FTP, InsertPos);
5018AnyFunctionEffects =
true;
5023llvm::FoldingSetNodeID
ID;
5026 void*InsertPos =
nullptr;
5027 if(
PipeType*PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
5033 if(!
T.isCanonical()) {
5037 PipeType*NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
5038assert(!NewIP &&
"Shouldn't be in the map!");
5041 auto*New =
new(*
this,
alignof(
PipeType))
PipeType(
T, Canonical, ReadOnly);
5042Types.push_back(New);
5043PipeTypes.InsertNode(New, InsertPos);
5054 returngetPipeType(
T,
true);
5058 returngetPipeType(
T,
false);
5062llvm::FoldingSetNodeID ID;
5065 void*InsertPos =
nullptr;
5066 if(
BitIntType*EIT = BitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
5070BitIntTypes.InsertNode(New, InsertPos);
5071Types.push_back(New);
5076 Expr*NumBitsExpr)
const{
5078llvm::FoldingSetNodeID ID;
5081 void*InsertPos =
nullptr;
5083DependentBitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
5088DependentBitIntTypes.InsertNode(New, InsertPos);
5090Types.push_back(New);
5096 if(!isa<CXXRecordDecl>(
D))
return false;
5097 const auto*RD = cast<CXXRecordDecl>(
D);
5098 if(isa<ClassTemplatePartialSpecializationDecl>(RD))
5100 if(RD->getDescribedClassTemplate() &&
5101!isa<ClassTemplateSpecializationDecl>(RD))
5112 if(
Decl->TypeForDecl) {
5113assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
5115assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
5116 Decl->TypeForDecl = PrevDecl->TypeForDecl;
5117assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
5121 Decl->TypeForDecl = newType;
5122Types.push_back(newType);
5130assert(
Decl&&
"Passed null for Decl param");
5131assert(!
Decl->TypeForDecl &&
"TypeForDecl present in slow case");
5133 if(
const auto*Typedef = dyn_cast<TypedefNameDecl>(
Decl))
5136assert(!isa<TemplateTypeParmDecl>(
Decl) &&
5137 "Template type parameter types are always available.");
5139 if(
const auto*
Record= dyn_cast<RecordDecl>(
Decl)) {
5140assert(
Record->isFirstDecl() &&
"struct/union has previous declaration");
5143}
else if(
const auto*
Enum= dyn_cast<EnumDecl>(
Decl)) {
5144assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
5146}
else if(
const auto*Using = dyn_cast<UnresolvedUsingTypenameDecl>(
Decl)) {
5149llvm_unreachable(
"TypeDecl without a type?");
5158 if(!
Decl->TypeForDecl) {
5159 if(Underlying.
isNull())
5160Underlying =
Decl->getUnderlyingType();
5163 Decl->TypeForDecl = NewType;
5164Types.push_back(NewType);
5167 if(Underlying.
isNull() ||
Decl->getUnderlyingType() == Underlying)
5171llvm::FoldingSetNodeID ID;
5174 void*InsertPos =
nullptr;
5175 if(
TypedefType*
T= TypedefTypes.FindNodeOrInsertPos(ID, InsertPos)) {
5176assert(!
T->typeMatchesDecl() &&
5177 "non-divergent case should be handled with TypeDecl");
5181 void*Mem =
Allocate(TypedefType::totalSizeToAlloc<QualType>(
true),
5183 auto*NewType =
new(Mem)
TypedefType(Type::Typedef,
Decl, Underlying,
5185TypedefTypes.InsertNode(NewType, InsertPos);
5186Types.push_back(NewType);
5192llvm::FoldingSetNodeID ID;
5195 void*InsertPos =
nullptr;
5196 if(
UsingType*
T= UsingTypes.FindNodeOrInsertPos(ID, InsertPos))
5199 const Type*TypeForDecl =
5200cast<TypeDecl>(
Found->getTargetDecl())->getTypeForDecl();
5206 if(Underlying.
getTypePtr() == TypeForDecl)
5209 Allocate(UsingType::totalSizeToAlloc<QualType>(!Underlying.
isNull()),
5212Types.push_back(NewType);
5213UsingTypes.InsertNode(NewType, InsertPos);
5221 if(PrevDecl->TypeForDecl)
5222 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
5225 Decl->TypeForDecl = newType;
5226Types.push_back(newType);
5234 if(PrevDecl->TypeForDecl)
5235 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
5238 Decl->TypeForDecl = newType;
5239Types.push_back(newType);
5244 unsignedNumPositiveBits,
5247 unsignedIntWidth =
Target->getIntWidth();
5248 unsignedCharWidth =
Target->getCharWidth();
5249 unsignedShortWidth =
Target->getShortWidth();
5250 boolEnumTooLarge =
false;
5252 if(NumNegativeBits) {
5256 if(IsPacked && NumNegativeBits <= CharWidth &&
5257NumPositiveBits < CharWidth) {
5259BestWidth = CharWidth;
5260}
else if(IsPacked && NumNegativeBits <= ShortWidth &&
5261NumPositiveBits < ShortWidth) {
5263BestWidth = ShortWidth;
5264}
else if(NumNegativeBits <= IntWidth && NumPositiveBits < IntWidth) {
5266BestWidth = IntWidth;
5268BestWidth =
Target->getLongWidth();
5270 if(NumNegativeBits <= BestWidth && NumPositiveBits < BestWidth) {
5273BestWidth =
Target->getLongLongWidth();
5275 if(NumNegativeBits > BestWidth || NumPositiveBits >= BestWidth)
5276EnumTooLarge =
true;
5280BestPromotionType = (BestWidth <= IntWidth ?
IntTy: BestType);
5285 if(IsPacked && NumPositiveBits <= CharWidth) {
5287BestPromotionType =
IntTy;
5288BestWidth = CharWidth;
5289}
else if(IsPacked && NumPositiveBits <= ShortWidth) {
5291BestPromotionType =
IntTy;
5292BestWidth = ShortWidth;
5293}
else if(NumPositiveBits <= IntWidth) {
5295BestWidth = IntWidth;
5296BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5299}
else if(NumPositiveBits <= (BestWidth =
Target->getLongWidth())) {
5301BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5305BestWidth =
Target->getLongLongWidth();
5306 if(NumPositiveBits > BestWidth) {
5311EnumTooLarge =
true;
5314BestPromotionType = (NumPositiveBits == BestWidth || !LangOpts.CPlusPlus)
5319 returnEnumTooLarge;
5324 if(
Decl->TypeForDecl)
5329 if(CanonicalDecl->TypeForDecl)
5330 return QualType(
Decl->TypeForDecl = CanonicalDecl->TypeForDecl, 0);
5334 Decl->TypeForDecl = newType;
5335Types.push_back(newType);
5342 const Attr*attr)
const{
5343llvm::FoldingSetNodeID id;
5346 void*insertPos =
nullptr;
5350assert(!
attr||
attr->getKind() == attrKind);
5356Types.push_back(
type);
5357AttributedTypes.InsertNode(
type, insertPos);
5370 switch(nullability) {
5386llvm_unreachable(
"Unknown nullability kind");
5391llvm::FoldingSetNodeID ID;
5394 void*InsertPos =
nullptr;
5396BTFTagAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
5404Types.push_back(Ty);
5405BTFTagAttributedTypes.InsertNode(Ty, InsertPos);
5414llvm::FoldingSetNodeID ID;
5417 void*InsertPos =
nullptr;
5419HLSLAttributedResourceTypes.FindNodeOrInsertPos(ID, InsertPos);
5426Types.push_back(Ty);
5427HLSLAttributedResourceTypes.InsertNode(Ty, InsertPos);
5433 QualTypeReplacement,
Decl*AssociatedDecl,
unsignedIndex,
5434std::optional<unsigned> PackIndex,
5436llvm::FoldingSetNodeID ID;
5439 void*InsertPos =
nullptr;
5441SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5444 void*Mem =
Allocate(SubstTemplateTypeParmType::totalSizeToAlloc<QualType>(
5445!Replacement.isCanonical()),
5448Index, PackIndex, Flag);
5449Types.push_back(SubstParm);
5450SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
5459 unsignedIndex,
boolFinal,
5466llvm::FoldingSetNodeID ID;
5469 void*InsertPos =
nullptr;
5471SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
5481[[maybe_unused]]
const auto*Nothing =
5482SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
5490Types.push_back(SubstParm);
5491SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
5501llvm::FoldingSetNodeID ID;
5503 void*InsertPos =
nullptr;
5505= TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5516= TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
5517assert(!TypeCheck &&
"Template type parameter canonical type broken");
5521Depth, Index, ParameterPack,
nullptr,
QualType());
5523Types.push_back(TypeParm);
5524TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
5534assert(!Name.getAsDependentTemplateName() &&
5535 "No dependent template names here!");
5546 for(
unsignedi = 0, e = TL.
getNumArgs(); i != e; ++i)
5556 "No dependent template names here!");
5559ArgVec.reserve(Args.size());
5561ArgVec.push_back(Arg.getArgument());
5569 if(Arg.isPackExpansion())
5581 "No dependent template names here!");
5586 if(!Underlying.
isNull())
5592 "Caller must compute aliased type");
5593IsTypeAlias =
false;
5602(IsTypeAlias ?
sizeof(
QualType) : 0),
5606IsTypeAlias ? Underlying :
QualType());
5608Types.push_back(Spec);
5615 "No dependent template names here!");
5624 boolAnyNonCanonArgs =
false;
5630llvm::FoldingSetNodeID ID;
5632CanonArgs, *
this);
5634 void*InsertPos =
nullptr;
5636= TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5646Types.push_back(Spec);
5647TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
5651 "Non-dependent template-id type must have a canonical type");
5658 TagDecl*OwnedTagDecl)
const{
5659llvm::FoldingSetNodeID ID;
5662 void*InsertPos =
nullptr;
5663 ElaboratedType*
T= ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5670 ElaboratedType*CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5671assert(!CheckT &&
"Elaborated canonical type broken");
5676 Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
5678 T=
new(Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
5680Types.push_back(
T);
5681ElaboratedTypes.InsertNode(
T, InsertPos);
5687llvm::FoldingSetNodeID ID;
5690 void*InsertPos =
nullptr;
5691 ParenType*
T= ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5698 ParenType*CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5699assert(!CheckT &&
"Paren canonical type broken");
5704Types.push_back(
T);
5705ParenTypes.InsertNode(
T, InsertPos);
5718Types.push_back(newType);
5728 if(CanonNNS != NNS)
5732llvm::FoldingSetNodeID ID;
5735 void*InsertPos =
nullptr;
5737= DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
5743Types.push_back(
T);
5744DependentNameTypes.InsertNode(
T, InsertPos);
5753 for(
unsignedI = 0,
E= Args.size(); I !=
E; ++I)
5765 "nested-name-specifier must be dependent");
5767llvm::FoldingSetNodeID ID;
5771 void*InsertPos =
nullptr;
5773= DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5783 boolAnyNonCanonArgs =
false;
5788 if(AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
5794[[maybe_unused]]
auto*Nothing =
5795DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5796assert(!Nothing &&
"canonical type broken");
5804Types.push_back(
T);
5805DependentTemplateSpecializationTypes.InsertNode(
T, InsertPos);
5811 if(
const auto*TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
5817}
else if(
auto*NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
5819NTTP->getType().getNonPackExpansionType().getNonLValueExprType(*
this);
5834 Expr*
E=
new(*this)
5836 T, VK, NTTP->getLocation());
5838 if(NTTP->isParameterPack())
5843 auto*TTP = cast<TemplateTemplateParmDecl>(Param);
5860std::optional<unsigned> NumExpansions,
5861 boolExpectPackInType)
const{
5863 "Pack expansions must expand one or more parameter packs");
5865llvm::FoldingSetNodeID ID;
5868 void*InsertPos =
nullptr;
5880PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
5885Types.push_back(
T);
5886PackExpansionTypes.InsertNode(
T, InsertPos);
5898 if(Protocols.empty())
return true;
5903 for(
unsignedi = 1; i != Protocols.size(); ++i)
5913llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
5917 P=
P->getCanonicalDecl();
5920 autoProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
5921Protocols.erase(ProtocolsEnd, Protocols.end());
5926 unsignedNumProtocols)
const{
5936 boolisKindOf)
const{
5939 if(typeArgs.empty() && protocols.empty() && !isKindOf &&
5940isa<ObjCInterfaceType>(baseType))
5944llvm::FoldingSetNodeID ID;
5946 void*InsertPos =
nullptr;
5947 if(
ObjCObjectType*QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
5954 if(effectiveTypeArgs.empty()) {
5956effectiveTypeArgs = baseObject->getTypeArgs();
5963 booltypeArgsAreCanonical = llvm::all_of(
5966 if(!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
5970 if(!typeArgsAreCanonical) {
5971canonTypeArgsVec.reserve(effectiveTypeArgs.size());
5972 for(
autotypeArg : effectiveTypeArgs)
5974canonTypeArgs = canonTypeArgsVec;
5976canonTypeArgs = effectiveTypeArgs;
5981 if(!protocolsSorted) {
5982canonProtocolsVec.append(protocols.begin(), protocols.end());
5984canonProtocols = canonProtocolsVec;
5986canonProtocols = protocols;
5990canonProtocols, isKindOf);
5993ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
5997size += typeArgs.size() *
sizeof(
QualType);
6004Types.push_back(
T);
6005ObjCObjectTypes.InsertNode(
T, InsertPos);
6015 boolallowOnPointerType)
const{
6018 if(
const auto*objT = dyn_cast<ObjCTypeParamType>(
type.getTypePtr())) {
6023 if(allowOnPointerType) {
6024 if(
const auto*objPtr =
6025dyn_cast<ObjCObjectPointerType>(
type.getTypePtr())) {
6031protocolsVec.append(protocols.begin(), protocols.end());
6043 if(
const auto*objT = dyn_cast<ObjCObjectType>(
type.getTypePtr())){
6048objT->getTypeArgsAsWritten(),
6050objT->isKindOfTypeAsWritten());
6054 if(
type->isObjCObjectType()) {
6064 if(
type->isObjCIdType()) {
6067objPtr->isKindOfType());
6072 if(
type->isObjCClassType()) {
6075objPtr->isKindOfType());
6087llvm::FoldingSetNodeID ID;
6089 void*InsertPos =
nullptr;
6091ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
6096 if(!protocols.empty()) {
6100Canonical, protocols, hasError,
true));
6101assert(!hasError &&
"Error when apply protocol qualifier to bound type");
6109Types.push_back(newType);
6110ObjCTypeParamTypes.InsertNode(newType, InsertPos);
6118 autoNewTypeParamTy = cast<ObjCTypeParamType>(New->
getTypeForDecl());
6120protocols.append(NewTypeParamTy->qual_begin(), NewTypeParamTy->qual_end());
6135 for(
auto*Proto : OPT->quals()) {
6158 if(InheritedProtocols.empty())
6162 boolConforms =
false;
6163 for(
auto*Proto : OPT->quals()) {
6165 for(
auto*PI : InheritedProtocols) {
6177 for(
auto*PI : InheritedProtocols) {
6179 boolAdopts =
false;
6180 for(
auto*Proto : OPT->quals()) {
6194llvm::FoldingSetNodeID ID;
6197 void*InsertPos =
nullptr;
6199ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
6208ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
6217Types.push_back(QType);
6218ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
6226 if(
Decl->TypeForDecl)
6230assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
6231 Decl->TypeForDecl = PrevDecl->TypeForDecl;
6232 return QualType(PrevDecl->TypeForDecl, 0);
6241 Decl->TypeForDecl =
T;
6242Types.push_back(
T);
6254llvm::FoldingSetNodeID ID;
6258 void*InsertPos =
nullptr;
6260DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
6270DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
6278Types.push_back(toe);
6289 auto*tot =
new(*
this,
alignof(
TypeOfType))
6290 TypeOfType(*
this, tofType, Canonical, Kind);
6291Types.push_back(tot);
6315llvm_unreachable(
"Unknown value kind");
6330llvm::FoldingSetNodeID ID;
6333 void*InsertPos =
nullptr;
6335= DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
6340DependentDecltypeTypes.InsertNode(Canon, InsertPos);
6348Types.push_back(dt);
6353 boolFullySubstituted,
6357 if(FullySubstituted && Index != -1) {
6360llvm::FoldingSetNodeID ID;
6363 void*InsertPos =
nullptr;
6365DependentPackIndexingTypes.FindNodeOrInsertPos(ID, InsertPos);
6368PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
6372IndexExpr, FullySubstituted, Expansions);
6373DependentPackIndexingTypes.InsertNode(Canon, InsertPos);
6379 Allocate(PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
6382FullySubstituted, Expansions);
6383Types.push_back(
T);
6397llvm::FoldingSetNodeID ID;
6400 void*InsertPos =
nullptr;
6402= DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
6408DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
6417Types.push_back(ut);
6421QualTypeASTContext::getAutoTypeInternal(
6426!TypeConstraintConcept && !IsDependent)
6430llvm::FoldingSetNodeID ID;
6431 boolIsDeducedDependent =
6434IsDependent || IsDeducedDependent, TypeConstraintConcept,
6435TypeConstraintArgs);
6436 if(
auto constAT_iter = AutoTypes.find(ID); AT_iter != AutoTypes.end())
6437 return QualType(AT_iter->getSecond(), 0);
6443}
else if(TypeConstraintConcept) {
6444 boolAnyNonCanonArgs =
false;
6447*
this, TypeConstraintArgs, AnyNonCanonArgs);
6448 if(CanonicalConcept != TypeConstraintConcept || AnyNonCanonArgs) {
6450getAutoTypeInternal(
QualType(), Keyword, IsDependent, IsPack,
6451CanonicalConcept, CanonicalConceptArgs,
true);
6461(IsDependent ? TypeDependence::DependentInstantiation
6462: TypeDependence::None) |
6463(IsPack ? TypeDependence::UnexpandedPack : TypeDependence::None),
6464Canon, TypeConstraintConcept, TypeConstraintArgs);
6466llvm::FoldingSetNodeID InsertedID;
6467AT->
Profile(InsertedID, *
this);
6468assert(InsertedID == ID &&
"ID does not match");
6470Types.push_back(AT);
6471AutoTypes.try_emplace(ID, AT);
6480 boolIsDependent,
boolIsPack,
6483assert((!IsPack || IsDependent) &&
"only use IsPack for a dependent pack");
6485 "A dependent auto should be undeduced");
6486 returngetAutoTypeInternal(
DeducedType, Keyword, IsDependent, IsPack,
6487TypeConstraintConcept, TypeConstraintArgs);
6491 QualTypeCanonT =
T.getNonPackExpansionType().getCanonicalType();
6495 if(!AT->isConstrained())
6499AT->containsUnexpandedParameterPack()),
6500 T.getQualifiers());
6511QualTypeASTContext::getDeducedTemplateSpecializationTypeInternal(
6515 void*InsertPos =
nullptr;
6516llvm::FoldingSetNodeID ID;
6520DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
6526llvm::FoldingSetNodeID TempID;
6527DTST->Profile(TempID);
6528assert(ID == TempID &&
"ID does not match");
6529Types.push_back(DTST);
6530DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
6540? getDeducedTemplateSpecializationTypeInternal(
6544 returngetDeducedTemplateSpecializationTypeInternal(Template,
DeducedType,
6545IsDependent, Canon);
6553llvm::FoldingSetNodeID ID;
6556 void*InsertPos =
nullptr;
6557 if(
AtomicType*AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
6563 if(!
T.isCanonical()) {
6567 AtomicType*NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
6568assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
6571Types.push_back(New);
6572AtomicTypes.InsertNode(New, InsertPos);
6608 returngetFromTargetType(
Target->getSizeType());
6614 returngetFromTargetType(
Target->getSignedSizeType());
6619 returngetFromTargetType(
Target->getIntMaxType());
6624 returngetFromTargetType(
Target->getUIntMaxType());
6642 returngetFromTargetType(
Target->getIntPtrType());
6665 returngetFromTargetType(
Target->getProcessIDType());
6677 const Type*Ty =
T.getTypePtr();
6681}
else if(isa<ArrayType>(Ty)) {
6683}
else if(isa<FunctionType>(Ty)) {
6705quals = splitType.
Quals;
6710 QualTypeelementType = AT->getElementType();
6715 if(elementType == unqualElementType) {
6716assert(quals.
empty());
6717quals = splitType.
Quals;
6725 if(
const auto*CAT = dyn_cast<ConstantArrayType>(AT)) {
6727CAT->getSizeExpr(), CAT->getSizeModifier(), 0);
6730 if(
const auto*IAT = dyn_cast<IncompleteArrayType>(AT)) {
6734 if(
const auto*VAT = dyn_cast<VariableArrayType>(AT)) {
6737VAT->getSizeModifier(),
6738VAT->getIndexTypeCVRQualifiers(),
6739VAT->getBracketsRange());
6742 const auto*DSAT = cast<DependentSizedArrayType>(AT);
6744DSAT->getSizeModifier(), 0,
6755 boolAllowPiMismatch)
const{
6770 if(
auto*CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
6771 auto*CAT2 = dyn_cast<ConstantArrayType>(AT2);
6772 if(!((CAT2 && CAT1->getSize() == CAT2->getSize()) ||
6774isa<IncompleteArrayType>(AT2))))
6776}
else if(isa<IncompleteArrayType>(AT1)) {
6777 if(!(isa<IncompleteArrayType>(AT2) ||
6779isa<ConstantArrayType>(AT2))))
6785T1 = AT1->getElementType();
6786T2 = AT2->getElementType();
6806 boolAllowPiMismatch)
const{
6811 if(T1PtrType && T2PtrType) {
6819 if(T1MPType && T2MPType &&
6830 if(T1OPType && T2OPType) {
6862 if(Quals1 != Quals2)
6876 switch(Name.getKind()) {
6911= Name.getAsSubstTemplateTemplateParm();
6918= Name.getAsSubstTemplateTemplateParmPack();
6931llvm_unreachable(
"bad template name kind!");
6937 if(!TP->hasDefaultArgument())
6939 return&TP->getDefaultArgument().getArgument();
6941 switch(
P->getKind()) {
6942 caseNamedDecl::TemplateTypeParm:
6943 returnhandleParam(cast<TemplateTypeParmDecl>(
P));
6944 caseNamedDecl::NonTypeTemplateParm:
6945 returnhandleParam(cast<NonTypeTemplateParmDecl>(
P));
6946 caseNamedDecl::TemplateTemplateParm:
6947 returnhandleParam(cast<TemplateTemplateParmDecl>(
P));
6949llvm_unreachable(
"Unexpected template parameter kind");
6954 boolIgnoreDeduced)
const{
6955 while(std::optional<TemplateName> UnderlyingOrNone =
6956Name.desugar(IgnoreDeduced))
6957Name = *UnderlyingOrNone;
6959 switch(Name.getKind()) {
6962 if(
auto*TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
6963Template = getCanonicalTemplateTemplateParmDecl(TTP);
6971llvm_unreachable(
"cannot canonicalize unresolved template");
6975assert(DTN &&
"Non-dependent template names must refer to template decls.");
6976 returnDTN->CanonicalTemplateName;
6981Name.getAsSubstTemplateTemplateParmPack();
6989assert(IgnoreDeduced ==
false);
6996 boolNonCanonical = CanonUnderlying != Underlying;
7002assert(CanonArgs.size() <= Params.size());
7008 for(
intI = CanonArgs.size() - 1; I >= 0; --I) {
7017 if(I ==
int(CanonArgs.size() - 1))
7018CanonArgs.pop_back();
7019NonCanonical =
true;
7029llvm_unreachable(
"always sugar node");
7032llvm_unreachable(
"bad template name!");
7037 boolIgnoreDeduced)
const{
7049llvm::FoldingSetNodeID XCEID, YCEID;
7050XCE->
Profile(XCEID, *
this,
true,
true);
7051YCE->
Profile(YCEID, *
this,
true,
true);
7052 returnXCEID == YCEID;
7098 if(
X->getKind() != Y->
getKind())
7101 if(
auto*TX = dyn_cast<TemplateTypeParmDecl>(
X)) {
7102 auto*TY = cast<TemplateTypeParmDecl>(Y);
7103 if(TX->isParameterPack() != TY->isParameterPack())
7105 if(TX->hasTypeConstraint() != TY->hasTypeConstraint())
7108TY->getTypeConstraint());
7111 if(
auto*TX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
7112 auto*TY = cast<NonTypeTemplateParmDecl>(Y);
7113 returnTX->isParameterPack() == TY->isParameterPack() &&
7114TX->getASTContext().hasSameType(TX->getType(), TY->getType()) &&
7116TY->getPlaceholderTypeConstraint());
7119 auto*TX = cast<TemplateTemplateParmDecl>(
X);
7120 auto*TY = cast<TemplateTemplateParmDecl>(Y);
7121 returnTX->isParameterPack() == TY->isParameterPack() &&
7123TY->getTemplateParameters());
7128 if(
X->size() != Y->
size())
7131 for(
unsignedI = 0, N =
X->size(); I != N; ++I)
7145 if(
auto*TTPX = dyn_cast<TemplateTypeParmDecl>(
X)) {
7146 auto*TTPY = cast<TemplateTypeParmDecl>(Y);
7147 if(!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
7150 return hasSameType(TTPX->getDefaultArgument().getArgument().getAsType(),
7151TTPY->getDefaultArgument().getArgument().getAsType());
7154 if(
auto*NTTPX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
7155 auto*NTTPY = cast<NonTypeTemplateParmDecl>(Y);
7156 if(!NTTPX->hasDefaultArgument() || !NTTPY->hasDefaultArgument())
7159 Expr*DefaultArgumentX =
7160NTTPX->getDefaultArgument().getArgument().getAsExpr()->
IgnoreImpCasts();
7161 Expr*DefaultArgumentY =
7162NTTPY->getDefaultArgument().getArgument().getAsExpr()->
IgnoreImpCasts();
7163llvm::FoldingSetNodeID XID, YID;
7164DefaultArgumentX->
Profile(XID, *
this,
true);
7165DefaultArgumentY->
Profile(YID, *
this,
true);
7169 auto*TTPX = cast<TemplateTemplateParmDecl>(
X);
7170 auto*TTPY = cast<TemplateTemplateParmDecl>(Y);
7172 if(!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
7181 if(
auto*NS =
X->getAsNamespace())
7183 if(
auto*NAS =
X->getAsNamespaceAlias())
7184 returnNAS->getNamespace();
7192 if(!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
7194}
else if(
X->getKind() != Y->
getKind())
7199 switch(
X->getKind()) {
7210 if(
X->getAsType()->getCanonicalTypeInternal() !=
7220 auto*PX =
X->getPrefix();
7234llvm::FoldingSetNodeID Cand1ID, Cand2ID;
7238 for(
autoPair : zip_longest(AEnableIfAttrs, BEnableIfAttrs)) {
7239std::optional<EnableIfAttr *> Cand1A = std::get<0>(Pair);
7240std::optional<EnableIfAttr *> Cand2A = std::get<1>(Pair);
7243 if(!Cand1A || !Cand2A)
7249(*Cand1A)->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
7250(*Cand2A)->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
7254 if(Cand1ID != Cand2ID)
7282 if(
const auto*TypedefX = dyn_cast<TypedefNameDecl>(
X))
7283 if(
const auto*TypedefY = dyn_cast<TypedefNameDecl>(Y))
7284 return hasSameType(TypedefX->getUnderlyingType(),
7285TypedefY->getUnderlyingType());
7288 if(
X->getKind() != Y->
getKind())
7292 if(isa<ObjCInterfaceDecl>(
X) || isa<ObjCProtocolDecl>(
X))
7295 if(isa<ClassTemplateSpecializationDecl>(
X)) {
7302 if(
const auto*TagX = dyn_cast<TagDecl>(
X)) {
7303 const auto*TagY = cast<TagDecl>(Y);
7304 return(TagX->getTagKind() == TagY->getTagKind()) ||
7316 if(
const auto*FuncX = dyn_cast<FunctionDecl>(
X)) {
7317 const auto*FuncY = cast<FunctionDecl>(Y);
7318 if(
const auto*CtorX = dyn_cast<CXXConstructorDecl>(
X)) {
7319 const auto*CtorY = cast<CXXConstructorDecl>(Y);
7320 if(CtorX->getInheritedConstructor() &&
7321!
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
7322CtorY->getInheritedConstructor().getConstructor()))
7326 if(FuncX->isMultiVersion() != FuncY->isMultiVersion())
7331 if(FuncX->isMultiVersion()) {
7332 const auto*TAX = FuncX->getAttr<TargetAttr>();
7333 const auto*TAY = FuncY->getAttr<TargetAttr>();
7334assert(TAX && TAY &&
"Multiversion Function without target attribute");
7336 if(TAX->getFeaturesStr() != TAY->getFeaturesStr())
7342 if((FuncX->isMemberLikeConstrainedFriend() ||
7343FuncY->isMemberLikeConstrainedFriend()) &&
7344!FuncX->getLexicalDeclContext()->Equals(
7345FuncY->getLexicalDeclContext())) {
7350FuncY->getTrailingRequiresClause()))
7358FD = FD->getCanonicalDecl();
7359 returnFD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType()
7362 QualTypeXT = GetTypeAsWritten(FuncX), YT = GetTypeAsWritten(FuncY);
7369 if(
getLangOpts().CPlusPlus17 && XFPT && YFPT &&
7377 returnFuncX->getLinkageInternal() == FuncY->getLinkageInternal() &&
7382 if(
const auto*VarX = dyn_cast<VarDecl>(
X)) {
7383 const auto*VarY = cast<VarDecl>(Y);
7384 if(VarX->getLinkageInternal() == VarY->getLinkageInternal()) {
7387 if(VarX->getType().isNull() || VarY->getType().isNull())
7390 if(
hasSameType(VarX->getType(), VarY->getType()))
7400 if(!VarXTy || !VarYTy)
7409 if(
const auto*NamespaceX = dyn_cast<NamespaceDecl>(
X)) {
7410 const auto*NamespaceY = cast<NamespaceDecl>(Y);
7411 returnNamespaceX->isInline() == NamespaceY->isInline();
7416 if(
const auto*TemplateX = dyn_cast<TemplateDecl>(
X)) {
7417 const auto*TemplateY = cast<TemplateDecl>(Y);
7420 if(
const auto*ConceptX = dyn_cast<ConceptDecl>(
X)) {
7421 const auto*ConceptY = cast<ConceptDecl>(Y);
7423ConceptY->getConstraintExpr()))
7428TemplateY->getTemplatedDecl()) &&
7430TemplateY->getTemplateParameters());
7434 if(
const auto*FDX = dyn_cast<FieldDecl>(
X)) {
7435 const auto*FDY = cast<FieldDecl>(Y);
7437 return hasSameType(FDX->getType(), FDY->getType());
7441 if(
const auto*IFDX = dyn_cast<IndirectFieldDecl>(
X)) {
7442 const auto*IFDY = cast<IndirectFieldDecl>(Y);
7443 returnIFDX->getAnonField()->getCanonicalDecl() ==
7444IFDY->getAnonField()->getCanonicalDecl();
7448 if(isa<EnumConstantDecl>(
X))
7453 if(
const auto*USX = dyn_cast<UsingShadowDecl>(
X)) {
7454 const auto*USY = cast<UsingShadowDecl>(Y);
7460 if(
const auto*UX = dyn_cast<UsingDecl>(
X)) {
7461 const auto*UY = cast<UsingDecl>(Y);
7463UX->hasTypename() == UY->hasTypename() &&
7464UX->isAccessDeclaration() == UY->isAccessDeclaration();
7466 if(
const auto*UX = dyn_cast<UnresolvedUsingValueDecl>(
X)) {
7467 const auto*UY = cast<UnresolvedUsingValueDecl>(Y);
7469UX->isAccessDeclaration() == UY->isAccessDeclaration();
7471 if(
const auto*UX = dyn_cast<UnresolvedUsingTypenameDecl>(
X)) {
7474cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
7479 if(
const auto*UX = dyn_cast<UsingPackDecl>(
X)) {
7481UX->getInstantiatedFromUsingDecl(),
7482cast<UsingPackDecl>(Y)->getInstantiatedFromUsingDecl());
7486 if(
const auto*NAX = dyn_cast<NamespaceAliasDecl>(
X)) {
7487 const auto*NAY = cast<NamespaceAliasDecl>(Y);
7488 returnNAX->getNamespace()->Equals(NAY->getNamespace());
7535 boolAnyNonCanonArgs =
false;
7538 if(!AnyNonCanonArgs)
7541 const_cast<ASTContext&
>(*
this), CanonArgs);
7548llvm_unreachable(
"Unhandled template argument kind");
7591DNT->getIdentifier());
7605llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
7610 if(!
T.hasLocalQualifiers()) {
7612 if(
const auto*AT = dyn_cast<ArrayType>(
T))
7617 if(!isa<ArrayType>(
T.getCanonicalType()))
7632 const auto*ATy = dyn_cast<ArrayType>(split.
Ty);
7633 if(!ATy || qs.
empty())
7640 if(
const auto*CAT = dyn_cast<ConstantArrayType>(ATy))
7643CAT->getSizeModifier(),
7644CAT->getIndexTypeCVRQualifiers()));
7645 if(
const auto*IAT = dyn_cast<IncompleteArrayType>(ATy))
7647IAT->getSizeModifier(),
7648IAT->getIndexTypeCVRQualifiers()));
7650 if(
const auto*DSAT = dyn_cast<DependentSizedArrayType>(ATy))
7651 returncast<ArrayType>(
7653DSAT->getSizeExpr(),
7654DSAT->getSizeModifier(),
7655DSAT->getIndexTypeCVRQualifiers(),
7656DSAT->getBracketsRange()));
7658 const auto*VAT = cast<VariableArrayType>(ATy);
7661VAT->getSizeModifier(),
7662VAT->getIndexTypeCVRQualifiers(),
7663VAT->getBracketsRange()));
7677 return T.getUnqualifiedType();
7690 return T.getUnqualifiedType();
7705assert(PrettyArrayType &&
"Not an array type!");
7742uint64_t ElementCount = 1;
7745CA = dyn_cast_or_null<ConstantArrayType>(
7748 returnElementCount;
7756uint64_t ElementCount = 1;
7760AILE = dyn_cast<ArrayInitLoopExpr>(AILE->
getSubExpr());
7763 returnElementCount;
7773 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
7775 caseBuiltinType::Half:
return HalfRank;
7776 caseBuiltinType::Float:
return FloatRank;
7777 caseBuiltinType::Double:
return DoubleRank;
7781 caseBuiltinType::Ibm128:
return Ibm128Rank;
7809unsignedASTContext::getIntegerRank(
const Type*
T)
const{
7814 if(
const auto*EIT = dyn_cast<BitIntType>(
T))
7815 return0 + (EIT->getNumBits() << 3);
7817 switch(cast<BuiltinType>(
T)->getKind()) {
7818 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
7819 caseBuiltinType::Bool:
7821 caseBuiltinType::Char_S:
7822 caseBuiltinType::Char_U:
7823 caseBuiltinType::SChar:
7824 caseBuiltinType::UChar:
7826 caseBuiltinType::Short:
7827 caseBuiltinType::UShort:
7829 caseBuiltinType::Int:
7830 caseBuiltinType::UInt:
7832 caseBuiltinType::Long:
7833 caseBuiltinType::ULong:
7835 caseBuiltinType::LongLong:
7836 caseBuiltinType::ULongLong:
7838 caseBuiltinType::Int128:
7839 caseBuiltinType::UInt128:
7844 caseBuiltinType::Char8:
7846 caseBuiltinType::Char16:
7847 returngetIntegerRank(
7849 caseBuiltinType::Char32:
7850 returngetIntegerRank(
7852 caseBuiltinType::WChar_S:
7853 caseBuiltinType::WChar_U:
7854 returngetIntegerRank(
7884uint64_t BitWidth = Field->getBitWidthValue();
7907 if(
QualTypeQT = Field->getType(); QT->isBitIntType())
7910 if(BitWidth < IntSize)
7913 if(BitWidth == IntSize)
7928assert(!Promotable.
isNull());
7931 returnET->getDecl()->getPromotionType();
7940 if(BT->getKind() == BuiltinType::WChar_S ||
7941BT->getKind() == BuiltinType::WChar_U ||
7942BT->getKind() == BuiltinType::Char8 ||
7943BT->getKind() == BuiltinType::Char16 ||
7944BT->getKind() == BuiltinType::Char32) {
7945 boolFromIsSigned = BT->getKind() == BuiltinType::WChar_S;
7949 for(
const auto&PT : PromoteTypes) {
7951 if(FromSize < ToSize ||
7952(FromSize == ToSize && FromIsSigned == PT->isSignedIntegerType()))
7955llvm_unreachable(
"char type should fit into long long");
7962uint64_t PromotableSize =
getIntWidth(Promotable);
7971 while(!
T.isNull()) {
7973 return T.getObjCLifetime();
8003 if(
const auto*ET = dyn_cast<EnumType>(LHSC))
8005 if(
const auto*ET = dyn_cast<EnumType>(RHSC))
8008 if(LHSC == RHSC)
return0;
8013 unsignedLHSRank = getIntegerRank(LHSC);
8014 unsignedRHSRank = getIntegerRank(RHSC);
8016 if(LHSUnsigned == RHSUnsigned) {
8017 if(LHSRank == RHSRank)
return0;
8018 returnLHSRank > RHSRank ? 1 : -1;
8024 if(LHSRank >= RHSRank)
8034 if(RHSRank >= LHSRank)
8044 if(CFConstantStringTypeDecl)
8045 returnCFConstantStringTypeDecl;
8047assert(!CFConstantStringTagDecl &&
8048 "tag and typedef should be initialized together");
8088 if(
static_cast<unsigned>(CFRuntime) <
8091Fields[Count++] = {
IntTy,
"flags"};
8093Fields[Count++] = {
LongTy,
"length"};
8097Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc"};
8101Fields[Count++] = {
IntTy,
"_ptr"};
8107 for(
unsignedi = 0; i < Count; ++i) {
8111Fields[i].Type,
nullptr,
8114CFConstantStringTagDecl->
addDecl(Field);
8121CFConstantStringTypeDecl =
8124 returnCFConstantStringTypeDecl;
8128 if(!CFConstantStringTagDecl)
8130 returnCFConstantStringTagDecl;
8139 if(ObjCSuperType.
isNull()) {
8144 returnObjCSuperType;
8149CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
8156 if(BlockDescriptorType)
8169 static const char*
constFieldNames[] = {
8174 for(
size_ti = 0; i < 2; ++i) {
8177&
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
8185BlockDescriptorType = RD;
8191 if(BlockDescriptorExtendedType)
8206 static const char*
constFieldNames[] = {
8213 for(
size_ti = 0; i < 4; ++i) {
8216&
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
8225BlockDescriptorExtendedType = RD;
8230 const auto*BT = dyn_cast<BuiltinType>(
T);
8233 if(isa<PipeType>(
T))
8239 switch(BT->getKind()) {
8240#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 8241 case BuiltinType::Id: \ 8243#include "clang/Basic/OpenCLImageTypes.def" 8245 caseBuiltinType::OCLClkEvent:
8248 caseBuiltinType::OCLEvent:
8251 caseBuiltinType::OCLQueue:
8254 caseBuiltinType::OCLReserveID:
8257 caseBuiltinType::OCLSampler:
8276 if(!copyExpr && record->hasTrivialDestructor())
return false;
8304llvm_unreachable(
"impossible");
8306llvm_unreachable(
"fell out of lifetime switch!");
8314 bool&HasByrefExtendedLayout)
const{
8319HasByrefExtendedLayout =
false;
8321HasByrefExtendedLayout =
true;
8335assert(
Target&&
"Expected target to be initialized");
8336 constllvm::Triple &
T=
Target->getTriple();
8338 if(
T.isOSWindows() &&
T.isArch64Bit())
8344assert(
Target&&
"Expected target to be initialized");
8345 constllvm::Triple &
T=
Target->getTriple();
8347 if(
T.isOSWindows() &&
T.isArch64Bit())
8353 if(!ObjCInstanceTypeDecl)
8354ObjCInstanceTypeDecl =
8356 returnObjCInstanceTypeDecl;
8362 if(
const auto*TT = dyn_cast<TypedefType>(
T))
8364 returnII->isStr(
"BOOL");
8372 if(!
type->isIncompleteArrayType() &&
type->isIncompleteType())
8381 else if(
type->isArrayType())
8400 if(
First->isInlineSpecified() || !
First->isStaticDataMember())
8407!
D->isInlineSpecified() && (
D->isConstexpr() ||
First->isConstexpr()))
8438 for(
auto*PI :
Decl->parameters()) {
8443assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
8452ParmOffset = PtrSize;
8453 for(
auto*PVDecl :
Decl->parameters()) {
8454 QualTypePType = PVDecl->getOriginalType();
8455 if(
const auto*AT =
8459 if(!isa<ConstantArrayType>(AT))
8460PType = PVDecl->getType();
8462PType = PVDecl->getType();
8482 for(
auto*PI :
Decl->parameters()) {
8489 "getObjCEncodingForFunctionDecl - Incomplete param type");
8496 for(
auto*PVDecl :
Decl->parameters()) {
8497 QualTypePType = PVDecl->getOriginalType();
8498 if(
const auto*AT =
8502 if(!isa<ConstantArrayType>(AT))
8503PType = PVDecl->getType();
8505PType = PVDecl->getType();
8519 boolExtended)
const{
8523ObjCEncOptions Options = ObjCEncOptions()
8524.setExpandPointedToStructures()
8525.setExpandStructures()
8526.setIsOutermostType();
8528Options.setEncodeBlockParameters().setEncodeClassNames();
8529getObjCEncodingForTypeImpl(
T, S, Options,
nullptr);
8535 boolExtended)
const{
8540 Decl->getReturnType(), S, Extended);
8549 E=
Decl->sel_param_end(); PI !=
E; ++PI) {
8556 "getObjCEncodingForMethodDecl - Incomplete param type");
8564ParmOffset = 2 * PtrSize;
8566 E=
Decl->sel_param_end(); PI !=
E; ++PI) {
8569 if(
const auto*AT =
8573 if(!isa<ConstantArrayType>(AT))
8578PType, S, Extended);
8589 const Decl*Container)
const{
8592 if(
const auto*CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
8593 for(
auto*PID : CID->property_impls())
8594 if(PID->getPropertyDecl() == PD)
8597 const auto*OID = cast<ObjCImplementationDecl>(Container);
8598 for(
auto*PID : OID->property_impls())
8599 if(PID->getPropertyDecl() == PD)
8633 const Decl*Container)
const{
8635 boolDynamic =
false;
8643SynthesizePID = PropertyImpDecl;
8647std::string S =
"T";
8692 if(SynthesizePID) {
8709 if(BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
8712 if(BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
8725getObjCEncodingForTypeImpl(
T, S,
8727.setExpandPointedToStructures()
8728.setExpandStructures()
8729.setIsOutermostType(),
8730Field, NotEncodedT);
8734std::string& S)
const{
8738getObjCEncodingForTypeImpl(
T, S,
8740.setExpandPointedToStructures()
8741.setExpandStructures()
8742.setIsOutermostType()
8743.setEncodingProperty(),
8751 caseBuiltinType::Void:
return 'v';
8752 caseBuiltinType::Bool:
return 'B';
8753 caseBuiltinType::Char8:
8754 caseBuiltinType::Char_U:
8755 caseBuiltinType::UChar:
return 'C';
8756 caseBuiltinType::Char16:
8757 caseBuiltinType::UShort:
return 'S';
8758 caseBuiltinType::Char32:
8759 caseBuiltinType::UInt:
return 'I';
8760 caseBuiltinType::ULong:
8761 return C->getTargetInfo().getLongWidth() == 32 ?
'L':
'Q';
8762 caseBuiltinType::UInt128:
return 'T';
8763 caseBuiltinType::ULongLong:
return 'Q';
8764 caseBuiltinType::Char_S:
8765 caseBuiltinType::SChar:
return 'c';
8766 caseBuiltinType::Short:
return 's';
8767 caseBuiltinType::WChar_S:
8768 caseBuiltinType::WChar_U:
8769 caseBuiltinType::Int:
return 'i';
8770 caseBuiltinType::Long:
8771 return C->getTargetInfo().getLongWidth() == 32 ?
'l':
'q';
8772 caseBuiltinType::LongLong:
return 'q';
8773 caseBuiltinType::Int128:
return 't';
8774 caseBuiltinType::Float:
return 'f';
8775 caseBuiltinType::Double:
return 'd';
8776 caseBuiltinType::LongDouble:
return 'D';
8777 caseBuiltinType::NullPtr:
return '*';
8779 caseBuiltinType::BFloat16:
8780 caseBuiltinType::Float16:
8781 caseBuiltinType::Float128:
8782 caseBuiltinType::Ibm128:
8783 caseBuiltinType::Half:
8784 caseBuiltinType::ShortAccum:
8785 caseBuiltinType::Accum:
8786 caseBuiltinType::LongAccum:
8787 caseBuiltinType::UShortAccum:
8788 caseBuiltinType::UAccum:
8789 caseBuiltinType::ULongAccum:
8790 caseBuiltinType::ShortFract:
8791 caseBuiltinType::Fract:
8792 caseBuiltinType::LongFract:
8793 caseBuiltinType::UShortFract:
8794 caseBuiltinType::UFract:
8795 caseBuiltinType::ULongFract:
8796 caseBuiltinType::SatShortAccum:
8797 caseBuiltinType::SatAccum:
8798 caseBuiltinType::SatLongAccum:
8799 caseBuiltinType::SatUShortAccum:
8800 caseBuiltinType::SatUAccum:
8801 caseBuiltinType::SatULongAccum:
8802 caseBuiltinType::SatShortFract:
8803 caseBuiltinType::SatFract:
8804 caseBuiltinType::SatLongFract:
8805 caseBuiltinType::SatUShortFract:
8806 caseBuiltinType::SatUFract:
8807 caseBuiltinType::SatULongFract:
8811#define SVE_TYPE(Name, Id, SingletonId) \ 8812 case BuiltinType::Id: 8813#include "clang/Basic/AArch64SVEACLETypes.def" 8814#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id: 8815#include "clang/Basic/RISCVVTypes.def" 8816#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id: 8817#include "clang/Basic/WebAssemblyReferenceTypes.def" 8818#define AMDGPU_TYPE(Name, Id, SingletonId, Width, Align) case BuiltinType::Id: 8819#include "clang/Basic/AMDGPUTypes.def" 8823 "cannot yet @encode type %0");
8824Diags.
Report(DiagID) << BT->
getName(
C->getPrintingPolicy());
8828 caseBuiltinType::ObjCId:
8829 caseBuiltinType::ObjCClass:
8830 caseBuiltinType::ObjCSel:
8831llvm_unreachable(
"@encoding ObjC primitive type");
8834#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 8835 case BuiltinType::Id: 8836#include "clang/Basic/OpenCLImageTypes.def" 8837#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 8838 case BuiltinType::Id: 8839#include "clang/Basic/OpenCLExtensionTypes.def" 8840 caseBuiltinType::OCLEvent:
8841 caseBuiltinType::OCLClkEvent:
8842 caseBuiltinType::OCLQueue:
8843 caseBuiltinType::OCLReserveID:
8844 caseBuiltinType::OCLSampler:
8845 caseBuiltinType::Dependent:
8846#define PPC_VECTOR_TYPE(Name, Id, Size) \ 8847 case BuiltinType::Id: 8848#include "clang/Basic/PPCTypes.def" 8849#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId) case BuiltinType::Id: 8850#include "clang/Basic/HLSLIntangibleTypes.def" 8851#define BUILTIN_TYPE(KIND, ID) 8852#define PLACEHOLDER_TYPE(KIND, ID) \ 8853 case BuiltinType::KIND: 8854#include "clang/AST/BuiltinTypes.def" 8855llvm_unreachable(
"invalid builtin type for @encode");
8857llvm_unreachable(
"invalid BuiltinType::Kind value");
8864 if(!
Enum->isFixed())
8874assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
8894 if(
const auto*IVD = dyn_cast<ObjCIvarDecl>(FD)) {
8903S += llvm::utostr(Offset);
8918 boolVisitBasesAndFields) {
8923PT->getPointeeType().getTypePtr(),
false);
8930 if(isa<ClassTemplateSpecializationDecl>(CXXRD))
8933 if(!CXXRD->hasDefinition() || !VisitBasesAndFields)
8936 for(
const auto&B : CXXRD->bases())
8941 for(
auto*FD : CXXRD->fields())
8950voidASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string &S,
8951 constObjCEncOptions Options,
8955 switch(CT->getTypeClass()) {
8960 if(
const auto*BT = dyn_cast<BuiltinType>(CT))
8982 caseType::LValueReference:
8983 caseType::RValueReference: {
8985 if(isa<PointerType>(CT)) {
8987 if(PT->isObjCSelType()) {
8996 boolisReadOnly =
false;
9002 if(Options.IsOutermostType() &&
T.isConstQualified()) {
9006}
else if(Options.IsOutermostType()) {
9009 P= PT->getPointeeType();
9010 if(
P.isConstQualified()) {
9019 if(StringRef(S).ends_with(
"nr"))
9020S.replace(S.end()-2, S.end(),
"rn");
9032 if(RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
9037 if(RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
9046RTy, Options.ExpandPointedToStructures()))) {
9055ObjCEncOptions NewOptions;
9056 if(Options.ExpandPointedToStructures())
9057NewOptions.setExpandStructures();
9058getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
9059 nullptr, NotEncodedT);
9063 caseType::ConstantArray:
9064 caseType::IncompleteArray:
9065 caseType::VariableArray: {
9066 const auto*AT = cast<ArrayType>(CT);
9068 if(isa<IncompleteArrayType>(AT) && !Options.IsStructField()) {
9072getObjCEncodingForTypeImpl(
9073AT->getElementType(), S,
9074Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
9078 if(
const auto*CAT = dyn_cast<ConstantArrayType>(AT))
9079S += llvm::utostr(CAT->getZExtSize());
9082assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
9083 "Unknown array type!");
9087getObjCEncodingForTypeImpl(
9088AT->getElementType(), S,
9089Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
9096 caseType::FunctionNoProto:
9097 caseType::FunctionProto:
9101 caseType::Record: {
9102 RecordDecl*RDecl = cast<RecordType>(CT)->getDecl();
9103S += RDecl->
isUnion() ?
'(':
'{';
9107 if(
const auto*Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
9109llvm::raw_string_ostream OS(S);
9116 if(Options.ExpandStructures()) {
9119getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
9121 for(
const auto*Field : RDecl->
fields()) {
9124S +=
Field->getNameAsString();
9129 if(
Field->isBitField()) {
9130getObjCEncodingForTypeImpl(
Field->getType(), S,
9131ObjCEncOptions().setExpandStructures(),
9136getObjCEncodingForTypeImpl(
9138ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
9144S += RDecl->
isUnion() ?
')':
'}';
9148 caseType::BlockPointer: {
9151 if(Options.EncodeBlockParameters()) {
9152 const auto*FT = BT->getPointeeType()->castAs<
FunctionType>();
9156getObjCEncodingForTypeImpl(FT->getReturnType(), S,
9157Options.forComponentType(), FD, NotEncodedT);
9161 if(
const auto*FPT = dyn_cast<FunctionProtoType>(FT)) {
9162 for(
const auto&I : FPT->param_types())
9163getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
9171 caseType::ObjCObject: {
9175S +=
"{objc_object=}";
9179S +=
"{objc_class=}";
9186 caseType::ObjCInterface: {
9192 if(Options.ExpandStructures()) {
9196 for(
unsignedi = 0, e = Ivars.size(); i != e; ++i) {
9198 if(
Field->isBitField())
9199getObjCEncodingForTypeImpl(
Field->getType(), S,
9200ObjCEncOptions().setExpandStructures(),
9203getObjCEncodingForTypeImpl(
Field->getType(), S,
9204ObjCEncOptions().setExpandStructures(), FD,
9212 caseType::ObjCObjectPointer: {
9214 if(OPT->isObjCIdType()) {
9219 if(OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
9227 if(OPT->isObjCQualifiedIdType()) {
9228getObjCEncodingForTypeImpl(
9230Options.keepingOnly(ObjCEncOptions()
9231.setExpandPointedToStructures()
9232.setExpandStructures()),
9234 if(FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
9238 for(
const auto*I : OPT->quals()) {
9240S += I->getObjCRuntimeNameAsString();
9249 if(OPT->getInterfaceDecl() &&
9250(FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
9252S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
9253 for(
const auto*I : OPT->quals()) {
9255S += I->getObjCRuntimeNameAsString();
9265 caseType::MemberPointer:
9269 caseType::ExtVector:
9275 caseType::ConstantMatrix:
9288 caseType::DeducedTemplateSpecialization:
9291 caseType::HLSLAttributedResource:
9292llvm_unreachable(
"unexpected type");
9294 caseType::ArrayParameter:
9296#define ABSTRACT_TYPE(KIND, BASE) 9297#define TYPE(KIND, BASE) 9298#define DEPENDENT_TYPE(KIND, BASE) \ 9300#define NON_CANONICAL_TYPE(KIND, BASE) \ 9302#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \ 9304#include "clang/AST/TypeNodes.inc" 9305llvm_unreachable(
"@encode for dependent type!");
9307llvm_unreachable(
"bad type kind!");
9310voidASTContext::getObjCEncodingForStructureImpl(
RecordDecl*RDecl,
9315assert(RDecl &&
"Expected non-null RecordDecl");
9316assert(!RDecl->
isUnion() &&
"Should not be called for unions");
9320 const auto*CXXRec = dyn_cast<CXXRecordDecl>(RDecl);
9321std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
9325 for(
const auto&BI : CXXRec->bases()) {
9326 if(!BI.isVirtual()) {
9331FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9332std::make_pair(offs, base));
9338 if(!
Field->isZeroLengthBitField() &&
Field->isZeroSize(*
this))
9341FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9342std::make_pair(offs, Field));
9345 if(CXXRec && includeVBases) {
9346 for(
const auto&BI : CXXRec->vbases()) {
9352FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
9353FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
9354std::make_pair(offs, base));
9368std::multimap<uint64_t, NamedDecl *>::iterator
9369CurLayObj = FieldOrBaseOffsets.begin();
9371 if(CXXRec && CXXRec->isDynamicClass() &&
9372(CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
9375std::string recname = CXXRec->getNameAsString();
9376 if(recname.empty()) recname =
"?";
9389FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
9390std::make_pair(offs,
nullptr));
9393 for(; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
9395assert(CurOffs <= CurLayObj->first);
9396 if(CurOffs < CurLayObj->first) {
9397 uint64_tpadding = CurLayObj->first - CurOffs;
9413 if(
auto*base = dyn_cast<CXXRecordDecl>(dcl)) {
9418getObjCEncodingForStructureImpl(base, S, FD,
false,
9425 const auto*field = cast<FieldDecl>(dcl);
9428S += field->getNameAsString();
9432 if(field->isBitField()) {
9435CurOffs += field->getBitWidthValue();
9440getObjCEncodingForTypeImpl(
9441qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
9452std::string& S)
const{
9485 if(!ObjCClassDecl) {
9490 returnObjCClassDecl;
9494 if(!ObjCProtocolClassDecl) {
9495ObjCProtocolClassDecl
9504 returnObjCProtocolClassDecl;
9549 const size_tNumFields = 5;
9551 const char*FieldNames[NumFields];
9555FieldNames[0] =
"__stack";
9559FieldNames[1] =
"__gr_top";
9563FieldNames[2] =
"__vr_top";
9566FieldTypes[3] = Context->
IntTy;
9567FieldNames[3] =
"__gr_offs";
9570FieldTypes[4] = Context->
IntTy;
9571FieldNames[4] =
"__vr_offs";
9574 for(
unsignedi = 0; i < NumFields; ++i) {
9579&Context->
Idents.
get(FieldNames[i]),
9580FieldTypes[i],
nullptr,
9585VaListTagDecl->
addDecl(Field);
9602 const size_tNumFields = 5;
9604 const char*FieldNames[NumFields];
9608FieldNames[0] =
"gpr";
9612FieldNames[1] =
"fpr";
9616FieldNames[2] =
"reserved";
9620FieldNames[3] =
"overflow_arg_area";
9624FieldNames[4] =
"reg_save_area";
9627 for(
unsignedi = 0; i < NumFields; ++i) {
9631&Context->
Idents.
get(FieldNames[i]),
9632FieldTypes[i],
nullptr,
9637VaListTagDecl->
addDecl(Field);
9664 const size_tNumFields = 4;
9666 const char*FieldNames[NumFields];
9670FieldNames[0] =
"gp_offset";
9674FieldNames[1] =
"fp_offset";
9678FieldNames[2] =
"overflow_arg_area";
9682FieldNames[3] =
"reg_save_area";
9685 for(
unsignedi = 0; i < NumFields; ++i) {
9690&Context->
Idents.
get(FieldNames[i]),
9691FieldTypes[i],
nullptr,
9696VaListTagDecl->
addDecl(Field);
9767 const size_tNumFields = 4;
9769 const char*FieldNames[NumFields];
9772FieldTypes[0] = Context->
LongTy;
9773FieldNames[0] =
"__gpr";
9776FieldTypes[1] = Context->
LongTy;
9777FieldNames[1] =
"__fpr";
9781FieldNames[2] =
"__overflow_arg_area";
9785FieldNames[3] =
"__reg_save_area";
9788 for(
unsignedi = 0; i < NumFields; ++i) {
9793&Context->
Idents.
get(FieldNames[i]),
9794FieldTypes[i],
nullptr,
9799VaListTagDecl->
addDecl(Field);
9821 const size_tNumFields = 3;
9823 const char*FieldNames[NumFields];
9827FieldNames[0] =
"__current_saved_reg_area_pointer";
9831FieldNames[1] =
"__saved_reg_area_end_pointer";
9835FieldNames[2] =
"__overflow_area_pointer";
9838 for(
unsignedi = 0; i < NumFields; ++i) {
9846VaListTagDecl->
addDecl(Field);
9876 constexpr size_tNumFields = 3;
9880 const char*FieldNames[NumFields] = {
"__va_stk",
"__va_reg",
"__va_ndx"};
9883 for(
unsignedi = 0; i < NumFields; ++i) {
9886&Context->
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
9890VaListTagDecl->
addDecl(Field);
9900 returnVaListTagTypedefDecl;
9928llvm_unreachable(
"Unhandled __builtin_va_list type kind");
9932 if(!BuiltinVaListDecl) {
9937 returnBuiltinVaListDecl;
9950 if(!BuiltinMSVaListDecl)
9953 returnBuiltinMSVaListDecl;
9965assert(ObjCConstantStringType.
isNull() &&
9966 "'NSConstantString' type already set!");
9976 unsignedsize = End -
Begin;
9977assert(size > 1 &&
"set is not overloaded!");
9986assert(isa<FunctionTemplateDecl>(
D) ||
9987isa<UnresolvedUsingValueDecl>(
D) ||
9988(isa<UsingShadowDecl>(
D) &&
9989isa<FunctionTemplateDecl>(
D->getUnderlyingDecl())));
10006 boolTemplateKeyword,
10012llvm::FoldingSetNodeID ID;
10015 void*InsertPos =
nullptr;
10017QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10021QualifiedTemplateNames.InsertNode(QTN, InsertPos);
10033 "Nested name specifier must be dependent");
10035llvm::FoldingSetNodeID ID;
10038 void*InsertPos =
nullptr;
10040DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10046 if(CanonNNS == NNS) {
10054DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10055assert(!CheckQTN &&
"Dependent type name canonicalization broken");
10059DependentTemplateNames.InsertNode(QTN, InsertPos);
10069 "Nested name specifier must be dependent");
10071llvm::FoldingSetNodeID ID;
10074 void*InsertPos =
nullptr;
10076= DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10082 if(CanonNNS == NNS) {
10091= DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
10092assert(!CheckQTN &&
"Dependent template name canonicalization broken");
10096DependentTemplateNames.InsertNode(QTN, InsertPos);
10102std::optional<unsigned> PackIndex)
const{
10103llvm::FoldingSetNodeID ID;
10107 void*insertPos =
nullptr;
10109= SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
10113Replacement, AssociatedDecl, Index, PackIndex);
10114SubstTemplateTemplateParms.InsertNode(subst, insertPos);
10122 Decl*AssociatedDecl,
10123 unsignedIndex,
boolFinal)
const{
10125llvm::FoldingSetNodeID ID;
10127AssociatedDecl, Index, Final);
10129 void*InsertPos =
nullptr;
10131= SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
10136SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
10150llvm::FoldingSetNodeID ID;
10153 void*InsertPos =
nullptr;
10155DeducedTemplates.FindNodeOrInsertPos(ID, InsertPos);
10161DeducedTemplates.InsertNode(DTS, InsertPos);
10184llvm_unreachable(
"Unhandled TargetInfo::IntType value");
10214 while(
const auto*AT = dyn_cast<ArrayType>(CT))
10215CT = AT->getElementType();
10247assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
10248assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
10285 if(Ty->
getKind() == BuiltinType::SveBool ||
10286Ty->
getKind() == BuiltinType::SveCount)
10299 returnBT->getKind() == BuiltinType::SveBool;
10301 returnVT->getElementType().getCanonicalType() ==
10312 returnIsValidCast(FirstType, SecondType) ||
10313IsValidCast(SecondType, FirstType);
10318 autoIsLaxCompatible = [
this](
QualTypeFirstType,
QualTypeSecondType) {
10331 if(BT->getKind() == BuiltinType::SveBool &&
10352 returnVecTy->getElementType().getCanonicalType()->isIntegerType() &&
10359 returnIsLaxCompatible(FirstType, SecondType) ||
10360IsLaxCompatible(SecondType, FirstType);
10377uint64_t MinElts = Info.
EC.getKnownMinValue();
10378 returnVScale->first * MinElts * EltSize;
10386 "Expected RVV builtin type and vector type!");
10426 returnIsValidCast(FirstType, SecondType) ||
10427IsValidCast(SecondType, FirstType);
10435 "Expected RVV builtin type and vector type!");
10437 autoIsLaxCompatible = [
this](
QualTypeFirstType,
QualTypeSecondType) {
10442 if(!BT->isRVVVLSBuiltinType())
10462 returnVecTy->getElementType().getCanonicalType()->isIntegerType() &&
10469 returnIsLaxCompatible(FirstType, SecondType) ||
10470IsLaxCompatible(SecondType, FirstType);
10477 if(
Attr->getAttrKind() == attr::ObjCOwnership)
10480Ty =
Attr->getModifiedType();
10483}
else if(
const ParenType*
Paren= dyn_cast<ParenType>(Ty)) {
10484Ty =
Paren->getInnerType();
10506 for(
auto*PI : rProto->
protocols())
10516 for(
auto*lhsProto : lhs->
quals()) {
10517 bool match=
false;
10518 for(
auto*rhsProto : rhs->
quals()) {
10549 for(
auto*I : lhs->
quals()) {
10553 if(!rhsID->ClassImplementsProtocol(I,
true))
10561 for(
auto*lhsProto : lhs->
quals()) {
10562 bool match=
false;
10567 for(
auto*rhsProto : rhs->
quals()) {
10577 for(
auto*I : lhs->
quals()) {
10581 if(rhsID->ClassImplementsProtocol(I,
true)) {
10598 for(
auto*lhsProto : lhs->
quals()) {
10599 bool match=
false;
10606 for(
auto*rhsProto : rhs->
quals()) {
10625 if(LHSInheritedProtocols.empty() && lhs->
qual_empty())
10627 for(
auto*lhsProto : LHSInheritedProtocols) {
10628 bool match=
false;
10629 for(
auto*rhsProto : rhs->
quals()) {
10659 autofinish = [&](
boolsucceeded) ->
bool{
10704 boolBlockReturnType) {
10708 autofinish = [&](
boolsucceeded) ->
bool{
10733 if(
getLangOpts().CompatibilityQualifiedIdBlockParamTypeChecking)
10737(!BlockReturnType &&
10741(BlockReturnType ? LHSOPT : RHSOPT),
10742(BlockReturnType ? RHSOPT : LHSOPT),
false));
10750 returnfinish(BlockReturnType);
10752 returnfinish(!BlockReturnType);
10764 return(*lhs)->getName().compare((*rhs)->getName());
10781assert(LHS->
getInterface() &&
"LHS must have an interface base");
10782assert(RHS->
getInterface() &&
"RHS must have an interface base");
10788 for(
auto*proto : LHS->
quals()) {
10799 for(
auto*proto : RHS->
quals()) {
10807 for(
auto*proto : LHSProtocolSet) {
10808 if(RHSProtocolSet.count(proto))
10809IntersectionSet.push_back(proto);
10818 if(!ImpliedProtocols.empty()) {
10820 returnImpliedProtocols.contains(proto);
10825llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
10835 if(lhsOPT && rhsOPT)
10841 if(lhsBlock && rhsBlock)
10846 if((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
10858 boolstripKindOf) {
10859 if(lhsArgs.size() != rhsArgs.size())
10866 for(
unsignedi = 0, n = lhsArgs.size(); i != n; ++i) {
10872 if(!stripKindOf ||
10873!ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
10874rhsArgs[i].stripObjCKindOfType(ctx))) {
10902 if(!LDecl || !RDecl)
10912llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
10922 boolanyChanges =
false;
10933anyChanges =
true;
10940 if(!Protocols.empty())
10941anyChanges =
true;
10946 if(anyChanges || LHS->
isKindOfType() != anyKindOf) {
10958 if(LHSSuperType.
isNull())
10968 if(KnownLHS != LHSAncestors.end()) {
10969LHS = KnownLHS->second;
10973 boolanyChanges =
false;
10984anyChanges =
true;
10991 if(!Protocols.empty())
10992anyChanges =
true;
10996 if(anyChanges || RHS->
isKindOfType() != anyKindOf) {
11008 if(RHSSuperType.
isNull())
11019assert(LHS->
getInterface() &&
"LHS is not an interface type");
11020assert(RHS->
getInterface() &&
"RHS is not an interface type");
11041 for(
auto*RHSPI : RHS->
quals())
11044 if(SuperClassInheritedProtocols.empty())
11047 for(
const auto*LHSProto : LHS->
quals()) {
11048 boolSuperImplementsProtocol =
false;
11049 for(
auto*SuperClassProto : SuperClassInheritedProtocols)
11050 if(SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
11051SuperImplementsProtocol =
true;
11054 if(!SuperImplementsProtocol)
11084 if(!LHSOPT || !RHSOPT)
11102 boolCompareUnqualified) {
11121 boolOfBlockPointer,
11125 if(UD->
hasAttr<TransparentUnionAttr>()) {
11126 for(
const auto*I : UD->
fields()) {
11127 QualTypeET = I->getType().getUnqualifiedType();
11141 boolOfBlockPointer,
11162 boolIsConditionalOperator) {
11165 const auto*lproto = dyn_cast<FunctionProtoType>(lbase);
11166 const auto*rproto = dyn_cast<FunctionProtoType>(rbase);
11167 boolallLTypes =
true;
11168 boolallRTypes =
true;
11172 if(OfBlockPointer) {
11174 QualTypeLHS = lbase->getReturnType();
11176 if(!UnqualifiedResult)
11178retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
11197allLTypes =
false;
11199allRTypes =
false;
11209 if(lbaseInfo.
getCC() != rbaseInfo.
getCC())
11243 boolNoReturn = IsConditionalOperator
11247allLTypes =
false;
11249allRTypes =
false;
11253std::optional<FunctionEffectSet> MergedFX;
11255 if(lproto && rproto) {
11256assert((AllowCXX ||
11257(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec())) &&
11258 "C++ shouldn't be here");
11260 if(lproto->getNumParams() != rproto->getNumParams())
11264 if(lproto->isVariadic() != rproto->isVariadic())
11267 if(lproto->getMethodQuals() != rproto->getMethodQuals())
11273 if(LHSFX != RHSFX) {
11274 if(IsConditionalOperator)
11283 if(*MergedFX != LHSFX)
11284allLTypes =
false;
11285 if(*MergedFX != RHSFX)
11286allRTypes =
false;
11290 boolcanUseLeft, canUseRight;
11296allLTypes =
false;
11298allRTypes =
false;
11302 for(
unsignedi = 0, n = lproto->getNumParams(); i < n; i++) {
11303 QualTypelParamType = lproto->getParamType(i).getUnqualifiedType();
11304 QualTyperParamType = rproto->getParamType(i).getUnqualifiedType();
11306lParamType, rParamType, OfBlockPointer,
Unqualified);
11307 if(paramType.
isNull())
11313 types.push_back(paramType);
11320allLTypes =
false;
11322allRTypes =
false;
11325 if(allLTypes)
returnlhs;
11326 if(allRTypes)
returnrhs;
11331newParamInfos.empty() ? nullptr : newParamInfos.data();
11337 if(lproto) allRTypes =
false;
11338 if(rproto) allLTypes =
false;
11342assert((AllowCXX || !proto->
hasExceptionSpec()) &&
"C++ shouldn't be here");
11350 for(
unsignedi = 0, n = proto->
getNumParams(); i < n; ++i) {
11356paramTy =
Enum->getDecl()->getIntegerType();
11366 if(allLTypes)
returnlhs;
11367 if(allRTypes)
returnrhs;
11376 if(allLTypes)
returnlhs;
11377 if(allRTypes)
returnrhs;
11383 QualTypeother,
boolisBlockReturnType) {
11389 if(underlyingType.
isNull())
11391 if(Context.
hasSameType(underlyingType, other))
11405 boolIsConditionalOperator) {
11416 if(LangOpts.OpenMP && LHSRefTy && RHSRefTy &&
11420 if(LHSRefTy || RHSRefTy)
11432 if(LHSCan == RHSCan)
11437 QualifiersRQuals = RHSCan.getLocalQualifiers();
11438 if(LQuals != RQuals) {
11454assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11475 if(LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
11476 if(RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
11479 if(LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
11480LHSClass = Type::ConstantArray;
11481 if(RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
11482RHSClass = Type::ConstantArray;
11485 if(LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
11486 if(RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
11489 if(LHSClass == Type::ExtVector) LHSClass = Type::Vector;
11490 if(RHSClass == Type::ExtVector) RHSClass = Type::Vector;
11493 if(LHSClass != RHSClass) {
11503 if(OfBlockPointer && !BlockReturnType) {
11512 if(!AT->isDeduced() && AT->isGNUAutoType())
11516 if(!AT->isDeduced() && AT->isGNUAutoType())
11523 switch(LHSClass) {
11524#define TYPE(Class, Base) 11525#define ABSTRACT_TYPE(Class, Base) 11526#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: 11527#define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 11528#define DEPENDENT_TYPE(Class, Base) case Type::Class: 11529#include "clang/AST/TypeNodes.inc" 11530llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
11533 caseType::DeducedTemplateSpecialization:
11534 caseType::LValueReference:
11535 caseType::RValueReference:
11536 caseType::MemberPointer:
11537llvm_unreachable(
"C++ should never be in mergeTypes");
11539 caseType::ObjCInterface:
11540 caseType::IncompleteArray:
11541 caseType::VariableArray:
11542 caseType::FunctionProto:
11543 caseType::ExtVector:
11544llvm_unreachable(
"Types are eliminated above");
11546 caseType::Pointer:
11557 if(ResultType.
isNull())
11565 caseType::BlockPointer:
11590 if(ResultType.
isNull())
11609 if(ResultType.
isNull())
11617 caseType::ConstantArray:
11632 if(ResultType.
isNull())
11640 if(LVAT || RVAT) {
11643-> std::pair<bool,llvm::APInt> {
11645std::optional<llvm::APSInt> TheInt;
11648 returnstd::make_pair(
true, *TheInt);
11649 returnstd::make_pair(
false, llvm::APSInt());
11652 returnstd::make_pair(
true, CAT->getSize());
11653 returnstd::make_pair(
false, llvm::APInt());
11656 boolHaveLSize, HaveRSize;
11657llvm::APInt LSize, RSize;
11658std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
11659std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
11660 if(HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
11694 caseType::FunctionNoProto:
11696 false, IsConditionalOperator);
11700 caseType::Builtin:
11703 caseType::Complex:
11712 caseType::ConstantMatrix:
11717 caseType::ObjCObject: {
11726 caseType::ObjCObjectPointer:
11727 if(OfBlockPointer) {
11739assert(LHS != RHS &&
11740 "Equivalent pipe types should have already been handled!");
11742 caseType::ArrayParameter:
11743assert(LHS != RHS &&
11744 "Equivalent ArrayParameter types should have already been handled!");
11746 caseType::BitInt: {
11754 if(LHSUnsigned != RHSUnsigned)
11757 if(LHSBits != RHSBits)
11761 caseType::HLSLAttributedResource: {
11768 "HLSLAttributedResourceType should always wrap __hlsl_resource_t");
11770 if(LHSTy->
getAttrs() == RHSTy->getAttrs() &&
11777llvm_unreachable(
"Invalid Type::Class!");
11782 bool&CanUseFirst,
bool&CanUseSecond,
11784assert(NewParamInfos.empty() &&
"param info list not empty");
11785CanUseFirst = CanUseSecond =
true;
11791 if(!FirstHasInfo && !SecondHasInfo)
11794 boolNeedParamInfo =
false;
11798 for(
size_tI = 0; I <
E; ++I) {
11809 boolFirstNoEscape = FirstParam.
isNoEscape();
11810 boolSecondNoEscape = SecondParam.
isNoEscape();
11811 boolIsNoEscape = FirstNoEscape && SecondNoEscape;
11812NewParamInfos.push_back(FirstParam.
withIsNoEscape(IsNoEscape));
11813 if(NewParamInfos.back().getOpaqueValue())
11814NeedParamInfo =
true;
11815 if(FirstNoEscape != IsNoEscape)
11816CanUseFirst =
false;
11817 if(SecondNoEscape != IsNoEscape)
11818CanUseSecond =
false;
11821 if(!NeedParamInfo)
11822NewParamInfos.clear();
11828ObjCLayouts[CD] =
nullptr;
11838 if(LHSCan == RHSCan)
11840 if(RHSCan->isFunctionType()) {
11844cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
11846cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
11849 if(ResReturnType.
isNull())
11851 if(ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
11855 if(
const auto*FPT = cast<FunctionProtoType>(F)) {
11868 QualifiersRQuals = RHSCan.getLocalQualifiers();
11869 if(LQuals != RQuals) {
11882assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11898 if(ResQT == LHSBaseQT)
11900 if(ResQT == RHSBaseQT)
11912 T= ET->getDecl()->getIntegerType();
11916 returnEIT->getNumBits();
11924 "Unexpected type");
11929VTy->getNumElements(), VTy->getVectorKind());
11938 T= ETy->getDecl()->getIntegerType();
11941 caseBuiltinType::Char_U:
11943 caseBuiltinType::Char_S:
11944 caseBuiltinType::SChar:
11945 caseBuiltinType::Char8:
11947 caseBuiltinType::Short:
11949 caseBuiltinType::Int:
11951 caseBuiltinType::Long:
11953 caseBuiltinType::LongLong:
11955 caseBuiltinType::Int128:
11960 caseBuiltinType::WChar_S:
11963 caseBuiltinType::ShortAccum:
11965 caseBuiltinType::Accum:
11967 caseBuiltinType::LongAccum:
11969 caseBuiltinType::SatShortAccum:
11971 caseBuiltinType::SatAccum:
11973 caseBuiltinType::SatLongAccum:
11975 caseBuiltinType::ShortFract:
11977 caseBuiltinType::Fract:
11979 caseBuiltinType::LongFract:
11981 caseBuiltinType::SatShortFract:
11983 caseBuiltinType::SatFract:
11985 caseBuiltinType::SatLongFract:
11990 "Unexpected signed integer or fixed point type");
11998 "Unexpected type");
12003VTy->getNumElements(), VTy->getVectorKind());
12012 T= ETy->getDecl()->getIntegerType();
12015 caseBuiltinType::Char_S:
12017 caseBuiltinType::Char_U:
12018 caseBuiltinType::UChar:
12019 caseBuiltinType::Char8:
12021 caseBuiltinType::UShort:
12023 caseBuiltinType::UInt:
12025 caseBuiltinType::ULong:
12027 caseBuiltinType::ULongLong:
12029 caseBuiltinType::UInt128:
12034 caseBuiltinType::WChar_U:
12037 caseBuiltinType::UShortAccum:
12039 caseBuiltinType::UAccum:
12041 caseBuiltinType::ULongAccum:
12043 caseBuiltinType::SatUShortAccum:
12045 caseBuiltinType::SatUAccum:
12047 caseBuiltinType::SatULongAccum:
12049 caseBuiltinType::UShortFract:
12051 caseBuiltinType::UFract:
12053 caseBuiltinType::ULongFract:
12055 caseBuiltinType::SatUShortFract:
12057 caseBuiltinType::SatUFract:
12059 caseBuiltinType::SatULongFract:
12064 "Unexpected signed integer or fixed point type");
12089 boolAllowTypeModifiers) {
12093RequiresICE =
false;
12096 boolDone =
false;
12098 boolIsSpecial =
false;
12102 default: Done =
true; --Str;
break;
12104RequiresICE =
true;
12107assert(!
Unsigned&&
"Can't use both 'S' and 'U' modifiers!");
12108assert(!
Signed&&
"Can't use 'S' modifier multiple times!");
12112assert(!
Signed&&
"Can't use both 'S' and 'U' modifiers!");
12113assert(!
Unsigned&&
"Can't use 'U' modifier multiple times!");
12117assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
12118assert(HowLong <= 2 &&
"Can't have LLLL modifier");
12123assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12124assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
12133assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12134assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
12140llvm_unreachable(
"Unexpected integer type");
12151assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12152assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
12158llvm_unreachable(
"Unexpected integer type");
12171assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
12172assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
12188 default: llvm_unreachable(
"Unknown builtin type letter!");
12191 "Bad modifiers used with 'x'!");
12196 "Bad modifiers used with 'y'!");
12201 "Bad modifiers used with 'v'!");
12206 "Bad modifiers used with 'h'!");
12211 "Bad modifiers used with 'f'!");
12216 "Bad modifiers used with 'd'!");
12219 else if(HowLong == 2)
12225assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
12234 else if(HowLong == 2)
12236 else if(HowLong == 1)
12242assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
12251assert(HowLong == 0 && !
Signed&& !
Unsigned&&
"Bad modifiers for 'b'!");
12255assert(HowLong == 0 && !
Signed&& !
Unsigned&&
"Bad modifiers for 'z'!");
12259assert(HowLong == 0 && !
Signed&& !
Unsigned&&
"Bad modifiers for 'w'!");
12276assert(!
Type.isNull() &&
"builtin va list type not initialized!");
12288assert(!
Type.isNull() &&
"builtin va list type not initialized!");
12296 unsignedNumElements = strtoul(Str, &End, 10);
12297assert(End != Str &&
"Missing vector size");
12301RequiresICE,
false);
12302assert(!RequiresICE &&
"Can't require vector ICE");
12310 Type= Context.SveCountTy;
12314 Type= Context.AMDGPUBufferRsrcTy;
12318llvm_unreachable(
"Unexpected target builtin type");
12324 unsignedNumElements = strtoul(Str, &End, 10);
12325assert(End != Str &&
"Missing vector size");
12329RequiresICE,
false);
12330assert(!RequiresICE &&
"Can't require vector ICE");
12339 unsignedNumElements = strtoul(Str, &End, 10);
12340assert(End != Str &&
"Missing vector size");
12352assert(!RequiresICE &&
"Can't require complex ICE");
12361 if(
Type.isNull()) {
12372 if(
Type.isNull()) {
12378assert(HowLong == 0 && !
Signed&& !
Unsigned&&
"Bad modifiers for 'K'!");
12381 if(
Type.isNull()) {
12390 Type= Context.MFloat8Ty;
12395Done = !AllowTypeModifiers;
12397 switch(
char c= *Str++) {
12398 default: Done =
true; --Str;
break;
12404 unsignedAddrSpace = strtoul(Str, &End, 10);
12432 "Integer constant 'I' type must be an integer");
12445 boolAllowTypeModifiers)
const{
12446 return DecodeTypeFromStr(Str, Context, Error, RequireICE, AllowTypeModifiers);
12452 unsigned*IntegerConstantArgs)
const{
12454 if(TypeStr[0] ==
'\0') {
12461 boolRequiresICE =
false;
12464RequiresICE,
true);
12468assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
12470 while(TypeStr[0] && TypeStr[0] !=
'.') {
12477 if(RequiresICE && IntegerConstantArgs)
12478*IntegerConstantArgs |= 1 << ArgTypes.size();
12484ArgTypes.push_back(Ty);
12487 if(
Id== Builtin::BI__GetExceptionInfo)
12490assert((TypeStr[0] !=
'.'|| TypeStr[1] == 0) &&
12491 "'.' should only occur at end of builtin type list!");
12493 boolVariadic = (TypeStr[0] ==
'.');
12496Variadic,
false,
true));
12501 if(ArgTypes.empty() && Variadic && !
getLangOpts().requiresStrictPrototypes())
12553!FD->
hasAttr<DLLExportAttr>()) ||
12554FD->
hasAttr<GNUInlineAttr>()) {
12573isa<CXXConstructorDecl>(FD) &&
12574cast<CXXConstructorDecl>(FD)->isInheritingConstructor())
12587 if(
D->
hasAttr<DLLImportAttr>()) {
12590}
else if(
D->
hasAttr<DLLExportAttr>()) {
12596 if(
D->
hasAttr<CUDAGlobalAttr>() &&
12659 while(LexicalContext && !isa<FunctionDecl>(LexicalContext))
12664 if(!LexicalContext)
12669 autoStaticLocalLinkage =
12681 returnStaticLocalLinkage;
12708 returnStrongLinkage;
12726llvm_unreachable(
"Invalid Linkage!");
12736 if(
const auto*VD = dyn_cast<VarDecl>(
D)) {
12737 if(!VD->isFileVarDecl())
12742 if(VD->getDescribedVarTemplate() ||
12743isa<VarTemplatePartialSpecializationDecl>(VD))
12745}
else if(
const auto*FD = dyn_cast<FunctionDecl>(
D)) {
12749}
else if(isa<PragmaCommentDecl>(
D))
12751 else if(isa<PragmaDetectMismatchDecl>(
D))
12753 else if(isa<OMPRequiresDecl>(
D))
12755 else if(isa<OMPThreadPrivateDecl>(
D))
12757 else if(isa<OMPAllocateDecl>(
D))
12759 else if(isa<OMPDeclareReductionDecl>(
D) || isa<OMPDeclareMapperDecl>(
D))
12761 else if(isa<ImportDecl>(
D))
12771 if(
D->
hasAttr<WeakRefAttr>())
12778 if(
const auto*FD = dyn_cast<FunctionDecl>(
D)) {
12780 if(!FD->doesThisDeclarationHaveABody())
12781 returnFD->doesDeclarationForceExternallyVisibleDefinition();
12784 if(FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
12789 if(
getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {
12790 if(
const auto*MD = dyn_cast<CXXMethodDecl>(FD)) {
12808 const auto*VD = cast<VarDecl>(
D);
12809assert(VD->isFileVarDecl() &&
"Expected file scoped var");
12813 if(LangOpts.OpenMP &&
12814OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
12821 if(VD->shouldEmitInExternalSource())
12834 if(VD->needsDestruction(*
this))
12838 if(VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
12840(VD->getInit()->isValueDependent() || !VD->evaluateValue()))
12845 if(
const auto*DD = dyn_cast<DecompositionDecl>(VD)) {
12846 for(
const auto*BD : DD->flat_bindings())
12847 if(
const auto*BindingVD = BD->getHoldingVar())
12857llvm::function_ref<
void(
FunctionDecl*)> Pred)
const{
12858assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
12859llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
12864 for(
auto*CurDecl :
12868SeenDecls.insert(CurFD).second) {
12876 boolIsBuiltin)
const{
12879 returnABI->getDefaultMethodCallConv(IsVariadic);
12884 switch(LangOpts.getDefaultCallingConv()) {
12913 return Target->getDefaultCallingConv();
12918 returnABI->isNearlyEmpty(RD);
12922 if(!VTContext.get()) {
12923 autoABI =
Target->getCXXABI();
12924 if(ABI.isMicrosoft())
12927 autoComponentLayout =
getLangOpts().RelativeCXXABIVTables
12933 returnVTContext.get();
12939 switch(
T->getCXXABI().getKind()) {
12940 caseTargetCXXABI::AppleARM64:
12941 caseTargetCXXABI::Fuchsia:
12942 caseTargetCXXABI::GenericAArch64:
12943 caseTargetCXXABI::GenericItanium:
12944 caseTargetCXXABI::GenericARM:
12945 caseTargetCXXABI::GenericMIPS:
12946 caseTargetCXXABI::iOS:
12947 caseTargetCXXABI::WebAssembly:
12948 caseTargetCXXABI::WatchOS:
12949 caseTargetCXXABI::XL:
12951 caseTargetCXXABI::Microsoft:
12954llvm_unreachable(
"Unsupported ABI");
12958assert(
T.getCXXABI().getKind() != TargetCXXABI::Microsoft &&
12959 "Device mangle context does not support Microsoft mangling.");
12960 switch(
T.getCXXABI().getKind()) {
12961 caseTargetCXXABI::AppleARM64:
12962 caseTargetCXXABI::Fuchsia:
12963 caseTargetCXXABI::GenericAArch64:
12964 caseTargetCXXABI::GenericItanium:
12965 caseTargetCXXABI::GenericARM:
12966 caseTargetCXXABI::GenericMIPS:
12967 caseTargetCXXABI::iOS:
12968 caseTargetCXXABI::WebAssembly:
12969 caseTargetCXXABI::WatchOS:
12970 caseTargetCXXABI::XL:
12974 if(
const auto*RD = dyn_cast<CXXRecordDecl>(ND))
12975 returnRD->getDeviceLambdaManglingNumber();
12976 returnstd::nullopt;
12979 caseTargetCXXABI::Microsoft:
12983llvm_unreachable(
"Unsupported ABI");
12989 returnASTRecordLayouts.getMemorySize() +
12990llvm::capacity_in_bytes(ObjCLayouts) +
12991llvm::capacity_in_bytes(KeyFunctions) +
12992llvm::capacity_in_bytes(ObjCImpls) +
12993llvm::capacity_in_bytes(BlockVarCopyInits) +
12994llvm::capacity_in_bytes(DeclAttrs) +
12995llvm::capacity_in_bytes(TemplateOrInstantiation) +
12996llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
12997llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
12998llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
12999llvm::capacity_in_bytes(OverriddenMethods) +
13000llvm::capacity_in_bytes(Types) +
13001llvm::capacity_in_bytes(VariableArrayTypes);
13009 unsigned Signed)
const{
13012 if(!QualTy && DestWidth == 128)
13041llvm_unreachable(
"Unhandled TargetInfo::RealType value");
13048MangleNumbers[ND] = Number;
13055 boolForAuxTarget)
const{
13056 autoI = MangleNumbers.find(ND);
13057 unsignedRes = I != MangleNumbers.end() ? I->second : 1;
13060 if(LangOpts.CUDA && !LangOpts.CUDAIsDevice) {
13061Res = ForAuxTarget ? Res >> 16 : Res & 0xFFFF;
13063assert(!ForAuxTarget &&
"Only CUDA/HIP host compilation supports mangling " 13064 "number for aux target");
13066 returnRes > 1 ? Res : 1;
13073StaticLocalNumbers[VD] = Number;
13080 autoI = StaticLocalNumbers.find(VD);
13081 returnI != StaticLocalNumbers.end() ? I->second : 1;
13086assert(LangOpts.CPlusPlus);
13087std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
13095assert(LangOpts.CPlusPlus);
13096std::unique_ptr<MangleNumberingContext> &MCtx =
13097ExtraMangleNumberingContexts[
D];
13103std::unique_ptr<MangleNumberingContext>
13105 returnABI->createMangleNumberingContext();
13110 returnABI->getCopyConstructorForExceptionObject(
13116 returnABI->addCopyConstructorForExceptionObject(
13123 returnABI->addTypedefNameForUnnamedTagDecl(TD, DD);
13128 returnABI->getTypedefNameForUnnamedTagDecl(TD);
13133 returnABI->addDeclaratorForUnnamedTagDecl(TD, DD);
13137 returnABI->getDeclaratorForUnnamedTagDecl(TD);
13141ParamIndices[
D] = index;
13145ParameterIndexTable::const_iterator I = ParamIndices.find(
D);
13146assert(I != ParamIndices.end() &&
13147 "ParmIndices lacks entry set by ParmVarDecl");
13152 unsignedLength)
const{
13178assert(
MSGuidTagDecl&&
"building MS GUID without MS extensions?");
13180llvm::FoldingSetNodeID ID;
13184 if(
MSGuidDecl*Existing = MSGuidDecls.FindNodeOrInsertPos(ID, InsertPos))
13188 MSGuidDecl*New = MSGuidDecl::Create(*
this, GUIDType, Parts);
13189MSGuidDecls.InsertNode(New, InsertPos);
13195 const APValue&APVal)
const{
13196llvm::FoldingSetNodeID ID;
13201UnnamedGlobalConstantDecls.FindNodeOrInsertPos(ID, InsertPos))
13205UnnamedGlobalConstantDecl::Create(*
this, Ty, APVal);
13206UnnamedGlobalConstantDecls.InsertNode(New, InsertPos);
13212assert(
T->
isRecordType() &&
"template param object of unexpected type");
13218llvm::FoldingSetNodeID ID;
13223TemplateParamObjectDecls.FindNodeOrInsertPos(ID, InsertPos))
13227TemplateParamObjectDecls.InsertNode(New, InsertPos);
13233 if(!
T.isOSDarwin())
13236 if(!(
T.isiOS() &&
T.isOSVersionLT(7)) &&
13237!(
T.isMacOSX() &&
T.isOSVersionLT(10, 9)))
13246 return(Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
13253 if(MethodDecl->
hasAttr<UnavailableAttr>()
13254|| MethodDecl->
hasAttr<DeprecatedAttr>())
13268IM != EM && IF != EF; ++IM, ++IF) {
13299llvm::FoldingSetNodeID IDX, IDY;
13300 X->Profile(IDX, *
this,
true);
13301Y->
Profile(IDY, *
this,
true);
13315 for(
const Decl*DX :
X->redecls()) {
13320 if(DX->isFirstDecl())
13323llvm_unreachable(
"Corrupt redecls chain");
13326template<
classT, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
13328 returncast_or_null<T>(
13330 const_cast<Decl*
>(cast_or_null<Decl>(Y))));
13333template<
classT, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
13336 const_cast<Decl*
>(cast<Decl>(Y))));
13341 boolIgnoreDeduced =
false) {
13356 boolIgnoreDeduced) {
13364assert(Xs.size() == Ys.size());
13366 for(
size_tI = 0; I < Rs.size(); ++I)
13373 return X->getAttributeLoc() == Y->getAttributeLoc() ?
X->getAttributeLoc()
13380 if(
X.getKind() != Y.
getKind())
13383 switch(
X.getKind()) {
13413 autoNExpX =
X.getNumTemplateExpansions();
13427 if(Xs.size() != Ys.size())
13429R.resize(Xs.size());
13430 for(
size_tI = 0; I < R.size(); ++I) {
13443assert(!Different);
13450 return X->getKeyword() == Y->getKeyword() ?
X->getKeyword()
13458 return X->getQualifier() == Y->getQualifier()
13459?
X->getQualifier()
13472 QualTypeEX =
X->getElementType(), EY = Y->getElementType();
13477QY += EY.getQualifiers() - RQ;
13487assert(Ctx.
hasSameExpr(
X->getSizeExpr(), Y->getSizeExpr()));
13488 return X->getSizeExpr();
13493 return X->getSizeModifier();
13499 return X->getIndexTypeCVRQualifiers();
13508llvm::DenseMap<QualType, unsigned>
Found;
13509 for(
autoTs : {
X, Y}) {
13516Out.emplace_back(
T);
13526 boolAcceptDependent) {
13552assert(AcceptDependent &&
13553 "computing composite pointer type of dependent types");
13568llvm_unreachable(
"These ESTs should be handled above");
13573assert(EST2 ==
EST_Dynamic&&
"other cases should already be handled");
13577 Result.Exceptions = ExceptionTypeStorage;
13584llvm_unreachable(
"shouldn't see unresolved exception specifications here");
13587llvm_unreachable(
"invalid ExceptionSpecificationType");
13596#define UNEXPECTED_TYPE(Class, Kind) \ 13597 case Type::Class: \ 13598 llvm_unreachable("Unexpected "Kind ": " #Class);
13600#define NON_CANONICAL_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "non-canonical")
13601#define TYPE(Class, Base) 13602#include "clang/AST/TypeNodes.inc" 13604#define SUGAR_FREE_TYPE(Class) UNEXPECTED_TYPE(Class, "sugar-free")
13615#undef SUGAR_FREE_TYPE 13616#define NON_UNIQUE_TYPE(Class) UNEXPECTED_TYPE(Class, "non-unique")
13619#undef NON_UNIQUE_TYPE 13623#undef UNEXPECTED_TYPE 13626 const auto*AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
13627assert(AX->getDeducedType().isNull());
13628assert(AY->getDeducedType().isNull());
13629assert(AX->getKeyword() == AY->getKeyword());
13630assert(AX->isInstantiationDependentType() ==
13631AY->isInstantiationDependentType());
13633AY->getTypeConstraintArguments());
13636AX->containsUnexpandedParameterPack(),
13638AY->getTypeConstraintConcept()),
13641 caseType::IncompleteArray: {
13642 const auto*AX = cast<IncompleteArrayType>(
X),
13643*AY = cast<IncompleteArrayType>(Y);
13648 caseType::DependentSizedArray: {
13649 const auto*AX = cast<DependentSizedArrayType>(
X),
13650*AY = cast<DependentSizedArrayType>(Y);
13655AX->getBracketsRange() == AY->getBracketsRange()
13656? AX->getBracketsRange()
13659 caseType::ConstantArray: {
13660 const auto*AX = cast<ConstantArrayType>(
X),
13661*AY = cast<ConstantArrayType>(Y);
13662assert(AX->getSize() == AY->getSize());
13663 const Expr*SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
13664? AX->getSizeExpr()
13670 caseType::ArrayParameter: {
13671 const auto*AX = cast<ArrayParameterType>(
X),
13672*AY = cast<ArrayParameterType>(Y);
13673assert(AX->getSize() == AY->getSize());
13674 const Expr*SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
13675? AX->getSizeExpr()
13682 caseType::Atomic: {
13683 const auto*AX = cast<AtomicType>(
X), *AY = cast<AtomicType>(Y);
13687 caseType::Complex: {
13688 const auto*CX = cast<ComplexType>(
X), *CY = cast<ComplexType>(Y);
13691 caseType::Pointer: {
13692 const auto*PX = cast<PointerType>(
X), *PY = cast<PointerType>(Y);
13695 caseType::BlockPointer: {
13696 const auto*PX = cast<BlockPointerType>(
X), *PY = cast<BlockPointerType>(Y);
13699 caseType::ObjCObjectPointer: {
13700 const auto*PX = cast<ObjCObjectPointerType>(
X),
13701*PY = cast<ObjCObjectPointerType>(Y);
13704 caseType::MemberPointer: {
13705 const auto*PX = cast<MemberPointerType>(
X),
13706*PY = cast<MemberPointerType>(Y);
13713 caseType::LValueReference: {
13714 const auto*PX = cast<LValueReferenceType>(
X),
13715*PY = cast<LValueReferenceType>(Y);
13718PX->isSpelledAsLValue() ||
13719PY->isSpelledAsLValue());
13721 caseType::RValueReference: {
13722 const auto*PX = cast<RValueReferenceType>(
X),
13723*PY = cast<RValueReferenceType>(Y);
13727 caseType::DependentAddressSpace: {
13728 const auto*PX = cast<DependentAddressSpaceType>(
X),
13729*PY = cast<DependentAddressSpaceType>(Y);
13730assert(Ctx.
hasSameExpr(PX->getAddrSpaceExpr(), PY->getAddrSpaceExpr()));
13732PX->getAddrSpaceExpr(),
13735 caseType::FunctionNoProto: {
13736 const auto*FX = cast<FunctionNoProtoType>(
X),
13737*FY = cast<FunctionNoProtoType>(Y);
13738assert(FX->getExtInfo() == FY->getExtInfo());
13743 caseType::FunctionProto: {
13744 const auto*FX = cast<FunctionProtoType>(
X),
13745*FY = cast<FunctionProtoType>(Y);
13747EPIY = FY->getExtProtoInfo();
13748assert(EPIX.
ExtInfo== EPIY.ExtInfo);
13751assert(EPIX.
TypeQuals== EPIY.TypeQuals);
13752assert(EPIX.
Variadic== EPIY.Variadic);
13766EPIX.
ExceptionSpec, EPIY.ExceptionSpec, Exceptions,
true);
13769 caseType::ObjCObject: {
13770 const auto*OX = cast<ObjCObjectType>(
X), *OY = cast<ObjCObjectType>(Y);
13772std::equal(OX->getProtocols().begin(), OX->getProtocols().end(),
13773OY->getProtocols().begin(), OY->getProtocols().end(),
13775return P0->getCanonicalDecl() == P1->getCanonicalDecl();
13777 "protocol lists must be the same");
13779OY->getTypeArgsAsWritten());
13782OX->getProtocols(),
13783OX->isKindOfTypeAsWritten() && OY->isKindOfTypeAsWritten());
13785 caseType::ConstantMatrix: {
13786 const auto*MX = cast<ConstantMatrixType>(
X),
13787*MY = cast<ConstantMatrixType>(Y);
13788assert(MX->getNumRows() == MY->getNumRows());
13789assert(MX->getNumColumns() == MY->getNumColumns());
13791MX->getNumRows(), MX->getNumColumns());
13793 caseType::DependentSizedMatrix: {
13794 const auto*MX = cast<DependentSizedMatrixType>(
X),
13795*MY = cast<DependentSizedMatrixType>(Y);
13796assert(Ctx.
hasSameExpr(MX->getRowExpr(), MY->getRowExpr()));
13797assert(Ctx.
hasSameExpr(MX->getColumnExpr(), MY->getColumnExpr()));
13802 caseType::Vector: {
13803 const auto*VX = cast<VectorType>(
X), *VY = cast<VectorType>(Y);
13804assert(VX->getNumElements() == VY->getNumElements());
13805assert(VX->getVectorKind() == VY->getVectorKind());
13807VX->getNumElements(), VX->getVectorKind());
13809 caseType::ExtVector: {
13810 const auto*VX = cast<ExtVectorType>(
X), *VY = cast<ExtVectorType>(Y);
13811assert(VX->getNumElements() == VY->getNumElements());
13813VX->getNumElements());
13815 caseType::DependentSizedExtVector: {
13816 const auto*VX = cast<DependentSizedExtVectorType>(
X),
13817*VY = cast<DependentSizedExtVectorType>(Y);
13822 caseType::DependentVector: {
13823 const auto*VX = cast<DependentVectorType>(
X),
13824*VY = cast<DependentVectorType>(Y);
13825assert(VX->getVectorKind() == VY->getVectorKind());
13830 caseType::InjectedClassName: {
13831 const auto*IX = cast<InjectedClassNameType>(
X),
13832*IY = cast<InjectedClassNameType>(Y);
13836IY->getInjectedSpecializationType()));
13838 caseType::TemplateSpecialization: {
13839 const auto*TX = cast<TemplateSpecializationType>(
X),
13840*TY = cast<TemplateSpecializationType>(Y);
13842TY->template_arguments());
13845TY->getTemplateName(),
13847As,
X->getCanonicalTypeInternal());
13849 caseType::Decltype: {
13850 const auto*DX = cast<DecltypeType>(
X);
13851[[maybe_unused]]
const auto*DY = cast<DecltypeType>(Y);
13852assert(DX->isDependentType());
13853assert(DY->isDependentType());
13854assert(Ctx.
hasSameExpr(DX->getUnderlyingExpr(), DY->getUnderlyingExpr()));
13858 caseType::PackIndexing: {
13859 const auto*DX = cast<PackIndexingType>(
X);
13860[[maybe_unused]]
const auto*DY = cast<PackIndexingType>(Y);
13861assert(DX->isDependentType());
13862assert(DY->isDependentType());
13863assert(Ctx.
hasSameExpr(DX->getIndexExpr(), DY->getIndexExpr()));
13866 caseType::DependentName: {
13867 const auto*NX = cast<DependentNameType>(
X),
13868*NY = cast<DependentNameType>(Y);
13869assert(NX->getIdentifier() == NY->getIdentifier());
13872NX->getIdentifier(), NX->getCanonicalTypeInternal());
13874 caseType::DependentTemplateSpecialization: {
13875 const auto*TX = cast<DependentTemplateSpecializationType>(
X),
13876*TY = cast<DependentTemplateSpecializationType>(Y);
13877assert(TX->getIdentifier() == TY->getIdentifier());
13879TY->template_arguments());
13882TX->getIdentifier(), As);
13884 caseType::UnaryTransform: {
13885 const auto*TX = cast<UnaryTransformType>(
X),
13886*TY = cast<UnaryTransformType>(Y);
13887assert(TX->getUTTKind() == TY->getUTTKind());
13891TY->getUnderlyingType()),
13894 caseType::PackExpansion: {
13895 const auto*PX = cast<PackExpansionType>(
X),
13896*PY = cast<PackExpansionType>(Y);
13897assert(PX->getNumExpansions() == PY->getNumExpansions());
13900PX->getNumExpansions(),
false);
13903 const auto*PX = cast<PipeType>(
X), *PY = cast<PipeType>(Y);
13904assert(PX->isReadOnly() == PY->isReadOnly());
13909 caseType::TemplateTypeParm: {
13910 const auto*TX = cast<TemplateTypeParmType>(
X),
13911*TY = cast<TemplateTypeParmType>(Y);
13912assert(TX->getDepth() == TY->getDepth());
13913assert(TX->getIndex() == TY->getIndex());
13914assert(TX->isParameterPack() == TY->isParameterPack());
13916TX->getDepth(), TX->getIndex(), TX->isParameterPack(),
13920llvm_unreachable(
"Unknown Type Class");
13930#define UNEXPECTED_TYPE(Class, Kind) \ 13931 case Type::Class: \ 13932 llvm_unreachable("Unexpected "Kind ": " #Class);
13933#define TYPE(Class, Base) 13934#define DEPENDENT_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "dependent")
13935#include "clang/AST/TypeNodes.inc" 13937#define CANONICAL_TYPE(Class) UNEXPECTED_TYPE(Class, "canonical")
13963#undef CANONICAL_TYPE 13965#undef UNEXPECTED_TYPE 13967 caseType::Adjusted: {
13968 const auto*AX = cast<AdjustedType>(
X), *AY = cast<AdjustedType>(Y);
13969 QualTypeOX = AX->getOriginalType(), OY = AY->getOriginalType();
13976 caseType::Decayed: {
13977 const auto*DX = cast<DecayedType>(
X), *DY = cast<DecayedType>(Y);
13978 QualTypeOX = DX->getOriginalType(), OY = DY->getOriginalType();
13985 caseType::Attributed: {
13986 const auto*AX = cast<AttributedType>(
X), *AY = cast<AttributedType>(Y);
13988 if(Kind != AY->getAttrKind())
13990 QualTypeMX = AX->getModifiedType(), MY = AY->getModifiedType();
13998 caseType::BTFTagAttributed: {
13999 const auto*BX = cast<BTFTagAttributedType>(
X);
14000 constBTFTypeTagAttr *AX = BX->getAttr();
14002 if(AX->getBTFTypeTag() !=
14003cast<BTFTagAttributedType>(Y)->getAttr()->getBTFTypeTag())
14008 const auto*AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
14011 if(KW != AY->getKeyword())
14015AY->getTypeConstraintConcept());
14019AY->getTypeConstraintArguments())) {
14027 false,
false, CD, As);
14029 caseType::PackIndexing:
14030 caseType::Decltype:
14032 caseType::DeducedTemplateSpecialization:
14036 caseType::Elaborated: {
14037 const auto*EX = cast<ElaboratedType>(
X), *EY = cast<ElaboratedType>(Y);
14043 caseType::MacroQualified: {
14044 const auto*MX = cast<MacroQualifiedType>(
X),
14045*MY = cast<MacroQualifiedType>(Y);
14047 if(IX != MY->getMacroIdentifier())
14051 caseType::SubstTemplateTypeParm: {
14052 const auto*SX = cast<SubstTemplateTypeParmType>(
X),
14053*SY = cast<SubstTemplateTypeParmType>(Y);
14058 unsignedIndex = SX->getIndex();
14059 if(Index != SY->getIndex())
14061 autoPackIndex = SX->getPackIndex();
14062 if(PackIndex != SY->getPackIndex())
14065CD, Index, PackIndex);
14067 caseType::ObjCTypeParam:
14073 caseType::TemplateSpecialization: {
14074 const auto*TX = cast<TemplateSpecializationType>(
X),
14075*TY = cast<TemplateSpecializationType>(Y);
14078TY->getTemplateName(),
true);
14083TY->template_arguments()))
14088 caseType::Typedef: {
14089 const auto*TX = cast<TypedefType>(
X), *TY = cast<TypedefType>(Y);
14095 caseType::TypeOf: {
14101 if(cast<TypeOfType>(
X)->
getKind() == cast<TypeOfType>(Y)->
getKind() &&
14106 caseType::TypeOfExpr:
14109 caseType::UnaryTransform: {
14110 const auto*UX = cast<UnaryTransformType>(
X),
14111*UY = cast<UnaryTransformType>(Y);
14113 if(KX != UY->getUTTKind())
14115 QualTypeBX = UX->getBaseType(), BY = UY->getBaseType();
14122 caseType::Using: {
14123 const auto*UX = cast<UsingType>(
X), *UY = cast<UsingType>(Y);
14130 caseType::CountAttributed: {
14131 const auto*DX = cast<CountAttributedType>(
X),
14132*DY = cast<CountAttributedType>(Y);
14133 if(DX->isCountInBytes() != DY->isCountInBytes())
14135 if(DX->isOrNull() != DY->isOrNull())
14137 Expr*CEX = DX->getCountExpr();
14138 Expr*CEY = DY->getCountExpr();
14142DX->isCountInBytes(), DX->isOrNull(),
14153DX->isCountInBytes(), DX->isOrNull(),
14157llvm_unreachable(
"Unhandled Type Class");
14179 if(
X.isCanonical())
14192 if(SX.
Ty!= SY.Ty) {
14200 while(!Xs.empty() && !Ys.empty() && Xs.back().Ty == Ys.back().Ty) {
14203SX = Xs.pop_back_val();
14204SY = Ys.pop_back_val();
14214 while(!Xs.empty() && !Ys.empty()) {
14217SX = Xs.pop_back_val();
14218SY = Ys.pop_back_val();
14223SX.
Ty= Underlying.Ty;
14226QX -= Underlying.Quals;
14244llvm_unreachable(
"Not a saturated fixed point type!");
14245 caseBuiltinType::SatShortAccum:
14247 caseBuiltinType::SatAccum:
14249 caseBuiltinType::SatLongAccum:
14251 caseBuiltinType::SatUShortAccum:
14253 caseBuiltinType::SatUAccum:
14255 caseBuiltinType::SatULongAccum:
14257 caseBuiltinType::SatShortFract:
14259 caseBuiltinType::SatFract:
14261 caseBuiltinType::SatLongFract:
14263 caseBuiltinType::SatUShortFract:
14265 caseBuiltinType::SatUFract:
14267 caseBuiltinType::SatULongFract:
14279llvm_unreachable(
"Not a fixed point type!");
14280 caseBuiltinType::ShortAccum:
14282 caseBuiltinType::Accum:
14284 caseBuiltinType::LongAccum:
14286 caseBuiltinType::UShortAccum:
14288 caseBuiltinType::UAccum:
14290 caseBuiltinType::ULongAccum:
14292 caseBuiltinType::ShortFract:
14294 caseBuiltinType::Fract:
14296 caseBuiltinType::LongFract:
14298 caseBuiltinType::UShortFract:
14300 caseBuiltinType::UFract:
14302 caseBuiltinType::ULongFract:
14308 if(LangOpts.OpenCL)
14332llvm_unreachable(
"Not a fixed point type!");
14333 caseBuiltinType::ShortAccum:
14334 caseBuiltinType::SatShortAccum:
14335 return Target.getShortAccumScale();
14336 caseBuiltinType::Accum:
14337 caseBuiltinType::SatAccum:
14338 return Target.getAccumScale();
14339 caseBuiltinType::LongAccum:
14340 caseBuiltinType::SatLongAccum:
14341 return Target.getLongAccumScale();
14342 caseBuiltinType::UShortAccum:
14343 caseBuiltinType::SatUShortAccum:
14344 return Target.getUnsignedShortAccumScale();
14345 caseBuiltinType::UAccum:
14346 caseBuiltinType::SatUAccum:
14347 return Target.getUnsignedAccumScale();
14348 caseBuiltinType::ULongAccum:
14349 caseBuiltinType::SatULongAccum:
14350 return Target.getUnsignedLongAccumScale();
14351 caseBuiltinType::ShortFract:
14352 caseBuiltinType::SatShortFract:
14353 return Target.getShortFractScale();
14354 caseBuiltinType::Fract:
14355 caseBuiltinType::SatFract:
14356 return Target.getFractScale();
14357 caseBuiltinType::LongFract:
14358 caseBuiltinType::SatLongFract:
14359 return Target.getLongFractScale();
14360 caseBuiltinType::UShortFract:
14361 caseBuiltinType::SatUShortFract:
14362 return Target.getUnsignedShortFractScale();
14363 caseBuiltinType::UFract:
14364 caseBuiltinType::SatUFract:
14365 return Target.getUnsignedFractScale();
14366 caseBuiltinType::ULongFract:
14367 caseBuiltinType::SatULongFract:
14368 return Target.getUnsignedLongFractScale();
14378llvm_unreachable(
"Not a fixed point type!");
14379 caseBuiltinType::ShortAccum:
14380 caseBuiltinType::SatShortAccum:
14381 return Target.getShortAccumIBits();
14382 caseBuiltinType::Accum:
14383 caseBuiltinType::SatAccum:
14384 return Target.getAccumIBits();
14385 caseBuiltinType::LongAccum:
14386 caseBuiltinType::SatLongAccum:
14387 return Target.getLongAccumIBits();
14388 caseBuiltinType::UShortAccum:
14389 caseBuiltinType::SatUShortAccum:
14390 return Target.getUnsignedShortAccumIBits();
14391 caseBuiltinType::UAccum:
14392 caseBuiltinType::SatUAccum:
14393 return Target.getUnsignedAccumIBits();
14394 caseBuiltinType::ULongAccum:
14395 caseBuiltinType::SatULongAccum:
14396 return Target.getUnsignedLongAccumIBits();
14397 caseBuiltinType::ShortFract:
14398 caseBuiltinType::SatShortFract:
14399 caseBuiltinType::Fract:
14400 caseBuiltinType::SatFract:
14401 caseBuiltinType::LongFract:
14402 caseBuiltinType::SatLongFract:
14403 caseBuiltinType::UShortFract:
14404 caseBuiltinType::SatUShortFract:
14405 caseBuiltinType::UFract:
14406 caseBuiltinType::SatUFract:
14407 caseBuiltinType::ULongFract:
14408 caseBuiltinType::SatULongFract:
14413llvm::FixedPointSemantics
14416 "Can only get the fixed point semantics for a " 14417 "fixed point or integer type.");
14419 returnllvm::FixedPointSemantics::GetIntegerSemantics(
14423 returnllvm::FixedPointSemantics(
14426!isSigned &&
getTargetInfo().doUnsignedFixedPointTypesHavePadding());
14441 "Expected unsigned fixed point type");
14444 caseBuiltinType::UShortAccum:
14446 caseBuiltinType::UAccum:
14448 caseBuiltinType::ULongAccum:
14450 caseBuiltinType::SatUShortAccum:
14452 caseBuiltinType::SatUAccum:
14454 caseBuiltinType::SatULongAccum:
14456 caseBuiltinType::UShortFract:
14458 caseBuiltinType::UFract:
14460 caseBuiltinType::ULongFract:
14462 caseBuiltinType::SatUShortFract:
14464 caseBuiltinType::SatUFract:
14466 caseBuiltinType::SatULongFract:
14469llvm_unreachable(
"Unexpected unsigned fixed point type");
14477std::vector<std::string> BackendFeats;
14478llvm::AArch64::ExtensionSet FeatureBits;
14479 for(StringRef F : FMVFeatStrings)
14480 if(
autoFMVExt = llvm::AArch64::parseFMVExtension(F))
14482FeatureBits.enable(*FMVExt->ID);
14483FeatureBits.toLLVMFeatureList(BackendFeats);
14484 returnBackendFeats;
14489assert(TD !=
nullptr);
14492llvm::erase_if(
ParsedAttr.Features, [&](
conststd::string &Feat) {
14493return !Target->isValidFeatureName(StringRef{Feat}.substr(1));
14504 Target->getTargetOpts().CPU,
14505 Target->getTargetOpts().Features);
14512StringRef TargetCPU =
Target->getTargetOpts().CPU;
14514 if(
const auto*TD = FD->
getAttr<TargetAttr>()) {
14520 if(!
Target->getTriple().isAArch64())
14523 Target->getTargetOpts().FeaturesAsWritten.begin(),
14524 Target->getTargetOpts().FeaturesAsWritten.end());
14535}
else if(
const auto*SD = FD->
getAttr<CPUSpecificAttr>()) {
14537 Target->getCPUSpecificCPUDispatchFeatures(
14539std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
14540Features.insert(Features.begin(),
14541 Target->getTargetOpts().FeaturesAsWritten.begin(),
14542 Target->getTargetOpts().FeaturesAsWritten.end());
14544}
else if(
const auto*TC = FD->
getAttr<TargetClonesAttr>()) {
14545 if(
Target->getTriple().isAArch64()) {
14549Features.insert(Features.begin(),
14550 Target->getTargetOpts().FeaturesAsWritten.begin(),
14551 Target->getTargetOpts().FeaturesAsWritten.end());
14553}
else if(
Target->getTriple().isRISCV()) {
14555std::vector<std::string> Features;
14556 if(VersionStr !=
"default") {
14558Features.insert(Features.begin(),
ParsedAttr.Features.begin(),
14561Features.insert(Features.begin(),
14562 Target->getTargetOpts().FeaturesAsWritten.begin(),
14563 Target->getTargetOpts().FeaturesAsWritten.end());
14566std::vector<std::string> Features;
14568 if(VersionStr.starts_with(
"arch="))
14569TargetCPU = VersionStr.drop_front(
sizeof(
"arch=") - 1);
14570 else if(VersionStr !=
"default")
14571Features.push_back((StringRef{
"+"} + VersionStr).str());
14574}
else if(
const auto*TV = FD->
getAttr<TargetVersionAttr>()) {
14575std::vector<std::string> Features;
14576 if(
Target->getTriple().isRISCV()) {
14578Features.insert(Features.begin(),
ParsedAttr.Features.begin(),
14581assert(
Target->getTriple().isAArch64());
14583TV->getFeatures(Feats);
14586Features.insert(Features.begin(),
14587 Target->getTargetOpts().FeaturesAsWritten.begin(),
14588 Target->getTargetOpts().FeaturesAsWritten.end());
14591FeatureMap =
Target->getTargetOpts().FeatureMap;
14597 return{KernelNameType, FD};
14606 const auto*SKEPAttr = FD->
getAttr<SYCLKernelEntryPointAttr>();
14607assert(SKEPAttr &&
"Missing sycl_kernel_entry_point attribute");
14616 "SYCL kernel name conflict");
14631 return&IT->second;
14636OMPTraitInfoVector.emplace_back(
new OMPTraitInfo());
14637 return*OMPTraitInfoVector.back();
14643 if(Section.
Decl)
14644 returnDB << Section.
Decl;
14645 returnDB <<
"a prior #pragma section";
14649 boolIsInternalVar =
14650isa<VarDecl>(
D) &&
14652 boolIsExplicitDeviceVar = (
D->
hasAttr<CUDADeviceAttr>() &&
14653!
D->
getAttr<CUDADeviceAttr>()->isImplicit()) ||
14654(
D->
hasAttr<CUDAConstantAttr>() &&
14655!
D->
getAttr<CUDAConstantAttr>()->isImplicit());
14659 return(IsInternalVar &&
14660(
D->
hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) ||
14661(
D->
hasAttr<CUDAGlobalAttr>() &&
14673 if(!CUIDHash.empty())
14675 if(LangOpts.
CUID.empty())
14676 returnStringRef();
14677CUIDHash = llvm::utohexstr(llvm::MD5Hash(LangOpts.
CUID),
true);
14687assert(PrimaryBase);
14690 auto Base= Layout.getPrimaryBase();
14691 if(!
Base||
Base== PrimaryBase || !
Base->isPolymorphic())
14693PrimaryBase =
Base;
14695 returnPrimaryBase;
14699StringRef MangledName) {
14700 auto*Method = cast<CXXMethodDecl>(VirtualMethodDecl.
getDecl());
14701assert(Method->isVirtual());
14702 boolDefaultIncludesPointerAuth =
14703LangOpts.PointerAuthCalls || LangOpts.PointerAuthIntrinsics;
14705 if(!DefaultIncludesPointerAuth)
14708 autoExisting = ThunksToBeAbbreviated.find(VirtualMethodDecl);
14709 if(Existing != ThunksToBeAbbreviated.end())
14710 returnExisting->second.contains(MangledName.str());
14713llvm::StringMap<llvm::SmallVector<std::string, 2>> Thunks;
14715 if(
const auto*ThunkInfos = VtableContext->getThunkInfo(VirtualMethodDecl)) {
14716 auto*
Destructor= dyn_cast<CXXDestructorDecl>(Method);
14717 for(
const auto&Thunk : *ThunkInfos) {
14719llvm::raw_svector_ostream ElidedNameStream(ElidedName);
14725Mangler->mangleThunk(Method, Thunk,
true,
14728llvm::raw_svector_ostream mangledNameStream(MangledName);
14732mangledNameStream);
14734Mangler->mangleThunk(Method, Thunk,
false,
14735mangledNameStream);
14737Thunks[ElidedName].push_back(std::string(MangledName));
14740llvm::StringSet<> SimplifiedThunkNames;
14741 for(
auto&ThunkList : Thunks) {
14742llvm::sort(ThunkList.second);
14743SimplifiedThunkNames.insert(ThunkList.second[0]);
14745 bool Result= SimplifiedThunkNames.contains(MangledName);
14746ThunksToBeAbbreviated[VirtualMethodDecl] = std::move(SimplifiedThunkNames);
This file provides AST data structures related to concepts.
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl * > &Protocols)
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
static SourceLocation getCommonAttrLoc(const T *X, const T *Y)
static auto getCommonTypes(ASTContext &Ctx, ArrayRef< QualType > Xs, ArrayRef< QualType > Ys, bool Unqualified=false)
static auto getCanonicalTemplateArguments(const ASTContext &C, ArrayRef< TemplateArgument > Args, bool &AnyNonCanonArgs)
static char getObjCEncodingForPrimitiveType(const ASTContext *C, const BuiltinType *BT)
static bool NeedsInjectedClassNameType(const RecordDecl *D)
static bool unionHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static NamespaceDecl * getNamespace(const NestedNameSpecifier *X)
static TypedefDecl * CreateHexagonBuiltinVaListDecl(const ASTContext *Context)
#define CANONICAL_TYPE(Class)
static NestedNameSpecifier * getCommonNNS(ASTContext &Ctx, const T *X, const T *Y)
static Decl * getCommonDecl(Decl *X, Decl *Y)
static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context, const Decl *D, GVALinkage L)
static bool isTypeTypedefedAsBOOL(QualType T)
static void EncodeBitField(const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
static const TemplateArgument * getDefaultTemplateArgumentOrNone(const NamedDecl *P)
static uint64_t getSVETypeSize(ASTContext &Context, const BuiltinType *Ty)
getSVETypeSize - Return SVE vector or predicate register size.
#define SUGAR_FREE_TYPE(Class)
static bool getCommonTemplateArguments(ASTContext &Ctx, SmallVectorImpl< TemplateArgument > &R, ArrayRef< TemplateArgument > Xs, ArrayRef< TemplateArgument > Ys)
static bool hasTemplateSpecializationInEncodedString(const Type *T, bool VisitBasesAndFields)
static void getIntersectionOfProtocols(ASTContext &Context, const ObjCInterfaceDecl *CommonBase, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, SmallVectorImpl< ObjCProtocolDecl * > &IntersectionSet)
getIntersectionOfProtocols - This routine finds the intersection of set of protocols inherited from t...
static bool areCompatMatrixTypes(const ConstantMatrixType *LHS, const ConstantMatrixType *RHS)
areCompatMatrixTypes - Return true if the two specified matrix types are compatible.
static TypedefDecl * CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context)
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
static bool canAssignObjCObjectTypes(ASTContext &ctx, QualType lhs, QualType rhs)
Determine whether the first type is a subtype of the second.
static const Type * getIntegerTypeForEnum(const EnumType *ET)
static const Decl & adjustDeclToTemplate(const Decl &D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template.
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
static QualType getCommonElementType(ASTContext &Ctx, const T *X, const T *Y)
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
static auto getCommonSizeModifier(const ArrayType *X, const ArrayType *Y)
static std::optional< int64_t > structHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static bool hasSameOverloadableAttrs(const FunctionDecl *A, const FunctionDecl *B)
Determine whether the attributes we can overload on are identical for A and B.
static T * getCommonDeclChecked(T *X, T *Y)
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
static int64_t getSubobjectOffset(const FieldDecl *Field, const ASTContext &Context, const clang::ASTRecordLayout &)
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
static TypedefDecl * CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context)
static TemplateName getCommonTemplateNameChecked(ASTContext &Ctx, TemplateName X, TemplateName Y, bool IgnoreDeduced)
static QualType mergeEnumWithInteger(ASTContext &Context, const EnumType *ET, QualType other, bool isBlockReturnType)
Given that we have an enum type and a non-enum type, try to merge them.
static GVALinkage adjustGVALinkageForExternalDefinitionKind(const ASTContext &Ctx, const Decl *D, GVALinkage L)
Adjust the GVALinkage for a declaration based on what an external AST source knows about whether ther...
static TypedefDecl * CreateSystemZBuiltinVaListDecl(const ASTContext *Context)
static std::optional< int64_t > getSubobjectSizeInBits(const FieldDecl *Field, const ASTContext &Context, bool CheckIfTriviallyCopyable)
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
#define NON_UNIQUE_TYPE(Class)
static TypedefDecl * CreateX86_64ABIBuiltinVaListDecl(const ASTContext *Context)
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
static auto getCommonIndexTypeCVRQualifiers(const ArrayType *X, const ArrayType *Y)
static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)
DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the pointer over the consume...
static TypedefDecl * CreateCharPtrBuiltinVaListDecl(const ASTContext *Context)
static void mergeTypeLists(ASTContext &Ctx, SmallVectorImpl< QualType > &Out, ArrayRef< QualType > X, ArrayRef< QualType > Y)
static bool areSortedAndUniqued(ArrayRef< ObjCProtocolDecl * > Protocols)
static TypeInfoChars getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
getConstantArrayInfoInChars - Performing the computation in CharUnits instead of in bits prevents ove...
static FloatingRank getFloatingRank(QualType T)
getFloatingRank - Return a relative rank for floating point types.
static TypedefDecl * CreateXtensaABIBuiltinVaListDecl(const ASTContext *Context)
static TemplateArgument getCommonTemplateArgument(ASTContext &Ctx, const TemplateArgument &X, const TemplateArgument &Y)
static auto * getCommonSizeExpr(ASTContext &Ctx, T *X, T *Y)
static void encodeTypeForFunctionPointerAuth(const ASTContext &Ctx, raw_ostream &OS, QualType QT)
Encode a function type for use in the discriminator of a function pointer type.
static std::optional< int64_t > structSubobjectsHaveUniqueObjectRepresentations(const RangeT &Subobjects, int64_t CurOffsetInBits, const ASTContext &Context, const clang::ASTRecordLayout &Layout, bool CheckIfTriviallyCopyable)
static char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
static QualType getCommonArrayElementType(ASTContext &Ctx, const T *X, Qualifiers &QX, const T *Y, Qualifiers &QY)
static QualType getCommonPointeeType(ASTContext &Ctx, const T *X, const T *Y)
static uint64_t getRVVTypeSize(ASTContext &Context, const BuiltinType *Ty)
getRVVTypeSize - Return RVV vector register size.
static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal)
static SYCLKernelInfo BuildSYCLKernelInfo(CanQualType KernelNameType, const FunctionDecl *FD)
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
static QualType getCommonNonSugarTypeNode(ASTContext &Ctx, const Type *X, Qualifiers &QX, const Type *Y, Qualifiers &QY)
static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, const Type *Y, SplitQualType Underlying)
static bool isSameQualifier(const NestedNameSpecifier *X, const NestedNameSpecifier *Y)
static std::string charUnitsToString(const CharUnits &CU)
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl * > &Redeclared)
static SmallVector< SourceLocation, 2 > getDeclLocsForCommentSearch(const Decl *D, SourceManager &SourceMgr)
static TemplateName getCommonTemplateName(ASTContext &Ctx, TemplateName X, TemplateName Y, bool IgnoreDeduced=false)
static bool isCanonicalResultType(QualType T)
Determine whether T is canonical as the result type of a function.
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
static bool areCompatVectorTypes(const VectorType *LHS, const VectorType *RHS)
areCompatVectorTypes - Return true if the two specified vector types are compatible.
static TypedefDecl * CreateCharPtrNamedVaListDecl(const ASTContext *Context, StringRef Name)
#define UNEXPECTED_TYPE(Class, Kind)
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
static std::vector< std::string > getFMVBackendFeaturesFor(const llvm::SmallVectorImpl< StringRef > &FMVFeatStrings)
static ElaboratedTypeKeyword getCommonTypeKeyword(const T *X, const T *Y)
Defines the clang::ASTContext interface.
Provides definitions for the various language-specific address spaces.
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
static constexpr Builtin::Info BuiltinInfo[]
Defines enum values for all the target-independent builtin functions.
static bool CanThrow(Expr *E, ASTContext &Ctx)
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static const Decl * getCanonicalDecl(const Decl *D)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
llvm::MachO::Record Record
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Defines the clang::Module class, which describes a module in the source code.
Defines types useful for describing an Objective-C runtime.
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
static QualType getUnderlyingType(const SubRegion *R)
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
static QualType getPointeeType(const MemRegion *R)
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
Defines the clang::TypeLoc interface and its subclasses.
static const TemplateArgument & getArgument(const TemplateArgument &A)
C Language Family Type Representation.
__device__ __2f16 float c
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
bool isMemberPointerToDerivedMember() const
const ValueDecl * getMemberPointerDecl() const
ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
MSGuidDecl * getMSGuidDecl(MSGuidDeclParts Parts) const
Return a declaration for the global GUID object representing the given GUID value.
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
CanQualType ObjCBuiltinSelTy
TranslationUnitDecl * getTranslationUnitDecl() const
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible SVE vector types, false otherwise.
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
void InitBuiltinTypes(const TargetInfo &Target, const TargetInfo *AuxTarget=nullptr)
Initialize built-in types.
ParentMapContext & getParentMapContext()
Returns the dynamic AST node parent map context.
QualType getParenType(QualType NamedType) const
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization,...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
CanQualType ARCUnbridgedCastTy
QualType getDependentSizedMatrixType(QualType ElementType, Expr *RowExpr, Expr *ColumnExpr, SourceLocation AttrLoc) const
Return the unique reference to the matrix type of the specified element type and size.
QualType getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, QualType Wrapped) const
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
BuiltinTemplateDecl * getBuiltinCommonTypeDecl() const
unsigned getManglingNumber(const NamedDecl *ND, bool ForAuxTarget=false) const
unsigned getIntWidth(QualType T) const
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one.
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
InlineVariableDefinitionKind
@ None
Not an inline variable.
@ Weak
Weak definition of inline variable.
@ Strong
Strong definition.
@ WeakUnknown
Weak for now, might become strong later in this TU.
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
TypedefDecl * getCFConstantStringDecl() const
CanQualType SatUnsignedFractTy
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template.
bool areCompatibleRVVTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an RISC-V vector builtin type and a VectorType that is a fixed-len...
ExternCContextDecl * getExternCContextDecl() const
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const
Parses the target attributes passed in, and returns only the ones that are valid feature names.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
CanQualType UnsignedShortAccumTy
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
QualType adjustFunctionResultType(QualType FunctionType, QualType NewResultType)
Change the result type of a function type, preserving sugar such as attributed types.
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
void adjustObjCTypeParamBoundType(const ObjCTypeParamDecl *Orig, ObjCTypeParamDecl *New) const
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.
bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool AllowCXX=false, bool IsConditionalOperator=false)
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
DeclarationNameTable DeclarationNames
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
QualType getUnresolvedUsingType(const UnresolvedUsingTypenameDecl *Decl) const
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType, const Attr *attr=nullptr) const
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
void setCurrentNamedModule(Module *M)
Set the (C++20) module we are building.
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>.
CharUnits getMemberPointerPathAdjustment(const APValue &MP) const
Find the 'this' offset for the member path in a pointer-to-member APValue.
bool mayExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel may be externalized.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
QualType getRecordType(const RecordDecl *Decl) const
QualType getScalableVectorType(QualType EltTy, unsigned NumElts, unsigned NumFields=1) const
Return the unique reference to a scalable vector type of the specified element type and scalable numb...
bool hasSameExpr(const Expr *X, const Expr *Y) const
Determine whether the given expressions X and Y are equivalent.
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
QualType getRealTypeForBitwidth(unsigned DestWidth, FloatModeKind ExplicitType) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any.
IdentifierInfo * getBuiltinCommonTypeName() const
unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built.
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
unsigned getTypeUnadjustedAlign(QualType T) const
Return the ABI-specified natural alignment of a (complete) type T, before alignment adjustments,...
unsigned char getFixedPointIBits(QualType Ty) const
QualType getCorrespondingSignedFixedPointType(QualType Ty) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getCountAttributedType(QualType T, Expr *CountExpr, bool CountInBytes, bool OrNull, ArrayRef< TypeCoupledDeclRefInfo > DependentDecls) const
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
bool mergeExtParameterInfo(const FunctionProtoType *FirstFnType, const FunctionProtoType *SecondFnType, bool &CanUseFirst, bool &CanUseSecond, SmallVectorImpl< FunctionProtoType::ExtParameterInfo > &NewParamInfos)
This function merges the ExtParameterInfo lists of two functions.
bool ObjCQualifiedClassTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>.
bool shouldExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel should be externalized.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
bool propertyTypesAreCompatible(QualType, QualType)
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc, VectorKind VecKind) const
Return the unique reference to the type for a dependently sized vector of the specified element type.
CanQualType SatLongAccumTy
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
OpenCLTypeKind getOpenCLTypeKind(const Type *T) const
Map an AST Type to an OpenCLTypeKind enum value.
QualType getFILEType() const
Retrieve the C FILE type.
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
unsigned getPreferredTypeAlign(QualType T) const
Return the "preferred" alignment of the specified type T for the current target, in bits.
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
CanQualType OMPArrayShapingTy
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins, TranslationUnitKind TUKind)
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
TemplateName getCanonicalTemplateName(TemplateName Name, bool IgnoreDeduced=false) const
Retrieves the "canonical" template name that refers to a given template.
unsigned getStaticLocalNumber(const VarDecl *VD) const
void addComment(const RawComment &RC)
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
bool isSameTypeConstraint(const TypeConstraint *XTC, const TypeConstraint *YTC) const
Determine whether two type contraint are similar enough that they could used in declarations of the s...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=RecordDecl::TagKind::Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex, SubstTemplateTypeParmTypeFlag Flag=SubstTemplateTypeParmTypeFlag::None) const
Retrieve a substitution-result type.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getMSGuidType() const
Retrieve the implicitly-predeclared 'struct _GUID' type.
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
CanQualType UnsignedLongFractTy
QualType getEnumType(const EnumDecl *Decl) const
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const
Return a dependent bit-precise integer type with the specified signedness and bit count.
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
StringRef getCUIDHash() const
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
QualType getReferenceQualifiedType(const Expr *e) const
getReferenceQualifiedType - Given an expr, will return the type for that expression,...
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U) const
Determine whether two function types are the same, ignoring exception specifications in cases where t...
QualType getBlockDescriptorExtendedType() const
Gets the struct used to keep track of the extended descriptor for pointer to blocks.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
IdentifierInfo * getMakeIntegerSeqName() const
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
void addLazyModuleInitializers(Module *M, ArrayRef< GlobalDeclID > IDs)
bool isSameConstraintExpr(const Expr *XCE, const Expr *YCE) const
Determine whether two 'requires' expressions are similar enough that they may be used in re-declarati...
IdentifierInfo * getTypePackElementName() const
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
CanQualType OMPIteratorTy
TemplateName getSubstTemplateTemplateParm(TemplateName replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Builtin::Context & BuiltinInfo
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
void addModuleInitializer(Module *M, Decl *Init)
Add a declaration to the list of declarations that are initialized for a module.
const LangOptions & getLangOpts() const
QualType getFunctionTypeWithoutPtrSizes(QualType T)
Get a function type and produce the equivalent function type where pointer size address spaces in the...
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
bool isTypeIgnoredBySanitizer(const SanitizerMask &Mask, const QualType &Ty) const
Check if a type can have its sanitizer instrumentation elided based on its presence within an ignorel...
unsigned getMinGlobalAlignOfVar(uint64_t Size, const VarDecl *VD) const
Return the minimum alignement as specified by the target.
RawCommentList Comments
All comments in this translation unit.
bool isSameDefaultTemplateArgument(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two default template arguments are similar enough that they may be used in declarat...
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType removePtrSizeAddrSpace(QualType T) const
Remove the existing address space on the type if it is a pointer size address space and return the ty...
bool areLaxCompatibleRVVTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible RISC-V vector types as defined by -flax-vect...
CanQualType SatShortFractTy
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
bool canBindObjCObjectType(QualType To, QualType From)
int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const
Compare the rank of two floating point types as above, but compare equal if both types have the same ...
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
void setParameterIndex(const ParmVarDecl *D, unsigned index)
Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...
QualType getFunctionTypeWithExceptionSpec(QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI) const
Get a function type and produce the equivalent function type with the specified exception specificati...
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool hasUniqueObjectRepresentations(QualType Ty, bool CheckIfTriviallyCopyable=true) const
Return true if the specified type has unique object representations according to (C++17 [meta....
bool typesAreBlockPointerCompatible(QualType, QualType)
CanQualType SatUnsignedAccumTy
bool useAbbreviatedThunkName(GlobalDecl VirtualMethodDecl, StringRef MangledName)
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
void forEachMultiversionedFunctionVersion(const FunctionDecl *FD, llvm::function_ref< void(FunctionDecl *)> Pred) const
Visits all versions of a multiversioned function with the passed predicate.
void setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst, UsingEnumDecl *Pattern)
Remember that the using enum decl Inst is an instantiation of the using enum decl Pattern of a class ...
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
CanQualType ArraySectionTy
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) const
CanQualType ObjCBuiltinIdTy
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
VTableContextBase * getVTableContext()
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i....
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
bool isNearlyEmpty(const CXXRecordDecl *RD) const
void cacheRawCommentForDecl(const Decl &OriginalD, const RawComment &Comment) const
Attaches Comment to OriginalD and to its redeclaration chain and removes the redeclaration chain from...
void attachCommentsToJustParsedDecls(ArrayRef< Decl * > Decls, const Preprocessor *PP)
Searches existing comments for doc comments that should be attached to Decls.
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth,...
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
UsingEnumDecl * getInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst)
If the given using-enum decl Inst is an instantiation of another using-enum decl, return it.
RecordDecl * getCFConstantStringTagDecl() const
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
CanQualType UnsignedFractTy
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
CanQualType ObjCBuiltinClassTy
unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built.
CanQualType UnresolvedTemplateTy
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
CanQualType UnsignedLongTy
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized,...
bool computeBestEnumTypes(bool IsPacked, unsigned NumNegativeBits, unsigned NumPositiveBits, QualType &BestType, QualType &BestPromotionType)
Compute BestType and BestPromotionType for an enum based on the highest number of negative and positi...
llvm::APFixedPoint getFixedPointMin(QualType Ty) const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
QualType adjustType(QualType OldType, llvm::function_ref< QualType(QualType)> Adjust) const
Rebuild a type, preserving any existing type sugar.
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
CanQualType UnsignedLongAccumTy
QualType AutoRRefDeductTy
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const
Return a type for a constant array for a string literal of the specified element type and length.
QualType getCorrespondingSaturatedType(QualType Ty) const
bool isSameEntity(const NamedDecl *X, const NamedDecl *Y) const
Determine whether the two declarations refer to the same entity.
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
QualType getSubstTemplateTypeParmPackType(Decl *AssociatedDecl, unsigned Index, bool Final, const TemplateArgument &ArgPack)
Retrieve a.
CanQualType BoundMemberTy
CanQualType SatUnsignedShortFractTy
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
bool hasSameFunctionTypeIgnoringParamABI(QualType T, QualType U) const
Determine if two function types are the same, ignoring parameter ABI annotations.
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
QualType getBlockDescriptorType() const
Gets the struct used to keep track of the descriptor for pointer to blocks.
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
llvm::DenseSet< const VarDecl * > CUDADeviceVarODRUsedByHost
Keep track of CUDA/HIP device-side variables ODR-used by host code.
CanQualType PseudoObjectTy
QualType getWebAssemblyExternrefType() const
Return a WebAssembly externref type.
void setTraversalScope(const std::vector< Decl * > &)
CharUnits getTypeUnadjustedAlignInChars(QualType T) const
getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type, in characters,...
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
unsigned getAlignOfGlobalVar(QualType T, const VarDecl *VD) const
Return the alignment in bits that should be given to a global variable with type T.
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
MangleContext * createDeviceMangleContext(const TargetInfo &T)
Creates a device mangle context to correctly mangle lambdas in a mixed architecture compile by settin...
CharUnits getExnObjectAlignment() const
Return the alignment (in bytes) of the thrown exception object.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
ASTMutationListener * Listener
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true) const
Form a pack expansion type with the given pattern.
CanQualType ObjCBuiltinBoolTy
TypeInfoChars getTypeInfoInChars(const Type *T) const
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
TemplateParamObjectDecl * getTemplateParamObjectDecl(QualType T, const APValue &V) const
Return the template parameter object of the given type with the given value.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
CanQualType OCLClkEventTy
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
const clang::PrintingPolicy & getPrintingPolicy() const
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
llvm::FixedPointSemantics getFixedPointSemantics(QualType Ty) const
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
CanQualType SatUnsignedShortAccumTy
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false, bool IsConditionalOperator=false)
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
CharUnits getAlignOfGlobalVarInChars(QualType T, const VarDecl *VD) const
Return the alignment in characters that should be given to a global variable with type T.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
QualType getObjCIdType() const
Represents the Objective-CC id type.
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
QualType getFunctionTypeWithoutParamABIs(QualType T) const
Get or construct a function type that is equivalent to the input type except that the parameter ABI a...
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getCorrespondingUnsaturatedType(QualType Ty) const
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
FunctionProtoType::ExceptionSpecInfo mergeExceptionSpecs(FunctionProtoType::ExceptionSpecInfo ESI1, FunctionProtoType::ExceptionSpecInfo ESI2, SmallVectorImpl< QualType > &ExceptionTypeStorage, bool AcceptDependent)
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl) const
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
llvm::DenseMap< CanQualType, SYCLKernelInfo > SYCLKernels
Map of SYCL kernels indexed by the unique type used to name the kernel.
bool isSameTemplateParameterList(const TemplateParameterList *X, const TemplateParameterList *Y) const
Determine whether two template parameter lists are similar enough that they may be used in declaratio...
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
const CXXRecordDecl * baseForVTableAuthentication(const CXXRecordDecl *ThisClass)
Resolve the root record to be used to derive the vtable pointer authentication policy for the specifi...
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CanQualType UnsignedInt128Ty
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.
unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built.
void setManglingNumber(const NamedDecl *ND, unsigned Number)
llvm::DenseMap< const Decl *, const RawComment * > DeclRawComments
Mapping from declaration to directly attached comment.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
CanQualType UnsignedCharTy
CanQualType UnsignedShortFractTy
BuiltinTemplateDecl * buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, const IdentifierInfo *II) const
void * Allocate(size_t Size, unsigned Align=8) const
bool canBuiltinBeRedeclared(const FunctionDecl *) const
Return whether a declaration to a builtin is allowed to be overloaded/redeclared.
CanQualType UnsignedIntTy
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply.
unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl * > protocols) const
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
getObjCEncodingForMethodParameter - Return the encoded type for a single method parameter or return t...
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
QualType getExceptionObjectType(QualType T) const
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field) const
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
CanQualType UnsignedLongLongTy
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
QualType getCommonSugaredType(QualType X, QualType Y, bool Unqualified=false)
CanQualType OCLReserveIDTy
bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two template parameters are similar enough that they may be used in declarations of...
void registerSYCLEntryPointFunction(FunctionDecl *FD)
Generates and stores SYCL kernel metadata for the provided SYCL kernel entry point function.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
CanQualType UnsignedShortTy
unsigned getTypeAlignIfKnown(QualType T, bool NeedsPreferredAlignment=false) const
Return the alignment of a type, in bits, or 0 if the type is incomplete and we cannot determine the a...
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true) const
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
const SYCLKernelInfo & getSYCLKernelInfo(QualType T) const
Given a type used as a SYCL kernel name, returns a reference to the metadata generated from the corre...
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
canAssignObjCInterfacesInBlockPointer - This routine is specifically written for providing type-safet...
CanQualType SatUnsignedLongFractTy
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType getPackIndexingType(QualType Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< QualType > Expansions={}, int Index=-1) const
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache.
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
const VariableArrayType * getAsVariableArrayType(QualType T) const
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
StringLiteral * getPredefinedStringLiteralFromCache(StringRef Key) const
Return a string representing the human readable name for the specified function declaration or file n...
bool hasSimilarType(QualType T1, QualType T2) const
Determine if two types are similar, according to the C++ rules.
llvm::APFixedPoint getFixedPointMax(QualType Ty) const
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
bool areCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an SVE builtin and a VectorType that is a fixed-length representat...
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
DiagnosticsEngine & getDiagnostics() const
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
void ResetObjCLayout(const ObjCContainerDecl *CD)
interp::Context & getInterpContext()
Returns the clang bytecode interpreter context.
UnnamedGlobalConstantDecl * getUnnamedGlobalConstantDecl(QualType Ty, const APValue &Value) const
Return a declaration for a uniquified anonymous global constant corresponding to a given APValue.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl * > &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
bool hasSameTemplateName(const TemplateName &X, const TemplateName &Y, bool IgnoreDeduced=false) const
Determine whether the given template names refer to the same template.
CanQualType SatLongFractTy
const TargetInfo & getTargetInfo() const
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
CanQualType SatShortAccumTy
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
CanQualType IncompleteMatrixIdxTy
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
CanQualType getNSIntegerType() const
QualType getCorrespondingUnsignedType(QualType T) const
void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)
Set the copy initialization expression of a block var decl.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
TargetCXXABI::Kind getCXXABIKind() const
Return the C++ ABI kind that should be used.
QualType getHLSLAttributedResourceType(QualType Wrapped, QualType Contained, const HLSLAttributedResourceType::Attributes &Attrs)
bool UnwrapSimilarTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true) const
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
BuiltinTemplateDecl * getTypePackElementDecl() const
CanQualType SatUnsignedLongAccumTy
QualType getUnconstrainedType(QualType T) const
Remove any type constraints from a template parameter type, for equivalence comparison of template pa...
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getCorrespondingSignedType(QualType T) const
QualType mergeObjCGCQualifiers(QualType, QualType)
mergeObjCGCQualifiers - This routine merges ObjC's GC attribute of 'LHS' and 'RHS' attributes and ret...
llvm::DenseMap< const Decl *, const Decl * > CommentlessRedeclChains
Keeps track of redeclaration chains that don't have any comment attached.
uint64_t getArrayInitLoopExprElementCount(const ArrayInitLoopExpr *AILE) const
Return number of elements initialized in an ArrayInitLoopExpr.
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
unsigned getTargetAddressSpace(LangAS AS) const
QualType getWideCharType() const
Return the type of wide characters.
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
void addTranslationUnitDecl()
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it.
bool isPromotableIntegerType(QualType T) const
More type predicates useful for type checking/promotion.
llvm::DenseMap< const Decl *, const Decl * > RedeclChainComments
Mapping from canonical declaration to the first redeclaration in chain that has a comment attached.
CanQualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Underlying=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
uint16_t getPointerAuthVTablePointerDiscriminator(const CXXRecordDecl *RD)
Return the "other" discriminator used for the pointer auth schema used for vtable pointers in instanc...
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
Loading virtual member pointers using the virtual inheritance model always results in an adjustment u...
LangAS getLangASForBuiltinAddressSpace(unsigned AS) const
bool hasSameFunctionTypeIgnoringPtrSizes(QualType T, QualType U)
Determine whether two function types are the same, ignoring pointer sizes in the return type and para...
unsigned char getFixedPointScale(QualType Ty) const
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
QualType DecodeTypeStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequireICE, bool AllowTypeModifiers) const
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
@ GE_Missing_stdio
Missing a type from <stdio.h>
@ GE_Missing_type
Missing a type.
@ GE_Missing_ucontext
Missing a type from <ucontext.h>
@ GE_Missing_setjmp
Missing a type from <setjmp.h>
QualType adjustStringLiteralBaseType(QualType StrLTy) const
uint16_t getPointerAuthTypeDiscriminator(QualType T)
Return the "other" type-specific discriminator for the given type.
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const
C23 feature and GCC extension.
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals) const
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
bool hasCvrSimilarType(QualType T1, QualType T2)
Determine if two types are similar, ignoring only CVR qualifiers.
TemplateName getDeducedTemplateName(TemplateName Underlying, DefaultArguments DefaultArgs) const
Represents a TemplateName which had some of its default arguments deduced.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or nullptr if none exists.
CanQualType UnsignedAccumTy
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
bool isInSameModule(const Module *M1, const Module *M2)
If the two module M1 and M2 are in the same module.
void setCFConstantStringType(QualType T)
const SYCLKernelInfo * findSYCLKernelInfo(QualType T) const
Returns a pointer to the metadata generated from the corresponding SYCLkernel entry point if the prov...
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
void AddDeallocation(void(*Callback)(void *), void *Data) const
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
CXXMethodVector::const_iterator overridden_cxx_method_iterator
RawComment * getRawCommentForDeclNoCacheImpl(const Decl *D, const SourceLocation RepresentativeLocForDecl, const std::map< unsigned, RawComment * > &CommentsInFile) const
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeTransparentUnionType - if T is a transparent union type and a member of T is compatible with Sub...
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
bool isSentinelNullExpr(const Expr *E)
CanQualType getNSUIntegerType() const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getBitIntType(bool Unsigned, unsigned NumBits) const
Return a bit-precise integer type with the specified signedness and bit count.
unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
virtual void AddedStaticLocalNumbers(const Decl *D, unsigned Number)
An static local number was added to a Decl.
virtual ~ASTMutationListener()
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
virtual void AddedManglingNumber(const Decl *D, unsigned Number)
An mangling number was added to a Decl.
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
const CXXRecordDecl * getBaseSharingVBPtr() const
CharUnits getSize() const
getSize - Get the record size in characters.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
CharUnits getDataSize() const
getDataSize() - Get the record data size, which is the record size without tail padding,...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
CharUnits getUnadjustedAlignment() const
getUnadjustedAlignment - Get the record alignment in characters, before alignment adjustement.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a loop initializing the elements of an array.
llvm::APInt getArraySize() const
Expr * getSubExpr() const
Get the initializer to use for each array element.
Represents a constant array type that does not decay to a pointer when used as a function parameter.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
A structure for storing the information associated with a name that has been assumed to be a template...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
void Profile(llvm::FoldingSetNodeID &ID)
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
bool isConstrained() const
void Profile(llvm::FoldingSetNodeID &ID)
A fixed int type of a specified bitwidth.
void Profile(llvm::FoldingSetNodeID &ID) const
unsigned getNumBits() const
Represents a block literal declaration, which is like an unnamed FunctionDecl.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
This class is used for builtin types like 'int'.
StringRef getName(const PrintingPolicy &Policy) const
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
bool hasCustomTypechecking(unsigned ID) const
Determines whether this builtin has custom typechecking.
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
Implements C++ ABI-specific semantic analysis functions.
Represents a C++ constructor within a class.
Represents a static or instance method of a struct/union/class.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a C++ struct/union/class.
bool isPolymorphic() const
Whether this class is polymorphic (C++ [class.virtual]), which means that the class contains or inher...
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool isDynamicClass() const
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
SplitQualType split() const
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
QualType withConst() const
Retrieves a version of this type with const applied.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Qualifiers getQualifiers() const
Retrieve all qualifiers.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
CharUnits - This is an opaque type for sizes expressed in character units.
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
bool isZero() const
isZero - Test whether the quantity equals zero.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Declaration of a class template.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
Complex values, per C99 6.2.5p11.
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a C++20 concept.
ConceptDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool hasExplicitTemplateArgs() const
Whether or not template arguments were explicitly specified in the concept reference (they might not ...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Represents the canonical version of C arrays with a specified constant size.
const Expr * getSizeExpr() const
Return a pointer to the size expression.
llvm::APInt getSize() const
Return the constant array size as an APInt.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
uint64_t getZExtSize() const
Return the size zero-extended as a uint64_t.
Represents a concrete matrix type with constant number of rows and columns.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getNumRows() const
Returns the number of rows in the matrix.
static constexpr bool isDimensionValid(size_t NumElements)
Returns true if NumElements is a valid matrix dimension.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
void Profile(llvm::FoldingSetNodeID &ID)
Represents a pointer type decayed from an array or function type.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isFileContext() const
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
const DeclContext * getParentFunctionOrMethod(bool LexicalParent=false) const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
unsigned getMaxAlignment() const
getMaxAlignment - return the maximum alignment specified by attributes on this decl,...
static Decl * castFromDeclContext(const DeclContext *)
bool isTemplated() const
Determine whether this declaration is a templated entity (whether it is.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
bool isInvalidDecl() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
SourceLocation getLocation() const
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack.
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
SourceLocation getBeginLoc() const LLVM_READONLY
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
DeclarationNameLoc - Additional source/type location info for a declaration name.
static DeclarationNameLoc makeCXXOperatorNameLoc(SourceLocation BeginLoc, SourceLocation EndLoc)
Construct location information for a non-literal C++ operator.
The name of a declaration.
static int compare(DeclarationName LHS, DeclarationName RHS)
Represents a ValueDecl that came out of a declarator.
TypeSourceInfo * getTypeSourceInfo() const
Represents the type decltype(expr) (C++11).
Represents a C++17 deduced template specialization type.
void Profile(llvm::FoldingSetNodeID &ID) const
TemplateName getUnderlying() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context) const
DefaultArguments getDefaultArguments() const
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Represents an extended address space qualifier where the input address space value is dependent.
Expr * getAddrSpaceExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Internal representation of canonical, dependent decltype(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a qualified type name for which the type name is dependent.
void Profile(llvm::FoldingSetNodeID &ID)
Represents an array type in C++ whose size is a value-dependent expression.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Expr * getSizeExpr() const
Represents an extended vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Expr * getRowExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a dependent template name that cannot be resolved prior to template instantiation.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a template specialization type whose template cannot be resolved, e.g.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Internal representation of canonical, dependent typeof(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Internal representation of canonical, dependent __underlying_type(type) types.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
void Profile(llvm::FoldingSetNodeID &ID)
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
bool isComplete() const
Returns true if this can be considered a complete type.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
EnumDecl * getDecl() const
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
void Profile(llvm::FoldingSetNodeID &ID) const
ExtVectorType - Extended vector type.
Declaration context for names declared as extern "C" in C++.
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
Abstract interface for external sources of AST nodes.
virtual ExtKind hasExternalDefinitions(const Decl *D)
virtual void ReadComments()
Loads comment ranges.
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration.
virtual void PrintStats()
Print any statistics that have been gathered regarding the external AST source.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
unsigned getBitWidthValue() const
Computes the bit width of this field, if this is a bit field.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a function declaration or definition.
bool isMultiVersion() const
True if this function is considered a multiversioned function.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization,...
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
static FunctionEffectSet getIntersection(FunctionEffectsRef LHS, FunctionEffectsRef RHS)
static FunctionEffectSet getUnion(FunctionEffectsRef LHS, FunctionEffectsRef RHS, Conflicts &Errs)
Represents an abstract function effect, using just an enumeration describing its kind.
An immutable set of FunctionEffects and possibly conditions attached to them.
ArrayRef< EffectConditionExpr > conditions() const
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a prototype with parameter type info, e.g.
ExtParameterInfo getExtParameterInfo(unsigned I) const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
unsigned getNumParams() const
QualType getParamType(unsigned i) const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
bool isVariadic() const
Whether this function prototype is variadic.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type?
Declaration of a template function.
A class which abstracts out some details necessary for making a call.
CallingConv getCC() const
bool getNoCfCheck() const
unsigned getRegParm() const
bool getNoCallerSavedRegs() const
ExtInfo withNoReturn(bool noReturn) const
bool getHasRegParm() const
bool getProducesResult() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
ExtParameterInfo withIsNoEscape(bool NoEscape) const
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
QualType getReturnType() const
GlobalDecl - represents a global declaration.
unsigned getMultiVersionIndex() const
CXXDtorType getDtorType() const
const Decl * getDecl() const
QualType getWrappedType() const
const Attributes & getAttrs() const
QualType getContainedType() const
void Profile(llvm::FoldingSetNodeID &ID)
One of these records is kept for each identifier that is lexed.
unsigned getLength() const
Efficiently return the length of this identifier info.
StringRef getName() const
Return the actual identifier string.
Implements an efficient mapping from strings to IdentifierInfo nodes.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a C array with an unspecified size.
void Profile(llvm::FoldingSetNodeID &ID)
The injected class name of a C++ class template or class template partial specialization.
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
@ Relative
Components in the vtable are relative offsets between the vtable and the other structs/functions.
@ Pointer
Components in the vtable are pointers to other structs/functions.
An lvalue reference type, per C++11 [dcl.ref].
@ Swift
Interoperability with the latest known version of the Swift runtime.
@ Swift4_2
Interoperability with the Swift 4.2 runtime.
@ Swift4_1
Interoperability with the Swift 4.1 runtime.
@ Integer
Permit vector bitcasts between integer vectors with different numbers of elements but the same total ...
@ All
Permit vector bitcasts between all vectors with the same total bit-width.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
std::optional< TargetCXXABI::Kind > CXXABI
C++ ABI to compile with, if specified by the frontend through -fc++-abi=.
clang::ObjCRuntime ObjCRuntime
CoreFoundationABI CFRuntime
CommentOptions CommentOpts
Options for parsing comments.
std::string CUID
The user provided compilation unit ID, if non-empty.
static void Profile(llvm::FoldingSetNodeID &ID, Parts P)
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
QualType getElementType() const
Returns type of the elements being stored in the matrix.
static bool isValidElementType(QualType T)
Valid elements types are the following:
A pointer to member type per C++ 8.3.3 - Pointers to members.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
const Type * getClass() const
Provides information a specialization of a member of a class template, which may be a member function...
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
Describes a module or submodule.
bool isNamedModule() const
Does this Module is a named module of a standard named module?
This represents a decl that may have a name.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
bool isPlaceholderVar(const LangOptions &LangOpts) const
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
bool isExternallyVisible() const
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Represent a C++ namespace.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCContainerDecl - Represents a container for method declarations.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, const IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
bool hasDefinition() const
Determine whether this class has been defined.
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class,...
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
ObjCImplementationDecl * getImplementation() const
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
ObjCInterfaceDecl * getSuperClass() const
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
known_extensions_range known_extensions() const
Interfaces are the core concept in Objective-C for object oriented design.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getNextIvar()
ObjCMethodDecl - Represents an instance or class method declaration.
ObjCDeclQualifier getObjCDeclQualifier() const
unsigned param_size() const
param_const_iterator param_end() const
param_const_iterator param_begin() const
const ParmVarDecl *const * param_const_iterator
Selector getSelector() const
bool isInstanceMethod() const
QualType getReturnType() const
Represents a pointer to an Objective C object.
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
void Profile(llvm::FoldingSetNodeID &ID)
Represents a class type in Objective C.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
bool isObjCQualifiedClass() const
QualType getBaseType() const
Gets the base type of this object type.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
bool isObjCQualifiedId() const
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
bool isObjCUnqualifiedId() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
Represents one property declaration in an Objective-C interface.
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID, ObjCPropertyQueryKind queryKind)
Lookup a property by name in the specified DeclContext.
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
Selector getSetterName() const
Selector getGetterName() const
ObjCPropertyAttribute::Kind getPropertyAttributes() const
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCIvarDecl * getPropertyIvarDecl() const
Represents an Objective-C protocol declaration.
protocol_range protocols() const
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
qual_iterator qual_end() const
qual_iterator qual_begin() const
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
Represents the declaration of an Objective-C type parameter.
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Represents a type parameter type in Objective C.
void Profile(llvm::FoldingSetNodeID &ID)
A structure for storing the information associated with an overloaded template name.
Represents a C++11 pack expansion that produces a sequence of expressions.
Represents a pack expansion of types.
void Profile(llvm::FoldingSetNodeID &ID)
void Profile(llvm::FoldingSetNodeID &ID)
Sugar for parentheses used when specifying types.
void Profile(llvm::FoldingSetNodeID &ID)
void clear()
Clear parent maps.
Represents a parameter to a function.
ObjCDeclQualifier getObjCDeclQualifier() const
QualType getOriginalType() const
ParsedAttr - Represents a syntactic attribute.
void Profile(llvm::FoldingSetNodeID &ID)
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QualType withConst() const
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool isConstQualified() const
Determine whether this type is const-qualified.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
const Type * getTypePtrOrNull() const
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name as written in source code.
void Profile(llvm::FoldingSetNodeID &ID)
A qualifier set is used to build a set of qualifiers.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeCVRQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
void removeFastQualifiers(unsigned mask)
bool hasUnaligned() const
bool hasAddressSpace() const
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B, const ASTContext &Ctx)
Returns true if address space A is equal to or a superset of B.
unsigned getFastQualifiers() const
void removeAddressSpace()
void setAddressSpace(LangAS space)
bool hasObjCGCAttr() const
uint64_t getAsOpaqueValue() const
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
void addObjCGCAttr(GC type)
LangAS getAddressSpace() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
bool hasFlexibleArrayMember() const
field_range fields() const
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
virtual void completeDefinition()
Note that the definition of this type is now complete.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
This table allows us to fully hide how we implement multi-keyword caching.
std::string getAsString() const
Derive the full selector name (e.g.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
DiagnosticsEngine & getDiagnostics() const
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID.
unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid=nullptr) const
Given a SourceLocation, return the spelling line number for the position indicated.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
StringLiteral - This represents a string literal expression, e.g.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringLiteralKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
A structure for storing an already-substituted template template parameter pack.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
A structure for storing the information associated with a substituted template template parameter.
void Profile(llvm::FoldingSetNodeID &ID)
TemplateTemplateParmDecl * getParameter() const
Represents the result of substituting a set of types for a template type parameter pack.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the declaration of a struct/union/class/enum.
TypedefNameDecl * getTypedefNameForAnonDecl() const
void startDefinition()
Starts the definition of this tag declaration.
TagDecl * getDecl() const
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Kind
The basic C++ ABI kind.
static Kind getKind(StringRef Name)
Exposes information about the current target.
TargetOptions & getTargetOpts() const
Retrieve the target options.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
IntType getInt64Type() const
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
unsigned getBFloat16Width() const
getBFloat16Width/Align/Format - Return the size/align/format of '__bf16'.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
@ AArch64ABIBuiltinVaList
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com....
@ PNaClABIBuiltinVaList
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
@ PowerABIBuiltinVaList
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
@ AAPCSABIBuiltinVaList
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
@ X86_64ABIBuiltinVaList
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0....
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
uint64_t getPointerWidth(LangAS AddrSpace) const
Return the width of pointers on this target, for the specified address space.
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
unsigned getHalfAlign() const
unsigned getBFloat16Align() const
virtual std::optional< std::pair< unsigned, unsigned > > getVScaleRange(const LangOptions &LangOpts, bool IsArmStreamingFunction) const
Returns target-specific min and max values VScale_Range.
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
llvm::StringMap< bool > FeatureMap
The map of which features have been enabled disabled based on the command line.
A convenient class for passing around template argument information.
SourceLocation getRAngleLoc() const
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
SourceLocation getLAngleLoc() const
A template argument list.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
std::optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce,...
QualType getAsType() const
Retrieve the type for a type template argument.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
QualType getIntegralType() const
Retrieve the type of the integral value.
bool getIsDefaulted() const
If returns 'true', this TemplateArgument corresponds to a default template parameter.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl(bool IgnoreDeduced=false) const
Retrieve the underlying template declaration that this template name refers to, if known.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ DeducedTemplate
A template name that refers to another TemplateName with deduced default arguments.
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
A template parameter object.
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, const APValue &V)
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
ArrayRef< NamedDecl * > asArray()
unsigned getNumArgs() const
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, bool Typename, TemplateParameterList *Params)
Declaration of a template type parameter.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > NumExpanded=std::nullopt)
void Profile(llvm::FoldingSetNodeID &ID)
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
ConceptDecl * getNamedConcept() const
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
ConceptReference * getConceptReference() const
Represents a declaration of a type.
void setTypeForDecl(const Type *TD)
const Type * getTypeForDecl() const
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isBooleanType() const
bool isFunctionReferenceType() const
bool isObjCBuiltinType() const
QualType getRVVEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an RVV builtin type.
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
bool isIncompleteArrayType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isConstantArrayType() const
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6....
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
bool isFunctionPointerType() const
bool isPointerType() const
bool isArrayParameterType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
bool isSignedFixedPointType() const
Return true if this is a fixed point type that is signed according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isEnumeralType() const
bool isSveVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'arm_sve_vector_bits' type attribute,...
bool isObjCQualifiedIdType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool hasUnsignedIntegerRepresentation() const
Determine whether this type has an unsigned integer representation of some sort, e....
QualType getSveEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an SVE builtin type.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isBitIntType() const
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g....
QualType getCanonicalTypeInternal() const
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isMemberPointerType() const
bool isObjCIdType() const
bool isUnsaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isObjCObjectPointerType() const
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isVectorType() const
bool isObjCClassType() const
bool isRVVVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'riscv_rvv_vector_bits' type attribute,...
bool isRVVSizelessBuiltinType() const
Returns true for RVV scalable vector types.
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
bool isAnyPointerType() const
TypeClass getTypeClass() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isNullPtrType() const
bool isRecordType() const
bool isObjCRetainableType() const
std::optional< NullabilityKind > getNullability() const
Determine the nullability of the given type.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
void setTypeSourceInfo(TypeSourceInfo *newType)
void Profile(llvm::FoldingSetNodeID &ID)
A unary type transform, which is a type constructed from another.
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Ty, const APValue &APVal)
The iterator over UnresolvedSets.
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a dependent using declaration which was marked with typename.
Represents a C++ using-enum-declaration.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
void Profile(llvm::FoldingSetNodeID &ID)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr.
Represents a variable declaration or definition.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member.
bool isStaticDataMember() const
Determines whether this is a static data member.
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization,...
bool isInline() const
Whether this variable is (C++1z) inline.
@ DeclarationOnly
This declaration is only a declaration.
DefinitionKind hasDefinition(ASTContext &) const
Check whether this variable is defined in this translation unit.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getSizeExpr() const
Represents a GCC generic vector type.
unsigned getNumElements() const
void Profile(llvm::FoldingSetNodeID &ID)
VectorKind getVectorKind() const
QualType getElementType() const
Holds all information required to evaluate constexpr code in a module.
Defines the Linkage enumeration and various utility functions.
Defines the clang::TargetInfo interface.
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
GVALinkage
A more specific kind of linkage than enum Linkage.
@ GVA_AvailableExternally
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenCLTypeKind
OpenCL type kinds.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
NullabilityKind
Describes the nullability of a particular type.
@ Nullable
Values of this type can be null.
@ Unspecified
Whether values of this type can be null is (explicitly) unspecified.
@ NonNull
Values of this type can never be null.
@ ICIS_NoInit
No in-class initializer.
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
TypeOfKind
The kind of 'typeof' expression we're after.
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
@ Result
The result type of a method or function.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
SubstTemplateTypeParmTypeFlag
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
bool isDiscardableGVALinkage(GVALinkage L)
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
@ BTK__builtin_common_type
This names the __builtin_common_type BuiltinTemplateDecl.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.
LangAS
Defines the address space values used by the address space qualifier of QualType.
TranslationUnitKind
Describes the kind of translation unit being processed.
bool isPtrSizeAddressSpace(LangAS AS)
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, const TemplateParameterList *TPL=nullptr)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ Invariant
The parameter is invariant: must match exactly.
@ Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X when the type parameter is covariant and...
@ Covariant
The parameter is covariant, e.g., X<T> is a subtype of X when the type parameter is covariant and T i...
@ AltiVecBool
is AltiVec 'vector bool ...'
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ Generic
not a target-specific vector type
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
LangAS getLangASFromTargetAS(unsigned TargetAS)
@ None
The alignment was not explicit in code.
@ RequiredByEnum
The alignment comes from an alignment attribute on a enum type.
@ RequiredByTypedef
The alignment comes from an alignment attribute on a typedef.
@ RequiredByRecord
The alignment comes from an alignment attribute on a record type.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_DynamicNone
throw()
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
Diagnostic wrappers for TextAPI types for error reporting.
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Expr * getCopyExpr() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
ArrayRef< TemplateArgument > Args
Holds information about the various types of exception specification.
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
bool requiresFunctionProtoTypeArmAttributes() const
FunctionEffectsRef FunctionEffects
const ExtParameterInfo * ExtParameterInfos
RefQualifierKind RefQualifier
unsigned HasTrailingReturn
bool requiresFunctionProtoTypeExtraBitfields() const
FunctionType::ExtInfo ExtInfo
A simple holder for a QualType representing a type in an exception specification.
A holder for Arm type attributes as described in the Arm C/C++ Language extensions which are not part...
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
Parts of a decomposed MSGuidDecl.
Contains information gathered from parsing the contents of TargetAttr.
Describes how types, statements, expressions, and declarations should be printed.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
const Type * Ty
The locally-unqualified type.
Qualifiers Quals
The local qualifiers.
A this pointer adjustment.
IntType
===-â Target Data Type Query Methods ----------------------------â===//
AlignRequirementKind AlignRequirement
AlignRequirementKind AlignRequirement
static bool isEqual(const FoldingSetNodeID &LHS, const FoldingSetNodeID &RHS)
static FoldingSetNodeID getTombstoneKey()
static FoldingSetNodeID getEmptyKey()
static unsigned getHashValue(const FoldingSetNodeID &Val)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4