69#include "llvm/ADT/APFixedPoint.h"
70#include "llvm/ADT/APInt.h"
71#include "llvm/ADT/APSInt.h"
72#include "llvm/ADT/ArrayRef.h"
73#include "llvm/ADT/DenseMap.h"
74#include "llvm/ADT/DenseSet.h"
75#include "llvm/ADT/FoldingSet.h"
76#include "llvm/ADT/PointerUnion.h"
77#include "llvm/ADT/STLExtras.h"
78#include "llvm/ADT/SmallPtrSet.h"
79#include "llvm/ADT/SmallVector.h"
80#include "llvm/ADT/StringExtras.h"
81#include "llvm/ADT/StringRef.h"
82#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
83#include "llvm/Support/Capacity.h"
84#include "llvm/Support/Casting.h"
85#include "llvm/Support/Compiler.h"
86#include "llvm/Support/ErrorHandling.h"
87#include "llvm/Support/MD5.h"
88#include "llvm/Support/MathExtras.h"
89#include "llvm/Support/raw_ostream.h"
90#include "llvm/TargetParser/Triple.h"
103using namespace clang;
127 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
132 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
133 if (VD->isStaticDataMember() &&
138 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
143 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
150 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
154 if (
const auto *TD = dyn_cast<TagDecl>(D)) {
157 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
161 if (isa<ParmVarDecl>(D))
166 if (isa<TemplateTypeParmDecl>(D) ||
167 isa<NonTypeTemplateParmDecl>(D) ||
168 isa<TemplateTemplateParmDecl>(D))
179 if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) ||
180 isa<ObjCPropertyDecl>(D) || isa<RedeclarableTemplateDecl>(D) ||
181 isa<ClassTemplateSpecializationDecl>(D) ||
189 Locations.emplace_back(BaseLocation);
217 const std::map<unsigned, RawComment *> &CommentsInTheFile)
const {
220 if (RepresentativeLocForDecl.
isInvalid() ||
221 !RepresentativeLocForDecl.
isFileID())
225 if (CommentsInTheFile.empty())
230 const std::pair<FileID, unsigned> DeclLocDecomp =
234 auto OffsetCommentBehindDecl =
235 CommentsInTheFile.lower_bound(DeclLocDecomp.second);
238 if (OffsetCommentBehindDecl != CommentsInTheFile.end()) {
239 RawComment *CommentBehindDecl = OffsetCommentBehindDecl->second;
243 (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
244 isa<ObjCMethodDecl>(D) || isa<ObjCPropertyDecl>(D))) {
248 if (SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second) ==
250 OffsetCommentBehindDecl->first)) {
251 return CommentBehindDecl;
258 if (OffsetCommentBehindDecl == CommentsInTheFile.begin())
261 auto OffsetCommentBeforeDecl = --OffsetCommentBehindDecl;
262 RawComment *CommentBeforeDecl = OffsetCommentBeforeDecl->second;
271 const unsigned CommentEndOffset =
276 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
282 StringRef
Text(Buffer + CommentEndOffset,
283 DeclLocDecomp.second - CommentEndOffset);
287 if (
Text.find_last_of(
";{}#@") != StringRef::npos)
290 return CommentBeforeDecl;
296 for (
const auto DeclLoc : DeclLocs) {
299 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
315 if (!CommentsInThisFile || CommentsInThisFile->empty())
327 assert(LangOpts.RetainCommentsFromSystemHeaders ||
336 if (
const auto *FD = dyn_cast<FunctionDecl>(&D)) {
356 if (
const auto *VD = dyn_cast<VarDecl>(&D)) {
359 if (VD->isStaticDataMember())
365 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(&D)) {
372 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
380 : *
static_cast<const Decl *
>(
386 CRD->getMemberSpecializationInfo())
387 return *Info->getInstantiatedFrom();
391 if (
const auto *ED = dyn_cast<EnumDecl>(&D)) {
404 const Decl **OriginalDecl)
const {
407 OriginalDecl =
nullptr;
419 return DeclComment->second;
432 *OriginalDecl = RedeclComment->second;
435 "This decl is supposed to have comment attached.");
436 return CommentAtRedecl->second;
442 auto LastCheckedRedecl = [
this, CanonicalD]() ->
const Decl * {
446 for (
const auto Redecl : D->
redecls()) {
449 if (LastCheckedRedecl) {
450 if (LastCheckedRedecl == Redecl) {
451 LastCheckedRedecl =
nullptr;
459 *OriginalDecl = Redecl;
460 return RedeclComment;
466 *OriginalDecl =
nullptr;
482 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
487 for (
const auto *Ext : ID->known_extensions()) {
491 Redeclared.push_back(RedeclaredMethod);
502 for (
const Decl *D : Decls) {
503 if (D->isInvalidDecl())
516 if (
File.isInvalid())
520 if (!CommentsInThisFile || CommentsInThisFile->empty() ||
521 CommentsInThisFile->rbegin()->second->isAttached())
531 for (
const Decl *D : Decls) {
533 if (D->isInvalidDecl())
543 for (
const auto DeclLoc : DeclLocs) {
544 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
548 D, DeclLoc, *CommentsInThisFile)) {
559 const Decl *D)
const {
562 ThisDeclInfo->IsFilled =
false;
563 ThisDeclInfo->fill();
564 ThisDeclInfo->CommentDecl = FC->
getDecl();
565 if (!ThisDeclInfo->TemplateParameters)
575 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
586 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
590 if (Canonical != D) {
598 const Decl *OriginalDecl =
nullptr;
602 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
604 const auto *OMD = dyn_cast<ObjCMethodDecl>(D);
605 if (OMD && OMD->isPropertyAccessor())
612 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
616 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(D)) {
619 QualType QT = TD->getUnderlyingType();
621 if (
const Decl *TD = TT->getDecl())
625 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(D)) {
626 while (IC->getSuperClass()) {
627 IC = IC->getSuperClass();
632 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(D)) {
637 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
638 if (!(RD = RD->getDefinition()))
641 for (
const auto &I : RD->bases()) {
642 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
656 for (
const auto &I : RD->vbases()) {
677 if (D != OriginalDecl && OriginalDecl)
686ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &ID,
694 ID.AddInteger(Params->
size());
696 PEnd = Params->
end();
698 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
700 ID.AddBoolean(TTP->isParameterPack());
701 if (TTP->isExpandedParameterPack()) {
703 ID.AddInteger(TTP->getNumExpansionParameters());
705 ID.AddBoolean(
false);
709 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
711 ID.AddBoolean(NTTP->isParameterPack());
712 ID.AddPointer(
C.getUnconstrainedType(
C.getCanonicalType(NTTP->getType()))
714 if (NTTP->isExpandedParameterPack()) {
716 ID.AddInteger(NTTP->getNumExpansionTypes());
717 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
719 ID.AddPointer(
T.getCanonicalType().getAsOpaquePtr());
722 ID.AddBoolean(
false);
726 auto *TTP = cast<TemplateTemplateParmDecl>(*
P);
733ASTContext::getCanonicalTemplateTemplateParmDecl(
736 llvm::FoldingSetNodeID
ID;
737 CanonicalTemplateTemplateParm::Profile(ID, *
this, TTP);
738 void *InsertPos =
nullptr;
739 CanonicalTemplateTemplateParm *Canonical
740 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
742 return Canonical->getParam();
747 CanonParams.reserve(Params->
size());
749 PEnd = Params->
end();
753 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
759 ? std::optional<unsigned>(TTP->getNumExpansionParameters())
761 CanonParams.push_back(NewTTP);
762 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
766 if (NTTP->isExpandedParameterPack()) {
769 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
771 ExpandedTInfos.push_back(
779 NTTP->getPosition(),
nullptr,
789 NTTP->getPosition(),
nullptr,
791 NTTP->isParameterPack(),
794 CanonParams.push_back(Param);
796 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
797 cast<TemplateTemplateParmDecl>(*
P)));
808 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
809 assert(!Canonical &&
"Shouldn't be in the map!");
813 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
814 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
824 if (!LangOpts.CPlusPlus)
return nullptr;
827 case TargetCXXABI::AppleARM64:
828 case TargetCXXABI::Fuchsia:
829 case TargetCXXABI::GenericARM:
830 case TargetCXXABI::iOS:
831 case TargetCXXABI::WatchOS:
832 case TargetCXXABI::GenericAArch64:
833 case TargetCXXABI::GenericMIPS:
834 case TargetCXXABI::GenericItanium:
835 case TargetCXXABI::WebAssembly:
836 case TargetCXXABI::XL:
838 case TargetCXXABI::Microsoft:
841 llvm_unreachable(
"Invalid CXXABI type!");
845 if (!InterpContext) {
848 return *InterpContext.get();
854 return *ParentMapCtx.get();
859 switch (LangOpts.getAddressSpaceMapMangling()) {
867 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
873 : ConstantArrayTypes(this_(), ConstantArrayTypesLog2InitSize),
874 DependentSizedArrayTypes(this_()), DependentSizedExtVectorTypes(this_()),
875 DependentAddressSpaceTypes(this_()), DependentVectorTypes(this_()),
876 DependentSizedMatrixTypes(this_()),
877 FunctionProtoTypes(this_(), FunctionProtoTypesLog2InitSize),
878 DependentTypeOfExprTypes(this_()), DependentDecltypeTypes(this_()),
879 TemplateSpecializationTypes(this_()),
880 DependentTemplateSpecializationTypes(this_()), AutoTypes(this_()),
881 DependentBitIntTypes(this_()), SubstTemplateTemplateParmPacks(this_()),
882 ArrayParameterTypes(this_()), CanonTemplateTemplateParms(this_()),
883 SourceMgr(
SM), LangOpts(LOpts),
886 LangOpts.XRayNeverInstrumentFiles,
887 LangOpts.XRayAttrListFiles,
SM)),
890 BuiltinInfo(builtins), TUKind(TUKind), DeclarationNames(*this),
891 Comments(
SM), CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
892 CompCategories(this_()), LastSDM(nullptr, 0) {
899 ReleaseDeclContextMaps();
902 for (
auto &Pair : Deallocations)
903 (Pair.first)(Pair.second);
904 Deallocations.clear();
910 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
916 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
917 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
922 ASTRecordLayouts.clear();
924 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
925 AEnd = DeclAttrs.end();
927 A->second->~AttrVec();
930 for (
const auto &
Value : ModuleInitializers)
931 Value.second->~PerModuleInitializers();
932 ModuleInitializers.
clear();
938 TraversalScope = TopLevelDecls;
943 Deallocations.push_back({Callback,
Data});
952 llvm::errs() <<
"\n*** AST Context Stats:\n";
953 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
955 unsigned counts[] = {
956#define TYPE(Name, Parent) 0,
957#define ABSTRACT_TYPE(Name, Parent)
958#include "clang/AST/TypeNodes.inc"
962 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
968 unsigned TotalBytes = 0;
969#define TYPE(Name, Parent) \
971 llvm::errs() << " " << counts[Idx] << " " << #Name \
972 << " types, " << sizeof(Name##Type) << " each " \
973 << "(" << counts[Idx] * sizeof(Name##Type) \
975 TotalBytes += counts[Idx] * sizeof(Name##Type); \
977#define ABSTRACT_TYPE(Name, Parent)
978#include "clang/AST/TypeNodes.inc"
980 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
985 <<
" implicit default constructors created\n";
988 <<
" implicit copy constructors created\n";
992 <<
" implicit move constructors created\n";
995 <<
" implicit copy assignment operators created\n";
999 <<
" implicit move assignment operators created\n";
1002 <<
" implicit destructors created\n";
1005 llvm::errs() <<
"\n";
1009 BumpAlloc.PrintStats();
1013 bool NotifyListeners) {
1014 if (NotifyListeners)
1023 if (It == MergedDefModules.end())
1026 auto &Merged = It->second;
1028 for (
Module *&M : Merged)
1029 if (!Found.insert(M).second)
1031 llvm::erase(Merged,
nullptr);
1038 if (MergedIt == MergedDefModules.end())
1039 return std::nullopt;
1040 return MergedIt->second;
1043void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1044 if (LazyInitializers.empty())
1048 assert(Source &&
"lazy initializers but no external source");
1050 auto LazyInits = std::move(LazyInitializers);
1051 LazyInitializers.clear();
1053 for (
auto ID : LazyInits)
1054 Initializers.push_back(Source->GetExternalDecl(ID));
1056 assert(LazyInitializers.empty() &&
1057 "GetExternalDecl for lazy module initializer added more inits");
1063 if (
const auto *ID = dyn_cast<ImportDecl>(D)) {
1064 auto It = ModuleInitializers.find(ID->getImportedModule());
1067 if (It == ModuleInitializers.end())
1071 auto &Imported = *It->second;
1072 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1073 Imported.resolve(*
this);
1074 auto *OnlyDecl = Imported.Initializers.front();
1075 if (isa<ImportDecl>(OnlyDecl))
1080 auto *&Inits = ModuleInitializers[M];
1082 Inits =
new (*this) PerModuleInitializers;
1083 Inits->Initializers.push_back(D);
1088 auto *&Inits = ModuleInitializers[M];
1090 Inits =
new (*this) PerModuleInitializers;
1091 Inits->LazyInitializers.insert(Inits->LazyInitializers.end(),
1092 IDs.begin(), IDs.end());
1096 auto It = ModuleInitializers.find(M);
1097 if (It == ModuleInitializers.end())
1098 return std::nullopt;
1100 auto *Inits = It->second;
1101 Inits->resolve(*
this);
1102 return Inits->Initializers;
1107 assert(!CurrentCXXNamedModule &&
1108 "We should set named module for ASTContext for only once");
1109 CurrentCXXNamedModule = M;
1113 if (!ExternCContext)
1116 return ExternCContext;
1122 auto *BuiltinTemplate =
1124 BuiltinTemplate->setImplicit();
1127 return BuiltinTemplate;
1132 if (!MakeIntegerSeqDecl)
1135 return MakeIntegerSeqDecl;
1140 if (!TypePackElementDecl)
1143 return TypePackElementDecl;
1157 NewDecl->
addAttr(TypeVisibilityAttr::CreateImplicit(
1158 const_cast<ASTContext &
>(*
this), TypeVisibilityAttr::Default));
1163 StringRef Name)
const {
1187 Types.push_back(Ty);
1192 assert((!this->Target || this->Target == &
Target) &&
1193 "Incorrect target reinitialization");
1197 this->AuxTarget = AuxTarget;
1199 ABI.reset(createCXXABI(
Target));
1203 InitBuiltinType(
VoidTy, BuiltinType::Void);
1206 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1208 if (LangOpts.CharIsSigned)
1209 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1211 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1214 InitBuiltinType(
ShortTy, BuiltinType::Short);
1215 InitBuiltinType(
IntTy, BuiltinType::Int);
1216 InitBuiltinType(
LongTy, BuiltinType::Long);
1217 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1227 InitBuiltinType(
FloatTy, BuiltinType::Float);
1228 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1229 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1232 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1235 InitBuiltinType(
Ibm128Ty, BuiltinType::Ibm128);
1238 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1241 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1242 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1243 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1247 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1248 InitBuiltinType(
FractTy, BuiltinType::Fract);
1249 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1254 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1260 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1267 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1272 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1274 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1275 if (LangOpts.CPlusPlus && LangOpts.WChar)
1285 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1287 if (LangOpts.CPlusPlus)
1288 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1292 if (LangOpts.CPlusPlus)
1293 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1302 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1305 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1317 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1323 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1326 if (LangOpts.OpenMP) {
1333 if (LangOpts.OpenACC && !LangOpts.OpenMP) {
1336 if (LangOpts.MatrixTypes)
1344 if (LangOpts.OpenCL) {
1345#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1346 InitBuiltinType(SingletonId, BuiltinType::Id);
1347#include "clang/Basic/OpenCLImageTypes.def"
1349 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1350 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1352 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1355#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1356 InitBuiltinType(Id##Ty, BuiltinType::Id);
1357#include "clang/Basic/OpenCLExtensionTypes.def"
1360 if (
Target.hasAArch64SVETypes()) {
1361#define SVE_TYPE(Name, Id, SingletonId) \
1362 InitBuiltinType(SingletonId, BuiltinType::Id);
1363#include "clang/Basic/AArch64SVEACLETypes.def"
1366 if (
Target.getTriple().isPPC64()) {
1367#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \
1368 InitBuiltinType(Id##Ty, BuiltinType::Id);
1369#include "clang/Basic/PPCTypes.def"
1370#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \
1371 InitBuiltinType(Id##Ty, BuiltinType::Id);
1372#include "clang/Basic/PPCTypes.def"
1375 if (
Target.hasRISCVVTypes()) {
1376#define RVV_TYPE(Name, Id, SingletonId) \
1377 InitBuiltinType(SingletonId, BuiltinType::Id);
1378#include "clang/Basic/RISCVVTypes.def"
1381 if (
Target.getTriple().isWasm() &&
Target.hasFeature(
"reference-types")) {
1382#define WASM_TYPE(Name, Id, SingletonId) \
1383 InitBuiltinType(SingletonId, BuiltinType::Id);
1384#include "clang/Basic/WebAssemblyReferenceTypes.def"
1391 ObjCConstantStringType =
QualType();
1396 if (LangOpts.OpenCLGenericAddressSpace) {
1406 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1409 InitBuiltinType(
HalfTy, BuiltinType::Half);
1411 InitBuiltinType(
BFloat16Ty, BuiltinType::BFloat16);
1417 if (LangOpts.MicrosoftExt || LangOpts.Borland) {
1439 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1440 if (Pos != DeclAttrs.end()) {
1441 Pos->second->~AttrVec();
1442 DeclAttrs.erase(Pos);
1456 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1457 TemplateOrInstantiation.find(Var);
1458 if (Pos == TemplateOrInstantiation.end())
1471 Tmpl, TSK, PointOfInstantiation));
1477 assert(!TemplateOrInstantiation[Inst] &&
1478 "Already noted what the variable was instantiated from");
1479 TemplateOrInstantiation[Inst] = TSI;
1484 return InstantiatedFromUsingDecl.lookup(UUD);
1489 assert((isa<UsingDecl>(Pattern) ||
1490 isa<UnresolvedUsingValueDecl>(Pattern) ||
1491 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1492 "pattern decl is not a using decl");
1493 assert((isa<UsingDecl>(Inst) ||
1494 isa<UnresolvedUsingValueDecl>(Inst) ||
1495 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1496 "instantiation did not produce a using decl");
1497 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1498 InstantiatedFromUsingDecl[Inst] = Pattern;
1503 return InstantiatedFromUsingEnumDecl.lookup(UUD);
1508 assert(!InstantiatedFromUsingEnumDecl[Inst] &&
"pattern already exists");
1509 InstantiatedFromUsingEnumDecl[Inst] = Pattern;
1514 return InstantiatedFromUsingShadowDecl.lookup(Inst);
1520 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1521 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1525 return InstantiatedFromUnnamedFieldDecl.lookup(Field);
1530 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1531 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1532 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1533 "Already noted what unnamed field was instantiated from");
1535 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1556 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1558 if (Pos == OverriddenMethods.end())
1566 OverriddenMethods[Method].push_back(Overridden);
1574 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1580 const auto *Method = dyn_cast<ObjCMethodDecl>(D);
1585 Method->getOverriddenMethods(OverDecls);
1586 Overridden.append(OverDecls.begin(), OverDecls.end());
1590 assert(!Import->getNextLocalImport() &&
1591 "Import declaration already in the chain");
1592 assert(!Import->isFromASTFile() &&
"Non-local import declaration");
1593 if (!FirstLocalImport) {
1594 FirstLocalImport = Import;
1595 LastLocalImport = Import;
1599 LastLocalImport->setNextLocalImport(Import);
1600 LastLocalImport = Import;
1612 llvm_unreachable(
"Not a floating point type!");
1613 case BuiltinType::BFloat16:
1614 return Target->getBFloat16Format();
1615 case BuiltinType::Float16:
1616 return Target->getHalfFormat();
1617 case BuiltinType::Half:
1618 return Target->getHalfFormat();
1619 case BuiltinType::Float:
return Target->getFloatFormat();
1620 case BuiltinType::Double:
return Target->getDoubleFormat();
1621 case BuiltinType::Ibm128:
1622 return Target->getIbm128Format();
1623 case BuiltinType::LongDouble:
1626 return Target->getLongDoubleFormat();
1627 case BuiltinType::Float128:
1630 return Target->getFloat128Format();
1635 unsigned Align =
Target->getCharWidth();
1639 Align = AlignFromAttr;
1647 bool UseAlignAttrOnly;
1648 if (
const FieldDecl *FD = dyn_cast<FieldDecl>(D))
1650 FD->hasAttr<PackedAttr>() || FD->getParent()->hasAttr<PackedAttr>();
1652 UseAlignAttrOnly = AlignFromAttr != 0;
1655 if (UseAlignAttrOnly) {
1657 }
else if (
const auto *VD = dyn_cast<ValueDecl>(D)) {
1667 Align = getTypeInfoImpl(
T.getTypePtr()).
Align;
1672 unsigned MinWidth =
Target->getLargeArrayMinWidth();
1673 if (!ForAlignof && MinWidth) {
1675 Align = std::max(Align,
Target->getLargeArrayAlign());
1676 else if (isa<ConstantArrayType>(
arrayType) &&
1678 Align = std::max(Align,
Target->getLargeArrayAlign());
1683 Align =
Target->getCharWidth();
1687 if (
const auto *VD = dyn_cast<VarDecl>(D))
1688 if (VD->hasGlobalStorage() && !ForAlignof) {
1699 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1702 if (!
Parent->isInvalidDecl()) {
1713 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1714 if (LowBitOfOffset < FieldAlign)
1715 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1718 Align = std::min(Align, FieldAlign);
1726 const auto *VD = dyn_cast<VarDecl>(D);
1727 if (MaxAlignedAttr && VD && VD->getStorageClass() ==
SC_Static)
1728 Align = std::min(Align, MaxAlignedAttr);
1766 (uint64_t)(-1)/Size) &&
1767 "Overflow in array type char size evaluation");
1772 Width = llvm::alignTo(Width, Align);
1779 if (
const auto *CAT = dyn_cast<ConstantArrayType>(
T))
1797 switch (BT->getKind()) {
1798 case BuiltinType::Bool:
1799 case BuiltinType::Char_S:
1800 case BuiltinType::Char_U:
1801 case BuiltinType::SChar:
1802 case BuiltinType::UChar:
1803 case BuiltinType::Short:
1804 case BuiltinType::UShort:
1805 case BuiltinType::WChar_S:
1806 case BuiltinType::WChar_U:
1807 case BuiltinType::Char8:
1808 case BuiltinType::Char16:
1809 case BuiltinType::Char32:
1819 ET->getDecl()->isScoped())
1837 bool NeedsPreferredAlignment)
const {
1840 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1851 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1856 return TT->getDecl()->getMaxAlignment();
1862 TypeInfoMap::iterator I = MemoizedTypeInfo.find(
T);
1863 if (I != MemoizedTypeInfo.end())
1868 MemoizedTypeInfo[
T] = TI;
1884#define TYPE(Class, Base)
1885#define ABSTRACT_TYPE(Class, Base)
1886#define NON_CANONICAL_TYPE(Class, Base)
1887#define DEPENDENT_TYPE(Class, Base) case Type::Class:
1888#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \
1890 assert(!T->isDependentType() && "should not see dependent types here"); \
1891 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr());
1892#include "clang/AST/TypeNodes.inc"
1893 llvm_unreachable(
"Should not see dependent types");
1895 case Type::FunctionNoProto:
1896 case Type::FunctionProto:
1902 case Type::IncompleteArray:
1903 case Type::VariableArray:
1904 case Type::ConstantArray:
1905 case Type::ArrayParameter: {
1908 if (
const auto *CAT = dyn_cast<ConstantArrayType>(
T))
1909 Size = CAT->getZExtSize();
1912 assert((Size == 0 || EltInfo.
Width <= (uint64_t)(-1) / Size) &&
1913 "Overflow in array type bit size evaluation");
1914 Width = EltInfo.
Width * Size;
1915 Align = EltInfo.
Align;
1919 Width = llvm::alignTo(Width, Align);
1923 case Type::ExtVector:
1924 case Type::Vector: {
1925 const auto *VT = cast<VectorType>(
T);
1927 Width = VT->isExtVectorBoolType() ? VT->getNumElements()
1928 : EltInfo.
Width * VT->getNumElements();
1930 Width = std::max<unsigned>(8, Width);
1931 Align = std::max<unsigned>(8, Width);
1935 if (Align & (Align-1)) {
1936 Align = llvm::bit_ceil(Align);
1937 Width = llvm::alignTo(Width, Align);
1941 if (TargetVectorAlign && TargetVectorAlign < Align)
1942 Align = TargetVectorAlign;
1953 Align = std::min<unsigned>(64, Width);
1957 case Type::ConstantMatrix: {
1958 const auto *MT = cast<ConstantMatrixType>(
T);
1963 Width = ElementInfo.
Width * MT->getNumRows() * MT->getNumColumns();
1964 Align = ElementInfo.
Align;
1969 switch (cast<BuiltinType>(
T)->
getKind()) {
1970 default: llvm_unreachable(
"Unknown builtin type!");
1971 case BuiltinType::Void:
1976 case BuiltinType::Bool:
1977 Width =
Target->getBoolWidth();
1978 Align =
Target->getBoolAlign();
1980 case BuiltinType::Char_S:
1981 case BuiltinType::Char_U:
1982 case BuiltinType::UChar:
1983 case BuiltinType::SChar:
1984 case BuiltinType::Char8:
1985 Width =
Target->getCharWidth();
1986 Align =
Target->getCharAlign();
1988 case BuiltinType::WChar_S:
1989 case BuiltinType::WChar_U:
1990 Width =
Target->getWCharWidth();
1991 Align =
Target->getWCharAlign();
1993 case BuiltinType::Char16:
1994 Width =
Target->getChar16Width();
1995 Align =
Target->getChar16Align();
1997 case BuiltinType::Char32:
1998 Width =
Target->getChar32Width();
1999 Align =
Target->getChar32Align();
2001 case BuiltinType::UShort:
2002 case BuiltinType::Short:
2003 Width =
Target->getShortWidth();
2004 Align =
Target->getShortAlign();
2006 case BuiltinType::UInt:
2007 case BuiltinType::Int:
2008 Width =
Target->getIntWidth();
2009 Align =
Target->getIntAlign();
2011 case BuiltinType::ULong:
2012 case BuiltinType::Long:
2013 Width =
Target->getLongWidth();
2014 Align =
Target->getLongAlign();
2016 case BuiltinType::ULongLong:
2017 case BuiltinType::LongLong:
2018 Width =
Target->getLongLongWidth();
2019 Align =
Target->getLongLongAlign();
2021 case BuiltinType::Int128:
2022 case BuiltinType::UInt128:
2024 Align =
Target->getInt128Align();
2026 case BuiltinType::ShortAccum:
2027 case BuiltinType::UShortAccum:
2028 case BuiltinType::SatShortAccum:
2029 case BuiltinType::SatUShortAccum:
2030 Width =
Target->getShortAccumWidth();
2031 Align =
Target->getShortAccumAlign();
2033 case BuiltinType::Accum:
2034 case BuiltinType::UAccum:
2035 case BuiltinType::SatAccum:
2036 case BuiltinType::SatUAccum:
2037 Width =
Target->getAccumWidth();
2038 Align =
Target->getAccumAlign();
2040 case BuiltinType::LongAccum:
2041 case BuiltinType::ULongAccum:
2042 case BuiltinType::SatLongAccum:
2043 case BuiltinType::SatULongAccum:
2044 Width =
Target->getLongAccumWidth();
2045 Align =
Target->getLongAccumAlign();
2047 case BuiltinType::ShortFract:
2048 case BuiltinType::UShortFract:
2049 case BuiltinType::SatShortFract:
2050 case BuiltinType::SatUShortFract:
2051 Width =
Target->getShortFractWidth();
2052 Align =
Target->getShortFractAlign();
2054 case BuiltinType::Fract:
2055 case BuiltinType::UFract:
2056 case BuiltinType::SatFract:
2057 case BuiltinType::SatUFract:
2058 Width =
Target->getFractWidth();
2059 Align =
Target->getFractAlign();
2061 case BuiltinType::LongFract:
2062 case BuiltinType::ULongFract:
2063 case BuiltinType::SatLongFract:
2064 case BuiltinType::SatULongFract:
2065 Width =
Target->getLongFractWidth();
2066 Align =
Target->getLongFractAlign();
2068 case BuiltinType::BFloat16:
2069 if (
Target->hasBFloat16Type()) {
2070 Width =
Target->getBFloat16Width();
2071 Align =
Target->getBFloat16Align();
2080 case BuiltinType::Float16:
2081 case BuiltinType::Half:
2084 Width =
Target->getHalfWidth();
2085 Align =
Target->getHalfAlign();
2088 "Expected OpenMP device compilation.");
2093 case BuiltinType::Float:
2094 Width =
Target->getFloatWidth();
2095 Align =
Target->getFloatAlign();
2097 case BuiltinType::Double:
2098 Width =
Target->getDoubleWidth();
2099 Align =
Target->getDoubleAlign();
2101 case BuiltinType::Ibm128:
2102 Width =
Target->getIbm128Width();
2103 Align =
Target->getIbm128Align();
2105 case BuiltinType::LongDouble:
2112 Width =
Target->getLongDoubleWidth();
2113 Align =
Target->getLongDoubleAlign();
2116 case BuiltinType::Float128:
2119 Width =
Target->getFloat128Width();
2120 Align =
Target->getFloat128Align();
2123 "Expected OpenMP device compilation.");
2128 case BuiltinType::NullPtr:
2133 case BuiltinType::ObjCId:
2134 case BuiltinType::ObjCClass:
2135 case BuiltinType::ObjCSel:
2139 case BuiltinType::OCLSampler:
2140 case BuiltinType::OCLEvent:
2141 case BuiltinType::OCLClkEvent:
2142 case BuiltinType::OCLQueue:
2143 case BuiltinType::OCLReserveID:
2144#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2145 case BuiltinType::Id:
2146#include "clang/Basic/OpenCLImageTypes.def"
2147#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2148 case BuiltinType::Id:
2149#include "clang/Basic/OpenCLExtensionTypes.def"
2151 Width =
Target->getPointerWidth(AS);
2152 Align =
Target->getPointerAlign(AS);
2162#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId, NumEls, ElBits, \
2163 IsSigned, IsFP, IsBF) \
2164 case BuiltinType::Id: \
2168#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId, NumEls) \
2169 case BuiltinType::Id: \
2173#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2174 case BuiltinType::Id: \
2178#include "clang/Basic/AArch64SVEACLETypes.def"
2179#define PPC_VECTOR_TYPE(Name, Id, Size) \
2180 case BuiltinType::Id: \
2184#include "clang/Basic/PPCTypes.def"
2185#define RVV_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, NF, IsSigned, \
2187 case BuiltinType::Id: \
2191#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) \
2192 case BuiltinType::Id: \
2196#include "clang/Basic/RISCVVTypes.def"
2197#define WASM_TYPE(Name, Id, SingletonId) \
2198 case BuiltinType::Id: \
2202#include "clang/Basic/WebAssemblyReferenceTypes.def"
2205 case Type::ObjCObjectPointer:
2209 case Type::BlockPointer:
2210 AS = cast<BlockPointerType>(
T)->getPointeeType().getAddressSpace();
2211 Width =
Target->getPointerWidth(AS);
2212 Align =
Target->getPointerAlign(AS);
2214 case Type::LValueReference:
2215 case Type::RValueReference:
2218 AS = cast<ReferenceType>(
T)->getPointeeType().getAddressSpace();
2219 Width =
Target->getPointerWidth(AS);
2220 Align =
Target->getPointerAlign(AS);
2223 AS = cast<PointerType>(
T)->getPointeeType().getAddressSpace();
2224 Width =
Target->getPointerWidth(AS);
2225 Align =
Target->getPointerAlign(AS);
2227 case Type::MemberPointer: {
2228 const auto *MPT = cast<MemberPointerType>(
T);
2234 case Type::Complex: {
2238 Width = EltInfo.
Width * 2;
2239 Align = EltInfo.
Align;
2242 case Type::ObjCObject:
2243 return getTypeInfo(cast<ObjCObjectType>(
T)->getBaseType().getTypePtr());
2244 case Type::Adjusted:
2247 case Type::ObjCInterface: {
2248 const auto *ObjCI = cast<ObjCInterfaceType>(
T);
2249 if (ObjCI->getDecl()->isInvalidDecl()) {
2259 case Type::BitInt: {
2260 const auto *EIT = cast<BitIntType>(
T);
2261 Align =
Target->getBitIntAlign(EIT->getNumBits());
2262 Width =
Target->getBitIntWidth(EIT->getNumBits());
2267 const auto *TT = cast<TagType>(
T);
2269 if (TT->getDecl()->isInvalidDecl()) {
2275 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
2276 const EnumDecl *ED = ET->getDecl();
2280 Info.
Align = AttrAlign;
2286 const auto *RT = cast<RecordType>(TT);
2291 AlignRequirement = RD->
hasAttr<AlignedAttr>()
2297 case Type::SubstTemplateTypeParm:
2298 return getTypeInfo(cast<SubstTemplateTypeParmType>(
T)->
2299 getReplacementType().getTypePtr());
2302 case Type::DeducedTemplateSpecialization: {
2303 const auto *A = cast<DeducedType>(
T);
2304 assert(!A->getDeducedType().isNull() &&
2305 "cannot request the size of an undeduced or dependent auto type");
2306 return getTypeInfo(A->getDeducedType().getTypePtr());
2310 return getTypeInfo(cast<ParenType>(
T)->getInnerType().getTypePtr());
2312 case Type::MacroQualified:
2316 case Type::ObjCTypeParam:
2317 return getTypeInfo(cast<ObjCTypeParamType>(
T)->desugar().getTypePtr());
2320 return getTypeInfo(cast<UsingType>(
T)->desugar().getTypePtr());
2322 case Type::Typedef: {
2323 const auto *TT = cast<TypedefType>(
T);
2328 if (
unsigned AttrAlign = TT->getDecl()->getMaxAlignment()) {
2339 case Type::Elaborated:
2340 return getTypeInfo(cast<ElaboratedType>(
T)->getNamedType().getTypePtr());
2342 case Type::Attributed:
2344 cast<AttributedType>(
T)->getEquivalentType().getTypePtr());
2346 case Type::CountAttributed:
2347 return getTypeInfo(cast<CountAttributedType>(
T)->desugar().getTypePtr());
2349 case Type::BTFTagAttributed:
2351 cast<BTFTagAttributedType>(
T)->getWrappedType().getTypePtr());
2353 case Type::Atomic: {
2362 Width =
Target->getCharWidth();
2364 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2370 Width = llvm::bit_ceil(Width);
2373 Align =
static_cast<unsigned>(Width);
2384 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2385 return TypeInfo(Width, Align, AlignRequirement);
2389 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(
T);
2390 if (I != MemoizedUnadjustedAlign.end())
2393 unsigned UnadjustedAlign;
2405 MemoizedUnadjustedAlign[
T] = UnadjustedAlign;
2406 return UnadjustedAlign;
2410 unsigned SimdAlign = llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(
2460 unsigned ABIAlign = TI.
Align;
2468 if (!
Target->allowsLargerPreferedTypeAlignment())
2482 unsigned PreferredAlign =
static_cast<unsigned>(
2484 assert(PreferredAlign >= ABIAlign &&
2485 "PreferredAlign should be at least as large as ABIAlign.");
2486 return PreferredAlign;
2493 T = CT->getElementType().getTypePtr();
2495 T = ET->getDecl()->getIntegerType().getTypePtr();
2500 Target->defaultsToAIXPowerAlignment()))
2555 for (
unsigned I = 0, N = Path.size(); I != N; ++I) {
2559 std::swap(
Base, Derived);
2579 llvm::append_range(Ivars, OI->
ivars());
2582 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2584 Ivars.push_back(Iv);
2592 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2595 for (
auto *Proto : OI->all_referenced_protocols()) {
2600 for (
const auto *Cat : OI->visible_categories())
2606 SD = SD->getSuperClass();
2608 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2609 for (
auto *Proto : OC->protocols()) {
2612 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2614 if (!Protocols.insert(
2618 for (
auto *Proto : OP->protocols())
2625 bool CheckIfTriviallyCopyable) {
2626 assert(RD->
isUnion() &&
"Must be union type");
2629 for (
const auto *Field : RD->
fields()) {
2631 CheckIfTriviallyCopyable))
2634 if (FieldSize != UnionSize)
2652static std::optional<int64_t>
2655 bool CheckIfTriviallyCopyable);
2657static std::optional<int64_t>
2659 bool CheckIfTriviallyCopyable) {
2660 if (Field->getType()->isRecordType()) {
2661 const RecordDecl *RD = Field->getType()->getAsRecordDecl();
2664 CheckIfTriviallyCopyable);
2669 bool IsBitIntType = Field->getType()->isBitIntType();
2670 if (!Field->getType()->isReferenceType() && !IsBitIntType &&
2672 CheckIfTriviallyCopyable))
2673 return std::nullopt;
2675 int64_t FieldSizeInBits =
2677 if (Field->isBitField()) {
2680 if (Field->isUnnamedBitField())
2683 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2685 if ((
unsigned)BitfieldSize >
2686 cast<BitIntType>(Field->getType())->getNumBits())
2687 return std::nullopt;
2688 }
else if (BitfieldSize > FieldSizeInBits) {
2689 return std::nullopt;
2691 FieldSizeInBits = BitfieldSize;
2693 Field->getType(), CheckIfTriviallyCopyable)) {
2694 return std::nullopt;
2696 return FieldSizeInBits;
2699static std::optional<int64_t>
2701 bool CheckIfTriviallyCopyable) {
2703 CheckIfTriviallyCopyable);
2706template <
typename RangeT>
2708 const RangeT &Subobjects, int64_t CurOffsetInBits,
2710 bool CheckIfTriviallyCopyable) {
2711 for (
const auto *Subobject : Subobjects) {
2712 std::optional<int64_t> SizeInBits =
2715 return std::nullopt;
2716 if (*SizeInBits != 0) {
2718 if (Offset != CurOffsetInBits)
2719 return std::nullopt;
2720 CurOffsetInBits += *SizeInBits;
2723 return CurOffsetInBits;
2726static std::optional<int64_t>
2729 bool CheckIfTriviallyCopyable) {
2730 assert(!RD->
isUnion() &&
"Must be struct/class type");
2733 int64_t CurOffsetInBits = 0;
2734 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2735 if (ClassDecl->isDynamicClass())
2736 return std::nullopt;
2739 for (
const auto &
Base : ClassDecl->bases()) {
2742 Bases.emplace_back(
Base.getType()->getAsCXXRecordDecl());
2746 return Layout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R);
2749 std::optional<int64_t> OffsetAfterBases =
2751 Bases, CurOffsetInBits, Context, Layout, CheckIfTriviallyCopyable);
2752 if (!OffsetAfterBases)
2753 return std::nullopt;
2754 CurOffsetInBits = *OffsetAfterBases;
2757 std::optional<int64_t> OffsetAfterFields =
2759 RD->
fields(), CurOffsetInBits, Context, Layout,
2760 CheckIfTriviallyCopyable);
2761 if (!OffsetAfterFields)
2762 return std::nullopt;
2763 CurOffsetInBits = *OffsetAfterFields;
2765 return CurOffsetInBits;
2769 QualType Ty,
bool CheckIfTriviallyCopyable)
const {
2786 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2791 CheckIfTriviallyCopyable);
2811 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2816 if (
Record->isInvalidDecl())
2821 CheckIfTriviallyCopyable);
2824 *
this,
Record, CheckIfTriviallyCopyable);
2826 return StructSize && *StructSize ==
static_cast<int64_t
>(
getTypeSize(Ty));
2847 count += Ext->ivar_size();
2852 count += ImplDecl->ivar_size();
2870 if (isa<GNUNullExpr>(E))
return true;
2878 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2879 I = ObjCImpls.find(D);
2880 if (I != ObjCImpls.end())
2881 return cast<ObjCImplementationDecl>(I->second);
2888 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2889 I = ObjCImpls.find(D);
2890 if (I != ObjCImpls.end())
2891 return cast<ObjCCategoryImplDecl>(I->second);
2898 assert(IFaceD && ImplD &&
"Passed null params");
2899 ObjCImpls[IFaceD] = ImplD;
2905 assert(CatD && ImplD &&
"Passed null params");
2906 ObjCImpls[CatD] = ImplD;
2911 return ObjCMethodRedecls.lookup(MD);
2917 ObjCMethodRedecls[MD] = Redecl;
2922 if (
const auto *ID = dyn_cast<ObjCInterfaceDecl>(ND->
getDeclContext()))
2924 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
2925 return CD->getClassInterface();
2926 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
2927 return IMD->getClassInterface();
2935 assert(VD &&
"Passed null params");
2936 assert(VD->
hasAttr<BlocksAttr>() &&
2937 "getBlockVarCopyInits - not __block var");
2938 auto I = BlockVarCopyInits.find(VD);
2939 if (I != BlockVarCopyInits.end())
2941 return {
nullptr,
false};
2947 assert(VD && CopyExpr &&
"Passed null params");
2948 assert(VD->
hasAttr<BlocksAttr>() &&
2949 "setBlockVarCopyInits - not __block var");
2950 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr,
CanThrow);
2954 unsigned DataSize)
const {
2959 "incorrect data size provided to CreateTypeSourceInfo!");
2976 return getObjCLayout(D,
nullptr);
2987 bool &AnyNonCanonArgs) {
2989 for (
auto &Arg : CanonArgs) {
2991 Arg =
C.getCanonicalTemplateArgument(Arg);
2992 AnyNonCanonArgs |= !Arg.structurallyEquals(OrigArg);
3002ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
3007 llvm::FoldingSetNodeID
ID;
3009 void *insertPos =
nullptr;
3010 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
3011 assert(eq->getQualifiers() == quals);
3020 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
3023 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
3026 auto *eq =
new (*
this,
alignof(
ExtQuals))
ExtQuals(baseType, canon, quals);
3027 ExtQualNodes.InsertNode(eq, insertPos);
3032 LangAS AddressSpace)
const {
3045 "Type cannot be in multiple addr spaces!");
3048 return getExtQualType(TypeNode, Quals);
3054 if (!
T.hasAddressSpace())
3060 const Type *TypeNode;
3062 while (
T.hasAddressSpace()) {
3063 TypeNode = Quals.
strip(
T);
3067 if (!
QualType(TypeNode, 0).hasAddressSpace())
3071 T =
T.getSingleStepDesugaredType(*
this);
3080 return getExtQualType(TypeNode, Quals);
3107 "Type cannot have multiple ObjCGCs!");
3110 return getExtQualType(TypeNode, Quals);
3124 QualType WrappedTy,
Expr *CountExpr,
bool CountInBytes,
bool OrNull,
3128 llvm::FoldingSetNodeID ID;
3131 void *InsertPos =
nullptr;
3133 CountAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
3138 size_t Size = CountAttributedType::totalSizeToAlloc<TypeCoupledDeclRefInfo>(
3139 DependentDecls.size());
3142 OrNull, DependentDecls);
3143 Types.push_back(CATy);
3144 CountAttributedTypes.InsertNode(CATy, InsertPos);
3155 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(
T)) {
3158 const auto *FPT = cast<FunctionProtoType>(
T);
3164 return cast<FunctionType>(
Result.getTypePtr());
3180 L->DeducedReturnType(FD, ResultType);
3190 if (
const auto *PT = dyn_cast<ParenType>(Orig))
3195 if (
const auto *MQT = dyn_cast<MacroQualifiedType>(Orig))
3198 MQT->getMacroIdentifier());
3201 if (
const auto *AT = dyn_cast<AttributedType>(Orig))
3211 Proto->getReturnType(), Proto->getParamTypes(),
3212 Proto->getExtProtoInfo().withExceptionSpec(ESI));
3227 for (
unsigned i = 0, n = Args.size(); i != n; ++i)
3261 if (TSInfo->getType() != FD->
getType())
3269 "TypeLoc size mismatch from updating exception specification");
3270 TSInfo->overrideType(Updated);
3279 llvm::FoldingSetNodeID ID;
3282 void *InsertPos =
nullptr;
3283 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
3289 if (!
T.isCanonical()) {
3293 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
3294 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3297 Types.push_back(New);
3298 ComplexTypes.InsertNode(New, InsertPos);
3307 llvm::FoldingSetNodeID ID;
3310 void *InsertPos =
nullptr;
3311 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3317 if (!
T.isCanonical()) {
3321 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3322 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3325 Types.push_back(New);
3326 PointerTypes.InsertNode(New, InsertPos);
3331 llvm::FoldingSetNodeID ID;
3333 void *InsertPos =
nullptr;
3334 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3341 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3342 assert(!AT &&
"Shouldn't be in the map!");
3346 Types.push_back(AT);
3347 AdjustedTypes.InsertNode(AT, InsertPos);
3352 llvm::FoldingSetNodeID ID;
3354 void *InsertPos =
nullptr;
3355 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3362 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3363 assert(!AT &&
"Shouldn't be in the map!");
3366 Types.push_back(AT);
3367 AdjustedTypes.InsertNode(AT, InsertPos);
3398 const auto *ATy = cast<ConstantArrayType>(Ty);
3399 llvm::FoldingSetNodeID ID;
3400 ATy->Profile(ID, *
this, ATy->getElementType(), ATy->getZExtSize(),
3401 ATy->getSizeExpr(), ATy->getSizeModifier(),
3402 ATy->getIndexTypeQualifiers().getAsOpaqueValue());
3403 void *InsertPos =
nullptr;
3405 ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3414 AT = ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3415 assert(!AT &&
"Shouldn't be in the map!");
3420 Types.push_back(AT);
3421 ArrayParameterTypes.InsertNode(AT, InsertPos);
3431 llvm::FoldingSetNodeID ID;
3434 void *InsertPos =
nullptr;
3436 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3442 if (!
T.isCanonical()) {
3447 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3448 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3452 Types.push_back(New);
3453 BlockPointerTypes.InsertNode(New, InsertPos);
3463 "Unresolved placeholder type");
3467 llvm::FoldingSetNodeID ID;
3470 void *InsertPos =
nullptr;
3472 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3480 if (!SpelledAsLValue || InnerRef || !
T.isCanonical()) {
3481 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
3486 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3487 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3492 Types.push_back(New);
3493 LValueReferenceTypes.InsertNode(New, InsertPos);
3503 "Unresolved placeholder type");
3507 llvm::FoldingSetNodeID ID;
3510 void *InsertPos =
nullptr;
3512 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3520 if (InnerRef || !
T.isCanonical()) {
3521 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
3526 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3527 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3532 Types.push_back(New);
3533 RValueReferenceTypes.InsertNode(New, InsertPos);
3542 llvm::FoldingSetNodeID ID;
3545 void *InsertPos =
nullptr;
3547 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3558 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3559 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3563 Types.push_back(New);
3564 MemberPointerTypes.InsertNode(New, InsertPos);
3571 const llvm::APInt &ArySizeIn,
3572 const Expr *SizeExpr,
3574 unsigned IndexTypeQuals)
const {
3577 "Constant array of VLAs is illegal!");
3585 llvm::APInt ArySize(ArySizeIn);
3586 ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
3588 llvm::FoldingSetNodeID ID;
3590 ASM, IndexTypeQuals);
3592 void *InsertPos =
nullptr;
3594 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
3605 ASM, IndexTypeQuals);
3610 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
3611 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3614 auto *New = ConstantArrayType::Create(*
this, EltTy, Canon, ArySize, SizeExpr,
3615 ASM, IndexTypeQuals);
3616 ConstantArrayTypes.InsertNode(New, InsertPos);
3617 Types.push_back(New);
3626 if (!
type->isVariablyModifiedType())
return type;
3631 const Type *ty = split.
Ty;
3633#define TYPE(Class, Base)
3634#define ABSTRACT_TYPE(Class, Base)
3635#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
3636#include "clang/AST/TypeNodes.inc"
3637 llvm_unreachable(
"didn't desugar past all non-canonical types?");
3643 case Type::DependentVector:
3644 case Type::ExtVector:
3645 case Type::DependentSizedExtVector:
3646 case Type::ConstantMatrix:
3647 case Type::DependentSizedMatrix:
3648 case Type::DependentAddressSpace:
3649 case Type::ObjCObject:
3650 case Type::ObjCInterface:
3651 case Type::ObjCObjectPointer:
3654 case Type::UnresolvedUsing:
3655 case Type::TypeOfExpr:
3657 case Type::Decltype:
3658 case Type::UnaryTransform:
3659 case Type::DependentName:
3660 case Type::InjectedClassName:
3661 case Type::TemplateSpecialization:
3662 case Type::DependentTemplateSpecialization:
3663 case Type::TemplateTypeParm:
3664 case Type::SubstTemplateTypeParmPack:
3666 case Type::DeducedTemplateSpecialization:
3667 case Type::PackExpansion:
3668 case Type::PackIndexing:
3670 case Type::DependentBitInt:
3671 case Type::ArrayParameter:
3672 llvm_unreachable(
"type should never be variably-modified");
3676 case Type::FunctionNoProto:
3677 case Type::FunctionProto:
3678 case Type::BlockPointer:
3679 case Type::MemberPointer:
3689 cast<PointerType>(ty)->getPointeeType()));
3692 case Type::LValueReference: {
3693 const auto *lv = cast<LValueReferenceType>(ty);
3696 lv->isSpelledAsLValue());
3700 case Type::RValueReference: {
3701 const auto *lv = cast<RValueReferenceType>(ty);
3707 case Type::Atomic: {
3708 const auto *at = cast<AtomicType>(ty);
3713 case Type::ConstantArray: {
3714 const auto *cat = cast<ConstantArrayType>(ty);
3719 cat->getSizeModifier(),
3720 cat->getIndexTypeCVRQualifiers());
3724 case Type::DependentSizedArray: {
3725 const auto *dat = cast<DependentSizedArrayType>(ty);
3729 dat->getSizeModifier(),
3730 dat->getIndexTypeCVRQualifiers(),
3731 dat->getBracketsRange());
3736 case Type::IncompleteArray: {
3737 const auto *iat = cast<IncompleteArrayType>(ty);
3746 case Type::VariableArray: {
3747 const auto *vat = cast<VariableArrayType>(ty);
3751 vat->getIndexTypeCVRQualifiers(), vat->getBracketsRange());
3764 unsigned IndexTypeQuals,
3775 IndexTypeQuals, Brackets);
3782 VariableArrayTypes.push_back(New);
3783 Types.push_back(New);
3793 unsigned elementTypeQuals,
3797 "Size must be type- or value-dependent!");
3801 void *insertPos =
nullptr;
3802 llvm::FoldingSetNodeID ID;
3804 ID, *
this, numElements ?
QualType(canonElementType.
Ty, 0) : elementType,
3805 ASM, elementTypeQuals, numElements);
3809 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3820 elementTypeQuals, brackets);
3821 DependentSizedArrayTypes.InsertNode(newType, insertPos);
3822 Types.push_back(newType);
3830 numElements, ASM, elementTypeQuals, brackets);
3831 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
3832 Types.push_back(canonTy);
3837 canonElementType.
Quals);
3841 if (
QualType(canonElementType.
Ty, 0) == elementType &&
3849 elementTypeQuals, brackets);
3850 Types.push_back(sugaredType);
3856 unsigned elementTypeQuals)
const {
3857 llvm::FoldingSetNodeID ID;
3860 void *insertPos =
nullptr;
3862 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
3874 ASM, elementTypeQuals);
3879 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3880 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
3886 IncompleteArrayTypes.InsertNode(newType, insertPos);
3887 Types.push_back(newType);
3893#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS) \
3894 {getIntTypeForBitwidth(BITS, SIGNED), llvm::ElementCount::getScalable(ELTS), \
3897#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS) \
3898 {ELTTY, llvm::ElementCount::getScalable(ELTS), NUMVECTORS};
3902 llvm_unreachable(
"Unsupported builtin vector type");
3903 case BuiltinType::SveInt8:
3905 case BuiltinType::SveUint8:
3907 case BuiltinType::SveInt8x2:
3909 case BuiltinType::SveUint8x2:
3911 case BuiltinType::SveInt8x3:
3913 case BuiltinType::SveUint8x3:
3915 case BuiltinType::SveInt8x4:
3917 case BuiltinType::SveUint8x4:
3919 case BuiltinType::SveInt16:
3921 case BuiltinType::SveUint16:
3923 case BuiltinType::SveInt16x2:
3925 case BuiltinType::SveUint16x2:
3927 case BuiltinType::SveInt16x3:
3929 case BuiltinType::SveUint16x3:
3931 case BuiltinType::SveInt16x4:
3933 case BuiltinType::SveUint16x4:
3935 case BuiltinType::SveInt32:
3937 case BuiltinType::SveUint32:
3939 case BuiltinType::SveInt32x2:
3941 case BuiltinType::SveUint32x2:
3943 case BuiltinType::SveInt32x3:
3945 case BuiltinType::SveUint32x3:
3947 case BuiltinType::SveInt32x4:
3949 case BuiltinType::SveUint32x4:
3951 case BuiltinType::SveInt64:
3953 case BuiltinType::SveUint64:
3955 case BuiltinType::SveInt64x2:
3957 case BuiltinType::SveUint64x2:
3959 case BuiltinType::SveInt64x3:
3961 case BuiltinType::SveUint64x3:
3963 case BuiltinType::SveInt64x4:
3965 case BuiltinType::SveUint64x4:
3967 case BuiltinType::SveBool:
3969 case BuiltinType::SveBoolx2:
3971 case BuiltinType::SveBoolx4:
3973 case BuiltinType::SveFloat16:
3975 case BuiltinType::SveFloat16x2:
3977 case BuiltinType::SveFloat16x3:
3979 case BuiltinType::SveFloat16x4:
3981 case BuiltinType::SveFloat32:
3983 case BuiltinType::SveFloat32x2:
3985 case BuiltinType::SveFloat32x3:
3987 case BuiltinType::SveFloat32x4:
3989 case BuiltinType::SveFloat64:
3991 case BuiltinType::SveFloat64x2:
3993 case BuiltinType::SveFloat64x3:
3995 case BuiltinType::SveFloat64x4:
3997 case BuiltinType::SveBFloat16:
3999 case BuiltinType::SveBFloat16x2:
4001 case BuiltinType::SveBFloat16x3:
4003 case BuiltinType::SveBFloat16x4:
4005#define RVV_VECTOR_TYPE_INT(Name, Id, SingletonId, NumEls, ElBits, NF, \
4007 case BuiltinType::Id: \
4008 return {getIntTypeForBitwidth(ElBits, IsSigned), \
4009 llvm::ElementCount::getScalable(NumEls), NF};
4010#define RVV_VECTOR_TYPE_FLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4011 case BuiltinType::Id: \
4012 return {ElBits == 16 ? Float16Ty : (ElBits == 32 ? FloatTy : DoubleTy), \
4013 llvm::ElementCount::getScalable(NumEls), NF};
4014#define RVV_VECTOR_TYPE_BFLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4015 case BuiltinType::Id: \
4016 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
4017#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4018 case BuiltinType::Id: \
4019 return {BoolTy, llvm::ElementCount::getScalable(NumEls), 1};
4020#include "clang/Basic/RISCVVTypes.def"
4027 if (
Target->getTriple().isWasm() &&
Target->hasFeature(
"reference-types")) {
4028#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
4029 if (BuiltinType::Id == BuiltinType::WasmExternRef) \
4031#include "clang/Basic/WebAssemblyReferenceTypes.def"
4034 "shouldn't try to generate type externref outside WebAssembly target");
4041 unsigned NumFields)
const {
4042 if (
Target->hasAArch64SVETypes()) {
4044#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId, NumEls, ElBits, \
4045 IsSigned, IsFP, IsBF) \
4046 if (!EltTy->isBooleanType() && \
4047 ((EltTy->hasIntegerRepresentation() && \
4048 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4049 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4051 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4052 IsBF && !IsFP)) && \
4053 EltTySize == ElBits && NumElts == NumEls) { \
4054 return SingletonId; \
4056#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId, NumEls) \
4057 if (EltTy->isBooleanType() && NumElts == NumEls) \
4059#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingleTonId)
4060#include "clang/Basic/AArch64SVEACLETypes.def"
4061 }
else if (
Target->hasRISCVVTypes()) {
4063#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
4065 if (!EltTy->isBooleanType() && \
4066 ((EltTy->hasIntegerRepresentation() && \
4067 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4068 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4070 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4071 IsBF && !IsFP)) && \
4072 EltTySize == ElBits && NumElts == NumEls && NumFields == NF) \
4074#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4075 if (EltTy->isBooleanType() && NumElts == NumEls) \
4077#include "clang/Basic/RISCVVTypes.def"
4093 llvm::FoldingSetNodeID ID;
4096 void *InsertPos =
nullptr;
4097 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4107 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4108 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4111 VectorType(vecType, NumElts, Canonical, VecKind);
4112 VectorTypes.InsertNode(New, InsertPos);
4113 Types.push_back(New);
4120 llvm::FoldingSetNodeID ID;
4123 void *InsertPos =
nullptr;
4125 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4130 VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
4133 if (CanonVecTy == VecType) {
4138 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4139 assert(!CanonCheck &&
4140 "Dependent-sized vector_size canonical type broken");
4142 DependentVectorTypes.InsertNode(New, InsertPos);
4151 Types.push_back(New);
4158 unsigned NumElts)
const {
4166 llvm::FoldingSetNodeID ID;
4169 void *InsertPos =
nullptr;
4170 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4180 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4181 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4185 VectorTypes.InsertNode(New, InsertPos);
4186 Types.push_back(New);
4194 llvm::FoldingSetNodeID ID;
4198 void *InsertPos =
nullptr;
4200 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4210 if (CanonVecTy == vecType) {
4215 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4216 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
4218 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
4227 Types.push_back(New);
4232 unsigned NumColumns)
const {
4233 llvm::FoldingSetNodeID ID;
4235 Type::ConstantMatrix);
4238 "need a valid element type");
4241 "need valid matrix dimensions");
4242 void *InsertPos =
nullptr;
4252 assert(!NewIP &&
"Matrix type shouldn't already exist in the map");
4258 MatrixTypes.InsertNode(New, InsertPos);
4259 Types.push_back(New);
4268 llvm::FoldingSetNodeID ID;
4272 void *InsertPos =
nullptr;
4274 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4279 ColumnExpr, AttrLoc);
4282 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4283 assert(!CanonCheck &&
"Dependent-sized matrix canonical type broken");
4285 DependentSizedMatrixTypes.InsertNode(Canon, InsertPos);
4286 Types.push_back(Canon);
4299 ColumnExpr, AttrLoc);
4300 Types.push_back(New);
4305 Expr *AddrSpaceExpr,
4311 void *insertPos =
nullptr;
4312 llvm::FoldingSetNodeID ID;
4317 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
4323 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
4324 Types.push_back(canonTy);
4327 if (canonPointeeType == PointeeType &&
4333 AddrSpaceExpr, AttrLoc);
4334 Types.push_back(sugaredType);
4340 return T.isCanonical() &&
4358 llvm::FoldingSetNodeID ID;
4361 void *InsertPos =
nullptr;
4363 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
4373 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4374 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4379 Types.push_back(New);
4380 FunctionNoProtoTypes.InsertNode(New, InsertPos);
4396 return CanResultType;
4403 if (!NoexceptInType)
4420 bool AnyPackExpansions =
false;
4425 AnyPackExpansions =
true;
4427 return AnyPackExpansions;
4433QualType ASTContext::getFunctionTypeInternal(
4436 size_t NumArgs = ArgArray.size();
4440 llvm::FoldingSetNodeID
ID;
4445 bool Unique =
false;
4447 void *InsertPos =
nullptr;
4449 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4469 bool IsCanonicalExceptionSpec =
4473 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
4475 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
4476 if (!ArgArray[i].isCanonicalAsParam())
4477 isCanonical =
false;
4479 if (OnlyWantCanonical)
4480 assert(isCanonical &&
4481 "given non-canonical parameters constructing canonical type");
4486 if (!isCanonical && Canonical.
isNull()) {
4488 CanonicalArgs.reserve(NumArgs);
4489 for (
unsigned i = 0; i != NumArgs; ++i)
4496 if (IsCanonicalExceptionSpec) {
4498 }
else if (NoexceptInType) {
4511 bool AnyPacks =
false;
4534 llvm_unreachable(
"dependent noexcept is already canonical");
4543 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
4547 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4548 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4553 auto ESH = FunctionProtoType::getExceptionSpecSize(
4555 size_t Size = FunctionProtoType::totalSizeToAlloc<
4561 ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
4568 Types.push_back(FTP);
4570 FunctionProtoTypes.InsertNode(FTP, InsertPos);
4575 llvm::FoldingSetNodeID
ID;
4578 void *InsertPos =
nullptr;
4579 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
4585 if (!
T.isCanonical()) {
4589 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
4590 assert(!NewIP &&
"Shouldn't be in the map!");
4594 Types.push_back(New);
4595 PipeTypes.InsertNode(New, InsertPos);
4606 return getPipeType(
T,
true);
4610 return getPipeType(
T,
false);
4614 llvm::FoldingSetNodeID ID;
4617 void *InsertPos =
nullptr;
4618 if (
BitIntType *EIT = BitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
4622 BitIntTypes.InsertNode(New, InsertPos);
4623 Types.push_back(New);
4628 Expr *NumBitsExpr)
const {
4630 llvm::FoldingSetNodeID ID;
4633 void *InsertPos =
nullptr;
4635 DependentBitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
4640 DependentBitIntTypes.InsertNode(New, InsertPos);
4642 Types.push_back(New);
4648 if (!isa<CXXRecordDecl>(D))
return false;
4649 const auto *RD = cast<CXXRecordDecl>(D);
4650 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
4652 if (RD->getDescribedClassTemplate() &&
4653 !isa<ClassTemplateSpecializationDecl>(RD))
4664 if (
Decl->TypeForDecl) {
4665 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
4667 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
4668 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4669 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
4673 Decl->TypeForDecl = newType;
4674 Types.push_back(newType);
4682 assert(
Decl &&
"Passed null for Decl param");
4683 assert(!
Decl->TypeForDecl &&
"TypeForDecl present in slow case");
4685 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(
Decl))
4688 assert(!isa<TemplateTypeParmDecl>(
Decl) &&
4689 "Template type parameter types are always available.");
4691 if (
const auto *
Record = dyn_cast<RecordDecl>(
Decl)) {
4692 assert(
Record->isFirstDecl() &&
"struct/union has previous declaration");
4695 }
else if (
const auto *
Enum = dyn_cast<EnumDecl>(
Decl)) {
4696 assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
4698 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(
Decl)) {
4701 llvm_unreachable(
"TypeDecl without a type?");
4710 if (!
Decl->TypeForDecl) {
4712 Underlying =
Decl->getUnderlyingType();
4715 Decl->TypeForDecl = NewType;
4716 Types.push_back(NewType);
4719 if (Underlying.
isNull() ||
Decl->getUnderlyingType() == Underlying)
4723 llvm::FoldingSetNodeID ID;
4726 void *InsertPos =
nullptr;
4727 if (
TypedefType *
T = TypedefTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4728 assert(!
T->typeMatchesDecl() &&
4729 "non-divergent case should be handled with TypeDecl");
4733 void *Mem =
Allocate(TypedefType::totalSizeToAlloc<QualType>(
true),
4735 auto *NewType =
new (Mem)
TypedefType(Type::Typedef,
Decl, Underlying,
4737 TypedefTypes.InsertNode(NewType, InsertPos);
4738 Types.push_back(NewType);
4744 llvm::FoldingSetNodeID ID;
4747 void *InsertPos =
nullptr;
4748 if (
UsingType *
T = UsingTypes.FindNodeOrInsertPos(ID, InsertPos))
4751 const Type *TypeForDecl =
4761 Allocate(UsingType::totalSizeToAlloc<QualType>(!Underlying.
isNull()),
4764 Types.push_back(NewType);
4765 UsingTypes.InsertNode(NewType, InsertPos);
4773 if (PrevDecl->TypeForDecl)
4774 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
4777 Decl->TypeForDecl = newType;
4778 Types.push_back(newType);
4786 if (PrevDecl->TypeForDecl)
4787 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
4790 Decl->TypeForDecl = newType;
4791 Types.push_back(newType);
4797 if (
Decl->TypeForDecl)
4802 if (CanonicalDecl->TypeForDecl)
4803 return QualType(
Decl->TypeForDecl = CanonicalDecl->TypeForDecl, 0);
4807 Decl->TypeForDecl = newType;
4808 Types.push_back(newType);
4815 llvm::FoldingSetNodeID id;
4818 void *insertPos =
nullptr;
4826 Types.push_back(
type);
4827 AttributedTypes.InsertNode(
type, insertPos);
4834 llvm::FoldingSetNodeID ID;
4837 void *InsertPos =
nullptr;
4839 BTFTagAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
4847 Types.push_back(Ty);
4848 BTFTagAttributedTypes.InsertNode(Ty, InsertPos);
4855 QualType Replacement,
Decl *AssociatedDecl,
unsigned Index,
4856 std::optional<unsigned> PackIndex)
const {
4857 llvm::FoldingSetNodeID ID;
4860 void *InsertPos =
nullptr;
4862 SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4865 void *Mem =
Allocate(SubstTemplateTypeParmType::totalSizeToAlloc<QualType>(
4866 !Replacement.isCanonical()),
4870 Types.push_back(SubstParm);
4871 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
4880 unsigned Index,
bool Final,
4887 llvm::FoldingSetNodeID ID;
4890 void *InsertPos =
nullptr;
4892 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
4902 [[maybe_unused]]
const auto *Nothing =
4903 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
4911 Types.push_back(SubstParm);
4912 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
4922 llvm::FoldingSetNodeID ID;
4924 void *InsertPos =
nullptr;
4926 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4937 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4938 assert(!TypeCheck &&
"Template type parameter canonical type broken");
4944 Types.push_back(TypeParm);
4945 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
4955 assert(!Name.getAsDependentTemplateName() &&
4956 "No dependent template names here!");
4967 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
4977 "No dependent template names here!");
4980 ArgVec.reserve(Args.size());
4982 ArgVec.push_back(Arg.getArgument());
4990 if (Arg.isPackExpansion())
5002 "No dependent template names here!");
5005 Template = QTN->getUnderlyingTemplate();
5010 if (!Underlying.
isNull())
5016 "Caller must compute aliased type");
5017 IsTypeAlias =
false;
5026 (IsTypeAlias ?
sizeof(
QualType) : 0),
5030 IsTypeAlias ? Underlying :
QualType());
5032 Types.push_back(Spec);
5039 "No dependent template names here!");
5047 bool AnyNonCanonArgs =
false;
5053 llvm::FoldingSetNodeID ID;
5057 void *InsertPos =
nullptr;
5059 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5069 Types.push_back(Spec);
5070 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
5074 "Non-dependent template-id type must have a canonical type");
5081 TagDecl *OwnedTagDecl)
const {
5082 llvm::FoldingSetNodeID ID;
5085 void *InsertPos =
nullptr;
5086 ElaboratedType *
T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5093 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5094 assert(!CheckT &&
"Elaborated canonical type broken");
5099 Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
5101 T =
new (Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
5104 ElaboratedTypes.InsertNode(
T, InsertPos);
5110 llvm::FoldingSetNodeID ID;
5113 void *InsertPos =
nullptr;
5114 ParenType *
T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5121 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5122 assert(!CheckT &&
"Paren canonical type broken");
5128 ParenTypes.InsertNode(
T, InsertPos);
5141 Types.push_back(newType);
5151 if (CanonNNS != NNS)
5155 llvm::FoldingSetNodeID ID;
5158 void *InsertPos =
nullptr;
5160 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
5167 DependentNameTypes.InsertNode(
T, InsertPos);
5176 for (
unsigned I = 0, E = Args.size(); I != E; ++I)
5188 "nested-name-specifier must be dependent");
5190 llvm::FoldingSetNodeID ID;
5194 void *InsertPos =
nullptr;
5196 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5206 bool AnyNonCanonArgs =
false;
5211 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
5217 [[maybe_unused]]
auto *Nothing =
5218 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5219 assert(!Nothing &&
"canonical type broken");
5228 DependentTemplateSpecializationTypes.InsertNode(
T, InsertPos);
5234 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
5240 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
5242 NTTP->getType().getNonPackExpansionType().getNonLValueExprType(*
this);
5250 *
this, NTTP,
false,
T,
5253 if (NTTP->isParameterPack())
5258 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
5274 Args.reserve(Args.size() + Params->
size());
5281 std::optional<unsigned> NumExpansions,
5282 bool ExpectPackInType) {
5284 "Pack expansions must expand one or more parameter packs");
5286 llvm::FoldingSetNodeID ID;
5289 void *InsertPos =
nullptr;
5301 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
5307 PackExpansionTypes.InsertNode(
T, InsertPos);
5319 if (Protocols.empty())
return true;
5324 for (
unsigned i = 1; i != Protocols.size(); ++i)
5334 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
5338 P =
P->getCanonicalDecl();
5341 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
5342 Protocols.erase(ProtocolsEnd, Protocols.end());
5347 unsigned NumProtocols)
const {
5357 bool isKindOf)
const {
5360 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
5361 isa<ObjCInterfaceType>(baseType))
5365 llvm::FoldingSetNodeID ID;
5367 void *InsertPos =
nullptr;
5368 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
5375 if (effectiveTypeArgs.empty()) {
5377 effectiveTypeArgs = baseObject->getTypeArgs();
5384 bool typeArgsAreCanonical = llvm::all_of(
5387 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
5391 if (!typeArgsAreCanonical) {
5392 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
5393 for (
auto typeArg : effectiveTypeArgs)
5395 canonTypeArgs = canonTypeArgsVec;
5397 canonTypeArgs = effectiveTypeArgs;
5402 if (!protocolsSorted) {
5403 canonProtocolsVec.append(protocols.begin(), protocols.end());
5405 canonProtocols = canonProtocolsVec;
5407 canonProtocols = protocols;
5411 canonProtocols, isKindOf);
5414 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
5418 size += typeArgs.size() *
sizeof(
QualType);
5426 ObjCObjectTypes.InsertNode(
T, InsertPos);
5436 bool allowOnPointerType)
const {
5439 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(
type.getTypePtr())) {
5444 if (allowOnPointerType) {
5445 if (
const auto *objPtr =
5446 dyn_cast<ObjCObjectPointerType>(
type.getTypePtr())) {
5452 protocolsVec.append(protocols.begin(), protocols.end());
5464 if (
const auto *objT = dyn_cast<ObjCObjectType>(
type.getTypePtr())){
5469 objT->getTypeArgsAsWritten(),
5471 objT->isKindOfTypeAsWritten());
5475 if (
type->isObjCObjectType()) {
5485 if (
type->isObjCIdType()) {
5488 objPtr->isKindOfType());
5493 if (
type->isObjCClassType()) {
5496 objPtr->isKindOfType());
5508 llvm::FoldingSetNodeID ID;
5510 void *InsertPos =
nullptr;
5512 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
5517 if (!protocols.empty()) {
5521 Canonical, protocols, hasError,
true ));
5522 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
5530 Types.push_back(newType);
5531 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
5539 auto NewTypeParamTy = cast<ObjCTypeParamType>(New->
getTypeForDecl());
5541 protocols.append(NewTypeParamTy->qual_begin(), NewTypeParamTy->qual_end());
5556 for (
auto *Proto : OPT->quals()) {
5579 if (InheritedProtocols.empty())
5583 bool Conforms =
false;
5584 for (
auto *Proto : OPT->quals()) {
5586 for (
auto *PI : InheritedProtocols) {
5598 for (
auto *PI : InheritedProtocols) {
5600 bool Adopts =
false;
5601 for (
auto *Proto : OPT->quals()) {
5615 llvm::FoldingSetNodeID ID;
5618 void *InsertPos =
nullptr;
5620 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
5629 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
5638 Types.push_back(QType);
5639 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
5647 if (
Decl->TypeForDecl)
5651 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
5652 Decl->TypeForDecl = PrevDecl->TypeForDecl;
5653 return QualType(PrevDecl->TypeForDecl, 0);
5662 Decl->TypeForDecl =
T;
5675 llvm::FoldingSetNodeID ID;
5679 void *InsertPos =
nullptr;
5681 DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
5691 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
5699 Types.push_back(toe);
5712 Types.push_back(tot);
5736 llvm_unreachable(
"Unknown value kind");
5751 llvm::FoldingSetNodeID ID;
5754 void *InsertPos =
nullptr;
5756 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
5761 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
5769 Types.push_back(dt);
5774 bool FullySubstituted,
5778 if (FullySubstituted && Index != -1) {
5781 llvm::FoldingSetNodeID ID;
5783 void *InsertPos =
nullptr;
5785 DependentPackIndexingTypes.FindNodeOrInsertPos(ID, InsertPos);
5788 PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
5792 DependentPackIndexingTypes.InsertNode(Canon, InsertPos);
5798 Allocate(PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
5816 llvm::FoldingSetNodeID ID;
5819 void *InsertPos =
nullptr;
5821 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
5827 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
5836 Types.push_back(ut);
5840QualType ASTContext::getAutoTypeInternal(
5845 !TypeConstraintConcept && !IsDependent)
5849 void *InsertPos =
nullptr;
5850 llvm::FoldingSetNodeID ID;
5852 TypeConstraintConcept, TypeConstraintArgs);
5853 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
5860 }
else if (TypeConstraintConcept) {
5861 bool AnyNonCanonArgs =
false;
5864 *
this, TypeConstraintArgs, AnyNonCanonArgs);
5865 if (CanonicalConcept != TypeConstraintConcept || AnyNonCanonArgs) {
5867 getAutoTypeInternal(
QualType(), Keyword, IsDependent, IsPack,
5868 CanonicalConcept, CanonicalConceptArgs,
true);
5870 [[maybe_unused]]
auto *Nothing =
5871 AutoTypes.FindNodeOrInsertPos(ID, InsertPos);
5872 assert(!Nothing &&
"canonical type broken");
5882 (IsDependent ? TypeDependence::DependentInstantiation
5883 : TypeDependence::None) |
5884 (IsPack ? TypeDependence::UnexpandedPack : TypeDependence::None),
5885 Canon, TypeConstraintConcept, TypeConstraintArgs);
5886 Types.push_back(AT);
5887 AutoTypes.InsertNode(AT, InsertPos);
5896 bool IsDependent,
bool IsPack,
5899 assert((!IsPack || IsDependent) &&
"only use IsPack for a dependent pack");
5901 "A dependent auto should be undeduced");
5902 return getAutoTypeInternal(
DeducedType, Keyword, IsDependent, IsPack,
5903 TypeConstraintConcept, TypeConstraintArgs);
5911 if (!AT->isConstrained())
5915 AT->containsUnexpandedParameterPack()),
5933 void *InsertPos =
nullptr;
5934 llvm::FoldingSetNodeID ID;
5938 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
5943 llvm::FoldingSetNodeID TempID;
5944 DTST->Profile(TempID);
5945 assert(ID == TempID &&
"ID does not match");
5946 Types.push_back(DTST);
5947 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
5956 llvm::FoldingSetNodeID ID;
5959 void *InsertPos =
nullptr;
5960 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
5966 if (!
T.isCanonical()) {
5970 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
5971 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
5974 Types.push_back(New);
5975 AtomicTypes.InsertNode(New, InsertPos);
6011 return getFromTargetType(
Target->getSizeType());
6017 return getFromTargetType(
Target->getSignedSizeType());
6022 return getFromTargetType(
Target->getIntMaxType());
6027 return getFromTargetType(
Target->getUIntMaxType());
6045 return getFromTargetType(
Target->getIntPtrType());
6068 return getFromTargetType(
Target->getProcessIDType());
6080 const Type *Ty =
T.getTypePtr();
6084 }
else if (isa<ArrayType>(Ty)) {
6086 }
else if (isa<FunctionType>(Ty)) {
6108 quals = splitType.
Quals;
6113 QualType elementType = AT->getElementType();
6118 if (elementType == unqualElementType) {
6119 assert(quals.
empty());
6120 quals = splitType.
Quals;
6128 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
6130 CAT->getSizeExpr(), CAT->getSizeModifier(), 0);
6133 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
6137 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
6140 VAT->getSizeModifier(),
6141 VAT->getIndexTypeCVRQualifiers(),
6142 VAT->getBracketsRange());
6145 const auto *DSAT = cast<DependentSizedArrayType>(AT);
6147 DSAT->getSizeModifier(), 0,
6158 bool AllowPiMismatch) {
6173 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
6174 auto *CAT2 = dyn_cast<ConstantArrayType>(AT2);
6175 if (!((CAT2 && CAT1->getSize() == CAT2->getSize()) ||
6177 isa<IncompleteArrayType>(AT2))))
6179 }
else if (isa<IncompleteArrayType>(AT1)) {
6180 if (!(isa<IncompleteArrayType>(AT2) ||
6182 isa<ConstantArrayType>(AT2))))
6188 T1 = AT1->getElementType();
6189 T2 = AT2->getElementType();
6209 bool AllowPiMismatch) {
6214 if (T1PtrType && T2PtrType) {
6222 if (T1MPType && T2MPType &&
6233 if (T1OPType && T2OPType) {
6265 if (Quals1 != Quals2)
6279 switch (Name.getKind()) {
6314 = Name.getAsSubstTemplateTemplateParm();
6321 = Name.getAsSubstTemplateTemplateParmPack();
6330 llvm_unreachable(
"bad template name kind!");
6335 switch (Name.getKind()) {
6340 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
6341 Template = getCanonicalTemplateTemplateParmDecl(TTP);
6349 llvm_unreachable(
"cannot canonicalize unresolved template");
6353 assert(DTN &&
"Non-dependent template names must refer to template decls.");
6354 return DTN->CanonicalTemplateName;
6359 = Name.getAsSubstTemplateTemplateParm();
6365 Name.getAsSubstTemplateTemplateParmPack();
6374 llvm_unreachable(
"bad template name!");
6390 llvm::FoldingSetNodeID XCEID, YCEID;
6391 XCE->
Profile(XCEID, *
this,
true,
true);
6392 YCE->
Profile(YCEID, *
this,
true,
true);
6393 return XCEID == YCEID;
6442 if (
auto *TX = dyn_cast<TemplateTypeParmDecl>(
X)) {
6443 auto *TY = cast<TemplateTypeParmDecl>(Y);
6444 if (TX->isParameterPack() != TY->isParameterPack())
6446 if (TX->hasTypeConstraint() != TY->hasTypeConstraint())
6449 TY->getTypeConstraint());
6452 if (
auto *TX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
6453 auto *TY = cast<NonTypeTemplateParmDecl>(Y);
6454 return TX->isParameterPack() == TY->isParameterPack() &&
6455 TX->getASTContext().hasSameType(TX->getType(), TY->getType()) &&
6457 TY->getPlaceholderTypeConstraint());
6460 auto *TX = cast<TemplateTemplateParmDecl>(
X);
6461 auto *TY = cast<TemplateTemplateParmDecl>(Y);
6462 return TX->isParameterPack() == TY->isParameterPack() &&
6464 TY->getTemplateParameters());
6469 if (
X->size() != Y->
size())
6472 for (
unsigned I = 0, N =
X->size(); I != N; ++I)
6486 if (
auto *TTPX = dyn_cast<TemplateTypeParmDecl>(
X)) {
6487 auto *TTPY = cast<TemplateTypeParmDecl>(Y);
6488 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
6491 return hasSameType(TTPX->getDefaultArgument(), TTPY->getDefaultArgument());
6494 if (
auto *NTTPX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
6495 auto *NTTPY = cast<NonTypeTemplateParmDecl>(Y);
6496 if (!NTTPX->hasDefaultArgument() || !NTTPY->hasDefaultArgument())
6501 llvm::FoldingSetNodeID XID, YID;
6502 DefaultArgumentX->
Profile(XID, *
this,
true);
6503 DefaultArgumentY->
Profile(YID, *
this,
true);
6507 auto *TTPX = cast<TemplateTemplateParmDecl>(
X);
6508 auto *TTPY = cast<TemplateTemplateParmDecl>(Y);
6510 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
6519 if (
auto *NS =
X->getAsNamespace())
6521 if (
auto *NAS =
X->getAsNamespaceAlias())
6522 return NAS->getNamespace();
6530 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
6532 }
else if (
X->getKind() != Y->
getKind())
6537 switch (
X->getKind()) {
6548 if (
X->getAsType()->getCanonicalTypeInternal() !=
6558 auto *PX =
X->getPrefix();
6572 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
6576 for (
auto Pair : zip_longest(AEnableIfAttrs, BEnableIfAttrs)) {
6577 std::optional<EnableIfAttr *> Cand1A = std::get<0>(Pair);
6578 std::optional<EnableIfAttr *> Cand2A = std::get<1>(Pair);
6581 if (!Cand1A || !Cand2A)
6587 (*Cand1A)->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
6588 (*Cand2A)->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
6592 if (Cand1ID != Cand2ID)
6620 if (
const auto *TypedefX = dyn_cast<TypedefNameDecl>(
X))
6621 if (
const auto *TypedefY = dyn_cast<TypedefNameDecl>(Y))
6623 TypedefY->getUnderlyingType());
6630 if (isa<ObjCInterfaceDecl>(
X) || isa<ObjCProtocolDecl>(
X))
6633 if (isa<ClassTemplateSpecializationDecl>(
X)) {
6640 if (
const auto *TagX = dyn_cast<TagDecl>(
X)) {
6641 const auto *TagY = cast<TagDecl>(Y);
6642 return (TagX->getTagKind() == TagY->getTagKind()) ||
6654 if (
const auto *FuncX = dyn_cast<FunctionDecl>(
X)) {
6655 const auto *FuncY = cast<FunctionDecl>(Y);
6656 if (
const auto *CtorX = dyn_cast<CXXConstructorDecl>(
X)) {
6657 const auto *CtorY = cast<CXXConstructorDecl>(Y);
6658 if (CtorX->getInheritedConstructor() &&
6659 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
6660 CtorY->getInheritedConstructor().getConstructor()))
6664 if (FuncX->isMultiVersion() != FuncY->isMultiVersion())
6669 if (FuncX->isMultiVersion()) {
6670 const auto *TAX = FuncX->getAttr<TargetAttr>();
6671 const auto *TAY = FuncY->getAttr<TargetAttr>();
6672 assert(TAX && TAY &&
"Multiversion Function without target attribute");
6674 if (TAX->getFeaturesStr() != TAY->getFeaturesStr())
6680 if ((FuncX->isMemberLikeConstrainedFriend() ||
6681 FuncY->isMemberLikeConstrainedFriend()) &&
6682 !FuncX->getLexicalDeclContext()->Equals(
6683 FuncY->getLexicalDeclContext())) {
6688 FuncY->getTrailingRequiresClause()))
6696 FD = FD->getCanonicalDecl();
6697 return FD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType()
6700 QualType XT = GetTypeAsWritten(FuncX), YT = GetTypeAsWritten(FuncY);
6715 return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() &&
6720 if (
const auto *VarX = dyn_cast<VarDecl>(
X)) {
6721 const auto *VarY = cast<VarDecl>(Y);
6722 if (VarX->getLinkageInternal() == VarY->getLinkageInternal()) {
6725 if (VarX->getType().isNull() || VarY->getType().isNull())
6728 if (
hasSameType(VarX->getType(), VarY->getType()))
6738 if (!VarXTy || !VarYTy)
6747 if (
const auto *NamespaceX = dyn_cast<NamespaceDecl>(
X)) {
6748 const auto *NamespaceY = cast<NamespaceDecl>(Y);
6749 return NamespaceX->isInline() == NamespaceY->isInline();
6754 if (
const auto *TemplateX = dyn_cast<TemplateDecl>(
X)) {
6755 const auto *TemplateY = cast<TemplateDecl>(Y);
6758 if (
const auto *ConceptX = dyn_cast<ConceptDecl>(
X)) {
6759 const auto *ConceptY = cast<ConceptDecl>(Y);
6761 ConceptY->getConstraintExpr()))
6766 TemplateY->getTemplatedDecl()) &&
6768 TemplateY->getTemplateParameters());
6772 if (
const auto *FDX = dyn_cast<FieldDecl>(
X)) {
6773 const auto *FDY = cast<FieldDecl>(Y);
6775 return hasSameType(FDX->getType(), FDY->getType());
6779 if (
const auto *IFDX = dyn_cast<IndirectFieldDecl>(
X)) {
6780 const auto *IFDY = cast<IndirectFieldDecl>(Y);
6781 return IFDX->getAnonField()->getCanonicalDecl() ==
6782 IFDY->getAnonField()->getCanonicalDecl();
6786 if (isa<EnumConstantDecl>(
X))
6791 if (
const auto *USX = dyn_cast<UsingShadowDecl>(
X)) {
6792 const auto *USY = cast<UsingShadowDecl>(Y);
6793 return USX->getTargetDecl() == USY->getTargetDecl();
6798 if (
const auto *UX = dyn_cast<UsingDecl>(
X)) {
6799 const auto *UY = cast<UsingDecl>(Y);
6801 UX->hasTypename() == UY->hasTypename() &&
6802 UX->isAccessDeclaration() == UY->isAccessDeclaration();
6804 if (
const auto *UX = dyn_cast<UnresolvedUsingValueDecl>(
X)) {
6805 const auto *UY = cast<UnresolvedUsingValueDecl>(Y);
6807 UX->isAccessDeclaration() == UY->isAccessDeclaration();
6809 if (
const auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(
X)) {
6812 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
6817 if (
const auto *UX = dyn_cast<UsingPackDecl>(
X)) {
6819 UX->getInstantiatedFromUsingDecl(),
6820 cast<UsingPackDecl>(Y)->getInstantiatedFromUsingDecl());
6824 if (
const auto *NAX = dyn_cast<NamespaceAliasDecl>(
X)) {
6825 const auto *NAY = cast<NamespaceAliasDecl>(Y);
6826 return NAX->getNamespace()->Equals(NAY->getNamespace());
6873 bool AnyNonCanonArgs =
false;
6876 if (!AnyNonCanonArgs)
6884 llvm_unreachable(
"Unhandled template argument kind");
6927 DNT->getIdentifier());
6941 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
6946 if (!
T.hasLocalQualifiers()) {
6948 if (
const auto *AT = dyn_cast<ArrayType>(
T))
6953 if (!isa<ArrayType>(
T.getCanonicalType()))
6968 const auto *ATy = dyn_cast<ArrayType>(split.
Ty);
6969 if (!ATy || qs.
empty())
6976 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
6979 CAT->getSizeModifier(),
6980 CAT->getIndexTypeCVRQualifiers()));
6981 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
6983 IAT->getSizeModifier(),
6984 IAT->getIndexTypeCVRQualifiers()));
6986 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
6987 return cast<ArrayType>(
6989 DSAT->getSizeExpr(),
6990 DSAT->getSizeModifier(),
6991 DSAT->getIndexTypeCVRQualifiers(),
6992 DSAT->getBracketsRange()));
6994 const auto *VAT = cast<VariableArrayType>(ATy);
6997 VAT->getSizeModifier(),
6998 VAT->getIndexTypeCVRQualifiers(),
6999 VAT->getBracketsRange()));
7013 return T.getUnqualifiedType();
7026 return T.getUnqualifiedType();
7041 assert(PrettyArrayType &&
"Not an array type!");
7078 uint64_t ElementCount = 1;
7081 CA = dyn_cast_or_null<ConstantArrayType>(
7084 return ElementCount;
7092 uint64_t ElementCount = 1;
7096 AILE = dyn_cast<ArrayInitLoopExpr>(AILE->
getSubExpr());
7099 return ElementCount;
7109 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
7111 case BuiltinType::Half:
return HalfRank;
7112 case BuiltinType::Float:
return FloatRank;
7145unsigned ASTContext::getIntegerRank(
const Type *
T)
const {
7150 if (
const auto *EIT = dyn_cast<BitIntType>(
T))
7151 return 0 + (EIT->getNumBits() << 3);
7153 switch (cast<BuiltinType>(
T)->getKind()) {
7154 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
7155 case BuiltinType::Bool:
7157 case BuiltinType::Char_S:
7158 case BuiltinType::Char_U:
7159 case BuiltinType::SChar:
7160 case BuiltinType::UChar:
7162 case BuiltinType::Short:
7163 case BuiltinType::UShort:
7165 case BuiltinType::Int:
7166 case BuiltinType::UInt:
7168 case BuiltinType::Long:
7169 case BuiltinType::ULong:
7171 case BuiltinType::LongLong:
7172 case BuiltinType::ULongLong:
7174 case BuiltinType::Int128:
7175 case BuiltinType::UInt128:
7180 case BuiltinType::Char8:
7182 case BuiltinType::Char16:
7183 return getIntegerRank(
7185 case BuiltinType::Char32:
7186 return getIntegerRank(
7188 case BuiltinType::WChar_S:
7189 case BuiltinType::WChar_U:
7190 return getIntegerRank(
7220 uint64_t BitWidth = Field->getBitWidthValue(*
this);
7243 if (
QualType QT = Field->getType(); QT->isBitIntType())
7246 if (BitWidth < IntSize)
7249 if (BitWidth == IntSize)
7264 assert(!Promotable.
isNull());
7267 return ET->getDecl()->getPromotionType();
7276 if (BT->getKind() == BuiltinType::WChar_S ||
7277 BT->getKind() == BuiltinType::WChar_U ||
7278 BT->getKind() == BuiltinType::Char8 ||
7279 BT->getKind() == BuiltinType::Char16 ||
7280 BT->getKind() == BuiltinType::Char32) {
7281 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
7285 for (
const auto &PT : PromoteTypes) {
7287 if (FromSize < ToSize ||
7288 (FromSize == ToSize && FromIsSigned == PT->isSignedIntegerType()))
7291 llvm_unreachable(
"char type should fit into long long");
7298 uint64_t PromotableSize =
getIntWidth(Promotable);
7307 while (!
T.isNull()) {
7309 return T.getObjCLifetime();
7339 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
7341 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
7344 if (LHSC == RHSC)
return 0;
7349 unsigned LHSRank = getIntegerRank(LHSC);
7350 unsigned RHSRank = getIntegerRank(RHSC);
7352 if (LHSUnsigned == RHSUnsigned) {
7353 if (LHSRank == RHSRank)
return 0;
7354 return LHSRank > RHSRank ? 1 : -1;
7360 if (LHSRank >= RHSRank)
7370 if (RHSRank >= LHSRank)
7380 if (CFConstantStringTypeDecl)
7381 return CFConstantStringTypeDecl;
7383 assert(!CFConstantStringTagDecl &&
7384 "tag and typedef should be initialized together");
7424 if (
static_cast<unsigned>(CFRuntime) <
7427 Fields[Count++] = {
IntTy,
"flags" };
7429 Fields[Count++] = {
LongTy,
"length" };
7433 Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc" };
7437 Fields[Count++] = {
IntTy,
"_ptr" };
7443 for (
unsigned i = 0; i < Count; ++i) {
7447 Fields[i].Type,
nullptr,
7450 CFConstantStringTagDecl->
addDecl(Field);
7457 CFConstantStringTypeDecl =
7460 return CFConstantStringTypeDecl;
7464 if (!CFConstantStringTagDecl)
7466 return CFConstantStringTagDecl;
7475 if (ObjCSuperType.
isNull()) {
7480 return ObjCSuperType;
7485 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
7492 if (BlockDescriptorType)
7505 static const char *
const FieldNames[] = {
7510 for (
size_t i = 0; i < 2; ++i) {
7513 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
7521 BlockDescriptorType = RD;
7527 if (BlockDescriptorExtendedType)
7542 static const char *
const FieldNames[] = {
7549 for (
size_t i = 0; i < 4; ++i) {
7552 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
7561 BlockDescriptorExtendedType = RD;
7566 const auto *BT = dyn_cast<BuiltinType>(
T);
7569 if (isa<PipeType>(
T))
7575 switch (BT->getKind()) {
7576#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7577 case BuiltinType::Id: \
7579#include "clang/Basic/OpenCLImageTypes.def"
7581 case BuiltinType::OCLClkEvent:
7584 case BuiltinType::OCLEvent:
7587 case BuiltinType::OCLQueue:
7590 case BuiltinType::OCLReserveID:
7593 case BuiltinType::OCLSampler:
7612 if (!copyExpr && record->hasTrivialDestructor())
return false;
7640 llvm_unreachable(
"impossible");
7642 llvm_unreachable(
"fell out of lifetime switch!");
7650 bool &HasByrefExtendedLayout)
const {
7655 HasByrefExtendedLayout =
false;
7657 HasByrefExtendedLayout =
true;
7671 assert(
Target &&
"Expected target to be initialized");
7672 const llvm::Triple &
T =
Target->getTriple();
7674 if (
T.isOSWindows() &&
T.isArch64Bit())
7680 assert(
Target &&
"Expected target to be initialized");
7681 const llvm::Triple &
T =
Target->getTriple();
7683 if (
T.isOSWindows() &&
T.isArch64Bit())
7689 if (!ObjCInstanceTypeDecl)
7690 ObjCInstanceTypeDecl =
7692 return ObjCInstanceTypeDecl;
7698 if (
const auto *TT = dyn_cast<TypedefType>(
T))
7700 return II->isStr(
"BOOL");
7708 if (!
type->isIncompleteArrayType() &&
type->isIncompleteType())
7717 else if (
type->isArrayType())
7736 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
7742 if (D->getLexicalDeclContext()->isFileContext() &&
7743 !D->isInlineSpecified() && (D->isConstexpr() ||
First->isConstexpr()))
7774 for (
auto *PI :
Decl->parameters()) {
7779 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
7788 ParmOffset = PtrSize;
7789 for (
auto *PVDecl :
Decl->parameters()) {
7790 QualType PType = PVDecl->getOriginalType();
7791 if (
const auto *AT =
7795 if (!isa<ConstantArrayType>(AT))
7796 PType = PVDecl->getType();
7798 PType = PVDecl->getType();
7818 for (
auto *PI :
Decl->parameters()) {
7825 "getObjCEncodingForFunctionDecl - Incomplete param type");
7832 for (
auto *PVDecl :
Decl->parameters()) {
7833 QualType PType = PVDecl->getOriginalType();
7834 if (
const auto *AT =
7838 if (!isa<ConstantArrayType>(AT))
7839 PType = PVDecl->getType();
7841 PType = PVDecl->getType();
7855 bool Extended)
const {
7859 ObjCEncOptions Options = ObjCEncOptions()
7860 .setExpandPointedToStructures()
7861 .setExpandStructures()
7862 .setIsOutermostType();
7864 Options.setEncodeBlockParameters().setEncodeClassNames();
7865 getObjCEncodingForTypeImpl(
T, S, Options,
nullptr);
7871 bool Extended)
const {
7876 Decl->getReturnType(), S, Extended);
7885 E =
Decl->sel_param_end(); PI != E; ++PI) {
7892 "getObjCEncodingForMethodDecl - Incomplete param type");
7900 ParmOffset = 2 * PtrSize;
7902 E =
Decl->sel_param_end(); PI != E; ++PI) {
7905 if (
const auto *AT =
7909 if (!isa<ConstantArrayType>(AT))
7914 PType, S, Extended);
7925 const Decl *Container)
const {
7928 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
7929 for (
auto *PID : CID->property_impls())
7930 if (PID->getPropertyDecl() == PD)
7933 const auto *OID = cast<ObjCImplementationDecl>(Container);
7934 for (
auto *PID : OID->property_impls())
7935 if (PID->getPropertyDecl() == PD)
7969 const Decl *Container)
const {
7971 bool Dynamic =
false;
7979 SynthesizePID = PropertyImpDecl;
7983 std::string S =
"T";
8028 if (SynthesizePID) {
8045 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
8048 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
8061 getObjCEncodingForTypeImpl(
T, S,
8063 .setExpandPointedToStructures()
8064 .setExpandStructures()
8065 .setIsOutermostType(),
8066 Field, NotEncodedT);
8070 std::string& S)
const {
8074 getObjCEncodingForTypeImpl(
T, S,
8076 .setExpandPointedToStructures()
8077 .setExpandStructures()
8078 .setIsOutermostType()
8079 .setEncodingProperty(),
8087 case BuiltinType::Void:
return 'v';
8088 case BuiltinType::Bool:
return 'B';
8089 case BuiltinType::Char8:
8090 case BuiltinType::Char_U:
8091 case BuiltinType::UChar:
return 'C';
8092 case BuiltinType::Char16:
8093 case BuiltinType::UShort:
return 'S';
8094 case BuiltinType::Char32:
8095 case BuiltinType::UInt:
return 'I';
8096 case BuiltinType::ULong:
8097 return C->getTargetInfo().getLongWidth() == 32 ?
'L' :
'Q';
8098 case BuiltinType::UInt128:
return 'T';
8099 case BuiltinType::ULongLong:
return 'Q';
8100 case BuiltinType::Char_S:
8101 case BuiltinType::SChar:
return 'c';
8102 case BuiltinType::Short:
return 's';
8103 case BuiltinType::WChar_S:
8104 case BuiltinType::WChar_U:
8105 case BuiltinType::Int:
return 'i';
8106 case BuiltinType::Long:
8107 return C->getTargetInfo().getLongWidth() == 32 ?
'l' :
'q';
8108 case BuiltinType::LongLong:
return 'q';
8109 case BuiltinType::Int128:
return 't';
8110 case BuiltinType::Float:
return 'f';
8111 case BuiltinType::Double:
return 'd';
8112 case BuiltinType::LongDouble:
return 'D';
8113 case BuiltinType::NullPtr:
return '*';
8115 case BuiltinType::BFloat16:
8116 case BuiltinType::Float16:
8117 case BuiltinType::Float128:
8118 case BuiltinType::Ibm128:
8119 case BuiltinType::Half:
8120 case BuiltinType::ShortAccum:
8121 case BuiltinType::Accum:
8122 case BuiltinType::LongAccum:
8123 case BuiltinType::UShortAccum:
8124 case BuiltinType::UAccum:
8125 case BuiltinType::ULongAccum:
8126 case BuiltinType::ShortFract:
8127 case BuiltinType::Fract:
8128 case BuiltinType::LongFract:
8129 case BuiltinType::UShortFract:
8130 case BuiltinType::UFract:
8131 case BuiltinType::ULongFract:
8132 case BuiltinType::SatShortAccum:
8133 case BuiltinType::SatAccum:
8134 case BuiltinType::SatLongAccum:
8135 case BuiltinType::SatUShortAccum:
8136 case BuiltinType::SatUAccum:
8137 case BuiltinType::SatULongAccum:
8138 case BuiltinType::SatShortFract:
8139 case BuiltinType::SatFract:
8140 case BuiltinType::SatLongFract:
8141 case BuiltinType::SatUShortFract:
8142 case BuiltinType::SatUFract:
8143 case BuiltinType::SatULongFract:
8147#define SVE_TYPE(Name, Id, SingletonId) \
8148 case BuiltinType::Id:
8149#include "clang/Basic/AArch64SVEACLETypes.def"
8150#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8151#include "clang/Basic/RISCVVTypes.def"
8152#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8153#include "clang/Basic/WebAssemblyReferenceTypes.def"
8157 "cannot yet @encode type %0");
8162 case BuiltinType::ObjCId:
8163 case BuiltinType::ObjCClass:
8164 case BuiltinType::ObjCSel:
8165 llvm_unreachable(
"@encoding ObjC primitive type");
8168#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8169 case BuiltinType::Id:
8170#include "clang/Basic/OpenCLImageTypes.def"
8171#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8172 case BuiltinType::Id:
8173#include "clang/Basic/OpenCLExtensionTypes.def"
8174 case BuiltinType::OCLEvent:
8175 case BuiltinType::OCLClkEvent:
8176 case BuiltinType::OCLQueue:
8177 case BuiltinType::OCLReserveID:
8178 case BuiltinType::OCLSampler:
8179 case BuiltinType::Dependent:
8180#define PPC_VECTOR_TYPE(Name, Id, Size) \
8181 case BuiltinType::Id:
8182#include "clang/Basic/PPCTypes.def"
8183#define BUILTIN_TYPE(KIND, ID)
8184#define PLACEHOLDER_TYPE(KIND, ID) \
8185 case BuiltinType::KIND:
8186#include "clang/AST/BuiltinTypes.def"
8187 llvm_unreachable(
"invalid builtin type for @encode");
8189 llvm_unreachable(
"invalid BuiltinType::Kind value");
8196 if (!
Enum->isFixed())
8206 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
8226 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
8235 S += llvm::utostr(Offset);
8250 bool VisitBasesAndFields) {
8255 PT->getPointeeType().getTypePtr(),
false);
8262 if (isa<ClassTemplateSpecializationDecl>(CXXRD))
8265 if (!CXXRD->hasDefinition() || !VisitBasesAndFields)
8268 for (
const auto &B : CXXRD->bases())
8273 for (
auto *FD : CXXRD->fields())
8282void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string &S,
8283 const ObjCEncOptions Options,
8287 switch (CT->getTypeClass()) {
8292 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
8314 case Type::LValueReference:
8315 case Type::RValueReference: {
8317 if (isa<PointerType>(CT)) {
8319 if (PT->isObjCSelType()) {
8328 bool isReadOnly =
false;
8334 if (Options.IsOutermostType() &&
T.isConstQualified()) {
8338 }
else if (Options.IsOutermostType()) {
8341 P = PT->getPointeeType();
8342 if (
P.isConstQualified()) {
8351 if (StringRef(S).ends_with(
"nr"))
8352 S.replace(S.end()-2, S.end(),
"rn");
8364 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
8369 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
8378 RTy, Options.ExpandPointedToStructures()))) {
8387 ObjCEncOptions NewOptions;
8388 if (Options.ExpandPointedToStructures())
8389 NewOptions.setExpandStructures();
8390 getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
8391 nullptr, NotEncodedT);
8395 case Type::ConstantArray:
8396 case Type::IncompleteArray:
8397 case Type::VariableArray: {
8398 const auto *AT = cast<ArrayType>(CT);
8400 if (isa<IncompleteArrayType>(AT) && !Options.IsStructField()) {
8404 getObjCEncodingForTypeImpl(
8405 AT->getElementType(), S,
8406 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
8410 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
8411 S += llvm::utostr(CAT->getZExtSize());
8414 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
8415 "Unknown array type!");
8419 getObjCEncodingForTypeImpl(
8420 AT->getElementType(), S,
8421 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
8428 case Type::FunctionNoProto:
8429 case Type::FunctionProto:
8433 case Type::Record: {
8434 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
8435 S += RDecl->
isUnion() ?
'(' :
'{';
8439 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
8441 llvm::raw_string_ostream OS(S);
8448 if (Options.ExpandStructures()) {
8451 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
8453 for (
const auto *Field : RDecl->
fields()) {
8456 S +=
Field->getNameAsString();
8461 if (
Field->isBitField()) {
8462 getObjCEncodingForTypeImpl(
Field->getType(), S,
8463 ObjCEncOptions().setExpandStructures(),
8468 getObjCEncodingForTypeImpl(
8470 ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
8476 S += RDecl->
isUnion() ?
')' :
'}';
8480 case Type::BlockPointer: {
8483 if (Options.EncodeBlockParameters()) {
8484 const auto *FT = BT->getPointeeType()->castAs<
FunctionType>();
8488 getObjCEncodingForTypeImpl(FT->getReturnType(), S,
8489 Options.forComponentType(), FD, NotEncodedT);
8493 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
8494 for (
const auto &I : FPT->param_types())
8495 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
8503 case Type::ObjCObject: {
8507 S +=
"{objc_object=}";
8511 S +=
"{objc_class=}";
8518 case Type::ObjCInterface: {
8524 if (Options.ExpandStructures()) {
8528 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
8530 if (
Field->isBitField())
8531 getObjCEncodingForTypeImpl(
Field->getType(), S,
8532 ObjCEncOptions().setExpandStructures(),
8535 getObjCEncodingForTypeImpl(
Field->getType(), S,
8536 ObjCEncOptions().setExpandStructures(), FD,
8544 case Type::ObjCObjectPointer: {
8546 if (OPT->isObjCIdType()) {
8551 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
8559 if (OPT->isObjCQualifiedIdType()) {
8560 getObjCEncodingForTypeImpl(
8562 Options.keepingOnly(ObjCEncOptions()
8563 .setExpandPointedToStructures()
8564 .setExpandStructures()),
8566 if (FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
8570 for (
const auto *I : OPT->quals()) {
8572 S += I->getObjCRuntimeNameAsString();
8581 if (OPT->getInterfaceDecl() &&
8582 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
8584 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
8585 for (
const auto *I : OPT->quals()) {
8587 S += I->getObjCRuntimeNameAsString();
8597 case Type::MemberPointer:
8601 case Type::ExtVector:
8607 case Type::ConstantMatrix:
8620 case Type::DeducedTemplateSpecialization:
8623 case Type::ArrayParameter:
8625#define ABSTRACT_TYPE(KIND, BASE)
8626#define TYPE(KIND, BASE)
8627#define DEPENDENT_TYPE(KIND, BASE) \
8629#define NON_CANONICAL_TYPE(KIND, BASE) \
8631#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \
8633#include "clang/AST/TypeNodes.inc"
8634 llvm_unreachable(
"@encode for dependent type!");
8636 llvm_unreachable(
"bad type kind!");
8639void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
8644 assert(RDecl &&
"Expected non-null RecordDecl");
8645 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
8649 const auto *CXXRec = dyn_cast<CXXRecordDecl>(RDecl);
8650 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
8654 for (
const auto &BI : CXXRec->bases()) {
8655 if (!BI.isVirtual()) {
8660 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8661 std::make_pair(offs, base));
8667 if (!
Field->isZeroLengthBitField(*
this) &&
Field->isZeroSize(*
this))
8670 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8671 std::make_pair(offs, Field));
8674 if (CXXRec && includeVBases) {
8675 for (
const auto &BI : CXXRec->vbases()) {
8681 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
8682 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
8683 std::make_pair(offs, base));
8697 std::multimap<uint64_t, NamedDecl *>::iterator
8698 CurLayObj = FieldOrBaseOffsets.begin();
8700 if (CXXRec && CXXRec->isDynamicClass() &&
8701 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
8704 std::string recname = CXXRec->getNameAsString();
8705 if (recname.empty()) recname =
"?";
8718 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8719 std::make_pair(offs,
nullptr));
8722 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
8724 assert(CurOffs <= CurLayObj->first);
8725 if (CurOffs < CurLayObj->first) {
8726 uint64_t padding = CurLayObj->first - CurOffs;
8742 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
8747 getObjCEncodingForStructureImpl(base, S, FD,
false,
8754 const auto *field = cast<FieldDecl>(dcl);
8757 S += field->getNameAsString();
8761 if (field->isBitField()) {
8764 CurOffs += field->getBitWidthValue(*
this);
8769 getObjCEncodingForTypeImpl(
8770 qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
8781 std::string& S)
const {
8814 if (!ObjCClassDecl) {
8819 return ObjCClassDecl;
8823 if (!ObjCProtocolClassDecl) {
8824 ObjCProtocolClassDecl
8833 return ObjCProtocolClassDecl;
8878 const size_t NumFields = 5;
8880 const char *FieldNames[NumFields];
8884 FieldNames[0] =
"__stack";
8888 FieldNames[1] =
"__gr_top";
8892 FieldNames[2] =
"__vr_top";
8895 FieldTypes[3] = Context->
IntTy;
8896 FieldNames[3] =
"__gr_offs";
8899 FieldTypes[4] = Context->
IntTy;
8900 FieldNames[4] =
"__vr_offs";
8903 for (
unsigned i = 0; i < NumFields; ++i) {
8909 FieldTypes[i],
nullptr,
8914 VaListTagDecl->
addDecl(Field);
8931 const size_t NumFields = 5;
8933 const char *FieldNames[NumFields];
8937 FieldNames[0] =
"gpr";
8941 FieldNames[1] =
"fpr";
8945 FieldNames[2] =
"reserved";
8949 FieldNames[3] =
"overflow_arg_area";
8953 FieldNames[4] =
"reg_save_area";
8956 for (
unsigned i = 0; i < NumFields; ++i) {
8961 FieldTypes[i],
nullptr,
8966 VaListTagDecl->
addDecl(Field);
8993 const size_t NumFields = 4;
8995 const char *FieldNames[NumFields];
8999 FieldNames[0] =
"gp_offset";
9003 FieldNames[1] =
"fp_offset";
9007 FieldNames[2] =
"overflow_arg_area";
9011 FieldNames[3] =
"reg_save_area";
9014 for (
unsigned i = 0; i < NumFields; ++i) {
9020 FieldTypes[i],
nullptr,
9025 VaListTagDecl->
addDecl(Field);
9096 const size_t NumFields = 4;
9098 const char *FieldNames[NumFields];
9101 FieldTypes[0] = Context->
LongTy;
9102 FieldNames[0] =
"__gpr";
9105 FieldTypes[1] = Context->
LongTy;
9106 FieldNames[1] =
"__fpr";
9110 FieldNames[2] =
"__overflow_arg_area";
9114 FieldNames[3] =
"__reg_save_area";
9117 for (
unsigned i = 0; i < NumFields; ++i) {
9123 FieldTypes[i],
nullptr,
9128 VaListTagDecl->
addDecl(Field);
9150 const size_t NumFields = 3;
9152 const char *FieldNames[NumFields];
9156 FieldNames[0] =
"__current_saved_reg_area_pointer";
9160 FieldNames[1] =
"__saved_reg_area_end_pointer";
9164 FieldNames[2] =
"__overflow_area_pointer";
9167 for (
unsigned i = 0; i < NumFields; ++i) {
9175 VaListTagDecl->
addDecl(Field);
9218 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
9222 if (!BuiltinVaListDecl) {
9227 return BuiltinVaListDecl;
9240 if (!BuiltinMSVaListDecl)
9243 return BuiltinMSVaListDecl;
9255 assert(ObjCConstantStringType.
isNull() &&
9256 "'NSConstantString' type already set!");
9266 unsigned size = End -
Begin;
9267 assert(size > 1 &&
"set is not overloaded!");
9276 assert(isa<FunctionTemplateDecl>(D) ||
9277 isa<UnresolvedUsingValueDecl>(D) ||
9278 (isa<UsingShadowDecl>(D) &&
9296 bool TemplateKeyword,
9298 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
9301 llvm::FoldingSetNodeID ID;
9304 void *InsertPos =
nullptr;
9306 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9310 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
9322 "Nested name specifier must be dependent");
9324 llvm::FoldingSetNodeID ID;
9327 void *InsertPos =
nullptr;
9329 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9335 if (CanonNNS == NNS) {
9343 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9344 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
9348 DependentTemplateNames.InsertNode(QTN, InsertPos);
9358 "Nested name specifier must be dependent");
9360 llvm::FoldingSetNodeID ID;
9363 void *InsertPos =
nullptr;
9365 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9371 if (CanonNNS == NNS) {
9380 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9381 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
9385 DependentTemplateNames.InsertNode(QTN, InsertPos);
9391 std::optional<unsigned> PackIndex)
const {
9392 llvm::FoldingSetNodeID ID;
9396 void *insertPos =
nullptr;
9398 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
9402 Replacement, AssociatedDecl, Index, PackIndex);
9403 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
9411 Decl *AssociatedDecl,
9412 unsigned Index,
bool Final)
const {
9414 llvm::FoldingSetNodeID ID;
9416 AssociatedDecl, Index, Final);
9418 void *InsertPos =
nullptr;
9420 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
9425 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
9449 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
9479 while (
const auto *AT = dyn_cast<ArrayType>(CT))
9480 CT = AT->getElementType();
9512 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
9513 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
9544 if (Ty->
getKind() == BuiltinType::SveBool ||
9545 Ty->
getKind() == BuiltinType::SveCount)
9558 return BT->getKind() == BuiltinType::SveBool;
9560 return VT->getElementType().getCanonicalType() ==
9571 return IsValidCast(FirstType, SecondType) ||
9572 IsValidCast(SecondType, FirstType);
9590 if (BT->getKind() == BuiltinType::SveBool &&
9611 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
9618 return IsLaxCompatible(FirstType, SecondType) ||
9619 IsLaxCompatible(SecondType, FirstType);
9635 uint64_t MinElts = Info.
EC.getKnownMinValue();
9636 return VScale->first * MinElts * EltSize;
9644 "Expected RVV builtin type and vector type!");
9666 return IsValidCast(FirstType, SecondType) ||
9667 IsValidCast(SecondType, FirstType);
9675 "Expected RVV builtin type and vector type!");
9682 if (!BT->isRVVVLSBuiltinType())
9702 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
9709 return IsLaxCompatible(FirstType, SecondType) ||
9710 IsLaxCompatible(SecondType, FirstType);
9717 if (
Attr->getAttrKind() == attr::ObjCOwnership)
9720 Ty =
Attr->getModifiedType();
9724 Ty =
Paren->getInnerType();
9756 for (
auto *lhsProto : lhs->
quals()) {
9758 for (
auto *rhsProto : rhs->
quals()) {
9789 for (
auto *I : lhs->
quals()) {
9793 if (!rhsID->ClassImplementsProtocol(I,
true))
9801 for (
auto *lhsProto : lhs->
quals()) {
9807 for (
auto *rhsProto : rhs->
quals()) {
9817 for (
auto *I : lhs->
quals()) {
9821 if (rhsID->ClassImplementsProtocol(I,
true)) {
9838 for (
auto *lhsProto : lhs->
quals()) {
9846 for (
auto *rhsProto : rhs->
quals()) {
9865 if (LHSInheritedProtocols.empty() && lhs->
qual_empty())
9867 for (
auto *lhsProto : LHSInheritedProtocols) {
9869 for (
auto *rhsProto : rhs->
quals()) {
9899 auto finish = [&](
bool succeeded) ->
bool {
9944 bool BlockReturnType) {
9948 auto finish = [&](
bool succeeded) ->
bool {
9973 if (
getLangOpts().CompatibilityQualifiedIdBlockParamTypeChecking)
9977 (!BlockReturnType &&
9981 (BlockReturnType ? LHSOPT : RHSOPT),
9982 (BlockReturnType ? RHSOPT : LHSOPT),
false));
9990 return finish(BlockReturnType);
9992 return finish(!BlockReturnType);
10004 return (*lhs)->getName().compare((*rhs)->getName());
10021 assert(LHS->
getInterface() &&
"LHS must have an interface base");
10022 assert(RHS->
getInterface() &&
"RHS must have an interface base");
10028 for (
auto *proto : LHS->
quals()) {
10039 for (
auto *proto : RHS->
quals()) {
10047 for (
auto *proto : LHSProtocolSet) {
10048 if (RHSProtocolSet.count(proto))
10049 IntersectionSet.push_back(proto);
10058 if (!ImpliedProtocols.empty()) {
10060 return ImpliedProtocols.contains(proto);
10065 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
10075 if (lhsOPT && rhsOPT)
10081 if (lhsBlock && rhsBlock)
10086 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
10098 bool stripKindOf) {
10099 if (lhsArgs.size() != rhsArgs.size())
10106 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
10112 if (!stripKindOf ||
10113 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
10114 rhsArgs[i].stripObjCKindOfType(ctx))) {
10142 if (!LDecl || !RDecl)
10152 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
10162 bool anyChanges =
false;
10180 if (!Protocols.empty())
10198 if (LHSSuperType.
isNull())
10208 if (KnownLHS != LHSAncestors.end()) {
10209 LHS = KnownLHS->second;
10213 bool anyChanges =
false;
10231 if (!Protocols.empty())
10248 if (RHSSuperType.
isNull())
10259 assert(LHS->
getInterface() &&
"LHS is not an interface type");
10260 assert(RHS->
getInterface() &&
"RHS is not an interface type");
10281 for (
auto *RHSPI : RHS->
quals())
10284 if (SuperClassInheritedProtocols.empty())
10287 for (
const auto *LHSProto : LHS->
quals()) {
10288 bool SuperImplementsProtocol =
false;
10289 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
10290 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
10291 SuperImplementsProtocol =
true;
10294 if (!SuperImplementsProtocol)
10324 if (!LHSOPT || !RHSOPT)
10342 bool CompareUnqualified) {
10361 bool OfBlockPointer,
10365 if (UD->
hasAttr<TransparentUnionAttr>()) {
10366 for (
const auto *I : UD->
fields()) {
10367 QualType ET = I->getType().getUnqualifiedType();
10381 bool OfBlockPointer,
10402 bool IsConditionalOperator) {
10405 const auto *lproto = dyn_cast<FunctionProtoType>(lbase);
10406 const auto *rproto = dyn_cast<FunctionProtoType>(rbase);
10407 bool allLTypes =
true;
10408 bool allRTypes =
true;
10412 if (OfBlockPointer) {
10414 QualType LHS = lbase->getReturnType();
10416 if (!UnqualifiedResult)
10418 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
10483 bool NoReturn = IsConditionalOperator
10493 if (lproto && rproto) {
10494 assert((AllowCXX ||
10495 (!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec())) &&
10496 "C++ shouldn't be here");
10498 if (lproto->getNumParams() != rproto->getNumParams())
10502 if (lproto->isVariadic() != rproto->isVariadic())
10505 if (lproto->getMethodQuals() != rproto->getMethodQuals())
10509 bool canUseLeft, canUseRight;
10521 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
10522 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
10523 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
10525 lParamType, rParamType, OfBlockPointer,
Unqualified);
10532 types.push_back(paramType);
10544 if (allLTypes)
return lhs;
10545 if (allRTypes)
return rhs;
10550 newParamInfos.empty() ? nullptr : newParamInfos.data();
10554 if (lproto) allRTypes =
false;
10555 if (rproto) allLTypes =
false;
10559 assert((AllowCXX || !proto->
hasExceptionSpec()) &&
"C++ shouldn't be here");
10567 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
10573 paramTy =
Enum->getDecl()->getIntegerType();
10583 if (allLTypes)
return lhs;
10584 if (allRTypes)
return rhs;
10591 if (allLTypes)
return lhs;
10592 if (allRTypes)
return rhs;
10598 QualType other,
bool isBlockReturnType) {
10604 if (underlyingType.
isNull())
10620 bool IsConditionalOperator) {
10631 if (LangOpts.OpenMP && LHSRefTy && RHSRefTy &&
10635 if (LHSRefTy || RHSRefTy)
10647 if (LHSCan == RHSCan)
10652 Qualifiers RQuals = RHSCan.getLocalQualifiers();
10653 if (LQuals != RQuals) {
10669 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
10690 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
10691 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
10694 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
10695 LHSClass = Type::ConstantArray;
10696 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
10697 RHSClass = Type::ConstantArray;
10700 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
10701 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
10704 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
10705 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
10708 if (LHSClass != RHSClass) {
10718 if (OfBlockPointer && !BlockReturnType) {
10727 if (!AT->isDeduced() && AT->isGNUAutoType())
10731 if (!AT->isDeduced() && AT->isGNUAutoType())
10738 switch (LHSClass) {
10739#define TYPE(Class, Base)
10740#define ABSTRACT_TYPE(Class, Base)
10741#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
10742#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
10743#define DEPENDENT_TYPE(Class, Base) case Type::Class:
10744#include "clang/AST/TypeNodes.inc"
10745 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
10748 case Type::DeducedTemplateSpecialization:
10749 case Type::LValueReference:
10750 case Type::RValueReference:
10751 case Type::MemberPointer:
10752 llvm_unreachable(
"C++ should never be in mergeTypes");
10754 case Type::ObjCInterface:
10755 case Type::IncompleteArray:
10756 case Type::VariableArray:
10757 case Type::FunctionProto:
10758 case Type::ExtVector:
10759 llvm_unreachable(
"Types are eliminated above");
10761 case Type::Pointer:
10772 if (ResultType.
isNull())
10780 case Type::BlockPointer:
10805 if (ResultType.
isNull())
10824 if (ResultType.
isNull())
10832 case Type::ConstantArray:
10847 if (ResultType.
isNull())
10855 if (LVAT || RVAT) {
10858 -> std::pair<bool,llvm::APInt> {
10860 std::optional<llvm::APSInt> TheInt;
10863 return std::make_pair(
true, *TheInt);
10864 return std::make_pair(
false, llvm::APSInt());
10867 return std::make_pair(
true, CAT->getSize());
10868 return std::make_pair(
false, llvm::APInt());
10871 bool HaveLSize, HaveRSize;
10872 llvm::APInt LSize, RSize;
10873 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
10874 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
10875 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
10909 case Type::FunctionNoProto:
10911 false, IsConditionalOperator);
10915 case Type::Builtin:
10918 case Type::Complex:
10927 case Type::ConstantMatrix:
10932 case Type::ObjCObject: {
10941 case Type::ObjCObjectPointer:
10942 if (OfBlockPointer) {
10954 assert(LHS != RHS &&
10955 "Equivalent pipe types should have already been handled!");
10957 case Type::ArrayParameter:
10958 assert(LHS != RHS &&
10959 "Equivalent ArrayParameter types should have already been handled!");
10961 case Type::BitInt: {
10969 if (LHSUnsigned != RHSUnsigned)
10972 if (LHSBits != RHSBits)
10978 llvm_unreachable(
"Invalid Type::Class!");
10983 bool &CanUseFirst,
bool &CanUseSecond,
10985 assert(NewParamInfos.empty() &&
"param info list not empty");
10986 CanUseFirst = CanUseSecond =
true;
10992 if (!FirstHasInfo && !SecondHasInfo)
10995 bool NeedParamInfo =
false;
10999 for (
size_t I = 0; I < E; ++I) {
11010 bool FirstNoEscape = FirstParam.
isNoEscape();
11011 bool SecondNoEscape = SecondParam.
isNoEscape();
11012 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
11014 if (NewParamInfos.back().getOpaqueValue())
11015 NeedParamInfo =
true;
11016 if (FirstNoEscape != IsNoEscape)
11017 CanUseFirst =
false;
11018 if (SecondNoEscape != IsNoEscape)
11019 CanUseSecond =
false;
11022 if (!NeedParamInfo)
11023 NewParamInfos.clear();
11029 ObjCLayouts[CD] =
nullptr;
11039 if (LHSCan == RHSCan)
11041 if (RHSCan->isFunctionType()) {
11045 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
11047 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
11050 if (ResReturnType.
isNull())
11052 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
11056 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
11069 Qualifiers RQuals = RHSCan.getLocalQualifiers();
11070 if (LQuals != RQuals) {
11083 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11099 if (ResQT == LHSBaseQT)
11101 if (ResQT == RHSBaseQT)
11113 T = ET->getDecl()->getIntegerType();
11117 return EIT->getNumBits();
11125 "Unexpected type");
11130 VTy->getNumElements(), VTy->getVectorKind());
11139 T = ETy->getDecl()->getIntegerType();
11142 case BuiltinType::Char_U:
11144 case BuiltinType::Char_S:
11145 case BuiltinType::SChar:
11146 case BuiltinType::Char8:
11148 case BuiltinType::Short:
11150 case BuiltinType::Int:
11152 case BuiltinType::Long:
11154 case BuiltinType::LongLong:
11156 case BuiltinType::Int128:
11161 case BuiltinType::WChar_S:
11164 case BuiltinType::ShortAccum:
11166 case BuiltinType::Accum:
11168 case BuiltinType::LongAccum:
11170 case BuiltinType::SatShortAccum:
11172 case BuiltinType::SatAccum:
11174 case BuiltinType::SatLongAccum:
11176 case BuiltinType::ShortFract:
11178 case BuiltinType::Fract:
11180 case BuiltinType::LongFract:
11182 case BuiltinType::SatShortFract:
11184 case BuiltinType::SatFract:
11186 case BuiltinType::SatLongFract:
11191 "Unexpected signed integer or fixed point type");
11199 "Unexpected type");
11204 VTy->getNumElements(), VTy->getVectorKind());
11213 T = ETy->getDecl()->getIntegerType();
11216 case BuiltinType::Char_S:
11218 case BuiltinType::Char_U:
11219 case BuiltinType::UChar:
11220 case BuiltinType::Char8:
11222 case BuiltinType::UShort:
11224 case BuiltinType::UInt:
11226 case BuiltinType::ULong:
11228 case BuiltinType::ULongLong:
11230 case BuiltinType::UInt128:
11235 case BuiltinType::WChar_U:
11238 case BuiltinType::UShortAccum:
11240 case BuiltinType::UAccum:
11242 case BuiltinType::ULongAccum:
11244 case BuiltinType::SatUShortAccum:
11246 case BuiltinType::SatUAccum:
11248 case BuiltinType::SatULongAccum:
11250 case BuiltinType::UShortFract:
11252 case BuiltinType::UFract:
11254 case BuiltinType::ULongFract:
11256 case BuiltinType::SatUShortFract:
11258 case BuiltinType::SatUFract:
11260 case BuiltinType::SatULongFract:
11265 "Unexpected signed integer or fixed point type");
11290 bool AllowTypeModifiers) {
11294 RequiresICE =
false;
11299 bool IsSpecial =
false;
11303 default: Done =
true; --Str;
break;
11305 RequiresICE =
true;
11308 assert(!
Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
11309 assert(!
Signed &&
"Can't use 'S' modifier multiple times!");
11313 assert(!
Signed &&
"Can't use both 'S' and 'U' modifiers!");
11314 assert(!
Unsigned &&
"Can't use 'U' modifier multiple times!");
11318 assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
11319 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
11324 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11325 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
11334 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11335 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
11341 llvm_unreachable(
"Unexpected integer type");
11352 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11353 assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
11359 llvm_unreachable(
"Unexpected integer type");
11372 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11373 assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
11389 default: llvm_unreachable(
"Unknown builtin type letter!");
11392 "Bad modifiers used with 'x'!");
11397 "Bad modifiers used with 'y'!");
11402 "Bad modifiers used with 'v'!");
11407 "Bad modifiers used with 'h'!");
11412 "Bad modifiers used with 'f'!");
11417 "Bad modifiers used with 'd'!");
11420 else if (HowLong == 2)
11426 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
11435 else if (HowLong == 2)
11437 else if (HowLong == 1)
11443 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
11452 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'b'!");
11456 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'z'!");
11460 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'w'!");
11477 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
11489 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
11497 unsigned NumElements = strtoul(Str, &End, 10);
11498 assert(End != Str &&
"Missing vector size");
11502 RequiresICE,
false);
11503 assert(!RequiresICE &&
"Can't require vector ICE");
11511 Type = Context.SveCountTy;
11515 llvm_unreachable(
"Unexpected target builtin type");
11521 unsigned NumElements = strtoul(Str, &End, 10);
11522 assert(End != Str &&
"Missing vector size");
11526 RequiresICE,
false);
11527 assert(!RequiresICE &&
"Can't require vector ICE");
11536 unsigned NumElements = strtoul(Str, &End, 10);
11537 assert(End != Str &&
"Missing vector size");
11549 assert(!RequiresICE &&
"Can't require complex ICE");
11558 if (
Type.isNull()) {
11569 if (
Type.isNull()) {
11575 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'K'!");
11578 if (
Type.isNull()) {
11589 Done = !AllowTypeModifiers;
11591 switch (
char c = *Str++) {
11592 default: Done =
true; --Str;
break;
11598 unsigned AddrSpace = strtoul(Str, &End, 10);
11626 "Integer constant 'I' type must be an integer");
11639 bool AllowTypeModifiers)
const {
11646 unsigned *IntegerConstantArgs)
const {
11648 if (TypeStr[0] ==
'\0') {
11655 bool RequiresICE =
false;
11658 RequiresICE,
true);
11662 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
11664 while (TypeStr[0] && TypeStr[0] !=
'.') {
11671 if (RequiresICE && IntegerConstantArgs)
11672 *IntegerConstantArgs |= 1 << ArgTypes.size();
11678 ArgTypes.push_back(Ty);
11681 if (
Id == Builtin::BI__GetExceptionInfo)
11684 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
11685 "'.' should only occur at end of builtin type list!");
11687 bool Variadic = (TypeStr[0] ==
'.');
11690 Variadic,
false,
true));
11695 if (ArgTypes.empty() && Variadic && !
getLangOpts().requiresStrictPrototypes())
11747 !FD->
hasAttr<DLLExportAttr>()) ||
11748 FD->
hasAttr<GNUInlineAttr>()) {
11767 isa<CXXConstructorDecl>(FD) &&
11768 cast<CXXConstructorDecl>(FD)->isInheritingConstructor())
11781 if (D->
hasAttr<DLLImportAttr>()) {
11784 }
else if (D->
hasAttr<DLLExportAttr>()) {
11790 if (D->
hasAttr<CUDAGlobalAttr>() &&
11853 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
11858 if (!LexicalContext)
11863 auto StaticLocalLinkage =
11875 return StaticLocalLinkage;
11902 return StrongLinkage;
11920 llvm_unreachable(
"Invalid Linkage!");
11930 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
11931 if (!VD->isFileVarDecl())
11936 if (VD->getDescribedVarTemplate() ||
11937 isa<VarTemplatePartialSpecializationDecl>(VD))
11939 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
11943 }
else if (isa<PragmaCommentDecl>(D))
11945 else if (isa<PragmaDetectMismatchDecl>(D))
11947 else if (isa<OMPRequiresDecl>(D))
11949 else if (isa<OMPThreadPrivateDecl>(D))
11951 else if (isa<OMPAllocateDecl>(D))
11953 else if (isa<OMPDeclareReductionDecl>(D) || isa<OMPDeclareMapperDecl>(D))
11955 else if (isa<ImportDecl>(D))
11965 if (D->
hasAttr<WeakRefAttr>())
11972 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
11974 if (!FD->doesThisDeclarationHaveABody())
11975 return FD->doesDeclarationForceExternallyVisibleDefinition();
11978 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
11983 if (
getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {
11984 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
12002 const auto *VD = cast<VarDecl>(D);
12003 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
12007 if (LangOpts.OpenMP &&
12008 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
12016 if (VD->isInAnotherModuleUnit())
12029 if (VD->needsDestruction(*
this))
12033 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
12035 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
12040 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
12041 for (
const auto *BD : DD->bindings())
12042 if (
const auto *BindingVD = BD->getHoldingVar())
12051 llvm::function_ref<
void(
FunctionDecl *)> Pred)
const {
12052 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
12053 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
12058 for (
auto *CurDecl :
12062 !SeenDecls.contains(CurFD)) {
12063 SeenDecls.insert(CurFD);
12071 bool IsBuiltin)
const {
12074 return ABI->getDefaultMethodCallConv(IsVariadic);
12079 switch (LangOpts.getDefaultCallingConv()) {
12108 return Target->getDefaultCallingConv();
12113 return ABI->isNearlyEmpty(RD);
12117 if (!VTContext.get()) {
12118 auto ABI =
Target->getCXXABI();
12119 if (ABI.isMicrosoft())
12122 auto ComponentLayout =
getLangOpts().RelativeCXXABIVTables
12128 return VTContext.get();
12134 switch (
T->getCXXABI().getKind()) {
12135 case TargetCXXABI::AppleARM64:
12136 case TargetCXXABI::Fuchsia:
12137 case TargetCXXABI::GenericAArch64:
12138 case TargetCXXABI::GenericItanium:
12139 case TargetCXXABI::GenericARM:
12140 case TargetCXXABI::GenericMIPS:
12141 case TargetCXXABI::iOS:
12142 case TargetCXXABI::WebAssembly:
12143 case TargetCXXABI::WatchOS:
12144 case TargetCXXABI::XL:
12146 case TargetCXXABI::Microsoft:
12149 llvm_unreachable(
"Unsupported ABI");
12153 assert(
T.getCXXABI().getKind() != TargetCXXABI::Microsoft &&
12154 "Device mangle context does not support Microsoft mangling.");
12155 switch (
T.getCXXABI().getKind()) {
12156 case TargetCXXABI::AppleARM64:
12157 case TargetCXXABI::Fuchsia:
12158 case TargetCXXABI::GenericAArch64:
12159 case TargetCXXABI::GenericItanium:
12160 case TargetCXXABI::GenericARM:
12161 case TargetCXXABI::GenericMIPS:
12162 case TargetCXXABI::iOS:
12163 case TargetCXXABI::WebAssembly:
12164 case TargetCXXABI::WatchOS:
12165 case TargetCXXABI::XL:
12169 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND))
12170 return RD->getDeviceLambdaManglingNumber();
12171 return std::nullopt;
12174 case TargetCXXABI::Microsoft:
12178 llvm_unreachable(
"Unsupported ABI");
12184 return ASTRecordLayouts.getMemorySize() +
12185 llvm::capacity_in_bytes(ObjCLayouts) +
12186 llvm::capacity_in_bytes(KeyFunctions) +
12187 llvm::capacity_in_bytes(ObjCImpls) +
12188 llvm::capacity_in_bytes(BlockVarCopyInits) +
12189 llvm::capacity_in_bytes(DeclAttrs) +
12190 llvm::capacity_in_bytes(TemplateOrInstantiation) +
12191 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
12192 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
12193 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
12194 llvm::capacity_in_bytes(OverriddenMethods) +
12195 llvm::capacity_in_bytes(Types) +
12196 llvm::capacity_in_bytes(VariableArrayTypes);
12204 unsigned Signed)
const {
12207 if (!QualTy && DestWidth == 128)
12236 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
12243 MangleNumbers[ND] = Number;
12250 bool ForAuxTarget)
const {
12251 auto I = MangleNumbers.find(ND);
12252 unsigned Res = I != MangleNumbers.end() ? I->second : 1;
12255 if (LangOpts.CUDA && !LangOpts.CUDAIsDevice) {
12256 Res = ForAuxTarget ? Res >> 16 : Res & 0xFFFF;
12258 assert(!ForAuxTarget &&
"Only CUDA/HIP host compilation supports mangling "
12259 "number for aux target");
12261 return Res > 1 ? Res : 1;
12268 StaticLocalNumbers[VD] = Number;
12275 auto I = StaticLocalNumbers.find(VD);
12276 return I != StaticLocalNumbers.end() ? I->second : 1;
12281 assert(LangOpts.CPlusPlus);
12282 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
12290 assert(LangOpts.CPlusPlus);
12291 std::unique_ptr<MangleNumberingContext> &MCtx =
12292 ExtraMangleNumberingContexts[D];
12298std::unique_ptr<MangleNumberingContext>
12300 return ABI->createMangleNumberingContext();
12305 return ABI->getCopyConstructorForExceptionObject(
12311 return ABI->addCopyConstructorForExceptionObject(
12318 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
12323 return ABI->getTypedefNameForUnnamedTagDecl(TD);
12328 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
12332 return ABI->getDeclaratorForUnnamedTagDecl(TD);
12336 ParamIndices[D] = index;
12340 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
12341 assert(I != ParamIndices.end() &&
12342 "ParmIndices lacks entry set by ParmVarDecl");
12347 unsigned Length)
const {
12373 assert(
MSGuidTagDecl &&
"building MS GUID without MS extensions?");
12375 llvm::FoldingSetNodeID ID;
12379 if (
MSGuidDecl *Existing = MSGuidDecls.FindNodeOrInsertPos(ID, InsertPos))
12383 MSGuidDecl *New = MSGuidDecl::Create(*
this, GUIDType, Parts);
12384 MSGuidDecls.InsertNode(New, InsertPos);
12390 const APValue &APVal)
const {
12391 llvm::FoldingSetNodeID ID;
12396 UnnamedGlobalConstantDecls.FindNodeOrInsertPos(ID, InsertPos))
12400 UnnamedGlobalConstantDecl::Create(*
this, Ty, APVal);
12401 UnnamedGlobalConstantDecls.InsertNode(New, InsertPos);
12407 assert(
T->
isRecordType() &&
"template param object of unexpected type");
12413 llvm::FoldingSetNodeID ID;
12418 TemplateParamObjectDecls.FindNodeOrInsertPos(ID, InsertPos))
12422 TemplateParamObjectDecls.InsertNode(New, InsertPos);
12428 if (!
T.isOSDarwin())
12431 if (!(
T.isiOS() &&
T.isOSVersionLT(7)) &&
12432 !(
T.isMacOSX() &&
T.isOSVersionLT(10, 9)))
12441 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
12448 if (MethodDecl->
hasAttr<UnavailableAttr>()
12449 || MethodDecl->
hasAttr<DeprecatedAttr>())
12463 IM != EM && IF != EF; ++IM, ++IF) {
12494 llvm::FoldingSetNodeID IDX, IDY;
12495 X->Profile(IDX, *
this,
true);
12496 Y->
Profile(IDY, *
this,
true);
12510 for (
const Decl *DX :
X->redecls()) {
12515 if (DX->isFirstDecl())
12518 llvm_unreachable(
"Corrupt redecls chain");
12521template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
12523 return cast_or_null<T>(
12525 const_cast<Decl *
>(cast_or_null<Decl>(Y))));
12528template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
12531 const_cast<Decl *
>(cast<Decl>(Y))));
12557 assert(Xs.size() == Ys.size());
12559 for (
size_t I = 0; I < Rs.size(); ++I)
12566 return X->getAttributeLoc() == Y->getAttributeLoc() ?
X->getAttributeLoc()
12576 switch (
X.getKind()) {
12606 auto NExpX =
X.getNumTemplateExpansions();
12620 if (Xs.size() != Ys.size())
12622 R.resize(Xs.size());
12623 for (
size_t I = 0; I < R.size(); ++I) {
12636 assert(!Different);
12643 return X->getKeyword() == Y->getKeyword() ?
X->getKeyword()
12651 return X->getQualifier() == Y->getQualifier()
12652 ?
X->getQualifier()
12665 QualType EX =
X->getElementType(), EY = Y->getElementType();
12670 QY += EY.getQualifiers() - RQ;
12680 assert(Ctx.
hasSameExpr(
X->getSizeExpr(), Y->getSizeExpr()));
12681 return X->getSizeExpr();
12686 return X->getSizeModifier();
12692 return X->getIndexTypeCVRQualifiers();
12701 llvm::DenseMap<QualType, unsigned> Found;
12702 for (
auto Ts : {
X, Y}) {
12709 Out.emplace_back(
T);
12719 bool AcceptDependent) {
12745 assert(AcceptDependent &&
12746 "computing composite pointer type of dependent types");
12761 llvm_unreachable(
"These ESTs should be handled above");
12766 assert(EST2 ==
EST_Dynamic &&
"other cases should already be handled");
12770 Result.Exceptions = ExceptionTypeStorage;
12777 llvm_unreachable(
"shouldn't see unresolved exception specifications here");
12780 llvm_unreachable(
"invalid ExceptionSpecificationType");
12789#define UNEXPECTED_TYPE(Class, Kind) \
12790 case Type::Class: \
12791 llvm_unreachable("Unexpected " Kind ": " #Class);
12793#define NON_CANONICAL_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "non-canonical")
12794#define TYPE(Class, Base)
12795#include "clang/AST/TypeNodes.inc"
12797#define SUGAR_FREE_TYPE(Class) UNEXPECTED_TYPE(Class, "sugar-free")
12807#undef SUGAR_FREE_TYPE
12808#define NON_UNIQUE_TYPE(Class) UNEXPECTED_TYPE(Class, "non-unique")
12811#undef NON_UNIQUE_TYPE
12815#undef UNEXPECTED_TYPE
12818 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
12819 assert(AX->getDeducedType().isNull());
12820 assert(AY->getDeducedType().isNull());
12821 assert(AX->getKeyword() == AY->getKeyword());
12822 assert(AX->isInstantiationDependentType() ==
12823 AY->isInstantiationDependentType());
12825 AY->getTypeConstraintArguments());
12828 AX->containsUnexpandedParameterPack(),
12830 AY->getTypeConstraintConcept()),
12833 case Type::IncompleteArray: {
12834 const auto *AX = cast<IncompleteArrayType>(
X),
12835 *AY = cast<IncompleteArrayType>(Y);
12840 case Type::DependentSizedArray: {
12841 const auto *AX = cast<DependentSizedArrayType>(
X),
12842 *AY = cast<DependentSizedArrayType>(Y);
12847 AX->getBracketsRange() == AY->getBracketsRange()
12848 ? AX->getBracketsRange()
12851 case Type::ConstantArray: {
12852 const auto *AX = cast<ConstantArrayType>(
X),
12853 *AY = cast<ConstantArrayType>(Y);
12854 assert(AX->getSize() == AY->getSize());
12855 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
12856 ? AX->getSizeExpr()
12862 case Type::ArrayParameter: {
12863 const auto *AX = cast<ArrayParameterType>(
X),
12864 *AY = cast<ArrayParameterType>(Y);
12865 assert(AX->getSize() == AY->getSize());
12866 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
12867 ? AX->getSizeExpr()
12874 case Type::Atomic: {
12875 const auto *AX = cast<AtomicType>(
X), *AY = cast<AtomicType>(Y);
12879 case Type::Complex: {
12880 const auto *CX = cast<ComplexType>(
X), *CY = cast<ComplexType>(Y);
12883 case Type::Pointer: {
12884 const auto *PX = cast<PointerType>(
X), *PY = cast<PointerType>(Y);
12887 case Type::BlockPointer: {
12888 const auto *PX = cast<BlockPointerType>(
X), *PY = cast<BlockPointerType>(Y);
12891 case Type::ObjCObjectPointer: {
12892 const auto *PX = cast<ObjCObjectPointerType>(
X),
12893 *PY = cast<ObjCObjectPointerType>(Y);
12896 case Type::MemberPointer: {
12897 const auto *PX = cast<MemberPointerType>(
X),
12898 *PY = cast<MemberPointerType>(Y);
12905 case Type::LValueReference: {
12906 const auto *PX = cast<LValueReferenceType>(
X),
12907 *PY = cast<LValueReferenceType>(Y);
12910 PX->isSpelledAsLValue() ||
12911 PY->isSpelledAsLValue());
12913 case Type::RValueReference: {
12914 const auto *PX = cast<RValueReferenceType>(
X),
12915 *PY = cast<RValueReferenceType>(Y);
12919 case Type::DependentAddressSpace: {
12920 const auto *PX = cast<DependentAddressSpaceType>(
X),
12921 *PY = cast<DependentAddressSpaceType>(Y);
12922 assert(Ctx.
hasSameExpr(PX->getAddrSpaceExpr(), PY->getAddrSpaceExpr()));
12924 PX->getAddrSpaceExpr(),
12927 case Type::FunctionNoProto: {
12928 const auto *FX = cast<FunctionNoProtoType>(
X),
12929 *FY = cast<FunctionNoProtoType>(Y);
12930 assert(FX->getExtInfo() == FY->getExtInfo());
12935 case Type::FunctionProto: {
12936 const auto *FX = cast<FunctionProtoType>(
X),
12937 *FY = cast<FunctionProtoType>(Y);
12939 EPIY = FY->getExtProtoInfo();
12940 assert(EPIX.
ExtInfo == EPIY.ExtInfo);
12943 assert(EPIX.
TypeQuals == EPIY.TypeQuals);
12944 assert(EPIX.
Variadic == EPIY.Variadic);
12961 case Type::ObjCObject: {
12962 const auto *OX = cast<ObjCObjectType>(
X), *OY = cast<ObjCObjectType>(Y);
12964 std::equal(OX->getProtocols().begin(), OX->getProtocols().end(),
12965 OY->getProtocols().begin(), OY->getProtocols().end(),
12967 return P0->getCanonicalDecl() == P1->getCanonicalDecl();
12969 "protocol lists must be the same");
12971 OY->getTypeArgsAsWritten());
12974 OX->getProtocols(),
12975 OX->isKindOfTypeAsWritten() && OY->isKindOfTypeAsWritten());
12977 case Type::ConstantMatrix: {
12978 const auto *MX = cast<ConstantMatrixType>(
X),
12979 *MY = cast<ConstantMatrixType>(Y);
12980 assert(MX->getNumRows() == MY->getNumRows());
12981 assert(MX->getNumColumns() == MY->getNumColumns());
12983 MX->getNumRows(), MX->getNumColumns());
12985 case Type::DependentSizedMatrix: {
12986 const auto *MX = cast<DependentSizedMatrixType>(
X),
12987 *MY = cast<DependentSizedMatrixType>(Y);
12988 assert(Ctx.
hasSameExpr(MX->getRowExpr(), MY->getRowExpr()));
12989 assert(Ctx.
hasSameExpr(MX->getColumnExpr(), MY->getColumnExpr()));
12994 case Type::Vector: {
12995 const auto *VX = cast<VectorType>(
X), *VY = cast<VectorType>(Y);
12996 assert(VX->getNumElements() == VY->getNumElements());
12997 assert(VX->getVectorKind() == VY->getVectorKind());
12999 VX->getNumElements(), VX->getVectorKind());
13001 case Type::ExtVector: {
13002 const auto *VX = cast<ExtVectorType>(
X), *VY = cast<ExtVectorType>(Y);
13003 assert(VX->getNumElements() == VY->getNumElements());
13005 VX->getNumElements());
13007 case Type::DependentSizedExtVector: {
13008 const auto *VX = cast<DependentSizedExtVectorType>(
X),
13009 *VY = cast<DependentSizedExtVectorType>(Y);
13014 case Type::DependentVector: {
13015 const auto *VX = cast<DependentVectorType>(
X),
13016 *VY = cast<DependentVectorType>(Y);
13017 assert(VX->getVectorKind() == VY->getVectorKind());
13022 case Type::InjectedClassName: {
13023 const auto *IX = cast<InjectedClassNameType>(
X),
13024 *IY = cast<InjectedClassNameType>(Y);
13028 IY->getInjectedSpecializationType()));
13030 case Type::TemplateSpecialization: {
13031 const auto *TX = cast<TemplateSpecializationType>(
X),
13032 *TY = cast<TemplateSpecializationType>(Y);
13034 TY->template_arguments());
13037 TY->getTemplateName()),
13038 As,
X->getCanonicalTypeInternal());
13040 case Type::Decltype: {
13041 const auto *DX = cast<DecltypeType>(
X);
13042 [[maybe_unused]]
const auto *DY = cast<DecltypeType>(Y);
13043 assert(DX->isDependentType());
13044 assert(DY->isDependentType());
13045 assert(Ctx.
hasSameExpr(DX->getUnderlyingExpr(), DY->getUnderlyingExpr()));
13049 case Type::PackIndexing: {
13050 const auto *DX = cast<PackIndexingType>(
X);
13051 [[maybe_unused]]
const auto *DY = cast<PackIndexingType>(Y);
13052 assert(DX->isDependentType());
13053 assert(DY->isDependentType());
13054 assert(Ctx.
hasSameExpr(DX->getIndexExpr(), DY->getIndexExpr()));
13057 case Type::DependentName: {
13058 const auto *NX = cast<DependentNameType>(
X),
13059 *NY = cast<DependentNameType>(Y);
13060 assert(NX->getIdentifier() == NY->getIdentifier());
13063 NX->getIdentifier(), NX->getCanonicalTypeInternal());
13065 case Type::DependentTemplateSpecialization: {
13066 const auto *TX = cast<DependentTemplateSpecializationType>(
X),
13067 *TY = cast<DependentTemplateSpecializationType>(Y);
13068 assert(TX->getIdentifier() == TY->getIdentifier());
13070 TY->template_arguments());
13073 TX->getIdentifier(), As);
13075 case Type::UnaryTransform: {
13076 const auto *TX = cast<UnaryTransformType>(
X),
13077 *TY = cast<UnaryTransformType>(Y);
13078 assert(TX->getUTTKind() == TY->getUTTKind());
13082 TY->getUnderlyingType()),
13085 case Type::PackExpansion: {
13086 const auto *PX = cast<PackExpansionType>(
X),
13087 *PY = cast<PackExpansionType>(Y);
13088 assert(PX->getNumExpansions() == PY->getNumExpansions());
13091 PX->getNumExpansions(),
false);
13094 const auto *PX = cast<PipeType>(
X), *PY = cast<PipeType>(Y);
13095 assert(PX->isReadOnly() == PY->isReadOnly());
13100 case Type::TemplateTypeParm: {
13101 const auto *TX = cast<TemplateTypeParmType>(
X),
13102 *TY = cast<TemplateTypeParmType>(Y);
13103 assert(TX->getDepth() == TY->getDepth());
13104 assert(TX->getIndex() == TY->getIndex());
13105 assert(TX->isParameterPack() == TY->isParameterPack());
13107 TX->getDepth(), TX->getIndex(), TX->isParameterPack(),
13111 llvm_unreachable(
"Unknown Type Class");
13121#define UNEXPECTED_TYPE(Class, Kind) \
13122 case Type::Class: \
13123 llvm_unreachable("Unexpected " Kind ": " #Class);
13124#define TYPE(Class, Base)
13125#define DEPENDENT_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "dependent")
13126#include "clang/AST/TypeNodes.inc"
13128#define CANONICAL_TYPE(Class) UNEXPECTED_TYPE(Class, "canonical")
13153#undef CANONICAL_TYPE
13155#undef UNEXPECTED_TYPE
13157 case Type::Adjusted: {
13158 const auto *AX = cast<AdjustedType>(
X), *AY = cast<AdjustedType>(Y);
13159 QualType OX = AX->getOriginalType(), OY = AY->getOriginalType();
13166 case Type::Decayed: {
13167 const auto *DX = cast<DecayedType>(
X), *DY = cast<DecayedType>(Y);
13168 QualType OX = DX->getOriginalType(), OY = DY->getOriginalType();
13175 case Type::Attributed: {
13176 const auto *AX = cast<AttributedType>(
X), *AY = cast<AttributedType>(Y);
13178 if (Kind != AY->getAttrKind())
13180 QualType MX = AX->getModifiedType(), MY = AY->getModifiedType();
13187 case Type::BTFTagAttributed: {
13188 const auto *BX = cast<BTFTagAttributedType>(
X);
13189 const BTFTypeTagAttr *AX = BX->getAttr();
13191 if (AX->getBTFTypeTag() !=
13192 cast<BTFTagAttributedType>(Y)->getAttr()->getBTFTypeTag())
13197 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
13200 if (KW != AY->getKeyword())
13204 AY->getTypeConstraintConcept());
13208 AY->getTypeConstraintArguments())) {
13216 false,
false, CD, As);
13218 case Type::PackIndexing:
13219 case Type::Decltype:
13221 case Type::DeducedTemplateSpecialization:
13225 case Type::Elaborated: {
13226 const auto *EX = cast<ElaboratedType>(
X), *EY = cast<ElaboratedType>(Y);
13232 case Type::MacroQualified: {
13233 const auto *MX = cast<MacroQualifiedType>(
X),
13234 *MY = cast<MacroQualifiedType>(Y);
13236 if (IX != MY->getMacroIdentifier())
13240 case Type::SubstTemplateTypeParm: {
13241 const auto *SX = cast<SubstTemplateTypeParmType>(
X),
13242 *SY = cast<SubstTemplateTypeParmType>(Y);
13247 unsigned Index = SX->getIndex();
13248 if (Index != SY->getIndex())
13250 auto PackIndex = SX->getPackIndex();
13251 if (PackIndex != SY->getPackIndex())
13254 CD, Index, PackIndex);
13256 case Type::ObjCTypeParam:
13262 case Type::TemplateSpecialization: {
13263 const auto *TX = cast<TemplateSpecializationType>(
X),
13264 *TY = cast<TemplateSpecializationType>(Y);
13266 TY->getTemplateName());
13271 TY->template_arguments()))
13276 case Type::Typedef: {
13277 const auto *TX = cast<TypedefType>(
X), *TY = cast<TypedefType>(Y);
13283 case Type::TypeOf: {
13289 if (cast<TypeOfType>(
X)->
getKind() == cast<TypeOfType>(Y)->
getKind() &&
13294 case Type::TypeOfExpr:
13297 case Type::UnaryTransform: {
13298 const auto *UX = cast<UnaryTransformType>(
X),
13299 *UY = cast<UnaryTransformType>(Y);
13301 if (KX != UY->getUTTKind())
13303 QualType BX = UX->getBaseType(), BY = UY->getBaseType();
13310 case Type::Using: {
13311 const auto *UX = cast<UsingType>(
X), *UY = cast<UsingType>(Y);
13318 case Type::CountAttributed: {
13319 const auto *DX = cast<CountAttributedType>(
X),
13320 *DY = cast<CountAttributedType>(Y);
13321 if (DX->isCountInBytes() != DY->isCountInBytes())
13323 if (DX->isOrNull() != DY->isOrNull())
13325 Expr *CEX = DX->getCountExpr();
13326 Expr *CEY = DY->getCountExpr();
13330 DX->isCountInBytes(), DX->isOrNull(),
13341 DX->isCountInBytes(), DX->isOrNull(),
13345 llvm_unreachable(
"Unhandled Type Class");
13367 if (
X.isCanonical())
13380 if (SX.
Ty != SY.Ty) {
13388 while (!Xs.empty() && !Ys.empty() && Xs.back().Ty == Ys.back().Ty) {
13391 SX = Xs.pop_back_val();
13392 SY = Ys.pop_back_val();
13402 while (!Xs.empty() && !Ys.empty()) {
13405 SX = Xs.pop_back_val();
13406 SY = Ys.pop_back_val();
13411 SX.
Ty = Underlying.Ty;
13414 QX -= Underlying.Quals;
13432 llvm_unreachable(
"Not a saturated fixed point type!");
13433 case BuiltinType::SatShortAccum:
13435 case BuiltinType::SatAccum:
13437 case BuiltinType::SatLongAccum:
13439 case BuiltinType::SatUShortAccum:
13441 case BuiltinType::SatUAccum:
13443 case BuiltinType::SatULongAccum:
13445 case BuiltinType::SatShortFract:
13447 case BuiltinType::SatFract:
13449 case BuiltinType::SatLongFract:
13451 case BuiltinType::SatUShortFract:
13453 case BuiltinType::SatUFract:
13455 case BuiltinType::SatULongFract:
13467 llvm_unreachable(
"Not a fixed point type!");
13468 case BuiltinType::ShortAccum:
13470 case BuiltinType::Accum:
13472 case BuiltinType::LongAccum:
13474 case BuiltinType::UShortAccum:
13476 case BuiltinType::UAccum:
13478 case BuiltinType::ULongAccum:
13480 case BuiltinType::ShortFract:
13482 case BuiltinType::Fract:
13484 case BuiltinType::LongFract:
13486 case BuiltinType::UShortFract:
13488 case BuiltinType::UFract:
13490 case BuiltinType::ULongFract:
13496 if (LangOpts.OpenCL)
13520 llvm_unreachable(
"Not a fixed point type!");
13521 case BuiltinType::ShortAccum:
13522 case BuiltinType::SatShortAccum:
13523 return Target.getShortAccumScale();
13524 case BuiltinType::Accum:
13525 case BuiltinType::SatAccum:
13526 return Target.getAccumScale();
13527 case BuiltinType::LongAccum:
13528 case BuiltinType::SatLongAccum:
13529 return Target.getLongAccumScale();
13530 case BuiltinType::UShortAccum:
13531 case BuiltinType::SatUShortAccum:
13532 return Target.getUnsignedShortAccumScale();
13533 case BuiltinType::UAccum:
13534 case BuiltinType::SatUAccum:
13535 return Target.getUnsignedAccumScale();
13536 case BuiltinType::ULongAccum:
13537 case BuiltinType::SatULongAccum:
13538 return Target.getUnsignedLongAccumScale();
13539 case BuiltinType::ShortFract:
13540 case BuiltinType::SatShortFract:
13541 return Target.getShortFractScale();
13542 case BuiltinType::Fract:
13543 case BuiltinType::SatFract:
13544 return Target.getFractScale();
13545 case BuiltinType::LongFract:
13546 case BuiltinType::SatLongFract:
13547 return Target.getLongFractScale();
13548 case BuiltinType::UShortFract:
13549 case BuiltinType::SatUShortFract:
13550 return Target.getUnsignedShortFractScale();
13551 case BuiltinType::UFract:
13552 case BuiltinType::SatUFract:
13553 return Target.getUnsignedFractScale();
13554 case BuiltinType::ULongFract:
13555 case BuiltinType::SatULongFract:
13556 return Target.getUnsignedLongFractScale();
13566 llvm_unreachable(
"Not a fixed point type!");
13567 case BuiltinType::ShortAccum:
13568 case BuiltinType::SatShortAccum:
13569 return Target.getShortAccumIBits();
13570 case BuiltinType::Accum:
13571 case BuiltinType::SatAccum:
13572 return Target.getAccumIBits();
13573 case BuiltinType::LongAccum:
13574 case BuiltinType::SatLongAccum:
13575 return Target.getLongAccumIBits();
13576 case BuiltinType::UShortAccum:
13577 case BuiltinType::SatUShortAccum:
13578 return Target.getUnsignedShortAccumIBits();
13579 case BuiltinType::UAccum:
13580 case BuiltinType::SatUAccum:
13581 return Target.getUnsignedAccumIBits();
13582 case BuiltinType::ULongAccum:
13583 case BuiltinType::SatULongAccum:
13584 return Target.getUnsignedLongAccumIBits();
13585 case BuiltinType::ShortFract:
13586 case BuiltinType::SatShortFract:
13587 case BuiltinType::Fract:
13588 case BuiltinType::SatFract:
13589 case BuiltinType::LongFract:
13590 case BuiltinType::SatLongFract:
13591 case BuiltinType::UShortFract:
13592 case BuiltinType::SatUShortFract:
13593 case BuiltinType::UFract:
13594 case BuiltinType::SatUFract:
13595 case BuiltinType::ULongFract:
13596 case BuiltinType::SatULongFract:
13601llvm::FixedPointSemantics
13604 "Can only get the fixed point semantics for a "
13605 "fixed point or integer type.");
13607 return llvm::FixedPointSemantics::GetIntegerSemantics(
13611 return llvm::FixedPointSemantics(
13614 !isSigned &&
getTargetInfo().doUnsignedFixedPointTypesHavePadding());
13629 "Expected unsigned fixed point type");
13632 case BuiltinType::UShortAccum:
13634 case BuiltinType::UAccum:
13636 case BuiltinType::ULongAccum:
13638 case BuiltinType::SatUShortAccum:
13640 case BuiltinType::SatUAccum:
13642 case BuiltinType::SatULongAccum:
13644 case BuiltinType::UShortFract:
13646 case BuiltinType::UFract:
13648 case BuiltinType::ULongFract:
13650 case BuiltinType::SatUShortFract:
13652 case BuiltinType::SatUFract:
13654 case BuiltinType::SatULongFract:
13657 llvm_unreachable(
"Unexpected unsigned fixed point type");
13662 const TargetVersionAttr *TV)
const {
13663 assert(TV !=
nullptr);
13665 std::vector<std::string> ResFeats;
13666 TV->getFeatures(Feats);
13667 for (
auto &Feature : Feats)
13668 if (
Target->validateCpuSupports(Feature.str()))
13670 ResFeats.push_back(
"?" + Feature.str());
13676 assert(TD !=
nullptr);
13679 llvm::erase_if(
ParsedAttr.Features, [&](
const std::string &Feat) {
13680 return !Target->isValidFeatureName(StringRef{Feat}.substr(1));
13691 Target->getTargetOpts().CPU,
13692 Target->getTargetOpts().Features);
13699 StringRef TargetCPU =
Target->getTargetOpts().CPU;
13701 if (
const auto *TD = FD->
getAttr<TargetAttr>()) {
13708 Target->getTargetOpts().FeaturesAsWritten.begin(),
13709 Target->getTargetOpts().FeaturesAsWritten.end());
13720 }
else if (
const auto *SD = FD->
getAttr<CPUSpecificAttr>()) {
13722 Target->getCPUSpecificCPUDispatchFeatures(
13724 std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
13725 Features.insert(Features.begin(),
13726 Target->getTargetOpts().FeaturesAsWritten.begin(),
13727 Target->getTargetOpts().FeaturesAsWritten.end());
13729 }
else if (
const auto *TC = FD->
getAttr<TargetClonesAttr>()) {
13730 std::vector<std::string> Features;
13731 if (
Target->getTriple().isAArch64()) {
13735 for (StringRef Feat : Feats)
13736 if (
Target->validateCpuSupports(Feat.str()))
13738 Features.push_back(
"?" + Feat.str());
13739 Features.insert(Features.begin(),
13740 Target->getTargetOpts().FeaturesAsWritten.begin(),
13741 Target->getTargetOpts().FeaturesAsWritten.end());
13744 if (VersionStr.starts_with(
"arch="))
13745 TargetCPU = VersionStr.drop_front(
sizeof(
"arch=") - 1);
13746 else if (VersionStr !=
"default")
13747 Features.push_back((StringRef{
"+"} + VersionStr).str());
13750 }
else if (
const auto *TV = FD->
getAttr<TargetVersionAttr>()) {
13752 Feats.insert(Feats.begin(),
13753 Target->getTargetOpts().FeaturesAsWritten.begin(),
13754 Target->getTargetOpts().FeaturesAsWritten.end());
13757 FeatureMap =
Target->getTargetOpts().FeatureMap;
13763 return *OMPTraitInfoVector.back();
13770 return DB << Section.
Decl;
13771 return DB <<
"a prior #pragma section";
13775 bool IsInternalVar =
13778 bool IsExplicitDeviceVar = (D->
hasAttr<CUDADeviceAttr>() &&
13779 !D->
getAttr<CUDADeviceAttr>()->isImplicit()) ||
13780 (D->
hasAttr<CUDAConstantAttr>() &&
13781 !D->
getAttr<CUDAConstantAttr>()->isImplicit());
13785 return (IsInternalVar &&
13786 (D->
hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) ||
13787 (D->
hasAttr<CUDAGlobalAttr>() &&
13794 (D->
hasAttr<HIPManagedAttr>() || D->
hasAttr<CUDAGlobalAttr>() ||
13799 if (!CUIDHash.empty())
13801 if (LangOpts.
CUID.empty())
13802 return StringRef();
13803 CUIDHash = llvm::utohexstr(llvm::MD5Hash(LangOpts.
CUID),
true);
This file provides AST data structures related to concepts.
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl * > &Protocols)
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
static SourceLocation getCommonAttrLoc(const T *X, const T *Y)
static auto getCommonTypes(ASTContext &Ctx, ArrayRef< QualType > Xs, ArrayRef< QualType > Ys, bool Unqualified=false)
static auto getCanonicalTemplateArguments(const ASTContext &C, ArrayRef< TemplateArgument > Args, bool &AnyNonCanonArgs)
static char getObjCEncodingForPrimitiveType(const ASTContext *C, const BuiltinType *BT)
static bool NeedsInjectedClassNameType(const RecordDecl *D)
#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS)
static bool unionHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static NamespaceDecl * getNamespace(const NestedNameSpecifier *X)
static TypedefDecl * CreateHexagonBuiltinVaListDecl(const ASTContext *Context)
#define CANONICAL_TYPE(Class)
static NestedNameSpecifier * getCommonNNS(ASTContext &Ctx, const T *X, const T *Y)
static Decl * getCommonDecl(Decl *X, Decl *Y)
static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context, const Decl *D, GVALinkage L)
static bool isTypeTypedefedAsBOOL(QualType T)
static void EncodeBitField(const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
static uint64_t getSVETypeSize(ASTContext &Context, const BuiltinType *Ty)
getSVETypeSize - Return SVE vector or predicate register size.
#define SUGAR_FREE_TYPE(Class)
static bool getCommonTemplateArguments(ASTContext &Ctx, SmallVectorImpl< TemplateArgument > &R, ArrayRef< TemplateArgument > Xs, ArrayRef< TemplateArgument > Ys)
static bool hasTemplateSpecializationInEncodedString(const Type *T, bool VisitBasesAndFields)
static void getIntersectionOfProtocols(ASTContext &Context, const ObjCInterfaceDecl *CommonBase, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, SmallVectorImpl< ObjCProtocolDecl * > &IntersectionSet)
getIntersectionOfProtocols - This routine finds the intersection of set of protocols inherited from t...
static bool areCompatMatrixTypes(const ConstantMatrixType *LHS, const ConstantMatrixType *RHS)
areCompatMatrixTypes - Return true if the two specified matrix types are compatible.
static TypedefDecl * CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context)
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
static bool canAssignObjCObjectTypes(ASTContext &ctx, QualType lhs, QualType rhs)
Determine whether the first type is a subtype of the second.
static const Type * getIntegerTypeForEnum(const EnumType *ET)
static TemplateName getCommonTemplateNameChecked(ASTContext &Ctx, TemplateName X, TemplateName Y)
static const Decl & adjustDeclToTemplate(const Decl &D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template.
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
static QualType getCommonElementType(ASTContext &Ctx, const T *X, const T *Y)
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
static auto getCommonSizeModifier(const ArrayType *X, const ArrayType *Y)
static std::optional< int64_t > structHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static TemplateName getCommonTemplateName(ASTContext &Ctx, TemplateName X, TemplateName Y)
static bool hasSameOverloadableAttrs(const FunctionDecl *A, const FunctionDecl *B)
Determine whether the attributes we can overload on are identical for A and B.
static T * getCommonDeclChecked(T *X, T *Y)
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
static int64_t getSubobjectOffset(const FieldDecl *Field, const ASTContext &Context, const clang::ASTRecordLayout &)
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
static TypedefDecl * CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context)
static QualType mergeEnumWithInteger(ASTContext &Context, const EnumType *ET, QualType other, bool isBlockReturnType)
Given that we have an enum type and a non-enum type, try to merge them.
static GVALinkage adjustGVALinkageForExternalDefinitionKind(const ASTContext &Ctx, const Decl *D, GVALinkage L)
Adjust the GVALinkage for a declaration based on what an external AST source knows about whether ther...
static TypedefDecl * CreateSystemZBuiltinVaListDecl(const ASTContext *Context)
static std::optional< int64_t > getSubobjectSizeInBits(const FieldDecl *Field, const ASTContext &Context, bool CheckIfTriviallyCopyable)
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
#define NON_UNIQUE_TYPE(Class)
static TypedefDecl * CreateX86_64ABIBuiltinVaListDecl(const ASTContext *Context)
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
static auto getCommonIndexTypeCVRQualifiers(const ArrayType *X, const ArrayType *Y)
#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS)
static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)
DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the pointer over the consume...
static TypedefDecl * CreateCharPtrBuiltinVaListDecl(const ASTContext *Context)
static void mergeTypeLists(ASTContext &Ctx, SmallVectorImpl< QualType > &Out, ArrayRef< QualType > X, ArrayRef< QualType > Y)
static bool areSortedAndUniqued(ArrayRef< ObjCProtocolDecl * > Protocols)
static TypeInfoChars getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
getConstantArrayInfoInChars - Performing the computation in CharUnits instead of in bits prevents ove...
static FloatingRank getFloatingRank(QualType T)
getFloatingRank - Return a relative rank for floating point types.
static TemplateArgument getCommonTemplateArgument(ASTContext &Ctx, const TemplateArgument &X, const TemplateArgument &Y)
static auto * getCommonSizeExpr(ASTContext &Ctx, T *X, T *Y)
static std::optional< int64_t > structSubobjectsHaveUniqueObjectRepresentations(const RangeT &Subobjects, int64_t CurOffsetInBits, const ASTContext &Context, const clang::ASTRecordLayout &Layout, bool CheckIfTriviallyCopyable)
static char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
static QualType getCommonArrayElementType(ASTContext &Ctx, const T *X, Qualifiers &QX, const T *Y, Qualifiers &QY)
static QualType getCommonPointeeType(ASTContext &Ctx, const T *X, const T *Y)
static uint64_t getRVVTypeSize(ASTContext &Context, const BuiltinType *Ty)
getRVVTypeSize - Return RVV vector register size.
static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal)
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
static QualType getCommonNonSugarTypeNode(ASTContext &Ctx, const Type *X, Qualifiers &QX, const Type *Y, Qualifiers &QY)
static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, const Type *Y, SplitQualType Underlying)
static bool isSameQualifier(const NestedNameSpecifier *X, const NestedNameSpecifier *Y)
static std::string charUnitsToString(const CharUnits &CU)
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl * > &Redeclared)
static SmallVector< SourceLocation, 2 > getDeclLocsForCommentSearch(const Decl *D, SourceManager &SourceMgr)
static bool isCanonicalResultType(QualType T)
Determine whether T is canonical as the result type of a function.
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
static bool areCompatVectorTypes(const VectorType *LHS, const VectorType *RHS)
areCompatVectorTypes - Return true if the two specified vector types are compatible.
static TypedefDecl * CreateCharPtrNamedVaListDecl(const ASTContext *Context, StringRef Name)
#define UNEXPECTED_TYPE(Class, Kind)
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
static ElaboratedTypeKeyword getCommonTypeKeyword(const T *X, const T *Y)
Defines the clang::ASTContext interface.
Provides definitions for the various language-specific address spaces.
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
static constexpr Builtin::Info BuiltinInfo[]
Defines enum values for all the target-independent builtin functions.
static bool CanThrow(Expr *E, ASTContext &Ctx)
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static const Decl * getCanonicalDecl(const Decl *D)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
llvm::MachO::Record Record
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Defines the clang::Module class, which describes a module in the source code.
Defines types useful for describing an Objective-C runtime.
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
static QualType getUnderlyingType(const SubRegion *R)
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
This file defines OpenACC AST classes for statement-level contructs.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
Defines the clang::TypeLoc interface and its subclasses.
static const TemplateArgument & getArgument(const TemplateArgument &A)
C Language Family Type Representation.
__device__ __2f16 float c
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
bool isMemberPointerToDerivedMember() const
const ValueDecl * getMemberPointerDecl() const
ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
MSGuidDecl * getMSGuidDecl(MSGuidDeclParts Parts) const
Return a declaration for the global GUID object representing the given GUID value.
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
CanQualType ObjCBuiltinSelTy
TranslationUnitDecl * getTranslationUnitDecl() const
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible SVE vector types, false otherwise.
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
void InitBuiltinTypes(const TargetInfo &Target, const TargetInfo *AuxTarget=nullptr)
Initialize built-in types.
ParentMapContext & getParentMapContext()
Returns the dynamic AST node parent map context.
QualType getParenType(QualType NamedType) const
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization,...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
CanQualType ARCUnbridgedCastTy
QualType getDependentSizedMatrixType(QualType ElementType, Expr *RowExpr, Expr *ColumnExpr, SourceLocation AttrLoc) const
Return the unique reference to the matrix type of the specified element type and size.
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
unsigned getManglingNumber(const NamedDecl *ND, bool ForAuxTarget=false) const
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true)
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
unsigned getIntWidth(QualType T) const
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one.
QualType getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, QualType Wrapped)
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType) const
InlineVariableDefinitionKind
@ None
Not an inline variable.
@ Weak
Weak definition of inline variable.
@ Strong
Strong definition.
@ WeakUnknown
Weak for now, might become strong later in this TU.
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
TypedefDecl * getCFConstantStringDecl() const
CanQualType SatUnsignedFractTy
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template.
bool areCompatibleRVVTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an RISC-V vector builtin type and a VectorType that is a fixed-len...
ExternCContextDecl * getExternCContextDecl() const
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const
Parses the target attributes passed in, and returns only the ones that are valid feature names.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
CanQualType UnsignedShortAccumTy
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
bool hasSimilarType(QualType T1, QualType T2)
Determine if two types are similar, according to the C++ rules.
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
void adjustObjCTypeParamBoundType(const ObjCTypeParamDecl *Orig, ObjCTypeParamDecl *New) const
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.
bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool AllowCXX=false, bool IsConditionalOperator=false)
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
DeclarationNameTable DeclarationNames
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
TemplateName getCanonicalTemplateName(const TemplateName &Name) const
Retrieves the "canonical" template name that refers to a given template.
QualType getUnresolvedUsingType(const UnresolvedUsingTypenameDecl *Decl) const
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
void setCurrentNamedModule(Module *M)
Set the (C++20) module we are building.
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>.
CharUnits getMemberPointerPathAdjustment(const APValue &MP) const
Find the 'this' offset for the member path in a pointer-to-member APValue.
bool mayExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel may be externalized.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
QualType getRecordType(const RecordDecl *Decl) const
QualType getScalableVectorType(QualType EltTy, unsigned NumElts, unsigned NumFields=1) const
Return the unique reference to a scalable vector type of the specified element type and scalable numb...
bool hasSameExpr(const Expr *X, const Expr *Y) const
Determine whether the given expressions X and Y are equivalent.
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
QualType getRealTypeForBitwidth(unsigned DestWidth, FloatModeKind ExplicitType) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any.
unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built.
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
unsigned getTypeUnadjustedAlign(QualType T) const
Return the ABI-specified natural alignment of a (complete) type T, before alignment adjustments,...
unsigned char getFixedPointIBits(QualType Ty) const
QualType getCorrespondingSignedFixedPointType(QualType Ty) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getCountAttributedType(QualType T, Expr *CountExpr, bool CountInBytes, bool OrNull, ArrayRef< TypeCoupledDeclRefInfo > DependentDecls) const
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true)
Form a pack expansion type with the given pattern.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
bool mergeExtParameterInfo(const FunctionProtoType *FirstFnType, const FunctionProtoType *SecondFnType, bool &CanUseFirst, bool &CanUseSecond, SmallVectorImpl< FunctionProtoType::ExtParameterInfo > &NewParamInfos)
This function merges the ExtParameterInfo lists of two functions.
bool ObjCQualifiedClassTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>.
bool shouldExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel should be externalized.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
bool propertyTypesAreCompatible(QualType, QualType)
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc, VectorKind VecKind) const
Return the unique reference to the type for a dependently sized vector of the specified element type.
CanQualType SatLongAccumTy
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
std::vector< std::string > filterFunctionTargetVersionAttrs(const TargetVersionAttr *TV) const
OpenCLTypeKind getOpenCLTypeKind(const Type *T) const
Map an AST Type to an OpenCLTypeKind enum value.
QualType getFILEType() const
Retrieve the C FILE type.
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
unsigned getPreferredTypeAlign(QualType T) const
Return the "preferred" alignment of the specified type T for the current target, in bits.
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list,...
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
CanQualType OMPArrayShapingTy
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins, TranslationUnitKind TUKind)
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
unsigned getStaticLocalNumber(const VarDecl *VD) const
void addComment(const RawComment &RC)
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
bool isSameTypeConstraint(const TypeConstraint *XTC, const TypeConstraint *YTC) const
Determine whether two type contraint are similar enough that they could used in declarations of the s...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=RecordDecl::TagKind::Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getMSGuidType() const
Retrieve the implicitly-predeclared 'struct _GUID' type.
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
CanQualType UnsignedLongFractTy
QualType getEnumType(const EnumDecl *Decl) const
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const
Return a dependent bit-precise integer type with the specified signedness and bit count.
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
StringRef getCUIDHash() const
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
QualType getReferenceQualifiedType(const Expr *e) const
getReferenceQualifiedType - Given an expr, will return the type for that expression,...
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U) const
Determine whether two function types are the same, ignoring exception specifications in cases where t...
QualType getBlockDescriptorExtendedType() const
Gets the struct used to keep track of the extended descriptor for pointer to blocks.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
IdentifierInfo * getMakeIntegerSeqName() const
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
void addLazyModuleInitializers(Module *M, ArrayRef< GlobalDeclID > IDs)
bool isSameConstraintExpr(const Expr *XCE, const Expr *YCE) const
Determine whether two 'requires' expressions are similar enough that they may be used in re-declarati...
IdentifierInfo * getTypePackElementName() const
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
CanQualType OMPIteratorTy
TemplateName getSubstTemplateTemplateParm(TemplateName replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Builtin::Context & BuiltinInfo
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
void addModuleInitializer(Module *M, Decl *Init)
Add a declaration to the list of declarations that are initialized for a module.
const LangOptions & getLangOpts() const
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl)
QualType getFunctionTypeWithoutPtrSizes(QualType T)
Get a function type and produce the equivalent function type where pointer size address spaces in the...
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
unsigned getMinGlobalAlignOfVar(uint64_t Size, const VarDecl *VD) const
Return the minimum alignement as specified by the target.
RawCommentList Comments
All comments in this translation unit.
bool isSameDefaultTemplateArgument(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two default template arguments are similar enough that they may be used in declarat...
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType removePtrSizeAddrSpace(QualType T) const
Remove the existing address space on the type if it is a pointer size address space and return the ty...
bool areLaxCompatibleRVVTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible RISC-V vector types as defined by -flax-vect...
CanQualType SatShortFractTy
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
bool canBindObjCObjectType(QualType To, QualType From)
int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const
Compare the rank of two floating point types as above, but compare equal if both types have the same ...
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
void setParameterIndex(const ParmVarDecl *D, unsigned index)
Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...
QualType getFunctionTypeWithExceptionSpec(QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI) const
Get a function type and produce the equivalent function type with the specified exception specificati...
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool hasUniqueObjectRepresentations(QualType Ty, bool CheckIfTriviallyCopyable=true) const
Return true if the specified type has unique object representations according to (C++17 [meta....
bool typesAreBlockPointerCompatible(QualType, QualType)
CanQualType SatUnsignedAccumTy
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
void forEachMultiversionedFunctionVersion(const FunctionDecl *FD, llvm::function_ref< void(FunctionDecl *)> Pred) const
Visits all versions of a multiversioned function with the passed predicate.
void setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst, UsingEnumDecl *Pattern)
Remember that the using enum decl Inst is an instantiation of the using enum decl Pattern of a class ...
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
CanQualType ArraySectionTy
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) const
CanQualType ObjCBuiltinIdTy
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
VTableContextBase * getVTableContext()
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i....
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
bool isNearlyEmpty(const CXXRecordDecl *RD) const
void cacheRawCommentForDecl(const Decl &OriginalD, const RawComment &Comment) const
Attaches Comment to OriginalD and to its redeclaration chain and removes the redeclaration chain from...
void attachCommentsToJustParsedDecls(ArrayRef< Decl * > Decls, const Preprocessor *PP)
Searches existing comments for doc comments that should be attached to Decls.
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth,...
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
UsingEnumDecl * getInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst)
If the given using-enum decl Inst is an instantiation of another using-enum decl, return it.
RecordDecl * getCFConstantStringTagDecl() const
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
CanQualType UnsignedFractTy
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
CanQualType ObjCBuiltinClassTy
unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built.
CanQualType UnresolvedTemplateTy
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
CanQualType UnsignedLongTy
bool hasSameTemplateName(const TemplateName &X, const TemplateName &Y) const
Determine whether the given template names refer to the same template.
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized,...
llvm::APFixedPoint getFixedPointMin(QualType Ty) const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
CanQualType UnsignedLongAccumTy
QualType AutoRRefDeductTy
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const
Return a type for a constant array for a string literal of the specified element type and length.
QualType getCorrespondingSaturatedType(QualType Ty) const
bool isSameEntity(const NamedDecl *X, const NamedDecl *Y) const
Determine whether the two declarations refer to the same entity.
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
QualType getSubstTemplateTypeParmPackType(Decl *AssociatedDecl, unsigned Index, bool Final, const TemplateArgument &ArgPack)
Retrieve a.
CanQualType BoundMemberTy
CanQualType SatUnsignedShortFractTy
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
QualType getBlockDescriptorType() const
Gets the struct used to keep track of the descriptor for pointer to blocks.
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
llvm::DenseSet< const VarDecl * > CUDADeviceVarODRUsedByHost
Keep track of CUDA/HIP device-side variables ODR-used by host code.
CanQualType PseudoObjectTy
QualType getWebAssemblyExternrefType() const
Return a WebAssembly externref type.
void setTraversalScope(const std::vector< Decl * > &)
CharUnits getTypeUnadjustedAlignInChars(QualType T) const
getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type, in characters,...
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
unsigned getAlignOfGlobalVar(QualType T, const VarDecl *VD) const
Return the alignment in bits that should be given to a global variable with type T.
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
MangleContext * createDeviceMangleContext(const TargetInfo &T)
Creates a device mangle context to correctly mangle lambdas in a mixed architecture compile by settin...
CharUnits getExnObjectAlignment() const
Return the alignment (in bytes) of the thrown exception object.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
ASTMutationListener * Listener
CanQualType ObjCBuiltinBoolTy
TypeInfoChars getTypeInfoInChars(const Type *T) const
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
TemplateParamObjectDecl * getTemplateParamObjectDecl(QualType T, const APValue &V) const
Return the template parameter object of the given type with the given value.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
CanQualType OCLClkEventTy
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
const clang::PrintingPolicy & getPrintingPolicy() const
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
llvm::FixedPointSemantics getFixedPointSemantics(QualType Ty) const
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
CanQualType SatUnsignedShortAccumTy
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false, bool IsConditionalOperator=false)
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
CharUnits getAlignOfGlobalVarInChars(QualType T, const VarDecl *VD) const
Return the alignment in characters that should be given to a global variable with type T.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
QualType getObjCIdType() const
Represents the Objective-CC id type.
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getCorrespondingUnsaturatedType(QualType Ty) const
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
FunctionProtoType::ExceptionSpecInfo mergeExceptionSpecs(FunctionProtoType::ExceptionSpecInfo ESI1, FunctionProtoType::ExceptionSpecInfo ESI2, SmallVectorImpl< QualType > &ExceptionTypeStorage, bool AcceptDependent)
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
bool isSameTemplateParameterList(const TemplateParameterList *X, const TemplateParameterList *Y) const
Determine whether two template parameter lists are similar enough that they may be used in declaratio...
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CanQualType UnsignedInt128Ty
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.
unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built.
void setManglingNumber(const NamedDecl *ND, unsigned Number)
llvm::DenseMap< const Decl *, const RawComment * > DeclRawComments
Mapping from declaration to directly attached comment.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
CanQualType UnsignedCharTy
CanQualType UnsignedShortFractTy
BuiltinTemplateDecl * buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, const IdentifierInfo *II) const
void * Allocate(size_t Size, unsigned Align=8) const
bool canBuiltinBeRedeclared(const FunctionDecl *) const
Return whether a declaration to a builtin is allowed to be overloaded/redeclared.
CanQualType UnsignedIntTy
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply.
unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl * > protocols) const
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
getObjCEncodingForMethodParameter - Return the encoded type for a single method parameter or return t...
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
QualType getExceptionObjectType(QualType T) const
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
CanQualType UnsignedLongLongTy
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
QualType getCommonSugaredType(QualType X, QualType Y, bool Unqualified=false)
CanQualType OCLReserveIDTy
bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two template parameters are similar enough that they may be used in declarations of...
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
CanQualType UnsignedShortTy
unsigned getTypeAlignIfKnown(QualType T, bool NeedsPreferredAlignment=false) const
Return the alignment of a type, in bits, or 0 if the type is incomplete and we cannot determine the a...
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
canAssignObjCInterfacesInBlockPointer - This routine is specifically written for providing type-safet...
CanQualType SatUnsignedLongFractTy
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType getPackIndexingType(QualType Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< QualType > Expansions={}, int Index=-1) const
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache.
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
const VariableArrayType * getAsVariableArrayType(QualType T) const
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
StringLiteral * getPredefinedStringLiteralFromCache(StringRef Key) const
Return a string representing the human readable name for the specified function declaration or file n...
bool UnwrapSimilarTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true)
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
llvm::APFixedPoint getFixedPointMax(QualType Ty) const
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
bool areCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an SVE builtin and a VectorType that is a fixed-length representat...
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
DiagnosticsEngine & getDiagnostics() const
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
void ResetObjCLayout(const ObjCContainerDecl *CD)
interp::Context & getInterpContext()
Returns the clang bytecode interpreter context.
UnnamedGlobalConstantDecl * getUnnamedGlobalConstantDecl(QualType Ty, const APValue &Value) const
Return a declaration for a uniquified anonymous global constant corresponding to a given APValue.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl * > &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
CanQualType SatLongFractTy
const TargetInfo & getTargetInfo() const
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
CanQualType SatShortAccumTy
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
CanQualType IncompleteMatrixIdxTy
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
CanQualType getNSIntegerType() const
QualType getCorrespondingUnsignedType(QualType T) const
void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)
Set the copy initialization expression of a block var decl.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
TargetCXXABI::Kind getCXXABIKind() const
Return the C++ ABI kind that should be used.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
BuiltinTemplateDecl * getTypePackElementDecl() const
CanQualType SatUnsignedLongAccumTy
QualType getUnconstrainedType(QualType T) const
Remove any type constraints from a template parameter type, for equivalence comparison of template pa...
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getCorrespondingSignedType(QualType T) const
QualType mergeObjCGCQualifiers(QualType, QualType)
mergeObjCGCQualifiers - This routine merges ObjC's GC attribute of 'LHS' and 'RHS' attributes and ret...
llvm::DenseMap< const Decl *, const Decl * > CommentlessRedeclChains
Keeps track of redeclaration chains that don't have any comment attached.
uint64_t getArrayInitLoopExprElementCount(const ArrayInitLoopExpr *AILE) const
Return number of elements initialized in an ArrayInitLoopExpr.
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
unsigned getTargetAddressSpace(LangAS AS) const
QualType getWideCharType() const
Return the type of wide characters.
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
void addTranslationUnitDecl()
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it.
bool isPromotableIntegerType(QualType T) const
More type predicates useful for type checking/promotion.
llvm::DenseMap< const Decl *, const Decl * > RedeclChainComments
Mapping from canonical declaration to the first redeclaration in chain that has a comment attached.
CanQualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Underlying=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Retrieve a substitution-result type.
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
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const
C23 feature and GCC extension.
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
bool hasCvrSimilarType(QualType T1, QualType T2)
Determine if two types are similar, ignoring only CVR qualifiers.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or nullptr if none exists.
CanQualType UnsignedAccumTy
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
void setCFConstantStringType(QualType T)
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
void AddDeallocation(void(*Callback)(void *), void *Data) const
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
CXXMethodVector::const_iterator overridden_cxx_method_iterator
RawComment * getRawCommentForDeclNoCacheImpl(const Decl *D, const SourceLocation RepresentativeLocForDecl, const std::map< unsigned, RawComment * > &CommentsInFile) const
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeTransparentUnionType - if T is a transparent union type and a member of T is compatible with Sub...
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
bool isSentinelNullExpr(const Expr *E)
CanQualType getNSUIntegerType() const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getBitIntType(bool Unsigned, unsigned NumBits) const
Return a bit-precise integer type with the specified signedness and bit count.
unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
virtual void AddedStaticLocalNumbers(const Decl *D, unsigned Number)
An static local number was added to a Decl.
virtual ~ASTMutationListener()
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
virtual void AddedManglingNumber(const Decl *D, unsigned Number)
An mangling number was added to a Decl.
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
const CXXRecordDecl * getBaseSharingVBPtr() const
CharUnits getSize() const
getSize - Get the record size in characters.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
CharUnits getDataSize() const
getDataSize() - Get the record data size, which is the record size without tail padding,...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
CharUnits getUnadjustedAlignment() const
getUnadjustedAlignment - Get the record alignment in characters, before alignment adjustement.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a loop initializing the elements of an array.
llvm::APInt getArraySize() const
Expr * getSubExpr() const
Get the initializer to use for each array element.
Represents a constant array type that does not decay to a pointer when used as a function parameter.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
A structure for storing the information associated with a name that has been assumed to be a template...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
void Profile(llvm::FoldingSetNodeID &ID)
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
bool isConstrained() const
void Profile(llvm::FoldingSetNodeID &ID)
A fixed int type of a specified bitwidth.
void Profile(llvm::FoldingSetNodeID &ID) const
unsigned getNumBits() const
Represents a block literal declaration, which is like an unnamed FunctionDecl.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
This class is used for builtin types like 'int'.
StringRef getName(const PrintingPolicy &Policy) const
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
bool hasCustomTypechecking(unsigned ID) const
Determines whether this builtin has custom typechecking.
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
Implements C++ ABI-specific semantic analysis functions.
Represents a C++ constructor within a class.
Represents a static or instance method of a struct/union/class.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a C++ struct/union/class.
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 isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
const DeclContext * getParentFunctionOrMethod(bool LexicalParent=false) const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
unsigned getMaxAlignment() const
getMaxAlignment - return the maximum alignment specified by attributes on this decl,...
static Decl * castFromDeclContext(const DeclContext *)
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
bool isInvalidDecl() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
SourceLocation getLocation() const
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack.
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
SourceLocation getBeginLoc() const LLVM_READONLY
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
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)
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Represents an extended address space qualifier where the input address space value is dependent.
Expr * getAddrSpaceExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Internal representation of canonical, dependent decltype(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a qualified type name for which the type name is dependent.
void Profile(llvm::FoldingSetNodeID &ID)
Represents an array type in C++ whose size is a value-dependent expression.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Expr * getSizeExpr() const
Represents an extended vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Expr * getRowExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a dependent template name that cannot be resolved prior to template instantiation.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a template specialization type whose template cannot be resolved, e.g.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Internal representation of canonical, dependent typeof(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
void Profile(llvm::FoldingSetNodeID &ID)
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
bool isComplete() const
Returns true if this can be considered a complete type.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
EnumDecl * getDecl() const
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
void Profile(llvm::FoldingSetNodeID &ID) const
ExtVectorType - Extended vector type.
Declaration context for names declared as extern "C" in C++.
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
Abstract interface for external sources of AST nodes.
virtual ExtKind hasExternalDefinitions(const Decl *D)
virtual void ReadComments()
Loads comment ranges.
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration.
virtual void PrintStats()
Print any statistics that have been gathered regarding the external AST source.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
unsigned getBitWidthValue(const ASTContext &Ctx) const
Computes the bit width of this field, if this is a bit field.
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a function declaration or definition.
bool isMultiVersion() const
True if this function is considered a multiversioned function.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization,...
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
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
const Decl * getDecl() const
One of these records is kept for each identifier that is lexed.
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.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
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.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
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.
const ObjCInterfaceDecl * getClassInterface() const
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 getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool isConstQualified() const
Determine whether this type is const-qualified.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
const Type * getTypePtrOrNull() const
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name that was expressed as a qualified name.
void Profile(llvm::FoldingSetNodeID &ID)
A qualifier set is used to build a set of qualifiers.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeCVRQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
void removeFastQualifiers(unsigned mask)
bool hasUnaligned() const
bool hasAddressSpace() const
unsigned getFastQualifiers() const
void removeAddressSpace()
void setAddressSpace(LangAS space)
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
bool hasObjCGCAttr() const
uint64_t getAsOpaqueValue() const
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
void addObjCGCAttr(GC type)
LangAS getAddressSpace() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
bool hasFlexibleArrayMember() const
field_range fields() const
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
virtual void completeDefinition()
Note that the definition of this type is now complete.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
This table allows us to fully hide how we implement multi-keyword caching.
std::string getAsString() const
Derive the full selector name (e.g.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
DiagnosticsEngine & getDiagnostics() const
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID.
unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid=nullptr) const
Given a SourceLocation, return the spelling line number for the position indicated.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
StringLiteral - This represents a string literal expression, e.g.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringLiteralKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
A structure for storing an already-substituted template template parameter pack.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
A structure for storing the information associated with a substituted template template parameter.
TemplateName getReplacement() const
void Profile(llvm::FoldingSetNodeID &ID)
TemplateTemplateParmDecl * getParameter() const
Represents the result of substituting a set of types for a template type parameter pack.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the declaration of a struct/union/class/enum.
void startDefinition()
Starts the definition of this tag declaration.
TagDecl * getDecl() const
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Kind
The basic C++ ABI kind.
static Kind getKind(StringRef Name)
Exposes information about the current target.
TargetOptions & getTargetOpts() const
Retrieve the target options.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
IntType getInt64Type() const
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
unsigned getBFloat16Width() const
getBFloat16Width/Align/Format - Return the size/align/format of '__bf16'.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
@ AArch64ABIBuiltinVaList
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com....
@ PNaClABIBuiltinVaList
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
@ PowerABIBuiltinVaList
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
@ AAPCSABIBuiltinVaList
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
@ X86_64ABIBuiltinVaList
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0....
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
uint64_t getPointerWidth(LangAS AddrSpace) const
Return the width of pointers on this target, for the specified address space.
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
unsigned getHalfAlign() const
unsigned getBFloat16Align() const
FloatModeKind getRealTypeByWidth(unsigned BitWidth, FloatModeKind ExplicitType) const
Return floating point type with specified width.
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
unsigned getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of 'half'.
unsigned getMaxAlignedAttribute() const
Get the maximum alignment in bits for a static variable with aligned attribute.
virtual unsigned getMinGlobalAlign(uint64_t Size, bool HasNonWeakDef) const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
unsigned getTargetAddressSpace(LangAS AS) const
unsigned getFloat128Width() const
getFloat128Width/Align/Format - Return the size/align/format of '__float128'.
const llvm::fltSemantics & getLongDoubleFormat() const
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target,...
unsigned getFloat128Align() const
virtual bool hasBFloat16Type() const
Determine whether the _BFloat16 type is supported on this target.
const llvm::fltSemantics & getFloat128Format() const
unsigned getLongDoubleWidth() const
getLongDoubleWidth/Align/Format - Return the size/align/format of 'long double'.
unsigned getLongDoubleAlign() const
virtual std::optional< std::pair< unsigned, unsigned > > getVScaleRange(const LangOptions &LangOpts) const
Returns target-specific min and max values VScale_Range.
llvm::StringMap< bool > FeatureMap
The map of which features have been enabled disabled based on the command line.
A convenient class for passing around template argument information.
SourceLocation getRAngleLoc() const
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
SourceLocation getLAngleLoc() const
A template argument list.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
std::optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce,...
QualType getAsType() const
Retrieve the type for a type template argument.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
QualType getIntegralType() const
Retrieve the type of the integral value.
bool getIsDefaulted() const
If returns 'true', this TemplateArgument corresponds to a default template parameter.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
A template parameter object.
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, const APValue &V)
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
unsigned getNumArgs() const
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, bool Typename, TemplateParameterList *Params)
Declaration of a template type parameter.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > NumExpanded=std::nullopt)
void Profile(llvm::FoldingSetNodeID &ID)
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
ConceptDecl * getNamedConcept() const
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
ConceptReference * getConceptReference() const
Represents a declaration of a type.
void setTypeForDecl(const Type *TD)
const Type * getTypeForDecl() const
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isBooleanType() const
bool 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 isPointerType() const
bool isArrayParameterType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
const T * castAs() const
Member-template castAs<specific type>.
bool isSpecificPlaceholderType(unsigned K) const
Test for a specific placeholder type.
bool isSignedFixedPointType() const
Return true if this is a fixed point type that is signed according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isEnumeralType() const
bool isSveVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'arm_sve_vector_bits' type attribute,...
bool isObjCQualifiedIdType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
bool hasUnsignedIntegerRepresentation() const
Determine whether this type has an unsigned integer representation of some sort, e....
QualType getSveEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an SVE builtin type.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type.
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
bool isBitIntType() const
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
bool isBuiltinType() const
Helper methods to distinguish type categories.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g....
QualType getCanonicalTypeInternal() const
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
bool isMemberPointerType() const
bool isObjCIdType() const
bool isUnsaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type.
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types,...
bool isFunctionType() const
bool isObjCObjectPointerType() const
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isVectorType() const
bool isObjCClassType() const
bool isRVVVLSBuiltinType() const
Determines if this is a sizeless type supported by the 'riscv_rvv_vector_bits' type attribute,...
bool isRVVSizelessBuiltinType() const
Returns true for RVV scalable vector types.
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
bool isAnyPointerType() const
TypeClass getTypeClass() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
const T * getAs() const
Member-template getAs<specific type>'.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs,...
bool isNullPtrType() const
bool isRecordType() const
bool isObjCRetainableType() const
std::optional< NullabilityKind > getNullability() const
Determine the nullability of the given type.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
void setTypeSourceInfo(TypeSourceInfo *newType)
void Profile(llvm::FoldingSetNodeID &ID)
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Ty, const APValue &APVal)
The iterator over UnresolvedSets.
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a dependent using declaration which was marked with typename.
Represents a C++ using-enum-declaration.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
void Profile(llvm::FoldingSetNodeID &ID)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr.
Represents a variable declaration or definition.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member.
bool isStaticDataMember() const
Determines whether this is a static data member.
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization,...
bool isInline() const
Whether this variable is (C++1z) inline.
@ DeclarationOnly
This declaration is only a declaration.
DefinitionKind hasDefinition(ASTContext &) const
Check whether this variable is defined in this translation unit.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getSizeExpr() const
Represents a GCC generic vector type.
unsigned getNumElements() const
void Profile(llvm::FoldingSetNodeID &ID)
VectorKind getVectorKind() const
QualType getElementType() const
Holds all information required to evaluate constexpr code in a module.
Defines the Linkage enumeration and various utility functions.
Defines the clang::TargetInfo interface.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
The JSON file list parser is used to communicate input to InstallAPI.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
GVALinkage
A more specific kind of linkage than enum Linkage.
@ GVA_AvailableExternally
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenCLTypeKind
OpenCL type kinds.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
@ ICIS_NoInit
No in-class initializer.
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
TypeOfKind
The kind of 'typeof' expression we're after.
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
@ Result
The result type of a method or function.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
bool isDiscardableGVALinkage(GVALinkage L)
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.
LangAS
Defines the address space values used by the address space qualifier of QualType.
TranslationUnitKind
Describes the kind of translation unit being processed.
bool isPtrSizeAddressSpace(LangAS AS)
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, const TemplateParameterList *TPL=nullptr)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ Invariant
The parameter is invariant: must match exactly.
@ Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X when the type parameter is covariant and...
@ Covariant
The parameter is covariant, e.g., X<T> is a subtype of X when the type parameter is covariant and T i...
@ AltiVecBool
is AltiVec 'vector bool ...'
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ Generic
not a target-specific vector type
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
LangAS getLangASFromTargetAS(unsigned TargetAS)
@ None
The alignment was not explicit in code.
@ RequiredByEnum
The alignment comes from an alignment attribute on a enum type.
@ RequiredByTypedef
The alignment comes from an alignment attribute on a typedef.
@ RequiredByRecord
The alignment comes from an alignment attribute on a record type.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Expr * getCopyExpr() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
Holds information about the various types of exception specification.
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
bool requiresFunctionProtoTypeArmAttributes() const
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