69#include "llvm/ADT/APFixedPoint.h"
70#include "llvm/ADT/APInt.h"
71#include "llvm/ADT/APSInt.h"
72#include "llvm/ADT/ArrayRef.h"
73#include "llvm/ADT/DenseMap.h"
74#include "llvm/ADT/DenseSet.h"
75#include "llvm/ADT/FoldingSet.h"
76#include "llvm/ADT/PointerUnion.h"
77#include "llvm/ADT/STLExtras.h"
78#include "llvm/ADT/SmallPtrSet.h"
79#include "llvm/ADT/SmallVector.h"
80#include "llvm/ADT/StringExtras.h"
81#include "llvm/ADT/StringRef.h"
82#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
83#include "llvm/Support/Capacity.h"
84#include "llvm/Support/Casting.h"
85#include "llvm/Support/Compiler.h"
86#include "llvm/Support/ErrorHandling.h"
87#include "llvm/Support/MD5.h"
88#include "llvm/Support/MathExtras.h"
89#include "llvm/Support/raw_ostream.h"
90#include "llvm/TargetParser/Triple.h"
103using namespace clang;
127 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
132 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
133 if (VD->isStaticDataMember() &&
138 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
143 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
150 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
154 if (
const auto *TD = dyn_cast<TagDecl>(D)) {
157 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
161 if (isa<ParmVarDecl>(D))
166 if (isa<TemplateTypeParmDecl>(D) ||
167 isa<NonTypeTemplateParmDecl>(D) ||
168 isa<TemplateTemplateParmDecl>(D))
179 if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) ||
180 isa<ObjCPropertyDecl>(D) || isa<RedeclarableTemplateDecl>(D) ||
181 isa<ClassTemplateSpecializationDecl>(D) ||
189 Locations.emplace_back(BaseLocation);
217 const std::map<unsigned, RawComment *> &CommentsInTheFile)
const {
220 if (RepresentativeLocForDecl.
isInvalid() ||
221 !RepresentativeLocForDecl.
isFileID())
225 if (CommentsInTheFile.empty())
230 const std::pair<FileID, unsigned> DeclLocDecomp =
234 auto OffsetCommentBehindDecl =
235 CommentsInTheFile.lower_bound(DeclLocDecomp.second);
238 if (OffsetCommentBehindDecl != CommentsInTheFile.end()) {
239 RawComment *CommentBehindDecl = OffsetCommentBehindDecl->second;
243 (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
244 isa<ObjCMethodDecl>(D) || isa<ObjCPropertyDecl>(D))) {
248 if (SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second) ==
250 OffsetCommentBehindDecl->first)) {
251 return CommentBehindDecl;
258 if (OffsetCommentBehindDecl == CommentsInTheFile.begin())
261 auto OffsetCommentBeforeDecl = --OffsetCommentBehindDecl;
262 RawComment *CommentBeforeDecl = OffsetCommentBeforeDecl->second;
271 const unsigned CommentEndOffset =
276 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
282 StringRef
Text(Buffer + CommentEndOffset,
283 DeclLocDecomp.second - CommentEndOffset);
287 if (
Text.find_last_of(
";{}#@") != StringRef::npos)
290 return CommentBeforeDecl;
296 for (
const auto DeclLoc : DeclLocs) {
299 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
315 if (!CommentsInThisFile || CommentsInThisFile->empty())
327 assert(LangOpts.RetainCommentsFromSystemHeaders ||
336 if (
const auto *FD = dyn_cast<FunctionDecl>(&D)) {
356 if (
const auto *VD = dyn_cast<VarDecl>(&D)) {
359 if (VD->isStaticDataMember())
365 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(&D)) {
372 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
380 : *
static_cast<const Decl *
>(
386 CRD->getMemberSpecializationInfo())
387 return *Info->getInstantiatedFrom();
391 if (
const auto *ED = dyn_cast<EnumDecl>(&D)) {
404 const Decl **OriginalDecl)
const {
407 OriginalDecl =
nullptr;
419 return DeclComment->second;
432 *OriginalDecl = RedeclComment->second;
435 "This decl is supposed to have comment attached.");
436 return CommentAtRedecl->second;
442 auto LastCheckedRedecl = [
this, CanonicalD]() ->
const Decl * {
446 for (
const auto Redecl : D->
redecls()) {
449 if (LastCheckedRedecl) {
450 if (LastCheckedRedecl == Redecl) {
451 LastCheckedRedecl =
nullptr;
459 *OriginalDecl = Redecl;
460 return RedeclComment;
466 *OriginalDecl =
nullptr;
482 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
487 for (
const auto *Ext : ID->known_extensions()) {
491 Redeclared.push_back(RedeclaredMethod);
502 for (
const Decl *D : Decls) {
503 if (D->isInvalidDecl())
516 if (
File.isInvalid())
520 if (!CommentsInThisFile || CommentsInThisFile->empty() ||
521 CommentsInThisFile->rbegin()->second->isAttached())
531 for (
const Decl *D : Decls) {
533 if (D->isInvalidDecl())
543 for (
const auto DeclLoc : DeclLocs) {
544 if (DeclLoc.isInvalid() || !DeclLoc.isFileID())
548 D, DeclLoc, *CommentsInThisFile)) {
559 const Decl *D)
const {
562 ThisDeclInfo->IsFilled =
false;
563 ThisDeclInfo->fill();
564 ThisDeclInfo->CommentDecl = FC->
getDecl();
565 if (!ThisDeclInfo->TemplateParameters)
575 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
586 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
590 if (Canonical != D) {
598 const Decl *OriginalDecl =
nullptr;
602 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
604 const auto *OMD = dyn_cast<ObjCMethodDecl>(D);
605 if (OMD && OMD->isPropertyAccessor())
612 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
616 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(D)) {
619 QualType QT = TD->getUnderlyingType();
621 if (
const Decl *TD = TT->getDecl())
625 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(D)) {
626 while (IC->getSuperClass()) {
627 IC = IC->getSuperClass();
632 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(D)) {
637 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
638 if (!(RD = RD->getDefinition()))
641 for (
const auto &I : RD->bases()) {
642 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
656 for (
const auto &I : RD->vbases()) {
677 if (D != OriginalDecl && OriginalDecl)
686ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &ID,
694 ID.AddInteger(Params->
size());
696 PEnd = Params->
end();
698 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
700 ID.AddBoolean(TTP->isParameterPack());
701 if (TTP->isExpandedParameterPack()) {
703 ID.AddInteger(TTP->getNumExpansionParameters());
705 ID.AddBoolean(
false);
709 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
711 ID.AddBoolean(NTTP->isParameterPack());
712 ID.AddPointer(
C.getUnconstrainedType(
C.getCanonicalType(NTTP->getType()))
714 if (NTTP->isExpandedParameterPack()) {
716 ID.AddInteger(NTTP->getNumExpansionTypes());
717 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
719 ID.AddPointer(
T.getCanonicalType().getAsOpaquePtr());
722 ID.AddBoolean(
false);
726 auto *TTP = cast<TemplateTemplateParmDecl>(*
P);
733ASTContext::getCanonicalTemplateTemplateParmDecl(
736 llvm::FoldingSetNodeID
ID;
737 CanonicalTemplateTemplateParm::Profile(ID, *
this, TTP);
738 void *InsertPos =
nullptr;
739 CanonicalTemplateTemplateParm *Canonical
740 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
742 return Canonical->getParam();
747 CanonParams.reserve(Params->
size());
749 PEnd = Params->
end();
753 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
759 ? std::optional<unsigned>(TTP->getNumExpansionParameters())
761 CanonParams.push_back(NewTTP);
762 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
766 if (NTTP->isExpandedParameterPack()) {
769 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
771 ExpandedTInfos.push_back(
779 NTTP->getPosition(),
nullptr,
789 NTTP->getPosition(),
nullptr,
791 NTTP->isParameterPack(),
794 CanonParams.push_back(Param);
796 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
797 cast<TemplateTemplateParmDecl>(*
P)));
808 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
809 assert(!Canonical &&
"Shouldn't be in the map!");
813 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
814 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
824 if (!LangOpts.CPlusPlus)
return nullptr;
827 case TargetCXXABI::AppleARM64:
828 case TargetCXXABI::Fuchsia:
829 case TargetCXXABI::GenericARM:
830 case TargetCXXABI::iOS:
831 case TargetCXXABI::WatchOS:
832 case TargetCXXABI::GenericAArch64:
833 case TargetCXXABI::GenericMIPS:
834 case TargetCXXABI::GenericItanium:
835 case TargetCXXABI::WebAssembly:
836 case TargetCXXABI::XL:
838 case TargetCXXABI::Microsoft:
841 llvm_unreachable(
"Invalid CXXABI type!");
845 if (!InterpContext) {
848 return *InterpContext.get();
854 return *ParentMapCtx.get();
859 switch (LangOpts.getAddressSpaceMapMangling()) {
867 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
873 : ConstantArrayTypes(this_(), ConstantArrayTypesLog2InitSize),
874 DependentSizedArrayTypes(this_()), DependentSizedExtVectorTypes(this_()),
875 DependentAddressSpaceTypes(this_()), DependentVectorTypes(this_()),
876 DependentSizedMatrixTypes(this_()),
877 FunctionProtoTypes(this_(), FunctionProtoTypesLog2InitSize),
878 DependentTypeOfExprTypes(this_()), DependentDecltypeTypes(this_()),
879 TemplateSpecializationTypes(this_()),
880 DependentTemplateSpecializationTypes(this_()), AutoTypes(this_()),
881 DependentBitIntTypes(this_()), SubstTemplateTemplateParmPacks(this_()),
882 ArrayParameterTypes(this_()), CanonTemplateTemplateParms(this_()),
883 SourceMgr(
SM), LangOpts(LOpts),
886 LangOpts.XRayNeverInstrumentFiles,
887 LangOpts.XRayAttrListFiles,
SM)),
890 BuiltinInfo(builtins), TUKind(TUKind), DeclarationNames(*this),
891 Comments(
SM), CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
892 CompCategories(this_()), LastSDM(nullptr, 0) {
899 ReleaseDeclContextMaps();
902 for (
auto &Pair : Deallocations)
903 (Pair.first)(Pair.second);
904 Deallocations.clear();
910 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
916 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
917 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
922 ASTRecordLayouts.clear();
924 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
925 AEnd = DeclAttrs.end();
927 A->second->~AttrVec();
930 for (
const auto &
Value : ModuleInitializers)
931 Value.second->~PerModuleInitializers();
932 ModuleInitializers.
clear();
938 TraversalScope = TopLevelDecls;
943 Deallocations.push_back({Callback,
Data});
952 llvm::errs() <<
"\n*** AST Context Stats:\n";
953 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
955 unsigned counts[] = {
956#define TYPE(Name, Parent) 0,
957#define ABSTRACT_TYPE(Name, Parent)
958#include "clang/AST/TypeNodes.inc"
962 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
968 unsigned TotalBytes = 0;
969#define TYPE(Name, Parent) \
971 llvm::errs() << " " << counts[Idx] << " " << #Name \
972 << " types, " << sizeof(Name##Type) << " each " \
973 << "(" << counts[Idx] * sizeof(Name##Type) \
975 TotalBytes += counts[Idx] * sizeof(Name##Type); \
977#define ABSTRACT_TYPE(Name, Parent)
978#include "clang/AST/TypeNodes.inc"
980 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
985 <<
" implicit default constructors created\n";
988 <<
" implicit copy constructors created\n";
992 <<
" implicit move constructors created\n";
995 <<
" implicit copy assignment operators created\n";
999 <<
" implicit move assignment operators created\n";
1002 <<
" implicit destructors created\n";
1005 llvm::errs() <<
"\n";
1009 BumpAlloc.PrintStats();
1013 bool NotifyListeners) {
1014 if (NotifyListeners)
1023 if (It == MergedDefModules.end())
1026 auto &Merged = It->second;
1028 for (
Module *&M : Merged)
1029 if (!Found.insert(M).second)
1031 llvm::erase(Merged,
nullptr);
1038 if (MergedIt == MergedDefModules.end())
1039 return std::nullopt;
1040 return MergedIt->second;
1043void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1044 if (LazyInitializers.empty())
1048 assert(Source &&
"lazy initializers but no external source");
1050 auto LazyInits = std::move(LazyInitializers);
1051 LazyInitializers.clear();
1053 for (
auto ID : LazyInits)
1054 Initializers.push_back(Source->GetExternalDecl(ID));
1056 assert(LazyInitializers.empty() &&
1057 "GetExternalDecl for lazy module initializer added more inits");
1063 if (
const auto *ID = dyn_cast<ImportDecl>(D)) {
1064 auto It = ModuleInitializers.find(ID->getImportedModule());
1067 if (It == ModuleInitializers.end())
1071 auto &Imported = *It->second;
1072 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1073 Imported.resolve(*
this);
1074 auto *OnlyDecl = Imported.Initializers.front();
1075 if (isa<ImportDecl>(OnlyDecl))
1080 auto *&Inits = ModuleInitializers[M];
1082 Inits =
new (*this) PerModuleInitializers;
1083 Inits->Initializers.push_back(D);
1088 auto *&Inits = ModuleInitializers[M];
1090 Inits =
new (*this) PerModuleInitializers;
1091 Inits->LazyInitializers.insert(Inits->LazyInitializers.end(),
1092 IDs.begin(), IDs.end());
1096 auto It = ModuleInitializers.find(M);
1097 if (It == ModuleInitializers.end())
1098 return std::nullopt;
1100 auto *Inits = It->second;
1101 Inits->resolve(*
this);
1102 return Inits->Initializers;
1107 assert(!CurrentCXXNamedModule &&
1108 "We should set named module for ASTContext for only once");
1109 CurrentCXXNamedModule = M;
1113 if (!ExternCContext)
1116 return ExternCContext;
1122 auto *BuiltinTemplate =
1124 BuiltinTemplate->setImplicit();
1127 return BuiltinTemplate;
1132 if (!MakeIntegerSeqDecl)
1135 return MakeIntegerSeqDecl;
1140 if (!TypePackElementDecl)
1143 return TypePackElementDecl;
1157 NewDecl->
addAttr(TypeVisibilityAttr::CreateImplicit(
1158 const_cast<ASTContext &
>(*
this), TypeVisibilityAttr::Default));
1163 StringRef Name)
const {
1187 Types.push_back(Ty);
1192 assert((!this->Target || this->Target == &
Target) &&
1193 "Incorrect target reinitialization");
1197 this->AuxTarget = AuxTarget;
1199 ABI.reset(createCXXABI(
Target));
1203 InitBuiltinType(
VoidTy, BuiltinType::Void);
1206 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1208 if (LangOpts.CharIsSigned)
1209 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1211 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1214 InitBuiltinType(
ShortTy, BuiltinType::Short);
1215 InitBuiltinType(
IntTy, BuiltinType::Int);
1216 InitBuiltinType(
LongTy, BuiltinType::Long);
1217 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1227 InitBuiltinType(
FloatTy, BuiltinType::Float);
1228 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1229 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1232 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1235 InitBuiltinType(
Ibm128Ty, BuiltinType::Ibm128);
1238 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1241 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1242 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1243 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1247 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1248 InitBuiltinType(
FractTy, BuiltinType::Fract);
1249 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1254 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1260 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1267 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1272 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1274 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1275 if (LangOpts.CPlusPlus && LangOpts.WChar)
1285 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1287 if (LangOpts.CPlusPlus)
1288 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1292 if (LangOpts.CPlusPlus)
1293 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1302 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1305 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1314 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1320 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1323 if (LangOpts.OpenMP) {
1330 if (LangOpts.OpenACC && !LangOpts.OpenMP) {
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)) {
1672 Align = getTypeInfoImpl(
T.getTypePtr()).
Align;
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);
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:
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;
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:
1910 case Type::ArrayParameter: {
1913 if (
const auto *CAT = dyn_cast<ConstantArrayType>(
T))
1914 Size = CAT->getZExtSize();
1917 assert((Size == 0 || EltInfo.
Width <= (uint64_t)(-1) / Size) &&
1918 "Overflow in array type bit size evaluation");
1919 Width = EltInfo.
Width * Size;
1920 Align = EltInfo.
Align;
1924 Width = llvm::alignTo(Width, Align);
1928 case Type::ExtVector:
1929 case Type::Vector: {
1930 const auto *VT = cast<VectorType>(
T);
1932 Width = VT->isExtVectorBoolType() ? VT->getNumElements()
1933 : EltInfo.
Width * VT->getNumElements();
1935 Width = std::max<unsigned>(8, Width);
1936 Align = std::max<unsigned>(8, Width);
1940 if (Align & (Align-1)) {
1941 Align = llvm::bit_ceil(Align);
1942 Width = llvm::alignTo(Width, Align);
1946 if (TargetVectorAlign && TargetVectorAlign < Align)
1947 Align = TargetVectorAlign;
1958 Align = std::min<unsigned>(64, Width);
1962 case Type::ConstantMatrix: {
1963 const auto *MT = cast<ConstantMatrixType>(
T);
1968 Width = ElementInfo.
Width * MT->getNumRows() * MT->getNumColumns();
1969 Align = ElementInfo.
Align;
1974 switch (cast<BuiltinType>(
T)->
getKind()) {
1975 default: llvm_unreachable(
"Unknown builtin type!");
1976 case BuiltinType::Void:
1981 case BuiltinType::Bool:
1982 Width =
Target->getBoolWidth();
1983 Align =
Target->getBoolAlign();
1985 case BuiltinType::Char_S:
1986 case BuiltinType::Char_U:
1987 case BuiltinType::UChar:
1988 case BuiltinType::SChar:
1989 case BuiltinType::Char8:
1990 Width =
Target->getCharWidth();
1991 Align =
Target->getCharAlign();
1993 case BuiltinType::WChar_S:
1994 case BuiltinType::WChar_U:
1995 Width =
Target->getWCharWidth();
1996 Align =
Target->getWCharAlign();
1998 case BuiltinType::Char16:
1999 Width =
Target->getChar16Width();
2000 Align =
Target->getChar16Align();
2002 case BuiltinType::Char32:
2003 Width =
Target->getChar32Width();
2004 Align =
Target->getChar32Align();
2006 case BuiltinType::UShort:
2007 case BuiltinType::Short:
2008 Width =
Target->getShortWidth();
2009 Align =
Target->getShortAlign();
2011 case BuiltinType::UInt:
2012 case BuiltinType::Int:
2013 Width =
Target->getIntWidth();
2014 Align =
Target->getIntAlign();
2016 case BuiltinType::ULong:
2017 case BuiltinType::Long:
2018 Width =
Target->getLongWidth();
2019 Align =
Target->getLongAlign();
2021 case BuiltinType::ULongLong:
2022 case BuiltinType::LongLong:
2023 Width =
Target->getLongLongWidth();
2024 Align =
Target->getLongLongAlign();
2026 case BuiltinType::Int128:
2027 case BuiltinType::UInt128:
2029 Align =
Target->getInt128Align();
2031 case BuiltinType::ShortAccum:
2032 case BuiltinType::UShortAccum:
2033 case BuiltinType::SatShortAccum:
2034 case BuiltinType::SatUShortAccum:
2035 Width =
Target->getShortAccumWidth();
2036 Align =
Target->getShortAccumAlign();
2038 case BuiltinType::Accum:
2039 case BuiltinType::UAccum:
2040 case BuiltinType::SatAccum:
2041 case BuiltinType::SatUAccum:
2042 Width =
Target->getAccumWidth();
2043 Align =
Target->getAccumAlign();
2045 case BuiltinType::LongAccum:
2046 case BuiltinType::ULongAccum:
2047 case BuiltinType::SatLongAccum:
2048 case BuiltinType::SatULongAccum:
2049 Width =
Target->getLongAccumWidth();
2050 Align =
Target->getLongAccumAlign();
2052 case BuiltinType::ShortFract:
2053 case BuiltinType::UShortFract:
2054 case BuiltinType::SatShortFract:
2055 case BuiltinType::SatUShortFract:
2056 Width =
Target->getShortFractWidth();
2057 Align =
Target->getShortFractAlign();
2059 case BuiltinType::Fract:
2060 case BuiltinType::UFract:
2061 case BuiltinType::SatFract:
2062 case BuiltinType::SatUFract:
2063 Width =
Target->getFractWidth();
2064 Align =
Target->getFractAlign();
2066 case BuiltinType::LongFract:
2067 case BuiltinType::ULongFract:
2068 case BuiltinType::SatLongFract:
2069 case BuiltinType::SatULongFract:
2070 Width =
Target->getLongFractWidth();
2071 Align =
Target->getLongFractAlign();
2073 case BuiltinType::BFloat16:
2074 if (
Target->hasBFloat16Type()) {
2075 Width =
Target->getBFloat16Width();
2076 Align =
Target->getBFloat16Align();
2085 case BuiltinType::Float16:
2086 case BuiltinType::Half:
2089 Width =
Target->getHalfWidth();
2090 Align =
Target->getHalfAlign();
2093 "Expected OpenMP device compilation.");
2098 case BuiltinType::Float:
2099 Width =
Target->getFloatWidth();
2100 Align =
Target->getFloatAlign();
2102 case BuiltinType::Double:
2103 Width =
Target->getDoubleWidth();
2104 Align =
Target->getDoubleAlign();
2106 case BuiltinType::Ibm128:
2107 Width =
Target->getIbm128Width();
2108 Align =
Target->getIbm128Align();
2110 case BuiltinType::LongDouble:
2117 Width =
Target->getLongDoubleWidth();
2118 Align =
Target->getLongDoubleAlign();
2121 case BuiltinType::Float128:
2124 Width =
Target->getFloat128Width();
2125 Align =
Target->getFloat128Align();
2128 "Expected OpenMP device compilation.");
2133 case BuiltinType::NullPtr:
2138 case BuiltinType::ObjCId:
2139 case BuiltinType::ObjCClass:
2140 case BuiltinType::ObjCSel:
2144 case BuiltinType::OCLSampler:
2145 case BuiltinType::OCLEvent:
2146 case BuiltinType::OCLClkEvent:
2147 case BuiltinType::OCLQueue:
2148 case BuiltinType::OCLReserveID:
2149#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
2150 case BuiltinType::Id:
2151#include "clang/Basic/OpenCLImageTypes.def"
2152#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
2153 case BuiltinType::Id:
2154#include "clang/Basic/OpenCLExtensionTypes.def"
2156 Width =
Target->getPointerWidth(AS);
2157 Align =
Target->getPointerAlign(AS);
2167#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId, NumEls, ElBits, \
2168 IsSigned, IsFP, IsBF) \
2169 case BuiltinType::Id: \
2173#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId, NumEls) \
2174 case BuiltinType::Id: \
2178#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingletonId) \
2179 case BuiltinType::Id: \
2183#include "clang/Basic/AArch64SVEACLETypes.def"
2184#define PPC_VECTOR_TYPE(Name, Id, Size) \
2185 case BuiltinType::Id: \
2189#include "clang/Basic/PPCTypes.def"
2190#define RVV_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, NF, IsSigned, \
2192 case BuiltinType::Id: \
2196#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) \
2197 case BuiltinType::Id: \
2201#include "clang/Basic/RISCVVTypes.def"
2202#define WASM_TYPE(Name, Id, SingletonId) \
2203 case BuiltinType::Id: \
2207#include "clang/Basic/WebAssemblyReferenceTypes.def"
2210 case Type::ObjCObjectPointer:
2214 case Type::BlockPointer:
2215 AS = cast<BlockPointerType>(
T)->getPointeeType().getAddressSpace();
2216 Width =
Target->getPointerWidth(AS);
2217 Align =
Target->getPointerAlign(AS);
2219 case Type::LValueReference:
2220 case Type::RValueReference:
2223 AS = cast<ReferenceType>(
T)->getPointeeType().getAddressSpace();
2224 Width =
Target->getPointerWidth(AS);
2225 Align =
Target->getPointerAlign(AS);
2228 AS = cast<PointerType>(
T)->getPointeeType().getAddressSpace();
2229 Width =
Target->getPointerWidth(AS);
2230 Align =
Target->getPointerAlign(AS);
2232 case Type::MemberPointer: {
2233 const auto *MPT = cast<MemberPointerType>(
T);
2239 case Type::Complex: {
2243 Width = EltInfo.
Width * 2;
2244 Align = EltInfo.
Align;
2247 case Type::ObjCObject:
2248 return getTypeInfo(cast<ObjCObjectType>(
T)->getBaseType().getTypePtr());
2249 case Type::Adjusted:
2252 case Type::ObjCInterface: {
2253 const auto *ObjCI = cast<ObjCInterfaceType>(
T);
2254 if (ObjCI->getDecl()->isInvalidDecl()) {
2264 case Type::BitInt: {
2265 const auto *EIT = cast<BitIntType>(
T);
2266 Align = std::clamp<unsigned>(llvm::PowerOf2Ceil(EIT->getNumBits()),
2268 Width = llvm::alignTo(EIT->getNumBits(), Align);
2273 const auto *TT = cast<TagType>(
T);
2275 if (TT->getDecl()->isInvalidDecl()) {
2281 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
2282 const EnumDecl *ED = ET->getDecl();
2286 Info.
Align = AttrAlign;
2292 const auto *RT = cast<RecordType>(TT);
2297 AlignRequirement = RD->
hasAttr<AlignedAttr>()
2303 case Type::SubstTemplateTypeParm:
2304 return getTypeInfo(cast<SubstTemplateTypeParmType>(
T)->
2305 getReplacementType().getTypePtr());
2308 case Type::DeducedTemplateSpecialization: {
2309 const auto *A = cast<DeducedType>(
T);
2310 assert(!A->getDeducedType().isNull() &&
2311 "cannot request the size of an undeduced or dependent auto type");
2312 return getTypeInfo(A->getDeducedType().getTypePtr());
2316 return getTypeInfo(cast<ParenType>(
T)->getInnerType().getTypePtr());
2318 case Type::MacroQualified:
2322 case Type::ObjCTypeParam:
2323 return getTypeInfo(cast<ObjCTypeParamType>(
T)->desugar().getTypePtr());
2326 return getTypeInfo(cast<UsingType>(
T)->desugar().getTypePtr());
2328 case Type::Typedef: {
2329 const auto *TT = cast<TypedefType>(
T);
2334 if (
unsigned AttrAlign = TT->getDecl()->getMaxAlignment()) {
2345 case Type::Elaborated:
2346 return getTypeInfo(cast<ElaboratedType>(
T)->getNamedType().getTypePtr());
2348 case Type::Attributed:
2350 cast<AttributedType>(
T)->getEquivalentType().getTypePtr());
2352 case Type::CountAttributed:
2353 return getTypeInfo(cast<CountAttributedType>(
T)->desugar().getTypePtr());
2355 case Type::BTFTagAttributed:
2357 cast<BTFTagAttributedType>(
T)->getWrappedType().getTypePtr());
2359 case Type::Atomic: {
2368 Width =
Target->getCharWidth();
2370 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2376 Width = llvm::bit_ceil(Width);
2379 Align =
static_cast<unsigned>(Width);
2390 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2391 return TypeInfo(Width, Align, AlignRequirement);
2395 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(
T);
2396 if (I != MemoizedUnadjustedAlign.end())
2399 unsigned UnadjustedAlign;
2411 MemoizedUnadjustedAlign[
T] = UnadjustedAlign;
2412 return UnadjustedAlign;
2416 unsigned SimdAlign = llvm::OpenMPIRBuilder::getOpenMPDefaultSimdAlign(
2466 unsigned ABIAlign = TI.
Align;
2474 if (!
Target->allowsLargerPreferedTypeAlignment())
2488 unsigned PreferredAlign =
static_cast<unsigned>(
2490 assert(PreferredAlign >= ABIAlign &&
2491 "PreferredAlign should be at least as large as ABIAlign.");
2492 return PreferredAlign;
2499 T = CT->getElementType().getTypePtr();
2501 T = ET->getDecl()->getIntegerType().getTypePtr();
2506 Target->defaultsToAIXPowerAlignment()))
2561 for (
unsigned I = 0, N = Path.size(); I != N; ++I) {
2565 std::swap(
Base, Derived);
2585 llvm::append_range(Ivars, OI->
ivars());
2588 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2590 Ivars.push_back(Iv);
2598 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2601 for (
auto *Proto : OI->all_referenced_protocols()) {
2606 for (
const auto *Cat : OI->visible_categories())
2612 SD = SD->getSuperClass();
2614 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2615 for (
auto *Proto : OC->protocols()) {
2618 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2620 if (!Protocols.insert(
2624 for (
auto *Proto : OP->protocols())
2631 bool CheckIfTriviallyCopyable) {
2632 assert(RD->
isUnion() &&
"Must be union type");
2635 for (
const auto *Field : RD->
fields()) {
2637 CheckIfTriviallyCopyable))
2640 if (FieldSize != UnionSize)
2658static std::optional<int64_t>
2661 bool CheckIfTriviallyCopyable);
2663static std::optional<int64_t>
2665 bool CheckIfTriviallyCopyable) {
2666 if (Field->getType()->isRecordType()) {
2667 const RecordDecl *RD = Field->getType()->getAsRecordDecl();
2670 CheckIfTriviallyCopyable);
2675 bool IsBitIntType = Field->getType()->isBitIntType();
2676 if (!Field->getType()->isReferenceType() && !IsBitIntType &&
2678 CheckIfTriviallyCopyable))
2679 return std::nullopt;
2681 int64_t FieldSizeInBits =
2683 if (Field->isBitField()) {
2686 if (Field->isUnnamedBitField())
2689 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2691 if ((
unsigned)BitfieldSize >
2692 cast<BitIntType>(Field->getType())->getNumBits())
2693 return std::nullopt;
2694 }
else if (BitfieldSize > FieldSizeInBits) {
2695 return std::nullopt;
2697 FieldSizeInBits = BitfieldSize;
2699 Field->getType(), CheckIfTriviallyCopyable)) {
2700 return std::nullopt;
2702 return FieldSizeInBits;
2705static std::optional<int64_t>
2707 bool CheckIfTriviallyCopyable) {
2709 CheckIfTriviallyCopyable);
2712template <
typename RangeT>
2714 const RangeT &Subobjects, int64_t CurOffsetInBits,
2716 bool CheckIfTriviallyCopyable) {
2717 for (
const auto *Subobject : Subobjects) {
2718 std::optional<int64_t> SizeInBits =
2721 return std::nullopt;
2722 if (*SizeInBits != 0) {
2724 if (Offset != CurOffsetInBits)
2725 return std::nullopt;
2726 CurOffsetInBits += *SizeInBits;
2729 return CurOffsetInBits;
2732static std::optional<int64_t>
2735 bool CheckIfTriviallyCopyable) {
2736 assert(!RD->
isUnion() &&
"Must be struct/class type");
2739 int64_t CurOffsetInBits = 0;
2740 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2741 if (ClassDecl->isDynamicClass())
2742 return std::nullopt;
2745 for (
const auto &
Base : ClassDecl->bases()) {
2748 Bases.emplace_back(
Base.getType()->getAsCXXRecordDecl());
2752 return Layout.getBaseClassOffset(L) < Layout.getBaseClassOffset(R);
2755 std::optional<int64_t> OffsetAfterBases =
2757 Bases, CurOffsetInBits, Context, Layout, CheckIfTriviallyCopyable);
2758 if (!OffsetAfterBases)
2759 return std::nullopt;
2760 CurOffsetInBits = *OffsetAfterBases;
2763 std::optional<int64_t> OffsetAfterFields =
2765 RD->
fields(), CurOffsetInBits, Context, Layout,
2766 CheckIfTriviallyCopyable);
2767 if (!OffsetAfterFields)
2768 return std::nullopt;
2769 CurOffsetInBits = *OffsetAfterFields;
2771 return CurOffsetInBits;
2775 QualType Ty,
bool CheckIfTriviallyCopyable)
const {
2792 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2797 CheckIfTriviallyCopyable);
2817 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2822 if (
Record->isInvalidDecl())
2827 CheckIfTriviallyCopyable);
2830 *
this,
Record, CheckIfTriviallyCopyable);
2832 return StructSize && *StructSize ==
static_cast<int64_t
>(
getTypeSize(Ty));
2853 count += Ext->ivar_size();
2858 count += ImplDecl->ivar_size();
2876 if (isa<GNUNullExpr>(E))
return true;
2884 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2885 I = ObjCImpls.find(D);
2886 if (I != ObjCImpls.end())
2887 return cast<ObjCImplementationDecl>(I->second);
2894 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2895 I = ObjCImpls.find(D);
2896 if (I != ObjCImpls.end())
2897 return cast<ObjCCategoryImplDecl>(I->second);
2904 assert(IFaceD && ImplD &&
"Passed null params");
2905 ObjCImpls[IFaceD] = ImplD;
2911 assert(CatD && ImplD &&
"Passed null params");
2912 ObjCImpls[CatD] = ImplD;
2917 return ObjCMethodRedecls.lookup(MD);
2923 ObjCMethodRedecls[MD] = Redecl;
2928 if (
const auto *ID = dyn_cast<ObjCInterfaceDecl>(ND->
getDeclContext()))
2930 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
2931 return CD->getClassInterface();
2932 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
2933 return IMD->getClassInterface();
2941 assert(VD &&
"Passed null params");
2942 assert(VD->
hasAttr<BlocksAttr>() &&
2943 "getBlockVarCopyInits - not __block var");
2944 auto I = BlockVarCopyInits.find(VD);
2945 if (I != BlockVarCopyInits.end())
2947 return {
nullptr,
false};
2953 assert(VD && CopyExpr &&
"Passed null params");
2954 assert(VD->
hasAttr<BlocksAttr>() &&
2955 "setBlockVarCopyInits - not __block var");
2956 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr,
CanThrow);
2960 unsigned DataSize)
const {
2965 "incorrect data size provided to CreateTypeSourceInfo!");
2982 return getObjCLayout(D,
nullptr);
2993 bool &AnyNonCanonArgs) {
2995 for (
auto &Arg : CanonArgs) {
2997 Arg =
C.getCanonicalTemplateArgument(Arg);
2998 AnyNonCanonArgs |= !Arg.structurallyEquals(OrigArg);
3008ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
3013 llvm::FoldingSetNodeID
ID;
3015 void *insertPos =
nullptr;
3016 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
3017 assert(eq->getQualifiers() == quals);
3026 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
3029 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
3032 auto *eq =
new (*
this,
alignof(
ExtQuals))
ExtQuals(baseType, canon, quals);
3033 ExtQualNodes.InsertNode(eq, insertPos);
3038 LangAS AddressSpace)
const {
3051 "Type cannot be in multiple addr spaces!");
3054 return getExtQualType(TypeNode, Quals);
3060 if (!
T.hasAddressSpace())
3066 const Type *TypeNode;
3068 while (
T.hasAddressSpace()) {
3069 TypeNode = Quals.
strip(
T);
3073 if (!
QualType(TypeNode, 0).hasAddressSpace())
3077 T =
T.getSingleStepDesugaredType(*
this);
3086 return getExtQualType(TypeNode, Quals);
3113 "Type cannot have multiple ObjCGCs!");
3116 return getExtQualType(TypeNode, Quals);
3130 QualType WrappedTy,
Expr *CountExpr,
bool CountInBytes,
bool OrNull,
3134 llvm::FoldingSetNodeID ID;
3137 void *InsertPos =
nullptr;
3139 CountAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
3144 size_t Size = CountAttributedType::totalSizeToAlloc<TypeCoupledDeclRefInfo>(
3145 DependentDecls.size());
3148 OrNull, DependentDecls);
3149 Types.push_back(CATy);
3150 CountAttributedTypes.InsertNode(CATy, InsertPos);
3161 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(
T)) {
3164 const auto *FPT = cast<FunctionProtoType>(
T);
3170 return cast<FunctionType>(
Result.getTypePtr());
3186 L->DeducedReturnType(FD, ResultType);
3196 if (
const auto *PT = dyn_cast<ParenType>(Orig))
3201 if (
const auto *MQT = dyn_cast<MacroQualifiedType>(Orig))
3204 MQT->getMacroIdentifier());
3207 if (
const auto *AT = dyn_cast<AttributedType>(Orig))
3217 Proto->getReturnType(), Proto->getParamTypes(),
3218 Proto->getExtProtoInfo().withExceptionSpec(ESI));
3233 for (
unsigned i = 0, n = Args.size(); i != n; ++i)
3267 if (TSInfo->getType() != FD->
getType())
3275 "TypeLoc size mismatch from updating exception specification");
3276 TSInfo->overrideType(Updated);
3285 llvm::FoldingSetNodeID ID;
3288 void *InsertPos =
nullptr;
3289 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
3295 if (!
T.isCanonical()) {
3299 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
3300 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3303 Types.push_back(New);
3304 ComplexTypes.InsertNode(New, InsertPos);
3313 llvm::FoldingSetNodeID ID;
3316 void *InsertPos =
nullptr;
3317 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3323 if (!
T.isCanonical()) {
3327 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3328 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3331 Types.push_back(New);
3332 PointerTypes.InsertNode(New, InsertPos);
3337 llvm::FoldingSetNodeID ID;
3339 void *InsertPos =
nullptr;
3340 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3347 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3348 assert(!AT &&
"Shouldn't be in the map!");
3352 Types.push_back(AT);
3353 AdjustedTypes.InsertNode(AT, InsertPos);
3358 llvm::FoldingSetNodeID ID;
3360 void *InsertPos =
nullptr;
3361 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3368 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3369 assert(!AT &&
"Shouldn't be in the map!");
3372 Types.push_back(AT);
3373 AdjustedTypes.InsertNode(AT, InsertPos);
3404 const auto *ATy = cast<ConstantArrayType>(Ty);
3405 llvm::FoldingSetNodeID ID;
3406 ATy->Profile(ID, *
this, ATy->getElementType(), ATy->getZExtSize(),
3407 ATy->getSizeExpr(), ATy->getSizeModifier(),
3408 ATy->getIndexTypeQualifiers().getAsOpaqueValue());
3409 void *InsertPos =
nullptr;
3411 ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3420 AT = ArrayParameterTypes.FindNodeOrInsertPos(ID, InsertPos);
3421 assert(!AT &&
"Shouldn't be in the map!");
3426 Types.push_back(AT);
3427 ArrayParameterTypes.InsertNode(AT, InsertPos);
3437 llvm::FoldingSetNodeID ID;
3440 void *InsertPos =
nullptr;
3442 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3448 if (!
T.isCanonical()) {
3453 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3454 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3458 Types.push_back(New);
3459 BlockPointerTypes.InsertNode(New, InsertPos);
3469 "Unresolved placeholder type");
3473 llvm::FoldingSetNodeID ID;
3476 void *InsertPos =
nullptr;
3478 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3486 if (!SpelledAsLValue || InnerRef || !
T.isCanonical()) {
3487 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
3492 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3493 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3498 Types.push_back(New);
3499 LValueReferenceTypes.InsertNode(New, InsertPos);
3509 "Unresolved placeholder type");
3513 llvm::FoldingSetNodeID ID;
3516 void *InsertPos =
nullptr;
3518 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3526 if (InnerRef || !
T.isCanonical()) {
3527 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() :
T);
3532 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3533 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3538 Types.push_back(New);
3539 RValueReferenceTypes.InsertNode(New, InsertPos);
3548 llvm::FoldingSetNodeID ID;
3551 void *InsertPos =
nullptr;
3553 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3564 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3565 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3569 Types.push_back(New);
3570 MemberPointerTypes.InsertNode(New, InsertPos);
3577 const llvm::APInt &ArySizeIn,
3578 const Expr *SizeExpr,
3580 unsigned IndexTypeQuals)
const {
3583 "Constant array of VLAs is illegal!");
3591 llvm::APInt ArySize(ArySizeIn);
3592 ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
3594 llvm::FoldingSetNodeID ID;
3596 ASM, IndexTypeQuals);
3598 void *InsertPos =
nullptr;
3600 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
3611 ASM, IndexTypeQuals);
3616 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
3617 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3620 auto *New = ConstantArrayType::Create(*
this, EltTy, Canon, ArySize, SizeExpr,
3621 ASM, IndexTypeQuals);
3622 ConstantArrayTypes.InsertNode(New, InsertPos);
3623 Types.push_back(New);
3632 if (!
type->isVariablyModifiedType())
return type;
3637 const Type *ty = split.
Ty;
3639#define TYPE(Class, Base)
3640#define ABSTRACT_TYPE(Class, Base)
3641#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
3642#include "clang/AST/TypeNodes.inc"
3643 llvm_unreachable(
"didn't desugar past all non-canonical types?");
3649 case Type::DependentVector:
3650 case Type::ExtVector:
3651 case Type::DependentSizedExtVector:
3652 case Type::ConstantMatrix:
3653 case Type::DependentSizedMatrix:
3654 case Type::DependentAddressSpace:
3655 case Type::ObjCObject:
3656 case Type::ObjCInterface:
3657 case Type::ObjCObjectPointer:
3660 case Type::UnresolvedUsing:
3661 case Type::TypeOfExpr:
3663 case Type::Decltype:
3664 case Type::UnaryTransform:
3665 case Type::DependentName:
3666 case Type::InjectedClassName:
3667 case Type::TemplateSpecialization:
3668 case Type::DependentTemplateSpecialization:
3669 case Type::TemplateTypeParm:
3670 case Type::SubstTemplateTypeParmPack:
3672 case Type::DeducedTemplateSpecialization:
3673 case Type::PackExpansion:
3674 case Type::PackIndexing:
3676 case Type::DependentBitInt:
3677 case Type::ArrayParameter:
3678 llvm_unreachable(
"type should never be variably-modified");
3682 case Type::FunctionNoProto:
3683 case Type::FunctionProto:
3684 case Type::BlockPointer:
3685 case Type::MemberPointer:
3695 cast<PointerType>(ty)->getPointeeType()));
3698 case Type::LValueReference: {
3699 const auto *lv = cast<LValueReferenceType>(ty);
3702 lv->isSpelledAsLValue());
3706 case Type::RValueReference: {
3707 const auto *lv = cast<RValueReferenceType>(ty);
3713 case Type::Atomic: {
3714 const auto *at = cast<AtomicType>(ty);
3719 case Type::ConstantArray: {
3720 const auto *cat = cast<ConstantArrayType>(ty);
3725 cat->getSizeModifier(),
3726 cat->getIndexTypeCVRQualifiers());
3730 case Type::DependentSizedArray: {
3731 const auto *dat = cast<DependentSizedArrayType>(ty);
3735 dat->getSizeModifier(),
3736 dat->getIndexTypeCVRQualifiers(),
3737 dat->getBracketsRange());
3742 case Type::IncompleteArray: {
3743 const auto *iat = cast<IncompleteArrayType>(ty);
3752 case Type::VariableArray: {
3753 const auto *vat = cast<VariableArrayType>(ty);
3757 vat->getIndexTypeCVRQualifiers(), vat->getBracketsRange());
3770 unsigned IndexTypeQuals,
3781 IndexTypeQuals, Brackets);
3788 VariableArrayTypes.push_back(New);
3789 Types.push_back(New);
3799 unsigned elementTypeQuals,
3803 "Size must be type- or value-dependent!");
3812 elementTypeQuals, brackets);
3813 Types.push_back(newType);
3822 void *insertPos =
nullptr;
3823 llvm::FoldingSetNodeID ID;
3826 ASM, elementTypeQuals, numElements);
3830 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3836 numElements, ASM, elementTypeQuals, brackets);
3837 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
3838 Types.push_back(canonTy);
3843 canonElementType.
Quals);
3847 if (
QualType(canonElementType.
Ty, 0) == elementType &&
3855 elementTypeQuals, brackets);
3856 Types.push_back(sugaredType);
3862 unsigned elementTypeQuals)
const {
3863 llvm::FoldingSetNodeID ID;
3866 void *insertPos =
nullptr;
3868 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
3880 ASM, elementTypeQuals);
3885 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3886 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
3892 IncompleteArrayTypes.InsertNode(newType, insertPos);
3893 Types.push_back(newType);
3899#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS) \
3900 {getIntTypeForBitwidth(BITS, SIGNED), llvm::ElementCount::getScalable(ELTS), \
3903#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS) \
3904 {ELTTY, llvm::ElementCount::getScalable(ELTS), NUMVECTORS};
3908 llvm_unreachable(
"Unsupported builtin vector type");
3909 case BuiltinType::SveInt8:
3911 case BuiltinType::SveUint8:
3913 case BuiltinType::SveInt8x2:
3915 case BuiltinType::SveUint8x2:
3917 case BuiltinType::SveInt8x3:
3919 case BuiltinType::SveUint8x3:
3921 case BuiltinType::SveInt8x4:
3923 case BuiltinType::SveUint8x4:
3925 case BuiltinType::SveInt16:
3927 case BuiltinType::SveUint16:
3929 case BuiltinType::SveInt16x2:
3931 case BuiltinType::SveUint16x2:
3933 case BuiltinType::SveInt16x3:
3935 case BuiltinType::SveUint16x3:
3937 case BuiltinType::SveInt16x4:
3939 case BuiltinType::SveUint16x4:
3941 case BuiltinType::SveInt32:
3943 case BuiltinType::SveUint32:
3945 case BuiltinType::SveInt32x2:
3947 case BuiltinType::SveUint32x2:
3949 case BuiltinType::SveInt32x3:
3951 case BuiltinType::SveUint32x3:
3953 case BuiltinType::SveInt32x4:
3955 case BuiltinType::SveUint32x4:
3957 case BuiltinType::SveInt64:
3959 case BuiltinType::SveUint64:
3961 case BuiltinType::SveInt64x2:
3963 case BuiltinType::SveUint64x2:
3965 case BuiltinType::SveInt64x3:
3967 case BuiltinType::SveUint64x3:
3969 case BuiltinType::SveInt64x4:
3971 case BuiltinType::SveUint64x4:
3973 case BuiltinType::SveBool:
3975 case BuiltinType::SveBoolx2:
3977 case BuiltinType::SveBoolx4:
3979 case BuiltinType::SveFloat16:
3981 case BuiltinType::SveFloat16x2:
3983 case BuiltinType::SveFloat16x3:
3985 case BuiltinType::SveFloat16x4:
3987 case BuiltinType::SveFloat32:
3989 case BuiltinType::SveFloat32x2:
3991 case BuiltinType::SveFloat32x3:
3993 case BuiltinType::SveFloat32x4:
3995 case BuiltinType::SveFloat64:
3997 case BuiltinType::SveFloat64x2:
3999 case BuiltinType::SveFloat64x3:
4001 case BuiltinType::SveFloat64x4:
4003 case BuiltinType::SveBFloat16:
4005 case BuiltinType::SveBFloat16x2:
4007 case BuiltinType::SveBFloat16x3:
4009 case BuiltinType::SveBFloat16x4:
4011#define RVV_VECTOR_TYPE_INT(Name, Id, SingletonId, NumEls, ElBits, NF, \
4013 case BuiltinType::Id: \
4014 return {getIntTypeForBitwidth(ElBits, IsSigned), \
4015 llvm::ElementCount::getScalable(NumEls), NF};
4016#define RVV_VECTOR_TYPE_FLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4017 case BuiltinType::Id: \
4018 return {ElBits == 16 ? Float16Ty : (ElBits == 32 ? FloatTy : DoubleTy), \
4019 llvm::ElementCount::getScalable(NumEls), NF};
4020#define RVV_VECTOR_TYPE_BFLOAT(Name, Id, SingletonId, NumEls, ElBits, NF) \
4021 case BuiltinType::Id: \
4022 return {BFloat16Ty, llvm::ElementCount::getScalable(NumEls), NF};
4023#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4024 case BuiltinType::Id: \
4025 return {BoolTy, llvm::ElementCount::getScalable(NumEls), 1};
4026#include "clang/Basic/RISCVVTypes.def"
4033 if (
Target->getTriple().isWasm() &&
Target->hasFeature(
"reference-types")) {
4034#define WASM_REF_TYPE(Name, MangledName, Id, SingletonId, AS) \
4035 if (BuiltinType::Id == BuiltinType::WasmExternRef) \
4037#include "clang/Basic/WebAssemblyReferenceTypes.def"
4040 "shouldn't try to generate type externref outside WebAssembly target");
4047 unsigned NumFields)
const {
4048 if (
Target->hasAArch64SVETypes()) {
4050#define SVE_VECTOR_TYPE(Name, MangledName, Id, SingletonId, NumEls, ElBits, \
4051 IsSigned, IsFP, IsBF) \
4052 if (!EltTy->isBooleanType() && \
4053 ((EltTy->hasIntegerRepresentation() && \
4054 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4055 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4057 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4058 IsBF && !IsFP)) && \
4059 EltTySize == ElBits && NumElts == NumEls) { \
4060 return SingletonId; \
4062#define SVE_PREDICATE_TYPE(Name, MangledName, Id, SingletonId, NumEls) \
4063 if (EltTy->isBooleanType() && NumElts == NumEls) \
4065#define SVE_OPAQUE_TYPE(Name, MangledName, Id, SingleTonId)
4066#include "clang/Basic/AArch64SVEACLETypes.def"
4067 }
else if (
Target->hasRISCVVTypes()) {
4069#define RVV_VECTOR_TYPE(Name, Id, SingletonId, NumEls, ElBits, NF, IsSigned, \
4071 if (!EltTy->isBooleanType() && \
4072 ((EltTy->hasIntegerRepresentation() && \
4073 EltTy->hasSignedIntegerRepresentation() == IsSigned) || \
4074 (EltTy->hasFloatingRepresentation() && !EltTy->isBFloat16Type() && \
4076 (EltTy->hasFloatingRepresentation() && EltTy->isBFloat16Type() && \
4077 IsBF && !IsFP)) && \
4078 EltTySize == ElBits && NumElts == NumEls && NumFields == NF) \
4080#define RVV_PREDICATE_TYPE(Name, Id, SingletonId, NumEls) \
4081 if (EltTy->isBooleanType() && NumElts == NumEls) \
4083#include "clang/Basic/RISCVVTypes.def"
4099 llvm::FoldingSetNodeID ID;
4102 void *InsertPos =
nullptr;
4103 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4113 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4114 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4117 VectorType(vecType, NumElts, Canonical, VecKind);
4118 VectorTypes.InsertNode(New, InsertPos);
4119 Types.push_back(New);
4126 llvm::FoldingSetNodeID ID;
4129 void *InsertPos =
nullptr;
4131 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4136 VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
4139 if (CanonVecTy == VecType) {
4144 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4145 assert(!CanonCheck &&
4146 "Dependent-sized vector_size canonical type broken");
4148 DependentVectorTypes.InsertNode(New, InsertPos);
4157 Types.push_back(New);
4164 unsigned NumElts)
const {
4172 llvm::FoldingSetNodeID ID;
4175 void *InsertPos =
nullptr;
4176 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
4186 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4187 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4191 VectorTypes.InsertNode(New, InsertPos);
4192 Types.push_back(New);
4200 llvm::FoldingSetNodeID ID;
4204 void *InsertPos =
nullptr;
4206 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4216 if (CanonVecTy == vecType) {
4221 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
4222 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
4224 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
4233 Types.push_back(New);
4238 unsigned NumColumns)
const {
4239 llvm::FoldingSetNodeID ID;
4241 Type::ConstantMatrix);
4244 "need a valid element type");
4247 "need valid matrix dimensions");
4248 void *InsertPos =
nullptr;
4258 assert(!NewIP &&
"Matrix type shouldn't already exist in the map");
4264 MatrixTypes.InsertNode(New, InsertPos);
4265 Types.push_back(New);
4274 llvm::FoldingSetNodeID ID;
4278 void *InsertPos =
nullptr;
4280 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4285 ColumnExpr, AttrLoc);
4288 DependentSizedMatrixTypes.FindNodeOrInsertPos(ID, InsertPos);
4289 assert(!CanonCheck &&
"Dependent-sized matrix canonical type broken");
4291 DependentSizedMatrixTypes.InsertNode(Canon, InsertPos);
4292 Types.push_back(Canon);
4305 ColumnExpr, AttrLoc);
4306 Types.push_back(New);
4311 Expr *AddrSpaceExpr,
4317 void *insertPos =
nullptr;
4318 llvm::FoldingSetNodeID ID;
4323 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
4329 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
4330 Types.push_back(canonTy);
4333 if (canonPointeeType == PointeeType &&
4339 AddrSpaceExpr, AttrLoc);
4340 Types.push_back(sugaredType);
4346 return T.isCanonical() &&
4364 llvm::FoldingSetNodeID ID;
4367 void *InsertPos =
nullptr;
4369 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
4379 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4380 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4385 Types.push_back(New);
4386 FunctionNoProtoTypes.InsertNode(New, InsertPos);
4402 return CanResultType;
4409 if (!NoexceptInType)
4426 bool AnyPackExpansions =
false;
4431 AnyPackExpansions =
true;
4433 return AnyPackExpansions;
4439QualType ASTContext::getFunctionTypeInternal(
4442 size_t NumArgs = ArgArray.size();
4446 llvm::FoldingSetNodeID
ID;
4451 bool Unique =
false;
4453 void *InsertPos =
nullptr;
4455 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4475 bool IsCanonicalExceptionSpec =
4479 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
4481 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
4482 if (!ArgArray[i].isCanonicalAsParam())
4483 isCanonical =
false;
4485 if (OnlyWantCanonical)
4486 assert(isCanonical &&
4487 "given non-canonical parameters constructing canonical type");
4492 if (!isCanonical && Canonical.
isNull()) {
4494 CanonicalArgs.reserve(NumArgs);
4495 for (
unsigned i = 0; i != NumArgs; ++i)
4502 if (IsCanonicalExceptionSpec) {
4504 }
else if (NoexceptInType) {
4517 bool AnyPacks =
false;
4540 llvm_unreachable(
"dependent noexcept is already canonical");
4549 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
4553 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4554 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4559 auto ESH = FunctionProtoType::getExceptionSpecSize(
4561 size_t Size = FunctionProtoType::totalSizeToAlloc<
4567 ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
4574 Types.push_back(FTP);
4576 FunctionProtoTypes.InsertNode(FTP, InsertPos);
4581 llvm::FoldingSetNodeID
ID;
4584 void *InsertPos =
nullptr;
4585 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
4591 if (!
T.isCanonical()) {
4595 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
4596 assert(!NewIP &&
"Shouldn't be in the map!");
4600 Types.push_back(New);
4601 PipeTypes.InsertNode(New, InsertPos);
4612 return getPipeType(
T,
true);
4616 return getPipeType(
T,
false);
4620 llvm::FoldingSetNodeID ID;
4623 void *InsertPos =
nullptr;
4624 if (
BitIntType *EIT = BitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
4628 BitIntTypes.InsertNode(New, InsertPos);
4629 Types.push_back(New);
4634 Expr *NumBitsExpr)
const {
4636 llvm::FoldingSetNodeID ID;
4639 void *InsertPos =
nullptr;
4641 DependentBitIntTypes.FindNodeOrInsertPos(ID, InsertPos))
4646 DependentBitIntTypes.InsertNode(New, InsertPos);
4648 Types.push_back(New);
4654 if (!isa<CXXRecordDecl>(D))
return false;
4655 const auto *RD = cast<CXXRecordDecl>(D);
4656 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
4658 if (RD->getDescribedClassTemplate() &&
4659 !isa<ClassTemplateSpecializationDecl>(RD))
4670 if (
Decl->TypeForDecl) {
4671 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
4673 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
4674 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4675 assert(isa<InjectedClassNameType>(
Decl->TypeForDecl));
4679 Decl->TypeForDecl = newType;
4680 Types.push_back(newType);
4688 assert(
Decl &&
"Passed null for Decl param");
4689 assert(!
Decl->TypeForDecl &&
"TypeForDecl present in slow case");
4691 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(
Decl))
4694 assert(!isa<TemplateTypeParmDecl>(
Decl) &&
4695 "Template type parameter types are always available.");
4697 if (
const auto *
Record = dyn_cast<RecordDecl>(
Decl)) {
4698 assert(
Record->isFirstDecl() &&
"struct/union has previous declaration");
4701 }
else if (
const auto *
Enum = dyn_cast<EnumDecl>(
Decl)) {
4702 assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
4704 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(
Decl)) {
4707 llvm_unreachable(
"TypeDecl without a type?");
4716 if (!
Decl->TypeForDecl) {
4718 Underlying =
Decl->getUnderlyingType();
4721 Decl->TypeForDecl = NewType;
4722 Types.push_back(NewType);
4725 if (Underlying.
isNull() ||
Decl->getUnderlyingType() == Underlying)
4729 llvm::FoldingSetNodeID ID;
4732 void *InsertPos =
nullptr;
4733 if (
TypedefType *
T = TypedefTypes.FindNodeOrInsertPos(ID, InsertPos)) {
4734 assert(!
T->typeMatchesDecl() &&
4735 "non-divergent case should be handled with TypeDecl");
4739 void *Mem =
Allocate(TypedefType::totalSizeToAlloc<QualType>(
true),
4741 auto *NewType =
new (Mem)
TypedefType(Type::Typedef,
Decl, Underlying,
4743 TypedefTypes.InsertNode(NewType, InsertPos);
4744 Types.push_back(NewType);
4750 llvm::FoldingSetNodeID ID;
4753 void *InsertPos =
nullptr;
4754 if (
UsingType *
T = UsingTypes.FindNodeOrInsertPos(ID, InsertPos))
4757 const Type *TypeForDecl =
4767 Allocate(UsingType::totalSizeToAlloc<QualType>(!Underlying.
isNull()),
4770 Types.push_back(NewType);
4771 UsingTypes.InsertNode(NewType, InsertPos);
4779 if (PrevDecl->TypeForDecl)
4780 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
4783 Decl->TypeForDecl = newType;
4784 Types.push_back(newType);
4792 if (PrevDecl->TypeForDecl)
4793 return QualType(
Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
4796 Decl->TypeForDecl = newType;
4797 Types.push_back(newType);
4803 if (
Decl->TypeForDecl)
4808 if (CanonicalDecl->TypeForDecl)
4809 return QualType(
Decl->TypeForDecl = CanonicalDecl->TypeForDecl, 0);
4813 Decl->TypeForDecl = newType;
4814 Types.push_back(newType);
4821 llvm::FoldingSetNodeID id;
4824 void *insertPos =
nullptr;
4832 Types.push_back(
type);
4833 AttributedTypes.InsertNode(
type, insertPos);
4840 llvm::FoldingSetNodeID ID;
4843 void *InsertPos =
nullptr;
4845 BTFTagAttributedTypes.FindNodeOrInsertPos(ID, InsertPos);
4853 Types.push_back(Ty);
4854 BTFTagAttributedTypes.InsertNode(Ty, InsertPos);
4861 QualType Replacement,
Decl *AssociatedDecl,
unsigned Index,
4862 std::optional<unsigned> PackIndex)
const {
4863 llvm::FoldingSetNodeID ID;
4866 void *InsertPos =
nullptr;
4868 SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4871 void *Mem =
Allocate(SubstTemplateTypeParmType::totalSizeToAlloc<QualType>(
4872 !Replacement.isCanonical()),
4876 Types.push_back(SubstParm);
4877 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
4886 unsigned Index,
bool Final,
4893 llvm::FoldingSetNodeID ID;
4896 void *InsertPos =
nullptr;
4898 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
4908 [[maybe_unused]]
const auto *Nothing =
4909 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
4917 Types.push_back(SubstParm);
4918 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
4928 llvm::FoldingSetNodeID ID;
4930 void *InsertPos =
nullptr;
4932 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4943 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4944 assert(!TypeCheck &&
"Template type parameter canonical type broken");
4950 Types.push_back(TypeParm);
4951 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
4961 assert(!Name.getAsDependentTemplateName() &&
4962 "No dependent template names here!");
4973 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
4983 "No dependent template names here!");
4986 ArgVec.reserve(Args.size());
4988 ArgVec.push_back(Arg.getArgument());
4996 if (Arg.isPackExpansion())
5008 "No dependent template names here!");
5011 Template = QTN->getUnderlyingTemplate();
5016 if (!Underlying.
isNull())
5022 "Caller must compute aliased type");
5023 IsTypeAlias =
false;
5032 (IsTypeAlias ?
sizeof(
QualType) : 0),
5036 IsTypeAlias ? Underlying :
QualType());
5038 Types.push_back(Spec);
5045 "No dependent template names here!");
5053 bool AnyNonCanonArgs =
false;
5059 llvm::FoldingSetNodeID ID;
5063 void *InsertPos =
nullptr;
5065 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5075 Types.push_back(Spec);
5076 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
5080 "Non-dependent template-id type must have a canonical type");
5087 TagDecl *OwnedTagDecl)
const {
5088 llvm::FoldingSetNodeID ID;
5091 void *InsertPos =
nullptr;
5092 ElaboratedType *
T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5099 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
5100 assert(!CheckT &&
"Elaborated canonical type broken");
5105 Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
5107 T =
new (Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
5110 ElaboratedTypes.InsertNode(
T, InsertPos);
5116 llvm::FoldingSetNodeID ID;
5119 void *InsertPos =
nullptr;
5120 ParenType *
T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5127 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
5128 assert(!CheckT &&
"Paren canonical type broken");
5134 ParenTypes.InsertNode(
T, InsertPos);
5147 Types.push_back(newType);
5157 if (CanonNNS != NNS)
5161 llvm::FoldingSetNodeID ID;
5164 void *InsertPos =
nullptr;
5166 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
5173 DependentNameTypes.InsertNode(
T, InsertPos);
5182 for (
unsigned I = 0, E = Args.size(); I != E; ++I)
5194 "nested-name-specifier must be dependent");
5196 llvm::FoldingSetNodeID ID;
5200 void *InsertPos =
nullptr;
5202 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5212 bool AnyNonCanonArgs =
false;
5217 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
5223 [[maybe_unused]]
auto *Nothing =
5224 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
5225 assert(!Nothing &&
"canonical type broken");
5234 DependentTemplateSpecializationTypes.InsertNode(
T, InsertPos);
5240 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
5246 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
5248 NTTP->getType().getNonPackExpansionType().getNonLValueExprType(*
this);
5256 *
this, NTTP,
false,
T,
5259 if (NTTP->isParameterPack())
5264 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
5280 Args.reserve(Args.size() + Params->
size());
5287 std::optional<unsigned> NumExpansions,
5288 bool ExpectPackInType) {
5290 "Pack expansions must expand one or more parameter packs");
5292 llvm::FoldingSetNodeID ID;
5295 void *InsertPos =
nullptr;
5307 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
5313 PackExpansionTypes.InsertNode(
T, InsertPos);
5325 if (Protocols.empty())
return true;
5330 for (
unsigned i = 1; i != Protocols.size(); ++i)
5340 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
5344 P =
P->getCanonicalDecl();
5347 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
5348 Protocols.erase(ProtocolsEnd, Protocols.end());
5353 unsigned NumProtocols)
const {
5363 bool isKindOf)
const {
5366 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
5367 isa<ObjCInterfaceType>(baseType))
5371 llvm::FoldingSetNodeID ID;
5373 void *InsertPos =
nullptr;
5374 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
5381 if (effectiveTypeArgs.empty()) {
5383 effectiveTypeArgs = baseObject->getTypeArgs();
5390 bool typeArgsAreCanonical = llvm::all_of(
5393 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
5397 if (!typeArgsAreCanonical) {
5398 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
5399 for (
auto typeArg : effectiveTypeArgs)
5401 canonTypeArgs = canonTypeArgsVec;
5403 canonTypeArgs = effectiveTypeArgs;
5408 if (!protocolsSorted) {
5409 canonProtocolsVec.append(protocols.begin(), protocols.end());
5411 canonProtocols = canonProtocolsVec;
5413 canonProtocols = protocols;
5417 canonProtocols, isKindOf);
5420 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
5424 size += typeArgs.size() *
sizeof(
QualType);
5432 ObjCObjectTypes.InsertNode(
T, InsertPos);
5442 bool allowOnPointerType)
const {
5445 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(
type.getTypePtr())) {
5450 if (allowOnPointerType) {
5451 if (
const auto *objPtr =
5452 dyn_cast<ObjCObjectPointerType>(
type.getTypePtr())) {
5458 protocolsVec.append(protocols.begin(), protocols.end());
5470 if (
const auto *objT = dyn_cast<ObjCObjectType>(
type.getTypePtr())){
5475 objT->getTypeArgsAsWritten(),
5477 objT->isKindOfTypeAsWritten());
5481 if (
type->isObjCObjectType()) {
5491 if (
type->isObjCIdType()) {
5494 objPtr->isKindOfType());
5499 if (
type->isObjCClassType()) {
5502 objPtr->isKindOfType());
5514 llvm::FoldingSetNodeID ID;
5516 void *InsertPos =
nullptr;
5518 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
5523 if (!protocols.empty()) {
5527 Canonical, protocols, hasError,
true ));
5528 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
5536 Types.push_back(newType);
5537 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
5545 auto NewTypeParamTy = cast<ObjCTypeParamType>(New->
getTypeForDecl());
5547 protocols.append(NewTypeParamTy->qual_begin(), NewTypeParamTy->qual_end());
5562 for (
auto *Proto : OPT->quals()) {
5585 if (InheritedProtocols.empty())
5589 bool Conforms =
false;
5590 for (
auto *Proto : OPT->quals()) {
5592 for (
auto *PI : InheritedProtocols) {
5604 for (
auto *PI : InheritedProtocols) {
5606 bool Adopts =
false;
5607 for (
auto *Proto : OPT->quals()) {
5621 llvm::FoldingSetNodeID ID;
5624 void *InsertPos =
nullptr;
5626 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
5635 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
5644 Types.push_back(QType);
5645 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
5653 if (
Decl->TypeForDecl)
5657 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
5658 Decl->TypeForDecl = PrevDecl->TypeForDecl;
5659 return QualType(PrevDecl->TypeForDecl, 0);
5668 Decl->TypeForDecl =
T;
5681 llvm::FoldingSetNodeID ID;
5685 void *InsertPos =
nullptr;
5687 DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
5697 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
5705 Types.push_back(toe);
5718 Types.push_back(tot);
5742 llvm_unreachable(
"Unknown value kind");
5757 llvm::FoldingSetNodeID ID;
5760 void *InsertPos =
nullptr;
5762 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
5767 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
5775 Types.push_back(dt);
5780 bool FullySubstituted,
5784 if (FullySubstituted && Index != -1) {
5787 llvm::FoldingSetNodeID ID;
5789 void *InsertPos =
nullptr;
5791 DependentPackIndexingTypes.FindNodeOrInsertPos(ID, InsertPos);
5794 PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
5798 DependentPackIndexingTypes.InsertNode(Canon, InsertPos);
5804 Allocate(PackIndexingType::totalSizeToAlloc<QualType>(Expansions.size()),
5822 llvm::FoldingSetNodeID ID;
5825 void *InsertPos =
nullptr;
5827 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
5833 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
5842 Types.push_back(ut);
5846QualType ASTContext::getAutoTypeInternal(
5851 !TypeConstraintConcept && !IsDependent)
5855 void *InsertPos =
nullptr;
5856 llvm::FoldingSetNodeID ID;
5858 TypeConstraintConcept, TypeConstraintArgs);
5859 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
5866 }
else if (TypeConstraintConcept) {
5867 bool AnyNonCanonArgs =
false;
5870 *
this, TypeConstraintArgs, AnyNonCanonArgs);
5871 if (CanonicalConcept != TypeConstraintConcept || AnyNonCanonArgs) {
5873 getAutoTypeInternal(
QualType(), Keyword, IsDependent, IsPack,
5874 CanonicalConcept, CanonicalConceptArgs,
true);
5876 [[maybe_unused]]
auto *Nothing =
5877 AutoTypes.FindNodeOrInsertPos(ID, InsertPos);
5878 assert(!Nothing &&
"canonical type broken");
5888 (IsDependent ? TypeDependence::DependentInstantiation
5889 : TypeDependence::None) |
5890 (IsPack ? TypeDependence::UnexpandedPack : TypeDependence::None),
5891 Canon, TypeConstraintConcept, TypeConstraintArgs);
5892 Types.push_back(AT);
5893 AutoTypes.InsertNode(AT, InsertPos);
5902 bool IsDependent,
bool IsPack,
5905 assert((!IsPack || IsDependent) &&
"only use IsPack for a dependent pack");
5907 "A dependent auto should be undeduced");
5908 return getAutoTypeInternal(
DeducedType, Keyword, IsDependent, IsPack,
5909 TypeConstraintConcept, TypeConstraintArgs);
5917 if (!AT->isConstrained())
5938 void *InsertPos =
nullptr;
5939 llvm::FoldingSetNodeID ID;
5943 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
5948 llvm::FoldingSetNodeID TempID;
5949 DTST->Profile(TempID);
5950 assert(ID == TempID &&
"ID does not match");
5951 Types.push_back(DTST);
5952 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
5961 llvm::FoldingSetNodeID ID;
5964 void *InsertPos =
nullptr;
5965 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
5971 if (!
T.isCanonical()) {
5975 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
5976 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
5979 Types.push_back(New);
5980 AtomicTypes.InsertNode(New, InsertPos);
6016 return getFromTargetType(
Target->getSizeType());
6022 return getFromTargetType(
Target->getSignedSizeType());
6027 return getFromTargetType(
Target->getIntMaxType());
6032 return getFromTargetType(
Target->getUIntMaxType());
6050 return getFromTargetType(
Target->getIntPtrType());
6073 return getFromTargetType(
Target->getProcessIDType());
6085 const Type *Ty =
T.getTypePtr();
6089 }
else if (isa<ArrayType>(Ty)) {
6091 }
else if (isa<FunctionType>(Ty)) {
6113 quals = splitType.
Quals;
6118 QualType elementType = AT->getElementType();
6123 if (elementType == unqualElementType) {
6124 assert(quals.
empty());
6125 quals = splitType.
Quals;
6133 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
6135 CAT->getSizeExpr(), CAT->getSizeModifier(), 0);
6138 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
6142 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
6145 VAT->getSizeModifier(),
6146 VAT->getIndexTypeCVRQualifiers(),
6147 VAT->getBracketsRange());
6150 const auto *DSAT = cast<DependentSizedArrayType>(AT);
6152 DSAT->getSizeModifier(), 0,
6163 bool AllowPiMismatch) {
6178 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
6179 auto *CAT2 = dyn_cast<ConstantArrayType>(AT2);
6180 if (!((CAT2 && CAT1->getSize() == CAT2->getSize()) ||
6182 isa<IncompleteArrayType>(AT2))))
6184 }
else if (isa<IncompleteArrayType>(AT1)) {
6185 if (!(isa<IncompleteArrayType>(AT2) ||
6187 isa<ConstantArrayType>(AT2))))
6193 T1 = AT1->getElementType();
6194 T2 = AT2->getElementType();
6214 bool AllowPiMismatch) {
6219 if (T1PtrType && T2PtrType) {
6227 if (T1MPType && T2MPType &&
6238 if (T1OPType && T2OPType) {
6270 if (Quals1 != Quals2)
6284 switch (Name.getKind()) {
6319 = Name.getAsSubstTemplateTemplateParm();
6326 = Name.getAsSubstTemplateTemplateParmPack();
6335 llvm_unreachable(
"bad template name kind!");
6340 switch (Name.getKind()) {
6345 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
6346 Template = getCanonicalTemplateTemplateParmDecl(TTP);
6354 llvm_unreachable(
"cannot canonicalize unresolved template");
6358 assert(DTN &&
"Non-dependent template names must refer to template decls.");
6359 return DTN->CanonicalTemplateName;
6364 = Name.getAsSubstTemplateTemplateParm();
6370 Name.getAsSubstTemplateTemplateParmPack();
6379 llvm_unreachable(
"bad template name!");
6395 llvm::FoldingSetNodeID XCEID, YCEID;
6396 XCE->
Profile(XCEID, *
this,
true,
true);
6397 YCE->
Profile(YCEID, *
this,
true,
true);
6398 return XCEID == YCEID;
6447 if (
auto *TX = dyn_cast<TemplateTypeParmDecl>(
X)) {
6448 auto *TY = cast<TemplateTypeParmDecl>(Y);
6449 if (TX->isParameterPack() != TY->isParameterPack())
6451 if (TX->hasTypeConstraint() != TY->hasTypeConstraint())
6454 TY->getTypeConstraint());
6457 if (
auto *TX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
6458 auto *TY = cast<NonTypeTemplateParmDecl>(Y);
6459 return TX->isParameterPack() == TY->isParameterPack() &&
6460 TX->getASTContext().hasSameType(TX->getType(), TY->getType()) &&
6462 TY->getPlaceholderTypeConstraint());
6465 auto *TX = cast<TemplateTemplateParmDecl>(
X);
6466 auto *TY = cast<TemplateTemplateParmDecl>(Y);
6467 return TX->isParameterPack() == TY->isParameterPack() &&
6469 TY->getTemplateParameters());
6474 if (
X->size() != Y->
size())
6477 for (
unsigned I = 0, N =
X->size(); I != N; ++I)
6491 if (
auto *TTPX = dyn_cast<TemplateTypeParmDecl>(
X)) {
6492 auto *TTPY = cast<TemplateTypeParmDecl>(Y);
6493 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
6496 return hasSameType(TTPX->getDefaultArgument(), TTPY->getDefaultArgument());
6499 if (
auto *NTTPX = dyn_cast<NonTypeTemplateParmDecl>(
X)) {
6500 auto *NTTPY = cast<NonTypeTemplateParmDecl>(Y);
6501 if (!NTTPX->hasDefaultArgument() || !NTTPY->hasDefaultArgument())
6506 llvm::FoldingSetNodeID XID, YID;
6507 DefaultArgumentX->
Profile(XID, *
this,
true);
6508 DefaultArgumentY->
Profile(YID, *
this,
true);
6512 auto *TTPX = cast<TemplateTemplateParmDecl>(
X);
6513 auto *TTPY = cast<TemplateTemplateParmDecl>(Y);
6515 if (!TTPX->hasDefaultArgument() || !TTPY->hasDefaultArgument())
6524 if (
auto *NS =
X->getAsNamespace())
6526 if (
auto *NAS =
X->getAsNamespaceAlias())
6527 return NAS->getNamespace();
6535 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
6537 }
else if (
X->getKind() != Y->
getKind())
6542 switch (
X->getKind()) {
6553 if (
X->getAsType()->getCanonicalTypeInternal() !=
6563 auto *PX =
X->getPrefix();
6577 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
6581 for (
auto Pair : zip_longest(AEnableIfAttrs, BEnableIfAttrs)) {
6582 std::optional<EnableIfAttr *> Cand1A = std::get<0>(Pair);
6583 std::optional<EnableIfAttr *> Cand2A = std::get<1>(Pair);
6586 if (!Cand1A || !Cand2A)
6592 (*Cand1A)->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
6593 (*Cand2A)->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
6597 if (Cand1ID != Cand2ID)
6625 if (
const auto *TypedefX = dyn_cast<TypedefNameDecl>(
X))
6626 if (
const auto *TypedefY = dyn_cast<TypedefNameDecl>(Y))
6628 TypedefY->getUnderlyingType());
6635 if (isa<ObjCInterfaceDecl>(
X) || isa<ObjCProtocolDecl>(
X))
6638 if (isa<ClassTemplateSpecializationDecl>(
X)) {
6645 if (
const auto *TagX = dyn_cast<TagDecl>(
X)) {
6646 const auto *TagY = cast<TagDecl>(Y);
6647 return (TagX->getTagKind() == TagY->getTagKind()) ||
6659 if (
const auto *FuncX = dyn_cast<FunctionDecl>(
X)) {
6660 const auto *FuncY = cast<FunctionDecl>(Y);
6661 if (
const auto *CtorX = dyn_cast<CXXConstructorDecl>(
X)) {
6662 const auto *CtorY = cast<CXXConstructorDecl>(Y);
6663 if (CtorX->getInheritedConstructor() &&
6664 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
6665 CtorY->getInheritedConstructor().getConstructor()))
6669 if (FuncX->isMultiVersion() != FuncY->isMultiVersion())
6674 if (FuncX->isMultiVersion()) {
6675 const auto *TAX = FuncX->getAttr<TargetAttr>();
6676 const auto *TAY = FuncY->getAttr<TargetAttr>();
6677 assert(TAX && TAY &&
"Multiversion Function without target attribute");
6679 if (TAX->getFeaturesStr() != TAY->getFeaturesStr())
6685 if ((FuncX->isMemberLikeConstrainedFriend() ||
6686 FuncY->isMemberLikeConstrainedFriend()) &&
6687 !FuncX->getLexicalDeclContext()->Equals(
6688 FuncY->getLexicalDeclContext())) {
6693 FuncY->getTrailingRequiresClause()))
6701 FD = FD->getCanonicalDecl();
6702 return FD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType()
6705 QualType XT = GetTypeAsWritten(FuncX), YT = GetTypeAsWritten(FuncY);
6720 return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() &&
6725 if (
const auto *VarX = dyn_cast<VarDecl>(
X)) {
6726 const auto *VarY = cast<VarDecl>(Y);
6727 if (VarX->getLinkageInternal() == VarY->getLinkageInternal()) {
6730 if (VarX->getType().isNull() || VarY->getType().isNull())
6733 if (
hasSameType(VarX->getType(), VarY->getType()))
6743 if (!VarXTy || !VarYTy)
6752 if (
const auto *NamespaceX = dyn_cast<NamespaceDecl>(
X)) {
6753 const auto *NamespaceY = cast<NamespaceDecl>(Y);
6754 return NamespaceX->isInline() == NamespaceY->isInline();
6759 if (
const auto *TemplateX = dyn_cast<TemplateDecl>(
X)) {
6760 const auto *TemplateY = cast<TemplateDecl>(Y);
6763 if (
const auto *ConceptX = dyn_cast<ConceptDecl>(
X)) {
6764 const auto *ConceptY = cast<ConceptDecl>(Y);
6766 ConceptY->getConstraintExpr()))
6771 TemplateY->getTemplatedDecl()) &&
6773 TemplateY->getTemplateParameters());
6777 if (
const auto *FDX = dyn_cast<FieldDecl>(
X)) {
6778 const auto *FDY = cast<FieldDecl>(Y);
6780 return hasSameType(FDX->getType(), FDY->getType());
6784 if (
const auto *IFDX = dyn_cast<IndirectFieldDecl>(
X)) {
6785 const auto *IFDY = cast<IndirectFieldDecl>(Y);
6786 return IFDX->getAnonField()->getCanonicalDecl() ==
6787 IFDY->getAnonField()->getCanonicalDecl();
6791 if (isa<EnumConstantDecl>(
X))
6796 if (
const auto *USX = dyn_cast<UsingShadowDecl>(
X)) {
6797 const auto *USY = cast<UsingShadowDecl>(Y);
6798 return USX->getTargetDecl() == USY->getTargetDecl();
6803 if (
const auto *UX = dyn_cast<UsingDecl>(
X)) {
6804 const auto *UY = cast<UsingDecl>(Y);
6806 UX->hasTypename() == UY->hasTypename() &&
6807 UX->isAccessDeclaration() == UY->isAccessDeclaration();
6809 if (
const auto *UX = dyn_cast<UnresolvedUsingValueDecl>(
X)) {
6810 const auto *UY = cast<UnresolvedUsingValueDecl>(Y);
6812 UX->isAccessDeclaration() == UY->isAccessDeclaration();
6814 if (
const auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(
X)) {
6817 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
6822 if (
const auto *UX = dyn_cast<UsingPackDecl>(
X)) {
6824 UX->getInstantiatedFromUsingDecl(),
6825 cast<UsingPackDecl>(Y)->getInstantiatedFromUsingDecl());
6829 if (
const auto *NAX = dyn_cast<NamespaceAliasDecl>(
X)) {
6830 const auto *NAY = cast<NamespaceAliasDecl>(Y);
6831 return NAX->getNamespace()->Equals(NAY->getNamespace());
6878 bool AnyNonCanonArgs =
false;
6881 if (!AnyNonCanonArgs)
6889 llvm_unreachable(
"Unhandled template argument kind");
6932 DNT->getIdentifier());
6946 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
6951 if (!
T.hasLocalQualifiers()) {
6953 if (
const auto *AT = dyn_cast<ArrayType>(
T))
6958 if (!isa<ArrayType>(
T.getCanonicalType()))
6973 const auto *ATy = dyn_cast<ArrayType>(split.
Ty);
6974 if (!ATy || qs.
empty())
6981 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
6984 CAT->getSizeModifier(),
6985 CAT->getIndexTypeCVRQualifiers()));
6986 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
6988 IAT->getSizeModifier(),
6989 IAT->getIndexTypeCVRQualifiers()));
6991 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
6992 return cast<ArrayType>(
6994 DSAT->getSizeExpr(),
6995 DSAT->getSizeModifier(),
6996 DSAT->getIndexTypeCVRQualifiers(),
6997 DSAT->getBracketsRange()));
6999 const auto *VAT = cast<VariableArrayType>(ATy);
7002 VAT->getSizeModifier(),
7003 VAT->getIndexTypeCVRQualifiers(),
7004 VAT->getBracketsRange()));
7018 return T.getUnqualifiedType();
7031 return T.getUnqualifiedType();
7046 assert(PrettyArrayType &&
"Not an array type!");
7083 uint64_t ElementCount = 1;
7086 CA = dyn_cast_or_null<ConstantArrayType>(
7089 return ElementCount;
7097 uint64_t ElementCount = 1;
7101 AILE = dyn_cast<ArrayInitLoopExpr>(AILE->
getSubExpr());
7104 return ElementCount;
7114 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
7116 case BuiltinType::Half:
return HalfRank;
7117 case BuiltinType::Float:
return FloatRank;
7150unsigned ASTContext::getIntegerRank(
const Type *
T)
const {
7155 if (
const auto *EIT = dyn_cast<BitIntType>(
T))
7156 return 0 + (EIT->getNumBits() << 3);
7158 switch (cast<BuiltinType>(
T)->getKind()) {
7159 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
7160 case BuiltinType::Bool:
7162 case BuiltinType::Char_S:
7163 case BuiltinType::Char_U:
7164 case BuiltinType::SChar:
7165 case BuiltinType::UChar:
7167 case BuiltinType::Short:
7168 case BuiltinType::UShort:
7170 case BuiltinType::Int:
7171 case BuiltinType::UInt:
7173 case BuiltinType::Long:
7174 case BuiltinType::ULong:
7176 case BuiltinType::LongLong:
7177 case BuiltinType::ULongLong:
7179 case BuiltinType::Int128:
7180 case BuiltinType::UInt128:
7185 case BuiltinType::Char8:
7187 case BuiltinType::Char16:
7188 return getIntegerRank(
7190 case BuiltinType::Char32:
7191 return getIntegerRank(
7193 case BuiltinType::WChar_S:
7194 case BuiltinType::WChar_U:
7195 return getIntegerRank(
7225 uint64_t BitWidth = Field->getBitWidthValue(*
this);
7248 if (
QualType QT = Field->getType(); QT->isBitIntType())
7251 if (BitWidth < IntSize)
7254 if (BitWidth == IntSize)
7269 assert(!Promotable.
isNull());
7272 return ET->getDecl()->getPromotionType();
7281 if (BT->getKind() == BuiltinType::WChar_S ||
7282 BT->getKind() == BuiltinType::WChar_U ||
7283 BT->getKind() == BuiltinType::Char8 ||
7284 BT->getKind() == BuiltinType::Char16 ||
7285 BT->getKind() == BuiltinType::Char32) {
7286 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
7290 for (
const auto &PT : PromoteTypes) {
7292 if (FromSize < ToSize ||
7293 (FromSize == ToSize && FromIsSigned == PT->isSignedIntegerType()))
7296 llvm_unreachable(
"char type should fit into long long");
7303 uint64_t PromotableSize =
getIntWidth(Promotable);
7312 while (!
T.isNull()) {
7314 return T.getObjCLifetime();
7344 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
7346 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
7349 if (LHSC == RHSC)
return 0;
7354 unsigned LHSRank = getIntegerRank(LHSC);
7355 unsigned RHSRank = getIntegerRank(RHSC);
7357 if (LHSUnsigned == RHSUnsigned) {
7358 if (LHSRank == RHSRank)
return 0;
7359 return LHSRank > RHSRank ? 1 : -1;
7365 if (LHSRank >= RHSRank)
7375 if (RHSRank >= LHSRank)
7385 if (CFConstantStringTypeDecl)
7386 return CFConstantStringTypeDecl;
7388 assert(!CFConstantStringTagDecl &&
7389 "tag and typedef should be initialized together");
7429 if (
static_cast<unsigned>(CFRuntime) <
7432 Fields[Count++] = {
IntTy,
"flags" };
7434 Fields[Count++] = {
LongTy,
"length" };
7438 Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc" };
7442 Fields[Count++] = {
IntTy,
"_ptr" };
7448 for (
unsigned i = 0; i < Count; ++i) {
7452 Fields[i].Type,
nullptr,
7455 CFConstantStringTagDecl->
addDecl(Field);
7462 CFConstantStringTypeDecl =
7465 return CFConstantStringTypeDecl;
7469 if (!CFConstantStringTagDecl)
7471 return CFConstantStringTagDecl;
7480 if (ObjCSuperType.
isNull()) {
7485 return ObjCSuperType;
7490 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
7497 if (BlockDescriptorType)
7510 static const char *
const FieldNames[] = {
7515 for (
size_t i = 0; i < 2; ++i) {
7518 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
7526 BlockDescriptorType = RD;
7532 if (BlockDescriptorExtendedType)
7547 static const char *
const FieldNames[] = {
7554 for (
size_t i = 0; i < 4; ++i) {
7557 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
7566 BlockDescriptorExtendedType = RD;
7571 const auto *BT = dyn_cast<BuiltinType>(
T);
7574 if (isa<PipeType>(
T))
7580 switch (BT->getKind()) {
7581#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
7582 case BuiltinType::Id: \
7584#include "clang/Basic/OpenCLImageTypes.def"
7586 case BuiltinType::OCLClkEvent:
7589 case BuiltinType::OCLEvent:
7592 case BuiltinType::OCLQueue:
7595 case BuiltinType::OCLReserveID:
7598 case BuiltinType::OCLSampler:
7617 if (!copyExpr && record->hasTrivialDestructor())
return false;
7645 llvm_unreachable(
"impossible");
7647 llvm_unreachable(
"fell out of lifetime switch!");
7655 bool &HasByrefExtendedLayout)
const {
7660 HasByrefExtendedLayout =
false;
7662 HasByrefExtendedLayout =
true;
7676 assert(
Target &&
"Expected target to be initialized");
7677 const llvm::Triple &
T =
Target->getTriple();
7679 if (
T.isOSWindows() &&
T.isArch64Bit())
7685 assert(
Target &&
"Expected target to be initialized");
7686 const llvm::Triple &
T =
Target->getTriple();
7688 if (
T.isOSWindows() &&
T.isArch64Bit())
7694 if (!ObjCInstanceTypeDecl)
7695 ObjCInstanceTypeDecl =
7697 return ObjCInstanceTypeDecl;
7703 if (
const auto *TT = dyn_cast<TypedefType>(
T))
7705 return II->isStr(
"BOOL");
7713 if (!
type->isIncompleteArrayType() &&
type->isIncompleteType())
7722 else if (
type->isArrayType())
7741 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
7747 if (D->getLexicalDeclContext()->isFileContext() &&
7748 !D->isInlineSpecified() && (D->isConstexpr() ||
First->isConstexpr()))
7779 for (
auto *PI :
Decl->parameters()) {
7784 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
7793 ParmOffset = PtrSize;
7794 for (
auto *PVDecl :
Decl->parameters()) {
7795 QualType PType = PVDecl->getOriginalType();
7796 if (
const auto *AT =
7800 if (!isa<ConstantArrayType>(AT))
7801 PType = PVDecl->getType();
7803 PType = PVDecl->getType();
7823 for (
auto *PI :
Decl->parameters()) {
7830 "getObjCEncodingForFunctionDecl - Incomplete param type");
7837 for (
auto *PVDecl :
Decl->parameters()) {
7838 QualType PType = PVDecl->getOriginalType();
7839 if (
const auto *AT =
7843 if (!isa<ConstantArrayType>(AT))
7844 PType = PVDecl->getType();
7846 PType = PVDecl->getType();
7860 bool Extended)
const {
7864 ObjCEncOptions Options = ObjCEncOptions()
7865 .setExpandPointedToStructures()
7866 .setExpandStructures()
7867 .setIsOutermostType();
7869 Options.setEncodeBlockParameters().setEncodeClassNames();
7870 getObjCEncodingForTypeImpl(
T, S, Options,
nullptr);
7876 bool Extended)
const {
7881 Decl->getReturnType(), S, Extended);
7890 E =
Decl->sel_param_end(); PI != E; ++PI) {
7897 "getObjCEncodingForMethodDecl - Incomplete param type");
7905 ParmOffset = 2 * PtrSize;
7907 E =
Decl->sel_param_end(); PI != E; ++PI) {
7910 if (
const auto *AT =
7914 if (!isa<ConstantArrayType>(AT))
7919 PType, S, Extended);
7930 const Decl *Container)
const {
7933 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
7934 for (
auto *PID : CID->property_impls())
7935 if (PID->getPropertyDecl() == PD)
7938 const auto *OID = cast<ObjCImplementationDecl>(Container);
7939 for (
auto *PID : OID->property_impls())
7940 if (PID->getPropertyDecl() == PD)
7974 const Decl *Container)
const {
7976 bool Dynamic =
false;
7984 SynthesizePID = PropertyImpDecl;
7988 std::string S =
"T";
8033 if (SynthesizePID) {
8050 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
8053 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
8066 getObjCEncodingForTypeImpl(
T, S,
8068 .setExpandPointedToStructures()
8069 .setExpandStructures()
8070 .setIsOutermostType(),
8071 Field, NotEncodedT);
8075 std::string& S)
const {
8079 getObjCEncodingForTypeImpl(
T, S,
8081 .setExpandPointedToStructures()
8082 .setExpandStructures()
8083 .setIsOutermostType()
8084 .setEncodingProperty(),
8092 case BuiltinType::Void:
return 'v';
8093 case BuiltinType::Bool:
return 'B';
8094 case BuiltinType::Char8:
8095 case BuiltinType::Char_U:
8096 case BuiltinType::UChar:
return 'C';
8097 case BuiltinType::Char16:
8098 case BuiltinType::UShort:
return 'S';
8099 case BuiltinType::Char32:
8100 case BuiltinType::UInt:
return 'I';
8101 case BuiltinType::ULong:
8102 return C->getTargetInfo().getLongWidth() == 32 ?
'L' :
'Q';
8103 case BuiltinType::UInt128:
return 'T';
8104 case BuiltinType::ULongLong:
return 'Q';
8105 case BuiltinType::Char_S:
8106 case BuiltinType::SChar:
return 'c';
8107 case BuiltinType::Short:
return 's';
8108 case BuiltinType::WChar_S:
8109 case BuiltinType::WChar_U:
8110 case BuiltinType::Int:
return 'i';
8111 case BuiltinType::Long:
8112 return C->getTargetInfo().getLongWidth() == 32 ?
'l' :
'q';
8113 case BuiltinType::LongLong:
return 'q';
8114 case BuiltinType::Int128:
return 't';
8115 case BuiltinType::Float:
return 'f';
8116 case BuiltinType::Double:
return 'd';
8117 case BuiltinType::LongDouble:
return 'D';
8118 case BuiltinType::NullPtr:
return '*';
8120 case BuiltinType::BFloat16:
8121 case BuiltinType::Float16:
8122 case BuiltinType::Float128:
8123 case BuiltinType::Ibm128:
8124 case BuiltinType::Half:
8125 case BuiltinType::ShortAccum:
8126 case BuiltinType::Accum:
8127 case BuiltinType::LongAccum:
8128 case BuiltinType::UShortAccum:
8129 case BuiltinType::UAccum:
8130 case BuiltinType::ULongAccum:
8131 case BuiltinType::ShortFract:
8132 case BuiltinType::Fract:
8133 case BuiltinType::LongFract:
8134 case BuiltinType::UShortFract:
8135 case BuiltinType::UFract:
8136 case BuiltinType::ULongFract:
8137 case BuiltinType::SatShortAccum:
8138 case BuiltinType::SatAccum:
8139 case BuiltinType::SatLongAccum:
8140 case BuiltinType::SatUShortAccum:
8141 case BuiltinType::SatUAccum:
8142 case BuiltinType::SatULongAccum:
8143 case BuiltinType::SatShortFract:
8144 case BuiltinType::SatFract:
8145 case BuiltinType::SatLongFract:
8146 case BuiltinType::SatUShortFract:
8147 case BuiltinType::SatUFract:
8148 case BuiltinType::SatULongFract:
8152#define SVE_TYPE(Name, Id, SingletonId) \
8153 case BuiltinType::Id:
8154#include "clang/Basic/AArch64SVEACLETypes.def"
8155#define RVV_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8156#include "clang/Basic/RISCVVTypes.def"
8157#define WASM_TYPE(Name, Id, SingletonId) case BuiltinType::Id:
8158#include "clang/Basic/WebAssemblyReferenceTypes.def"
8162 "cannot yet @encode type %0");
8167 case BuiltinType::ObjCId:
8168 case BuiltinType::ObjCClass:
8169 case BuiltinType::ObjCSel:
8170 llvm_unreachable(
"@encoding ObjC primitive type");
8173#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
8174 case BuiltinType::Id:
8175#include "clang/Basic/OpenCLImageTypes.def"
8176#define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
8177 case BuiltinType::Id:
8178#include "clang/Basic/OpenCLExtensionTypes.def"
8179 case BuiltinType::OCLEvent:
8180 case BuiltinType::OCLClkEvent:
8181 case BuiltinType::OCLQueue:
8182 case BuiltinType::OCLReserveID:
8183 case BuiltinType::OCLSampler:
8184 case BuiltinType::Dependent:
8185#define PPC_VECTOR_TYPE(Name, Id, Size) \
8186 case BuiltinType::Id:
8187#include "clang/Basic/PPCTypes.def"
8188#define BUILTIN_TYPE(KIND, ID)
8189#define PLACEHOLDER_TYPE(KIND, ID) \
8190 case BuiltinType::KIND:
8191#include "clang/AST/BuiltinTypes.def"
8192 llvm_unreachable(
"invalid builtin type for @encode");
8194 llvm_unreachable(
"invalid BuiltinType::Kind value");
8201 if (!
Enum->isFixed())
8211 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
8231 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
8240 S += llvm::utostr(Offset);
8255 bool VisitBasesAndFields) {
8260 PT->getPointeeType().getTypePtr(),
false);
8267 if (isa<ClassTemplateSpecializationDecl>(CXXRD))
8270 if (!CXXRD->hasDefinition() || !VisitBasesAndFields)
8273 for (
const auto &B : CXXRD->bases())
8278 for (
auto *FD : CXXRD->fields())
8287void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string &S,
8288 const ObjCEncOptions Options,
8292 switch (CT->getTypeClass()) {
8297 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
8319 case Type::LValueReference:
8320 case Type::RValueReference: {
8322 if (isa<PointerType>(CT)) {
8324 if (PT->isObjCSelType()) {
8333 bool isReadOnly =
false;
8339 if (Options.IsOutermostType() &&
T.isConstQualified()) {
8343 }
else if (Options.IsOutermostType()) {
8346 P = PT->getPointeeType();
8347 if (
P.isConstQualified()) {
8356 if (StringRef(S).ends_with(
"nr"))
8357 S.replace(S.end()-2, S.end(),
"rn");
8369 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
8374 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
8383 RTy, Options.ExpandPointedToStructures()))) {
8392 ObjCEncOptions NewOptions;
8393 if (Options.ExpandPointedToStructures())
8394 NewOptions.setExpandStructures();
8395 getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
8396 nullptr, NotEncodedT);
8400 case Type::ConstantArray:
8401 case Type::IncompleteArray:
8402 case Type::VariableArray: {
8403 const auto *AT = cast<ArrayType>(CT);
8405 if (isa<IncompleteArrayType>(AT) && !Options.IsStructField()) {
8409 getObjCEncodingForTypeImpl(
8410 AT->getElementType(), S,
8411 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
8415 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
8416 S += llvm::utostr(CAT->getZExtSize());
8419 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
8420 "Unknown array type!");
8424 getObjCEncodingForTypeImpl(
8425 AT->getElementType(), S,
8426 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
8433 case Type::FunctionNoProto:
8434 case Type::FunctionProto:
8438 case Type::Record: {
8439 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
8440 S += RDecl->
isUnion() ?
'(' :
'{';
8444 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
8446 llvm::raw_string_ostream OS(S);
8453 if (Options.ExpandStructures()) {
8456 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
8458 for (
const auto *Field : RDecl->
fields()) {
8461 S +=
Field->getNameAsString();
8466 if (
Field->isBitField()) {
8467 getObjCEncodingForTypeImpl(
Field->getType(), S,
8468 ObjCEncOptions().setExpandStructures(),
8473 getObjCEncodingForTypeImpl(
8475 ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
8481 S += RDecl->
isUnion() ?
')' :
'}';
8485 case Type::BlockPointer: {
8488 if (Options.EncodeBlockParameters()) {
8489 const auto *FT = BT->getPointeeType()->castAs<
FunctionType>();
8493 getObjCEncodingForTypeImpl(FT->getReturnType(), S,
8494 Options.forComponentType(), FD, NotEncodedT);
8498 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
8499 for (
const auto &I : FPT->param_types())
8500 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
8508 case Type::ObjCObject: {
8512 S +=
"{objc_object=}";
8516 S +=
"{objc_class=}";
8523 case Type::ObjCInterface: {
8529 if (Options.ExpandStructures()) {
8533 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
8535 if (
Field->isBitField())
8536 getObjCEncodingForTypeImpl(
Field->getType(), S,
8537 ObjCEncOptions().setExpandStructures(),
8540 getObjCEncodingForTypeImpl(
Field->getType(), S,
8541 ObjCEncOptions().setExpandStructures(), FD,
8549 case Type::ObjCObjectPointer: {
8551 if (OPT->isObjCIdType()) {
8556 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
8564 if (OPT->isObjCQualifiedIdType()) {
8565 getObjCEncodingForTypeImpl(
8567 Options.keepingOnly(ObjCEncOptions()
8568 .setExpandPointedToStructures()
8569 .setExpandStructures()),
8571 if (FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
8575 for (
const auto *I : OPT->quals()) {
8577 S += I->getObjCRuntimeNameAsString();
8586 if (OPT->getInterfaceDecl() &&
8587 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
8589 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
8590 for (
const auto *I : OPT->quals()) {
8592 S += I->getObjCRuntimeNameAsString();
8602 case Type::MemberPointer:
8606 case Type::ExtVector:
8612 case Type::ConstantMatrix:
8625 case Type::DeducedTemplateSpecialization:
8628 case Type::ArrayParameter:
8630#define ABSTRACT_TYPE(KIND, BASE)
8631#define TYPE(KIND, BASE)
8632#define DEPENDENT_TYPE(KIND, BASE) \
8634#define NON_CANONICAL_TYPE(KIND, BASE) \
8636#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \
8638#include "clang/AST/TypeNodes.inc"
8639 llvm_unreachable(
"@encode for dependent type!");
8641 llvm_unreachable(
"bad type kind!");
8644void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
8649 assert(RDecl &&
"Expected non-null RecordDecl");
8650 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
8654 const auto *CXXRec = dyn_cast<CXXRecordDecl>(RDecl);
8655 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
8659 for (
const auto &BI : CXXRec->bases()) {
8660 if (!BI.isVirtual()) {
8665 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8666 std::make_pair(offs, base));
8672 if (!
Field->isZeroLengthBitField(*
this) &&
Field->isZeroSize(*
this))
8675 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8676 std::make_pair(offs, Field));
8679 if (CXXRec && includeVBases) {
8680 for (
const auto &BI : CXXRec->vbases()) {
8686 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
8687 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
8688 std::make_pair(offs, base));
8702 std::multimap<uint64_t, NamedDecl *>::iterator
8703 CurLayObj = FieldOrBaseOffsets.begin();
8705 if (CXXRec && CXXRec->isDynamicClass() &&
8706 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
8709 std::string recname = CXXRec->getNameAsString();
8710 if (recname.empty()) recname =
"?";
8723 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
8724 std::make_pair(offs,
nullptr));
8727 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
8729 assert(CurOffs <= CurLayObj->first);
8730 if (CurOffs < CurLayObj->first) {
8731 uint64_t padding = CurLayObj->first - CurOffs;
8747 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
8752 getObjCEncodingForStructureImpl(base, S, FD,
false,
8759 const auto *field = cast<FieldDecl>(dcl);
8762 S += field->getNameAsString();
8766 if (field->isBitField()) {
8769 CurOffs += field->getBitWidthValue(*
this);
8774 getObjCEncodingForTypeImpl(
8775 qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
8786 std::string& S)
const {
8819 if (!ObjCClassDecl) {
8824 return ObjCClassDecl;
8828 if (!ObjCProtocolClassDecl) {
8829 ObjCProtocolClassDecl
8838 return ObjCProtocolClassDecl;
8883 const size_t NumFields = 5;
8885 const char *FieldNames[NumFields];
8889 FieldNames[0] =
"__stack";
8893 FieldNames[1] =
"__gr_top";
8897 FieldNames[2] =
"__vr_top";
8900 FieldTypes[3] = Context->
IntTy;
8901 FieldNames[3] =
"__gr_offs";
8904 FieldTypes[4] = Context->
IntTy;
8905 FieldNames[4] =
"__vr_offs";
8908 for (
unsigned i = 0; i < NumFields; ++i) {
8914 FieldTypes[i],
nullptr,
8919 VaListTagDecl->
addDecl(Field);
8936 const size_t NumFields = 5;
8938 const char *FieldNames[NumFields];
8942 FieldNames[0] =
"gpr";
8946 FieldNames[1] =
"fpr";
8950 FieldNames[2] =
"reserved";
8954 FieldNames[3] =
"overflow_arg_area";
8958 FieldNames[4] =
"reg_save_area";
8961 for (
unsigned i = 0; i < NumFields; ++i) {
8966 FieldTypes[i],
nullptr,
8971 VaListTagDecl->
addDecl(Field);
8998 const size_t NumFields = 4;
9000 const char *FieldNames[NumFields];
9004 FieldNames[0] =
"gp_offset";
9008 FieldNames[1] =
"fp_offset";
9012 FieldNames[2] =
"overflow_arg_area";
9016 FieldNames[3] =
"reg_save_area";
9019 for (
unsigned i = 0; i < NumFields; ++i) {
9025 FieldTypes[i],
nullptr,
9030 VaListTagDecl->
addDecl(Field);
9101 const size_t NumFields = 4;
9103 const char *FieldNames[NumFields];
9106 FieldTypes[0] = Context->
LongTy;
9107 FieldNames[0] =
"__gpr";
9110 FieldTypes[1] = Context->
LongTy;
9111 FieldNames[1] =
"__fpr";
9115 FieldNames[2] =
"__overflow_arg_area";
9119 FieldNames[3] =
"__reg_save_area";
9122 for (
unsigned i = 0; i < NumFields; ++i) {
9128 FieldTypes[i],
nullptr,
9133 VaListTagDecl->
addDecl(Field);
9155 const size_t NumFields = 3;
9157 const char *FieldNames[NumFields];
9161 FieldNames[0] =
"__current_saved_reg_area_pointer";
9165 FieldNames[1] =
"__saved_reg_area_end_pointer";
9169 FieldNames[2] =
"__overflow_area_pointer";
9172 for (
unsigned i = 0; i < NumFields; ++i) {
9180 VaListTagDecl->
addDecl(Field);
9223 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
9227 if (!BuiltinVaListDecl) {
9232 return BuiltinVaListDecl;
9245 if (!BuiltinMSVaListDecl)
9248 return BuiltinMSVaListDecl;
9260 assert(ObjCConstantStringType.
isNull() &&
9261 "'NSConstantString' type already set!");
9271 unsigned size = End -
Begin;
9272 assert(size > 1 &&
"set is not overloaded!");
9281 assert(isa<FunctionTemplateDecl>(D) ||
9282 isa<UnresolvedUsingValueDecl>(D) ||
9283 (isa<UsingShadowDecl>(D) &&
9301 bool TemplateKeyword,
9303 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
9306 llvm::FoldingSetNodeID ID;
9309 void *InsertPos =
nullptr;
9311 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9315 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
9327 "Nested name specifier must be dependent");
9329 llvm::FoldingSetNodeID ID;
9332 void *InsertPos =
nullptr;
9334 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9340 if (CanonNNS == NNS) {
9348 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9349 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
9353 DependentTemplateNames.InsertNode(QTN, InsertPos);
9363 "Nested name specifier must be dependent");
9365 llvm::FoldingSetNodeID ID;
9368 void *InsertPos =
nullptr;
9370 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9376 if (CanonNNS == NNS) {
9385 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
9386 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
9390 DependentTemplateNames.InsertNode(QTN, InsertPos);
9396 std::optional<unsigned> PackIndex)
const {
9397 llvm::FoldingSetNodeID ID;
9401 void *insertPos =
nullptr;
9403 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
9407 Replacement, AssociatedDecl, Index, PackIndex);
9408 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
9416 Decl *AssociatedDecl,
9417 unsigned Index,
bool Final)
const {
9419 llvm::FoldingSetNodeID ID;
9421 AssociatedDecl, Index, Final);
9423 void *InsertPos =
nullptr;
9425 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
9430 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
9454 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
9484 while (
const auto *AT = dyn_cast<ArrayType>(CT))
9485 CT = AT->getElementType();
9517 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
9518 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
9549 if (Ty->
getKind() == BuiltinType::SveBool ||
9550 Ty->
getKind() == BuiltinType::SveCount)
9560 "Expected SVE builtin type and vector type!");
9568 return BT->getKind() == BuiltinType::SveBool;
9570 return VT->getElementType().getCanonicalType() ==
9581 return IsValidCast(FirstType, SecondType) ||
9582 IsValidCast(SecondType, FirstType);
9590 "Expected SVE builtin type and vector type!");
9605 if (BT->getKind() == BuiltinType::SveBool &&
9626 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
9633 return IsLaxCompatible(FirstType, SecondType) ||
9634 IsLaxCompatible(SecondType, FirstType);
9650 uint64_t MinElts = Info.
EC.getKnownMinValue();
9651 return VScale->first * MinElts * EltSize;
9659 "Expected RVV builtin type and vector type!");
9681 return IsValidCast(FirstType, SecondType) ||
9682 IsValidCast(SecondType, FirstType);
9690 "Expected RVV builtin type and vector type!");
9697 if (!BT->isRVVVLSBuiltinType())
9717 return VecTy->getElementType().getCanonicalType()->isIntegerType() &&
9724 return IsLaxCompatible(FirstType, SecondType) ||
9725 IsLaxCompatible(SecondType, FirstType);
9732 if (
Attr->getAttrKind() == attr::ObjCOwnership)
9735 Ty =
Attr->getModifiedType();
9739 Ty =
Paren->getInnerType();
9771 for (
auto *lhsProto : lhs->
quals()) {
9773 for (
auto *rhsProto : rhs->
quals()) {
9804 for (
auto *I : lhs->
quals()) {
9808 if (!rhsID->ClassImplementsProtocol(I,
true))
9816 for (
auto *lhsProto : lhs->
quals()) {
9822 for (
auto *rhsProto : rhs->
quals()) {
9832 for (
auto *I : lhs->
quals()) {
9836 if (rhsID->ClassImplementsProtocol(I,
true)) {
9853 for (
auto *lhsProto : lhs->
quals()) {
9861 for (
auto *rhsProto : rhs->
quals()) {
9880 if (LHSInheritedProtocols.empty() && lhs->
qual_empty())
9882 for (
auto *lhsProto : LHSInheritedProtocols) {
9884 for (
auto *rhsProto : rhs->
quals()) {
9914 auto finish = [&](
bool succeeded) ->
bool {
9959 bool BlockReturnType) {
9963 auto finish = [&](
bool succeeded) ->
bool {
9988 if (
getLangOpts().CompatibilityQualifiedIdBlockParamTypeChecking)
9992 (!BlockReturnType &&
9996 (BlockReturnType ? LHSOPT : RHSOPT),
9997 (BlockReturnType ? RHSOPT : LHSOPT),
false));
10005 return finish(BlockReturnType);
10007 return finish(!BlockReturnType);
10019 return (*lhs)->getName().compare((*rhs)->getName());
10036 assert(LHS->
getInterface() &&
"LHS must have an interface base");
10037 assert(RHS->
getInterface() &&
"RHS must have an interface base");
10043 for (
auto *proto : LHS->
quals()) {
10054 for (
auto *proto : RHS->
quals()) {
10062 for (
auto *proto : LHSProtocolSet) {
10063 if (RHSProtocolSet.count(proto))
10064 IntersectionSet.push_back(proto);
10073 if (!ImpliedProtocols.empty()) {
10075 return ImpliedProtocols.contains(proto);
10080 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
10090 if (lhsOPT && rhsOPT)
10096 if (lhsBlock && rhsBlock)
10101 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
10113 bool stripKindOf) {
10114 if (lhsArgs.size() != rhsArgs.size())
10121 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
10127 if (!stripKindOf ||
10128 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
10129 rhsArgs[i].stripObjCKindOfType(ctx))) {
10157 if (!LDecl || !RDecl)
10167 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
10177 bool anyChanges =
false;
10195 if (!Protocols.empty())
10213 if (LHSSuperType.
isNull())
10223 if (KnownLHS != LHSAncestors.end()) {
10224 LHS = KnownLHS->second;
10228 bool anyChanges =
false;
10246 if (!Protocols.empty())
10263 if (RHSSuperType.
isNull())
10274 assert(LHS->
getInterface() &&
"LHS is not an interface type");
10275 assert(RHS->
getInterface() &&
"RHS is not an interface type");
10296 for (
auto *RHSPI : RHS->
quals())
10299 if (SuperClassInheritedProtocols.empty())
10302 for (
const auto *LHSProto : LHS->
quals()) {
10303 bool SuperImplementsProtocol =
false;
10304 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
10305 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
10306 SuperImplementsProtocol =
true;
10309 if (!SuperImplementsProtocol)
10339 if (!LHSOPT || !RHSOPT)
10357 bool CompareUnqualified) {
10376 bool OfBlockPointer,
10380 if (UD->
hasAttr<TransparentUnionAttr>()) {
10381 for (
const auto *I : UD->
fields()) {
10382 QualType ET = I->getType().getUnqualifiedType();
10396 bool OfBlockPointer,
10417 bool IsConditionalOperator) {
10420 const auto *lproto = dyn_cast<FunctionProtoType>(lbase);
10421 const auto *rproto = dyn_cast<FunctionProtoType>(rbase);
10422 bool allLTypes =
true;
10423 bool allRTypes =
true;
10427 if (OfBlockPointer) {
10429 QualType LHS = lbase->getReturnType();
10431 if (!UnqualifiedResult)
10433 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
10498 bool NoReturn = IsConditionalOperator
10508 if (lproto && rproto) {
10509 assert((AllowCXX ||
10510 (!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec())) &&
10511 "C++ shouldn't be here");
10513 if (lproto->getNumParams() != rproto->getNumParams())
10517 if (lproto->isVariadic() != rproto->isVariadic())
10520 if (lproto->getMethodQuals() != rproto->getMethodQuals())
10524 bool canUseLeft, canUseRight;
10536 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
10537 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
10538 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
10540 lParamType, rParamType, OfBlockPointer,
Unqualified);
10547 types.push_back(paramType);
10559 if (allLTypes)
return lhs;
10560 if (allRTypes)
return rhs;
10565 newParamInfos.empty() ? nullptr : newParamInfos.data();
10569 if (lproto) allRTypes =
false;
10570 if (rproto) allLTypes =
false;
10574 assert((AllowCXX || !proto->
hasExceptionSpec()) &&
"C++ shouldn't be here");
10582 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
10588 paramTy =
Enum->getDecl()->getIntegerType();
10598 if (allLTypes)
return lhs;
10599 if (allRTypes)
return rhs;
10606 if (allLTypes)
return lhs;
10607 if (allRTypes)
return rhs;
10613 QualType other,
bool isBlockReturnType) {
10619 if (underlyingType.
isNull())
10635 bool IsConditionalOperator) {
10646 if (LangOpts.OpenMP && LHSRefTy && RHSRefTy &&
10650 if (LHSRefTy || RHSRefTy)
10662 if (LHSCan == RHSCan)
10667 Qualifiers RQuals = RHSCan.getLocalQualifiers();
10668 if (LQuals != RQuals) {
10684 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
10705 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
10706 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
10709 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
10710 LHSClass = Type::ConstantArray;
10711 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
10712 RHSClass = Type::ConstantArray;
10715 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
10716 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
10719 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
10720 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
10723 if (LHSClass != RHSClass) {
10733 if (OfBlockPointer && !BlockReturnType) {
10742 if (!AT->isDeduced() && AT->isGNUAutoType())
10746 if (!AT->isDeduced() && AT->isGNUAutoType())
10753 switch (LHSClass) {
10754#define TYPE(Class, Base)
10755#define ABSTRACT_TYPE(Class, Base)
10756#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
10757#define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
10758#define DEPENDENT_TYPE(Class, Base) case Type::Class:
10759#include "clang/AST/TypeNodes.inc"
10760 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
10763 case Type::DeducedTemplateSpecialization:
10764 case Type::LValueReference:
10765 case Type::RValueReference:
10766 case Type::MemberPointer:
10767 llvm_unreachable(
"C++ should never be in mergeTypes");
10769 case Type::ObjCInterface:
10770 case Type::IncompleteArray:
10771 case Type::VariableArray:
10772 case Type::FunctionProto:
10773 case Type::ExtVector:
10774 llvm_unreachable(
"Types are eliminated above");
10776 case Type::Pointer:
10787 if (ResultType.
isNull())
10795 case Type::BlockPointer:
10820 if (ResultType.
isNull())
10839 if (ResultType.
isNull())
10847 case Type::ConstantArray:
10862 if (ResultType.
isNull())
10870 if (LVAT || RVAT) {
10873 -> std::pair<bool,llvm::APInt> {
10875 std::optional<llvm::APSInt> TheInt;
10878 return std::make_pair(
true, *TheInt);
10879 return std::make_pair(
false, llvm::APSInt());
10882 return std::make_pair(
true, CAT->getSize());
10883 return std::make_pair(
false, llvm::APInt());
10886 bool HaveLSize, HaveRSize;
10887 llvm::APInt LSize, RSize;
10888 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
10889 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
10890 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
10924 case Type::FunctionNoProto:
10926 false, IsConditionalOperator);
10930 case Type::Builtin:
10933 case Type::Complex:
10942 case Type::ConstantMatrix:
10947 case Type::ObjCObject: {
10956 case Type::ObjCObjectPointer:
10957 if (OfBlockPointer) {
10969 assert(LHS != RHS &&
10970 "Equivalent pipe types should have already been handled!");
10972 case Type::ArrayParameter:
10973 assert(LHS != RHS &&
10974 "Equivalent ArrayParameter types should have already been handled!");
10976 case Type::BitInt: {
10984 if (LHSUnsigned != RHSUnsigned)
10987 if (LHSBits != RHSBits)
10993 llvm_unreachable(
"Invalid Type::Class!");
10998 bool &CanUseFirst,
bool &CanUseSecond,
11000 assert(NewParamInfos.empty() &&
"param info list not empty");
11001 CanUseFirst = CanUseSecond =
true;
11007 if (!FirstHasInfo && !SecondHasInfo)
11010 bool NeedParamInfo =
false;
11014 for (
size_t I = 0; I < E; ++I) {
11025 bool FirstNoEscape = FirstParam.
isNoEscape();
11026 bool SecondNoEscape = SecondParam.
isNoEscape();
11027 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
11029 if (NewParamInfos.back().getOpaqueValue())
11030 NeedParamInfo =
true;
11031 if (FirstNoEscape != IsNoEscape)
11032 CanUseFirst =
false;
11033 if (SecondNoEscape != IsNoEscape)
11034 CanUseSecond =
false;
11037 if (!NeedParamInfo)
11038 NewParamInfos.clear();
11044 ObjCLayouts[CD] =
nullptr;
11054 if (LHSCan == RHSCan)
11056 if (RHSCan->isFunctionType()) {
11060 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
11062 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
11065 if (ResReturnType.
isNull())
11067 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
11071 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
11084 Qualifiers RQuals = RHSCan.getLocalQualifiers();
11085 if (LQuals != RQuals) {
11098 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
11114 if (ResQT == LHSBaseQT)
11116 if (ResQT == RHSBaseQT)
11128 T = ET->getDecl()->getIntegerType();
11132 return EIT->getNumBits();
11140 "Unexpected type");
11145 VTy->getNumElements(), VTy->getVectorKind());
11154 T = ETy->getDecl()->getIntegerType();
11157 case BuiltinType::Char_U:
11159 case BuiltinType::Char_S:
11160 case BuiltinType::SChar:
11161 case BuiltinType::Char8:
11163 case BuiltinType::Short:
11165 case BuiltinType::Int:
11167 case BuiltinType::Long:
11169 case BuiltinType::LongLong:
11171 case BuiltinType::Int128:
11176 case BuiltinType::WChar_S:
11179 case BuiltinType::ShortAccum:
11181 case BuiltinType::Accum:
11183 case BuiltinType::LongAccum:
11185 case BuiltinType::SatShortAccum:
11187 case BuiltinType::SatAccum:
11189 case BuiltinType::SatLongAccum:
11191 case BuiltinType::ShortFract:
11193 case BuiltinType::Fract:
11195 case BuiltinType::LongFract:
11197 case BuiltinType::SatShortFract:
11199 case BuiltinType::SatFract:
11201 case BuiltinType::SatLongFract:
11206 "Unexpected signed integer or fixed point type");
11214 "Unexpected type");
11219 VTy->getNumElements(), VTy->getVectorKind());
11228 T = ETy->getDecl()->getIntegerType();
11231 case BuiltinType::Char_S:
11233 case BuiltinType::Char_U:
11234 case BuiltinType::UChar:
11235 case BuiltinType::Char8:
11237 case BuiltinType::UShort:
11239 case BuiltinType::UInt:
11241 case BuiltinType::ULong:
11243 case BuiltinType::ULongLong:
11245 case BuiltinType::UInt128:
11250 case BuiltinType::WChar_U:
11253 case BuiltinType::UShortAccum:
11255 case BuiltinType::UAccum:
11257 case BuiltinType::ULongAccum:
11259 case BuiltinType::SatUShortAccum:
11261 case BuiltinType::SatUAccum:
11263 case BuiltinType::SatULongAccum:
11265 case BuiltinType::UShortFract:
11267 case BuiltinType::UFract:
11269 case BuiltinType::ULongFract:
11271 case BuiltinType::SatUShortFract:
11273 case BuiltinType::SatUFract:
11275 case BuiltinType::SatULongFract:
11280 "Unexpected signed integer or fixed point type");
11305 bool AllowTypeModifiers) {
11309 RequiresICE =
false;
11314 bool IsSpecial =
false;
11318 default: Done =
true; --Str;
break;
11320 RequiresICE =
true;
11323 assert(!
Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
11324 assert(!
Signed &&
"Can't use 'S' modifier multiple times!");
11328 assert(!
Signed &&
"Can't use both 'S' and 'U' modifiers!");
11329 assert(!
Unsigned &&
"Can't use 'U' modifier multiple times!");
11333 assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
11334 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
11339 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11340 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
11349 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11350 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
11356 llvm_unreachable(
"Unexpected integer type");
11367 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11368 assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
11374 llvm_unreachable(
"Unexpected integer type");
11387 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
11388 assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
11404 default: llvm_unreachable(
"Unknown builtin type letter!");
11407 "Bad modifiers used with 'x'!");
11412 "Bad modifiers used with 'y'!");
11417 "Bad modifiers used with 'v'!");
11422 "Bad modifiers used with 'h'!");
11427 "Bad modifiers used with 'f'!");
11432 "Bad modifiers used with 'd'!");
11435 else if (HowLong == 2)
11441 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
11450 else if (HowLong == 2)
11452 else if (HowLong == 1)
11458 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
11467 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'b'!");
11471 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'z'!");
11475 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'w'!");
11492 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
11504 assert(!
Type.isNull() &&
"builtin va list type not initialized!");
11512 unsigned NumElements = strtoul(Str, &End, 10);
11513 assert(End != Str &&
"Missing vector size");
11517 RequiresICE,
false);
11518 assert(!RequiresICE &&
"Can't require vector ICE");
11526 Type = Context.SveCountTy;
11530 llvm_unreachable(
"Unexpected target builtin type");
11536 unsigned NumElements = strtoul(Str, &End, 10);
11537 assert(End != Str &&
"Missing vector size");
11541 RequiresICE,
false);
11542 assert(!RequiresICE &&
"Can't require vector ICE");
11551 unsigned NumElements = strtoul(Str, &End, 10);
11552 assert(End != Str &&
"Missing vector size");
11564 assert(!RequiresICE &&
"Can't require complex ICE");
11573 if (
Type.isNull()) {
11584 if (
Type.isNull()) {
11590 assert(HowLong == 0 && !
Signed && !
Unsigned &&
"Bad modifiers for 'K'!");
11593 if (
Type.isNull()) {
11604 Done = !AllowTypeModifiers;
11606 switch (
char c = *Str++) {
11607 default: Done =
true; --Str;
break;
11613 unsigned AddrSpace = strtoul(Str, &End, 10);
11641 "Integer constant 'I' type must be an integer");
11654 bool AllowTypeModifiers)
const {
11661 unsigned *IntegerConstantArgs)
const {
11663 if (TypeStr[0] ==
'\0') {
11670 bool RequiresICE =
false;
11673 RequiresICE,
true);
11677 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
11679 while (TypeStr[0] && TypeStr[0] !=
'.') {
11686 if (RequiresICE && IntegerConstantArgs)
11687 *IntegerConstantArgs |= 1 << ArgTypes.size();
11693 ArgTypes.push_back(Ty);
11696 if (
Id == Builtin::BI__GetExceptionInfo)
11699 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
11700 "'.' should only occur at end of builtin type list!");
11702 bool Variadic = (TypeStr[0] ==
'.');
11705 Variadic,
false,
true));
11710 if (ArgTypes.empty() && Variadic && !
getLangOpts().requiresStrictPrototypes())
11762 !FD->
hasAttr<DLLExportAttr>()) ||
11763 FD->
hasAttr<GNUInlineAttr>()) {
11782 isa<CXXConstructorDecl>(FD) &&
11783 cast<CXXConstructorDecl>(FD)->isInheritingConstructor())
11796 if (D->
hasAttr<DLLImportAttr>()) {
11799 }
else if (D->
hasAttr<DLLExportAttr>()) {
11805 if (D->
hasAttr<CUDAGlobalAttr>() &&
11868 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
11873 if (!LexicalContext)
11878 auto StaticLocalLinkage =
11890 return StaticLocalLinkage;
11917 return StrongLinkage;
11935 llvm_unreachable(
"Invalid Linkage!");
11945 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
11946 if (!VD->isFileVarDecl())
11951 if (VD->getDescribedVarTemplate() ||
11952 isa<VarTemplatePartialSpecializationDecl>(VD))
11954 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
11958 }
else if (isa<PragmaCommentDecl>(D))
11960 else if (isa<PragmaDetectMismatchDecl>(D))
11962 else if (isa<OMPRequiresDecl>(D))
11964 else if (isa<OMPThreadPrivateDecl>(D))
11966 else if (isa<OMPAllocateDecl>(D))
11968 else if (isa<OMPDeclareReductionDecl>(D) || isa<OMPDeclareMapperDecl>(D))
11970 else if (isa<ImportDecl>(D))
11980 if (D->
hasAttr<WeakRefAttr>())
11987 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
11989 if (!FD->doesThisDeclarationHaveABody())
11990 return FD->doesDeclarationForceExternallyVisibleDefinition();
11993 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
11998 if (
getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {
11999 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
12017 const auto *VD = cast<VarDecl>(D);
12018 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
12022 if (LangOpts.OpenMP &&
12023 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
12031 if (VD->isInAnotherModuleUnit())
12044 if (VD->needsDestruction(*
this))
12048 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
12050 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
12055 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
12056 for (
const auto *BD : DD->bindings())
12057 if (
const auto *BindingVD = BD->getHoldingVar())
12066 llvm::function_ref<
void(
FunctionDecl *)> Pred)
const {
12067 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
12068 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
12073 for (
auto *CurDecl :
12077 !SeenDecls.contains(CurFD)) {
12078 SeenDecls.insert(CurFD);
12086 bool IsBuiltin)
const {
12089 return ABI->getDefaultMethodCallConv(IsVariadic);
12094 switch (LangOpts.getDefaultCallingConv()) {
12123 return Target->getDefaultCallingConv();
12128 return ABI->isNearlyEmpty(RD);
12132 if (!VTContext.get()) {
12133 auto ABI =
Target->getCXXABI();
12134 if (ABI.isMicrosoft())
12137 auto ComponentLayout =
getLangOpts().RelativeCXXABIVTables
12143 return VTContext.get();
12149 switch (
T->getCXXABI().getKind()) {
12150 case TargetCXXABI::AppleARM64:
12151 case TargetCXXABI::Fuchsia:
12152 case TargetCXXABI::GenericAArch64:
12153 case TargetCXXABI::GenericItanium:
12154 case TargetCXXABI::GenericARM:
12155 case TargetCXXABI::GenericMIPS:
12156 case TargetCXXABI::iOS:
12157 case TargetCXXABI::WebAssembly:
12158 case TargetCXXABI::WatchOS:
12159 case TargetCXXABI::XL:
12161 case TargetCXXABI::Microsoft:
12164 llvm_unreachable(
"Unsupported ABI");
12168 assert(
T.getCXXABI().getKind() != TargetCXXABI::Microsoft &&
12169 "Device mangle context does not support Microsoft mangling.");
12170 switch (
T.getCXXABI().getKind()) {
12171 case TargetCXXABI::AppleARM64:
12172 case TargetCXXABI::Fuchsia:
12173 case TargetCXXABI::GenericAArch64:
12174 case TargetCXXABI::GenericItanium:
12175 case TargetCXXABI::GenericARM:
12176 case TargetCXXABI::GenericMIPS:
12177 case TargetCXXABI::iOS:
12178 case TargetCXXABI::WebAssembly:
12179 case TargetCXXABI::WatchOS:
12180 case TargetCXXABI::XL:
12184 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND))
12185 return RD->getDeviceLambdaManglingNumber();
12186 return std::nullopt;
12189 case TargetCXXABI::Microsoft:
12193 llvm_unreachable(
"Unsupported ABI");
12199 return ASTRecordLayouts.getMemorySize() +
12200 llvm::capacity_in_bytes(ObjCLayouts) +
12201 llvm::capacity_in_bytes(KeyFunctions) +
12202 llvm::capacity_in_bytes(ObjCImpls) +
12203 llvm::capacity_in_bytes(BlockVarCopyInits) +
12204 llvm::capacity_in_bytes(DeclAttrs) +
12205 llvm::capacity_in_bytes(TemplateOrInstantiation) +
12206 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
12207 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
12208 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
12209 llvm::capacity_in_bytes(OverriddenMethods) +
12210 llvm::capacity_in_bytes(Types) +
12211 llvm::capacity_in_bytes(VariableArrayTypes);
12219 unsigned Signed)
const {
12222 if (!QualTy && DestWidth == 128)
12251 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
12258 MangleNumbers[ND] = Number;
12265 bool ForAuxTarget)
const {
12266 auto I = MangleNumbers.find(ND);
12267 unsigned Res = I != MangleNumbers.end() ? I->second : 1;
12270 if (LangOpts.CUDA && !LangOpts.CUDAIsDevice) {
12271 Res = ForAuxTarget ? Res >> 16 : Res & 0xFFFF;
12273 assert(!ForAuxTarget &&
"Only CUDA/HIP host compilation supports mangling "
12274 "number for aux target");
12276 return Res > 1 ? Res : 1;
12283 StaticLocalNumbers[VD] = Number;
12290 auto I = StaticLocalNumbers.find(VD);
12291 return I != StaticLocalNumbers.end() ? I->second : 1;
12296 assert(LangOpts.CPlusPlus);
12297 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
12305 assert(LangOpts.CPlusPlus);
12306 std::unique_ptr<MangleNumberingContext> &MCtx =
12307 ExtraMangleNumberingContexts[D];
12313std::unique_ptr<MangleNumberingContext>
12315 return ABI->createMangleNumberingContext();
12320 return ABI->getCopyConstructorForExceptionObject(
12326 return ABI->addCopyConstructorForExceptionObject(
12333 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
12338 return ABI->getTypedefNameForUnnamedTagDecl(TD);
12343 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
12347 return ABI->getDeclaratorForUnnamedTagDecl(TD);
12351 ParamIndices[D] = index;
12355 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
12356 assert(I != ParamIndices.end() &&
12357 "ParmIndices lacks entry set by ParmVarDecl");
12362 unsigned Length)
const {
12388 assert(
MSGuidTagDecl &&
"building MS GUID without MS extensions?");
12390 llvm::FoldingSetNodeID ID;
12394 if (
MSGuidDecl *Existing = MSGuidDecls.FindNodeOrInsertPos(ID, InsertPos))
12398 MSGuidDecl *New = MSGuidDecl::Create(*
this, GUIDType, Parts);
12399 MSGuidDecls.InsertNode(New, InsertPos);
12405 const APValue &APVal)
const {
12406 llvm::FoldingSetNodeID ID;
12411 UnnamedGlobalConstantDecls.FindNodeOrInsertPos(ID, InsertPos))
12415 UnnamedGlobalConstantDecl::Create(*
this, Ty, APVal);
12416 UnnamedGlobalConstantDecls.InsertNode(New, InsertPos);
12422 assert(
T->
isRecordType() &&
"template param object of unexpected type");
12428 llvm::FoldingSetNodeID ID;
12433 TemplateParamObjectDecls.FindNodeOrInsertPos(ID, InsertPos))
12437 TemplateParamObjectDecls.InsertNode(New, InsertPos);
12443 if (!
T.isOSDarwin())
12446 if (!(
T.isiOS() &&
T.isOSVersionLT(7)) &&
12447 !(
T.isMacOSX() &&
T.isOSVersionLT(10, 9)))
12456 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
12463 if (MethodDecl->
hasAttr<UnavailableAttr>()
12464 || MethodDecl->
hasAttr<DeprecatedAttr>())
12478 IM != EM && IF != EF; ++IM, ++IF) {
12509 llvm::FoldingSetNodeID IDX, IDY;
12510 X->Profile(IDX, *
this,
true);
12511 Y->
Profile(IDY, *
this,
true);
12525 for (
const Decl *DX :
X->redecls()) {
12530 if (DX->isFirstDecl())
12533 llvm_unreachable(
"Corrupt redecls chain");
12536template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
12538 return cast_or_null<T>(
12540 const_cast<Decl *
>(cast_or_null<Decl>(Y))));
12543template <
class T, std::enable_if_t<std::is_base_of_v<Decl, T>,
bool> = true>
12546 const_cast<Decl *
>(cast<Decl>(Y))));
12572 assert(Xs.size() == Ys.size());
12574 for (
size_t I = 0; I < Rs.size(); ++I)
12581 return X->getAttributeLoc() == Y->getAttributeLoc() ?
X->getAttributeLoc()
12591 switch (
X.getKind()) {
12621 auto NExpX =
X.getNumTemplateExpansions();
12635 if (Xs.size() != Ys.size())
12637 R.resize(Xs.size());
12638 for (
size_t I = 0; I < R.size(); ++I) {
12651 assert(!Different);
12658 return X->getKeyword() == Y->getKeyword() ?
X->getKeyword()
12666 return X->getQualifier() == Y->getQualifier()
12667 ?
X->getQualifier()
12680 QualType EX =
X->getElementType(), EY = Y->getElementType();
12685 QY += EY.getQualifiers() - RQ;
12695 assert(Ctx.
hasSameExpr(
X->getSizeExpr(), Y->getSizeExpr()));
12696 return X->getSizeExpr();
12701 return X->getSizeModifier();
12707 return X->getIndexTypeCVRQualifiers();
12716 llvm::DenseMap<QualType, unsigned> Found;
12717 for (
auto Ts : {
X, Y}) {
12724 Out.emplace_back(
T);
12734 bool AcceptDependent) {
12760 assert(AcceptDependent &&
12761 "computing composite pointer type of dependent types");
12776 llvm_unreachable(
"These ESTs should be handled above");
12781 assert(EST2 ==
EST_Dynamic &&
"other cases should already be handled");
12785 Result.Exceptions = ExceptionTypeStorage;
12792 llvm_unreachable(
"shouldn't see unresolved exception specifications here");
12795 llvm_unreachable(
"invalid ExceptionSpecificationType");
12804#define UNEXPECTED_TYPE(Class, Kind) \
12805 case Type::Class: \
12806 llvm_unreachable("Unexpected " Kind ": " #Class);
12808#define NON_CANONICAL_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "non-canonical")
12809#define TYPE(Class, Base)
12810#include "clang/AST/TypeNodes.inc"
12812#define SUGAR_FREE_TYPE(Class) UNEXPECTED_TYPE(Class, "sugar-free")
12822#undef SUGAR_FREE_TYPE
12823#define NON_UNIQUE_TYPE(Class) UNEXPECTED_TYPE(Class, "non-unique")
12826#undef NON_UNIQUE_TYPE
12830#undef UNEXPECTED_TYPE
12833 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
12834 assert(AX->getDeducedType().isNull());
12835 assert(AY->getDeducedType().isNull());
12836 assert(AX->getKeyword() == AY->getKeyword());
12837 assert(AX->isInstantiationDependentType() ==
12838 AY->isInstantiationDependentType());
12840 AY->getTypeConstraintArguments());
12843 AX->containsUnexpandedParameterPack(),
12845 AY->getTypeConstraintConcept()),
12848 case Type::IncompleteArray: {
12849 const auto *AX = cast<IncompleteArrayType>(
X),
12850 *AY = cast<IncompleteArrayType>(Y);
12855 case Type::DependentSizedArray: {
12856 const auto *AX = cast<DependentSizedArrayType>(
X),
12857 *AY = cast<DependentSizedArrayType>(Y);
12862 AX->getBracketsRange() == AY->getBracketsRange()
12863 ? AX->getBracketsRange()
12866 case Type::ConstantArray: {
12867 const auto *AX = cast<ConstantArrayType>(
X),
12868 *AY = cast<ConstantArrayType>(Y);
12869 assert(AX->getSize() == AY->getSize());
12870 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
12871 ? AX->getSizeExpr()
12877 case Type::ArrayParameter: {
12878 const auto *AX = cast<ArrayParameterType>(
X),
12879 *AY = cast<ArrayParameterType>(Y);
12880 assert(AX->getSize() == AY->getSize());
12881 const Expr *SizeExpr = Ctx.
hasSameExpr(AX->getSizeExpr(), AY->getSizeExpr())
12882 ? AX->getSizeExpr()
12889 case Type::Atomic: {
12890 const auto *AX = cast<AtomicType>(
X), *AY = cast<AtomicType>(Y);
12894 case Type::Complex: {
12895 const auto *CX = cast<ComplexType>(
X), *CY = cast<ComplexType>(Y);
12898 case Type::Pointer: {
12899 const auto *PX = cast<PointerType>(
X), *PY = cast<PointerType>(Y);
12902 case Type::BlockPointer: {
12903 const auto *PX = cast<BlockPointerType>(
X), *PY = cast<BlockPointerType>(Y);
12906 case Type::ObjCObjectPointer: {
12907 const auto *PX = cast<ObjCObjectPointerType>(
X),
12908 *PY = cast<ObjCObjectPointerType>(Y);
12911 case Type::MemberPointer: {
12912 const auto *PX = cast<MemberPointerType>(
X),
12913 *PY = cast<MemberPointerType>(Y);
12920 case Type::LValueReference: {
12921 const auto *PX = cast<LValueReferenceType>(
X),
12922 *PY = cast<LValueReferenceType>(Y);
12925 PX->isSpelledAsLValue() ||
12926 PY->isSpelledAsLValue());
12928 case Type::RValueReference: {
12929 const auto *PX = cast<RValueReferenceType>(
X),
12930 *PY = cast<RValueReferenceType>(Y);
12934 case Type::DependentAddressSpace: {
12935 const auto *PX = cast<DependentAddressSpaceType>(
X),
12936 *PY = cast<DependentAddressSpaceType>(Y);
12937 assert(Ctx.
hasSameExpr(PX->getAddrSpaceExpr(), PY->getAddrSpaceExpr()));
12939 PX->getAddrSpaceExpr(),
12942 case Type::FunctionNoProto: {
12943 const auto *FX = cast<FunctionNoProtoType>(
X),
12944 *FY = cast<FunctionNoProtoType>(Y);
12945 assert(FX->getExtInfo() == FY->getExtInfo());
12950 case Type::FunctionProto: {
12951 const auto *FX = cast<FunctionProtoType>(
X),
12952 *FY = cast<FunctionProtoType>(Y);
12954 EPIY = FY->getExtProtoInfo();
12955 assert(EPIX.
ExtInfo == EPIY.ExtInfo);
12958 assert(EPIX.
TypeQuals == EPIY.TypeQuals);
12959 assert(EPIX.
Variadic == EPIY.Variadic);
12976 case Type::ObjCObject: {
12977 const auto *OX = cast<ObjCObjectType>(
X), *OY = cast<ObjCObjectType>(Y);
12979 std::equal(OX->getProtocols().begin(), OX->getProtocols().end(),
12980 OY->getProtocols().begin(), OY->getProtocols().end(),
12982 return P0->getCanonicalDecl() == P1->getCanonicalDecl();
12984 "protocol lists must be the same");
12986 OY->getTypeArgsAsWritten());
12989 OX->getProtocols(),
12990 OX->isKindOfTypeAsWritten() && OY->isKindOfTypeAsWritten());
12992 case Type::ConstantMatrix: {
12993 const auto *MX = cast<ConstantMatrixType>(
X),
12994 *MY = cast<ConstantMatrixType>(Y);
12995 assert(MX->getNumRows() == MY->getNumRows());
12996 assert(MX->getNumColumns() == MY->getNumColumns());
12998 MX->getNumRows(), MX->getNumColumns());
13000 case Type::DependentSizedMatrix: {
13001 const auto *MX = cast<DependentSizedMatrixType>(
X),
13002 *MY = cast<DependentSizedMatrixType>(Y);
13003 assert(Ctx.
hasSameExpr(MX->getRowExpr(), MY->getRowExpr()));
13004 assert(Ctx.
hasSameExpr(MX->getColumnExpr(), MY->getColumnExpr()));
13009 case Type::Vector: {
13010 const auto *VX = cast<VectorType>(
X), *VY = cast<VectorType>(Y);
13011 assert(VX->getNumElements() == VY->getNumElements());
13012 assert(VX->getVectorKind() == VY->getVectorKind());
13014 VX->getNumElements(), VX->getVectorKind());
13016 case Type::ExtVector: {
13017 const auto *VX = cast<ExtVectorType>(
X), *VY = cast<ExtVectorType>(Y);
13018 assert(VX->getNumElements() == VY->getNumElements());
13020 VX->getNumElements());
13022 case Type::DependentSizedExtVector: {
13023 const auto *VX = cast<DependentSizedExtVectorType>(
X),
13024 *VY = cast<DependentSizedExtVectorType>(Y);
13029 case Type::DependentVector: {
13030 const auto *VX = cast<DependentVectorType>(
X),
13031 *VY = cast<DependentVectorType>(Y);
13032 assert(VX->getVectorKind() == VY->getVectorKind());
13037 case Type::InjectedClassName: {
13038 const auto *IX = cast<InjectedClassNameType>(
X),
13039 *IY = cast<InjectedClassNameType>(Y);
13043 IY->getInjectedSpecializationType()));
13045 case Type::TemplateSpecialization: {
13046 const auto *TX = cast<TemplateSpecializationType>(
X),
13047 *TY = cast<TemplateSpecializationType>(Y);
13049 TY->template_arguments());
13052 TY->getTemplateName()),
13053 As,
X->getCanonicalTypeInternal());
13055 case Type::Decltype: {
13056 const auto *DX = cast<DecltypeType>(
X);
13057 [[maybe_unused]]
const auto *DY = cast<DecltypeType>(Y);
13058 assert(DX->isDependentType());
13059 assert(DY->isDependentType());
13060 assert(Ctx.
hasSameExpr(DX->getUnderlyingExpr(), DY->getUnderlyingExpr()));
13064 case Type::PackIndexing: {
13065 const auto *DX = cast<PackIndexingType>(
X);
13066 [[maybe_unused]]
const auto *DY = cast<PackIndexingType>(Y);
13067 assert(DX->isDependentType());
13068 assert(DY->isDependentType());
13069 assert(Ctx.
hasSameExpr(DX->getIndexExpr(), DY->getIndexExpr()));
13072 case Type::DependentName: {
13073 const auto *NX = cast<DependentNameType>(
X),
13074 *NY = cast<DependentNameType>(Y);
13075 assert(NX->getIdentifier() == NY->getIdentifier());
13078 NX->getIdentifier(), NX->getCanonicalTypeInternal());
13080 case Type::DependentTemplateSpecialization: {
13081 const auto *TX = cast<DependentTemplateSpecializationType>(
X),
13082 *TY = cast<DependentTemplateSpecializationType>(Y);
13083 assert(TX->getIdentifier() == TY->getIdentifier());
13085 TY->template_arguments());
13088 TX->getIdentifier(), As);
13090 case Type::UnaryTransform: {
13091 const auto *TX = cast<UnaryTransformType>(
X),
13092 *TY = cast<UnaryTransformType>(Y);
13093 assert(TX->getUTTKind() == TY->getUTTKind());
13097 TY->getUnderlyingType()),
13100 case Type::PackExpansion: {
13101 const auto *PX = cast<PackExpansionType>(
X),
13102 *PY = cast<PackExpansionType>(Y);
13103 assert(PX->getNumExpansions() == PY->getNumExpansions());
13106 PX->getNumExpansions(),
false);
13109 const auto *PX = cast<PipeType>(
X), *PY = cast<PipeType>(Y);
13110 assert(PX->isReadOnly() == PY->isReadOnly());
13115 case Type::TemplateTypeParm: {
13116 const auto *TX = cast<TemplateTypeParmType>(
X),
13117 *TY = cast<TemplateTypeParmType>(Y);
13118 assert(TX->getDepth() == TY->getDepth());
13119 assert(TX->getIndex() == TY->getIndex());
13120 assert(TX->isParameterPack() == TY->isParameterPack());
13122 TX->getDepth(), TX->getIndex(), TX->isParameterPack(),
13126 llvm_unreachable(
"Unknown Type Class");
13136#define UNEXPECTED_TYPE(Class, Kind) \
13137 case Type::Class: \
13138 llvm_unreachable("Unexpected " Kind ": " #Class);
13139#define TYPE(Class, Base)
13140#define DEPENDENT_TYPE(Class, Base) UNEXPECTED_TYPE(Class, "dependent")
13141#include "clang/AST/TypeNodes.inc"
13143#define CANONICAL_TYPE(Class) UNEXPECTED_TYPE(Class, "canonical")
13168#undef CANONICAL_TYPE
13170#undef UNEXPECTED_TYPE
13172 case Type::Adjusted: {
13173 const auto *AX = cast<AdjustedType>(
X), *AY = cast<AdjustedType>(Y);
13174 QualType OX = AX->getOriginalType(), OY = AY->getOriginalType();
13181 case Type::Decayed: {
13182 const auto *DX = cast<DecayedType>(
X), *DY = cast<DecayedType>(Y);
13183 QualType OX = DX->getOriginalType(), OY = DY->getOriginalType();
13190 case Type::Attributed: {
13191 const auto *AX = cast<AttributedType>(
X), *AY = cast<AttributedType>(Y);
13193 if (Kind != AY->getAttrKind())
13195 QualType MX = AX->getModifiedType(), MY = AY->getModifiedType();
13202 case Type::BTFTagAttributed: {
13203 const auto *BX = cast<BTFTagAttributedType>(
X);
13204 const BTFTypeTagAttr *AX = BX->getAttr();
13206 if (AX->getBTFTypeTag() !=
13207 cast<BTFTagAttributedType>(Y)->getAttr()->getBTFTypeTag())
13212 const auto *AX = cast<AutoType>(
X), *AY = cast<AutoType>(Y);
13215 if (KW != AY->getKeyword())
13219 AY->getTypeConstraintConcept());
13223 AY->getTypeConstraintArguments())) {
13231 false,
false, CD, As);
13233 case Type::PackIndexing:
13234 case Type::Decltype:
13236 case Type::DeducedTemplateSpecialization:
13240 case Type::Elaborated: {
13241 const auto *EX = cast<ElaboratedType>(
X), *EY = cast<ElaboratedType>(Y);
13247 case Type::MacroQualified: {
13248 const auto *MX = cast<MacroQualifiedType>(
X),
13249 *MY = cast<MacroQualifiedType>(Y);
13251 if (IX != MY->getMacroIdentifier())
13255 case Type::SubstTemplateTypeParm: {
13256 const auto *SX = cast<SubstTemplateTypeParmType>(
X),
13257 *SY = cast<SubstTemplateTypeParmType>(Y);
13262 unsigned Index = SX->getIndex();
13263 if (Index != SY->getIndex())
13265 auto PackIndex = SX->getPackIndex();
13266 if (PackIndex != SY->getPackIndex())
13269 CD, Index, PackIndex);
13271 case Type::ObjCTypeParam:
13277 case Type::TemplateSpecialization: {
13278 const auto *TX = cast<TemplateSpecializationType>(
X),
13279 *TY = cast<TemplateSpecializationType>(Y);
13281 TY->getTemplateName());
13286 TY->template_arguments()))
13291 case Type::Typedef: {
13292 const auto *TX = cast<TypedefType>(
X), *TY = cast<TypedefType>(Y);
13298 case Type::TypeOf: {
13304 if (cast<TypeOfType>(
X)->
getKind() == cast<TypeOfType>(Y)->
getKind() &&
13309 case Type::TypeOfExpr:
13312 case Type::UnaryTransform: {
13313 const auto *UX = cast<UnaryTransformType>(
X),
13314 *UY = cast<UnaryTransformType>(Y);
13316 if (KX != UY->getUTTKind())
13318 QualType BX = UX->getBaseType(), BY = UY->getBaseType();
13325 case Type::Using: {
13326 const auto *UX = cast<UsingType>(
X), *UY = cast<UsingType>(Y);
13333 case Type::CountAttributed: {
13334 const auto *DX = cast<CountAttributedType>(
X),
13335 *DY = cast<CountAttributedType>(Y);
13336 if (DX->isCountInBytes() != DY->isCountInBytes())
13338 if (DX->isOrNull() != DY->isOrNull())
13340 Expr *CEX = DX->getCountExpr();
13341 Expr *CEY = DY->getCountExpr();
13345 DX->isCountInBytes(), DX->isOrNull(),
13356 DX->isCountInBytes(), DX->isOrNull(),
13360 llvm_unreachable(
"Unhandled Type Class");
13382 if (
X.isCanonical())
13395 if (SX.
Ty != SY.Ty) {
13403 while (!Xs.empty() && !Ys.empty() && Xs.back().Ty == Ys.back().Ty) {
13406 SX = Xs.pop_back_val();
13407 SY = Ys.pop_back_val();
13417 while (!Xs.empty() && !Ys.empty()) {
13420 SX = Xs.pop_back_val();
13421 SY = Ys.pop_back_val();
13426 SX.
Ty = Underlying.Ty;
13429 QX -= Underlying.Quals;
13447 llvm_unreachable(
"Not a saturated fixed point type!");
13448 case BuiltinType::SatShortAccum:
13450 case BuiltinType::SatAccum:
13452 case BuiltinType::SatLongAccum:
13454 case BuiltinType::SatUShortAccum:
13456 case BuiltinType::SatUAccum:
13458 case BuiltinType::SatULongAccum:
13460 case BuiltinType::SatShortFract:
13462 case BuiltinType::SatFract:
13464 case BuiltinType::SatLongFract:
13466 case BuiltinType::SatUShortFract:
13468 case BuiltinType::SatUFract:
13470 case BuiltinType::SatULongFract:
13482 llvm_unreachable(
"Not a fixed point type!");
13483 case BuiltinType::ShortAccum:
13485 case BuiltinType::Accum:
13487 case BuiltinType::LongAccum:
13489 case BuiltinType::UShortAccum:
13491 case BuiltinType::UAccum:
13493 case BuiltinType::ULongAccum:
13495 case BuiltinType::ShortFract:
13497 case BuiltinType::Fract:
13499 case BuiltinType::LongFract:
13501 case BuiltinType::UShortFract:
13503 case BuiltinType::UFract:
13505 case BuiltinType::ULongFract:
13511 if (LangOpts.OpenCL)
13535 llvm_unreachable(
"Not a fixed point type!");
13536 case BuiltinType::ShortAccum:
13537 case BuiltinType::SatShortAccum:
13538 return Target.getShortAccumScale();
13539 case BuiltinType::Accum:
13540 case BuiltinType::SatAccum:
13541 return Target.getAccumScale();
13542 case BuiltinType::LongAccum:
13543 case BuiltinType::SatLongAccum:
13544 return Target.getLongAccumScale();
13545 case BuiltinType::UShortAccum:
13546 case BuiltinType::SatUShortAccum:
13547 return Target.getUnsignedShortAccumScale();
13548 case BuiltinType::UAccum:
13549 case BuiltinType::SatUAccum:
13550 return Target.getUnsignedAccumScale();
13551 case BuiltinType::ULongAccum:
13552 case BuiltinType::SatULongAccum:
13553 return Target.getUnsignedLongAccumScale();
13554 case BuiltinType::ShortFract:
13555 case BuiltinType::SatShortFract:
13556 return Target.getShortFractScale();
13557 case BuiltinType::Fract:
13558 case BuiltinType::SatFract:
13559 return Target.getFractScale();
13560 case BuiltinType::LongFract:
13561 case BuiltinType::SatLongFract:
13562 return Target.getLongFractScale();
13563 case BuiltinType::UShortFract:
13564 case BuiltinType::SatUShortFract:
13565 return Target.getUnsignedShortFractScale();
13566 case BuiltinType::UFract:
13567 case BuiltinType::SatUFract:
13568 return Target.getUnsignedFractScale();
13569 case BuiltinType::ULongFract:
13570 case BuiltinType::SatULongFract:
13571 return Target.getUnsignedLongFractScale();
13581 llvm_unreachable(
"Not a fixed point type!");
13582 case BuiltinType::ShortAccum:
13583 case BuiltinType::SatShortAccum:
13584 return Target.getShortAccumIBits();
13585 case BuiltinType::Accum:
13586 case BuiltinType::SatAccum:
13587 return Target.getAccumIBits();
13588 case BuiltinType::LongAccum:
13589 case BuiltinType::SatLongAccum:
13590 return Target.getLongAccumIBits();
13591 case BuiltinType::UShortAccum:
13592 case BuiltinType::SatUShortAccum:
13593 return Target.getUnsignedShortAccumIBits();
13594 case BuiltinType::UAccum:
13595 case BuiltinType::SatUAccum:
13596 return Target.getUnsignedAccumIBits();
13597 case BuiltinType::ULongAccum:
13598 case BuiltinType::SatULongAccum:
13599 return Target.getUnsignedLongAccumIBits();
13600 case BuiltinType::ShortFract:
13601 case BuiltinType::SatShortFract:
13602 case BuiltinType::Fract:
13603 case BuiltinType::SatFract:
13604 case BuiltinType::LongFract:
13605 case BuiltinType::SatLongFract:
13606 case BuiltinType::UShortFract:
13607 case BuiltinType::SatUShortFract:
13608 case BuiltinType::UFract:
13609 case BuiltinType::SatUFract:
13610 case BuiltinType::ULongFract:
13611 case BuiltinType::SatULongFract:
13616llvm::FixedPointSemantics
13619 "Can only get the fixed point semantics for a "
13620 "fixed point or integer type.");
13622 return llvm::FixedPointSemantics::GetIntegerSemantics(
13626 return llvm::FixedPointSemantics(
13629 !isSigned &&
getTargetInfo().doUnsignedFixedPointTypesHavePadding());
13644 "Expected unsigned fixed point type");
13647 case BuiltinType::UShortAccum:
13649 case BuiltinType::UAccum:
13651 case BuiltinType::ULongAccum:
13653 case BuiltinType::SatUShortAccum:
13655 case BuiltinType::SatUAccum:
13657 case BuiltinType::SatULongAccum:
13659 case BuiltinType::UShortFract:
13661 case BuiltinType::UFract:
13663 case BuiltinType::ULongFract:
13665 case BuiltinType::SatUShortFract:
13667 case BuiltinType::SatUFract:
13669 case BuiltinType::SatULongFract:
13672 llvm_unreachable(
"Unexpected unsigned fixed point type");
13677 const TargetVersionAttr *TV)
const {
13678 assert(TV !=
nullptr);
13680 std::vector<std::string> ResFeats;
13681 TV->getFeatures(Feats);
13682 for (
auto &Feature : Feats)
13683 if (
Target->validateCpuSupports(Feature.str()))
13685 ResFeats.push_back(
"?" + Feature.str());
13691 assert(TD !=
nullptr);
13694 llvm::erase_if(
ParsedAttr.Features, [&](
const std::string &Feat) {
13695 return !Target->isValidFeatureName(StringRef{Feat}.substr(1));
13706 Target->getTargetOpts().CPU,
13707 Target->getTargetOpts().Features);
13714 StringRef TargetCPU =
Target->getTargetOpts().CPU;
13716 if (
const auto *TD = FD->
getAttr<TargetAttr>()) {
13723 Target->getTargetOpts().FeaturesAsWritten.begin(),
13724 Target->getTargetOpts().FeaturesAsWritten.end());
13735 }
else if (
const auto *SD = FD->
getAttr<CPUSpecificAttr>()) {
13737 Target->getCPUSpecificCPUDispatchFeatures(
13739 std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
13740 Features.insert(Features.begin(),
13741 Target->getTargetOpts().FeaturesAsWritten.begin(),
13742 Target->getTargetOpts().FeaturesAsWritten.end());
13744 }
else if (
const auto *TC = FD->
getAttr<TargetClonesAttr>()) {
13745 std::vector<std::string> Features;
13746 if (
Target->getTriple().isAArch64()) {
13750 for (StringRef Feat : Feats)
13751 if (
Target->validateCpuSupports(Feat.str()))
13753 Features.push_back(
"?" + Feat.str());
13754 Features.insert(Features.begin(),
13755 Target->getTargetOpts().FeaturesAsWritten.begin(),
13756 Target->getTargetOpts().FeaturesAsWritten.end());
13759 if (VersionStr.starts_with(
"arch="))
13760 TargetCPU = VersionStr.drop_front(
sizeof(
"arch=") - 1);
13761 else if (VersionStr !=
"default")
13762 Features.push_back((StringRef{
"+"} + VersionStr).str());
13765 }
else if (
const auto *TV = FD->
getAttr<TargetVersionAttr>()) {
13767 Feats.insert(Feats.begin(),
13768 Target->getTargetOpts().FeaturesAsWritten.begin(),
13769 Target->getTargetOpts().FeaturesAsWritten.end());
13772 FeatureMap =
Target->getTargetOpts().FeatureMap;
13778 return *OMPTraitInfoVector.back();
13785 return DB << Section.
Decl;
13786 return DB <<
"a prior #pragma section";
13790 bool IsInternalVar =
13793 bool IsExplicitDeviceVar = (D->
hasAttr<CUDADeviceAttr>() &&
13794 !D->
getAttr<CUDADeviceAttr>()->isImplicit()) ||
13795 (D->
hasAttr<CUDAConstantAttr>() &&
13796 !D->
getAttr<CUDAConstantAttr>()->isImplicit());
13800 return (IsInternalVar &&
13801 (D->
hasAttr<HIPManagedAttr>() || IsExplicitDeviceVar)) ||
13802 (D->
hasAttr<CUDAGlobalAttr>() &&
13809 (D->
hasAttr<HIPManagedAttr>() || D->
hasAttr<CUDAGlobalAttr>() ||
13814 if (!CUIDHash.empty())
13816 if (LangOpts.
CUID.empty())
13817 return StringRef();
13818 CUIDHash = llvm::utohexstr(llvm::MD5Hash(LangOpts.
CUID),
true);
This file provides AST data structures related to concepts.
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl * > &Protocols)
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
static SourceLocation getCommonAttrLoc(const T *X, const T *Y)
static auto getCommonTypes(ASTContext &Ctx, ArrayRef< QualType > Xs, ArrayRef< QualType > Ys, bool Unqualified=false)
static auto getCanonicalTemplateArguments(const ASTContext &C, ArrayRef< TemplateArgument > Args, bool &AnyNonCanonArgs)
static char getObjCEncodingForPrimitiveType(const ASTContext *C, const BuiltinType *BT)
static bool NeedsInjectedClassNameType(const RecordDecl *D)
#define SVE_ELTTY(ELTTY, ELTS, NUMVECTORS)
static bool unionHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static NamespaceDecl * getNamespace(const NestedNameSpecifier *X)
static TypedefDecl * CreateHexagonBuiltinVaListDecl(const ASTContext *Context)
#define CANONICAL_TYPE(Class)
static NestedNameSpecifier * getCommonNNS(ASTContext &Ctx, const T *X, const T *Y)
static Decl * getCommonDecl(Decl *X, Decl *Y)
static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context, const Decl *D, GVALinkage L)
static bool isTypeTypedefedAsBOOL(QualType T)
static void EncodeBitField(const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
static uint64_t getSVETypeSize(ASTContext &Context, const BuiltinType *Ty)
getSVETypeSize - Return SVE vector or predicate register size.
#define SUGAR_FREE_TYPE(Class)
static bool getCommonTemplateArguments(ASTContext &Ctx, SmallVectorImpl< TemplateArgument > &R, ArrayRef< TemplateArgument > Xs, ArrayRef< TemplateArgument > Ys)
static bool hasTemplateSpecializationInEncodedString(const Type *T, bool VisitBasesAndFields)
static void getIntersectionOfProtocols(ASTContext &Context, const ObjCInterfaceDecl *CommonBase, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, SmallVectorImpl< ObjCProtocolDecl * > &IntersectionSet)
getIntersectionOfProtocols - This routine finds the intersection of set of protocols inherited from t...
static bool areCompatMatrixTypes(const ConstantMatrixType *LHS, const ConstantMatrixType *RHS)
areCompatMatrixTypes - Return true if the two specified matrix types are compatible.
static TypedefDecl * CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context)
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
static bool canAssignObjCObjectTypes(ASTContext &ctx, QualType lhs, QualType rhs)
Determine whether the first type is a subtype of the second.
static const Type * getIntegerTypeForEnum(const EnumType *ET)
static TemplateName getCommonTemplateNameChecked(ASTContext &Ctx, TemplateName X, TemplateName Y)
static const Decl & adjustDeclToTemplate(const Decl &D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template.
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
static QualType getCommonElementType(ASTContext &Ctx, const T *X, const T *Y)
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
static auto getCommonSizeModifier(const ArrayType *X, const ArrayType *Y)
static std::optional< int64_t > structHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD, bool CheckIfTriviallyCopyable)
static TemplateName getCommonTemplateName(ASTContext &Ctx, TemplateName X, TemplateName Y)
static bool hasSameOverloadableAttrs(const FunctionDecl *A, const FunctionDecl *B)
Determine whether the attributes we can overload on are identical for A and B.
static T * getCommonDeclChecked(T *X, T *Y)
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
static int64_t getSubobjectOffset(const FieldDecl *Field, const ASTContext &Context, const clang::ASTRecordLayout &)
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
static TypedefDecl * CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context)
static QualType mergeEnumWithInteger(ASTContext &Context, const EnumType *ET, QualType other, bool isBlockReturnType)
Given that we have an enum type and a non-enum type, try to merge them.
static GVALinkage adjustGVALinkageForExternalDefinitionKind(const ASTContext &Ctx, const Decl *D, GVALinkage L)
Adjust the GVALinkage for a declaration based on what an external AST source knows about whether ther...
static TypedefDecl * CreateSystemZBuiltinVaListDecl(const ASTContext *Context)
static std::optional< int64_t > getSubobjectSizeInBits(const FieldDecl *Field, const ASTContext &Context, bool CheckIfTriviallyCopyable)
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
#define NON_UNIQUE_TYPE(Class)
static TypedefDecl * CreateX86_64ABIBuiltinVaListDecl(const ASTContext *Context)
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
static auto getCommonIndexTypeCVRQualifiers(const ArrayType *X, const ArrayType *Y)
#define SVE_INT_ELTTY(BITS, ELTS, SIGNED, NUMVECTORS)
static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)
DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the pointer over the consume...
static TypedefDecl * CreateCharPtrBuiltinVaListDecl(const ASTContext *Context)
static void mergeTypeLists(ASTContext &Ctx, SmallVectorImpl< QualType > &Out, ArrayRef< QualType > X, ArrayRef< QualType > Y)
static bool areSortedAndUniqued(ArrayRef< ObjCProtocolDecl * > Protocols)
static TypeInfoChars getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
getConstantArrayInfoInChars - Performing the computation in CharUnits instead of in bits prevents ove...
static FloatingRank getFloatingRank(QualType T)
getFloatingRank - Return a relative rank for floating point types.
static TemplateArgument getCommonTemplateArgument(ASTContext &Ctx, const TemplateArgument &X, const TemplateArgument &Y)
static auto * getCommonSizeExpr(ASTContext &Ctx, T *X, T *Y)
static std::optional< int64_t > structSubobjectsHaveUniqueObjectRepresentations(const RangeT &Subobjects, int64_t CurOffsetInBits, const ASTContext &Context, const clang::ASTRecordLayout &Layout, bool CheckIfTriviallyCopyable)
static char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
static QualType getCommonArrayElementType(ASTContext &Ctx, const T *X, Qualifiers &QX, const T *Y, Qualifiers &QY)
static QualType getCommonPointeeType(ASTContext &Ctx, const T *X, const T *Y)
static uint64_t getRVVTypeSize(ASTContext &Context, const BuiltinType *Ty)
getRVVTypeSize - Return RVV vector register size.
static auto unwrapSugar(SplitQualType &T, Qualifiers &QTotal)
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
static QualType getCommonNonSugarTypeNode(ASTContext &Ctx, const Type *X, Qualifiers &QX, const Type *Y, Qualifiers &QY)
static QualType getCommonSugarTypeNode(ASTContext &Ctx, const Type *X, const Type *Y, SplitQualType Underlying)
static bool isSameQualifier(const NestedNameSpecifier *X, const NestedNameSpecifier *Y)
static std::string charUnitsToString(const CharUnits &CU)
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl * > &Redeclared)
static SmallVector< SourceLocation, 2 > getDeclLocsForCommentSearch(const Decl *D, SourceManager &SourceMgr)
static bool isCanonicalResultType(QualType T)
Determine whether T is canonical as the result type of a function.
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
static bool areCompatVectorTypes(const VectorType *LHS, const VectorType *RHS)
areCompatVectorTypes - Return true if the two specified vector types are compatible.
static TypedefDecl * CreateCharPtrNamedVaListDecl(const ASTContext *Context, StringRef Name)
#define UNEXPECTED_TYPE(Class, Kind)
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
static ElaboratedTypeKeyword getCommonTypeKeyword(const T *X, const T *Y)
Defines the clang::ASTContext interface.
Provides definitions for the various language-specific address spaces.
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
static constexpr Builtin::Info BuiltinInfo[]
Defines enum values for all the target-independent builtin functions.
static bool CanThrow(Expr *E, ASTContext &Ctx)
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
This file defines OpenMP nodes for declarative directives.
Defines the C++ template declaration subclasses.
Defines the ExceptionSpecificationType enumeration and various utility functions.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static const Decl * getCanonicalDecl(const Decl *D)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::LangOptions interface.
llvm::MachO::Target Target
llvm::MachO::Record Record
static bool hasFeature(StringRef Feature, const LangOptions &LangOpts, const TargetInfo &Target)
Determine whether a translation unit built using the current language options has the given feature.
Defines the clang::Module class, which describes a module in the source code.
Defines types useful for describing an Objective-C runtime.
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
static QualType getUnderlyingType(const SubRegion *R)
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
Defines various enumerations that describe declaration and type specifiers.
This file defines OpenACC AST classes for statement-level contructs.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting.
Defines the clang::TypeLoc interface and its subclasses.
static const TemplateArgument & getArgument(const TemplateArgument &A)
C Language Family Type Representation.
__device__ __2f16 float c
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
bool isMemberPointerToDerivedMember() const
const ValueDecl * getMemberPointerDecl() const
ArrayRef< const CXXRecordDecl * > getMemberPointerPath() const
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
MSGuidDecl * getMSGuidDecl(MSGuidDeclParts Parts) const
Return a declaration for the global GUID object representing the given GUID value.
QualType getUsingType(const UsingShadowDecl *Found, QualType Underlying) const
BuiltinVectorTypeInfo getBuiltinVectorTypeInfo(const BuiltinType *VecTy) const
Returns the element type, element count and number of vectors (in case of tuple) for a builtin vector...
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
CanQualType ObjCBuiltinSelTy
TranslationUnitDecl * getTranslationUnitDecl() const
const ConstantArrayType * getAsConstantArrayType(QualType T) const
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
bool areLaxCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible SVE vector types, false otherwise.
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
void InitBuiltinTypes(const TargetInfo &Target, const TargetInfo *AuxTarget=nullptr)
Initialize built-in types.
ParentMapContext & getParentMapContext()
Returns the dynamic AST node parent map context.
QualType getParenType(QualType NamedType) const
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization,...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type.
CanQualType ARCUnbridgedCastTy
QualType getDependentSizedMatrixType(QualType ElementType, Expr *RowExpr, Expr *ColumnExpr, SourceLocation AttrLoc) const
Return the unique reference to the matrix type of the specified element type and size.
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
unsigned getManglingNumber(const NamedDecl *ND, bool ForAuxTarget=false) const
void UnwrapSimilarArrayTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true)
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
unsigned getIntWidth(QualType T) const
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one.
QualType getBTFTagAttributedType(const BTFTypeTagAttr *BTFAttr, QualType Wrapped)
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType) const
InlineVariableDefinitionKind
@ None
Not an inline variable.
@ Weak
Weak definition of inline variable.
@ Strong
Strong definition.
@ WeakUnknown
Weak for now, might become strong later in this TU.
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
TypedefDecl * getCFConstantStringDecl() const
CanQualType SatUnsignedFractTy
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template.
bool areCompatibleRVVTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an RISC-V vector builtin type and a VectorType that is a fixed-len...
ExternCContextDecl * getExternCContextDecl() const
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const
Parses the target attributes passed in, and returns only the ones that are valid feature names.
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
CanQualType UnsignedShortAccumTy
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, ArrayRef< TemplateArgumentLoc > Args) const
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
bool hasSimilarType(QualType T1, QualType T2)
Determine if two types are similar, according to the C++ rules.
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl.
void adjustObjCTypeParamBoundType(const ObjCTypeParamDecl *Orig, ObjCTypeParamDecl *New) const
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type.
bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool AllowCXX=false, bool IsConditionalOperator=false)
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
DeclarationNameTable DeclarationNames
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
TemplateName getCanonicalTemplateName(const TemplateName &Name) const
Retrieves the "canonical" template name that refers to a given template.
QualType getUnresolvedUsingType(const UnresolvedUsingTypenameDecl *Decl) const
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
void setCurrentNamedModule(Module *M)
Set the (C++20) module we are building.
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>.
CharUnits getMemberPointerPathAdjustment(const APValue &MP) const
Find the 'this' offset for the member path in a pointer-to-member APValue.
bool mayExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel may be externalized.
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
QualType getRecordType(const RecordDecl *Decl) const
QualType getScalableVectorType(QualType EltTy, unsigned NumElts, unsigned NumFields=1) const
Return the unique reference to a scalable vector type of the specified element type and scalable numb...
bool hasSameExpr(const Expr *X, const Expr *Y) const
Determine whether the given expressions X and Y are equivalent.
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
QualType getRealTypeForBitwidth(unsigned DestWidth, FloatModeKind ExplicitType) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any.
unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built.
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
unsigned getTypeUnadjustedAlign(QualType T) const
Return the ABI-specified natural alignment of a (complete) type T, before alignment adjustments,...
unsigned char getFixedPointIBits(QualType Ty) const
QualType getCorrespondingSignedFixedPointType(QualType Ty) const
QualType getArrayParameterType(QualType Ty) const
Return the uniqued reference to a specified array parameter type from the original array type.
QualType getCountAttributedType(QualType T, Expr *CountExpr, bool CountInBytes, bool OrNull, ArrayRef< TypeCoupledDeclRefInfo > DependentDecls) const
QualType getPackExpansionType(QualType Pattern, std::optional< unsigned > NumExpansions, bool ExpectPackInType=true)
Form a pack expansion type with the given pattern.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D,...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
bool mergeExtParameterInfo(const FunctionProtoType *FirstFnType, const FunctionProtoType *SecondFnType, bool &CanUseFirst, bool &CanUseSecond, SmallVectorImpl< FunctionProtoType::ExtParameterInfo > &NewParamInfos)
This function merges the ExtParameterInfo lists of two functions.
bool ObjCQualifiedClassTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>.
bool shouldExternalize(const Decl *D) const
Whether a C++ static variable or CUDA/HIP kernel should be externalized.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
bool propertyTypesAreCompatible(QualType, QualType)
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateName Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc, VectorKind VecKind) const
Return the unique reference to the type for a dependently sized vector of the specified element type.
CanQualType SatLongAccumTy
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
std::vector< std::string > filterFunctionTargetVersionAttrs(const TargetVersionAttr *TV) const
OpenCLTypeKind getOpenCLTypeKind(const Type *T) const
Map an AST Type to an OpenCLTypeKind enum value.
QualType getFILEType() const
Retrieve the C FILE type.
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
unsigned getPreferredTypeAlign(QualType T) const
Return the "preferred" alignment of the specified type T for the current target, in bits.
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list,...
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
CanQualType OMPArrayShapingTy
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins, TranslationUnitKind TUKind)
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
unsigned getStaticLocalNumber(const VarDecl *VD) const
void addComment(const RawComment &RC)
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
bool isSameTypeConstraint(const TypeConstraint *XTC, const TypeConstraint *YTC) const
Determine whether two type contraint are similar enough that they could used in declarations of the s...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=RecordDecl::TagKind::Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
QualType getMSGuidType() const
Retrieve the implicitly-predeclared 'struct _GUID' type.
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
CanQualType UnsignedLongFractTy
QualType getEnumType(const EnumDecl *Decl) const
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
QualType getDependentBitIntType(bool Unsigned, Expr *BitsExpr) const
Return a dependent bit-precise integer type with the specified signedness and bit count.
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
StringRef getCUIDHash() const
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
QualType getReferenceQualifiedType(const Expr *e) const
getReferenceQualifiedType - Given an expr, will return the type for that expression,...
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U) const
Determine whether two function types are the same, ignoring exception specifications in cases where t...
QualType getBlockDescriptorExtendedType() const
Gets the struct used to keep track of the extended descriptor for pointer to blocks.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type.
IdentifierInfo * getMakeIntegerSeqName() const
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
void addLazyModuleInitializers(Module *M, ArrayRef< GlobalDeclID > IDs)
bool isSameConstraintExpr(const Expr *XCE, const Expr *YCE) const
Determine whether two 'requires' expressions are similar enough that they may be used in re-declarati...
IdentifierInfo * getTypePackElementName() const
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
CanQualType OMPIteratorTy
TemplateName getSubstTemplateTemplateParm(TemplateName replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Builtin::Context & BuiltinInfo
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type.
void addModuleInitializer(Module *M, Decl *Init)
Add a declaration to the list of declarations that are initialized for a module.
const LangOptions & getLangOpts() const
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl)
QualType getFunctionTypeWithoutPtrSizes(QualType T)
Get a function type and produce the equivalent function type where pointer size address spaces in the...
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
unsigned getMinGlobalAlignOfVar(uint64_t Size, const VarDecl *VD) const
Return the minimum alignement as specified by the target.
RawCommentList Comments
All comments in this translation unit.
bool isSameDefaultTemplateArgument(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two default template arguments are similar enough that they may be used in declarat...
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
QualType removePtrSizeAddrSpace(QualType T) const
Remove the existing address space on the type if it is a pointer size address space and return the ty...
bool areLaxCompatibleRVVTypes(QualType FirstType, QualType SecondType)
Return true if the given vector types are lax-compatible RISC-V vector types as defined by -flax-vect...
CanQualType SatShortFractTy
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
bool canBindObjCObjectType(QualType To, QualType From)
int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const
Compare the rank of two floating point types as above, but compare equal if both types have the same ...
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
void setParameterIndex(const ParmVarDecl *D, unsigned index)
Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...
QualType getFunctionTypeWithExceptionSpec(QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI) const
Get a function type and produce the equivalent function type with the specified exception specificati...
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool hasUniqueObjectRepresentations(QualType Ty, bool CheckIfTriviallyCopyable=true) const
Return true if the specified type has unique object representations according to (C++17 [meta....
bool typesAreBlockPointerCompatible(QualType, QualType)
CanQualType SatUnsignedAccumTy
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
void forEachMultiversionedFunctionVersion(const FunctionDecl *FD, llvm::function_ref< void(FunctionDecl *)> Pred) const
Visits all versions of a multiversioned function with the passed predicate.
void setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst, UsingEnumDecl *Pattern)
Remember that the using enum decl Inst is an instantiation of the using enum decl Pattern of a class ...
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
CanQualType ArraySectionTy
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) const
CanQualType ObjCBuiltinIdTy
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
VTableContextBase * getVTableContext()
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i....
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
bool isNearlyEmpty(const CXXRecordDecl *RD) const
void cacheRawCommentForDecl(const Decl &OriginalD, const RawComment &Comment) const
Attaches Comment to OriginalD and to its redeclaration chain and removes the redeclaration chain from...
void attachCommentsToJustParsedDecls(ArrayRef< Decl * > Decls, const Preprocessor *PP)
Searches existing comments for doc comments that should be attached to Decls.
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth,...
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
UsingEnumDecl * getInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst)
If the given using-enum decl Inst is an instantiation of another using-enum decl, return it.
RecordDecl * getCFConstantStringTagDecl() const
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
CanQualType UnsignedFractTy
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
CanQualType ObjCBuiltinClassTy
unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built.
OMPTraitInfo & getNewOMPTraitInfo()
Return a new OMPTraitInfo object owned by this context.
CanQualType UnsignedLongTy
bool hasSameTemplateName(const TemplateName &X, const TemplateName &Y) const
Determine whether the given template names refer to the same template.
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized,...
llvm::APFixedPoint getFixedPointMin(QualType Ty) const
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location,...
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
CanQualType UnsignedLongAccumTy
QualType AutoRRefDeductTy
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const
Return a type for a constant array for a string literal of the specified element type and length.
QualType getCorrespondingSaturatedType(QualType Ty) const
bool isSameEntity(const NamedDecl *X, const NamedDecl *Y) const
Determine whether the two declarations refer to the same entity.
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
QualType getSubstTemplateTypeParmPackType(Decl *AssociatedDecl, unsigned Index, bool Final, const TemplateArgument &ArgPack)
Retrieve a.
CanQualType BoundMemberTy
CanQualType SatUnsignedShortFractTy
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
QualType getBlockDescriptorType() const
Gets the struct used to keep track of the descriptor for pointer to blocks.
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
llvm::DenseSet< const VarDecl * > CUDADeviceVarODRUsedByHost
Keep track of CUDA/HIP device-side variables ODR-used by host code.
CanQualType PseudoObjectTy
QualType getWebAssemblyExternrefType() const
Return a WebAssembly externref type.
void setTraversalScope(const std::vector< Decl * > &)
CharUnits getTypeUnadjustedAlignInChars(QualType T) const
getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type, in characters,...
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
unsigned getAlignOfGlobalVar(QualType T, const VarDecl *VD) const
Return the alignment in bits that should be given to a global variable with type T.
TypeInfoChars getTypeInfoDataSizeInChars(QualType T) const
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
MangleContext * createDeviceMangleContext(const TargetInfo &T)
Creates a device mangle context to correctly mangle lambdas in a mixed architecture compile by settin...
CharUnits getExnObjectAlignment() const
Return the alignment (in bytes) of the thrown exception object.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
ASTMutationListener * Listener
CanQualType ObjCBuiltinBoolTy
TypeInfoChars getTypeInfoInChars(const Type *T) const
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
TemplateParamObjectDecl * getTemplateParamObjectDecl(QualType T, const APValue &V) const
Return the template parameter object of the given type with the given value.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
CanQualType OCLClkEventTy
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated,...
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
const clang::PrintingPolicy & getPrintingPolicy() const
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
llvm::FixedPointSemantics getFixedPointSemantics(QualType Ty) const
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
CanQualType SatUnsignedShortAccumTy
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false, bool IsConditionalOperator=false)
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
CharUnits getAlignOfGlobalVarInChars(QualType T, const VarDecl *VD) const
Return the alignment in characters that should be given to a global variable with type T.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
QualType getObjCIdType() const
Represents the Objective-CC id type.
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
QualType getCorrespondingUnsaturatedType(QualType Ty) const
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
FunctionProtoType::ExceptionSpecInfo mergeExceptionSpecs(FunctionProtoType::ExceptionSpecInfo ESI1, FunctionProtoType::ExceptionSpecInfo ESI2, SmallVectorImpl< QualType > &ExceptionTypeStorage, bool AcceptDependent)
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
bool isSameTemplateParameterList(const TemplateParameterList *X, const TemplateParameterList *Y) const
Determine whether two template parameter lists are similar enough that they may be used in declaratio...
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
CanQualType UnsignedInt128Ty
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class.
unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built.
void setManglingNumber(const NamedDecl *ND, unsigned Number)
llvm::DenseMap< const Decl *, const RawComment * > DeclRawComments
Mapping from declaration to directly attached comment.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type.
CanQualType UnsignedCharTy
CanQualType UnsignedShortFractTy
BuiltinTemplateDecl * buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, const IdentifierInfo *II) const
void * Allocate(size_t Size, unsigned Align=8) const
bool canBuiltinBeRedeclared(const FunctionDecl *) const
Return whether a declaration to a builtin is allowed to be overloaded/redeclared.
CanQualType UnsignedIntTy
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply.
unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl * > protocols) const
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
getObjCEncodingForMethodParameter - Return the encoded type for a single method parameter or return t...
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
QualType getExceptionObjectType(QualType T) const
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
CanQualType UnsignedLongLongTy
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
QualType getCommonSugaredType(QualType X, QualType Y, bool Unqualified=false)
CanQualType OCLReserveIDTy
bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y) const
Determine whether two template parameters are similar enough that they may be used in declarations of...
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
CanQualType UnsignedShortTy
unsigned getTypeAlignIfKnown(QualType T, bool NeedsPreferredAlignment=false) const
Return the alignment of a type, in bits, or 0 if the type is incomplete and we cannot determine the a...
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
canAssignObjCInterfacesInBlockPointer - This routine is specifically written for providing type-safet...
CanQualType SatUnsignedLongFractTy
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType getPackIndexingType(QualType Pattern, Expr *IndexExpr, bool FullySubstituted=false, ArrayRef< QualType > Expansions={}, int Index=-1) const
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache.
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
const VariableArrayType * getAsVariableArrayType(QualType T) const
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
StringLiteral * getPredefinedStringLiteralFromCache(StringRef Key) const
Return a string representing the human readable name for the specified function declaration or file n...
bool UnwrapSimilarTypes(QualType &T1, QualType &T2, bool AllowPiMismatch=true)
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
llvm::APFixedPoint getFixedPointMax(QualType Ty) const
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type.
bool areCompatibleSveTypes(QualType FirstType, QualType SecondType)
Return true if the given types are an SVE builtin and a VectorType that is a fixed-length representat...
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
DiagnosticsEngine & getDiagnostics() const
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
void ResetObjCLayout(const ObjCContainerDecl *CD)
interp::Context & getInterpContext()
Returns the clang bytecode interpreter context.
UnnamedGlobalConstantDecl * getUnnamedGlobalConstantDecl(QualType Ty, const APValue &Value) const
Return a declaration for a uniquified anonymous global constant corresponding to a given APValue.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size.
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl * > &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
CanQualType SatLongFractTy
const TargetInfo & getTargetInfo() const
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
CanQualType SatShortAccumTy
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
CanQualType IncompleteMatrixIdxTy
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
CanQualType getNSIntegerType() const
QualType getCorrespondingUnsignedType(QualType T) const
void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)
Set the copy initialization expression of a block var decl.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
TemplateName getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack, Decl *AssociatedDecl, unsigned Index, bool Final) const
TargetCXXABI::Kind getCXXABIKind() const
Return the C++ ABI kind that should be used.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
BuiltinTemplateDecl * getTypePackElementDecl() const
CanQualType SatUnsignedLongAccumTy
QualType getUnconstrainedType(QualType T) const
Remove any type constraints from a template parameter type, for equivalence comparison of template pa...
QualType getTypeOfType(QualType QT, TypeOfKind Kind) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
QualType getCorrespondingSignedType(QualType T) const
QualType mergeObjCGCQualifiers(QualType, QualType)
mergeObjCGCQualifiers - This routine merges ObjC's GC attribute of 'LHS' and 'RHS' attributes and ret...
llvm::DenseMap< const Decl *, const Decl * > CommentlessRedeclChains
Keeps track of redeclaration chains that don't have any comment attached.
uint64_t getArrayInitLoopExprElementCount(const ArrayInitLoopExpr *AILE) const
Return number of elements initialized in an ArrayInitLoopExpr.
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
unsigned getTargetAddressSpace(LangAS AS) const
QualType getWideCharType() const
Return the type of wide characters.
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
void addTranslationUnitDecl()
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it.
bool isPromotableIntegerType(QualType T) const
More type predicates useful for type checking/promotion.
llvm::DenseMap< const Decl *, const Decl * > RedeclChainComments
Mapping from canonical declaration to the first redeclaration in chain that has a comment attached.
CanQualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Underlying=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
QualType getSubstTemplateTypeParmType(QualType Replacement, Decl *AssociatedDecl, unsigned Index, std::optional< unsigned > PackIndex) const
Retrieve a substitution-result type.
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
Loading virtual member pointers using the virtual inheritance model always results in an adjustment u...
LangAS getLangASForBuiltinAddressSpace(unsigned AS) const
bool hasSameFunctionTypeIgnoringPtrSizes(QualType T, QualType U)
Determine whether two function types are the same, ignoring pointer sizes in the return type and para...
unsigned char getFixedPointScale(QualType Ty) const
QualType getIncompleteArrayType(QualType EltTy, ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
QualType DecodeTypeStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequireICE, bool AllowTypeModifiers) const
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
@ GE_Missing_stdio
Missing a type from <stdio.h>
@ GE_Missing_type
Missing a type.
@ GE_Missing_ucontext
Missing a type from <ucontext.h>
@ GE_Missing_setjmp
Missing a type from <setjmp.h>
QualType adjustStringLiteralBaseType(QualType StrLTy) const
QualType getTypeOfExprType(Expr *E, TypeOfKind Kind) const
C23 feature and GCC extension.
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
bool hasCvrSimilarType(QualType T1, QualType T2)
Determine if two types are similar, ignoring only CVR qualifiers.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or nullptr if none exists.
CanQualType UnsignedAccumTy
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
QualType getConstantMatrixType(QualType ElementType, unsigned NumRows, unsigned NumColumns) const
Return the unique reference to the matrix type of the specified element type and size.
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
void setCFConstantStringType(QualType T)
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
void AddDeallocation(void(*Callback)(void *), void *Data) const
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
CXXMethodVector::const_iterator overridden_cxx_method_iterator
RawComment * getRawCommentForDeclNoCacheImpl(const Decl *D, const SourceLocation RepresentativeLocForDecl, const std::map< unsigned, RawComment * > &CommentsInFile) const
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeTransparentUnionType - if T is a transparent union type and a member of T is compatible with Sub...
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
bool isSentinelNullExpr(const Expr *E)
CanQualType getNSUIntegerType() const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getBitIntType(bool Unsigned, unsigned NumBits) const
Return a bit-precise integer type with the specified signedness and bit count.
unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
virtual void AddedStaticLocalNumbers(const Decl *D, unsigned Number)
An static local number was added to a Decl.
virtual ~ASTMutationListener()
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
virtual void AddedManglingNumber(const Decl *D, unsigned Number)
An mangling number was added to a Decl.
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
const CXXRecordDecl * getBaseSharingVBPtr() const
CharUnits getSize() const
getSize - Get the record size in characters.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
CharUnits getDataSize() const
getDataSize() - Get the record data size, which is the record size without tail padding,...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
CharUnits getUnadjustedAlignment() const
getUnadjustedAlignment - Get the record alignment in characters, before alignment adjustement.
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a loop initializing the elements of an array.
llvm::APInt getArraySize() const
Expr * getSubExpr() const
Get the initializer to use for each array element.
Represents a constant array type that does not decay to a pointer when used as a function parameter.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
ArraySizeModifier getSizeModifier() const
Qualifiers getIndexTypeQualifiers() const
QualType getElementType() const
unsigned getIndexTypeCVRQualifiers() const
A structure for storing the information associated with a name that has been assumed to be a template...
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load,...
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
void Profile(llvm::FoldingSetNodeID &ID)
Attr - This represents one attribute.
An attributed type is a type to which a type attribute has been applied.
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
bool isConstrained() const
void Profile(llvm::FoldingSetNodeID &ID)
A fixed int type of a specified bitwidth.
void Profile(llvm::FoldingSetNodeID &ID) const
unsigned getNumBits() const
Represents a block literal declaration, which is like an unnamed FunctionDecl.
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
This class is used for builtin types like 'int'.
StringRef getName(const PrintingPolicy &Policy) const
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
bool hasCustomTypechecking(unsigned ID) const
Determines whether this builtin has custom typechecking.
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
Implements C++ ABI-specific semantic analysis functions.
Represents a C++ constructor within a class.
Represents a static or instance method of a struct/union/class.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a C++ struct/union/class.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool isDynamicClass() const
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
SplitQualType split() const
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
QualType withConst() const
Retrieves a version of this type with const applied.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Qualifiers getQualifiers() const
Retrieve all qualifiers.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
CharUnits - This is an opaque type for sizes expressed in character units.
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
bool isZero() const
isZero - Test whether the quantity equals zero.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
Declaration of a class template.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
Complex values, per C99 6.2.5p11.
QualType getElementType() const
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a C++20 concept.
ConceptDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool hasExplicitTemplateArgs() const
Whether or not template arguments were explicitly specified in the concept reference (they might not ...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Represents the canonical version of C arrays with a specified constant size.
const Expr * getSizeExpr() const
Return a pointer to the size expression.
llvm::APInt getSize() const
Return the constant array size as an APInt.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
uint64_t getZExtSize() const
Return the size zero-extended as a uint64_t.
Represents a concrete matrix type with constant number of rows and columns.
unsigned getNumColumns() const
Returns the number of columns in the matrix.
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getNumRows() const
Returns the number of rows in the matrix.
static constexpr bool isDimensionValid(size_t NumElements)
Returns true if NumElements is a valid matrix dimension.
Represents a sugar type with __counted_by or __sized_by annotations, including their _or_null variant...
void Profile(llvm::FoldingSetNodeID &ID)
Represents a pointer type decayed from an array or function type.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void addDecl(Decl *D)
Add the declaration D into this context.
A reference to a declared variable, function, enum, etc.
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
const DeclContext * getParentFunctionOrMethod(bool LexicalParent=false) const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext,...
ASTContext & getASTContext() const LLVM_READONLY
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
unsigned getMaxAlignment() const
getMaxAlignment - return the maximum alignment specified by attributes on this decl,...
static Decl * castFromDeclContext(const DeclContext *)
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
bool isInvalidDecl() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
SourceLocation getLocation() const
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack.
void setImplicit(bool I=true)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
DeclContext * getDeclContext()
SourceLocation getBeginLoc() const LLVM_READONLY
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
DeclarationNameLoc - Additional source/type location info for a declaration name.
static DeclarationNameLoc makeCXXOperatorNameLoc(SourceLocation BeginLoc, SourceLocation EndLoc)
Construct location information for a non-literal C++ operator.
The name of a declaration.
static int compare(DeclarationName LHS, DeclarationName RHS)
Represents a ValueDecl that came out of a declarator.
TypeSourceInfo * getTypeSourceInfo() const
Represents the type decltype(expr) (C++11).
Represents a C++17 deduced template specialization type.
void Profile(llvm::FoldingSetNodeID &ID)
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Represents an extended address space qualifier where the input address space value is dependent.
Expr * getAddrSpaceExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Internal representation of canonical, dependent decltype(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a qualified type name for which the type name is dependent.
void Profile(llvm::FoldingSetNodeID &ID)
Represents an array type in C++ whose size is a value-dependent expression.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Expr * getSizeExpr() const
Represents an extended vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a matrix type where the type and the number of rows and columns is dependent on a template...
Expr * getRowExpr() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a dependent template name that cannot be resolved prior to template instantiation.
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a template specialization type whose template cannot be resolved, e.g.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Internal representation of canonical, dependent typeof(expr) types.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Represents a vector type where either the type or size is dependent.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
Concrete class used by the front-end to report problems and issues.
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
Represents a type that was referred to using an elaborated type keyword, e.g., struct S,...
void Profile(llvm::FoldingSetNodeID &ID)
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
bool isComplete() const
Returns true if this can be considered a complete type.
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums.
EnumDecl * getDecl() const
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
bool isValueDependent() const
Determines whether the value of this expression depends on.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
bool isTypeDependent() const
Determines whether the type of this expression depends on.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
@ NPC_ValueDependentIsNull
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on.
bool isIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
Expr * IgnoreImpCasts() LLVM_READONLY
Skip past any implicit casts which might surround this expression until reaching a fixed point.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant.
std::optional< llvm::APSInt > getIntegerConstantExpr(const ASTContext &Ctx, SourceLocation *Loc=nullptr) const
isIntegerConstantExpr - Return the value if this expression is a valid integer constant expression.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
void Profile(llvm::FoldingSetNodeID &ID) const
ExtVectorType - Extended vector type.
Declaration context for names declared as extern "C" in C++.
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
Abstract interface for external sources of AST nodes.
virtual ExtKind hasExternalDefinitions(const Decl *D)
virtual void ReadComments()
Loads comment ranges.
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration.
virtual void PrintStats()
Print any statistics that have been gathered regarding the external AST source.
Represents a member of a struct/union/class.
bool isBitField() const
Determines whether this field is a bitfield.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
unsigned getBitWidthValue(const ASTContext &Ctx) const
Computes the bit width of this field, if this is a bit field.
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined.
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, const IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a function declaration or definition.
bool isMultiVersion() const
True if this function is considered a multiversioned function.
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
bool isUserProvided() const
True if this method is user-declared and was not deleted or defaulted on its first declaration.
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization,...
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
Represents a K&R-style 'int foo()' function, which has no information available about its arguments.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a prototype with parameter type info, e.g.
ExtParameterInfo getExtParameterInfo(unsigned I) const
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
unsigned getNumParams() const
QualType getParamType(unsigned i) const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
bool isVariadic() const
Whether this function prototype is variadic.
ExtProtoInfo getExtProtoInfo() const
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type?
Declaration of a template function.
A class which abstracts out some details necessary for making a call.
CallingConv getCC() const
bool getNoCfCheck() const
unsigned getRegParm() const
bool getNoCallerSavedRegs() const
ExtInfo withNoReturn(bool noReturn) const
bool getHasRegParm() const
bool getProducesResult() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
ExtParameterInfo withIsNoEscape(bool NoEscape) const
FunctionType - C99 6.7.5.3 - Function Declarators.
ExtInfo getExtInfo() const
QualType getReturnType() const
GlobalDecl - represents a global declaration.
unsigned getMultiVersionIndex() const
const Decl * getDecl() const
One of these records is kept for each identifier that is lexed.
Implements an efficient mapping from strings to IdentifierInfo nodes.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a C array with an unspecified size.
void Profile(llvm::FoldingSetNodeID &ID)
The injected class name of a C++ class template or class template partial specialization.
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
@ Relative
Components in the vtable are relative offsets between the vtable and the other structs/functions.
@ Pointer
Components in the vtable are pointers to other structs/functions.
An lvalue reference type, per C++11 [dcl.ref].
@ Swift
Interoperability with the latest known version of the Swift runtime.
@ Swift4_2
Interoperability with the Swift 4.2 runtime.
@ Swift4_1
Interoperability with the Swift 4.1 runtime.
@ Integer
Permit vector bitcasts between integer vectors with different numbers of elements but the same total ...
@ All
Permit vector bitcasts between all vectors with the same total bit-width.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
std::optional< TargetCXXABI::Kind > CXXABI
C++ ABI to compile with, if specified by the frontend through -fc++-abi=.
clang::ObjCRuntime ObjCRuntime
CoreFoundationABI CFRuntime
CommentOptions CommentOpts
Options for parsing comments.
std::string CUID
The user provided compilation unit ID, if non-empty.
static void Profile(llvm::FoldingSetNodeID &ID, Parts P)
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation.
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
QualType getElementType() const
Returns type of the elements being stored in the matrix.
static bool isValidElementType(QualType T)
Valid elements types are the following:
A pointer to member type per C++ 8.3.3 - Pointers to members.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getPointeeType() const
const Type * getClass() const
Provides information a specialization of a member of a class template, which may be a member function...
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags, bool IsAux=false)
Describes a module or submodule.
bool isNamedModule() const
Does this Module is a named module of a standard named module?
This represents a decl that may have a name.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
bool isExternallyVisible() const
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Represent a C++ namespace.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl, bool Nested)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, const IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCContainerDecl - Represents a container for method declarations.
const ObjCInterfaceDecl * getClassInterface() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, const IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
bool hasDefinition() const
Determine whether this class has been defined.
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class,...
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
ObjCImplementationDecl * getImplementation() const
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
ObjCInterfaceDecl * getSuperClass() const
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
known_extensions_range known_extensions() const
Interfaces are the core concept in Objective-C for object oriented design.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getNextIvar()
ObjCMethodDecl - Represents an instance or class method declaration.
ObjCDeclQualifier getObjCDeclQualifier() const
unsigned param_size() const
param_const_iterator param_end() const
param_const_iterator param_begin() const
const ParmVarDecl *const * param_const_iterator
Selector getSelector() const
bool isInstanceMethod() const
QualType getReturnType() const
Represents a pointer to an Objective C object.
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
void Profile(llvm::FoldingSetNodeID &ID)
Represents a class type in Objective C.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
bool isObjCQualifiedClass() const
QualType getBaseType() const
Gets the base type of this object type.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
bool isObjCQualifiedId() const
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
bool isObjCUnqualifiedId() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
Represents one property declaration in an Objective-C interface.
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID, ObjCPropertyQueryKind queryKind)
Lookup a property by name in the specified DeclContext.
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
Selector getSetterName() const
Selector getGetterName() const
ObjCPropertyAttribute::Kind getPropertyAttributes() const
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
ObjCIvarDecl * getPropertyIvarDecl() const
Represents an Objective-C protocol declaration.
protocol_range protocols() const
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
qual_iterator qual_end() const
qual_iterator qual_begin() const
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
Represents the declaration of an Objective-C type parameter.
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Represents a type parameter type in Objective C.
void Profile(llvm::FoldingSetNodeID &ID)
A structure for storing the information associated with an overloaded template name.
Represents a C++11 pack expansion that produces a sequence of expressions.
Represents a pack expansion of types.
void Profile(llvm::FoldingSetNodeID &ID)
void Profile(llvm::FoldingSetNodeID &ID)
Sugar for parentheses used when specifying types.
void Profile(llvm::FoldingSetNodeID &ID)
void clear()
Clear parent maps.
Represents a parameter to a function.
ObjCDeclQualifier getObjCDeclQualifier() const
QualType getOriginalType() const
ParsedAttr - Represents a syntactic attribute.
void Profile(llvm::FoldingSetNodeID &ID)
PointerType - C99 6.7.5.1 - Pointer Declarators.
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
A (possibly-)qualified type.
bool isVolatileQualified() const
Determine whether this type is volatile-qualified.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QualType withConst() const
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
LangAS getAddressSpace() const
Return the address space of this type.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
bool isConstQualified() const
Determine whether this type is const-qualified.
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after.
const Type * getTypePtrOrNull() const
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
Represents a template name that was expressed as a qualified name.
void Profile(llvm::FoldingSetNodeID &ID)
A qualifier set is used to build a set of qualifiers.
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
The collection of all-type qualifiers we support.
unsigned getCVRQualifiers() const
void removeCVRQualifiers(unsigned mask)
void addAddressSpace(LangAS space)
static Qualifiers removeCommonQualifiers(Qualifiers &L, Qualifiers &R)
Returns the common set of qualifiers while removing them from the given sets.
@ OCL_Strong
Assigning into this object requires the old value to be released and the new value to be retained.
@ OCL_ExplicitNone
This object can be modified without requiring retains or releases.
@ OCL_None
There is no lifetime qualification on this type.
@ OCL_Weak
Reading or writing from this object requires a barrier call.
@ OCL_Autoreleasing
Assigning into this object requires a lifetime extension.
void removeObjCLifetime()
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
void removeFastQualifiers(unsigned mask)
bool hasUnaligned() const
bool hasAddressSpace() const
unsigned getFastQualifiers() const
void removeAddressSpace()
void setAddressSpace(LangAS space)
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
bool hasObjCGCAttr() const
uint64_t getAsOpaqueValue() const
bool hasObjCLifetime() const
ObjCLifetime getObjCLifetime() const
void addObjCGCAttr(GC type)
LangAS getAddressSpace() const
An rvalue reference type, per C++11 [dcl.ref].
Represents a struct/union/class.
bool hasFlexibleArrayMember() const
field_range fields() const
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
virtual void completeDefinition()
Note that the definition of this type is now complete.
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
RecordDecl * getDecl() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Base for LValueReferenceType and RValueReferenceType.
QualType getPointeeType() const
void Profile(llvm::FoldingSetNodeID &ID)
This table allows us to fully hide how we implement multi-keyword caching.
std::string getAsString() const
Derive the full selector name (e.g.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
DiagnosticsEngine & getDiagnostics() const
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID.
unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid=nullptr) const
Given a SourceLocation, return the spelling line number for the position indicated.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID.
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical, bool ProfileLambdaExpr=false) const
Produce a unique representation of the given statement.
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
StringLiteral - This represents a string literal expression, e.g.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringLiteralKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
A structure for storing an already-substituted template template parameter pack.
Decl * getAssociatedDecl() const
A template-like entity which owns the whole pattern being substituted.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
unsigned getIndex() const
Returns the index of the replaced parameter in the associated declaration.
A structure for storing the information associated with a substituted template template parameter.
TemplateName getReplacement() const
void Profile(llvm::FoldingSetNodeID &ID)
TemplateTemplateParmDecl * getParameter() const
Represents the result of substituting a set of types for a template type parameter pack.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
Represents the declaration of a struct/union/class/enum.
void startDefinition()
Starts the definition of this tag declaration.
TagDecl * getDecl() const
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
Kind
The basic C++ ABI kind.
static Kind getKind(StringRef Name)
Exposes information about the current target.
TargetOptions & getTargetOpts() const
Retrieve the target options.
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
IntType getInt64Type() const
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space.
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
unsigned getBFloat16Width() const
getBFloat16Width/Align/Format - Return the size/align/format of '__bf16'.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
@ AArch64ABIBuiltinVaList
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com....
@ PNaClABIBuiltinVaList
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
@ PowerABIBuiltinVaList
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
@ AAPCSABIBuiltinVaList
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
@ CharPtrBuiltinVaList
typedef char* __builtin_va_list;
@ VoidPtrBuiltinVaList
typedef void* __builtin_va_list;
@ X86_64ABIBuiltinVaList
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0....
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
uint64_t getPointerWidth(LangAS AddrSpace) const
Return the width of pointers on this target, for the specified address space.
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
unsigned getHalfAlign() const
unsigned getBFloat16Align() const
FloatModeKind getRealTypeByWidth(unsigned BitWidth, FloatModeKind ExplicitType) const
Return floating point type with specified width.
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
unsigned getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of 'half'.
unsigned getMaxAlignedAttribute() const
Get the maximum alignment in bits for a static variable with aligned attribute.
virtual unsigned getMinGlobalAlign(uint64_t Size, bool HasNonWeakDef) const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
unsigned getTargetAddressSpace(LangAS AS) const
unsigned getFloat128Width() const
getFloat128Width/Align/Format - Return the size/align/format of '__float128'.
const llvm::fltSemantics & getLongDoubleFormat() const
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target,...
unsigned getFloat128Align() const
virtual bool hasBFloat16Type() const
Determine whether the _BFloat16 type is supported on this target.
const llvm::fltSemantics & getFloat128Format() const
unsigned getLongDoubleWidth() const
getLongDoubleWidth/Align/Format - Return the size/align/format of 'long double'.
unsigned getLongDoubleAlign() const
virtual std::optional< std::pair< unsigned, unsigned > > getVScaleRange(const LangOptions &LangOpts) const
Returns target-specific min and max values VScale_Range.
llvm::StringMap< bool > FeatureMap
The map of which features have been enabled disabled based on the command line.
A convenient class for passing around template argument information.
SourceLocation getRAngleLoc() const
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
SourceLocation getLAngleLoc() const
A template argument list.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
Location wrapper for a TemplateArgument.
Represents a template argument.
QualType getStructuralValueType() const
Get the type of a StructuralValue.
QualType getParamTypeForDecl() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
std::optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce,...
QualType getAsType() const
Retrieve the type for a type template argument.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
bool structurallyEquals(const TemplateArgument &Other) const
Determines whether two template arguments are superficially the same.
QualType getIntegralType() const
Retrieve the type of the integral value.
bool getIsDefaulted() const
If returns 'true', this TemplateArgument corresponds to a default template parameter.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ Template
The template argument is a template name that was provided for a template template parameter.
@ StructuralValue
The template argument is a non-type template argument that can't be represented by the special-case D...
@ Pack
The template argument is actually a parameter pack.
@ TemplateExpansion
The template argument is a pack expansion of a template name that was provided for a template templat...
@ NullPtr
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
@ Type
The template argument is a type.
@ Null
Represents an empty template argument, e.g., one that has not been deduced.
@ Integral
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
@ Expression
The template argument is an expression, and we've not resolved it to one of the other forms yet,...
ArgKind getKind() const
Return the kind of stored template argument.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion,...
const APValue & getAsStructuralValue() const
Get the value of a StructuralValue.
The base class of all kinds of template declarations (e.g., class, function, etc.).
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a C++ template name within the type system.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
@ UsingTemplate
A template name that refers to a template declaration found through a specific using shadow declarati...
@ OverloadedTemplate
A set of overloaded template declarations.
@ Template
A single template declaration.
@ DependentTemplate
A dependent template name that has not been resolved to a template (or set of templates).
@ SubstTemplateTemplateParm
A template template parameter that has been substituted for some other template name.
@ SubstTemplateTemplateParmPack
A template template parameter pack that has been substituted for a template template argument pack,...
@ QualifiedTemplate
A qualified template name, where the qualification is kept to describe the source code as written.
@ AssumedTemplate
An unqualified-id that has been assumed to name a function template that will be found by ADL.
A template parameter object.
static void Profile(llvm::FoldingSetNodeID &ID, QualType T, const APValue &V)
Stores a list of template parameters for a TemplateDecl and its derived classes.
NamedDecl * getParam(unsigned Idx)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
unsigned getNumArgs() const
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setTemplateKeywordLoc(SourceLocation Loc)
void setTemplateNameLoc(SourceLocation Loc)
void setLAngleLoc(SourceLocation Loc)
void setRAngleLoc(SourceLocation Loc)
Represents a type template specialization; the template must be a class template, a type alias templa...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, bool Typename, TemplateParameterList *Params)
Declaration of a template type parameter.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, std::optional< unsigned > NumExpanded=std::nullopt)
void Profile(llvm::FoldingSetNodeID &ID)
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
ConceptDecl * getNamedConcept() const
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
ConceptReference * getConceptReference() const
Represents a declaration of a type.
void setTypeForDecl(const Type *TD)
const Type * getTypeForDecl() const
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location.
Represents a typeof (or typeof) expression (a C23 feature and GCC extension) or a typeof_unqual expre...
Represents typeof(type), a C23 feature and GCC extension, or `typeof_unqual(type),...
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
The base class of the type hierarchy.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
bool isBlockPointerType() const
bool isBooleanType() const
bool isObjCBuiltinType() const
QualType getRVVEltType(const ASTContext &Ctx) const
Returns the representative type for the element of an RVV builtin type.
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
bool isIncompleteArrayType() const
bool isPlaceholderType() const
Test for a type which does not represent an actual type-system type but is instead used as a placehol...
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
bool isConstantArrayType() const
bool hasIntegerRepresentation() const
Determine whether this type has an integer representation of some sort, e.g., it is an integer type o...
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6....
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
bool isPointerType() const
bool isArrayParameterType() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
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, const IdentifierInfo *Id, TypeSourceInfo *TInfo)
Base class for declarations which introduce a typedef-name.
QualType getUnderlyingType() const
void setTypeSourceInfo(TypeSourceInfo *newType)
void Profile(llvm::FoldingSetNodeID &ID)
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
static void Profile(llvm::FoldingSetNodeID &ID, QualType Ty, const APValue &APVal)
The iterator over UnresolvedSets.
Represents the dependent type named by a dependently-scoped typename using declaration,...
Represents a dependent using declaration which was marked with typename.
Represents a C++ using-enum-declaration.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
void Profile(llvm::FoldingSetNodeID &ID)
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
void setType(QualType newType)
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr.
Represents a variable declaration or definition.
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member.
bool isStaticDataMember() const
Determines whether this is a static data member.
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization,...
bool isInline() const
Whether this variable is (C++1z) inline.
@ DeclarationOnly
This declaration is only a declaration.
DefinitionKind hasDefinition(ASTContext &) const
Check whether this variable is defined in this translation unit.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getSizeExpr() const
Represents a GCC generic vector type.
unsigned getNumElements() const
void Profile(llvm::FoldingSetNodeID &ID)
VectorKind getVectorKind() const
QualType getElementType() const
Holds all information required to evaluate constexpr code in a module.
Defines the Linkage enumeration and various utility functions.
Defines the clang::TargetInfo interface.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
The JSON file list parser is used to communicate input to InstallAPI.
@ Vector
'vector' clause, allowed on 'loop', Combined, and 'routine' directives.
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
GVALinkage
A more specific kind of linkage than enum Linkage.
@ GVA_AvailableExternally
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
OpenCLTypeKind
OpenCL type kinds.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
@ ICIS_NoInit
No in-class initializer.
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
TypeOfKind
The kind of 'typeof' expression we're after.
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ External
External linkage, which indicates that the entity can be referred to from other translation units.
@ Result
The result type of a method or function.
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
TagTypeKind
The kind of a tag type.
@ Interface
The "__interface" keyword.
@ Struct
The "struct" keyword.
@ Class
The "class" keyword.
bool isDiscardableGVALinkage(GVALinkage L)
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
@ BTK__type_pack_element
This names the __type_pack_element BuiltinTemplateDecl.
@ BTK__make_integer_seq
This names the __make_integer_seq BuiltinTemplateDecl.
LangAS
Defines the address space values used by the address space qualifier of QualType.
TranslationUnitKind
Describes the kind of translation unit being processed.
bool isPtrSizeAddressSpace(LangAS AS)
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
@ VK_XValue
An x-value expression is a reference to an object with independent storage but which can be "moved",...
@ VK_LValue
An l-value expression is a reference to an object with independent storage.
const FunctionProtoType * T
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, const TemplateParameterList *TPL=nullptr)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ExplicitSpecialization
This template specialization was declared or defined by an explicit specialization (C++ [temp....
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
@ TSK_Undeclared
This template specialization was formed from a template-id but has not yet been declared,...
CallingConv
CallingConv - Specifies the calling convention that a function uses.
@ Invariant
The parameter is invariant: must match exactly.
@ Contravariant
The parameter is contravariant, e.g., X<T> is a subtype of X when the type parameter is covariant and...
@ Covariant
The parameter is covariant, e.g., X<T> is a subtype of X when the type parameter is covariant and T i...
@ AltiVecBool
is AltiVec 'vector bool ...'
@ SveFixedLengthData
is AArch64 SVE fixed-length data vector
@ AltiVecPixel
is AltiVec 'vector Pixel'
@ Generic
not a target-specific vector type
@ RVVFixedLengthData
is RISC-V RVV fixed-length data vector
@ RVVFixedLengthMask
is RISC-V RVV fixed-length mask vector
@ SveFixedLengthPredicate
is AArch64 SVE fixed-length predicate vector
LangAS getLangASFromTargetAS(unsigned TargetAS)
@ None
The alignment was not explicit in code.
@ RequiredByEnum
The alignment comes from an alignment attribute on a enum type.
@ RequiredByTypedef
The alignment comes from an alignment attribute on a typedef.
@ RequiredByRecord
The alignment comes from an alignment attribute on a record type.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
@ None
No keyword precedes the qualified type name.
@ Enum
The "enum" keyword introduces the elaborated-type-specifier.
@ Typename
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_DependentNoexcept
noexcept(expression), value-dependent
@ EST_Uninstantiated
not instantiated yet
@ EST_Unparsed
not parsed yet
@ EST_NoThrow
Microsoft __declspec(nothrow) extension.
@ EST_None
no exception specification
@ EST_MSAny
Microsoft throw(...) extension.
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_NoexceptTrue
noexcept(expression), evals to 'true'
@ EST_Dynamic
throw(T1, T2)
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Expr * getCopyExpr() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspon...
Holds information about the various types of exception specification.
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Extra information about a function prototype.
ExceptionSpecInfo ExceptionSpec
bool requiresFunctionProtoTypeArmAttributes() const
const ExtParameterInfo * ExtParameterInfos
RefQualifierKind RefQualifier
unsigned HasTrailingReturn
bool requiresFunctionProtoTypeExtraBitfields() const
FunctionType::ExtInfo ExtInfo
A simple holder for a QualType representing a type in an exception specification.
A holder for Arm type attributes as described in the Arm C/C++ Language extensions which are not part...
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
Parts of a decomposed MSGuidDecl.
Contains information gathered from parsing the contents of TargetAttr.
Describes how types, statements, expressions, and declarations should be printed.
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
const Type * Ty
The locally-unqualified type.
Qualifiers Quals
The local qualifiers.
A this pointer adjustment.
IntType
===-— Target Data Type Query Methods ----------------------------—===//
AlignRequirementKind AlignRequirement
AlignRequirementKind AlignRequirement