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) {
718 QualType T = NTTP->getExpansionType(I);
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 CanonTemplateTemplateParms(this_()), SourceMgr(
SM), LangOpts(LOpts),
885 LangOpts.XRayNeverInstrumentFiles,
886 LangOpts.XRayAttrListFiles,
SM)),
889 BuiltinInfo(builtins), TUKind(TUKind), DeclarationNames(*this),
890 Comments(
SM), CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
891 CompCategories(this_()), LastSDM(nullptr, 0) {
898 ReleaseDeclContextMaps();
901 for (
auto &Pair : Deallocations)
902 (Pair.first)(Pair.second);
903 Deallocations.clear();
909 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
915 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
916 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
921 ASTRecordLayouts.clear();
923 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
924 AEnd = DeclAttrs.end();
926 A->second->~AttrVec();
929 for (
const auto &
Value : ModuleInitializers)
930 Value.second->~PerModuleInitializers();
931 ModuleInitializers.
clear();
937 TraversalScope = TopLevelDecls;
942 Deallocations.push_back({Callback,
Data});
951 llvm::errs() <<
"\n*** AST Context Stats:\n";
952 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
954 unsigned counts[] = {
955#define TYPE(Name, Parent) 0,
956#define ABSTRACT_TYPE(Name, Parent)
957#include "clang/AST/TypeNodes.inc"
961 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
967 unsigned TotalBytes = 0;
968#define TYPE(Name, Parent) \
970 llvm::errs() << " " << counts[Idx] << " " << #Name \
971 << " types, " << sizeof(Name##Type) << " each " \
972 << "(" << counts[Idx] * sizeof(Name##Type) \
974 TotalBytes += counts[Idx] * sizeof(Name##Type); \
976#define ABSTRACT_TYPE(Name, Parent)
977#include "clang/AST/TypeNodes.inc"
979 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
984 <<
" implicit default constructors created\n";
987 <<
" implicit copy constructors created\n";
991 <<
" implicit move constructors created\n";
994 <<
" implicit copy assignment operators created\n";
998 <<
" implicit move assignment operators created\n";
1001 <<
" implicit destructors created\n";
1004 llvm::errs() <<
"\n";
1008 BumpAlloc.PrintStats();
1012 bool NotifyListeners) {
1013 if (NotifyListeners)
1022 if (It == MergedDefModules.end())
1025 auto &Merged = It->second;
1027 for (
Module *&M : Merged)
1028 if (!Found.insert(M).second)
1030 llvm::erase(Merged,
nullptr);
1037 if (MergedIt == MergedDefModules.end())
1038 return std::nullopt;
1039 return MergedIt->second;
1042void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1043 if (LazyInitializers.empty())
1047 assert(Source &&
"lazy initializers but no external source");
1049 auto LazyInits = std::move(LazyInitializers);
1050 LazyInitializers.clear();
1052 for (
auto ID : LazyInits)
1053 Initializers.push_back(Source->GetExternalDecl(ID));
1055 assert(LazyInitializers.empty() &&
1056 "GetExternalDecl for lazy module initializer added more inits");
1062 if (
const auto *ID = dyn_cast<ImportDecl>(D)) {
1063 auto It = ModuleInitializers.find(ID->getImportedModule());
1066 if (It == ModuleInitializers.end())
1070 auto &Imported = *It->second;
1071 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1072 Imported.resolve(*
this);
1073 auto *OnlyDecl = Imported.Initializers.front();
1074 if (isa<ImportDecl>(OnlyDecl))
1079 auto *&Inits = ModuleInitializers[M];
1081 Inits =
new (*this) PerModuleInitializers;
1082 Inits->Initializers.push_back(D);
1086 auto *&Inits = ModuleInitializers[M];
1088 Inits =
new (*this) PerModuleInitializers;
1089 Inits->LazyInitializers.insert(Inits->LazyInitializers.end(),
1090 IDs.begin(), IDs.end());
1094 auto It = ModuleInitializers.find(M);
1095 if (It == ModuleInitializers.end())
1096 return std::nullopt;
1098 auto *Inits = It->second;
1099 Inits->resolve(*
this);
1100 return Inits->Initializers;
1105 assert(!CurrentCXXNamedModule &&
1106 "We should set named module for ASTContext for only once");
1107 CurrentCXXNamedModule = M;
1111 if (!ExternCContext)
1114 return ExternCContext;
1120 auto *BuiltinTemplate =
1122 BuiltinTemplate->setImplicit();
1125 return BuiltinTemplate;
1130 if (!MakeIntegerSeqDecl)
1133 return MakeIntegerSeqDecl;
1138 if (!TypePackElementDecl)
1141 return TypePackElementDecl;
1155 NewDecl->
addAttr(TypeVisibilityAttr::CreateImplicit(
1156 const_cast<ASTContext &
>(*
this), TypeVisibilityAttr::Default));
1161 StringRef Name)
const {
1185 Types.push_back(Ty);
1190 assert((!this->Target || this->Target == &
Target) &&
1191 "Incorrect target reinitialization");
1195 this->AuxTarget = AuxTarget;
1197 ABI.reset(createCXXABI(
Target));
1201 InitBuiltinType(
VoidTy, BuiltinType::Void);
1204 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1206 if (LangOpts.CharIsSigned)
1207 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1209 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1212 InitBuiltinType(
ShortTy, BuiltinType::Short);
1213 InitBuiltinType(
IntTy, BuiltinType::Int);
1214 InitBuiltinType(
LongTy, BuiltinType::Long);
1215 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1225 InitBuiltinType(
FloatTy, BuiltinType::Float);
1226 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1227 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1230 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1233 InitBuiltinType(
Ibm128Ty, BuiltinType::Ibm128);
1236 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1239 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1240 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1241 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1245 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1246 InitBuiltinType(
FractTy, BuiltinType::Fract);
1247 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1252 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1258 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1265 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1270 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1272 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1273 if (LangOpts.CPlusPlus && LangOpts.WChar)
1283 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1285 if (LangOpts.CPlusPlus)
1286 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1290 if (LangOpts.CPlusPlus)
1291 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1300 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1303 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1312 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1318 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1321 if (LangOpts.OpenMP) {
1327 if (LangOpts.OpenACC) {
1333 if (LangOpts.MatrixTypes)
1341 if (LangOpts.OpenCL) {
1342#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1343 InitBuiltinType(SingletonId, BuiltinType::Id);
1344#include "clang/Basic/OpenCLImageTypes.def"
1346 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1347 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1349 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1352#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
1353 InitBuiltinType(Id##Ty, BuiltinType::Id);
1354#include "clang/Basic/OpenCLExtensionTypes.def"
1357 if (
Target.hasAArch64SVETypes()) {
1358#define SVE_TYPE(Name, Id, SingletonId) \
1359 InitBuiltinType(SingletonId, BuiltinType::Id);
1360#include "clang/Basic/AArch64SVEACLETypes.def"
1363 if (
Target.getTriple().isPPC64()) {
1364#define PPC_VECTOR_MMA_TYPE(Name, Id, Size) \
1365 InitBuiltinType(Id##Ty, BuiltinType::Id);
1366#include "clang/Basic/PPCTypes.def"
1367#define PPC_VECTOR_VSX_TYPE(Name, Id, Size) \
1368 InitBuiltinType(Id##Ty, BuiltinType::Id);
1369#include "clang/Basic/PPCTypes.def"
1372 if (
Target.hasRISCVVTypes()) {
1373#define RVV_TYPE(Name, Id, SingletonId) \
1374 InitBuiltinType(SingletonId, BuiltinType::Id);
1375#include "clang/Basic/RISCVVTypes.def"
1378 if (
Target.getTriple().isWasm() &&
Target.hasFeature(
"reference-types")) {
1379#define WASM_TYPE(Name, Id, SingletonId) \
1380 InitBuiltinType(SingletonId, BuiltinType::Id);
1381#include "clang/Basic/WebAssemblyReferenceTypes.def"
1388 ObjCConstantStringType =
QualType();
1393 if (LangOpts.OpenCLGenericAddressSpace) {
1403 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1406 InitBuiltinType(
HalfTy, BuiltinType::Half);
1408 InitBuiltinType(
BFloat16Ty, BuiltinType::BFloat16);
1414 if (LangOpts.MicrosoftExt || LangOpts.Borland) {
1436 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1437 if (Pos != DeclAttrs.end()) {
1438 Pos->second->~AttrVec();
1439 DeclAttrs.erase(Pos);
1453 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1454 TemplateOrInstantiation.find(Var);
1455 if (Pos == TemplateOrInstantiation.end())
1468 Tmpl, TSK, PointOfInstantiation));
1474 assert(!TemplateOrInstantiation[Inst] &&
1475 "Already noted what the variable was instantiated from");
1476 TemplateOrInstantiation[Inst] = TSI;
1481 return InstantiatedFromUsingDecl.lookup(UUD);
1486 assert((isa<UsingDecl>(Pattern) ||
1487 isa<UnresolvedUsingValueDecl>(Pattern) ||
1488 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1489 "pattern decl is not a using decl");
1490 assert((isa<UsingDecl>(Inst) ||
1491 isa<UnresolvedUsingValueDecl>(Inst) ||
1492 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1493 "instantiation did not produce a using decl");
1494 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1495 InstantiatedFromUsingDecl[Inst] = Pattern;
1500 return InstantiatedFromUsingEnumDecl.lookup(UUD);
1505 assert(!InstantiatedFromUsingEnumDecl[Inst] &&
"pattern already exists");
1506 InstantiatedFromUsingEnumDecl[Inst] = Pattern;
1511 return InstantiatedFromUsingShadowDecl.lookup(Inst);
1517 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1518 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1522 return InstantiatedFromUnnamedFieldDecl.lookup(Field);
1527 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1528 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1529 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1530 "Already noted what unnamed field was instantiated from");
1532 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1548 return Range.end() - Range.begin();
1553 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1555 if (Pos == OverriddenMethods.end())
1563 OverriddenMethods[Method].push_back(Overridden);
1571 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1577 const auto *Method = dyn_cast<ObjCMethodDecl>(D);
1582 Method->getOverriddenMethods(OverDecls);
1583 Overridden.append(OverDecls.begin(), OverDecls.end());
1587 assert(!Import->getNextLocalImport() &&
1588 "Import declaration already in the chain");
1589 assert(!Import->isFromASTFile() &&
"Non-local import declaration");
1590 if (!FirstLocalImport) {
1591 FirstLocalImport = Import;
1592 LastLocalImport = Import;
1596 LastLocalImport->setNextLocalImport(Import);
1597 LastLocalImport = Import;
1609 llvm_unreachable(
"Not a floating point type!");
1610 case BuiltinType::BFloat16:
1611 return Target->getBFloat16Format();
1612 case BuiltinType::Float16:
1613 return Target->getHalfFormat();
1614 case BuiltinType::Half:
1619 return Target->getHalfFormat();
1621 return Target->getFloatFormat();
1623 return Target->getHalfFormat();
1624 case BuiltinType::Float:
return Target->getFloatFormat();
1625 case BuiltinType::Double:
return Target->getDoubleFormat();
1626 case BuiltinType::Ibm128:
1627 return Target->getIbm128Format();
1628 case BuiltinType::LongDouble:
1631 return Target->getLongDoubleFormat();
1632 case BuiltinType::Float128:
1635 return Target->getFloat128Format();
1640 unsigned Align =
Target->getCharWidth();
1644 Align = AlignFromAttr;
1652 bool UseAlignAttrOnly;
1653 if (
const FieldDecl *FD = dyn_cast<FieldDecl>(D))
1655 FD->hasAttr<PackedAttr>() || FD->getParent()->hasAttr<PackedAttr>();
1657 UseAlignAttrOnly = AlignFromAttr != 0;
1660 if (UseAlignAttrOnly) {
1662 }
else if (
const auto *VD = dyn_cast<ValueDecl>(D)) {
1677 unsigned MinWidth =
Target->getLargeArrayMinWidth();
1678 if (!ForAlignof && MinWidth) {
1680 Align = std::max(Align,
Target->getLargeArrayAlign());
1681 else if (isa<ConstantArrayType>(
arrayType) &&
1683 Align = std::max(Align,
Target->getLargeArrayAlign());
1688 Align =
Target->getCharWidth();
1692 if (
const auto *VD = dyn_cast<VarDecl>(D))
1693 if (VD->hasGlobalStorage() && !ForAlignof) {
1704 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1707 if (!
Parent->isInvalidDecl()) {
1718 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1719 if (LowBitOfOffset < FieldAlign)
1720 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1723 Align = std::min(Align, FieldAlign);
1731 const auto *VD = dyn_cast<VarDecl>(D);
1732 if (MaxAlignedAttr && VD && VD->getStorageClass() ==
SC_Static)
1733 Align = std::min(Align, MaxAlignedAttr);
1769 uint64_t Size = CAT->
getSize().getZExtValue();
1771 (uint64_t)(-1)/Size) &&
1772 "Overflow in array type char size evaluation");
1777 Width = llvm::alignTo(Width, Align);
1784 if (
const auto *CAT = dyn_cast<ConstantArrayType>(T))
1802 switch (BT->getKind()) {
1803 case BuiltinType::Bool:
1804 case BuiltinType::Char_S:
1805 case BuiltinType::Char_U:
1806 case BuiltinType::SChar:
1807 case BuiltinType::UChar:
1808 case BuiltinType::Short:
1809 case BuiltinType::UShort:
1810 case BuiltinType::WChar_S:
1811 case BuiltinType::WChar_U:
1812 case BuiltinType::Char8:
1813 case BuiltinType::Char16:
1814 case BuiltinType::Char32:
1823 if (T->
isDependentType() || ET->getDecl()->getPromotionType().isNull() ||
1824 ET->getDecl()->isScoped())
1842 bool NeedsPreferredAlignment)
const {
1845 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1856 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1861 return TT->getDecl()->getMaxAlignment();
1867 TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
1868 if (I != MemoizedTypeInfo.end())
1873 MemoizedTypeInfo[T] = TI;
1883TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
1889#define TYPE(Class, Base)
1890#define ABSTRACT_TYPE(Class, Base)
1891#define NON_CANONICAL_TYPE(Class, Base)
1892#define DEPENDENT_TYPE(Class, Base) case Type::Class:
1893#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \
1895 assert(!T->isDependentType() && "should not see dependent types here"); \
1896 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr());
1897#include "clang/AST/TypeNodes.inc"
1898 llvm_unreachable(
"Should not see dependent types");
1900 case Type::FunctionNoProto:
1901 case Type::FunctionProto:
1907 case Type::IncompleteArray:
1908 case Type::VariableArray:
1909 case Type::ConstantArray: {
1912 if (
const auto *CAT = dyn_cast<ConstantArrayType>(T))
1913 Size = CAT->getSize().getZExtValue();
1916 assert((Size == 0 || EltInfo.
Width <= (uint64_t)(-1) / Size) &&
1917 "Overflow in array type bit size evaluation");
1918 Width = EltInfo.
Width * Size;
1919 Align = EltInfo.
Align;
1923 Width = llvm::alignTo(Width, Align);
1927 case Type::ExtVector:
1928 case Type::Vector: {
1929 const auto *VT = cast<VectorType>(T);
1931 Width = VT->isExtVectorBoolType() ? VT->getNumElements()
1932 : EltInfo.
Width * VT->getNumElements();
1934 Width = std::max<unsigned>(8, Width);
1935 Align = std::max<unsigned>(8, Width);
1939 if (Align & (Align-1)) {
1940 Align = llvm::bit_ceil(Align);
1941 Width = llvm::alignTo(Width, Align);
1945 if (TargetVectorAlign && TargetVectorAlign < Align)
1946 Align = TargetVectorAlign;
1957 Align = std::min<unsigned>(64, Width);
1961 case Type::ConstantMatrix: {
1962 const auto *MT = cast<ConstantMatrixType>(T);
1967 Width = ElementInfo.
Width * MT->getNumRows() * MT->getNumColumns();
1968 Align = ElementInfo.
Align;
1973 switch (cast<BuiltinType>(T)->
getKind()) {
1974 default: llvm_unreachable(
"Unknown builtin type!");
1975 case BuiltinType::Void:
1980 case BuiltinType::Bool:
1981 Width =
Target->getBoolWidth();
1982 Align =
Target->getBoolAlign();
1984 case BuiltinType::Char_S:
1985 case BuiltinType::Char_U:
1986 case BuiltinType::UChar:
1987 case BuiltinType::SChar:
1988 case BuiltinType::Char8:
1989 Width =
Target->getCharWidth();
1990 Align =
Target->getCharAlign();
1992 case BuiltinType::WChar_S:
1993 case BuiltinType::WChar_U:
1994 Width =
Target->getWCharWidth();
1995 Align =
Target->getWCharAlign();
1997 case BuiltinType::Char16:
1998 Width =
Target->getChar16Width();
1999 Align =
Target->getChar16Align();
2001 case BuiltinType::Char32:
2002 Width =
Target->getChar32Width();
2003 Align =
Target->getChar32Align();
2005 case BuiltinType::UShort:
2006 case BuiltinType::Short:
2007 Width =
Target->getShortWidth();
2008 Align =
Target->getShortAlign();
2010 case BuiltinType::UInt:
2011 case BuiltinType::Int:
2012 Width =
Target->getIntWidth();
2013 Align =
Target->getIntAlign();
2015 case BuiltinType::ULong:
2016 case BuiltinType::Long:
2017 Width =
Target->getLongWidth();
2018 Align =
Target->getLongAlign();
2020 case BuiltinType::ULongLong:
2021 case BuiltinType::LongLong:
2022 Width =
Target->getLongLongWidth();
2023 Align =
Target->getLongLongAlign();
2025 case BuiltinType::Int128:
2026 case BuiltinType::UInt128:
2028 Align =
Target->getInt128Align();
2030 case BuiltinType::ShortAccum:
2031 case BuiltinType::UShortAccum:
2032 case BuiltinType::SatShortAccum:
2033 case BuiltinType::SatUShortAccum:
2034 Width =
Target->getShortAccumWidth();
2035 Align =
Target->getShortAccumAlign();
2037 case BuiltinType::Accum:
2038 case BuiltinType::UAccum:
2039 case BuiltinType::SatAccum:
2040 case BuiltinType::SatUAccum:
2041 Width =
Target->getAccumWidth();
2042 Align =
Target->getAccumAlign();
2044 case BuiltinType::LongAccum:
2045 case BuiltinType::ULongAccum:
2046 case BuiltinType::SatLongAccum:
2047 case BuiltinType::SatULongAccum:
2048 Width =
Target->getLongAccumWidth();
2049 Align =
Target->getLongAccumAlign();
2051 case BuiltinType::ShortFract:
2052 case BuiltinType::UShortFract:
2053 case BuiltinType::SatShortFract:
2054 case BuiltinType::SatUShortFract:
2055 Width =
Target->getShortFractWidth();
2056 Align =
Target->getShortFractAlign();
2058 case BuiltinType::Fract:
2059 case BuiltinType::UFract:
2060 case BuiltinType::SatFract:
2061 case BuiltinType::SatUFract:
2062 Width =
Target->getFractWidth();
2063 Align =
Target->getFractAlign();
2065 case BuiltinType::LongFract:
2066 case BuiltinType::ULongFract:
2067 case BuiltinType::SatLongFract:
2068 case BuiltinType::SatULongFract:
2069 Width =
Target->getLongFractWidth();
2070 Align =
Target->getLongFractAlign();
2072 case BuiltinType::BFloat16:
2073 if (
Target->hasBFloat16Type()) {
2074 Width =
Target->getBFloat16Width();
2075 Align =
Target->getBFloat16Align();
2084 case BuiltinType::Float16:
2085 case BuiltinType::Half:
2088 Width =
Target->getHalfWidth();
2089 Align =
Target->getHalfAlign();
2092 "Expected OpenMP device compilation.");
2097 case BuiltinType::Float:
2098 Width =
Target->getFloatWidth();
2099 Align =
Target->getFloatAlign();
2101 case BuiltinType::Double:
2102 Width =
Target->getDoubleWidth();
2103 Align =
Target->getDoubleAlign();
2105 case BuiltinType::Ibm128:
2106 Width =
Target->getIbm128Width();
2107 Align =
Target->getIbm128Align();
2109 case BuiltinType::LongDouble:
2116 Width =
Target->getLongDoubleWidth();
2117 Align =
Target->getLongDoubleAlign();
2120 case BuiltinType::Float128:
2123 Width =
Target->getFloat128Width();
2124 Align =
Target->getFloat128Align();
2127 "Expected OpenMP device compilation.");
2132 case BuiltinType::NullPtr:
2137 case BuiltinType::ObjCId:
2138 case BuiltinType::ObjCClass:
2139 case BuiltinType::ObjCSel:
2143 case BuiltinType::OCLSampler:
2144 case BuiltinType::OCLEvent:
2145 case BuiltinType::OCLClkEvent:
2146 case BuiltinType::OCLQueue:
2147 case BuiltinType::OCLReserveID:
2148#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2149 case BuiltinType::Id:
2150#include "clang/Basic/OpenCLImageTypes.def"
2151#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2152 case BuiltinType::Id:
2153#include "clang/Basic/OpenCLExtensionTypes.def"
2155 Width =
Target->getPointerWidth(AS);
2156 Align =
Target->getPointerAlign(AS);
2166#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId, NumEls, ElBits, \
2167 IsSigned, IsFP, IsBF) \
2168 case BuiltinType::Id: \
2172#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId, NumEls) \
2173 case BuiltinType::Id: \
2177#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2178 case BuiltinType::Id: \
2182#include "clang/Basic/AArch64SVEACLETypes.def"
2183#define PPC_VECTOR_TYPE(Name, Id, Size) \
2184 case BuiltinType::Id: \
2188#include "clang/Basic/PPCTypes.def"
2189#define RVV_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, NF, IsSigned, \
2191 case BuiltinType::Id: \
2195#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) \
2196 case BuiltinType::Id: \
2200#include "clang/Basic/RISCVVTypes.def"
2201#define WASM_TYPE(Name, Id, SingletonId) \
2202 case BuiltinType::Id: \
2206#include "clang/Basic/WebAssemblyReferenceTypes.def"
2209 case Type::ObjCObjectPointer:
2213 case Type::BlockPointer:
2214 AS = cast<BlockPointerType>(T)->getPointeeType().getAddressSpace();
2215 Width =
Target->getPointerWidth(AS);
2216 Align =
Target->getPointerAlign(AS);
2218 case Type::LValueReference:
2219 case Type::RValueReference:
2222 AS = cast<ReferenceType>(T)->getPointeeType().getAddressSpace();
2223 Width =
Target->getPointerWidth(AS);
2224 Align =
Target->getPointerAlign(AS);
2227 AS = cast<PointerType>(T)->getPointeeType().getAddressSpace();
2228 Width =
Target->getPointerWidth(AS);
2229 Align =
Target->getPointerAlign(AS);
2231 case Type::MemberPointer: {
2232 const auto *MPT = cast<MemberPointerType>(T);
2238 case Type::Complex: {
2242 Width = EltInfo.
Width * 2;
2243 Align = EltInfo.
Align;
2246 case Type::ObjCObject:
2247 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr());
2248 case Type::Adjusted:
2251 case Type::ObjCInterface: {
2252 const auto *ObjCI = cast<ObjCInterfaceType>(T);
2253 if (ObjCI->getDecl()->isInvalidDecl()) {
2263 case Type::BitInt: {
2264 const auto *EIT = cast<BitIntType>(T);
2265 Align = std::clamp<unsigned>(llvm::PowerOf2Ceil(EIT->getNumBits()),
2267 Width = llvm::alignTo(EIT->getNumBits(), Align);
2272 const auto *TT = cast<TagType>(T);
2274 if (TT->getDecl()->isInvalidDecl()) {
2280 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
2281 const EnumDecl *ED = ET->getDecl();
2285 Info.
Align = AttrAlign;
2291 const auto *RT = cast<RecordType>(TT);
2296 AlignRequirement = RD->
hasAttr<AlignedAttr>()
2302 case Type::SubstTemplateTypeParm:
2303 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
2304 getReplacementType().getTypePtr());
2307 case Type::DeducedTemplateSpecialization: {
2308 const auto *A = cast<DeducedType>(T);
2309 assert(!A->getDeducedType().isNull() &&
2310 "cannot request the size of an undeduced or dependent auto type");
2311 return getTypeInfo(A->getDeducedType().getTypePtr());
2315 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr());
2317 case Type::MacroQualified:
2321 case Type::ObjCTypeParam:
2322 return getTypeInfo(cast<ObjCTypeParamType>(T)->desugar().getTypePtr());
2325 return getTypeInfo(cast<UsingType>(T)->desugar().getTypePtr());
2327 case Type::Typedef: {
2328 const auto *TT = cast<TypedefType>(T);
2333 if (
unsigned AttrAlign = TT->getDecl()->getMaxAlignment()) {
2344 case Type::Elaborated:
2345 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
2347 case Type::Attributed:
2349 cast<AttributedType>(T)->getEquivalentType().getTypePtr());
2351 case Type::BTFTagAttributed:
2353 cast<BTFTagAttributedType>(T)->getWrappedType().getTypePtr());
2355 case Type::Atomic: {
2364 Width =
Target->getCharWidth();
2366 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2372 Width = llvm::bit_ceil(Width);
2375 Align =
static_cast<unsigned>(Width);
2386 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2387 return TypeInfo(Width, Align, AlignRequirement);
2391 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(T);
2392 if (I != MemoizedUnadjustedAlign.end())
2395 unsigned UnadjustedAlign;
2407 MemoizedUnadjustedAlign[T] = UnadjustedAlign;
2408 return UnadjustedAlign;
2412 unsigned SimdAlign = llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(
2462 unsigned ABIAlign = TI.
Align;
2470 if (!
Target->allowsLargerPreferedTypeAlignment())
2484 unsigned PreferredAlign =
static_cast<unsigned>(
2486 assert(PreferredAlign >= ABIAlign &&
2487 "PreferredAlign should be at least as large as ABIAlign.");
2488 return PreferredAlign;
2495 T = CT->getElementType().getTypePtr();
2497 T = ET->getDecl()->getIntegerType().getTypePtr();
2502 Target->defaultsToAIXPowerAlignment()))
2506 return std::max(ABIAlign, (
unsigned)
getTypeSize(T));
2557 for (
unsigned I = 0, N = Path.size(); I != N; ++I) {
2561 std::swap(
Base, Derived);
2581 llvm::append_range(Ivars, OI->
ivars());
2584 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2586 Ivars.push_back(Iv);
2594 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2597 for (
auto *Proto : OI->all_referenced_protocols()) {
2602 for (
const auto *Cat : OI->visible_categories())
2608 SD = SD->getSuperClass();
2610 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2611 for (
auto *Proto : OC->protocols()) {
2614 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2616 if (!Protocols.insert(
2620 for (
auto *Proto : OP->protocols())
2627 bool CheckIfTriviallyCopyable) {
2628 assert(RD->
isUnion() &&
"Must be union type");
2631 for (
const auto *Field : RD->
fields()) {
2633 CheckIfTriviallyCopyable))
2636 if (FieldSize != UnionSize)
2654static std::optional<int64_t>
2657 bool CheckIfTriviallyCopyable);
2659static std::optional<int64_t>
2661 bool CheckIfTriviallyCopyable) {
2662 if (Field->getType()->isRecordType()) {
2663 const RecordDecl *RD = Field->getType()->getAsRecordDecl();
2666 CheckIfTriviallyCopyable);
2671 bool IsBitIntType = Field->getType()->isBitIntType();
2672 if (!Field->getType()->isReferenceType() && !IsBitIntType &&
2674 CheckIfTriviallyCopyable))
2675 return std::nullopt;
2677 int64_t FieldSizeInBits =
2679 if (Field->isBitField()) {
2682 if (Field->isUnnamedBitfield())
2685 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2687 if ((
unsigned)BitfieldSize >
2688 cast<BitIntType>(Field->getType())->getNumBits())
2689 return std::nullopt;
2690 }
else if (BitfieldSize > FieldSizeInBits) {
2691 return std::nullopt;
2693 FieldSizeInBits = BitfieldSize;
2695 Field->getType(), CheckIfTriviallyCopyable)) {
2696 return std::nullopt;
2698 return FieldSizeInBits;
2701static std::optional<int64_t>
2703 bool CheckIfTriviallyCopyable) {
2705 CheckIfTriviallyCopyable);
2708template <
typename RangeT>
2710 const RangeT &Subobjects, int64_t CurOffsetInBits,
2712 bool CheckIfTriviallyCopyable) {
2713 for (
const auto *Subobject : Subobjects) {
2714 std::optional<int64_t> SizeInBits =
2717 return std::nullopt;
2718 if (*SizeInBits != 0) {
2720 if (Offset != CurOffsetInBits)
2721 return std::nullopt;
2722 CurOffsetInBits += *SizeInBits;
2725 return CurOffsetInBits;
2728static std::optional<int64_t>
2731 bool CheckIfTriviallyCopyable) {
2732 assert(!RD->
isUnion() &&
"Must be struct/class type");
2735 int64_t CurOffsetInBits = 0;
2736 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2737 if (ClassDecl->isDynamicClass())
2738 return std::nullopt;
2741 for (
const auto &
Base : ClassDecl->bases()) {
2744 Bases.emplace_back(
Base.getType()->getAsCXXRecordDecl());
2748 return Layout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R);
2751 std::optional<int64_t> OffsetAfterBases =
2753 Bases, CurOffsetInBits, Context, Layout, CheckIfTriviallyCopyable);
2754 if (!OffsetAfterBases)
2755 return std::nullopt;
2756 CurOffsetInBits = *OffsetAfterBases;
2759 std::optional<int64_t> OffsetAfterFields =
2761 RD->
fields(), CurOffsetInBits, Context, Layout,
2762 CheckIfTriviallyCopyable);
2763 if (!OffsetAfterFields)
2764 return std::nullopt;
2765 CurOffsetInBits = *OffsetAfterFields;
2767 return CurOffsetInBits;
2771 QualType Ty,
bool CheckIfTriviallyCopyable)
const {
2788 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2793 CheckIfTriviallyCopyable);
2813 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2818 if (
Record->isInvalidDecl())
2823 CheckIfTriviallyCopyable);
2826 *
this,
Record, CheckIfTriviallyCopyable);
2828 return StructSize && *StructSize ==
static_cast<int64_t
>(
getTypeSize(Ty));
2849 count += Ext->ivar_size();
2854 count += ImplDecl->ivar_size();
2872 if (isa<GNUNullExpr>(E))
return true;
2880 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2881 I = ObjCImpls.find(D);
2882 if (I != ObjCImpls.end())
2883 return cast<ObjCImplementationDecl>(I->second);
2890 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2891 I = ObjCImpls.find(D);
2892 if (I != ObjCImpls.end())
2893 return cast<ObjCCategoryImplDecl>(I->second);
2900 assert(IFaceD && ImplD &&
"Passed null params");
2901 ObjCImpls[IFaceD] = ImplD;
2907 assert(CatD && ImplD &&
"Passed null params");
2908 ObjCImpls[CatD] = ImplD;
2913 return ObjCMethodRedecls.lookup(MD);
2919 ObjCMethodRedecls[MD] = Redecl;
2924 if (
const auto *ID = dyn_cast<ObjCInterfaceDecl>(ND->
getDeclContext()))
2926 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
2927 return CD->getClassInterface();
2928 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
2929 return IMD->getClassInterface();
2937 assert(VD &&
"Passed null params");
2938 assert(VD->
hasAttr<BlocksAttr>() &&
2939 "getBlockVarCopyInits - not __block var");
2940 auto I = BlockVarCopyInits.find(VD);
2941 if (I != BlockVarCopyInits.end())
2943 return {
nullptr,
false};
2949 assert(VD && CopyExpr &&
"Passed null params");
2950 assert(VD->
hasAttr<BlocksAttr>() &&
2951 "setBlockVarCopyInits - not __block var");
2952 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr,
CanThrow);
2956 unsigned DataSize)
const {
2961 "incorrect data size provided to CreateTypeSourceInfo!");
2978 return getObjCLayout(D,
nullptr);
2989 bool &AnyNonCanonArgs) {
2991 for (
auto &Arg : CanonArgs) {
2993 Arg =
C.getCanonicalTemplateArgument(Arg);
2994 AnyNonCanonArgs |= !Arg.structurallyEquals(OrigArg);
3004ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
3009 llvm::FoldingSetNodeID
ID;
3011 void *insertPos =
nullptr;
3012 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
3013 assert(eq->getQualifiers() == quals);
3022 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
3025 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
3028 auto *eq =
new (*
this,
alignof(
ExtQuals))
ExtQuals(baseType, canon, quals);
3029 ExtQualNodes.InsertNode(eq, insertPos);
3034 LangAS AddressSpace)
const {
3047 "Type cannot be in multiple addr spaces!");
3050 return getExtQualType(TypeNode, Quals);
3062 const Type *TypeNode;
3065 TypeNode = Quals.
strip(T);
3069 if (!
QualType(TypeNode, 0).hasAddressSpace())
3082 return getExtQualType(TypeNode, Quals);
3109 "Type cannot have multiple ObjCGCs!");
3112 return getExtQualType(TypeNode, Quals);
3131 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(T)) {
3134 const auto *FPT = cast<FunctionProtoType>(T);
3140 return cast<FunctionType>(
Result.getTypePtr());
3156 L->DeducedReturnType(FD, ResultType);
3166 if (
const auto *PT = dyn_cast<ParenType>(Orig))
3171 if (
const auto *MQT = dyn_cast<MacroQualifiedType>(Orig))
3174 MQT->getMacroIdentifier());
3177 if (
const auto *AT = dyn_cast<AttributedType>(Orig))
3187 Proto->getReturnType(), Proto->getParamTypes(),
3188 Proto->getExtProtoInfo().withExceptionSpec(ESI));
3203 for (
unsigned i = 0, n = Args.size(); i != n; ++i)
3237 if (TSInfo->getType() != FD->
getType())
3245 "TypeLoc size mismatch from updating exception specification");
3246 TSInfo->overrideType(Updated);
3255 llvm::FoldingSetNodeID ID;
3258 void *InsertPos =
nullptr;
3259 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
3269 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
3270 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3273 Types.push_back(New);
3274 ComplexTypes.InsertNode(New, InsertPos);
3283 llvm::FoldingSetNodeID ID;
3286 void *InsertPos =
nullptr;
3287 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3297 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3298 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3301 Types.push_back(New);
3302 PointerTypes.InsertNode(New, InsertPos);
3307 llvm::FoldingSetNodeID ID;
3309 void *InsertPos =
nullptr;
3310 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3317 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3318 assert(!AT &&
"Shouldn't be in the map!");
3322 Types.push_back(AT);
3323 AdjustedTypes.InsertNode(AT, InsertPos);
3328 llvm::FoldingSetNodeID ID;
3330 void *InsertPos =
nullptr;
3331 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3338 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3339 assert(!AT &&
"Shouldn't be in the map!");
3342 Types.push_back(AT);
3343 AdjustedTypes.InsertNode(AT, InsertPos);
3376 llvm::FoldingSetNodeID ID;
3379 void *InsertPos =
nullptr;
3381 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3392 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3393 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3397 Types.push_back(New);
3398 BlockPointerTypes.InsertNode(New, InsertPos);
3408 "Unresolved placeholder type");
3412 llvm::FoldingSetNodeID ID;
3415 void *InsertPos =
nullptr;
3417 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3425 if (!SpelledAsLValue || InnerRef || !T.
isCanonical()) {
3426 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
3431 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3432 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3437 Types.push_back(New);
3438 LValueReferenceTypes.InsertNode(New, InsertPos);
3448 "Unresolved placeholder type");
3452 llvm::FoldingSetNodeID ID;
3455 void *InsertPos =
nullptr;
3457 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3466 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
3471 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3472 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3477 Types.push_back(New);
3478 RValueReferenceTypes.InsertNode(New, InsertPos);
3487 llvm::FoldingSetNodeID ID;
3490 void *InsertPos =
nullptr;
3492 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3503 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3504 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3508 Types.push_back(New);
3509 MemberPointerTypes.InsertNode(New, InsertPos);
3516 const llvm::APInt &ArySizeIn,
3517 const Expr *SizeExpr,
3519 unsigned IndexTypeQuals)
const {
3522 "Constant array of VLAs is illegal!");
3530 llvm::APInt ArySize(ArySizeIn);
3531 ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
3533 llvm::FoldingSetNodeID ID;
3537 void *InsertPos =
nullptr;
3539 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
3550 ASM, IndexTypeQuals);
3555 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
3556 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3560 ConstantArrayType::totalSizeToAlloc<const Expr *>(SizeExpr ? 1 : 0),
3562 auto *New =
new (Mem)
3564 ConstantArrayTypes.InsertNode(New, InsertPos);
3565 Types.push_back(New);
3574 if (!
type->isVariablyModifiedType())
return type;
3579 const Type *ty = split.
Ty;
3581#define TYPE(Class, Base)
3582#define ABSTRACT_TYPE(Class, Base)
3583#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
3584#include "clang/AST/TypeNodes.inc"
3585 llvm_unreachable(
"didn't desugar past all non-canonical types?");
3591 case Type::DependentVector:
3592 case Type::ExtVector:
3593 case Type::DependentSizedExtVector:
3594 case Type::ConstantMatrix:
3595 case Type::DependentSizedMatrix:
3596 case Type::DependentAddressSpace:
3597 case Type::ObjCObject:
3598 case Type::ObjCInterface:
3599 case Type::ObjCObjectPointer:
3602 case Type::UnresolvedUsing:
3603 case Type::TypeOfExpr:
3605 case Type::Decltype:
3606 case Type::UnaryTransform:
3607 case Type::DependentName:
3608 case Type::InjectedClassName:
3609 case Type::TemplateSpecialization:
3610 case Type::DependentTemplateSpecialization:
3611 case Type::TemplateTypeParm:
3612 case Type::SubstTemplateTypeParmPack:
3614 case Type::DeducedTemplateSpecialization:
3615 case Type::PackExpansion:
3616 case Type::PackIndexing:
3618 case Type::DependentBitInt:
3619 llvm_unreachable(
"type should never be variably-modified");
3623 case Type::FunctionNoProto:
3624 case Type::FunctionProto:
3625 case Type::BlockPointer:
3626 case Type::MemberPointer:
3636 cast<PointerType>(ty)->getPointeeType()));
3639 case Type::LValueReference: {
3640 const auto *lv = cast<LValueReferenceType>(ty);
3643 lv->isSpelledAsLValue());
3647 case Type::RValueReference: {
3648 const auto *lv = cast<RValueReferenceType>(ty);
3654 case Type::Atomic: {
3655 const auto *at = cast<AtomicType>(ty);
3660 case Type::ConstantArray: {
3661 const auto *cat = cast<ConstantArrayType>(ty);
3666 cat->getSizeModifier(),
3667 cat->getIndexTypeCVRQualifiers());
3671 case Type::DependentSizedArray: {
3672 const auto *dat = cast<DependentSizedArrayType>(ty);
3676 dat->getSizeModifier(),
3677 dat->getIndexTypeCVRQualifiers(),
3678 dat->getBracketsRange());
3683 case Type::IncompleteArray: {
3684 const auto *iat = cast<IncompleteArrayType>(ty);
3693 case Type::VariableArray: {
3694 const auto *vat = cast<VariableArrayType>(ty);
3698 vat->getIndexTypeCVRQualifiers(), vat->getBracketsRange());
3711 unsigned IndexTypeQuals,
3722 IndexTypeQuals, Brackets);
3729 VariableArrayTypes.push_back(New);
3730 Types.push_back(New);
3740 unsigned elementTypeQuals,
3744 "Size must be type- or value-dependent!");
3753 elementTypeQuals, brackets);
3754 Types.push_back(newType);
3763 void *insertPos =
nullptr;
3764 llvm::FoldingSetNodeID ID;
3767 ASM, elementTypeQuals, numElements);
3771 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3777 numElements, ASM, elementTypeQuals, brackets);
3778 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
3779 Types.push_back(canonTy);
3784 canonElementType.
Quals);
3788 if (
QualType(canonElementType.
Ty, 0) == elementType &&
3796 elementTypeQuals, brackets);
3797 Types.push_back(sugaredType);
3803 unsigned elementTypeQuals)
const {
3804 llvm::FoldingSetNodeID ID;
3807 void *insertPos =
nullptr;
3809 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
3821 ASM, elementTypeQuals);
3826 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3827 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
3833 IncompleteArrayTypes.InsertNode(newType, insertPos);
3834 Types.push_back(newType);
3840#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS) \
3841 {getIntTypeForBitwidth(BITS, SIGNED), llvm::ElementCount::getScalable(ELTS), \
3844#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS) \
3845 {ELTTY, llvm::ElementCount::getScalable(ELTS), NUMVECTORS};
3849 llvm_unreachable(
"Unsupported builtin vector type");
3850 case BuiltinType::SveInt8:
3852 case BuiltinType::SveUint8:
3854 case BuiltinType::SveInt8x2:
3856 case BuiltinType::SveUint8x2:
3858 case BuiltinType::SveInt8x3:
3860 case BuiltinType::SveUint8x3:
3862 case BuiltinType::SveInt8x4:
3864 case BuiltinType::SveUint8x4:
3866 case BuiltinType::SveInt16:
3868 case BuiltinType::SveUint16:
3870 case BuiltinType::SveInt16x2:
3872 case BuiltinType::SveUint16x2:
3874 case BuiltinType::SveInt16x3:
3876 case BuiltinType::SveUint16x3:
3878 case BuiltinType::SveInt16x4:
3880 case BuiltinType::SveUint16x4:
3882 case BuiltinType::SveInt32:
3884 case BuiltinType::SveUint32:
3886 case BuiltinType::SveInt32x2:
3888 case BuiltinType::SveUint32x2:
3890 case BuiltinType::SveInt32x3:
3892 case BuiltinType::SveUint32x3:
3894 case BuiltinType::SveInt32x4:
3896 case BuiltinType::SveUint32x4:
3898 case BuiltinType::SveInt64:
3900 case BuiltinType::SveUint64:
3902 case BuiltinType::SveInt64x2:
3904 case BuiltinType::SveUint64x2:
3906 case BuiltinType::SveInt64x3:
3908 case BuiltinType::SveUint64x3:
3910 case BuiltinType::SveInt64x4:
3912 case BuiltinType::SveUint64x4:
3914 case BuiltinType::SveBool:
3916 case BuiltinType::SveBoolx2:
3918 case BuiltinType::SveBoolx4:
3920 case BuiltinType::SveFloat16:
3922 case BuiltinType::SveFloat16x2:
3924 case BuiltinType::SveFloat16x3:
3926 case BuiltinType::SveFloat16x4:
3928 case BuiltinType::SveFloat32:
3930 case BuiltinType::SveFloat32x2:
3932 case BuiltinType::SveFloat32x3:
3934 case BuiltinType::SveFloat32x4:
3936 case BuiltinType::SveFloat64:
3938 case BuiltinType::SveFloat64x2:
3940 case BuiltinType::SveFloat64x3:
3942 case BuiltinType::SveFloat64x4:
3944 case BuiltinType::SveBFloat16:
3946 case BuiltinType::SveBFloat16x2:
3948 case BuiltinType::SveBFloat16x3:
3950 case BuiltinType::SveBFloat16x4:
3952#define RVV_VECTOR_TYPE_INT(Name, Id, SingletonId, NumEls, ElBits, NF, \
3954 case BuiltinType::Id: \
3955 return {getIntTypeForBitwidth(ElBits, IsSigned), \
3956 llvm::ElementCount::getScalable(NumEls), NF};
3957#define RVV_VECTOR_TYPE_FLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
3958 case BuiltinType::Id: \
3959 return {ElBits == 16 ? Float16Ty : (ElBits == 32 ? FloatTy : DoubleTy), \
3960 llvm::ElementCount::getScalable(NumEls), NF};
3961#define RVV_VECTOR_TYPE_BFLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
3962 case BuiltinType::Id: \
3963 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
3964#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
3965 case BuiltinType::Id: \
3966 return {BoolTy, llvm::ElementCount::getScalable(NumEls), 1};
3967#include "clang/Basic/RISCVVTypes.def"
3974 if (
Target->getTriple().isWasm() &&
Target->hasFeature(
"reference-types")) {
3975#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
3976 if (BuiltinType::Id == BuiltinType::WasmExternRef) \
3978#include "clang/Basic/WebAssemblyReferenceTypes.def"
3981 "shouldn't try to generate type externref outside WebAssembly target");
3988 unsigned NumFields)
const {
3989 if (
Target->hasAArch64SVETypes()) {
3991#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId, NumEls, ElBits, \
3992 IsSigned, IsFP, IsBF) \
3993 if (!EltTy->isBooleanType() && \
3994 ((EltTy->hasIntegerRepresentation() && \
3995 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
3996 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
3998 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
3999 IsBF && !IsFP)) && \
4000 EltTySize == ElBits && NumElts == NumEls) { \
4001 return SingletonId; \
4003#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId, NumEls) \
4004 if (EltTy->isBooleanType() && NumElts == NumEls) \
4006#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingleTonId)
4007#include "clang/Basic/AArch64SVEACLETypes.def"
4008 }
else if (
Target->hasRISCVVTypes()) {
4010#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
4012 if (!EltTy->isBooleanType() && \
4013 ((EltTy->hasIntegerRepresentation() && \
4014 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4015 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4017 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4018 IsBF && !IsFP)) && \
4019 EltTySize == ElBits && NumElts == NumEls && NumFields == NF) \
4021#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4022 if (EltTy->isBooleanType() && NumElts == NumEls) \
4024#include "clang/Basic/RISCVVTypes.def"
4040 llvm::FoldingSetNodeID ID;
4043 void *InsertPos =
nullptr;
4044 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4054 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4055 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4058 VectorType(vecType, NumElts, Canonical, VecKind);
4059 VectorTypes.InsertNode(New, InsertPos);
4060 Types.push_back(New);
4067 llvm::FoldingSetNodeID ID;
4070 void *InsertPos =
nullptr;
4072 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4077 VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
4080 if (CanonVecTy == VecType) {
4085 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4086 assert(!CanonCheck &&
4087 "Dependent-sized vector_size canonical type broken");
4089 DependentVectorTypes.InsertNode(New, InsertPos);
4098 Types.push_back(New);
4105 unsigned NumElts)
const {
4113 llvm::FoldingSetNodeID ID;
4116 void *InsertPos =
nullptr;
4117 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4127 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4128 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4132 VectorTypes.InsertNode(New, InsertPos);
4133 Types.push_back(New);
4141 llvm::FoldingSetNodeID ID;
4145 void *InsertPos =
nullptr;
4147 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4157 if (CanonVecTy == vecType) {
4162 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4163 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
4165 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
4174 Types.push_back(New);
4179 unsigned NumColumns)
const {
4180 llvm::FoldingSetNodeID ID;
4182 Type::ConstantMatrix);
4185 "need a valid element type");
4188 "need valid matrix dimensions");
4189 void *InsertPos =
nullptr;
4199 assert(!NewIP &&
"Matrix type shouldn't already exist in the map");
4205 MatrixTypes.InsertNode(New, InsertPos);
4206 Types.push_back(New);
4215 llvm::FoldingSetNodeID ID;
4219 void *InsertPos =
nullptr;
4221 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4226 ColumnExpr, AttrLoc);
4229 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4230 assert(!CanonCheck &&
"Dependent-sized matrix canonical type broken");
4232 DependentSizedMatrixTypes.InsertNode(Canon, InsertPos);
4233 Types.push_back(Canon);
4246 ColumnExpr, AttrLoc);
4247 Types.push_back(New);
4252 Expr *AddrSpaceExpr,
4258 void *insertPos =
nullptr;
4259 llvm::FoldingSetNodeID ID;
4264 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
4270 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
4271 Types.push_back(canonTy);
4274 if (canonPointeeType == PointeeType &&
4280 AddrSpaceExpr, AttrLoc);
4281 Types.push_back(sugaredType);
4305 llvm::FoldingSetNodeID ID;
4308 void *InsertPos =
nullptr;
4310 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
4320 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4321 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4326 Types.push_back(New);
4327 FunctionNoProtoTypes.InsertNode(New, InsertPos);
4343 return CanResultType;
4350 if (!NoexceptInType)
4367 bool AnyPackExpansions =
false;
4372 AnyPackExpansions =
true;
4374 return AnyPackExpansions;
4380QualType ASTContext::getFunctionTypeInternal(
4383 size_t NumArgs = ArgArray.size();
4387 llvm::FoldingSetNodeID
ID;
4392 bool Unique =
false;
4394 void *InsertPos =
nullptr;
4396 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4416 bool IsCanonicalExceptionSpec =
4420 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
4422 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
4423 if (!ArgArray[i].isCanonicalAsParam())
4424 isCanonical =
false;
4426 if (OnlyWantCanonical)
4427 assert(isCanonical &&
4428 "given non-canonical parameters constructing canonical type");
4433 if (!isCanonical && Canonical.
isNull()) {
4435 CanonicalArgs.reserve(NumArgs);
4436 for (
unsigned i = 0; i != NumArgs; ++i)
4443 if (IsCanonicalExceptionSpec) {
4445 }
else if (NoexceptInType) {
4458 bool AnyPacks =
false;
4481 llvm_unreachable(
"dependent noexcept is already canonical");
4490 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
4494 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4495 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4500 auto ESH = FunctionProtoType::getExceptionSpecSize(
4502 size_t Size = FunctionProtoType::totalSizeToAlloc<
4508 ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
4515 Types.push_back(FTP);
4517 FunctionProtoTypes.InsertNode(FTP, InsertPos);
4522 llvm::FoldingSetNodeID
ID;
4525 void *InsertPos =
nullptr;
4526 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
4536 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
4537 assert(!NewIP &&
"Shouldn't be in the map!");
4540 auto *New =
new (*
this,
alignof(
PipeType))
PipeType(T, Canonical, ReadOnly);
4541 Types.push_back(New);
4542 PipeTypes.InsertNode(New, InsertPos);
4553 return getPipeType(T,
true);
4557 return getPipeType(T,
false);
4561 llvm::FoldingSetNodeID ID;
4564 void *InsertPos =
nullptr;
4565 if (
BitIntType *EIT = BitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
4569 BitIntTypes.InsertNode(New, InsertPos);
4570 Types.push_back(New);
4575 Expr *NumBitsExpr)
const {
4577 llvm::FoldingSetNodeID ID;
4580 void *InsertPos =
nullptr;
4582 DependentBitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
4587 DependentBitIntTypes.InsertNode(New, InsertPos);
4589 Types.push_back(New);
4595 if (!isa<CXXRecordDecl>(D))
return false;
4596 const auto *RD = cast<CXXRecordDecl>(D);
4597 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
4599 if (RD->getDescribedClassTemplate() &&
4600 !isa<ClassTemplateSpecializationDecl>(RD))
4611 if (
Decl->TypeForDecl) {
4612 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
4614 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
4615 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4616 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
4620 Decl->TypeForDecl = newType;
4621 Types.push_back(newType);
4629 assert(
Decl &&
"Passed null for Decl param");
4630 assert(!
Decl->TypeForDecl &&
"TypeForDecl present in slow case");
4632 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(
Decl))
4635 assert(!isa<TemplateTypeParmDecl>(
Decl) &&
4636 "Template type parameter types are always available.");
4638 if (
const auto *
Record = dyn_cast<RecordDecl>(
Decl)) {
4639 assert(
Record->isFirstDecl() &&
"struct/union has previous declaration");
4642 }
else if (
const auto *
Enum = dyn_cast<EnumDecl>(
Decl)) {
4643 assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
4645 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(
Decl)) {
4648 llvm_unreachable(
"TypeDecl without a type?");
4657 if (!
Decl->TypeForDecl) {
4659 Underlying =
Decl->getUnderlyingType();
4662 Decl->TypeForDecl = NewType;
4663 Types.push_back(NewType);
4666 if (Underlying.
isNull() ||
Decl->getUnderlyingType() == Underlying)
4670 llvm::FoldingSetNodeID ID;
4673 void *InsertPos =
nullptr;
4674 if (
TypedefType *T = TypedefTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4675 assert(!T->typeMatchesDecl() &&
4676 "non-divergent case should be handled with TypeDecl");
4680 void *Mem =
Allocate(TypedefType::totalSizeToAlloc<QualType>(
true),
4682 auto *NewType =
new (Mem)
TypedefType(Type::Typedef,
Decl, Underlying,
4684 TypedefTypes.InsertNode(NewType, InsertPos);
4685 Types.push_back(NewType);
4691 llvm::FoldingSetNodeID ID;
4694 void *InsertPos =
nullptr;
4695 if (
UsingType *T = UsingTypes.FindNodeOrInsertPos(ID, InsertPos))
4698 const Type *TypeForDecl =
4708 Allocate(UsingType::totalSizeToAlloc<QualType>(!Underlying.
isNull()),
4711 Types.push_back(NewType);
4712 UsingTypes.InsertNode(NewType, InsertPos);
4720 if (PrevDecl->TypeForDecl)
4721 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
4724 Decl->TypeForDecl = newType;
4725 Types.push_back(newType);
4733 if (PrevDecl->TypeForDecl)
4734 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
4737 Decl->TypeForDecl = newType;
4738 Types.push_back(newType);
4744 if (
Decl->TypeForDecl)
4749 if (CanonicalDecl->TypeForDecl)
4750 return QualType(
Decl->TypeForDecl = CanonicalDecl->TypeForDecl, 0);
4754 Decl->TypeForDecl = newType;
4755 Types.push_back(newType);
4762 llvm::FoldingSetNodeID id;
4765 void *insertPos =
nullptr;
4773 Types.push_back(
type);
4774 AttributedTypes.InsertNode(
type, insertPos);
4781 llvm::FoldingSetNodeID ID;
4784 void *InsertPos =
nullptr;
4786 BTFTagAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
4794 Types.push_back(Ty);
4795 BTFTagAttributedTypes.InsertNode(Ty, InsertPos);
4802 QualType Replacement,
Decl *AssociatedDecl,
unsigned Index,
4803 std::optional<unsigned> PackIndex)
const {
4804 llvm::FoldingSetNodeID ID;
4807 void *InsertPos =
nullptr;
4809 SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4812 void *Mem =
Allocate(SubstTemplateTypeParmType::totalSizeToAlloc<QualType>(
4813 !Replacement.isCanonical()),
4817 Types.push_back(SubstParm);
4818 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
4827 unsigned Index,
bool Final,
4834 llvm::FoldingSetNodeID ID;
4837 void *InsertPos =
nullptr;
4839 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
4849 [[maybe_unused]]
const auto *Nothing =
4850 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
4858 Types.push_back(SubstParm);
4859 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
4869 llvm::FoldingSetNodeID ID;
4871 void *InsertPos =
nullptr;
4873 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4884 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4885 assert(!TypeCheck &&
"Template type parameter canonical type broken");
4891 Types.push_back(TypeParm);
4892 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
4902 assert(!Name.getAsDependentTemplateName() &&
4903 "No dependent template names here!");
4914 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
4924 "No dependent template names here!");
4927 ArgVec.reserve(Args.size());
4929 ArgVec.push_back(Arg.getArgument());
4937 if (Arg.isPackExpansion())
4949 "No dependent template names here!");
4952 Template = QTN->getUnderlyingTemplate();
4957 if (!Underlying.
isNull())
4963 "Caller must compute aliased type");
4964 IsTypeAlias =
false;
4973 (IsTypeAlias ?
sizeof(
QualType) : 0),
4977 IsTypeAlias ? Underlying :
QualType());
4979 Types.push_back(Spec);
4986 "No dependent template names here!");
4994 bool AnyNonCanonArgs =
false;
5000 llvm::FoldingSetNodeID ID;
5004 void *InsertPos =
nullptr;
5006 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5016 Types.push_back(Spec);
5017 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
5021 "Non-dependent template-id type must have a canonical type");
5028 TagDecl *OwnedTagDecl)
const {
5029 llvm::FoldingSetNodeID ID;
5032 void *InsertPos =
nullptr;
5033 ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5040 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5041 assert(!CheckT &&
"Elaborated canonical type broken");
5046 Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
5048 T =
new (Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
5051 ElaboratedTypes.InsertNode(T, InsertPos);
5057 llvm::FoldingSetNodeID ID;
5060 void *InsertPos =
nullptr;
5061 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5068 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5069 assert(!CheckT &&
"Paren canonical type broken");
5075 ParenTypes.InsertNode(T, InsertPos);
5088 Types.push_back(newType);
5098 if (CanonNNS != NNS)
5102 llvm::FoldingSetNodeID ID;
5105 void *InsertPos =
nullptr;
5107 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
5114 DependentNameTypes.InsertNode(T, InsertPos);
5123 for (
unsigned I = 0, E = Args.size(); I != E; ++I)
5135 "nested-name-specifier must be dependent");
5137 llvm::FoldingSetNodeID ID;
5141 void *InsertPos =
nullptr;
5143 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5153 bool AnyNonCanonArgs =
false;
5158 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
5164 [[maybe_unused]]
auto *Nothing =
5165 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5166 assert(!Nothing &&
"canonical type broken");
5175 DependentTemplateSpecializationTypes.InsertNode(T, InsertPos);
5181 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
5187 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
5189 NTTP->getType().getNonPackExpansionType().getNonLValueExprType(*
this);
5197 *
this, NTTP,
false, T,
5200 if (NTTP->isParameterPack())
5205 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
5221 Args.reserve(Args.size() + Params->
size());
5228 std::optional<unsigned> NumExpansions,
5229 bool ExpectPackInType) {
5231 "Pack expansions must expand one or more parameter packs");
5233 llvm::FoldingSetNodeID ID;
5236 void *InsertPos =
nullptr;
5248 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
5254 PackExpansionTypes.InsertNode(T, InsertPos);
5266 if (Protocols.empty())
return true;
5271 for (
unsigned i = 1; i != Protocols.size(); ++i)
5281 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
5285 P =
P->getCanonicalDecl();
5288 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
5289 Protocols.erase(ProtocolsEnd, Protocols.end());
5294 unsigned NumProtocols)
const {
5304 bool isKindOf)
const {
5307 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
5308 isa<ObjCInterfaceType>(baseType))
5312 llvm::FoldingSetNodeID ID;
5314 void *InsertPos =
nullptr;
5315 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
5322 if (effectiveTypeArgs.empty()) {
5324 effectiveTypeArgs = baseObject->getTypeArgs();
5331 bool typeArgsAreCanonical = llvm::all_of(
5334 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
5338 if (!typeArgsAreCanonical) {
5339 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
5340 for (
auto typeArg : effectiveTypeArgs)
5342 canonTypeArgs = canonTypeArgsVec;
5344 canonTypeArgs = effectiveTypeArgs;
5349 if (!protocolsSorted) {
5350 canonProtocolsVec.append(protocols.begin(), protocols.end());
5352 canonProtocols = canonProtocolsVec;
5354 canonProtocols = protocols;
5358 canonProtocols, isKindOf);
5361 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
5365 size += typeArgs.size() *
sizeof(
QualType);
5373 ObjCObjectTypes.InsertNode(T, InsertPos);
5383 bool allowOnPointerType)
const {
5386 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(
type.getTypePtr())) {
5391 if (allowOnPointerType) {
5392 if (
const auto *objPtr =
5393 dyn_cast<ObjCObjectPointerType>(
type.getTypePtr())) {
5399 protocolsVec.append(protocols.begin(), protocols.end());
5411 if (
const auto *objT = dyn_cast<ObjCObjectType>(
type.getTypePtr())){
5416 objT->getTypeArgsAsWritten(),
5418 objT->isKindOfTypeAsWritten());
5422 if (
type->isObjCObjectType()) {
5432 if (
type->isObjCIdType()) {
5435 objPtr->isKindOfType());
5440 if (
type->isObjCClassType()) {
5443 objPtr->isKindOfType());
5455 llvm::FoldingSetNodeID ID;
5457 void *InsertPos =
nullptr;
5459 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
5464 if (!protocols.empty()) {
5468 Canonical, protocols, hasError,
true ));
5469 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
5477 Types.push_back(newType);
5478 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
5486 auto NewTypeParamTy = cast<ObjCTypeParamType>(New->
getTypeForDecl());
5488 protocols.append(NewTypeParamTy->qual_begin(), NewTypeParamTy->qual_end());
5503 for (
auto *Proto : OPT->quals()) {
5526 if (InheritedProtocols.empty())
5530 bool Conforms =
false;
5531 for (
auto *Proto : OPT->quals()) {
5533 for (
auto *PI : InheritedProtocols) {
5545 for (
auto *PI : InheritedProtocols) {
5547 bool Adopts =
false;
5548 for (
auto *Proto : OPT->quals()) {
5562 llvm::FoldingSetNodeID ID;
5565 void *InsertPos =
nullptr;
5567 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
5576 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
5585 Types.push_back(QType);
5586 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
5594 if (
Decl->TypeForDecl)
5598 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
5599 Decl->TypeForDecl = PrevDecl->TypeForDecl;
5600 return QualType(PrevDecl->TypeForDecl, 0);
5609 Decl->TypeForDecl = T;
5622 llvm::FoldingSetNodeID ID;
5626 void *InsertPos =
nullptr;
5628 DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
5638 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
5646 Types.push_back(toe);
5659 Types.push_back(tot);
5683 llvm_unreachable(
"Unknown value kind");
5698 llvm::FoldingSetNodeID ID;
5701 void *InsertPos =
nullptr;
5703 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
5708 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
5716 Types.push_back(dt);
5721 bool FullySubstituted,
5725 if (FullySubstituted && Index != -1) {
5728 llvm::FoldingSetNodeID ID;
5730 void *InsertPos =
nullptr;
5732 DependentPackIndexingTypes.FindNodeOrInsertPos(ID, InsertPos);
5735 PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
5739 DependentPackIndexingTypes.InsertNode(Canon, InsertPos);
5745 Allocate(PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
5763 llvm::FoldingSetNodeID ID;
5766 void *InsertPos =
nullptr;
5768 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
5774 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
5783 Types.push_back(ut);
5787QualType ASTContext::getAutoTypeInternal(
5792 !TypeConstraintConcept && !IsDependent)
5796 void *InsertPos =
nullptr;
5797 llvm::FoldingSetNodeID ID;
5799 TypeConstraintConcept, TypeConstraintArgs);
5800 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
5807 }
else if (TypeConstraintConcept) {
5808 bool AnyNonCanonArgs =
false;
5811 *
this, TypeConstraintArgs, AnyNonCanonArgs);
5812 if (CanonicalConcept != TypeConstraintConcept || AnyNonCanonArgs) {
5814 getAutoTypeInternal(
QualType(), Keyword, IsDependent, IsPack,
5815 CanonicalConcept, CanonicalConceptArgs,
true);
5817 [[maybe_unused]]
auto *Nothing =
5818 AutoTypes.FindNodeOrInsertPos(ID, InsertPos);
5819 assert(!Nothing &&
"canonical type broken");
5829 (IsDependent ? TypeDependence::DependentInstantiation
5830 : TypeDependence::None) |
5831 (IsPack ? TypeDependence::UnexpandedPack : TypeDependence::None),
5832 Canon, TypeConstraintConcept, TypeConstraintArgs);
5833 Types.push_back(AT);
5834 AutoTypes.InsertNode(AT, InsertPos);
5843 bool IsDependent,
bool IsPack,
5846 assert((!IsPack || IsDependent) &&
"only use IsPack for a dependent pack");
5848 "A dependent auto should be undeduced");
5849 return getAutoTypeInternal(
DeducedType, Keyword, IsDependent, IsPack,
5850 TypeConstraintConcept, TypeConstraintArgs);
5858 if (!AT->isConstrained())
5879 void *InsertPos =
nullptr;
5880 llvm::FoldingSetNodeID ID;
5884 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
5889 llvm::FoldingSetNodeID TempID;
5890 DTST->Profile(TempID);
5891 assert(ID == TempID &&
"ID does not match");
5892 Types.push_back(DTST);
5893 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
5902 llvm::FoldingSetNodeID ID;
5905 void *InsertPos =
nullptr;
5906 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
5916 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
5917 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
5920 Types.push_back(New);
5921 AtomicTypes.InsertNode(New, InsertPos);
5957 return getFromTargetType(
Target->getSizeType());
5963 return getFromTargetType(
Target->getSignedSizeType());
5968 return getFromTargetType(
Target->getIntMaxType());
5973 return getFromTargetType(
Target->getUIntMaxType());
5991 return getFromTargetType(
Target->getIntPtrType());
6014 return getFromTargetType(
Target->getProcessIDType());
6028 if (isa<ArrayType>(Ty)) {
6030 }
else if (isa<FunctionType>(Ty)) {
6052 quals = splitType.
Quals;
6057 QualType elementType = AT->getElementType();
6062 if (elementType == unqualElementType) {
6063 assert(quals.
empty());
6064 quals = splitType.
Quals;
6072 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
6074 CAT->getSizeExpr(), CAT->getSizeModifier(), 0);
6077 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
6081 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
6084 VAT->getSizeModifier(),
6085 VAT->getIndexTypeCVRQualifiers(),
6086 VAT->getBracketsRange());
6089 const auto *DSAT = cast<DependentSizedArrayType>(AT);
6091 DSAT->getSizeModifier(), 0,
6102 bool AllowPiMismatch) {
6117 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
6118 auto *CAT2 = dyn_cast<ConstantArrayType>(AT2);
6119 if (!((CAT2 && CAT1->getSize() == CAT2->getSize()) ||
6121 isa<IncompleteArrayType>(AT2))))
6123 }
else if (isa<IncompleteArrayType>(AT1)) {
6124 if (!(isa<IncompleteArrayType>(AT2) ||
6126 isa<ConstantArrayType>(AT2))))
6132 T1 = AT1->getElementType();
6133 T2 = AT2->getElementType();
6153 bool AllowPiMismatch) {
6158 if (T1PtrType && T2PtrType) {
6166 if (T1MPType && T2MPType &&
6177 if (T1OPType && T2OPType) {
6209 if (Quals1 != Quals2)
6223 switch (Name.getKind()) {
6258 = Name.getAsSubstTemplateTemplateParm();
6265 = Name.getAsSubstTemplateTemplateParmPack();
6274 llvm_unreachable(
"bad template name kind!");
6279 switch (Name.getKind()) {
6284 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
6285 Template = getCanonicalTemplateTemplateParmDecl(TTP);
6293 llvm_unreachable(
"cannot canonicalize unresolved template");
6297 assert(DTN &&
"Non-dependent template names must refer to template decls.");
6298 return DTN->CanonicalTemplateName;
6303 = Name.getAsSubstTemplateTemplateParm();
6309 Name.getAsSubstTemplateTemplateParmPack();
6318 llvm_unreachable(
"bad template name!");
6334 llvm::FoldingSetNodeID XCEID, YCEID;
6335 XCE->
Profile(XCEID, *
this,
true,
true);
6336 YCE->
Profile(YCEID, *
this,
true,
true);
6337 return XCEID == YCEID;
6386 if (
auto *TX = dyn_cast<TemplateTypeParmDecl>(
X)) {
6387 auto *TY = cast<TemplateTypeParmDecl>(Y);
6388 if (TX->isParameterPack() != TY->isParameterPack())
6390 if (TX->hasTypeConstraint() != TY->hasTypeConstraint())
6393 TY->getTypeConstraint());
6396 if (
auto *TX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
6397 auto *TY = cast<NonTypeTemplateParmDecl>(Y);
6398 return TX->isParameterPack() == TY->isParameterPack() &&
6399 TX->getASTContext().hasSameType(TX->getType(), TY->getType()) &&
6401 TY->getPlaceholderTypeConstraint());
6404 auto *TX = cast<TemplateTemplateParmDecl>(
X);
6405 auto *TY = cast<TemplateTemplateParmDecl>(Y);
6406 return TX->isParameterPack() == TY->isParameterPack() &&
6408 TY->getTemplateParameters());
6413 if (
X->size() != Y->
size())
6416 for (
unsigned I = 0, N =
X->size(); I != N; ++I)
6430 if (
auto *TTPX = dyn_cast<TemplateTypeParmDecl>(
X)) {
6431 auto *TTPY = cast<TemplateTypeParmDecl>(Y);
6432 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
6435 return hasSameType(TTPX->getDefaultArgument(), TTPY->getDefaultArgument());
6438 if (
auto *NTTPX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
6439 auto *NTTPY = cast<NonTypeTemplateParmDecl>(Y);
6440 if (!NTTPX->hasDefaultArgument() || !NTTPY->hasDefaultArgument())
6445 llvm::FoldingSetNodeID XID, YID;
6446 DefaultArgumentX->
Profile(XID, *
this,
true);
6447 DefaultArgumentY->
Profile(YID, *
this,
true);
6451 auto *TTPX = cast<TemplateTemplateParmDecl>(
X);
6452 auto *TTPY = cast<TemplateTemplateParmDecl>(Y);
6454 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
6463 if (
auto *NS =
X->getAsNamespace())
6465 if (
auto *NAS =
X->getAsNamespaceAlias())
6466 return NAS->getNamespace();
6474 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
6476 }
else if (
X->getKind() != Y->
getKind())
6481 switch (
X->getKind()) {
6492 if (
X->getAsType()->getCanonicalTypeInternal() !=
6502 auto *PX =
X->getPrefix();
6516 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
6520 for (
auto Pair : zip_longest(AEnableIfAttrs, BEnableIfAttrs)) {
6521 std::optional<EnableIfAttr *> Cand1A = std::get<0>(Pair);
6522 std::optional<EnableIfAttr *> Cand2A = std::get<1>(Pair);
6525 if (!Cand1A || !Cand2A)
6531 (*Cand1A)->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
6532 (*Cand2A)->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
6536 if (Cand1ID != Cand2ID)
6564 if (
const auto *TypedefX = dyn_cast<TypedefNameDecl>(
X))
6565 if (
const auto *TypedefY = dyn_cast<TypedefNameDecl>(Y))
6567 TypedefY->getUnderlyingType());
6574 if (isa<ObjCInterfaceDecl>(
X) || isa<ObjCProtocolDecl>(
X))
6577 if (isa<ClassTemplateSpecializationDecl>(
X)) {
6584 if (
const auto *TagX = dyn_cast<TagDecl>(
X)) {
6585 const auto *TagY = cast<TagDecl>(Y);
6586 return (TagX->getTagKind() == TagY->getTagKind()) ||
6598 if (
const auto *FuncX = dyn_cast<FunctionDecl>(
X)) {
6599 const auto *FuncY = cast<FunctionDecl>(Y);
6600 if (
const auto *CtorX = dyn_cast<CXXConstructorDecl>(
X)) {
6601 const auto *CtorY = cast<CXXConstructorDecl>(Y);
6602 if (CtorX->getInheritedConstructor() &&
6603 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
6604 CtorY->getInheritedConstructor().getConstructor()))
6608 if (FuncX->isMultiVersion() != FuncY->isMultiVersion())
6613 if (FuncX->isMultiVersion()) {
6614 const auto *TAX = FuncX->getAttr<TargetAttr>();
6615 const auto *TAY = FuncY->getAttr<TargetAttr>();
6616 assert(TAX && TAY &&
"Multiversion Function without target attribute");
6618 if (TAX->getFeaturesStr() != TAY->getFeaturesStr())
6624 if ((FuncX->isMemberLikeConstrainedFriend() ||
6625 FuncY->isMemberLikeConstrainedFriend()) &&
6626 !FuncX->getLexicalDeclContext()->Equals(
6627 FuncY->getLexicalDeclContext())) {
6632 FuncY->getTrailingRequiresClause()))
6640 FD = FD->getCanonicalDecl();
6641 return FD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType()
6644 QualType XT = GetTypeAsWritten(FuncX), YT = GetTypeAsWritten(FuncY);
6659 return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() &&
6664 if (
const auto *VarX = dyn_cast<VarDecl>(
X)) {
6665 const auto *VarY = cast<VarDecl>(Y);
6666 if (VarX->getLinkageInternal() == VarY->getLinkageInternal()) {
6669 if (VarX->getType().isNull() || VarY->getType().isNull())
6672 if (
hasSameType(VarX->getType(), VarY->getType()))
6682 if (!VarXTy || !VarYTy)
6691 if (
const auto *NamespaceX = dyn_cast<NamespaceDecl>(
X)) {
6692 const auto *NamespaceY = cast<NamespaceDecl>(Y);
6693 return NamespaceX->isInline() == NamespaceY->isInline();
6698 if (
const auto *TemplateX = dyn_cast<TemplateDecl>(
X)) {
6699 const auto *TemplateY = cast<TemplateDecl>(Y);
6702 if (
const auto *ConceptX = dyn_cast<ConceptDecl>(
X)) {
6703 const auto *ConceptY = cast<ConceptDecl>(Y);
6705 ConceptY->getConstraintExpr()))
6710 TemplateY->getTemplatedDecl()) &&
6712 TemplateY->getTemplateParameters());
6716 if (
const auto *FDX = dyn_cast<FieldDecl>(
X)) {
6717 const auto *FDY = cast<FieldDecl>(Y);
6719 return hasSameType(FDX->getType(), FDY->getType());
6723 if (
const auto *IFDX = dyn_cast<IndirectFieldDecl>(
X)) {
6724 const auto *IFDY = cast<IndirectFieldDecl>(Y);
6725 return IFDX->getAnonField()->getCanonicalDecl() ==
6726 IFDY->getAnonField()->getCanonicalDecl();
6730 if (isa<EnumConstantDecl>(
X))
6735 if (
const auto *USX = dyn_cast<UsingShadowDecl>(
X)) {
6736 const auto *USY = cast<UsingShadowDecl>(Y);
6737 return USX->getTargetDecl() == USY->getTargetDecl();
6742 if (
const auto *UX = dyn_cast<UsingDecl>(
X)) {
6743 const auto *UY = cast<UsingDecl>(Y);
6745 UX->hasTypename() == UY->hasTypename() &&
6746 UX->isAccessDeclaration() == UY->isAccessDeclaration();
6748 if (
const auto *UX = dyn_cast<UnresolvedUsingValueDecl>(
X)) {
6749 const auto *UY = cast<UnresolvedUsingValueDecl>(Y);
6751 UX->isAccessDeclaration() == UY->isAccessDeclaration();
6753 if (
const auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(
X)) {
6756 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
6761 if (
const auto *UX = dyn_cast<UsingPackDecl>(
X)) {
6763 UX->getInstantiatedFromUsingDecl(),
6764 cast<UsingPackDecl>(Y)->getInstantiatedFromUsingDecl());
6768 if (
const auto *NAX = dyn_cast<NamespaceAliasDecl>(
X)) {
6769 const auto *NAY = cast<NamespaceAliasDecl>(Y);
6770 return NAX->getNamespace()->Equals(NAY->getNamespace());
6817 bool AnyNonCanonArgs =
false;
6820 if (!AnyNonCanonArgs)
6828 llvm_unreachable(
"Unhandled template argument kind");
6871 *
this, DNT->getQualifier(),
6875 const_cast<Type *
>(T));
6879 const_cast<Type *
>(T));
6888 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
6895 if (
const auto *AT = dyn_cast<ArrayType>(T))
6915 const auto *ATy = dyn_cast<ArrayType>(split.
Ty);
6916 if (!ATy || qs.
empty())
6923 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
6926 CAT->getSizeModifier(),
6927 CAT->getIndexTypeCVRQualifiers()));
6928 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
6930 IAT->getSizeModifier(),
6931 IAT->getIndexTypeCVRQualifiers()));
6933 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
6934 return cast<ArrayType>(
6936 DSAT->getSizeExpr(),
6937 DSAT->getSizeModifier(),
6938 DSAT->getIndexTypeCVRQualifiers(),
6939 DSAT->getBracketsRange()));
6941 const auto *VAT = cast<VariableArrayType>(ATy);
6944 VAT->getSizeModifier(),
6945 VAT->getIndexTypeCVRQualifiers(),
6946 VAT->getBracketsRange()));
6986 assert(PrettyArrayType &&
"Not an array type!");
7023 uint64_t ElementCount = 1;
7025 ElementCount *= CA->
getSize().getZExtValue();
7026 CA = dyn_cast_or_null<ConstantArrayType>(
7029 return ElementCount;
7037 uint64_t ElementCount = 1;
7041 AILE = dyn_cast<ArrayInitLoopExpr>(AILE->
getSubExpr());
7044 return ElementCount;
7054 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
7056 case BuiltinType::Half:
return HalfRank;
7057 case BuiltinType::Float:
return FloatRank;
7090unsigned ASTContext::getIntegerRank(
const Type *T)
const {
7095 if (
const auto *EIT = dyn_cast<BitIntType>(T))
7096 return 0 + (EIT->getNumBits() << 3);
7098 switch (cast<BuiltinType>(T)->getKind()) {
7099 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
7100 case BuiltinType::Bool:
7102 case BuiltinType::Char_S:
7103 case BuiltinType::Char_U:
7104 case BuiltinType::SChar:
7105 case BuiltinType::UChar:
7107 case BuiltinType::Short:
7108 case BuiltinType::UShort:
7110 case BuiltinType::Int:
7111 case BuiltinType::UInt:
7113 case BuiltinType::Long:
7114 case BuiltinType::ULong:
7116 case BuiltinType::LongLong:
7117 case BuiltinType::ULongLong:
7119 case BuiltinType::Int128:
7120 case BuiltinType::UInt128:
7125 case BuiltinType::Char8:
7127 case BuiltinType::Char16:
7128 return getIntegerRank(
7130 case BuiltinType::Char32:
7131 return getIntegerRank(
7133 case BuiltinType::WChar_S:
7134 case BuiltinType::WChar_U:
7135 return getIntegerRank(
7165 uint64_t BitWidth = Field->getBitWidthValue(*
this);
7183 if (BitWidth < IntSize)
7186 if (BitWidth == IntSize)
7201 assert(!Promotable.
isNull());
7204 return ET->getDecl()->getPromotionType();
7213 if (BT->getKind() == BuiltinType::WChar_S ||
7214 BT->getKind() == BuiltinType::WChar_U ||
7215 BT->getKind() == BuiltinType::Char8 ||
7216 BT->getKind() == BuiltinType::Char16 ||
7217 BT->getKind() == BuiltinType::Char32) {
7218 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
7222 for (
const auto &PT : PromoteTypes) {
7224 if (FromSize < ToSize ||
7225 (FromSize == ToSize && FromIsSigned == PT->isSignedIntegerType()))
7228 llvm_unreachable(
"char type should fit into long long");
7235 uint64_t PromotableSize =
getIntWidth(Promotable);
7276 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
7278 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
7281 if (LHSC == RHSC)
return 0;
7286 unsigned LHSRank = getIntegerRank(LHSC);
7287 unsigned RHSRank = getIntegerRank(RHSC);
7289 if (LHSUnsigned == RHSUnsigned) {
7290 if (LHSRank == RHSRank)
return 0;
7291 return LHSRank > RHSRank ? 1 : -1;
7297 if (LHSRank >= RHSRank)
7307 if (RHSRank >= LHSRank)
7317 if (CFConstantStringTypeDecl)
7318 return CFConstantStringTypeDecl;
7320 assert(!CFConstantStringTagDecl &&
7321 "tag and typedef should be initialized together");
7361 if (
static_cast<unsigned>(CFRuntime) <
7364 Fields[Count++] = {
IntTy,
"flags" };
7366 Fields[Count++] = {
LongTy,
"length" };
7370 Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc" };
7374 Fields[Count++] = {
IntTy,
"_ptr" };
7380 for (
unsigned i = 0; i < Count; ++i) {
7384 Fields[i].Type,
nullptr,
7387 CFConstantStringTagDecl->
addDecl(Field);
7394 CFConstantStringTypeDecl =
7397 return CFConstantStringTypeDecl;
7401 if (!CFConstantStringTagDecl)
7403 return CFConstantStringTagDecl;
7412 if (ObjCSuperType.
isNull()) {
7417 return ObjCSuperType;
7422 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
7429 if (BlockDescriptorType)
7442 static const char *
const FieldNames[] = {
7447 for (
size_t i = 0; i < 2; ++i) {
7450 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
7458 BlockDescriptorType = RD;
7464 if (BlockDescriptorExtendedType)
7479 static const char *
const FieldNames[] = {
7486 for (
size_t i = 0; i < 4; ++i) {
7489 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
7498 BlockDescriptorExtendedType = RD;
7503 const auto *BT = dyn_cast<BuiltinType>(T);
7506 if (isa<PipeType>(T))
7512 switch (BT->getKind()) {
7513#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7514 case BuiltinType::Id: \
7516#include "clang/Basic/OpenCLImageTypes.def"
7518 case BuiltinType::OCLClkEvent:
7521 case BuiltinType::OCLEvent:
7524 case BuiltinType::OCLQueue:
7527 case BuiltinType::OCLReserveID:
7530 case BuiltinType::OCLSampler:
7549 if (!copyExpr && record->hasTrivialDestructor())
return false;
7577 llvm_unreachable(
"impossible");
7579 llvm_unreachable(
"fell out of lifetime switch!");
7587 bool &HasByrefExtendedLayout)
const {
7592 HasByrefExtendedLayout =
false;
7594 HasByrefExtendedLayout =
true;
7608 assert(
Target &&
"Expected target to be initialized");
7609 const llvm::Triple &T =
Target->getTriple();
7611 if (T.isOSWindows() && T.isArch64Bit())
7617 assert(
Target &&
"Expected target to be initialized");
7618 const llvm::Triple &T =
Target->getTriple();
7620 if (T.isOSWindows() && T.isArch64Bit())
7626 if (!ObjCInstanceTypeDecl)
7627 ObjCInstanceTypeDecl =
7629 return ObjCInstanceTypeDecl;
7635 if (
const auto *TT = dyn_cast<TypedefType>(T))
7637 return II->isStr(
"BOOL");
7645 if (!
type->isIncompleteArrayType() &&
type->isIncompleteType())
7654 else if (
type->isArrayType())
7673 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
7679 if (D->getLexicalDeclContext()->isFileContext() &&
7680 !D->isInlineSpecified() && (D->isConstexpr() ||
First->isConstexpr()))
7711 for (
auto *PI :
Decl->parameters()) {
7716 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
7725 ParmOffset = PtrSize;
7726 for (
auto *PVDecl :
Decl->parameters()) {
7727 QualType PType = PVDecl->getOriginalType();
7728 if (
const auto *AT =
7732 if (!isa<ConstantArrayType>(AT))
7733 PType = PVDecl->getType();
7735 PType = PVDecl->getType();
7755 for (
auto *PI :
Decl->parameters()) {
7762 "getObjCEncodingForFunctionDecl - Incomplete param type");
7769 for (
auto *PVDecl :
Decl->parameters()) {
7770 QualType PType = PVDecl->getOriginalType();
7771 if (
const auto *AT =
7775 if (!isa<ConstantArrayType>(AT))
7776 PType = PVDecl->getType();
7778 PType = PVDecl->getType();
7792 bool Extended)
const {
7796 ObjCEncOptions Options = ObjCEncOptions()
7797 .setExpandPointedToStructures()
7798 .setExpandStructures()
7799 .setIsOutermostType();
7801 Options.setEncodeBlockParameters().setEncodeClassNames();
7802 getObjCEncodingForTypeImpl(T, S, Options,
nullptr);
7808 bool Extended)
const {
7813 Decl->getReturnType(), S, Extended);
7822 E =
Decl->sel_param_end(); PI != E; ++PI) {
7829 "getObjCEncodingForMethodDecl - Incomplete param type");
7837 ParmOffset = 2 * PtrSize;
7839 E =
Decl->sel_param_end(); PI != E; ++PI) {
7842 if (
const auto *AT =
7846 if (!isa<ConstantArrayType>(AT))
7851 PType, S, Extended);
7862 const Decl *Container)
const {
7865 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
7866 for (
auto *PID : CID->property_impls())
7867 if (PID->getPropertyDecl() == PD)
7870 const auto *OID = cast<ObjCImplementationDecl>(Container);
7871 for (
auto *PID : OID->property_impls())
7872 if (PID->getPropertyDecl() == PD)
7906 const Decl *Container)
const {
7908 bool Dynamic =
false;
7916 SynthesizePID = PropertyImpDecl;
7920 std::string S =
"T";
7965 if (SynthesizePID) {
7982 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
7985 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
7998 getObjCEncodingForTypeImpl(T, S,
8000 .setExpandPointedToStructures()
8001 .setExpandStructures()
8002 .setIsOutermostType(),
8003 Field, NotEncodedT);
8007 std::string& S)
const {
8011 getObjCEncodingForTypeImpl(T, S,
8013 .setExpandPointedToStructures()
8014 .setExpandStructures()
8015 .setIsOutermostType()
8016 .setEncodingProperty(),
8024 case BuiltinType::Void:
return 'v';
8025 case BuiltinType::Bool:
return 'B';
8026 case BuiltinType::Char8:
8027 case BuiltinType::Char_U:
8028 case BuiltinType::UChar:
return 'C';
8029 case BuiltinType::Char16:
8030 case BuiltinType::UShort:
return 'S';
8031 case BuiltinType::Char32:
8032 case BuiltinType::UInt:
return 'I';
8033 case BuiltinType::ULong:
8034 return C->getTargetInfo().getLongWidth() == 32 ?
'L' :
'Q';
8035 case BuiltinType::UInt128:
return 'T';
8036 case BuiltinType::ULongLong:
return 'Q';
8037 case BuiltinType::Char_S:
8038 case BuiltinType::SChar:
return 'c';
8039 case BuiltinType::Short:
return 's';
8040 case BuiltinType::WChar_S:
8041 case BuiltinType::WChar_U:
8042 case BuiltinType::Int:
return 'i';
8043 case BuiltinType::Long:
8044 return C->getTargetInfo().getLongWidth() == 32 ?
'l' :
'q';
8045 case BuiltinType::LongLong:
return 'q';
8046 case BuiltinType::Int128:
return 't';
8047 case BuiltinType::Float:
return 'f';
8048 case BuiltinType::Double:
return 'd';
8049 case BuiltinType::LongDouble:
return 'D';
8050 case BuiltinType::NullPtr:
return '*';
8052 case BuiltinType::BFloat16:
8053 case BuiltinType::Float16:
8054 case BuiltinType::Float128:
8055 case BuiltinType::Ibm128:
8056 case BuiltinType::Half:
8057 case BuiltinType::ShortAccum:
8058 case BuiltinType::Accum:
8059 case BuiltinType::LongAccum:
8060 case BuiltinType::UShortAccum:
8061 case BuiltinType::UAccum:
8062 case BuiltinType::ULongAccum:
8063 case BuiltinType::ShortFract:
8064 case BuiltinType::Fract:
8065 case BuiltinType::LongFract:
8066 case BuiltinType::UShortFract:
8067 case BuiltinType::UFract:
8068 case BuiltinType::ULongFract:
8069 case BuiltinType::SatShortAccum:
8070 case BuiltinType::SatAccum:
8071 case BuiltinType::SatLongAccum:
8072 case BuiltinType::SatUShortAccum:
8073 case BuiltinType::SatUAccum:
8074 case BuiltinType::SatULongAccum:
8075 case BuiltinType::SatShortFract:
8076 case BuiltinType::SatFract:
8077 case BuiltinType::SatLongFract:
8078 case BuiltinType::SatUShortFract:
8079 case BuiltinType::SatUFract:
8080 case BuiltinType::SatULongFract:
8084#define SVE_TYPE(Name, Id, SingletonId) \
8085 case BuiltinType::Id:
8086#include "clang/Basic/AArch64SVEACLETypes.def"
8087#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8088#include "clang/Basic/RISCVVTypes.def"
8089#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8090#include "clang/Basic/WebAssemblyReferenceTypes.def"
8094 "cannot yet @encode type %0");
8099 case BuiltinType::ObjCId:
8100 case BuiltinType::ObjCClass:
8101 case BuiltinType::ObjCSel:
8102 llvm_unreachable(
"@encoding ObjC primitive type");
8105#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8106 case BuiltinType::Id:
8107#include "clang/Basic/OpenCLImageTypes.def"
8108#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8109 case BuiltinType::Id:
8110#include "clang/Basic/OpenCLExtensionTypes.def"
8111 case BuiltinType::OCLEvent:
8112 case BuiltinType::OCLClkEvent:
8113 case BuiltinType::OCLQueue:
8114 case BuiltinType::OCLReserveID:
8115 case BuiltinType::OCLSampler:
8116 case BuiltinType::Dependent:
8117#define PPC_VECTOR_TYPE(Name, Id, Size) \
8118 case BuiltinType::Id:
8119#include "clang/Basic/PPCTypes.def"
8120#define BUILTIN_TYPE(KIND, ID)
8121#define PLACEHOLDER_TYPE(KIND, ID) \
8122 case BuiltinType::KIND:
8123#include "clang/AST/BuiltinTypes.def"
8124 llvm_unreachable(
"invalid builtin type for @encode");
8126 llvm_unreachable(
"invalid BuiltinType::Kind value");
8133 if (!
Enum->isFixed())
8143 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
8163 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
8172 S += llvm::utostr(Offset);
8187 bool VisitBasesAndFields) {
8192 PT->getPointeeType().getTypePtr(),
false);
8199 if (isa<ClassTemplateSpecializationDecl>(CXXRD))
8202 if (!CXXRD->hasDefinition() || !VisitBasesAndFields)
8205 for (
const auto &B : CXXRD->bases())
8210 for (
auto *FD : CXXRD->fields())
8219void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string &S,
8220 const ObjCEncOptions Options,
8224 switch (CT->getTypeClass()) {
8229 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
8251 case Type::LValueReference:
8252 case Type::RValueReference: {
8254 if (isa<PointerType>(CT)) {
8256 if (PT->isObjCSelType()) {
8265 bool isReadOnly =
false;
8275 }
else if (Options.IsOutermostType()) {
8278 P = PT->getPointeeType();
8279 if (
P.isConstQualified()) {
8288 if (StringRef(S).ends_with(
"nr"))
8289 S.replace(S.end()-2, S.end(),
"rn");
8301 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
8306 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
8315 RTy, Options.ExpandPointedToStructures()))) {
8324 ObjCEncOptions NewOptions;
8325 if (Options.ExpandPointedToStructures())
8326 NewOptions.setExpandStructures();
8327 getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
8328 nullptr, NotEncodedT);
8332 case Type::ConstantArray:
8333 case Type::IncompleteArray:
8334 case Type::VariableArray: {
8335 const auto *AT = cast<ArrayType>(CT);
8337 if (isa<IncompleteArrayType>(AT) && !Options.IsStructField()) {
8341 getObjCEncodingForTypeImpl(
8342 AT->getElementType(), S,
8343 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
8347 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
8348 S += llvm::utostr(CAT->getSize().getZExtValue());
8351 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
8352 "Unknown array type!");
8356 getObjCEncodingForTypeImpl(
8357 AT->getElementType(), S,
8358 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
8365 case Type::FunctionNoProto:
8366 case Type::FunctionProto:
8370 case Type::Record: {
8371 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
8372 S += RDecl->
isUnion() ?
'(' :
'{';
8376 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
8378 llvm::raw_string_ostream OS(S);
8385 if (Options.ExpandStructures()) {
8388 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
8390 for (
const auto *Field : RDecl->
fields()) {
8393 S +=
Field->getNameAsString();
8398 if (
Field->isBitField()) {
8399 getObjCEncodingForTypeImpl(
Field->getType(), S,
8400 ObjCEncOptions().setExpandStructures(),
8405 getObjCEncodingForTypeImpl(
8407 ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
8413 S += RDecl->
isUnion() ?
')' :
'}';
8417 case Type::BlockPointer: {
8420 if (Options.EncodeBlockParameters()) {
8421 const auto *FT = BT->getPointeeType()->castAs<
FunctionType>();
8425 getObjCEncodingForTypeImpl(FT->getReturnType(), S,
8426 Options.forComponentType(), FD, NotEncodedT);
8430 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
8431 for (
const auto &I : FPT->param_types())
8432 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
8440 case Type::ObjCObject: {
8444 S +=
"{objc_object=}";
8448 S +=
"{objc_class=}";
8455 case Type::ObjCInterface: {
8461 if (Options.ExpandStructures()) {
8465 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
8467 if (
Field->isBitField())
8468 getObjCEncodingForTypeImpl(
Field->getType(), S,
8469 ObjCEncOptions().setExpandStructures(),
8472 getObjCEncodingForTypeImpl(
Field->getType(), S,
8473 ObjCEncOptions().setExpandStructures(), FD,
8481 case Type::ObjCObjectPointer: {
8483 if (OPT->isObjCIdType()) {
8488 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
8496 if (OPT->isObjCQualifiedIdType()) {
8497 getObjCEncodingForTypeImpl(
8499 Options.keepingOnly(ObjCEncOptions()
8500 .setExpandPointedToStructures()
8501 .setExpandStructures()),
8503 if (FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
8507 for (
const auto *I : OPT->quals()) {
8509 S += I->getObjCRuntimeNameAsString();
8518 if (OPT->getInterfaceDecl() &&
8519 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
8521 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
8522 for (
const auto *I : OPT->quals()) {
8524 S += I->getObjCRuntimeNameAsString();
8534 case Type::MemberPointer:
8538 case Type::ExtVector:
8544 case Type::ConstantMatrix:
8557 case Type::DeducedTemplateSpecialization:
8561#define ABSTRACT_TYPE(KIND, BASE)
8562#define TYPE(KIND, BASE)
8563#define DEPENDENT_TYPE(KIND, BASE) \
8565#define NON_CANONICAL_TYPE(KIND, BASE) \
8567#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \
8569#include "clang/AST/TypeNodes.inc"
8570 llvm_unreachable(
"@encode for dependent type!");
8572 llvm_unreachable(
"bad type kind!");
8575void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
8580 assert(RDecl &&
"Expected non-null RecordDecl");
8581 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
8585 const auto *CXXRec = dyn_cast<CXXRecordDecl>(RDecl);
8586 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
8590 for (
const auto &BI : CXXRec->bases()) {
8591 if (!BI.isVirtual()) {
8596 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8597 std::make_pair(offs, base));
8603 if (!
Field->isZeroLengthBitField(*
this) &&
Field->isZeroSize(*
this))
8606 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8607 std::make_pair(offs, Field));
8610 if (CXXRec && includeVBases) {
8611 for (
const auto &BI : CXXRec->vbases()) {
8617 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
8618 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
8619 std::make_pair(offs, base));
8633 std::multimap<uint64_t, NamedDecl *>::iterator
8634 CurLayObj = FieldOrBaseOffsets.begin();
8636 if (CXXRec && CXXRec->isDynamicClass() &&
8637 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
8640 std::string recname = CXXRec->getNameAsString();
8641 if (recname.empty()) recname =
"?";
8654 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8655 std::make_pair(offs,
nullptr));
8658 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
8660 assert(CurOffs <= CurLayObj->first);
8661 if (CurOffs < CurLayObj->first) {
8662 uint64_t padding = CurLayObj->first - CurOffs;
8678 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
8683 getObjCEncodingForStructureImpl(base, S, FD,
false,
8690 const auto *field = cast<FieldDecl>(dcl);
8693 S += field->getNameAsString();
8697 if (field->isBitField()) {
8700 CurOffs += field->getBitWidthValue(*
this);
8705 getObjCEncodingForTypeImpl(
8706 qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
8717 std::string& S)
const {
8750 if (!ObjCClassDecl) {
8755 return ObjCClassDecl;
8759 if (!ObjCProtocolClassDecl) {
8760 ObjCProtocolClassDecl
8769 return ObjCProtocolClassDecl;
8814 const size_t NumFields = 5;
8816 const char *FieldNames[NumFields];
8820 FieldNames[0] =
"__stack";
8824 FieldNames[1] =
"__gr_top";
8828 FieldNames[2] =
"__vr_top";
8831 FieldTypes[3] = Context->
IntTy;
8832 FieldNames[3] =
"__gr_offs";
8835 FieldTypes[4] = Context->
IntTy;
8836 FieldNames[4] =
"__vr_offs";
8839 for (
unsigned i = 0; i < NumFields; ++i) {
8845 FieldTypes[i],
nullptr,
8850 VaListTagDecl->
addDecl(Field);
8867 const size_t NumFields = 5;
8869 const char *FieldNames[NumFields];
8873 FieldNames[0] =
"gpr";
8877 FieldNames[1] =
"fpr";
8881 FieldNames[2] =
"reserved";
8885 FieldNames[3] =
"overflow_arg_area";
8889 FieldNames[4] =
"reg_save_area";
8892 for (
unsigned i = 0; i < NumFields; ++i) {
8897 FieldTypes[i],
nullptr,
8902 VaListTagDecl->
addDecl(Field);
8929 const size_t NumFields = 4;
8931 const char *FieldNames[NumFields];
8935 FieldNames[0] =
"gp_offset";
8939 FieldNames[1] =
"fp_offset";
8943 FieldNames[2] =
"overflow_arg_area";
8947 FieldNames[3] =
"reg_save_area";
8950 for (
unsigned i = 0; i < NumFields; ++i) {
8956 FieldTypes[i],
nullptr,
8961 VaListTagDecl->
addDecl(Field);
9032 const size_t NumFields = 4;
9034 const char *FieldNames[NumFields];
9037 FieldTypes[0] = Context->
LongTy;
9038 FieldNames[0] =
"__gpr";
9041 FieldTypes[1] = Context->
LongTy;
9042 FieldNames[1] =
"__fpr";
9046 FieldNames[2] =
"__overflow_arg_area";
9050 FieldNames[3] =
"__reg_save_area";
9053 for (
unsigned i = 0; i < NumFields; ++i) {
9059 FieldTypes[i],
nullptr,
9064 VaListTagDecl->
addDecl(Field);
9086 const size_t NumFields = 3;
9088 const char *FieldNames[NumFields];
9092 FieldNames[0] =
"__current_saved_reg_area_pointer";
9096 FieldNames[1] =
"__saved_reg_area_end_pointer";
9100 FieldNames[2] =
"__overflow_area_pointer";
9103 for (
unsigned i = 0; i < NumFields; ++i) {
9111 VaListTagDecl->
addDecl(Field);
9154 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
9158 if (!BuiltinVaListDecl) {
9163 return BuiltinVaListDecl;
9176 if (!BuiltinMSVaListDecl)
9179 return BuiltinMSVaListDecl;
9191 assert(ObjCConstantStringType.
isNull() &&
9192 "'NSConstantString' type already set!");
9202 unsigned size = End -
Begin;
9203 assert(size > 1 &&
"set is not overloaded!");
9212 assert(isa<FunctionTemplateDecl>(D) ||
9213 isa<UnresolvedUsingValueDecl>(D) ||
9214 (isa<UsingShadowDecl>(D) &&
9232 bool TemplateKeyword,
9234 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
9237 llvm::FoldingSetNodeID ID;
9240 void *InsertPos =
nullptr;
9242 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9246 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
9258 "Nested name specifier must be dependent");
9260 llvm::FoldingSetNodeID ID;
9263 void *InsertPos =
nullptr;
9265 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9271 if (CanonNNS == NNS) {
9279 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9280 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
9284 DependentTemplateNames.InsertNode(QTN, InsertPos);
9294 "Nested name specifier must be dependent");
9296 llvm::FoldingSetNodeID ID;
9299 void *InsertPos =
nullptr;
9301 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9307 if (CanonNNS == NNS) {
9316 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9317 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
9321 DependentTemplateNames.InsertNode(QTN, InsertPos);
9327 std::optional<unsigned> PackIndex)
const {
9328 llvm::FoldingSetNodeID ID;
9332 void *insertPos =
nullptr;
9334 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
9338 Replacement, AssociatedDecl, Index, PackIndex);
9339 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
9347 Decl *AssociatedDecl,
9348 unsigned Index,
bool Final)
const {
9350 llvm::FoldingSetNodeID ID;
9352 AssociatedDecl, Index, Final);
9354 void *InsertPos =
nullptr;
9356 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
9361 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
9385 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
9415 while (
const auto *AT = dyn_cast<ArrayType>(CT))
9416 CT = AT->getElementType();
9448 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
9449 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
9480 if (Ty->
getKind() == BuiltinType::SveBool ||
9481 Ty->
getKind() == BuiltinType::SveCount)
9491 "Expected SVE builtin type and vector type!");
9499 return BT->getKind() == BuiltinType::SveBool;
9501 return VT->getElementType().getCanonicalType() ==
9512 return IsValidCast(FirstType, SecondType) ||
9513 IsValidCast(SecondType, FirstType);
9521 "Expected SVE builtin type and vector type!");
9536 if (BT->getKind() == BuiltinType::SveBool &&
9557 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
9564 return IsLaxCompatible(FirstType, SecondType) ||
9565 IsLaxCompatible(SecondType, FirstType);
9581 unsigned MinElts = Info.
EC.getKnownMinValue();
9582 return VScale->first * MinElts * EltSize;
9590 "Expected RVV builtin type and vector type!");
9612 return IsValidCast(FirstType, SecondType) ||
9613 IsValidCast(SecondType, FirstType);
9621 "Expected RVV builtin type and vector type!");
9628 if (!BT->isRVVVLSBuiltinType())
9648 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
9655 return IsLaxCompatible(FirstType, SecondType) ||
9656 IsLaxCompatible(SecondType, FirstType);
9663 if (
Attr->getAttrKind() == attr::ObjCOwnership)
9666 Ty =
Attr->getModifiedType();
9670 Ty =
Paren->getInnerType();
9702 for (
auto *lhsProto : lhs->
quals()) {
9704 for (
auto *rhsProto : rhs->
quals()) {
9735 for (
auto *I : lhs->
quals()) {
9739 if (!rhsID->ClassImplementsProtocol(I,
true))
9747 for (
auto *lhsProto : lhs->
quals()) {
9753 for (
auto *rhsProto : rhs->
quals()) {
9763 for (
auto *I : lhs->
quals()) {
9767 if (rhsID->ClassImplementsProtocol(I,
true)) {
9784 for (
auto *lhsProto : lhs->
quals()) {
9792 for (
auto *rhsProto : rhs->
quals()) {
9811 if (LHSInheritedProtocols.empty() && lhs->
qual_empty())
9813 for (
auto *lhsProto : LHSInheritedProtocols) {
9815 for (
auto *rhsProto : rhs->
quals()) {
9845 auto finish = [&](
bool succeeded) ->
bool {
9890 bool BlockReturnType) {
9894 auto finish = [&](
bool succeeded) ->
bool {
9919 if (
getLangOpts().CompatibilityQualifiedIdBlockParamTypeChecking)
9923 (!BlockReturnType &&
9927 (BlockReturnType ? LHSOPT : RHSOPT),
9928 (BlockReturnType ? RHSOPT : LHSOPT),
false));
9936 return finish(BlockReturnType);
9938 return finish(!BlockReturnType);
9950 return (*lhs)->getName().compare((*rhs)->getName());
9967 assert(LHS->
getInterface() &&
"LHS must have an interface base");
9968 assert(RHS->
getInterface() &&
"RHS must have an interface base");
9974 for (
auto *proto : LHS->
quals()) {
9985 for (
auto *proto : RHS->
quals()) {
9993 for (
auto *proto : LHSProtocolSet) {
9994 if (RHSProtocolSet.count(proto))
9995 IntersectionSet.push_back(proto);
10004 if (!ImpliedProtocols.empty()) {
10006 return ImpliedProtocols.contains(proto);
10011 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
10021 if (lhsOPT && rhsOPT)
10027 if (lhsBlock && rhsBlock)
10032 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
10044 bool stripKindOf) {
10045 if (lhsArgs.size() != rhsArgs.size())
10052 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
10058 if (!stripKindOf ||
10059 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
10060 rhsArgs[i].stripObjCKindOfType(ctx))) {
10088 if (!LDecl || !RDecl)
10098 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
10108 bool anyChanges =
false;
10126 if (!Protocols.empty())
10144 if (LHSSuperType.
isNull())
10154 if (KnownLHS != LHSAncestors.end()) {
10155 LHS = KnownLHS->second;
10159 bool anyChanges =
false;
10177 if (!Protocols.empty())
10194 if (RHSSuperType.
isNull())
10205 assert(LHS->
getInterface() &&
"LHS is not an interface type");
10206 assert(RHS->
getInterface() &&
"RHS is not an interface type");
10227 for (
auto *RHSPI : RHS->
quals())
10230 if (SuperClassInheritedProtocols.empty())
10233 for (
const auto *LHSProto : LHS->
quals()) {
10234 bool SuperImplementsProtocol =
false;
10235 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
10236 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
10237 SuperImplementsProtocol =
true;
10240 if (!SuperImplementsProtocol)
10270 if (!LHSOPT || !RHSOPT)
10288 bool CompareUnqualified) {
10307 bool OfBlockPointer,
10311 if (UD->
hasAttr<TransparentUnionAttr>()) {
10312 for (
const auto *I : UD->
fields()) {
10313 QualType ET = I->getType().getUnqualifiedType();
10327 bool OfBlockPointer,
10348 bool IsConditionalOperator) {
10351 const auto *lproto = dyn_cast<FunctionProtoType>(lbase);
10352 const auto *rproto = dyn_cast<FunctionProtoType>(rbase);
10353 bool allLTypes =
true;
10354 bool allRTypes =
true;
10358 if (OfBlockPointer) {
10360 QualType LHS = lbase->getReturnType();
10362 if (!UnqualifiedResult)
10364 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
10429 bool NoReturn = IsConditionalOperator
10439 if (lproto && rproto) {
10440 assert((AllowCXX ||
10441 (!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec())) &&
10442 "C++ shouldn't be here");
10444 if (lproto->getNumParams() != rproto->getNumParams())
10448 if (lproto->isVariadic() != rproto->isVariadic())
10451 if (lproto->getMethodQuals() != rproto->getMethodQuals())
10455 bool canUseLeft, canUseRight;
10467 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
10468 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
10469 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
10471 lParamType, rParamType, OfBlockPointer,
Unqualified);
10478 types.push_back(paramType);
10490 if (allLTypes)
return lhs;
10491 if (allRTypes)
return rhs;
10496 newParamInfos.empty() ? nullptr : newParamInfos.data();
10500 if (lproto) allRTypes =
false;
10501 if (rproto) allLTypes =
false;
10505 assert((AllowCXX || !proto->
hasExceptionSpec()) &&
"C++ shouldn't be here");
10513 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
10519 paramTy =
Enum->getDecl()->getIntegerType();
10529 if (allLTypes)
return lhs;
10530 if (allRTypes)
return rhs;
10537 if (allLTypes)
return lhs;
10538 if (allRTypes)
return rhs;
10544 QualType other,
bool isBlockReturnType) {
10550 if (underlyingType.
isNull())
10566 bool IsConditionalOperator) {
10577 if (LangOpts.OpenMP && LHSRefTy && RHSRefTy &&
10581 if (LHSRefTy || RHSRefTy)
10593 if (LHSCan == RHSCan)
10598 Qualifiers RQuals = RHSCan.getLocalQualifiers();
10599 if (LQuals != RQuals) {
10615 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
10636 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
10637 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
10640 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
10641 LHSClass = Type::ConstantArray;
10642 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
10643 RHSClass = Type::ConstantArray;
10646 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
10647 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
10650 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
10651 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
10654 if (LHSClass != RHSClass) {
10664 if (OfBlockPointer && !BlockReturnType) {
10673 if (!AT->isDeduced() && AT->isGNUAutoType())
10677 if (!AT->isDeduced() && AT->isGNUAutoType())
10684 switch (LHSClass) {
10685#define TYPE(Class, Base)
10686#define ABSTRACT_TYPE(Class, Base)
10687#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
10688#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
10689#define DEPENDENT_TYPE(Class, Base) case Type::Class:
10690#include "clang/AST/TypeNodes.inc"
10691 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
10694 case Type::DeducedTemplateSpecialization:
10695 case Type::LValueReference:
10696 case Type::RValueReference:
10697 case Type::MemberPointer:
10698 llvm_unreachable(
"C++ should never be in mergeTypes");
10700 case Type::ObjCInterface:
10701 case Type::IncompleteArray:
10702 case Type::VariableArray:
10703 case Type::FunctionProto:
10704 case Type::ExtVector:
10705 llvm_unreachable(
"Types are eliminated above");
10707 case Type::Pointer:
10718 if (ResultType.
isNull())
10726 case Type::BlockPointer:
10751 if (ResultType.
isNull())
10770 if (ResultType.
isNull())
10778 case Type::ConstantArray:
10793 if (ResultType.
isNull())
10801 if (LVAT || RVAT) {
10804 -> std::pair<bool,llvm::APInt> {
10806 std::optional<llvm::APSInt> TheInt;
10809 return std::make_pair(
true, *TheInt);
10810 return std::make_pair(
false, llvm::APSInt());
10813 return std::make_pair(
true, CAT->getSize());
10814 return std::make_pair(
false, llvm::APInt());
10817 bool HaveLSize, HaveRSize;
10818 llvm::APInt LSize, RSize;
10819 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
10820 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
10821 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
10855 case Type::FunctionNoProto:
10857 false, IsConditionalOperator);
10861 case Type::Builtin:
10864 case Type::Complex:
10873 case Type::ConstantMatrix:
10878 case Type::ObjCObject: {
10887 case Type::ObjCObjectPointer:
10888 if (OfBlockPointer) {
10900 assert(LHS != RHS &&
10901 "Equivalent pipe types should have already been handled!");
10903 case Type::BitInt: {
10911 if (LHSUnsigned != RHSUnsigned)
10914 if (LHSBits != RHSBits)
10920 llvm_unreachable(
"Invalid Type::Class!");
10925 bool &CanUseFirst,
bool &CanUseSecond,
10927 assert(NewParamInfos.empty() &&
"param info list not empty");
10928 CanUseFirst = CanUseSecond =
true;
10934 if (!FirstHasInfo && !SecondHasInfo)
10937 bool NeedParamInfo =
false;
10941 for (
size_t I = 0; I < E; ++I) {
10952 bool FirstNoEscape = FirstParam.
isNoEscape();
10953 bool SecondNoEscape = SecondParam.
isNoEscape();
10954 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
10956 if (NewParamInfos.back().getOpaqueValue())
10957 NeedParamInfo =
true;
10958 if (FirstNoEscape != IsNoEscape)
10959 CanUseFirst =
false;
10960 if (SecondNoEscape != IsNoEscape)
10961 CanUseSecond =
false;
10964 if (!NeedParamInfo)
10965 NewParamInfos.clear();
10971 ObjCLayouts[CD] =
nullptr;
10981 if (LHSCan == RHSCan)
10983 if (RHSCan->isFunctionType()) {
10987 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
10989 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
10992 if (ResReturnType.
isNull())
10994 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
10998 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
11011 Qualifiers RQuals = RHSCan.getLocalQualifiers();
11012 if (LQuals != RQuals) {
11025 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11041 if (ResQT == LHSBaseQT)
11043 if (ResQT == RHSBaseQT)
11055 T = ET->getDecl()->getIntegerType();
11059 return EIT->getNumBits();
11067 "Unexpected type");
11072 VTy->getNumElements(), VTy->getVectorKind());
11081 T = ETy->getDecl()->getIntegerType();
11084 case BuiltinType::Char_U:
11086 case BuiltinType::Char_S:
11087 case BuiltinType::SChar:
11088 case BuiltinType::Char8:
11090 case BuiltinType::Short:
11092 case BuiltinType::Int:
11094 case BuiltinType::Long:
11096 case BuiltinType::LongLong:
11098 case BuiltinType::Int128:
11103 case BuiltinType::WChar_S:
11106 case BuiltinType::ShortAccum:
11108 case BuiltinType::Accum:
11110 case BuiltinType::LongAccum:
11112 case BuiltinType::SatShortAccum:
11114 case BuiltinType::SatAccum:
11116 case BuiltinType::SatLongAccum:
11118 case BuiltinType::ShortFract:
11120 case BuiltinType::Fract:
11122 case BuiltinType::LongFract:
11124 case BuiltinType::SatShortFract:
11126 case BuiltinType::SatFract:
11128 case BuiltinType::SatLongFract:
11133 "Unexpected signed integer or fixed point type");
11141 "Unexpected type");
11146 VTy->getNumElements(), VTy->getVectorKind());
11155 T = ETy->getDecl()->getIntegerType();
11158 case BuiltinType::Char_S:
11160 case BuiltinType::Char_U:
11161 case BuiltinType::UChar:
11162 case BuiltinType::Char8:
11164 case BuiltinType::UShort:
11166 case BuiltinType::UInt:
11168 case BuiltinType::ULong:
11170 case BuiltinType::ULongLong:
11172 case BuiltinType::UInt128:
11177 case BuiltinType::WChar_U:
11180 case BuiltinType::UShortAccum:
11182 case BuiltinType::UAccum:
11184 case BuiltinType::ULongAccum:
11186 case BuiltinType::SatUShortAccum:
11188 case BuiltinType::SatUAccum:
11190 case BuiltinType::SatULongAccum:
11192 case BuiltinType::UShortFract:
11194 case BuiltinType::UFract:
11196 case BuiltinType::ULongFract:
11198 case BuiltinType::SatUShortFract:
11200 case BuiltinType::SatUFract:
11202 case BuiltinType::SatULongFract:
11207 "Unexpected signed integer or fixed point type");
11232 bool AllowTypeModifiers) {
11236 RequiresICE =
false;
11241 bool IsSpecial =
false;
11245 default: Done =
true; --Str;
break;
11247 RequiresICE =
true;
11250 assert(!
Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
11251 assert(!
Signed &&
"Can't use 'S' modifier multiple times!");
11255 assert(!
Signed &&
"Can't use both 'S' and 'U' modifiers!");
11256 assert(!
Unsigned &&
"Can't use 'U' modifier multiple times!");
11260 assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
11261 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
11266 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11267 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
11276 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11277 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
11283 llvm_unreachable(
"Unexpected integer type");
11294 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11295 assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
11301 llvm_unreachable(
"Unexpected integer type");
11314 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11315 assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
11331 default: llvm_unreachable(
"Unknown builtin type letter!");
11334 "Bad modifiers used with 'x'!");
11339 "Bad modifiers used with 'y'!");
11344 "Bad modifiers used with 'v'!");
11349 "Bad modifiers used with 'h'!");
11354 "Bad modifiers used with 'f'!");
11359 "Bad modifiers used with 'd'!");
11362 else if (HowLong == 2)
11368 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
11377 else if (HowLong == 2)
11379 else if (HowLong == 1)
11385 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
11394 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'b'!");
11398 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'z'!");
11402 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'w'!");
11419 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
11431 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
11439 unsigned NumElements = strtoul(Str, &End, 10);
11440 assert(End != Str &&
"Missing vector size");
11444 RequiresICE,
false);
11445 assert(!RequiresICE &&
"Can't require vector ICE");
11453 Type = Context.SveCountTy;
11457 llvm_unreachable(
"Unexpected target builtin type");
11463 unsigned NumElements = strtoul(Str, &End, 10);
11464 assert(End != Str &&
"Missing vector size");
11468 RequiresICE,
false);
11469 assert(!RequiresICE &&
"Can't require vector ICE");
11478 unsigned NumElements = strtoul(Str, &End, 10);
11479 assert(End != Str &&
"Missing vector size");
11491 assert(!RequiresICE &&
"Can't require complex ICE");
11500 if (
Type.isNull()) {
11511 if (
Type.isNull()) {
11517 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'K'!");
11520 if (
Type.isNull()) {
11531 Done = !AllowTypeModifiers;
11533 switch (
char c = *Str++) {
11534 default: Done =
true; --Str;
break;
11540 unsigned AddrSpace = strtoul(Str, &End, 10);
11568 "Integer constant 'I' type must be an integer");
11581 bool AllowTypeModifiers)
const {
11588 unsigned *IntegerConstantArgs)
const {
11590 if (TypeStr[0] ==
'\0') {
11597 bool RequiresICE =
false;
11600 RequiresICE,
true);
11604 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
11606 while (TypeStr[0] && TypeStr[0] !=
'.') {
11613 if (RequiresICE && IntegerConstantArgs)
11614 *IntegerConstantArgs |= 1 << ArgTypes.size();
11620 ArgTypes.push_back(Ty);
11623 if (
Id == Builtin::BI__GetExceptionInfo)
11626 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
11627 "'.' should only occur at end of builtin type list!");
11629 bool Variadic = (TypeStr[0] ==
'.');
11632 Variadic,
false,
true));
11637 if (ArgTypes.empty() && Variadic && !
getLangOpts().requiresStrictPrototypes())
11689 !FD->
hasAttr<DLLExportAttr>()) ||
11690 FD->
hasAttr<GNUInlineAttr>()) {
11709 isa<CXXConstructorDecl>(FD) &&
11710 cast<CXXConstructorDecl>(FD)->isInheritingConstructor())
11723 if (D->
hasAttr<DLLImportAttr>()) {
11726 }
else if (D->
hasAttr<DLLExportAttr>()) {
11732 if (D->
hasAttr<CUDAGlobalAttr>() &&
11795 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
11800 if (!LexicalContext)
11805 auto StaticLocalLinkage =
11817 return StaticLocalLinkage;
11844 return StrongLinkage;
11862 llvm_unreachable(
"Invalid Linkage!");
11872 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
11873 if (!VD->isFileVarDecl())
11878 if (VD->getDescribedVarTemplate() ||
11879 isa<VarTemplatePartialSpecializationDecl>(VD))
11881 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
11885 }
else if (isa<PragmaCommentDecl>(D))
11887 else if (isa<PragmaDetectMismatchDecl>(D))
11889 else if (isa<OMPRequiresDecl>(D))
11891 else if (isa<OMPThreadPrivateDecl>(D))
11893 else if (isa<OMPAllocateDecl>(D))
11895 else if (isa<OMPDeclareReductionDecl>(D) || isa<OMPDeclareMapperDecl>(D))
11897 else if (isa<ImportDecl>(D))
11907 if (D->
hasAttr<WeakRefAttr>())
11914 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
11916 if (!FD->doesThisDeclarationHaveABody())
11917 return FD->doesDeclarationForceExternallyVisibleDefinition();
11920 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
11925 if (
getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {
11926 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
11944 const auto *VD = cast<VarDecl>(D);
11945 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
11949 if (LangOpts.OpenMP &&
11950 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
11958 if (VD->isInAnotherModuleUnit())
11971 if (VD->needsDestruction(*
this))
11975 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
11977 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
11982 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
11983 for (
const auto *BD : DD->bindings())
11984 if (
const auto *BindingVD = BD->getHoldingVar())
11993 llvm::function_ref<
void(
FunctionDecl *)> Pred)
const {
11994 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
11995 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
12000 for (
auto *CurDecl :
12004 !SeenDecls.contains(CurFD)) {
12005 SeenDecls.insert(CurFD);
12013 bool IsBuiltin)
const {
12016 return ABI->getDefaultMethodCallConv(IsVariadic);
12021 switch (LangOpts.getDefaultCallingConv()) {
12050 return Target->getDefaultCallingConv();
12055 return ABI->isNearlyEmpty(RD);
12059 if (!VTContext.get()) {
12060 auto ABI =
Target->getCXXABI();
12061 if (ABI.isMicrosoft())
12064 auto ComponentLayout =
getLangOpts().RelativeCXXABIVTables
12070 return VTContext.get();
12077 case TargetCXXABI::AppleARM64:
12078 case TargetCXXABI::Fuchsia:
12079 case TargetCXXABI::GenericAArch64:
12080 case TargetCXXABI::GenericItanium:
12081 case TargetCXXABI::GenericARM:
12082 case TargetCXXABI::GenericMIPS:
12083 case TargetCXXABI::iOS:
12084 case TargetCXXABI::WebAssembly:
12085 case TargetCXXABI::WatchOS:
12086 case TargetCXXABI::XL:
12088 case TargetCXXABI::Microsoft:
12091 llvm_unreachable(
"Unsupported ABI");
12096 "Device mangle context does not support Microsoft mangling.");
12098 case TargetCXXABI::AppleARM64:
12099 case TargetCXXABI::Fuchsia:
12100 case TargetCXXABI::GenericAArch64:
12101 case TargetCXXABI::GenericItanium:
12102 case TargetCXXABI::GenericARM:
12103 case TargetCXXABI::GenericMIPS:
12104 case TargetCXXABI::iOS:
12105 case TargetCXXABI::WebAssembly:
12106 case TargetCXXABI::WatchOS:
12107 case TargetCXXABI::XL:
12111 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND))
12112 return RD->getDeviceLambdaManglingNumber();
12113 return std::nullopt;
12116 case TargetCXXABI::Microsoft:
12120 llvm_unreachable(
"Unsupported ABI");
12126 return ASTRecordLayouts.getMemorySize() +
12127 llvm::capacity_in_bytes(ObjCLayouts) +
12128 llvm::capacity_in_bytes(KeyFunctions) +
12129 llvm::capacity_in_bytes(ObjCImpls) +
12130 llvm::capacity_in_bytes(BlockVarCopyInits) +
12131 llvm::capacity_in_bytes(DeclAttrs) +
12132 llvm::capacity_in_bytes(TemplateOrInstantiation) +
12133 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
12134 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
12135 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
12136 llvm::capacity_in_bytes(OverriddenMethods) +
12137 llvm::capacity_in_bytes(Types) +
12138 llvm::capacity_in_bytes(VariableArrayTypes);
12146 unsigned Signed)
const {
12149 if (!QualTy && DestWidth == 128)
12178 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
12183 MangleNumbers[ND] = Number;
12187 bool ForAuxTarget)
const {
12188 auto I = MangleNumbers.find(ND);
12189 unsigned Res = I != MangleNumbers.end() ? I->second : 1;
12192 if (LangOpts.CUDA && !LangOpts.CUDAIsDevice) {
12193 Res = ForAuxTarget ? Res >> 16 : Res & 0xFFFF;
12195 assert(!ForAuxTarget &&
"Only CUDA/HIP host compilation supports mangling "
12196 "number for aux target");
12198 return Res > 1 ? Res : 1;
12203 StaticLocalNumbers[VD] = Number;
12207 auto I = StaticLocalNumbers.find(VD);
12208 return I != StaticLocalNumbers.end() ? I->second : 1;
12213 assert(LangOpts.CPlusPlus);
12214 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
12222 assert(LangOpts.CPlusPlus);
12223 std::unique_ptr<MangleNumberingContext> &MCtx =
12224 ExtraMangleNumberingContexts[D];
12230std::unique_ptr<MangleNumberingContext>
12232 return ABI->createMangleNumberingContext();
12237 return ABI->getCopyConstructorForExceptionObject(
12243 return ABI->addCopyConstructorForExceptionObject(
12250 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
12255 return ABI->getTypedefNameForUnnamedTagDecl(TD);
12260 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
12264 return ABI->getDeclaratorForUnnamedTagDecl(TD);
12268 ParamIndices[D] = index;
12272 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
12273 assert(I != ParamIndices.end() &&
12274 "ParmIndices lacks entry set by ParmVarDecl");
12279 unsigned Length)
const {
12305 assert(
MSGuidTagDecl &&
"building MS GUID without MS extensions?");
12307 llvm::FoldingSetNodeID ID;
12311 if (
MSGuidDecl *Existing = MSGuidDecls.FindNodeOrInsertPos(ID, InsertPos))
12315 MSGuidDecl *New = MSGuidDecl::Create(*
this, GUIDType, Parts);
12316 MSGuidDecls.InsertNode(New, InsertPos);
12322 const APValue &APVal)
const {
12323 llvm::FoldingSetNodeID ID;
12328 UnnamedGlobalConstantDecls.FindNodeOrInsertPos(ID, InsertPos))
12332 UnnamedGlobalConstantDecl::Create(*
this, Ty, APVal);
12333 UnnamedGlobalConstantDecls.InsertNode(New, InsertPos);
12339 assert(T->
isRecordType() &&
"template param object of unexpected type");
12345 llvm::FoldingSetNodeID ID;
12350 TemplateParamObjectDecls.FindNodeOrInsertPos(ID, InsertPos))
12354 TemplateParamObjectDecls.InsertNode(New, InsertPos);
12360 if (!T.isOSDarwin())
12363 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
12364 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
12373 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
12380 if (MethodDecl->
hasAttr<UnavailableAttr>()
12381 || MethodDecl->
hasAttr<DeprecatedAttr>())
12395 IM != EM && IF != EF; ++IM, ++IF) {
12426 llvm::FoldingSetNodeID IDX, IDY;
12427 X->Profile(IDX, *
this,
true);
12428 Y->
Profile(IDY, *
this,
true);
12442 for (
const Decl *DX :
X->redecls()) {
12447 if (DX->isFirstDecl())
12450 llvm_unreachable(
"Corrupt redecls chain");
12453template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
12455 return cast_or_null<T>(
12457 const_cast<Decl *
>(cast_or_null<Decl>(Y))));
12460template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
12463 const_cast<Decl *
>(cast<Decl>(Y))));
12489 assert(Xs.size() == Ys.size());
12491 for (
size_t I = 0; I < Rs.size(); ++I)
12498 return X->getAttributeLoc() == Y->getAttributeLoc() ?
X->getAttributeLoc()
12508 switch (
X.getKind()) {
12538 auto NExpX =
X.getNumTemplateExpansions();
12552 if (Xs.size() != Ys.size())
12554 R.resize(Xs.size());
12555 for (
size_t I = 0; I < R.size(); ++I) {
12568 assert(!Different);
12575 return X->getKeyword() == Y->getKeyword() ?
X->getKeyword()
12583 return X->getQualifier() == Y->getQualifier()
12584 ?
X->getQualifier()
12597 QualType EX =
X->getElementType(), EY = Y->getElementType();
12602 QY += EY.getQualifiers() - RQ;
12612 assert(Ctx.
hasSameExpr(
X->getSizeExpr(), Y->getSizeExpr()));
12613 return X->getSizeExpr();
12618 return X->getSizeModifier();
12624 return X->getIndexTypeCVRQualifiers();
12633 llvm::DenseMap<QualType, unsigned> Found;
12634 for (
auto Ts : {
X, Y}) {
12641 Out.emplace_back(T);
12651 bool AcceptDependent) {
12677 assert(AcceptDependent &&
12678 "computing composite pointer type of dependent types");
12693 llvm_unreachable(
"These ESTs should be handled above");
12698 assert(EST2 ==
EST_Dynamic &&
"other cases should already be handled");
12702 Result.Exceptions = ExceptionTypeStorage;
12709 llvm_unreachable(
"shouldn't see unresolved exception specifications here");
12712 llvm_unreachable(
"invalid ExceptionSpecificationType");
12721#define UNEXPECTED_TYPE(Class, Kind) \
12722 case Type::Class: \
12723 llvm_unreachable("Unexpected " Kind ": " #Class);
12725#define NON_CANONICAL_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "non-canonical")
12726#define TYPE(Class, Base)
12727#include "clang/AST/TypeNodes.inc"
12729#define SUGAR_FREE_TYPE(Class) UNEXPECTED_TYPE(Class, "sugar-free")
12739#undef SUGAR_FREE_TYPE
12740#define NON_UNIQUE_TYPE(Class) UNEXPECTED_TYPE(Class, "non-unique")
12743#undef NON_UNIQUE_TYPE
12747#undef UNEXPECTED_TYPE
12750 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
12751 assert(AX->getDeducedType().isNull());
12752 assert(AY->getDeducedType().isNull());
12753 assert(AX->getKeyword() == AY->getKeyword());
12754 assert(AX->isInstantiationDependentType() ==
12755 AY->isInstantiationDependentType());
12757 AY->getTypeConstraintArguments());
12760 AX->containsUnexpandedParameterPack(),
12762 AY->getTypeConstraintConcept()),
12765 case Type::IncompleteArray: {
12766 const auto *AX = cast<IncompleteArrayType>(
X),
12767 *AY = cast<IncompleteArrayType>(Y);
12772 case Type::DependentSizedArray: {
12773 const auto *AX = cast<DependentSizedArrayType>(
X),
12774 *AY = cast<DependentSizedArrayType>(Y);
12779 AX->getBracketsRange() == AY->getBracketsRange()
12780 ? AX->getBracketsRange()
12783 case Type::ConstantArray: {
12784 const auto *AX = cast<ConstantArrayType>(
X),
12785 *AY = cast<ConstantArrayType>(Y);
12786 assert(AX->getSize() == AY->getSize());
12787 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
12788 ? AX->getSizeExpr()
12794 case Type::Atomic: {
12795 const auto *AX = cast<AtomicType>(
X), *AY = cast<AtomicType>(Y);
12799 case Type::Complex: {
12800 const auto *CX = cast<ComplexType>(
X), *CY = cast<ComplexType>(Y);
12803 case Type::Pointer: {
12804 const auto *PX = cast<PointerType>(
X), *PY = cast<PointerType>(Y);
12807 case Type::BlockPointer: {
12808 const auto *PX = cast<BlockPointerType>(
X), *PY = cast<BlockPointerType>(Y);
12811 case Type::ObjCObjectPointer: {
12812 const auto *PX = cast<ObjCObjectPointerType>(
X),
12813 *PY = cast<ObjCObjectPointerType>(Y);
12816 case Type::MemberPointer: {
12817 const auto *PX = cast<MemberPointerType>(
X),
12818 *PY = cast<MemberPointerType>(Y);
12825 case Type::LValueReference: {
12826 const auto *PX = cast<LValueReferenceType>(
X),
12827 *PY = cast<LValueReferenceType>(Y);
12830 PX->isSpelledAsLValue() ||
12831 PY->isSpelledAsLValue());
12833 case Type::RValueReference: {
12834 const auto *PX = cast<RValueReferenceType>(
X),
12835 *PY = cast<RValueReferenceType>(Y);
12839 case Type::DependentAddressSpace: {
12840 const auto *PX = cast<DependentAddressSpaceType>(
X),
12841 *PY = cast<DependentAddressSpaceType>(Y);
12842 assert(Ctx.
hasSameExpr(PX->getAddrSpaceExpr(), PY->getAddrSpaceExpr()));
12844 PX->getAddrSpaceExpr(),
12847 case Type::FunctionNoProto: {
12848 const auto *FX = cast<FunctionNoProtoType>(
X),
12849 *FY = cast<FunctionNoProtoType>(Y);
12850 assert(FX->getExtInfo() == FY->getExtInfo());
12855 case Type::FunctionProto: {
12856 const auto *FX = cast<FunctionProtoType>(
X),
12857 *FY = cast<FunctionProtoType>(Y);
12859 EPIY = FY->getExtProtoInfo();
12860 assert(EPIX.
ExtInfo == EPIY.ExtInfo);
12863 assert(EPIX.
TypeQuals == EPIY.TypeQuals);
12864 assert(EPIX.
Variadic == EPIY.Variadic);
12881 case Type::ObjCObject: {
12882 const auto *OX = cast<ObjCObjectType>(
X), *OY = cast<ObjCObjectType>(Y);
12884 std::equal(OX->getProtocols().begin(), OX->getProtocols().end(),
12885 OY->getProtocols().begin(), OY->getProtocols().end(),
12887 return P0->getCanonicalDecl() == P1->getCanonicalDecl();
12889 "protocol lists must be the same");
12891 OY->getTypeArgsAsWritten());
12894 OX->getProtocols(),
12895 OX->isKindOfTypeAsWritten() && OY->isKindOfTypeAsWritten());
12897 case Type::ConstantMatrix: {
12898 const auto *MX = cast<ConstantMatrixType>(
X),
12899 *MY = cast<ConstantMatrixType>(Y);
12900 assert(MX->getNumRows() == MY->getNumRows());
12901 assert(MX->getNumColumns() == MY->getNumColumns());
12903 MX->getNumRows(), MX->getNumColumns());
12905 case Type::DependentSizedMatrix: {
12906 const auto *MX = cast<DependentSizedMatrixType>(
X),
12907 *MY = cast<DependentSizedMatrixType>(Y);
12908 assert(Ctx.
hasSameExpr(MX->getRowExpr(), MY->getRowExpr()));
12909 assert(Ctx.
hasSameExpr(MX->getColumnExpr(), MY->getColumnExpr()));
12914 case Type::Vector: {
12915 const auto *VX = cast<VectorType>(
X), *VY = cast<VectorType>(Y);
12916 assert(VX->getNumElements() == VY->getNumElements());
12917 assert(VX->getVectorKind() == VY->getVectorKind());
12919 VX->getNumElements(), VX->getVectorKind());
12921 case Type::ExtVector: {
12922 const auto *VX = cast<ExtVectorType>(
X), *VY = cast<ExtVectorType>(Y);
12923 assert(VX->getNumElements() == VY->getNumElements());
12925 VX->getNumElements());
12927 case Type::DependentSizedExtVector: {
12928 const auto *VX = cast<DependentSizedExtVectorType>(
X),
12929 *VY = cast<DependentSizedExtVectorType>(Y);
12934 case Type::DependentVector: {
12935 const auto *VX = cast<DependentVectorType>(
X),
12936 *VY = cast<DependentVectorType>(Y);
12937 assert(VX->getVectorKind() == VY->getVectorKind());
12942 case Type::InjectedClassName: {
12943 const auto *IX = cast<InjectedClassNameType>(
X),
12944 *IY = cast<InjectedClassNameType>(Y);
12948 IY->getInjectedSpecializationType()));
12950 case Type::TemplateSpecialization: {
12951 const auto *TX = cast<TemplateSpecializationType>(
X),
12952 *TY = cast<TemplateSpecializationType>(Y);
12954 TY->template_arguments());
12957 TY->getTemplateName()),
12958 As,
X->getCanonicalTypeInternal());
12960 case Type::Decltype: {
12961 const auto *DX = cast<DecltypeType>(
X);
12962 [[maybe_unused]]
const auto *DY = cast<DecltypeType>(Y);
12963 assert(DX->isDependentType());
12964 assert(DY->isDependentType());
12965 assert(Ctx.
hasSameExpr(DX->getUnderlyingExpr(), DY->getUnderlyingExpr()));
12969 case Type::PackIndexing: {
12970 const auto *DX = cast<PackIndexingType>(
X);
12971 [[maybe_unused]]
const auto *DY = cast<PackIndexingType>(Y);
12972 assert(DX->isDependentType());
12973 assert(DY->isDependentType());
12974 assert(Ctx.
hasSameExpr(DX->getIndexExpr(), DY->getIndexExpr()));
12977 case Type::DependentName: {
12978 const auto *NX = cast<DependentNameType>(
X),
12979 *NY = cast<DependentNameType>(Y);
12980 assert(NX->getIdentifier() == NY->getIdentifier());
12983 NX->getIdentifier(), NX->getCanonicalTypeInternal());
12985 case Type::DependentTemplateSpecialization: {
12986 const auto *TX = cast<DependentTemplateSpecializationType>(
X),
12987 *TY = cast<DependentTemplateSpecializationType>(Y);
12988 assert(TX->getIdentifier() == TY->getIdentifier());
12990 TY->template_arguments());
12993 TX->getIdentifier(), As);
12995 case Type::UnaryTransform: {
12996 const auto *TX = cast<UnaryTransformType>(
X),
12997 *TY = cast<UnaryTransformType>(Y);
12998 assert(TX->getUTTKind() == TY->getUTTKind());
13002 TY->getUnderlyingType()),
13005 case Type::PackExpansion: {
13006 const auto *PX = cast<PackExpansionType>(
X),
13007 *PY = cast<PackExpansionType>(Y);
13008 assert(PX->getNumExpansions() == PY->getNumExpansions());
13011 PX->getNumExpansions(),
false);
13014 const auto *PX = cast<PipeType>(
X), *PY = cast<PipeType>(Y);
13015 assert(PX->isReadOnly() == PY->isReadOnly());
13020 case Type::TemplateTypeParm: {
13021 const auto *TX = cast<TemplateTypeParmType>(
X),
13022 *TY = cast<TemplateTypeParmType>(Y);
13023 assert(TX->getDepth() == TY->getDepth());
13024 assert(TX->getIndex() == TY->getIndex());
13025 assert(TX->isParameterPack() == TY->isParameterPack());
13027 TX->getDepth(), TX->getIndex(), TX->isParameterPack(),
13031 llvm_unreachable(
"Unknown Type Class");
13041#define UNEXPECTED_TYPE(Class, Kind) \
13042 case Type::Class: \
13043 llvm_unreachable("Unexpected " Kind ": " #Class);
13044#define TYPE(Class, Base)
13045#define DEPENDENT_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "dependent")
13046#include "clang/AST/TypeNodes.inc"
13048#define CANONICAL_TYPE(Class) UNEXPECTED_TYPE(Class, "canonical")
13072#undef CANONICAL_TYPE
13074#undef UNEXPECTED_TYPE
13076 case Type::Adjusted: {
13077 const auto *AX = cast<AdjustedType>(
X), *AY = cast<AdjustedType>(Y);
13078 QualType OX = AX->getOriginalType(), OY = AY->getOriginalType();
13085 case Type::Decayed: {
13086 const auto *DX = cast<DecayedType>(
X), *DY = cast<DecayedType>(Y);
13087 QualType OX = DX->getOriginalType(), OY = DY->getOriginalType();
13094 case Type::Attributed: {
13095 const auto *AX = cast<AttributedType>(
X), *AY = cast<AttributedType>(Y);
13097 if (Kind != AY->getAttrKind())
13099 QualType MX = AX->getModifiedType(), MY = AY->getModifiedType();
13106 case Type::BTFTagAttributed: {
13107 const auto *BX = cast<BTFTagAttributedType>(
X);
13108 const BTFTypeTagAttr *AX = BX->getAttr();
13110 if (AX->getBTFTypeTag() !=
13111 cast<BTFTagAttributedType>(Y)->getAttr()->getBTFTypeTag())
13116 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
13119 if (KW != AY->getKeyword())
13123 AY->getTypeConstraintConcept());
13127 AY->getTypeConstraintArguments())) {
13135 false,
false, CD, As);
13137 case Type::PackIndexing:
13138 case Type::Decltype:
13140 case Type::DeducedTemplateSpecialization:
13144 case Type::Elaborated: {
13145 const auto *EX = cast<ElaboratedType>(
X), *EY = cast<ElaboratedType>(Y);
13151 case Type::MacroQualified: {
13152 const auto *MX = cast<MacroQualifiedType>(
X),
13153 *MY = cast<MacroQualifiedType>(Y);
13155 if (IX != MY->getMacroIdentifier())
13159 case Type::SubstTemplateTypeParm: {
13160 const auto *SX = cast<SubstTemplateTypeParmType>(
X),
13161 *SY = cast<SubstTemplateTypeParmType>(Y);
13166 unsigned Index = SX->getIndex();
13167 if (Index != SY->getIndex())
13169 auto PackIndex = SX->getPackIndex();
13170 if (PackIndex != SY->getPackIndex())
13173 CD, Index, PackIndex);
13175 case Type::ObjCTypeParam:
13181 case Type::TemplateSpecialization: {
13182 const auto *TX = cast<TemplateSpecializationType>(
X),
13183 *TY = cast<TemplateSpecializationType>(Y);
13185 TY->getTemplateName());
13190 TY->template_arguments()))
13195 case Type::Typedef: {
13196 const auto *TX = cast<TypedefType>(
X), *TY = cast<TypedefType>(Y);
13202 case Type::TypeOf: {
13208 if (cast<TypeOfType>(
X)->
getKind() == cast<TypeOfType>(Y)->
getKind() &&
13213 case Type::TypeOfExpr:
13216 case Type::UnaryTransform: {
13217 const auto *UX = cast<UnaryTransformType>(
X),
13218 *UY = cast<UnaryTransformType>(Y);
13220 if (KX != UY->getUTTKind())
13222 QualType BX = UX->getBaseType(), BY = UY->getBaseType();
13229 case Type::Using: {
13230 const auto *UX = cast<UsingType>(
X), *UY = cast<UsingType>(Y);
13238 llvm_unreachable(
"Unhandled Type Class");
13260 if (
X.isCanonical())
13273 if (SX.
Ty != SY.Ty) {
13281 while (!Xs.empty() && !Ys.empty() && Xs.back().Ty == Ys.back().Ty) {
13284 SX = Xs.pop_back_val();
13285 SY = Ys.pop_back_val();
13295 while (!Xs.empty() && !Ys.empty()) {
13298 SX = Xs.pop_back_val();
13299 SY = Ys.pop_back_val();
13304 SX.
Ty = Underlying.Ty;
13307 QX -= Underlying.Quals;
13325 llvm_unreachable(
"Not a saturated fixed point type!");
13326 case BuiltinType::SatShortAccum:
13328 case BuiltinType::SatAccum:
13330 case BuiltinType::SatLongAccum:
13332 case BuiltinType::SatUShortAccum:
13334 case BuiltinType::SatUAccum:
13336 case BuiltinType::SatULongAccum:
13338 case BuiltinType::SatShortFract:
13340 case BuiltinType::SatFract:
13342 case BuiltinType::SatLongFract:
13344 case BuiltinType::SatUShortFract:
13346 case BuiltinType::SatUFract:
13348 case BuiltinType::SatULongFract:
13360 llvm_unreachable(
"Not a fixed point type!");
13361 case BuiltinType::ShortAccum:
13363 case BuiltinType::Accum:
13365 case BuiltinType::LongAccum:
13367 case BuiltinType::UShortAccum:
13369 case BuiltinType::UAccum:
13371 case BuiltinType::ULongAccum:
13373 case BuiltinType::ShortFract:
13375 case BuiltinType::Fract:
13377 case BuiltinType::LongFract:
13379 case BuiltinType::UShortFract:
13381 case BuiltinType::UFract:
13383 case BuiltinType::ULongFract:
13389 if (LangOpts.OpenCL)
13413 llvm_unreachable(
"Not a fixed point type!");
13414 case BuiltinType::ShortAccum:
13415 case BuiltinType::SatShortAccum:
13416 return Target.getShortAccumScale();
13417 case BuiltinType::Accum:
13418 case BuiltinType::SatAccum:
13419 return Target.getAccumScale();
13420 case BuiltinType::LongAccum:
13421 case BuiltinType::SatLongAccum:
13422 return Target.getLongAccumScale();
13423 case BuiltinType::UShortAccum:
13424 case BuiltinType::SatUShortAccum:
13425 return Target.getUnsignedShortAccumScale();
13426 case BuiltinType::UAccum:
13427 case BuiltinType::SatUAccum:
13428 return Target.getUnsignedAccumScale();
13429 case BuiltinType::ULongAccum:
13430 case BuiltinType::SatULongAccum:
13431 return Target.getUnsignedLongAccumScale();
13432 case BuiltinType::ShortFract:
13433 case BuiltinType::SatShortFract:
13434 return Target.getShortFractScale();
13435 case BuiltinType::Fract:
13436 case BuiltinType::SatFract:
13437 return Target.getFractScale();
13438 case BuiltinType::LongFract:
13439 case BuiltinType::SatLongFract:
13440 return Target.getLongFractScale();
13441 case BuiltinType::UShortFract:
13442 case BuiltinType::SatUShortFract:
13443 return Target.getUnsignedShortFractScale();
13444 case BuiltinType::UFract:
13445 case BuiltinType::SatUFract:
13446 return Target.getUnsignedFractScale();
13447 case BuiltinType::ULongFract:
13448 case BuiltinType::SatULongFract:
13449 return Target.getUnsignedLongFractScale();
13459 llvm_unreachable(
"Not a fixed point type!");
13460 case BuiltinType::ShortAccum:
13461 case BuiltinType::SatShortAccum:
13462 return Target.getShortAccumIBits();
13463 case BuiltinType::Accum:
13464 case BuiltinType::SatAccum:
13465 return Target.getAccumIBits();
13466 case BuiltinType::LongAccum:
13467 case BuiltinType::SatLongAccum:
13468 return Target.getLongAccumIBits();
13469 case BuiltinType::UShortAccum:
13470 case BuiltinType::SatUShortAccum:
13471 return Target.getUnsignedShortAccumIBits();
13472 case BuiltinType::UAccum:
13473 case BuiltinType::SatUAccum:
13474 return Target.getUnsignedAccumIBits();
13475 case BuiltinType::ULongAccum:
13476 case BuiltinType::SatULongAccum:
13477 return Target.getUnsignedLongAccumIBits();
13478 case BuiltinType::ShortFract:
13479 case BuiltinType::SatShortFract:
13480 case BuiltinType::Fract:
13481 case BuiltinType::SatFract:
13482 case BuiltinType::LongFract:
13483 case BuiltinType::SatLongFract:
13484 case BuiltinType::UShortFract:
13485 case BuiltinType::SatUShortFract:
13486 case BuiltinType::UFract:
13487 case BuiltinType::SatUFract:
13488 case BuiltinType::ULongFract:
13489 case BuiltinType::SatULongFract:
13494llvm::FixedPointSemantics
13497 "Can only get the fixed point semantics for a "
13498 "fixed point or integer type.");
13500 return llvm::FixedPointSemantics::GetIntegerSemantics(
13504 return llvm::FixedPointSemantics(
13507 !isSigned &&
getTargetInfo().doUnsignedFixedPointTypesHavePadding());
13522 "Expected unsigned fixed point type");
13525 case BuiltinType::UShortAccum:
13527 case BuiltinType::UAccum:
13529 case BuiltinType::ULongAccum:
13531 case BuiltinType::SatUShortAccum:
13533 case BuiltinType::SatUAccum:
13535 case BuiltinType::SatULongAccum:
13537 case BuiltinType::UShortFract:
13539 case BuiltinType::UFract:
13541 case BuiltinType::ULongFract:
13543 case BuiltinType::SatUShortFract:
13545 case BuiltinType::SatUFract:
13547 case BuiltinType::SatULongFract:
13550 llvm_unreachable(
"Unexpected unsigned fixed point type");
13555 const TargetVersionAttr *TV)
const {
13556 assert(TV !=
nullptr);
13558 std::vector<std::string> ResFeats;
13559 TV->getFeatures(Feats);
13560 for (
auto &Feature : Feats)
13561 if (
Target->validateCpuSupports(Feature.str()))
13563 ResFeats.push_back(
"?" + Feature.str());
13569 assert(TD !=
nullptr);
13572 llvm::erase_if(
ParsedAttr.Features, [&](
const std::string &Feat) {
13573 return !Target->isValidFeatureName(StringRef{Feat}.substr(1));
13584 Target->getTargetOpts().CPU,
13585 Target->getTargetOpts().Features);
13592 StringRef TargetCPU =
Target->getTargetOpts().CPU;
13594 if (
const auto *TD = FD->
getAttr<TargetAttr>()) {
13601 Target->getTargetOpts().FeaturesAsWritten.begin(),
13602 Target->getTargetOpts().FeaturesAsWritten.end());
13613 }
else if (
const auto *SD = FD->
getAttr<CPUSpecificAttr>()) {
13615 Target->getCPUSpecificCPUDispatchFeatures(
13617 std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
13618 Features.insert(Features.begin(),
13619 Target->getTargetOpts().FeaturesAsWritten.begin(),
13620 Target->getTargetOpts().FeaturesAsWritten.end());
13622 }
else if (
const auto *TC = FD->
getAttr<TargetClonesAttr>()) {
13623 std::vector<std::string> Features;
13625 if (
Target->getTriple().isAArch64()) {
13627 if (VersionStr !=
"default") {
13629 VersionStr.split(VersionFeatures,
"+");
13630 for (
auto &VFeature : VersionFeatures) {
13631 VFeature = VFeature.trim();
13633 Features.push_back((StringRef{
"?"} + VFeature).str());
13636 Features.insert(Features.begin(),
13637 Target->getTargetOpts().FeaturesAsWritten.begin(),
13638 Target->getTargetOpts().FeaturesAsWritten.end());
13640 if (VersionStr.starts_with(
"arch="))
13641 TargetCPU = VersionStr.drop_front(
sizeof(
"arch=") - 1);
13642 else if (VersionStr !=
"default")
13643 Features.push_back((StringRef{
"+"} + VersionStr).str());
13646 }
else if (
const auto *TV = FD->
getAttr<TargetVersionAttr>()) {
13648 Feats.insert(Feats.begin(),
13649 Target->getTargetOpts().FeaturesAsWritten.begin(),
13650 Target->getTargetOpts().FeaturesAsWritten.end());
13653 FeatureMap =
Target->getTargetOpts().FeatureMap;
13659 return *OMPTraitInfoVector.back();
13666 return DB << Section.
Decl;
13667 return DB <<
"a prior #pragma section";
13671 bool IsInternalVar =
13674 bool IsExplicitDeviceVar = (D->
hasAttr<CUDADeviceAttr>() &&
13675 !D->
getAttr<CUDADeviceAttr>()->isImplicit()) ||
13676 (D->
hasAttr<CUDAConstantAttr>() &&
13677 !D->
getAttr<CUDAConstantAttr>()->isImplicit());
13681 return (IsInternalVar &&
13682 (D->
hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) ||
13683 (D->
hasAttr<CUDAGlobalAttr>() &&
13690 (D->
hasAttr<HIPManagedAttr>() || D->
hasAttr<CUDAGlobalAttr>() ||
13695 if (!CUIDHash.empty())
13697 if (LangOpts.
CUID.empty())
13698 return StringRef();
13699 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.
void addLazyModuleInitializers(Module *M, ArrayRef< uint32_t > IDs)
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 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...
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...
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.
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
CanQualType OMPArraySectionTy
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getBitIntType(bool Unsigned, unsigned NumBits) const
Return a bit-precise integer type with the specified signedness and bit count.
unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
virtual ~ASTMutationListener()
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
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 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...
DeclarationName getDeclName() const
Get the name of the 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 llvm::APInt & getSize() const
const Expr * getSizeExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
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 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.
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, 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.
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.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
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, 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, 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
void addConst()
Add the const type qualifier to this QualType.
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getCanonicalType() const
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
SplitQualType getSplitDesugaredType() const
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
void * getAsOpaquePtr() const
bool isConstQualified() const
Determine whether this type is const-qualified.
bool hasAddressSpace() const
Check if this type has any address space qualifier.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
QualType getSingleStepDesugaredType(const ASTContext &Context) const
Return the specified type with one level of "sugar" removed from the type.
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)
unsigned getAsOpaqueValue() const
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
bool hasObjCGCAttr() 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, 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 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 isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
bool isSVESizelessBuiltinType() const
Returns true for SVE scalable vector types.
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, 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.
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