63 #include "llvm/ADT/APInt.h" 64 #include "llvm/ADT/APSInt.h" 65 #include "llvm/ADT/ArrayRef.h" 66 #include "llvm/ADT/DenseMap.h" 67 #include "llvm/ADT/DenseSet.h" 68 #include "llvm/ADT/FoldingSet.h" 69 #include "llvm/ADT/None.h" 70 #include "llvm/ADT/Optional.h" 71 #include "llvm/ADT/PointerUnion.h" 72 #include "llvm/ADT/STLExtras.h" 73 #include "llvm/ADT/SmallPtrSet.h" 74 #include "llvm/ADT/SmallVector.h" 75 #include "llvm/ADT/StringExtras.h" 76 #include "llvm/ADT/StringRef.h" 77 #include "llvm/ADT/Triple.h" 78 #include "llvm/Support/Capacity.h" 79 #include "llvm/Support/Casting.h" 80 #include "llvm/Support/Compiler.h" 81 #include "llvm/Support/ErrorHandling.h" 82 #include "llvm/Support/MathExtras.h" 83 #include "llvm/Support/raw_ostream.h" 95 using namespace clang;
120 assert(std::is_sorted(RawComments.begin(), RawComments.end(),
134 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
139 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
140 if (VD->isStaticDataMember() &&
145 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
150 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
157 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
161 if (
const auto *TD = dyn_cast<TagDecl>(D)) {
164 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
168 if (isa<ParmVarDecl>(D))
173 if (isa<TemplateTypeParmDecl>(D) ||
174 isa<NonTypeTemplateParmDecl>(D) ||
175 isa<TemplateTemplateParmDecl>(D))
181 if (RawComments.empty())
191 if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) ||
192 isa<ObjCPropertyDecl>(D) ||
193 isa<RedeclarableTemplateDecl>(D) ||
194 isa<ClassTemplateSpecializationDecl>(D))
199 if (isa<TypedefDecl>(D)) {
204 }
else if (
const auto *TD = dyn_cast<TagDecl>(D)) {
211 TD->isCompleteDefinition())
232 bool Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
233 if (!Found && RawComments.size() >= 2) {
235 Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
239 Comment = MaybeBeforeDecl + 1;
240 assert(Comment == std::lower_bound(RawComments.begin(), RawComments.end(),
241 &CommentAtDeclLoc, Compare));
244 Comment = std::lower_bound(RawComments.begin(), RawComments.end(),
245 &CommentAtDeclLoc, Compare);
251 std::pair<FileID, unsigned> DeclLocDecomp = SourceMgr.
getDecomposedLoc(DeclLoc);
254 if (Comment != RawComments.end() &&
256 && (*Comment)->isTrailingComment() &&
257 (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
258 isa<ObjCMethodDecl>(D) || isa<ObjCPropertyDecl>(D))) {
259 std::pair<FileID, unsigned> CommentBeginDecomp
263 if (DeclLocDecomp.first == CommentBeginDecomp.first &&
264 SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second)
266 CommentBeginDecomp.second)) {
273 if (Comment == RawComments.begin())
278 if (!((*Comment)->isDocumentation() ||
280 (*Comment)->isTrailingComment())
284 std::pair<FileID, unsigned> CommentEndDecomp
289 if (DeclLocDecomp.first != CommentEndDecomp.first)
293 bool Invalid =
false;
294 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
300 StringRef
Text(Buffer + CommentEndDecomp.second,
301 DeclLocDecomp.second - CommentEndDecomp.second);
305 if (Text.find_first_of(
";{}#@") != StringRef::npos)
315 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
335 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
338 if (VD->isStaticDataMember())
344 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
351 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
357 return PU.is<ClassTemplateDecl*>() ?
358 static_cast<const Decl*>(PU.get<ClassTemplateDecl *>()) :
359 static_cast<const Decl*>(
365 CRD->getMemberSpecializationInfo())
366 return Info->getInstantiatedFrom();
370 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
383 const Decl **OriginalDecl)
const {
388 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
402 const Decl *OriginalDeclForRC =
nullptr;
404 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
415 OriginalDeclForRC = I;
435 *OriginalDecl = OriginalDeclForRC;
455 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
464 Redeclared.push_back(RedeclaredMethod);
470 const Decl *D)
const {
473 ThisDeclInfo->IsFilled =
false;
474 ThisDeclInfo->fill();
475 ThisDeclInfo->CommentDecl = FC->
getDecl();
476 if (!ThisDeclInfo->TemplateParameters)
486 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
497 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
501 if (Canonical != D) {
509 const Decl *OriginalDecl;
513 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
516 if (OMD && OMD->isPropertyAccessor())
523 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
527 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(D)) {
530 QualType QT = TD->getUnderlyingType();
532 if (
const Decl *TD = TT->getDecl())
536 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(D)) {
537 while (IC->getSuperClass()) {
538 IC = IC->getSuperClass();
543 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(D)) {
548 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
549 if (!(RD = RD->getDefinition()))
552 for (
const auto &I : RD->bases()) {
553 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
559 if (!(NonVirtualBase= NonVirtualBase->getDefinition()))
567 for (
const auto &I : RD->vbases()) {
574 if (!(VirtualBase= VirtualBase->getDefinition()))
588 if (D != OriginalDecl)
597 ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &
ID,
604 ID.AddInteger(Params->
size());
606 PEnd = Params->
end();
608 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
610 ID.AddBoolean(TTP->isParameterPack());
614 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
616 ID.AddBoolean(NTTP->isParameterPack());
617 ID.AddPointer(NTTP->getType().getCanonicalType().getAsOpaquePtr());
618 if (NTTP->isExpandedParameterPack()) {
620 ID.AddInteger(NTTP->getNumExpansionTypes());
621 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
622 QualType T = NTTP->getExpansionType(I);
626 ID.AddBoolean(
false);
630 auto *TTP = cast<TemplateTemplateParmDecl>(*P);
637 ASTContext::getCanonicalTemplateTemplateParmDecl(
640 llvm::FoldingSetNodeID
ID;
641 CanonicalTemplateTemplateParm::Profile(ID, TTP);
642 void *InsertPos =
nullptr;
643 CanonicalTemplateTemplateParm *Canonical
644 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
646 return Canonical->getParam();
651 CanonParams.reserve(Params->
size());
653 PEnd = Params->
end();
655 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P))
656 CanonParams.push_back(
663 else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
667 if (NTTP->isExpandedParameterPack()) {
670 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
672 ExpandedTInfos.push_back(
680 NTTP->getPosition(),
nullptr,
690 NTTP->getPosition(),
nullptr,
692 NTTP->isParameterPack(),
695 CanonParams.push_back(Param);
698 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
699 cast<TemplateTemplateParmDecl>(*
P)));
703 "Unexpected requires-clause on template template-parameter");
704 Expr *
const CanonRequiresClause =
nullptr;
716 CanonRequiresClause));
719 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
720 assert(!Canonical &&
"Shouldn't be in the map!");
724 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
725 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
730 if (!LangOpts.CPlusPlus)
return nullptr;
745 llvm_unreachable(
"Invalid CXXABI type!");
750 if (LOpts.FakeAddressSpaceMap) {
753 static const unsigned FakeAddrSpaceMap[] = {
764 return &FakeAddrSpaceMap;
772 switch (LangOpts.getAddressSpaceMapMangling()) {
780 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
786 : FunctionProtoTypes(this_()), TemplateSpecializationTypes(this_()),
787 DependentTemplateSpecializationTypes(this_()),
788 SubstTemplateTemplateParmPacks(this_()), SourceMgr(SM), LangOpts(LOpts),
791 LangOpts.XRayNeverInstrumentFiles,
792 LangOpts.XRayAttrListFiles, SM)),
795 CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
801 ReleaseParentMapEntries();
805 ReleaseDeclContextMaps();
808 for (
auto &Pair : Deallocations)
809 (Pair.first)(Pair.second);
815 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
817 if (
auto *R = const_cast<ASTRecordLayout *>((I++)->second))
820 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
821 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
823 if (
auto *R = const_cast<ASTRecordLayout *>((I++)->second))
827 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
828 AEnd = DeclAttrs.end();
830 A->second->~AttrVec();
832 for (std::pair<const MaterializeTemporaryExpr *, APValue *> &MTVPair :
833 MaterializedTemporaryValues)
834 MTVPair.second->~APValue();
836 for (
const auto &
Value : ModuleInitializers)
837 Value.second->~PerModuleInitializers();
840 void ASTContext::ReleaseParentMapEntries() {
841 if (!PointerParents)
return;
842 for (
const auto &Entry : *PointerParents) {
849 for (
const auto &Entry : *OtherParents) {
859 Deallocations.push_back({Callback, Data});
868 llvm::errs() <<
"\n*** AST Context Stats:\n";
869 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
871 unsigned counts[] = {
872 #define TYPE(Name, Parent) 0, 873 #define ABSTRACT_TYPE(Name, Parent) 874 #include "clang/AST/TypeNodes.def" 878 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
884 unsigned TotalBytes = 0;
885 #define TYPE(Name, Parent) \ 887 llvm::errs() << " " << counts[Idx] << " " << #Name \ 889 TotalBytes += counts[Idx] * sizeof(Name##Type); \ 891 #define ABSTRACT_TYPE(Name, Parent) 892 #include "clang/AST/TypeNodes.def" 894 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
899 <<
" implicit default constructors created\n";
902 <<
" implicit copy constructors created\n";
906 <<
" implicit move constructors created\n";
909 <<
" implicit copy assignment operators created\n";
913 <<
" implicit move assignment operators created\n";
916 <<
" implicit destructors created\n";
919 llvm::errs() <<
"\n";
923 BumpAlloc.PrintStats();
927 bool NotifyListeners) {
933 MergedDefModules[ND].push_back(M);
939 auto It = MergedDefModules.find(ND);
940 if (It == MergedDefModules.end())
943 auto &Merged = It->second;
946 if (!Found.insert(M).second)
948 Merged.erase(std::remove(Merged.begin(), Merged.end(),
nullptr), Merged.end());
951 void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
952 if (LazyInitializers.empty())
956 assert(Source &&
"lazy initializers but no external source");
958 auto LazyInits = std::move(LazyInitializers);
959 LazyInitializers.clear();
961 for (
auto ID : LazyInits)
962 Initializers.push_back(Source->GetExternalDecl(
ID));
964 assert(LazyInitializers.empty() &&
965 "GetExternalDecl for lazy module initializer added more inits");
971 if (
const auto *
ID = dyn_cast<ImportDecl>(D)) {
972 auto It = ModuleInitializers.find(
ID->getImportedModule());
975 if (It == ModuleInitializers.end())
979 auto &Imported = *It->second;
980 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
981 Imported.resolve(*
this);
982 auto *OnlyDecl = Imported.Initializers.front();
983 if (isa<ImportDecl>(OnlyDecl))
988 auto *&
Inits = ModuleInitializers[M];
990 Inits =
new (*this) PerModuleInitializers;
991 Inits->Initializers.push_back(D);
995 auto *&
Inits = ModuleInitializers[M];
997 Inits =
new (*this) PerModuleInitializers;
998 Inits->LazyInitializers.insert(
Inits->LazyInitializers.end(),
999 IDs.begin(), IDs.end());
1003 auto It = ModuleInitializers.find(M);
1004 if (It == ModuleInitializers.end())
1007 auto *
Inits = It->second;
1008 Inits->resolve(*
this);
1009 return Inits->Initializers;
1013 if (!ExternCContext)
1016 return ExternCContext;
1023 BuiltinTemplate->setImplicit();
1024 TUDecl->
addDecl(BuiltinTemplate);
1026 return BuiltinTemplate;
1031 if (!MakeIntegerSeqDecl)
1034 return MakeIntegerSeqDecl;
1039 if (!TypePackElementDecl)
1042 return TypePackElementDecl;
1056 NewDecl->addAttr(TypeVisibilityAttr::CreateImplicit(
1062 StringRef Name)
const {
1086 Types.push_back(Ty);
1091 assert((!this->Target || this->Target == &Target) &&
1092 "Incorrect target reinitialization");
1095 this->Target = &Target;
1096 this->AuxTarget = AuxTarget;
1098 ABI.reset(createCXXABI(Target));
1103 InitBuiltinType(
VoidTy, BuiltinType::Void);
1106 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1108 if (LangOpts.CharIsSigned)
1109 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1111 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1114 InitBuiltinType(
ShortTy, BuiltinType::Short);
1115 InitBuiltinType(
IntTy, BuiltinType::Int);
1116 InitBuiltinType(
LongTy, BuiltinType::Long);
1117 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1127 InitBuiltinType(
FloatTy, BuiltinType::Float);
1128 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1129 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1132 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1135 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1138 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1139 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1140 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1144 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1145 InitBuiltinType(
FractTy, BuiltinType::Fract);
1146 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1151 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1157 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1164 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1169 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1171 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1172 if (LangOpts.CPlusPlus && LangOpts.WChar)
1176 WideCharTy = getFromTargetType(Target.getWCharType());
1179 WIntTy = getFromTargetType(Target.getWIntType());
1182 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1184 if (LangOpts.CPlusPlus)
1185 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1187 Char16Ty = getFromTargetType(Target.getChar16Type());
1189 if (LangOpts.CPlusPlus)
1190 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1192 Char32Ty = getFromTargetType(Target.getChar32Type());
1199 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1202 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1211 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1217 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1220 if (LangOpts.OpenMP)
1234 if (LangOpts.OpenCL) {
1235 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1236 InitBuiltinType(SingletonId, BuiltinType::Id); 1237 #include "clang/Basic/OpenCLImageTypes.def" 1239 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1240 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1242 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1250 ObjCConstantStringType =
QualType();
1255 if (LangOpts.OpenCLVersion >= 200) {
1265 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1268 InitBuiltinType(
HalfTy, BuiltinType::Half);
1290 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1291 if (Pos != DeclAttrs.end()) {
1292 Pos->second->~AttrVec();
1293 DeclAttrs.erase(Pos);
1307 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1308 TemplateOrInstantiation.find(Var);
1309 if (Pos == TemplateOrInstantiation.end())
1322 Tmpl, TSK, PointOfInstantiation));
1328 assert(!TemplateOrInstantiation[Inst] &&
1329 "Already noted what the variable was instantiated from");
1330 TemplateOrInstantiation[Inst] = TSI;
1335 assert(FD &&
"Specialization is 0");
1336 llvm::DenseMap<const FunctionDecl*, FunctionDecl *>::const_iterator Pos
1337 = ClassScopeSpecializationPattern.find(FD);
1338 if (Pos == ClassScopeSpecializationPattern.end())
1346 assert(FD &&
"Specialization is 0");
1347 assert(Pattern &&
"Class scope specialization pattern is 0");
1348 ClassScopeSpecializationPattern[FD] = Pattern;
1353 auto Pos = InstantiatedFromUsingDecl.find(UUD);
1354 if (Pos == InstantiatedFromUsingDecl.end())
1362 assert((isa<UsingDecl>(Pattern) ||
1363 isa<UnresolvedUsingValueDecl>(Pattern) ||
1364 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1365 "pattern decl is not a using decl");
1366 assert((isa<UsingDecl>(Inst) ||
1367 isa<UnresolvedUsingValueDecl>(Inst) ||
1368 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1369 "instantiation did not produce a using decl");
1370 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1371 InstantiatedFromUsingDecl[Inst] = Pattern;
1376 llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>::const_iterator Pos
1377 = InstantiatedFromUsingShadowDecl.find(Inst);
1378 if (Pos == InstantiatedFromUsingShadowDecl.end())
1387 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1388 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1392 llvm::DenseMap<FieldDecl *, FieldDecl *>::iterator Pos
1393 = InstantiatedFromUnnamedFieldDecl.find(Field);
1394 if (Pos == InstantiatedFromUnnamedFieldDecl.end())
1402 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1403 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1404 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1405 "Already noted what unnamed field was instantiated from");
1407 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1423 return Range.end() - Range.begin();
1428 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1430 if (Pos == OverriddenMethods.end())
1438 OverriddenMethods[Method].push_back(Overridden);
1446 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1457 Method->getOverriddenMethods(OverDecls);
1458 Overridden.append(OverDecls.begin(), OverDecls.end());
1462 assert(!Import->NextLocalImport &&
"Import declaration already in the chain");
1463 assert(!Import->
isFromASTFile() &&
"Non-local import declaration");
1464 if (!FirstLocalImport) {
1465 FirstLocalImport = Import;
1466 LastLocalImport = Import;
1470 LastLocalImport->NextLocalImport = Import;
1471 LastLocalImport = Import;
1482 assert(BT &&
"Not a floating point type!");
1483 switch (BT->getKind()) {
1484 default: llvm_unreachable(
"Not a floating point type!");
1485 case BuiltinType::Float16:
1486 case BuiltinType::Half:
1498 bool UseAlignAttrOnly =
false;
1500 Align = AlignFromAttr;
1508 if (isa<FieldDecl>(D)) {
1509 UseAlignAttrOnly = D->
hasAttr<PackedAttr>() ||
1510 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1512 UseAlignAttrOnly =
true;
1515 else if (isa<FieldDecl>(D))
1518 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1522 if (UseAlignAttrOnly) {
1524 }
else if (
const auto *VD = dyn_cast<ValueDecl>(D)) {
1534 Align = getTypeInfoImpl(T.
getTypePtr()).Align;
1535 else if (!BaseT->isIncompleteType()) {
1540 if (!ForAlignof && MinWidth) {
1543 else if (isa<ConstantArrayType>(
arrayType) &&
1544 MinWidth <= getTypeSize(cast<ConstantArrayType>(
arrayType)))
1549 if (BaseT.getQualifiers().hasUnaligned())
1551 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
1552 if (VD->hasGlobalStorage() && !ForAlignof)
1562 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1576 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1577 if (LowBitOfOffset < FieldAlign)
1578 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1581 Align =
std::min(Align, FieldAlign);
1593 std::pair<CharUnits, CharUnits>
1607 return sizeAndAlign;
1612 std::pair<CharUnits, CharUnits>
1615 std::pair<CharUnits, CharUnits> EltInfo =
1617 uint64_t Size = CAT->
getSize().getZExtValue();
1618 assert((Size == 0 || static_cast<uint64_t>(EltInfo.first.getQuantity()) <=
1619 (uint64_t)(-1)/Size) &&
1620 "Overflow in array type char size evaluation");
1621 uint64_t Width = EltInfo.first.getQuantity() * Size;
1622 unsigned Align = EltInfo.second.getQuantity();
1625 Width = llvm::alignTo(Width, Align);
1630 std::pair<CharUnits, CharUnits>
1632 if (
const auto *CAT = dyn_cast<ConstantArrayType>(T))
1639 std::pair<CharUnits, CharUnits>
1655 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1666 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1671 return TT->getDecl()->getMaxAlignment();
1677 TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
1678 if (I != MemoizedTypeInfo.end())
1683 MemoizedTypeInfo[T] = TI;
1693 TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
1696 bool AlignIsRequired =
false;
1699 #define TYPE(Class, Base) 1700 #define ABSTRACT_TYPE(Class, Base) 1701 #define NON_CANONICAL_TYPE(Class, Base) 1702 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 1703 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \ 1705 assert(!T->isDependentType() && "should not see dependent types here"); \ 1706 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr()); 1707 #include "clang/AST/TypeNodes.def" 1708 llvm_unreachable(
"Should not see dependent types");
1710 case Type::FunctionNoProto:
1711 case Type::FunctionProto:
1717 case Type::IncompleteArray:
1718 case Type::VariableArray:
1720 Align =
getTypeAlign(cast<ArrayType>(T)->getElementType());
1723 case Type::ConstantArray: {
1724 const auto *CAT = cast<ConstantArrayType>(T);
1727 uint64_t Size = CAT->getSize().getZExtValue();
1728 assert((Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) &&
1729 "Overflow in array type bit size evaluation");
1730 Width = EltInfo.Width * Size;
1731 Align = EltInfo.Align;
1734 Width = llvm::alignTo(Width, Align);
1737 case Type::ExtVector:
1738 case Type::Vector: {
1739 const auto *VT = cast<VectorType>(T);
1741 Width = EltInfo.
Width * VT->getNumElements();
1745 if (Align & (Align-1)) {
1746 Align = llvm::NextPowerOf2(Align);
1747 Width = llvm::alignTo(Width, Align);
1751 if (TargetVectorAlign && TargetVectorAlign < Align)
1752 Align = TargetVectorAlign;
1757 switch (cast<BuiltinType>(T)->
getKind()) {
1758 default: llvm_unreachable(
"Unknown builtin type!");
1759 case BuiltinType::Void:
1764 case BuiltinType::Bool:
1768 case BuiltinType::Char_S:
1769 case BuiltinType::Char_U:
1770 case BuiltinType::UChar:
1771 case BuiltinType::SChar:
1772 case BuiltinType::Char8:
1776 case BuiltinType::WChar_S:
1777 case BuiltinType::WChar_U:
1781 case BuiltinType::Char16:
1785 case BuiltinType::Char32:
1789 case BuiltinType::UShort:
1790 case BuiltinType::Short:
1794 case BuiltinType::UInt:
1795 case BuiltinType::Int:
1799 case BuiltinType::ULong:
1800 case BuiltinType::Long:
1804 case BuiltinType::ULongLong:
1805 case BuiltinType::LongLong:
1809 case BuiltinType::Int128:
1810 case BuiltinType::UInt128:
1814 case BuiltinType::ShortAccum:
1815 case BuiltinType::UShortAccum:
1816 case BuiltinType::SatShortAccum:
1817 case BuiltinType::SatUShortAccum:
1821 case BuiltinType::Accum:
1822 case BuiltinType::UAccum:
1823 case BuiltinType::SatAccum:
1824 case BuiltinType::SatUAccum:
1828 case BuiltinType::LongAccum:
1829 case BuiltinType::ULongAccum:
1830 case BuiltinType::SatLongAccum:
1831 case BuiltinType::SatULongAccum:
1835 case BuiltinType::ShortFract:
1836 case BuiltinType::UShortFract:
1837 case BuiltinType::SatShortFract:
1838 case BuiltinType::SatUShortFract:
1842 case BuiltinType::Fract:
1843 case BuiltinType::UFract:
1844 case BuiltinType::SatFract:
1845 case BuiltinType::SatUFract:
1849 case BuiltinType::LongFract:
1850 case BuiltinType::ULongFract:
1851 case BuiltinType::SatLongFract:
1852 case BuiltinType::SatULongFract:
1856 case BuiltinType::Float16:
1857 case BuiltinType::Half:
1861 case BuiltinType::Float:
1865 case BuiltinType::Double:
1869 case BuiltinType::LongDouble:
1873 case BuiltinType::Float128:
1877 case BuiltinType::NullPtr:
1881 case BuiltinType::ObjCId:
1882 case BuiltinType::ObjCClass:
1883 case BuiltinType::ObjCSel:
1887 case BuiltinType::OCLSampler:
1888 case BuiltinType::OCLEvent:
1889 case BuiltinType::OCLClkEvent:
1890 case BuiltinType::OCLQueue:
1891 case BuiltinType::OCLReserveID:
1892 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1893 case BuiltinType::Id: 1894 #include "clang/Basic/OpenCLImageTypes.def" 1902 case Type::ObjCObjectPointer:
1906 case Type::BlockPointer:
1911 case Type::LValueReference:
1912 case Type::RValueReference:
1924 case Type::MemberPointer: {
1925 const auto *MPT = cast<MemberPointerType>(T);
1931 case Type::Complex: {
1935 Width = EltInfo.
Width * 2;
1936 Align = EltInfo.
Align;
1939 case Type::ObjCObject:
1940 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr());
1941 case Type::Adjusted:
1944 case Type::ObjCInterface: {
1945 const auto *ObjCI = cast<ObjCInterfaceType>(T);
1947 Width =
toBits(Layout.getSize());
1948 Align =
toBits(Layout.getAlignment());
1953 const auto *TT = cast<TagType>(T);
1955 if (TT->getDecl()->isInvalidDecl()) {
1961 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
1962 const EnumDecl *ED = ET->getDecl();
1966 Info.
Align = AttrAlign;
1972 const auto *RT = cast<RecordType>(TT);
1977 AlignIsRequired = RD->hasAttr<AlignedAttr>();
1981 case Type::SubstTemplateTypeParm:
1982 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
1983 getReplacementType().getTypePtr());
1986 case Type::DeducedTemplateSpecialization: {
1987 const auto *A = cast<DeducedType>(T);
1988 assert(!A->getDeducedType().isNull() &&
1989 "cannot request the size of an undeduced or dependent auto type");
1990 return getTypeInfo(A->getDeducedType().getTypePtr());
1994 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr());
1996 case Type::ObjCTypeParam:
1997 return getTypeInfo(cast<ObjCTypeParamType>(T)->desugar().getTypePtr());
1999 case Type::Typedef: {
2007 AlignIsRequired =
true;
2016 case Type::Elaborated:
2017 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
2019 case Type::Attributed:
2021 cast<AttributedType>(T)->getEquivalentType().getTypePtr());
2023 case Type::Atomic: {
2034 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2040 if (!llvm::isPowerOf2_64(Width))
2041 Width = llvm::NextPowerOf2(Width);
2044 Align =
static_cast<unsigned>(Width);
2055 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2056 return TypeInfo(Width, Align, AlignIsRequired);
2060 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(T);
2061 if (I != MemoizedUnadjustedAlign.end())
2064 unsigned UnadjustedAlign;
2076 MemoizedUnadjustedAlign[T] = UnadjustedAlign;
2077 return UnadjustedAlign;
2083 if ((
getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 ||
2084 getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) &&
2135 unsigned ABIAlign = TI.
Align;
2148 T = CT->getElementType().getTypePtr();
2150 T = ET->getDecl()->getIntegerType().getTypePtr();
2202 for (
const auto *I : OI->
ivars())
2206 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2208 Ivars.push_back(Iv);
2215 llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols) {
2216 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2219 for (
auto *Proto : OI->all_referenced_protocols()) {
2224 for (
const auto *Cat : OI->visible_categories())
2230 SD = SD->getSuperClass();
2232 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2233 for (
auto *Proto : OC->protocols()) {
2236 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2238 if (!Protocols.insert(
2239 const_cast<ObjCProtocolDecl *>(OP->getCanonicalDecl())).second)
2242 for (
auto *Proto : OP->protocols())
2249 assert(RD->
isUnion() &&
"Must be union type");
2252 for (
const auto *Field : RD->
fields()) {
2256 if (FieldSize != UnionSize)
2268 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
2269 return ClassDecl->isEmpty();
2277 assert(!RD->
isUnion() &&
"Must be struct/class type");
2280 int64_t CurOffsetInBits = 0;
2281 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2282 if (ClassDecl->isDynamicClass())
2286 for (
const auto Base : ClassDecl->bases()) {
2294 Bases.emplace_back(
Base.getType(), Size.getValue());
2299 Bases.begin(), Bases.end(), [&](
const std::pair<QualType, int64_t> &L,
2300 const std::pair<QualType, int64_t> &R) {
2301 return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) <
2302 Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
2305 for (
const auto Base : Bases) {
2306 int64_t BaseOffset = Context.
toBits(
2307 Layout.getBaseClassOffset(
Base.first->getAsCXXRecordDecl()));
2308 int64_t BaseSize =
Base.second;
2309 if (BaseOffset != CurOffsetInBits)
2311 CurOffsetInBits = BaseOffset + BaseSize;
2315 for (
const auto *Field : RD->
fields()) {
2316 if (!Field->getType()->isReferenceType() &&
2320 int64_t FieldSizeInBits =
2322 if (Field->isBitField()) {
2323 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2325 if (BitfieldSize > FieldSizeInBits)
2327 FieldSizeInBits = BitfieldSize;
2332 if (FieldOffsetInBits != CurOffsetInBits)
2335 CurOffsetInBits = FieldSizeInBits + FieldOffsetInBits;
2338 return CurOffsetInBits;
2359 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2379 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2394 return StructSize &&
2395 StructSize.getValue() ==
static_cast<int64_t
>(
getTypeSize(Ty));
2416 count += Ext->ivar_size();
2421 count += ImplDecl->ivar_size();
2439 if (isa<GNUNullExpr>(E))
return true;
2447 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2448 I = ObjCImpls.find(D);
2449 if (I != ObjCImpls.end())
2450 return cast<ObjCImplementationDecl>(I->second);
2457 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2458 I = ObjCImpls.find(D);
2459 if (I != ObjCImpls.end())
2460 return cast<ObjCCategoryImplDecl>(I->second);
2467 assert(IFaceD && ImplD &&
"Passed null params");
2468 ObjCImpls[IFaceD] = ImplD;
2474 assert(CatD && ImplD &&
"Passed null params");
2475 ObjCImpls[CatD] = ImplD;
2480 return ObjCMethodRedecls.lookup(MD);
2486 ObjCMethodRedecls[MD] = Redecl;
2493 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
2494 return CD->getClassInterface();
2495 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
2496 return IMD->getClassInterface();
2504 assert(VD &&
"Passed null params");
2505 assert(VD->
hasAttr<BlocksAttr>() &&
2506 "getBlockVarCopyInits - not __block var");
2507 llvm::DenseMap<const VarDecl*, Expr*>::iterator
2508 I = BlockVarCopyInits.find(VD);
2509 return (I != BlockVarCopyInits.end()) ? I->second :
nullptr;
2514 assert(VD && Init &&
"Passed null params");
2515 assert(VD->
hasAttr<BlocksAttr>() &&
2516 "setBlockVarCopyInits - not __block var");
2517 BlockVarCopyInits[VD] = Init;
2521 unsigned DataSize)
const {
2526 "incorrect data size provided to CreateTypeSourceInfo!");
2543 return getObjCLayout(D,
nullptr);
2557 ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
2562 llvm::FoldingSetNodeID
ID;
2564 void *insertPos =
nullptr;
2565 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
2566 assert(eq->getQualifiers() == quals);
2575 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
2578 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
2582 ExtQualNodes.InsertNode(eq, insertPos);
2587 LangAS AddressSpace)
const {
2600 "Type cannot be in multiple addr spaces!");
2603 return getExtQualType(TypeNode, Quals);
2622 return getExtQualType(TypeNode, Quals);
2649 "Type cannot have multiple ObjCGCs!");
2652 return getExtQualType(TypeNode, Quals);
2661 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(T)) {
2664 const auto *FPT = cast<FunctionProtoType>(T);
2667 Result =
getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI);
2670 return cast<FunctionType>(Result.
getTypePtr());
2686 L->DeducedReturnType(FD, ResultType);
2696 if (
const auto *PT = dyn_cast<ParenType>(Orig))
2701 if (
const auto *AT = dyn_cast<AttributedType>(Orig))
2709 const auto *Proto = cast<FunctionProtoType>(Orig);
2711 Proto->getReturnType(), Proto->getParamTypes(),
2712 Proto->getExtProtoInfo().withExceptionSpec(ESI));
2738 if (TSInfo->getType() != FD->
getType())
2746 "TypeLoc size mismatch from updating exception specification");
2747 TSInfo->overrideType(Updated);
2756 llvm::FoldingSetNodeID
ID;
2759 void *InsertPos =
nullptr;
2760 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
2770 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
2771 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2774 Types.push_back(New);
2775 ComplexTypes.InsertNode(New, InsertPos);
2784 llvm::FoldingSetNodeID
ID;
2787 void *InsertPos =
nullptr;
2788 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2798 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2799 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2802 Types.push_back(New);
2803 PointerTypes.InsertNode(New, InsertPos);
2808 llvm::FoldingSetNodeID
ID;
2810 void *InsertPos =
nullptr;
2811 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2818 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2819 assert(!AT &&
"Shouldn't be in the map!");
2823 Types.push_back(AT);
2824 AdjustedTypes.InsertNode(AT, InsertPos);
2848 llvm::FoldingSetNodeID
ID;
2850 void *InsertPos =
nullptr;
2851 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2858 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2859 assert(!AT &&
"Shouldn't be in the map!");
2862 Types.push_back(AT);
2863 AdjustedTypes.InsertNode(AT, InsertPos);
2873 llvm::FoldingSetNodeID
ID;
2876 void *InsertPos =
nullptr;
2878 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2889 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2890 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2893 Types.push_back(New);
2894 BlockPointerTypes.InsertNode(New, InsertPos);
2903 "Unresolved overloaded function type");
2907 llvm::FoldingSetNodeID
ID;
2910 void *InsertPos =
nullptr;
2912 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2920 if (!SpelledAsLValue || InnerRef || !T.
isCanonical()) {
2921 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
2926 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2927 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2932 Types.push_back(New);
2933 LValueReferenceTypes.InsertNode(New, InsertPos);
2943 llvm::FoldingSetNodeID
ID;
2946 void *InsertPos =
nullptr;
2948 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2957 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
2962 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2963 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2967 Types.push_back(New);
2968 RValueReferenceTypes.InsertNode(New, InsertPos);
2977 llvm::FoldingSetNodeID
ID;
2980 void *InsertPos =
nullptr;
2982 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2993 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2994 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2997 Types.push_back(New);
2998 MemberPointerTypes.InsertNode(New, InsertPos);
3005 const llvm::APInt &ArySizeIn,
3007 unsigned IndexTypeQuals)
const {
3010 "Constant array of VLAs is illegal!");
3014 llvm::APInt ArySize(ArySizeIn);
3017 llvm::FoldingSetNodeID
ID;
3020 void *InsertPos =
nullptr;
3022 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
3031 ASM, IndexTypeQuals);
3036 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
3037 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3042 ConstantArrayTypes.InsertNode(New, InsertPos);
3043 Types.push_back(New);
3057 const Type *ty = split.
Ty;
3059 #define TYPE(Class, Base) 3060 #define ABSTRACT_TYPE(Class, Base) 3061 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 3062 #include "clang/AST/TypeNodes.def" 3063 llvm_unreachable(
"didn't desugar past all non-canonical types?");
3069 case Type::DependentVector:
3070 case Type::ExtVector:
3071 case Type::DependentSizedExtVector:
3072 case Type::DependentAddressSpace:
3073 case Type::ObjCObject:
3074 case Type::ObjCInterface:
3075 case Type::ObjCObjectPointer:
3078 case Type::UnresolvedUsing:
3079 case Type::TypeOfExpr:
3081 case Type::Decltype:
3082 case Type::UnaryTransform:
3083 case Type::DependentName:
3084 case Type::InjectedClassName:
3085 case Type::TemplateSpecialization:
3086 case Type::DependentTemplateSpecialization:
3087 case Type::TemplateTypeParm:
3088 case Type::SubstTemplateTypeParmPack:
3090 case Type::DeducedTemplateSpecialization:
3091 case Type::PackExpansion:
3092 llvm_unreachable(
"type should never be variably-modified");
3096 case Type::FunctionNoProto:
3097 case Type::FunctionProto:
3098 case Type::BlockPointer:
3099 case Type::MemberPointer:
3109 cast<PointerType>(ty)->getPointeeType()));
3112 case Type::LValueReference: {
3113 const auto *lv = cast<LValueReferenceType>(ty);
3116 lv->isSpelledAsLValue());
3120 case Type::RValueReference: {
3121 const auto *lv = cast<RValueReferenceType>(ty);
3127 case Type::Atomic: {
3128 const auto *at = cast<AtomicType>(ty);
3133 case Type::ConstantArray: {
3134 const auto *cat = cast<ConstantArrayType>(ty);
3138 cat->getSizeModifier(),
3139 cat->getIndexTypeCVRQualifiers());
3143 case Type::DependentSizedArray: {
3144 const auto *dat = cast<DependentSizedArrayType>(ty);
3148 dat->getSizeModifier(),
3149 dat->getIndexTypeCVRQualifiers(),
3150 dat->getBracketsRange());
3155 case Type::IncompleteArray: {
3156 const auto *iat = cast<IncompleteArrayType>(ty);
3161 iat->getIndexTypeCVRQualifiers(),
3167 case Type::VariableArray: {
3168 const auto *vat = cast<VariableArrayType>(ty);
3173 vat->getIndexTypeCVRQualifiers(),
3174 vat->getBracketsRange());
3188 unsigned IndexTypeQuals,
3198 IndexTypeQuals, Brackets);
3205 VariableArrayTypes.push_back(New);
3206 Types.push_back(New);
3216 unsigned elementTypeQuals,
3220 "Size must be type- or value-dependent!");
3230 numElements, ASM, elementTypeQuals,
3232 Types.push_back(newType);
3241 void *insertPos =
nullptr;
3242 llvm::FoldingSetNodeID
ID;
3245 ASM, elementTypeQuals, numElements);
3249 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3255 QualType(), numElements, ASM, elementTypeQuals,
3257 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
3258 Types.push_back(canonTy);
3263 canonElementType.
Quals);
3267 if (
QualType(canonElementType.
Ty, 0) == elementType &&
3276 ASM, elementTypeQuals, brackets);
3277 Types.push_back(sugaredType);
3283 unsigned elementTypeQuals)
const {
3284 llvm::FoldingSetNodeID
ID;
3287 void *insertPos =
nullptr;
3289 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
3300 ASM, elementTypeQuals);
3305 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3306 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
3312 IncompleteArrayTypes.InsertNode(newType, insertPos);
3313 Types.push_back(newType);
3324 llvm::FoldingSetNodeID
ID;
3327 void *InsertPos =
nullptr;
3328 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3338 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3339 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3342 VectorType(vecType, NumElts, Canonical, VecKind);
3343 VectorTypes.InsertNode(New, InsertPos);
3344 Types.push_back(New);
3352 llvm::FoldingSetNodeID
ID;
3355 void *InsertPos =
nullptr;
3357 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3362 *
this, VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
3365 if (CanonVecTy == VecType) {
3367 *
this, VecType,
QualType(), SizeExpr, AttrLoc, VecKind);
3370 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3371 assert(!CanonCheck &&
3372 "Dependent-sized vector_size canonical type broken");
3374 DependentVectorTypes.InsertNode(New, InsertPos);
3379 *
this, VecType, Canon, SizeExpr, AttrLoc, VecKind);
3383 Types.push_back(New);
3394 llvm::FoldingSetNodeID
ID;
3397 void *InsertPos =
nullptr;
3398 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3408 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3409 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3413 VectorTypes.InsertNode(New, InsertPos);
3414 Types.push_back(New);
3422 llvm::FoldingSetNodeID
ID;
3426 void *InsertPos =
nullptr;
3428 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3438 if (CanonVecTy == vecType) {
3444 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3445 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
3447 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
3456 Types.push_back(New);
3461 Expr *AddrSpaceExpr,
3467 void *insertPos =
nullptr;
3468 llvm::FoldingSetNodeID
ID;
3473 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
3478 QualType(), AddrSpaceExpr, AttrLoc);
3479 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
3480 Types.push_back(canonTy);
3483 if (canonPointeeType == PointeeType &&
3490 AddrSpaceExpr, AttrLoc);
3491 Types.push_back(sugaredType);
3508 llvm::FoldingSetNodeID
ID;
3511 void *InsertPos =
nullptr;
3513 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
3523 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3524 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3529 Types.push_back(New);
3530 FunctionNoProtoTypes.InsertNode(New, InsertPos);
3546 return CanResultType;
3553 if (!NoexceptInType)
3570 bool AnyPackExpansions =
false;
3575 AnyPackExpansions =
true;
3577 return AnyPackExpansions;
3583 QualType ASTContext::getFunctionTypeInternal(
3586 size_t NumArgs = ArgArray.size();
3590 llvm::FoldingSetNodeID
ID;
3595 bool Unique =
false;
3597 void *InsertPos =
nullptr;
3599 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
3608 EPI.ExceptionSpec.NoexceptExpr == FPT->getNoexceptExpr())
3619 bool IsCanonicalExceptionSpec =
3623 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
3625 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
3626 if (!ArgArray[i].isCanonicalAsParam())
3627 isCanonical =
false;
3629 if (OnlyWantCanonical)
3630 assert(isCanonical &&
3631 "given non-canonical parameters constructing canonical type");
3636 if (!isCanonical && Canonical.isNull()) {
3638 CanonicalArgs.reserve(NumArgs);
3639 for (
unsigned i = 0; i != NumArgs; ++i)
3646 if (IsCanonicalExceptionSpec) {
3648 }
else if (NoexceptInType) {
3649 switch (EPI.ExceptionSpec.Type) {
3661 bool AnyPacks =
false;
3662 for (
QualType ET : EPI.ExceptionSpec.Exceptions) {
3681 llvm_unreachable(
"dependent noexcept is already canonical");
3690 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
3694 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3695 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3708 FunctionProtoType::getExceptionSpecSize(
3709 EPI.ExceptionSpec.Type, EPI.ExceptionSpec.Exceptions.size());
3717 if (EPI.ExtParameterInfos) {
3724 Types.push_back(FTP);
3726 FunctionProtoTypes.InsertNode(FTP, InsertPos);
3731 llvm::FoldingSetNodeID
ID;
3734 void *InsertPos =
nullptr;
3735 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
3745 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
3746 assert(!NewIP &&
"Shouldn't be in the map!");
3750 Types.push_back(New);
3751 PipeTypes.InsertNode(New, InsertPos);
3762 return getPipeType(T,
true);
3766 return getPipeType(T,
false);
3771 if (!isa<CXXRecordDecl>(D))
return false;
3772 const auto *RD = cast<CXXRecordDecl>(D);
3773 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
3775 if (RD->getDescribedClassTemplate() &&
3776 !isa<ClassTemplateSpecializationDecl>(RD))
3787 if (Decl->TypeForDecl) {
3788 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3790 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
3791 Decl->TypeForDecl = PrevDecl->TypeForDecl;
3792 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3796 Decl->TypeForDecl = newType;
3797 Types.push_back(newType);
3799 return QualType(Decl->TypeForDecl, 0);
3805 assert(Decl &&
"Passed null for Decl param");
3806 assert(!Decl->TypeForDecl &&
"TypeForDecl present in slow case");
3808 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(Decl))
3811 assert(!isa<TemplateTypeParmDecl>(Decl) &&
3812 "Template type parameter types are always available.");
3814 if (
const auto *Record = dyn_cast<RecordDecl>(Decl)) {
3815 assert(Record->isFirstDecl() &&
"struct/union has previous declaration");
3818 }
else if (
const auto *Enum = dyn_cast<EnumDecl>(Decl)) {
3819 assert(Enum->isFirstDecl() &&
"enum has previous declaration");
3821 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(Decl)) {
3823 Decl->TypeForDecl = newType;
3824 Types.push_back(newType);
3826 llvm_unreachable(
"TypeDecl without a type?");
3828 return QualType(Decl->TypeForDecl, 0);
3836 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3842 Decl->TypeForDecl = newType;
3843 Types.push_back(newType);
3848 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3851 if (PrevDecl->TypeForDecl)
3852 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3855 Decl->TypeForDecl = newType;
3856 Types.push_back(newType);
3861 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3864 if (PrevDecl->TypeForDecl)
3865 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3868 Decl->TypeForDecl = newType;
3869 Types.push_back(newType);
3876 llvm::FoldingSetNodeID
id;
3879 void *insertPos =
nullptr;
3881 if (type)
return QualType(type, 0);
3887 Types.push_back(type);
3888 AttributedTypes.InsertNode(type, insertPos);
3898 &&
"replacement types must always be canonical");
3900 llvm::FoldingSetNodeID
ID;
3902 void *InsertPos =
nullptr;
3904 = SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3909 Types.push_back(SubstParm);
3910 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
3923 assert(
P.getAsType().isCanonical() &&
"Pack contains non-canonical type");
3927 llvm::FoldingSetNodeID
ID;
3929 void *InsertPos =
nullptr;
3931 = SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
3939 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
3945 Types.push_back(SubstParm);
3946 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
3956 llvm::FoldingSetNodeID
ID;
3958 void *InsertPos =
nullptr;
3960 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3970 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3971 assert(!TypeCheck &&
"Template type parameter canonical type broken");
3977 Types.push_back(TypeParm);
3978 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
3989 "No dependent template names here!");
3999 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
4009 "No dependent template names here!");
4012 ArgVec.reserve(Args.
size());
4014 ArgVec.push_back(Arg.getArgument());
4022 if (Arg.isPackExpansion())
4034 "No dependent template names here!");
4043 if (!Underlying.
isNull())
4049 "Caller must compute aliased type");
4050 IsTypeAlias =
false;
4059 (IsTypeAlias?
sizeof(
QualType) : 0),
4063 IsTypeAlias ? Underlying :
QualType());
4065 Types.push_back(Spec);
4072 "No dependent template names here!");
4081 unsigned NumArgs = Args.size();
4082 CanonArgs.reserve(NumArgs);
4088 llvm::FoldingSetNodeID
ID;
4092 void *InsertPos =
nullptr;
4094 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4104 Types.push_back(Spec);
4105 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
4109 "Non-dependent template-id type must have a canonical type");
4116 TagDecl *OwnedTagDecl)
const {
4117 llvm::FoldingSetNodeID
ID;
4120 void *InsertPos =
nullptr;
4121 ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4128 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4129 assert(!CheckT &&
"Elaborated canonical type broken");
4136 ElaboratedTypes.InsertNode(T, InsertPos);
4142 llvm::FoldingSetNodeID
ID;
4145 void *InsertPos =
nullptr;
4146 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4153 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4154 assert(!CheckT &&
"Paren canonical type broken");
4160 ParenTypes.InsertNode(T, InsertPos);
4170 if (CanonNNS != NNS)
4174 llvm::FoldingSetNodeID
ID;
4177 void *InsertPos =
nullptr;
4179 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
4185 DependentNameTypes.InsertNode(T, InsertPos);
4197 for (
unsigned I = 0, E = Args.
size(); I != E; ++I)
4198 ArgCopy.push_back(Args[I].getArgument());
4209 "nested-name-specifier must be dependent");
4211 llvm::FoldingSetNodeID
ID;
4215 void *InsertPos =
nullptr;
4217 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4226 bool AnyNonCanonArgs =
false;
4227 unsigned NumArgs = Args.size();
4229 for (
unsigned I = 0; I != NumArgs; ++I) {
4231 if (!CanonArgs[I].structurallyEquals(Args[I]))
4232 AnyNonCanonArgs =
true;
4236 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
4242 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4251 DependentTemplateSpecializationTypes.InsertNode(T, InsertPos);
4257 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
4263 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
4266 NTTP->getType().getNonLValueExprType(*
this),
4269 if (NTTP->isParameterPack())
4274 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
4290 Args.reserve(Args.size() + Params->
size());
4298 llvm::FoldingSetNodeID
ID;
4302 "Pack expansions must expand one or more parameter packs");
4303 void *InsertPos =
nullptr;
4305 = PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4320 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4327 PackExpansionTypes.InsertNode(T, InsertPos);
4339 if (Protocols.empty())
return true;
4344 for (
unsigned i = 1; i != Protocols.size(); ++i)
4346 Protocols[i]->getCanonicalDecl() != Protocols[i])
4354 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
4358 P =
P->getCanonicalDecl();
4361 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
4362 Protocols.erase(ProtocolsEnd, Protocols.end());
4367 unsigned NumProtocols)
const {
4369 llvm::makeArrayRef(Protocols, NumProtocols),
4377 bool isKindOf)
const {
4380 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
4381 isa<ObjCInterfaceType>(baseType))
4385 llvm::FoldingSetNodeID
ID;
4387 void *InsertPos =
nullptr;
4388 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
4395 if (effectiveTypeArgs.empty()) {
4397 effectiveTypeArgs = baseObject->getTypeArgs();
4404 bool typeArgsAreCanonical = std::all_of(effectiveTypeArgs.begin(),
4405 effectiveTypeArgs.end(),
4407 return type.isCanonical();
4410 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
4414 if (!typeArgsAreCanonical) {
4415 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
4416 for (
auto typeArg : effectiveTypeArgs)
4418 canonTypeArgs = canonTypeArgsVec;
4420 canonTypeArgs = effectiveTypeArgs;
4425 if (!protocolsSorted) {
4426 canonProtocolsVec.append(protocols.begin(), protocols.end());
4428 canonProtocols = canonProtocolsVec;
4430 canonProtocols = protocols;
4434 canonProtocols, isKindOf);
4437 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
4441 size += typeArgs.size() *
sizeof(
QualType);
4449 ObjCObjectTypes.InsertNode(T, InsertPos);
4459 bool allowOnPointerType)
const {
4462 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(type.
getTypePtr())) {
4467 if (allowOnPointerType) {
4468 if (
const auto *objPtr =
4469 dyn_cast<ObjCObjectPointerType>(type.
getTypePtr())) {
4475 protocolsVec.append(protocols.begin(), protocols.end());
4487 if (
const auto *objT = dyn_cast<ObjCObjectType>(type.
getTypePtr())){
4492 objT->getTypeArgsAsWritten(),
4494 objT->isKindOfTypeAsWritten());
4511 objPtr->isKindOfType());
4519 objPtr->isKindOfType());
4532 llvm::FoldingSetNodeID
ID;
4534 void *InsertPos =
nullptr;
4536 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
4539 if (Canonical.
isNull()) {
4542 if (!protocols.empty()) {
4547 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
4556 Types.push_back(newType);
4557 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
4571 for (
auto *Proto : OPT->quals()) {
4592 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> InheritedProtocols;
4594 if (InheritedProtocols.empty())
4598 bool Conforms =
false;
4599 for (
auto *Proto : OPT->quals()) {
4601 for (
auto *PI : InheritedProtocols) {
4613 for (
auto *PI : InheritedProtocols) {
4615 bool Adopts =
false;
4616 for (
auto *Proto : OPT->quals()) {
4630 llvm::FoldingSetNodeID
ID;
4633 void *InsertPos =
nullptr;
4635 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4644 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4652 Types.push_back(QType);
4653 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
4661 if (Decl->TypeForDecl)
4662 return QualType(Decl->TypeForDecl, 0);
4665 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
4666 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4667 return QualType(PrevDecl->TypeForDecl, 0);
4676 Decl->TypeForDecl = T;
4689 llvm::FoldingSetNodeID
ID;
4692 void *InsertPos =
nullptr;
4694 = DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
4704 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
4711 Types.push_back(toe);
4723 Types.push_back(tot);
4739 llvm::FoldingSetNodeID
ID;
4742 void *InsertPos =
nullptr;
4744 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
4748 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
4756 Types.push_back(dt);
4770 llvm::FoldingSetNodeID
ID;
4773 void *InsertPos =
nullptr;
4775 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
4782 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
4790 UnderlyingType, Kind,
4793 Types.push_back(ut);
4801 bool IsDependent)
const {
4806 void *InsertPos =
nullptr;
4807 llvm::FoldingSetNodeID
ID;
4809 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
4813 AutoType(DeducedType, Keyword, IsDependent);
4814 Types.push_back(AT);
4816 AutoTypes.InsertNode(AT, InsertPos);
4826 void *InsertPos =
nullptr;
4827 llvm::FoldingSetNodeID
ID;
4831 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
4836 Types.push_back(DTST);
4838 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
4847 llvm::FoldingSetNodeID
ID;
4850 void *InsertPos =
nullptr;
4851 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
4861 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
4862 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4865 Types.push_back(New);
4866 AtomicTypes.InsertNode(New, InsertPos);
4972 if (isa<ArrayType>(Ty)) {
4974 }
else if (isa<FunctionType>(Ty)) {
4996 quals = splitType.
Quals;
5001 QualType elementType = AT->getElementType();
5006 if (elementType == unqualElementType) {
5007 assert(quals.
empty());
5008 quals = splitType.
Quals;
5016 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
5018 CAT->getSizeModifier(), 0);
5021 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
5025 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
5028 VAT->getSizeModifier(),
5029 VAT->getIndexTypeCVRQualifiers(),
5030 VAT->getBracketsRange());
5033 const auto *DSAT = cast<DependentSizedArrayType>(AT);
5035 DSAT->getSizeModifier(), 0,
5043 bool UnwrappedAny =
false;
5046 if (!AT1)
return UnwrappedAny;
5049 if (!AT2)
return UnwrappedAny;
5053 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
5055 if (!CAT2 || CAT1->getSize() != CAT2->getSize())
5056 return UnwrappedAny;
5057 }
else if (!isa<IncompleteArrayType>(AT1) ||
5058 !isa<IncompleteArrayType>(AT2)) {
5059 return UnwrappedAny;
5062 T1 = AT1->getElementType();
5063 T2 = AT2->getElementType();
5064 UnwrappedAny =
true;
5085 if (T1PtrType && T2PtrType) {
5093 if (T1MPType && T2MPType &&
5104 if (T1OPType && T2OPType) {
5136 if (Quals1 != Quals2)
5194 llvm_unreachable(
"bad template name kind!");
5202 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
5203 Template = getCanonicalTemplateTemplateParmDecl(TTP);
5210 llvm_unreachable(
"cannot canonicalize overloaded template");
5214 assert(DTN &&
"Non-dependent template names must refer to template decls.");
5215 return DTN->CanonicalTemplateName;
5235 llvm_unreachable(
"bad template name!");
5284 A != AEnd; (void)++A, ++Idx)
5287 return TemplateArgument(llvm::makeArrayRef(CanonArgs, Arg.
pack_size()));
5292 llvm_unreachable(
"Unhandled template argument kind");
5348 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
5355 if (
const auto *AT = dyn_cast<ArrayType>(T))
5376 if (!ATy || qs.
empty())
5383 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
5385 CAT->getSizeModifier(),
5386 CAT->getIndexTypeCVRQualifiers()));
5387 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
5389 IAT->getSizeModifier(),
5390 IAT->getIndexTypeCVRQualifiers()));
5392 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
5393 return cast<ArrayType>(
5395 DSAT->getSizeExpr(),
5396 DSAT->getSizeModifier(),
5397 DSAT->getIndexTypeCVRQualifiers(),
5398 DSAT->getBracketsRange()));
5400 const auto *VAT = cast<VariableArrayType>(ATy);
5403 VAT->getSizeModifier(),
5404 VAT->getIndexTypeCVRQualifiers(),
5405 VAT->getBracketsRange()));
5445 assert(PrettyArrayType &&
"Not an array type!");
5482 uint64_t ElementCount = 1;
5484 ElementCount *= CA->
getSize().getZExtValue();
5485 CA = dyn_cast_or_null<ConstantArrayType>(
5488 return ElementCount;
5497 assert(T->
getAs<
BuiltinType>() &&
"getFloatingRank(): not a floating type");
5499 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
5501 case BuiltinType::Half:
return HalfRank;
5502 case BuiltinType::Float:
return FloatRank;
5519 case HalfRank: llvm_unreachable(
"Complex half is not supported");
5536 llvm_unreachable(
"getFloatingRank(): illegal value for rank");
5557 unsigned ASTContext::getIntegerRank(
const Type *T)
const {
5560 switch (cast<BuiltinType>(T)->getKind()) {
5561 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
5562 case BuiltinType::Bool:
5564 case BuiltinType::Char_S:
5565 case BuiltinType::Char_U:
5566 case BuiltinType::SChar:
5567 case BuiltinType::UChar:
5569 case BuiltinType::Short:
5570 case BuiltinType::UShort:
5572 case BuiltinType::Int:
5573 case BuiltinType::UInt:
5575 case BuiltinType::Long:
5576 case BuiltinType::ULong:
5578 case BuiltinType::LongLong:
5579 case BuiltinType::ULongLong:
5581 case BuiltinType::Int128:
5582 case BuiltinType::UInt128:
5630 if (BitWidth < IntSize)
5633 if (BitWidth == IntSize)
5648 assert(!Promotable.
isNull());
5651 return ET->getDecl()->getPromotionType();
5660 if (BT->getKind() == BuiltinType::WChar_S ||
5661 BT->getKind() == BuiltinType::WChar_U ||
5662 BT->getKind() == BuiltinType::Char8 ||
5663 BT->getKind() == BuiltinType::Char16 ||
5664 BT->getKind() == BuiltinType::Char32) {
5665 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
5669 for (
size_t Idx = 0; Idx < llvm::array_lengthof(PromoteTypes); ++Idx) {
5671 if (FromSize < ToSize ||
5672 (FromSize == ToSize &&
5673 FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType()))
5674 return PromoteTypes[Idx];
5676 llvm_unreachable(
"char type should fit into long long");
5683 uint64_t PromotableSize =
getIntWidth(Promotable);
5724 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
5726 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
5729 if (LHSC == RHSC)
return 0;
5734 unsigned LHSRank = getIntegerRank(LHSC);
5735 unsigned RHSRank = getIntegerRank(RHSC);
5737 if (LHSUnsigned == RHSUnsigned) {
5738 if (LHSRank == RHSRank)
return 0;
5739 return LHSRank > RHSRank ? 1 : -1;
5745 if (LHSRank >= RHSRank)
5755 if (RHSRank >= LHSRank)
5765 if (!CFConstantStringTypeDecl) {
5766 assert(!CFConstantStringTagDecl &&
5767 "tag and typedef should be initialized together");
5772 const char *FieldNames[4];
5776 FieldNames[0] =
"isa";
5778 FieldTypes[1] =
IntTy;
5779 FieldNames[1] =
"flags";
5782 FieldNames[2] =
"str";
5785 FieldNames[3] =
"length";
5788 for (
unsigned i = 0; i < 4; ++i) {
5793 FieldTypes[i],
nullptr,
5798 CFConstantStringTagDecl->
addDecl(Field);
5805 CFConstantStringTypeDecl =
5809 return CFConstantStringTypeDecl;
5813 if (!CFConstantStringTagDecl)
5815 return CFConstantStringTagDecl;
5824 if (ObjCSuperType.
isNull()) {
5826 TUDecl->
addDecl(ObjCSuperTypeDecl);
5829 return ObjCSuperType;
5834 assert(TD &&
"Invalid CFConstantStringType");
5835 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
5838 assert(TagType &&
"Invalid CFConstantStringType");
5839 CFConstantStringTagDecl = TagType->getDecl();
5843 if (BlockDescriptorType)
5856 static const char *
const FieldNames[] = {
5861 for (
size_t i = 0; i < 2; ++i) {
5864 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
5872 BlockDescriptorType = RD;
5878 if (BlockDescriptorExtendedType)
5893 static const char *
const FieldNames[] = {
5900 for (
size_t i = 0; i < 4; ++i) {
5903 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
5912 BlockDescriptorExtendedType = RD;
5920 if (isa<PipeType>(T))
5926 switch (BT->getKind()) {
5927 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 5928 case BuiltinType::Id: \ 5929 return TargetInfo::OCLTK_Image; 5930 #include "clang/Basic/OpenCLImageTypes.def" 5932 case BuiltinType::OCLClkEvent:
5935 case BuiltinType::OCLEvent:
5938 case BuiltinType::OCLQueue:
5941 case BuiltinType::OCLReserveID:
5944 case BuiltinType::OCLSampler:
5963 if (!copyExpr && record->hasTrivialDestructor())
return false;
5991 llvm_unreachable(
"impossible");
5993 llvm_unreachable(
"fell out of lifetime switch!");
6001 bool &HasByrefExtendedLayout)
const {
6006 HasByrefExtendedLayout =
false;
6008 HasByrefExtendedLayout =
true;
6022 if (!ObjCInstanceTypeDecl)
6023 ObjCInstanceTypeDecl =
6025 return ObjCInstanceTypeDecl;
6031 if (
const auto *TT = dyn_cast<TypedefType>(T))
6033 return II->isStr(
"BOOL");
6069 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
6075 if (D->getLexicalDeclContext()->isFileContext() &&
6076 !D->isInlineSpecified() && (D->isConstexpr() ||
First->isConstexpr()))
6112 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
6121 ParmOffset = PtrSize;
6123 QualType PType = PVDecl->getOriginalType();
6124 if (
const auto *AT =
6128 if (!isa<ConstantArrayType>(AT))
6129 PType = PVDecl->getType();
6131 PType = PVDecl->getType();
6158 "getObjCEncodingForFunctionDecl - Incomplete param type");
6166 QualType PType = PVDecl->getOriginalType();
6167 if (
const auto *AT =
6171 if (!isa<ConstantArrayType>(AT))
6172 PType = PVDecl->getType();
6174 PType = PVDecl->getType();
6188 bool Extended)
const {
6192 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
6203 bool Extended)
const {
6224 "getObjCEncodingForMethodDecl - Incomplete param type");
6232 ParmOffset = 2 * PtrSize;
6237 if (
const auto *AT =
6241 if (!isa<ConstantArrayType>(AT))
6246 PType, S, Extended);
6257 const Decl *Container)
const {
6260 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
6261 for (
auto *PID : CID->property_impls())
6262 if (PID->getPropertyDecl() == PD)
6265 const auto *OID = cast<ObjCImplementationDecl>(Container);
6266 for (
auto *PID : OID->property_impls())
6267 if (PID->getPropertyDecl() == PD)
6300 const Decl *Container)
const {
6302 bool Dynamic =
false;
6310 SynthesizePID = PropertyImpDecl;
6314 std::string S =
"T";
6356 if (SynthesizePID) {
6371 if (isa<TypedefType>(PointeeTy.
getTypePtr())) {
6373 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
6376 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
6389 getObjCEncodingForTypeImpl(T, S,
true,
true, Field,
6390 true ,
false,
false,
6391 false,
false,
false, NotEncodedT);
6395 std::string& S)
const {
6399 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
6407 case BuiltinType::Void:
return 'v';
6408 case BuiltinType::Bool:
return 'B';
6409 case BuiltinType::Char8:
6410 case BuiltinType::Char_U:
6411 case BuiltinType::UChar:
return 'C';
6412 case BuiltinType::Char16:
6413 case BuiltinType::UShort:
return 'S';
6414 case BuiltinType::Char32:
6415 case BuiltinType::UInt:
return 'I';
6416 case BuiltinType::ULong:
6418 case BuiltinType::UInt128:
return 'T';
6419 case BuiltinType::ULongLong:
return 'Q';
6420 case BuiltinType::Char_S:
6421 case BuiltinType::SChar:
return 'c';
6422 case BuiltinType::Short:
return 's';
6423 case BuiltinType::WChar_S:
6424 case BuiltinType::WChar_U:
6425 case BuiltinType::Int:
return 'i';
6426 case BuiltinType::Long:
6428 case BuiltinType::LongLong:
return 'q';
6429 case BuiltinType::Int128:
return 't';
6430 case BuiltinType::Float:
return 'f';
6431 case BuiltinType::Double:
return 'd';
6432 case BuiltinType::LongDouble:
return 'D';
6433 case BuiltinType::NullPtr:
return '*';
6435 case BuiltinType::Float16:
6436 case BuiltinType::Float128:
6437 case BuiltinType::Half:
6438 case BuiltinType::ShortAccum:
6439 case BuiltinType::Accum:
6440 case BuiltinType::LongAccum:
6441 case BuiltinType::UShortAccum:
6442 case BuiltinType::UAccum:
6443 case BuiltinType::ULongAccum:
6444 case BuiltinType::ShortFract:
6445 case BuiltinType::Fract:
6446 case BuiltinType::LongFract:
6447 case BuiltinType::UShortFract:
6448 case BuiltinType::UFract:
6449 case BuiltinType::ULongFract:
6450 case BuiltinType::SatShortAccum:
6451 case BuiltinType::SatAccum:
6452 case BuiltinType::SatLongAccum:
6453 case BuiltinType::SatUShortAccum:
6454 case BuiltinType::SatUAccum:
6455 case BuiltinType::SatULongAccum:
6456 case BuiltinType::SatShortFract:
6457 case BuiltinType::SatFract:
6458 case BuiltinType::SatLongFract:
6459 case BuiltinType::SatUShortFract:
6460 case BuiltinType::SatUFract:
6461 case BuiltinType::SatULongFract:
6465 case BuiltinType::ObjCId:
6466 case BuiltinType::ObjCClass:
6467 case BuiltinType::ObjCSel:
6468 llvm_unreachable(
"@encoding ObjC primitive type");
6471 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6472 case BuiltinType::Id: 6473 #include "clang/Basic/OpenCLImageTypes.def" 6474 case BuiltinType::OCLEvent:
6475 case BuiltinType::OCLClkEvent:
6476 case BuiltinType::OCLQueue:
6477 case BuiltinType::OCLReserveID:
6478 case BuiltinType::OCLSampler:
6479 case BuiltinType::Dependent:
6480 #define BUILTIN_TYPE(KIND, ID) 6481 #define PLACEHOLDER_TYPE(KIND, ID) \ 6482 case BuiltinType::KIND: 6483 #include "clang/AST/BuiltinTypes.def" 6484 llvm_unreachable(
"invalid builtin type for @encode");
6486 llvm_unreachable(
"invalid BuiltinType::Kind value");
6503 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
6523 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
6532 S += llvm::utostr(Offset);
6545 void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string& S,
6546 bool ExpandPointedToStructures,
6547 bool ExpandStructures,
6550 bool EncodingProperty,
6552 bool EncodeBlockParameters,
6553 bool EncodeClassNames,
6554 bool EncodePointerToObjCTypedef,
6557 switch (CT->getTypeClass()) {
6562 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
6568 case Type::Complex: {
6571 getObjCEncodingForTypeImpl(CT->getElementType(), S,
false,
false,
nullptr);
6575 case Type::Atomic: {
6578 getObjCEncodingForTypeImpl(AT->getValueType(), S,
false,
false,
nullptr);
6584 case Type::LValueReference:
6585 case Type::RValueReference: {
6587 if (isa<PointerType>(CT)) {
6589 if (PT->isObjCSelType()) {
6598 bool isReadOnly =
false;
6608 }
else if (OutermostType) {
6621 if (StringRef(S).endswith(
"nr"))
6622 S.replace(S.end()-2, S.end(),
"rn");
6634 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
6639 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
6648 getObjCEncodingForTypeImpl(PointeeTy, S,
false, ExpandPointedToStructures,
6649 nullptr,
false,
false,
false,
false,
false,
false,
6654 case Type::ConstantArray:
6655 case Type::IncompleteArray:
6656 case Type::VariableArray: {
6657 const auto *AT = cast<ArrayType>(CT);
6659 if (isa<IncompleteArrayType>(AT) && !StructField) {
6663 getObjCEncodingForTypeImpl(AT->getElementType(), S,
6664 false, ExpandStructures, FD);
6668 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
6669 S += llvm::utostr(CAT->getSize().getZExtValue());
6672 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
6673 "Unknown array type!");
6677 getObjCEncodingForTypeImpl(AT->getElementType(), S,
6678 false, ExpandStructures, FD,
6679 false,
false,
false,
false,
false,
false,
6686 case Type::FunctionNoProto:
6687 case Type::FunctionProto:
6691 case Type::Record: {
6692 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
6693 S += RDecl->
isUnion() ?
'(' :
'{';
6697 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
6699 llvm::raw_string_ostream OS(S);
6706 if (ExpandStructures) {
6709 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
6711 for (
const auto *Field : RDecl->
fields()) {
6714 S += Field->getNameAsString();
6719 if (Field->isBitField()) {
6720 getObjCEncodingForTypeImpl(Field->getType(), S,
false,
true,
6725 getObjCEncodingForTypeImpl(qt, S,
false,
true,
6729 false,
false,
false, NotEncodedT);
6734 S += RDecl->
isUnion() ?
')' :
'}';
6738 case Type::BlockPointer: {
6741 if (EncodeBlockParameters) {
6746 getObjCEncodingForTypeImpl(
6747 FT->getReturnType(), S, ExpandPointedToStructures, ExpandStructures,
6748 FD,
false , EncodingProperty,
6749 false , EncodeBlockParameters, EncodeClassNames,
false,
6754 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
6755 for (
const auto &I : FPT->param_types())
6756 getObjCEncodingForTypeImpl(
6757 I, S, ExpandPointedToStructures, ExpandStructures, FD,
6758 false , EncodingProperty,
6759 false , EncodeBlockParameters, EncodeClassNames,
6760 false, NotEncodedT);
6767 case Type::ObjCObject: {
6771 S +=
"{objc_object=}";
6775 S +=
"{objc_class=}";
6782 case Type::ObjCInterface: {
6788 if (ExpandStructures) {
6792 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
6795 getObjCEncodingForTypeImpl(Field->
getType(), S,
false,
true, Field);
6797 getObjCEncodingForTypeImpl(Field->
getType(), S,
false,
true, FD,
6798 false,
false,
false,
false,
false,
6799 EncodePointerToObjCTypedef,
6807 case Type::ObjCObjectPointer: {
6809 if (OPT->isObjCIdType()) {
6814 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
6822 if (OPT->isObjCQualifiedIdType()) {
6824 ExpandPointedToStructures,
6825 ExpandStructures, FD);
6826 if (FD || EncodingProperty || EncodeClassNames) {
6830 for (
const auto *I : OPT->quals()) {
6832 S += I->getObjCRuntimeNameAsString();
6841 if (!EncodingProperty &&
6843 !EncodePointerToObjCTypedef) {
6848 if (FD && OPT->getInterfaceDecl()) {
6853 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
6854 if (Ivars[i] == FD) {
6862 getObjCEncodingForTypeImpl(PointeeTy, S,
6863 false, ExpandPointedToStructures,
6865 false,
false,
false,
false,
false,
6871 if (OPT->getInterfaceDecl() &&
6872 (FD || EncodingProperty || EncodeClassNames)) {
6874 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
6875 for (
const auto *I : OPT->quals()) {
6877 S += I->getObjCRuntimeNameAsString();
6887 case Type::MemberPointer:
6891 case Type::ExtVector:
6900 case Type::DeducedTemplateSpecialization:
6904 #define ABSTRACT_TYPE(KIND, BASE) 6905 #define TYPE(KIND, BASE) 6906 #define DEPENDENT_TYPE(KIND, BASE) \ 6908 #define NON_CANONICAL_TYPE(KIND, BASE) \ 6910 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \ 6912 #include "clang/AST/TypeNodes.def" 6913 llvm_unreachable(
"@encode for dependent type!");
6915 llvm_unreachable(
"bad type kind!");
6918 void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
6923 assert(RDecl &&
"Expected non-null RecordDecl");
6924 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
6929 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
6933 for (
const auto &BI : CXXRec->bases()) {
6934 if (!BI.isVirtual()) {
6939 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6940 std::make_pair(offs, base));
6946 for (
auto *Field : RDecl->
fields()) {
6948 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6949 std::make_pair(offs, Field));
6953 if (CXXRec && includeVBases) {
6954 for (
const auto &BI : CXXRec->vbases()) {
6960 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
6961 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
6962 std::make_pair(offs, base));
6974 uint64_t CurOffs = 0;
6976 std::multimap<uint64_t, NamedDecl *>::iterator
6977 CurLayObj = FieldOrBaseOffsets.begin();
6979 if (CXXRec && CXXRec->isDynamicClass() &&
6980 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
6983 std::string recname = CXXRec->getNameAsString();
6984 if (recname.empty()) recname =
"?";
6996 uint64_t offs =
toBits(size);
6997 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6998 std::make_pair(offs,
nullptr));
7001 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
7003 assert(CurOffs <= CurLayObj->first);
7004 if (CurOffs < CurLayObj->first) {
7005 uint64_t padding = CurLayObj->first - CurOffs;
7021 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
7026 getObjCEncodingForStructureImpl(base, S, FD,
false,
7028 assert(!base->isEmpty());
7033 const auto *field = cast<FieldDecl>(dcl);
7036 S += field->getNameAsString();
7040 if (field->isBitField()) {
7043 CurOffs += field->getBitWidthValue(*
this);
7048 getObjCEncodingForTypeImpl(qt, S,
false,
true, FD,
7052 false,
false,
false, NotEncodedT);
7062 std::string& S)
const {
7095 if (!ObjCClassDecl) {
7100 return ObjCClassDecl;
7104 if (!ObjCProtocolClassDecl) {
7105 ObjCProtocolClassDecl
7114 return ObjCProtocolClassDecl;
7160 const size_t NumFields = 5;
7162 const char *FieldNames[NumFields];
7166 FieldNames[0] =
"__stack";
7170 FieldNames[1] =
"__gr_top";
7174 FieldNames[2] =
"__vr_top";
7177 FieldTypes[3] = Context->
IntTy;
7178 FieldNames[3] =
"__gr_offs";
7181 FieldTypes[4] = Context->
IntTy;
7182 FieldNames[4] =
"__vr_offs";
7185 for (
unsigned i = 0; i < NumFields; ++i) {
7191 FieldTypes[i],
nullptr,
7196 VaListTagDecl->
addDecl(Field);
7213 const size_t NumFields = 5;
7215 const char *FieldNames[NumFields];
7219 FieldNames[0] =
"gpr";
7223 FieldNames[1] =
"fpr";
7227 FieldNames[2] =
"reserved";
7231 FieldNames[3] =
"overflow_arg_area";
7235 FieldNames[4] =
"reg_save_area";
7238 for (
unsigned i = 0; i < NumFields; ++i) {
7243 FieldTypes[i],
nullptr,
7248 VaListTagDecl->
addDecl(Field);
7276 const size_t NumFields = 4;
7278 const char *FieldNames[NumFields];
7282 FieldNames[0] =
"gp_offset";
7286 FieldNames[1] =
"fp_offset";
7290 FieldNames[2] =
"overflow_arg_area";
7294 FieldNames[3] =
"reg_save_area";
7297 for (
unsigned i = 0; i < NumFields; ++i) {
7303 FieldTypes[i],
nullptr,
7308 VaListTagDecl->
addDecl(Field);
7379 const size_t NumFields = 4;
7381 const char *FieldNames[NumFields];
7384 FieldTypes[0] = Context->
LongTy;
7385 FieldNames[0] =
"__gpr";
7388 FieldTypes[1] = Context->
LongTy;
7389 FieldNames[1] =
"__fpr";
7393 FieldNames[2] =
"__overflow_arg_area";
7397 FieldNames[3] =
"__reg_save_area";
7400 for (
unsigned i = 0; i < NumFields; ++i) {
7406 FieldTypes[i],
nullptr,
7411 VaListTagDecl->
addDecl(Field);
7448 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
7452 if (!BuiltinVaListDecl) {
7457 return BuiltinVaListDecl;
7470 if (!BuiltinMSVaListDecl)
7473 return BuiltinMSVaListDecl;
7481 assert(ObjCConstantStringType.
isNull() &&
7482 "'NSConstantString' type already set!");
7492 unsigned size = End -
Begin;
7493 assert(size > 1 &&
"set is not overloaded!");
7502 assert(isa<FunctionTemplateDecl>(D) ||
7503 isa<UnresolvedUsingValueDecl>(D) ||
7504 (isa<UsingShadowDecl>(D) &&
7516 bool TemplateKeyword,
7518 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
7521 llvm::FoldingSetNodeID
ID;
7524 void *InsertPos =
nullptr;
7526 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7530 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
7542 "Nested name specifier must be dependent");
7544 llvm::FoldingSetNodeID
ID;
7547 void *InsertPos =
nullptr;
7549 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7555 if (CanonNNS == NNS) {
7563 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7564 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
7568 DependentTemplateNames.InsertNode(QTN, InsertPos);
7578 "Nested name specifier must be dependent");
7580 llvm::FoldingSetNodeID
ID;
7583 void *InsertPos =
nullptr;
7585 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7591 if (CanonNNS == NNS) {
7600 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7601 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
7605 DependentTemplateNames.InsertNode(QTN, InsertPos);
7612 llvm::FoldingSetNodeID
ID;
7615 void *insertPos =
nullptr;
7617 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
7621 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
7630 auto &Self =
const_cast<ASTContext &
>(*this);
7631 llvm::FoldingSetNodeID
ID;
7634 void *InsertPos =
nullptr;
7636 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
7642 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
7666 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
7696 while (
const auto *AT = dyn_cast<ArrayType>(CT))
7697 CT = AT->getElementType();
7719 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
7720 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
7763 assert((lhsQID && rhsOPT) &&
"ObjCQualifiedClassTypesAreCompatible");
7765 for (
auto *lhsProto : lhsQID->quals()) {
7767 for (
auto *rhsProto : rhsOPT->
quals()) {
7794 if (!rhsOPT)
return false;
7796 if (rhsOPT->qual_empty()) {
7800 for (
auto *I : lhsQID->quals()) {
7804 if (!rhsID->ClassImplementsProtocol(I,
true))
7812 for (
auto *lhsProto : lhsQID->quals()) {
7818 for (
auto *rhsProto : rhsOPT->quals()) {
7828 for (
auto *I : lhsQID->quals()) {
7832 if (rhsID->ClassImplementsProtocol(I,
true)) {
7846 assert(rhsQID &&
"One of the LHS/RHS should be id<x>");
7851 for (
auto *lhsProto : lhsOPT->quals()) {
7859 for (
auto *rhsProto : rhsQID->
quals()) {
7873 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSInheritedProtocols;
7878 if (LHSInheritedProtocols.empty() && lhsOPT->qual_empty())
7880 for (
auto *lhsProto : LHSInheritedProtocols) {
7882 for (
auto *rhsProto : rhsQID->
quals()) {
7913 auto finish = [&](
bool succeeded) ->
bool {
7953 bool BlockReturnType) {
7957 auto finish = [&](
bool succeeded) ->
bool {
7991 return finish(BlockReturnType);
7993 return finish(!BlockReturnType);
8005 return (*lhs)->getName().compare((*rhs)->getName());
8022 assert(LHS->
getInterface() &&
"LHS must have an interface base");
8023 assert(RHS->
getInterface() &&
"RHS must have an interface base");
8026 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSProtocolSet;
8029 for (
auto proto : LHS->
quals()) {
8037 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> RHSProtocolSet;
8040 for (
auto proto : RHS->
quals()) {
8048 for (
auto proto : LHSProtocolSet) {
8049 if (RHSProtocolSet.count(proto))
8050 IntersectionSet.push_back(proto);
8055 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ImpliedProtocols;
8059 if (!ImpliedProtocols.empty()) {
8060 IntersectionSet.erase(
8061 std::remove_if(IntersectionSet.begin(),
8062 IntersectionSet.end(),
8064 return ImpliedProtocols.count(proto) > 0;
8066 IntersectionSet.end());
8070 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
8080 if (lhsOPT && rhsOPT)
8086 if (lhsBlock && rhsBlock)
8091 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
8104 if (lhsArgs.size() != rhsArgs.size())
8108 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
8115 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
8116 rhsArgs[i].stripObjCKindOfType(ctx))) {
8144 if (!LDecl || !RDecl)
8154 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
8164 bool anyChanges =
false;
8182 if (!Protocols.empty())
8200 if (LHSSuperType.
isNull())
8210 if (KnownLHS != LHSAncestors.end()) {
8211 LHS = KnownLHS->second;
8215 bool anyChanges =
false;
8233 if (!Protocols.empty())
8250 if (RHSSuperType.
isNull())
8261 assert(LHS->
getInterface() &&
"LHS is not an interface type");
8262 assert(RHS->
getInterface() &&
"RHS is not an interface type");
8279 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> SuperClassInheritedProtocols;
8283 for (
auto *RHSPI : RHS->
quals())
8286 if (SuperClassInheritedProtocols.empty())
8289 for (
const auto *LHSProto : LHS->
quals()) {
8290 bool SuperImplementsProtocol =
false;
8291 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
8292 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
8293 SuperImplementsProtocol =
true;
8296 if (!SuperImplementsProtocol)
8326 if (!LHSOPT || !RHSOPT)
8344 bool CompareUnqualified) {
8363 bool OfBlockPointer,
8367 if (UD->
hasAttr<TransparentUnionAttr>()) {
8368 for (
const auto *I : UD->
fields()) {
8369 QualType ET = I->getType().getUnqualifiedType();
8383 bool OfBlockPointer,
8398 return mergeTypes(lhs, rhs, OfBlockPointer, Unqualified);
8402 bool OfBlockPointer,
8408 bool allLTypes =
true;
8409 bool allRTypes =
true;
8413 if (OfBlockPointer) {
8415 QualType LHS = lbase->getReturnType();
8416 bool UnqualifiedResult = Unqualified;
8417 if (!UnqualifiedResult)
8419 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
8476 if (lproto && rproto) {
8477 assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
8478 "C++ shouldn't be here");
8480 if (lproto->getNumParams() != rproto->getNumParams())
8484 if (lproto->isVariadic() != rproto->isVariadic())
8491 bool canUseLeft, canUseRight;
8503 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
8504 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
8505 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
8507 lParamType, rParamType, OfBlockPointer, Unqualified);
8514 types.push_back(paramType);
8526 if (allLTypes)
return lhs;
8527 if (allRTypes)
return rhs;
8532 newParamInfos.empty() ? nullptr : newParamInfos.data();
8536 if (lproto) allRTypes =
false;
8537 if (rproto) allLTypes =
false;
8549 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
8555 paramTy = Enum->getDecl()->getIntegerType();
8565 if (allLTypes)
return lhs;
8566 if (allRTypes)
return rhs;
8573 if (allLTypes)
return lhs;
8574 if (allRTypes)
return rhs;
8580 QualType other,
bool isBlockReturnType) {
8586 if (underlyingType.
isNull())
8601 bool OfBlockPointer,
8602 bool Unqualified,
bool BlockReturnType) {
8620 if (LHSCan == RHSCan)
8625 Qualifiers RQuals = RHSCan.getLocalQualifiers();
8626 if (LQuals != RQuals) {
8642 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
8663 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
8664 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
8667 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
8668 LHSClass = Type::ConstantArray;
8669 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
8670 RHSClass = Type::ConstantArray;
8673 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
8674 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
8677 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
8678 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
8681 if (LHSClass != RHSClass) {
8691 if (OfBlockPointer && !BlockReturnType) {
8703 #define TYPE(Class, Base) 8704 #define ABSTRACT_TYPE(Class, Base) 8705 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: 8706 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 8707 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 8708 #include "clang/AST/TypeNodes.def" 8709 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
8712 case Type::DeducedTemplateSpecialization:
8713 case Type::LValueReference:
8714 case Type::RValueReference:
8715 case Type::MemberPointer:
8716 llvm_unreachable(
"C++ should never be in mergeTypes");
8718 case Type::ObjCInterface:
8719 case Type::IncompleteArray:
8720 case Type::VariableArray:
8721 case Type::FunctionProto:
8722 case Type::ExtVector:
8723 llvm_unreachable(
"Types are eliminated above");
8744 case Type::BlockPointer:
8769 if (ResultType.isNull())
8796 case Type::ConstantArray:
8822 -> std::pair<bool,llvm::APInt> {
8824 llvm::APSInt TheInt;
8827 return std::make_pair(
true, TheInt);
8829 return std::make_pair(
false, TheInt);
8831 return std::make_pair(
true, CAT->getSize());
8833 return std::make_pair(
false, llvm::APInt());
8837 bool HaveLSize, HaveRSize;
8838 llvm::APInt LSize, RSize;
8839 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
8840 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
8841 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
8874 case Type::FunctionNoProto:
8891 case Type::ObjCObject: {
8902 case Type::ObjCObjectPointer:
8903 if (OfBlockPointer) {
8917 assert(LHS != RHS &&
8918 "Equivalent pipe types should have already been handled!");
8922 llvm_unreachable(
"Invalid Type::Class!");
8927 bool &CanUseFirst,
bool &CanUseSecond,
8929 assert(NewParamInfos.empty() &&
"param info list not empty");
8930 CanUseFirst = CanUseSecond =
true;
8936 if (!FirstHasInfo && !SecondHasInfo)
8939 bool NeedParamInfo =
false;
8943 for (
size_t I = 0; I < E; ++I) {
8954 bool FirstNoEscape = FirstParam.
isNoEscape();
8955 bool SecondNoEscape = SecondParam.
isNoEscape();
8956 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
8958 if (NewParamInfos.back().getOpaqueValue())
8959 NeedParamInfo =
true;
8960 if (FirstNoEscape != IsNoEscape)
8961 CanUseFirst =
false;
8962 if (SecondNoEscape != IsNoEscape)
8963 CanUseSecond =
false;
8967 NewParamInfos.clear();
8973 ObjCLayouts[CD] =
nullptr;
8983 if (LHSCan == RHSCan)
8985 if (RHSCan->isFunctionType()) {
8989 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
8991 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
8994 if (ResReturnType.
isNull())
8996 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
9000 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
9013 Qualifiers RQuals = RHSCan.getLocalQualifiers();
9014 if (LQuals != RQuals) {
9027 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
9043 if (ResQT == LHSBaseQT)
9045 if (ResQT == RHSBaseQT)
9057 T = ET->getDecl()->getIntegerType();
9071 VTy->getNumElements(), VTy->getVectorKind());
9075 T = ETy->getDecl()->getIntegerType();
9078 assert(BTy &&
"Unexpected signed integer or fixed point type");
9079 switch (BTy->getKind()) {
9080 case BuiltinType::Char_S:
9081 case BuiltinType::SChar:
9083 case BuiltinType::Short:
9085 case BuiltinType::Int:
9087 case BuiltinType::Long:
9089 case BuiltinType::LongLong:
9091 case BuiltinType::Int128:
9094 case BuiltinType::ShortAccum:
9096 case BuiltinType::Accum:
9098 case BuiltinType::LongAccum:
9100 case BuiltinType::SatShortAccum:
9102 case BuiltinType::SatAccum:
9104 case BuiltinType::SatLongAccum:
9106 case BuiltinType::ShortFract:
9108 case BuiltinType::Fract:
9110 case BuiltinType::LongFract:
9112 case BuiltinType::SatShortFract:
9114 case BuiltinType::SatFract:
9116 case BuiltinType::SatLongFract:
9119 llvm_unreachable(
"Unexpected signed integer or fixed point type");
9143 bool AllowTypeModifiers) {
9146 bool Signed =
false, Unsigned =
false;
9147 RequiresICE =
false;
9152 bool IsSpecialLong =
false;
9156 default: Done =
true; --Str;
break;
9161 assert(!Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
9162 assert(!Signed &&
"Can't use 'S' modifier multiple times!");
9166 assert(!Signed &&
"Can't use both 'S' and 'U' modifiers!");
9167 assert(!Unsigned &&
"Can't use 'U' modifier multiple times!");
9171 assert(!IsSpecialLong &&
"Can't use 'L' with 'W' or 'N' modifiers");
9172 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
9177 assert(!IsSpecialLong &&
"Can't use two 'N' or 'W' modifiers!");
9178 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
9180 IsSpecialLong =
true;
9187 assert(!IsSpecialLong &&
"Can't use two 'N' or 'W' modifiers!");
9188 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
9190 IsSpecialLong =
true;
9194 llvm_unreachable(
"Unexpected integer type");
9210 default: llvm_unreachable(
"Unknown builtin type letter!");
9212 assert(HowLong == 0 && !Signed && !Unsigned &&
9213 "Bad modifiers used with 'v'!");
9217 assert(HowLong == 0 && !Signed && !Unsigned &&
9218 "Bad modifiers used with 'h'!");
9222 assert(HowLong == 0 && !Signed && !Unsigned &&
9223 "Bad modifiers used with 'f'!");
9227 assert(HowLong < 3 && !Signed && !Unsigned &&
9228 "Bad modifiers used with 'd'!");
9231 else if (HowLong == 2)
9237 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
9246 else if (HowLong == 2)
9248 else if (HowLong == 1)
9254 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
9263 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'b'!");
9267 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'z'!");
9271 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'w'!");
9288 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9300 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9308 unsigned NumElements = strtoul(Str, &End, 10);
9309 assert(End != Str &&
"Missing vector size");
9313 RequiresICE,
false);
9314 assert(!RequiresICE &&
"Can't require vector ICE");
9324 unsigned NumElements = strtoul(Str, &End, 10);
9325 assert(End != Str &&
"Missing vector size");
9337 assert(!RequiresICE &&
"Can't require complex ICE");
9363 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'K'!");
9377 Done = !AllowTypeModifiers;
9379 switch (
char c = *Str++) {
9380 default: Done =
true; --Str;
break;
9386 unsigned AddrSpace = strtoul(Str, &End, 10);
9387 if (End != Str && AddrSpace != 0) {
9412 "Integer constant 'I' type must be an integer");
9420 unsigned *IntegerConstantArgs)
const {
9425 bool RequiresICE =
false;
9432 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
9434 while (TypeStr[0] && TypeStr[0] !=
'.') {
9441 if (RequiresICE && IntegerConstantArgs)
9442 *IntegerConstantArgs |= 1 << ArgTypes.size();
9448 ArgTypes.push_back(Ty);
9451 if (Id == Builtin::BI__GetExceptionInfo)
9454 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
9455 "'.' should only occur at end of builtin type list!");
9460 bool Variadic = (TypeStr[0] ==
'.');
9463 if (ArgTypes.empty() && Variadic && !
getLangOpts().CPlusPlus)
9483 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD))
9484 if (!MD->isUserProvided())
9516 !FD->
hasAttr<DLLExportAttr>()) ||
9517 FD->
hasAttr<GNUInlineAttr>()) {
9542 if (D->
hasAttr<DLLImportAttr>()) {
9545 }
else if (D->
hasAttr<DLLExportAttr>()) {
9549 D->
hasAttr<CUDAGlobalAttr>()) {
9596 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
9601 if (!LexicalContext)
9606 auto StaticLocalLinkage =
9618 return StaticLocalLinkage;
9645 return StrongLinkage;
9663 llvm_unreachable(
"Invalid Linkage!");
9673 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
9674 if (!VD->isFileVarDecl())
9679 if (VD->getDescribedVarTemplate() ||
9680 isa<VarTemplatePartialSpecializationDecl>(VD))
9682 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
9686 }
else if (isa<PragmaCommentDecl>(D))
9688 else if (isa<OMPThreadPrivateDecl>(D))
9690 else if (isa<PragmaDetectMismatchDecl>(D))
9692 else if (isa<OMPThreadPrivateDecl>(D))
9694 else if (isa<OMPDeclareReductionDecl>(D))
9696 else if (isa<ImportDecl>(D))
9701 if (D->
isFromASTFile() && !LangOpts.BuildingPCHWithObjectFile) {
9716 isa<FunctionDecl>(D) &&
9717 cast<FunctionDecl>(D)->getTemplateSpecializationKind() ==
9729 if (D->
hasAttr<WeakRefAttr>())
9736 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
9738 if (!FD->doesThisDeclarationHaveABody())
9739 return FD->doesDeclarationForceExternallyVisibleDefinition();
9742 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
9748 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
9766 const auto *VD = cast<VarDecl>(D);
9767 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
9783 if (VD->getType().isDestructedType())
9787 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
9789 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
9794 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
9795 for (
const auto *BD : DD->bindings())
9796 if (
const auto *BindingVD = BD->getHoldingVar())
9802 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
9803 return *Res != OMPDeclareTargetDeclAttr::MT_Link;
9811 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
9812 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
9814 for (
auto *CurDecl :
9818 std::end(SeenDecls) == llvm::find(SeenDecls, CurFD)) {
9819 SeenDecls.insert(CurFD);
9826 bool IsCXXMethod)
const {
9829 return ABI->getDefaultMethodCallConv(IsVariadic);
9831 switch (LangOpts.getDefaultCallingConv()) {
9860 return ABI->isNearlyEmpty(RD);
9864 if (!VTContext.get()) {
9870 return VTContext.get();
9887 llvm_unreachable(
"Unsupported ABI");
9893 return ASTRecordLayouts.getMemorySize() +
9894 llvm::capacity_in_bytes(ObjCLayouts) +
9895 llvm::capacity_in_bytes(KeyFunctions) +
9896 llvm::capacity_in_bytes(ObjCImpls) +
9897 llvm::capacity_in_bytes(BlockVarCopyInits) +
9898 llvm::capacity_in_bytes(DeclAttrs) +
9899 llvm::capacity_in_bytes(TemplateOrInstantiation) +
9900 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
9901 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
9902 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
9903 llvm::capacity_in_bytes(OverriddenMethods) +
9904 llvm::capacity_in_bytes(Types) +
9905 llvm::capacity_in_bytes(VariableArrayTypes) +
9906 llvm::capacity_in_bytes(ClassScopeSpecializationPattern);
9914 unsigned Signed)
const {
9917 if (!QualTy && DestWidth == 128)
9940 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
9945 MangleNumbers[ND] = Number;
9949 auto I = MangleNumbers.find(ND);
9950 return I != MangleNumbers.end() ? I->second : 1;
9955 StaticLocalNumbers[VD] = Number;
9959 auto I = StaticLocalNumbers.find(VD);
9960 return I != StaticLocalNumbers.end() ? I->second : 1;
9965 assert(LangOpts.CPlusPlus);
9966 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
9972 std::unique_ptr<MangleNumberingContext>
9974 return ABI->createMangleNumberingContext();
9979 return ABI->getCopyConstructorForExceptionObject(
9985 return ABI->addCopyConstructorForExceptionObject(
9992 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
9997 return ABI->getTypedefNameForUnnamedTagDecl(TD);
10002 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
10006 return ABI->getDeclaratorForUnnamedTagDecl(TD);
10010 ParamIndices[D] = index;
10014 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
10015 assert(I != ParamIndices.end() &&
10016 "ParmIndices lacks entry set by ParmVarDecl");
10024 "don't need to cache the computed value for this temporary");
10026 APValue *&MTVI = MaterializedTemporaryValues[E];
10032 return MaterializedTemporaryValues.lookup(E);
10037 if (!T.isOSDarwin())
10040 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
10041 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
10050 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
10054 ASTContext::ParentMapPointers::mapped_type U) {
10055 if (
const auto *D = U.dyn_cast<
const Decl *>())
10057 if (
const auto *S = U.dyn_cast<
const Stmt *>())
10066 template <
typename T>
10097 ParentMapASTVisitor Visitor(
new ASTContext::ParentMapPointers,
10099 Visitor.TraverseDecl(&TU);
10100 return std::make_pair(Visitor.Parents, Visitor.OtherParents);
10108 ParentMapASTVisitor(ASTContext::ParentMapPointers *Parents,
10110 : Parents(Parents), OtherParents(OtherParents) {}
10112 bool shouldVisitTemplateInstantiations()
const {
10116 bool shouldVisitImplicitCode()
const {
10120 template <
typename T,
typename MapNodeTy,
typename BaseTraverseFn,
10122 bool TraverseNode(T Node, MapNodeTy MapNode,
10123 BaseTraverseFn BaseTraverse,
MapTy *Parents) {
10126 if (ParentStack.size() > 0) {
10137 auto &NodeOrVector = (*Parents)[MapNode];
10138 if (NodeOrVector.isNull()) {
10139 if (
const auto *D = ParentStack.back().get<Decl>())
10141 else if (
const auto *S = ParentStack.back().get<
Stmt>())
10147 if (!NodeOrVector.template is<ASTContext::ParentVector *>()) {
10150 delete NodeOrVector
10152 NodeOrVector = Vector;
10156 NodeOrVector.template get<ASTContext::ParentVector *>();
10162 std::find(Vector->begin(), Vector->end(),
10163 ParentStack.back()) != Vector->end();
10165 Vector->push_back(ParentStack.back());
10168 ParentStack.push_back(createDynTypedNode(Node));
10169 bool Result = BaseTraverse();
10170 ParentStack.pop_back();
10174 bool TraverseDecl(Decl *DeclNode) {
10175 return TraverseNode(DeclNode, DeclNode,
10176 [&] {
return VisitorBase::TraverseDecl(DeclNode); },
10180 bool TraverseStmt(
Stmt *StmtNode) {
10181 return TraverseNode(StmtNode, StmtNode,
10182 [&] {
return VisitorBase::TraverseStmt(StmtNode); },
10186 bool TraverseTypeLoc(
TypeLoc TypeLocNode) {
10187 return TraverseNode(
10189 [&] {
return VisitorBase::TraverseTypeLoc(TypeLocNode); },
10194 return TraverseNode(
10197 return VisitorBase::TraverseNestedNameSpecifierLoc(NNSLocNode);
10202 ASTContext::ParentMapPointers *Parents;
10209 template <
typename NodeTy,
typename MapTy>
10211 const MapTy &Map) {
10212 auto I = Map.find(Node);
10213 if (I == Map.end()) {
10216 if (
const auto *V =
10217 I->second.template dyn_cast<ASTContext::ParentVector *>()) {
10218 return llvm::makeArrayRef(*V);
10225 if (!PointerParents) {
10229 PointerParents.reset(Maps.first);
10230 OtherParents.reset(Maps.second);
10241 if (MethodDecl->
hasAttr<UnavailableAttr>()
10242 || MethodDecl->
hasAttr<DeprecatedAttr>())
10256 IM != EM && IF != EF; ++IM, ++IF) {
10282 return (*AddrSpaceMap)[(unsigned)AS];
10291 switch (BT->getKind()) {
10293 llvm_unreachable(
"Not a fixed point type!");
10294 case BuiltinType::ShortAccum:
10296 case BuiltinType::Accum:
10298 case BuiltinType::LongAccum:
10300 case BuiltinType::UShortAccum:
10302 case BuiltinType::UAccum:
10304 case BuiltinType::ULongAccum:
10306 case BuiltinType::ShortFract:
10308 case BuiltinType::Fract:
10310 case BuiltinType::LongFract:
10312 case BuiltinType::UShortFract:
10314 case BuiltinType::UFract:
10316 case BuiltinType::ULongFract:
10335 switch (BT->getKind()) {
10337 llvm_unreachable(
"Not a fixed point type!");
10338 case BuiltinType::ShortAccum:
10339 case BuiltinType::SatShortAccum:
10340 return Target.getShortAccumScale();
10341 case BuiltinType::Accum:
10342 case BuiltinType::SatAccum:
10343 return Target.getAccumScale();
10344 case BuiltinType::LongAccum:
10345 case BuiltinType::SatLongAccum:
10346 return Target.getLongAccumScale();
10347 case BuiltinType::UShortAccum:
10348 case BuiltinType::SatUShortAccum:
10349 return Target.getUnsignedShortAccumScale();
10350 case BuiltinType::UAccum:
10351 case BuiltinType::SatUAccum:
10352 return Target.getUnsignedAccumScale();
10353 case BuiltinType::ULongAccum:
10354 case BuiltinType::SatULongAccum:
10355 return Target.getUnsignedLongAccumScale();
10356 case BuiltinType::ShortFract:
10357 case BuiltinType::SatShortFract:
10358 return Target.getShortFractScale();
10359 case BuiltinType::Fract:
10360 case BuiltinType::SatFract:
10361 return Target.getFractScale();
10362 case BuiltinType::LongFract:
10363 case BuiltinType::SatLongFract:
10364 return Target.getLongFractScale();
10365 case BuiltinType::UShortFract:
10366 case BuiltinType::SatUShortFract:
10367 return Target.getUnsignedShortFractScale();
10368 case BuiltinType::UFract:
10369 case BuiltinType::SatUFract:
10370 return Target.getUnsignedFractScale();
10371 case BuiltinType::ULongFract:
10372 case BuiltinType::SatULongFract:
10373 return Target.getUnsignedLongFractScale();
10382 switch (BT->getKind()) {
10384 llvm_unreachable(
"Not a fixed point type!");
10385 case BuiltinType::ShortAccum:
10386 case BuiltinType::SatShortAccum:
10387 return Target.getShortAccumIBits();
10388 case BuiltinType::Accum:
10389 case BuiltinType::SatAccum:
10390 return Target.getAccumIBits();
10391 case BuiltinType::LongAccum:
10392 case BuiltinType::SatLongAccum:
10393 return Target.getLongAccumIBits();
10394 case BuiltinType::UShortAccum:
10395 case BuiltinType::SatUShortAccum:
10396 return Target.getUnsignedShortAccumIBits();
10397 case BuiltinType::UAccum:
10398 case BuiltinType::SatUAccum:
10399 return Target.getUnsignedAccumIBits();
10400 case BuiltinType::ULongAccum:
10401 case BuiltinType::SatULongAccum:
10402 return Target.getUnsignedLongAccumIBits();
10403 case BuiltinType::ShortFract:
10404 case BuiltinType::SatShortFract:
10405 case BuiltinType::Fract:
10406 case BuiltinType::SatFract:
10407 case BuiltinType::LongFract:
10408 case BuiltinType::SatLongFract:
10409 case BuiltinType::UShortFract:
10410 case BuiltinType::SatUShortFract:
10411 case BuiltinType::UFract:
10412 case BuiltinType::SatUFract:
10413 case BuiltinType::ULongFract:
10414 case BuiltinType::SatULongFract:
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=TTK_Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
Internal representation of canonical, dependent typeof(expr) types.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
static bool canAssignObjCObjectTypes(ASTContext &ctx, QualType lhs, QualType rhs)
Determine whether the first type is a subtype of the second.
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
CanQualType SatShortAccumTy
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
static void EncodeBitField(const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
CanQualType SatUnsignedLongFractTy
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Defines the clang::ASTContext interface.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
const BlockDecl * getBlockDecl() const
bool hasDefinition() const
Determine whether this class has been defined.
The generic AArch64 ABI is also a modified version of the Itanium ABI, but it has fewer divergences t...
static ast_type_traits::DynTypedNode getSingleDynTypedNodeFromParentMap(ASTContext::ParentMapPointers::mapped_type U)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
ASTMutationListener * Listener
IntType getInt64Type() const
unsigned getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of 'half'.
QualType withConst() const
Retrieves a version of this type with const applied.
const Type * Ty
The locally-unqualified type.
static bool isTypeTypedefedAsBOOL(QualType T)
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
static const Decl * getCanonicalDecl(const Decl *D)
void setImplicit(bool I=true)
Represents a function declaration or definition.
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 ...
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
unsigned getLongFractAlign() const
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
SplitQualType split() const
no exception specification
unsigned char getFixedPointIBits(QualType Ty) const
QualType getObjCIdType() const
Represents the Objective-CC id type.
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
TypedefDecl * getCFConstantStringDecl() const
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
PointerType - C99 6.7.5.1 - Pointer Declarators.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
CanQualType LongDoubleComplexTy
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
QualType getPointeeType() const
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
The iOS 64-bit ABI is follows ARM's published 64-bit ABI more closely, but we don't guarantee to foll...
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
bool isBlockPointerType() const
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool getNoCfCheck() const
bool isMemberPointerType() const
bool canBuiltinBeRedeclared(const FunctionDecl *) const
Return whether a declaration to a builtin is allowed to be overloaded/redeclared. ...
unsigned param_size() const
unsigned char getFixedPointScale(QualType Ty) const
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins)
CanQualType UnsignedLongFractTy
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
unsigned getBoolWidth() const
Return the size of '_Bool' and C++ 'bool' for this target, in bits.
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target...
InlineVariableDefinitionKind
static unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built...
ObjCIvarDecl * getPropertyIvarDecl() const
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
void Profile(llvm::FoldingSetNodeID &ID) const
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
static unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
unsigned getMaxVectorAlign() const
Return the maximum vector alignment supported for the given target.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
Stmt - This represents one statement.
void setLAngleLoc(SourceLocation Loc)
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
FunctionType - C99 6.7.5.3 - Function Declarators.
unsigned getLargeArrayAlign() const
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getFloat128Align() const
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type...
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
bool isRealFloatingType() const
Floating point categories.
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
Represents the declaration of a typedef-name via the 'typedef' type specifier.
C Language Family Type Representation.
unsigned getLongAlign() const
Defines the SourceManager interface.
void Profile(llvm::FoldingSetNodeID &ID)
CharUnits getAlignOfGlobalVarInChars(QualType T) const
Return the alignment in characters that should be given to a global variable with type T...
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
static unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
Represents a qualified type name for which the type name is dependent.
static TypedefDecl * CreateSystemZBuiltinVaListDecl(const ASTContext *Context)
The template argument is an expression, and we've not resolved it to one of the other forms yet...
void Profile(llvm::FoldingSetNodeID &ID)
bool isRecordType() const
unsigned getTypeAlignIfKnown(QualType T) const
Return the ABI-specified alignment of a type, in bits, or 0 if the type is incomplete and we cannot d...
CanQualType FloatComplexTy
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
RawCommentList Comments
All comments in this translation unit.
const T * get() const
Retrieve the stored node as type T.
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getEnumType(const EnumDecl *Decl) const
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
const Type * getTypeForDecl() const
Decl - This represents one declaration (or definition), e.g.
EnumDecl * getPreviousDecl()
CanQualType ObjCBuiltinSelTy
bool isDiscardableGVALinkage(GVALinkage L)
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type.
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
Defines types useful for describing an Objective-C runtime.
unsigned getFractWidth() const
getFractWidth/Align - Return the size of 'signed _Fract' and 'unsigned _Fract' for this target...
QualType getDependentVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc, VectorType::VectorKind VecKind) const
Return the unique reference to the type for a dependently sized vector of the specified element type...
CanQualType ARCUnbridgedCastTy
const RecordDecl * getParent() const
Returns the parent of this field declaration, which is the struct in which this field is defined...
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
The base class of the type hierarchy.
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...
CanQualType SatUnsignedAccumTy
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
static bool areSortedAndUniqued(ArrayRef< ObjCProtocolDecl *> Protocols)
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
DiagnosticsEngine & getDiagnostics() const
virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const
Get address space for OpenCL type.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getCorrespondingUnsignedType(QualType T) const
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
void Profile(llvm::FoldingSetNodeID &ID)
Represent a C++ namespace.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
void Profile(llvm::FoldingSetNodeID &ID)
virtual void completeDefinition()
Note that the definition of this type is now complete.
bool isZero() const
isZero - Test whether the quantity equals zero.
QualType withConst() const
const TargetInfo & getTargetInfo() const
QualType adjustStringLiteralBaseType(QualType StrLTy) const
A container of type source information.
llvm::DenseMap< Stmt *, Stmt * > MapTy
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl *> &Redeclared)
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
const Expr * getRequiresClause() const
Get the constraint-expression from the associated requires-clause (if any)
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
param_const_iterator param_end() const
unsigned getCharWidth() const
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
A template template parameter that has been substituted for some other template name.
ExtParameterInfo withIsNoEscape(bool NoEscape) const
QualType getElementType() const
unsigned getLargeArrayMinWidth() const
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
An identifier, stored as an IdentifierInfo*.
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
unsigned getDepth() const
Get the nesting depth of the template parameter.
static const Type * getIntegerTypeForEnum(const EnumType *ET)
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one...
const RawComment * getRaw() const LLVM_READONLY
Represents a variable declaration or definition.
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
void removeObjCLifetime()
QualType getReturnType() const
LangAS getLangASFromTargetAS(unsigned TargetAS)
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
RecordDecl * getPreviousDecl()
llvm::SmallVector< ast_type_traits::DynTypedNode, 2 > ParentVector
Contains parents of a node.
unsigned getNumParams() const
bool isEnumeralType() const
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
const T * getAs() const
Member-template getAs<specific type>'.
void setClassScopeSpecializationPattern(FunctionDecl *FD, FunctionDecl *Pattern)
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration...
MangleContext * createMangleContext()
unsigned getCharAlign() const
Represents an empty template argument, e.g., one that has not been deduced.
Extra information about a function prototype.
unsigned getWCharAlign() const
Declaration context for names declared as extern "C" in C++.
const llvm::fltSemantics & getHalfFormat() const
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Represents a C++17 deduced template specialization type.
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
ObjCMethodDecl - Represents an instance or class method declaration.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or nullptr if none exists.
A namespace, stored as a NamespaceDecl*.
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 ...
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class...
void setRaw(const RawComment *RC)
bool isInvalidDecl() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
static ObjCPropertyDecl * findPropertyDecl(const DeclContext *DC, const IdentifierInfo *propertyID, ObjCPropertyQueryKind queryKind)
Lookup a property by name in the specified DeclContext.
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
Describes how types, statements, expressions, and declarations should be printed. ...
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
protocol_range protocols() const
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Defines the clang::Expr interface and subclasses for C++ expressions.
unsigned getAccumAlign() const
QualType getIntegralType() const
Retrieve the type of the integral value.
noexcept(expression), value-dependent
static TypedefDecl * CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context)
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
The collection of all-type qualifiers we support.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
bool UnwrapSimilarTypes(QualType &T1, QualType &T2)
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
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...
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers getQualifiers() const
Retrieve all qualifiers.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Base wrapper for a particular "section" of type source info.
Represents a struct/union/class.
unsigned getLongDoubleAlign() const
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
RecordDecl * getCFConstantStringTagDecl() const
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement) const
Retrieve a substitution-result type.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
FunctionType::ExtInfo ExtInfo
bool isComplete() const
Returns true if this can be considered a complete type.
One of these records is kept for each identifier that is lexed.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool isObjCQualifiedClass() const
This table allows us to fully hide how we implement multi-keyword caching.
unsigned getIntAlign() const
unsigned getRegParm() const
IntType getUnsignedPtrDiffType(unsigned AddrSpace) const
Represents a class type in Objective C.
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
QualType getPointeeType() const
void setManglingNumber(const NamedDecl *ND, unsigned Number)
CXXRecordDecl * getPreviousDecl()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
const ParmVarDecl *const * param_const_iterator
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
Missing a type from <ucontext.h>
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
CanQualType UnsignedFractTy
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
unsigned getChar32Width() const
getChar32Width/Align - Return the size of 'char32_t' for this target, in bits.
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
field_range fields() const
static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context, const Decl *D, GVALinkage L)
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
bool isObjCIdType() const
The generic Mips ABI is a modified version of the Itanium ABI.
Represents a member of a struct/union/class.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
DynTypedNodeList getParents(const NodeT &Node)
Returns the parents of the given node.
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
unsigned getStaticLocalNumber(const VarDecl *VD) const
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
void addLazyModuleInitializers(Module *M, ArrayRef< uint32_t > IDs)
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template...
void startDefinition()
Starts the definition of this tag declaration.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
CharUnits getTypeUnadjustedAlignInChars(QualType T) const
getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type, in characters, before alignment adjustments.
The iterator over UnresolvedSets.
Represents the result of substituting a set of types for a template type parameter pack...
IntType getSizeType() const
Container for either a single DynTypedNode or for an ArrayRef to DynTypedNode.
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
qual_iterator qual_begin() const
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache...
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
CanQualType OCLReserveIDTy
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
TemplateName getReplacement() const
void Profile(llvm::FoldingSetNodeID &ID)
static TypedefDecl * CreateCharPtrNamedVaListDecl(const ASTContext *Context, StringRef Name)
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
QualType getParamTypeForDecl() const
Describes a module or submodule.
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
ArrayRef< ParmVarDecl * > parameters() const
bool getProducesResult() const
QualType mergeObjCGCQualifiers(QualType, QualType)
mergeObjCGCQualifiers - This routine merges ObjC's GC attribute of 'LHS' and 'RHS' attributes and ret...
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
void Profile(llvm::FoldingSetNodeID &ID)
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
An rvalue reference type, per C++11 [dcl.ref].
bool isBitField() const
Determines whether this field is a bitfield.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
qual_iterator qual_end() const
A qualified template name, where the qualification is kept to describe the source code as written...
unsigned getAlignOfGlobalVar(QualType T) const
Return the alignment in bits that should be given to a global variable with type T.
static bool unionHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD)
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
const LangASMap & getAddressSpaceMap() const
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
static llvm::Optional< int64_t > structHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD)
ObjCContainerDecl - Represents a container for method declarations.
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
QualType getOriginalType() const
void addObjCGCAttr(GC type)
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
CharUnits - This is an opaque type for sizes expressed in character units.
Microsoft throw(...) extension.
A convenient class for passing around template argument information.
CanQualType SatShortFractTy
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers).
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
bool hasAddressSpace() const
CanQualType SatUnsignedShortAccumTy
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
PropertyAttributeKind getPropertyAttributes() const
unsigned toTargetAddressSpace(LangAS AS)
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
Concrete class used by the front-end to report problems and issues.
Represents a typeof (or typeof) expression (a GCC extension).
const clang::PrintingPolicy & getPrintingPolicy() const
static const Decl * adjustDeclToTemplate(const Decl *D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
Represents a declaration of a type.
CanQualType PseudoObjectTy
LangAS getAddressSpace() const
QualType getExceptionObjectType(QualType T) const
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
const Type * getClass() const
CXXMethodVector::const_iterator overridden_cxx_method_iterator
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
unsigned getShortWidth() const
Return the size of 'signed short' and 'unsigned short' for this target, in bits.
void Profile(llvm::FoldingSetNodeID &ID)
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
Expr * IgnoreParenCasts() LLVM_READONLY
IgnoreParenCasts - Ignore parentheses and casts.
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
Expr * getSizeExpr() const
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
unsigned getChar16Align() const
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
unsigned getBitWidthValue(const ASTContext &Ctx) const
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
unsigned getFractAlign() const
Defines the Linkage enumeration and various utility functions.
DiagnosticsEngine & getDiagnostics() const
Represents an Objective-C protocol declaration.
static unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built...
TemplateTemplateParmDecl * getParameter() const
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...
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
ASTNodeKind getNodeKind() const
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
void * getAsOpaquePtr() const
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
unsigned getTypeUnadjustedAlign(QualType T) const
Return the ABI-specified natural alignment of a (complete) type T, before alignment adjustments...
Represents an ObjC class declaration.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs, typeofs, etc., as well as any qualifiers.
QualType getReturnType() const
unsigned getLongLongAlign() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
bool isKindOfType() const
Whether this is a "__kindof" type.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SplitQualType getSplitDesugaredType() const
unsigned getNumArgs() const
The iOS ABI is a partial implementation of the ARM ABI.
IntrusiveRefCntPtr< ExternalASTSource > ExternalSource
CanQualType UnsignedCharTy
Expr * getSizeExpr() const
bool getNoCallerSavedRegs() const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
static char getObjCEncodingForPrimitiveKind(const ASTContext *C, BuiltinType::Kind kind)
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
Represents an extended vector type where either the type or size is dependent.
This object can be modified without requiring retains or releases.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
void Profile(llvm::FoldingSetNodeID &ID)
static bool isCanonicalResultType(QualType T)
Determine whether T is canonical as the result type of a function.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
CanQualType Float128ComplexTy
unsigned getTypeQuals() const
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Expr * getAddrSpaceExpr() const
Provides definitions for the various language-specific address spaces.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getBlockDescriptorExtendedType() const
Gets the struct used to keep track of the extended descriptor for pointer to blocks.
QualType getBaseType() const
Gets the base type of this object type.
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
QualType getCorrespondingSaturatedType(QualType Ty) const
unsigned getMinGlobalAlign() const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
void Profile(llvm::FoldingSetNodeID &ID)
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
The generic ARM ABI is a modified version of the Itanium ABI proposed by ARM for use on ARM-based pla...
bool isDynamicClass() const
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl *> protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
const llvm::fltSemantics & getDoubleFormat() const
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
static unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
Represents a ValueDecl that came out of a declarator.
A dependent template name that has not been resolved to a template (or set of templates).
DeclarationNameTable DeclarationNames
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type...
bool UnwrapSimilarArrayTypes(QualType &T1, QualType &T2)
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
void setCFConstantStringType(QualType T)
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169...
CanQualType UnsignedAccumTy
void Profile(llvm::FoldingSetNodeID &ID)
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl *> &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized, ivars in super class and then collects all ivars, including those synthesized for current class.
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
const llvm::fltSemantics & getLongDoubleFormat() const
typedef void* __builtin_va_list;
bool hasPointerIdentity() const
Check if the given ASTNodeKind identifies a type that offers pointer identity.
CanQualType UnsignedShortFractTy
Exposes information about the current target.
Represents an array type in C++ whose size is a value-dependent expression.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting...
CommentOptions CommentOpts
Options for parsing comments.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
unsigned getShortFractAlign() const
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Expr - This represents one expression.
Defines the clang::LangOptions interface.
IntType getSignedSizeType() const
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
known_extensions_range known_extensions() const
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
Selector getSetterName() const
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
static const LangASMap * getAddressSpaceMap(const TargetInfo &T, const LangOptions &LOpts)
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
unsigned getAsOpaqueValue() const
void ResetObjCLayout(const ObjCContainerDecl *CD)
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
static std::pair< CharUnits, CharUnits > getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
getConstantArrayInfoInChars - Performing the computation in CharUnits instead of in bits prevents ove...
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target, in bits.
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) const
Declaration of a template type parameter.
Internal representation of canonical, dependent decltype(expr) types.
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
Implements an efficient mapping from strings to IdentifierInfo nodes.
bool getHasRegParm() const
bool isObjCBuiltinType() const
const T * castAs() const
Member-template castAs<specific type>.
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
bool isNearlyEmpty(const CXXRecordDecl *RD) const
bool isObjCRetainableType() const
QualType getTypeOfExprType(Expr *e) const
GCC extension.
unsigned getShortAccumWidth() const
getShortAccumWidth/Align - Return the size of 'signed short _Accum' and 'unsigned short _Accum' for t...
void Profile(llvm::FoldingSetNodeID &ID)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
QualType getParenType(QualType NamedType) const
CanQualType OMPArraySectionTy
static TypedefDecl * CreateX86_64ABIBuiltinVaListDecl(const ASTContext *Context)
static unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
bool hasUniqueObjectRepresentations(QualType Ty) const
Return true if the specified type has unique object representations according to (C++17 [meta...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
static std::string charUnitsToString(const CharUnits &CU)
void Profile(llvm::FoldingSetNodeID &ID)
bool isNullPtrType() const
unsigned getFastQualifiers() const
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
unsigned getAccumWidth() const
getAccumWidth/Align - Return the size of 'signed _Accum' and 'unsigned _Accum' for this target...
ObjCLifetime getObjCLifetime() const
void removeFastQualifiers(unsigned mask)
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
bool isObjCClassType() const
void Profile(llvm::FoldingSetNodeID &ID)
DeclContext * getDeclContext()
A structure for storing the information associated with a substituted template template parameter...
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
ObjCInterfaceDecl * getSuperClass() const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
void Profile(llvm::FoldingSetNodeID &ID)
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
internal::Matcher< T > id(StringRef ID, const internal::BindableMatcher< T > &InnerMatcher)
If the provided matcher matches a node, binds the node to ID.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack...
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
static TypedefDecl * CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context)
unsigned getLongAccumWidth() const
getLongAccumWidth/Align - Return the size of 'signed long _Accum' and 'unsigned long _Accum' for this...
QualType getFILEType() const
Retrieve the C FILE type.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
Defines the clang::TypeLoc interface and its subclasses.
A namespace alias, stored as a NamespaceAliasDecl*.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
CanQualType UnsignedInt128Ty
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
void Profile(llvm::FoldingSetNodeID &ID)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists...
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
clang::ObjCRuntime ObjCRuntime
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
Qualifiers Quals
The local qualifiers.
unsigned getMaxAlignment() const
getMaxAlignment - return the maximum alignment specified by attributes on this decl, 0 if there are none.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
void setAddressSpace(LangAS space)
unsigned getShortAlign() const
Return the alignment of 'signed short' and 'unsigned short' for this target.
QualType getRecordType(const RecordDecl *Decl) const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
QualType getFunctionTypeWithExceptionSpec(QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI)
Get a function type and produce the equivalent function type with the specified exception specificati...
bool isInstanceMethod() const
QualType getBlockDescriptorType() const
Gets the struct used to keep track of the descriptor for pointer to blocks.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a GCC generic vector type.
struct CXXOpName CXXOperatorName
An lvalue reference type, per C++11 [dcl.ref].
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
QualType getSubstTemplateTypeParmPackType(const TemplateTypeParmType *Replaced, const TemplateArgument &ArgPack)
Retrieve a.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
CanQualType SatLongAccumTy
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Implements C++ ABI-specific semantic analysis functions.
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
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...
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it...
unsigned getDoubleAlign() const
Selector getSelector() const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
bool ObjCQualifiedClassTypesAreCompatible(QualType LHS, QualType RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>. ...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
A type, stored as a Type*.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
void removeCVRQualifiers(unsigned mask)
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
IntType getUIntMaxType() const
void setOriginalDecl(const Decl *Orig)
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool isSignedFixedPointType() const
Return true if this is a fixed point type that is signed according to ISO/IEC JTC1 SC22 WG14 N1169...
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
virtual bool allowsLargerPreferedTypeAlignment() const
Whether target allows to overalign ABI-specified preferred alignment.
ExtInfo withNoReturn(bool noReturn) const
std::pair< CharUnits, CharUnits > getTypeInfoDataSizeInChars(QualType T) const
WatchOS is a modernisation of the iOS ABI, which roughly means it's the iOS64 ABI ported to 32-bits...
bool isVoidPointerType() const
bool isConstQualified() const
Determine whether this type is const-qualified.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent) const
C++11 deduced auto type.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
unsigned getWCharWidth() const
getWCharWidth/Align - Return the size of 'wchar_t' for this target, in bits.
noexcept(expression), evals to 'false'
unsigned getLongAccumAlign() const
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
Abstract interface for external sources of AST nodes.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
SourceLocation getLocStart() const LLVM_READONLY
QualType getWideCharType() const
Return the type of wide characters.
IntType getPtrDiffType(unsigned AddrSpace) const
A template template parameter pack that has been substituted for a template template argument pack...
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
There is no lifetime qualification on this type.
static unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
std::string getAsString() const
Derive the full selector name (e.g.
is AltiVec 'vector Pixel'
This declaration does not have an attached comment, and we have searched the redeclaration chain...
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
SelectorTable & Selectors
Assigning into this object requires the old value to be released and the new value to be retained...
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
QualType getCanonicalType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
not a target-specific vector type
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
ExceptionSpecificationType Type
The kind of exception specification this is.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
Expr * getBlockVarCopyInits(const VarDecl *VD)
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
ExtParameterInfo getExtParameterInfo(unsigned I) const
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ExtProtoInfo getExtProtoInfo() const
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
const ExtParameterInfo * ExtParameterInfos
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
void AddDeallocation(void(*Callback)(void *), void *Data)
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
Sugar for parentheses used when specifying types.
QualType getReturnType() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
bool hasSameTemplateName(TemplateName X, TemplateName Y)
Determine whether the given template names refer to the same template.
unsigned getShortAccumAlign() const
LangAS getAddressSpace() const
Return the address space of this type.
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
CanQualType UnsignedLongAccumTy
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
This names the __make_integer_seq BuiltinTemplateDecl.
unsigned getManglingNumber(const NamedDecl *ND) const
A structure for storing an already-substituted template template parameter pack.
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...
static unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built...
Kind getKind() const LLVM_READONLY
Represents the declaration of a struct/union/class/enum.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
unsigned getChar16Width() const
getChar16Width/Align - Return the size of 'char16_t' for this target, in bits.
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of 'signed long long' and 'unsigned long long' for this targ...
CallingConv getCC() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getElementType() const
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
Represents a vector type where either the type or size is dependent.
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class...
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Represents a static or instance method of a struct/union/class.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
const ConstantArrayType * getAsConstantArrayType(QualType T) const
IntType getIntMaxType() const
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
Weak for now, might become strong later in this TU.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid=nullptr) const
Given a SourceLocation, return the spelling line number for the position indicated.
unsigned getFloat128Width() const
getFloat128Width/Align/Format - Return the size/align/format of '__float128'.
This file defines OpenMP nodes for declarative directives.
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
CanQualType SatUnsignedLongAccumTy
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
ObjCCategoryDecl - Represents a category declaration.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
unsigned getHalfAlign() const
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
CanQualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t. ...
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl *> protocols, QualType Canonical=QualType()) const
bool isObjCObjectPointerType() const
bool isAnyPointerType() const
CanQualType SatLongFractTy
This declaration is only a declaration.
is AltiVec 'vector bool ...'
virtual BuiltinVaListKind getBuiltinVaListKind() const =0
Returns the kind of __builtin_va_list type that should be used with this target.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Represents one property declaration in an Objective-C interface.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
bool canBindObjCObjectType(QualType To, QualType From)
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
We have found a comment attached to this particular declaration.
The generic Itanium ABI is the standard ABI of most open-source and Unix-like platforms.
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl *> &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
void InitBuiltinTypes(const TargetInfo &Target, const TargetInfo *AuxTarget=nullptr)
Initialize built-in types.
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
Qualifiers getIndexTypeQualifiers() const
TypeClass getTypeClass() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool typesAreBlockPointerCompatible(QualType, QualType)
CharUnits getDataSize() const
getDataSize() - Get the record data size, which is the record size without tail padding, in characters.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
ObjCDeclQualifier getObjCDeclQualifier() const
bool isTargetAddressSpace(LangAS AS)
EnumDecl * getDecl() const
bool isVectorType() const
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
FunctionDecl * getClassScopeSpecializationPattern(const FunctionDecl *FD)
Assigning into this object requires a lifetime extension.
CanQualType SatUnsignedFractTy
unsigned getPreferredTypeAlign(const Type *T) const
Return the "preferred" alignment of the specified type T for the current target, in bits...
ObjCImplementationDecl * getImplementation() const
llvm::DenseMap< const Decl *, RawCommentAndCacheFlags > RedeclComments
Mapping from declarations to comments attached to any redeclaration.
static DynTypedNode create(const T &Node)
Creates a DynTypedNode from Node.
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
CanQualType SatUnsignedShortFractTy
bool hasFlexibleArrayMember() const
unsigned getLongDoubleWidth() const
getLongDoubleWidth/Align/Format - Return the size/align/format of 'long double'.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
void Profile(llvm::FoldingSetNodeID &ID)
CharUnits getUnadjustedAlignment() const
getUnadjustedAlignment - Get the record alignment in characters, before alignment adjustement...
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a pointer type decayed from an array or function type.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
The WebAssembly ABI is a modified version of the Itanium ABI.
The injected class name of a C++ class template or class template partial specialization.
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
Represents a pack expansion of types.
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
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.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
ast_type_traits::DynTypedNode DynTypedNode
Defines various enumerations that describe declaration and type specifiers.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
void setTemplateKeywordLoc(SourceLocation Loc)
void * Allocate(size_t Size, unsigned Align=8) const
ObjCDeclQualifier getObjCDeclQualifier() const
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
const llvm::fltSemantics & getFloat128Format() const
CanQualType UnsignedShortTy
ObjCIvarDecl * getNextIvar()
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod) const
Retrieves the default calling convention for the current target.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Canon=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
bool propertyTypesAreCompatible(QualType, QualType)
Represents a template argument.
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...
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
IntType
===-— Target Data Type Query Methods ----------------------------—===//
QualType withRestrict() const
Represents a template name that was expressed as a qualified name.
TagTypeKind
The kind of a tag type.
RealType getRealTypeByWidth(unsigned BitWidth) const
Return floating point type with specified width.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getTypeOfType(QualType t) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
const ObjCInterfaceDecl * getClassInterface() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
CanQualType ObjCBuiltinIdTy
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
Dataflow Directional Tag Classes.
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i...
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list...
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
CharUnits getSize() const
getSize - Get the record size in characters.
ExtInfo getExtInfo() const
TargetInfo::OpenCLTypeKind getOpenCLTypeKind(const Type *T) const
Map an AST Type to an OpenCLTypeKind enum value.
not evaluated yet, for special member function
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
A qualifier set is used to build a set of qualifiers.
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
void forEachMultiversionedFunctionVersion(const FunctionDecl *FD, llvm::function_ref< void(FunctionDecl *)> Pred) const
Visits all versions of a multiversioned function with the passed predicate.
bool isSentinelNullExpr(const Expr *E)
The base class of all kinds of template declarations (e.g., class, function, etc.).
CanQualType DoubleComplexTy
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...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
typedef char* __builtin_va_list;
static FloatingRank getFloatingRank(QualType T)
getFloatingRank - Return a relative rank for floating point types.
CanQualType UnsignedShortAccumTy
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
The template argument is a pack expansion of a template name that was provided for a template templat...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
unsigned[(unsigned) LangAS::FirstTargetAddressSpace] LangASMap
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
static bool areCompatVectorTypes(const VectorType *LHS, const VectorType *RHS)
areCompatVectorTypes - Return true if the two specified vector types are compatible.
QualType getUnderlyingType() const
CanQualType UnsignedLongLongTy
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
bool hasCvrSimilarType(QualType T1, QualType T2)
Determine if two types are similar, ignoring only CVR qualifiers.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
This template specialization was instantiated from a template due to an explicit instantiation declar...
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>.
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
void Profile(llvm::FoldingSetNodeID &ID)
DeclarationName - The name of a declaration.
VectorKind getVectorKind() const
Represents the declaration of an Objective-C type parameter.
bool isBooleanType() const
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
const CXXRecordDecl * getBaseSharingVBPtr() const
Represents a C++11 pack expansion that produces a sequence of expressions.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
static ASTContext::DynTypedNodeList getDynNodeFromMap(const NodeTy &Node, const MapTy &Map)
void Profile(llvm::FoldingSetNodeID &ID)
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
void Profile(llvm::FoldingSetNodeID &ID)
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return true if this expression is a valid integer constant expression...
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
virtual ~ASTMutationListener()
This names the __type_pack_element BuiltinTemplateDecl.
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
canAssignObjCInterfacesInBlockPointer - This routine is specifically written for providing type-safet...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool hasObjCLifetime() const
QualType AutoRRefDeductTy
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
A type that was preceded by the 'template' keyword, stored as a Type*.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
unsigned getShortFractWidth() const
getShortFractWidth/Align - Return the size of 'signed short _Fract' and 'unsigned short _Fract' for t...
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
void Profile(llvm::FoldingSetNodeID &ID)
static unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
bool isObjCUnqualifiedIdOrClass() const
GVALinkage GetGVALinkageForVariable(const VarDecl *VD)
A dynamically typed AST node container.
const Decl * getOriginalDecl() const LLVM_READONLY
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
Represents a pointer to an Objective C object.
CanQualType ObjCBuiltinBoolTy
unsigned getLongFractWidth() const
getLongFractWidth/Align - Return the size of 'signed long _Fract' and 'unsigned long _Fract' for this...
unsigned getIntWidth(QualType T) const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArrayType::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...
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
Loading virtual member pointers using the virtual inheritance model always results in an adjustment u...
virtual ExtKind hasExternalDefinitions(const Decl *D)
bool isIncompleteArrayType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
BuiltinTemplateDecl * getTypePackElementDecl() const
bool isMacroArgExpansion(SourceLocation Loc, SourceLocation *StartLoc=nullptr) const
Tests whether the given source location represents a macro argument's expansion into the function-lik...
bool isObjCQualifiedId() const
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
QualType getCanonicalTypeInternal() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
This template specialization was declared or defined by an explicit specialization (C++ [temp...
CanQualType UnsignedLongTy
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 Profile(llvm::FoldingSetNodeID &ID)
const llvm::APInt & getSize() const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize, QualType typeDomain) const
Return a real floating point or a complex type (based on typeDomain/typeSize).
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.
bool isFunctionType() const
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated...
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if this address space is a superset of the other one.
unsigned getBoolAlign() const
Return the alignment of '_Bool' and C++ 'bool' for this target.
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
bool isObjCQualifiedIdType() const
static char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
TypeSourceInfo * getTypeSourceInfo() const
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required...
ExtVectorType - Extended vector type.
CanQualType ObjCBuiltinClassTy
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
param_const_iterator param_begin() const
Base for LValueReferenceType and RValueReferenceType.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
CanQualType BoundMemberTy
static TypedefDecl * CreateCharPtrBuiltinVaListDecl(const ASTContext *Context)
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
The template argument is a type.
void addDecl(Decl *D)
Add the declaration D into this context.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl)
void setBlockVarCopyInits(VarDecl *VD, Expr *Init)
Set the copy inialization expression of a block var decl.
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
The template argument is actually a parameter pack.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const
Gets the default calling convention for the given target and declaration context. ...
bool isObjCObjectType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
bool hasObjCGCAttr() const
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
A template argument list.
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
BuiltinTemplateDecl * buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, const IdentifierInfo *II) const
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
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...
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
unsigned getFloatAlign() const
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
Reading or writing from this object requires a barrier call.
ExternCContextDecl * getExternCContextDecl() const
bool hasSimilarType(QualType T1, QualType T2)
Determine if two types are similar, according to the C++ rules.
ArgKind getKind() const
Return the kind of stored template argument.
An attributed type is a type to which a type attribute has been applied.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
QualType getParamType(unsigned i) const
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...
Represents a type parameter type in Objective C.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
TranslationUnitDecl * getTranslationUnitDecl() const
Defines the clang::SourceLocation class and associated facilities.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool hasUnaligned() const
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.
llvm::DenseMap< const void *, llvm::PointerUnion4< const Decl *, const Stmt *, ast_type_traits::DynTypedNode *, ParentVector * > > ParentMapPointers
Maps from a node to its parents.
void addModuleInitializer(Module *M, Decl *Init)
Add a declaration to the list of declarations that are initialized for a module.
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...
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g., it is an signed integer type or a vector.
Represents a C++ struct/union/class.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
IdentifierInfo * getTypePackElementName() const
Represents a template specialization type whose template cannot be resolved, e.g. ...
const llvm::fltSemantics & getFloatFormat() const
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
The template argument is a template name that was provided for a template template parameter...
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
Represents a C array with an unspecified size.
VTableContextBase * getVTableContext()
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
Missing a type from <stdio.h>
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
static TranslationUnitDecl * Create(ASTContext &C)
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl *> &Protocols)
IdentifierInfo * getMakeIntegerSeqName() const
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...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
ObjCIvarDecl - Represents an ObjC instance variable.
static int compare(DeclarationName LHS, DeclarationName RHS)
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
Provides information a specialization of a member of a class template, which may be a member function...
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
A structure for storing the information associated with an overloaded template name.
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...
We searched for a comment attached to the particular declaration, but didn't find any...
static unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
Builtin::Context & BuiltinInfo
Weak definition of inline variable.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a class template.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type...
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
param_const_iterator sel_param_end() const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
uint64_t getPointerAlign(unsigned AddrSpace) const
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
Defines the clang::TargetInfo interface.
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U)
Determine whether two function types are the same, ignoring exception specifications in cases where t...
unsigned getSimdDefaultAlign() const
Return default simd alignment for the given target.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
void setRAngleLoc(SourceLocation Loc)
unsigned getCVRQualifiers() const
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
SourceLocation getLAngleLoc() const
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated, or computed.
const VariableArrayType * getAsVariableArrayType(QualType T) const
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
__DEVICE__ int max(int __a, int __b)
static Decl::Kind getKind(const Decl *D)
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
unsigned getNumElements() const
IntType getIntPtrType() const
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
static bool NeedsInjectedClassNameType(const RecordDecl *D)
The top declaration context.
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
QualType getRealTypeForBitwidth(unsigned DestWidth) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
QualType getAsType() const
Retrieve the type for a type template argument.
A reference to a declared variable, function, enum, etc.
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
Represents an extended address space qualifier where the input address space value is dependent...
Represents a type template specialization; the template must be a class template, a type alias templa...
ArrayRef< ParmVarDecl * > parameters() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
GVALinkage
A more specific kind of linkage than enum Linkage.
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
bool isPointerType() const
llvm::DenseMap< ast_type_traits::DynTypedNode, llvm::PointerUnion4< const Decl *, const Stmt *, ast_type_traits::DynTypedNode *, ParentVector * > > ParentMapOtherNodes
Parent map for nodes without pointer identity.
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types ...
__DEVICE__ int min(int __a, int __b)
void addAddressSpace(LangAS space)
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
bool isStaticDataMember() const
Determines whether this is a static data member.
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
A set of overloaded template declarations.
unsigned getChar32Align() const
A trivial tuple used to represent a source range.
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
This represents a decl that may have a name.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
void setAccess(AccessSpecifier AS)
Represents a C array with a specified size that is not an integer-constant-expression.
void setTemplateNameLoc(SourceLocation Loc)
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
No keyword precedes the qualified type name.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
bool isInline() const
Whether this variable is (C++1z) inline.
void Profile(llvm::FoldingSetNodeID &ID)
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
unsigned getTargetAddressSpace(QualType T) const
Selector getGetterName() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
SourceLocation getRAngleLoc() const
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
The global specifier '::'. There is no stored value.
static bool isStructEmpty(QualType Ty)
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Missing a type from <setjmp.h>
void setType(QualType newType)
void removeAddressSpace()
IntType getProcessIDType() const
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
const LangOptions & getLangOpts() const
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
Represents the canonical version of C arrays with a specified constant size.
This class handles loading and caching of source files into memory.
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
Defines enum values for all the target-independent builtin functions.
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
Declaration of a template function.
const void * getMemoizationData() const
Returns a pointer that identifies the stored AST node.
A class which abstracts out some details necessary for making a call.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
SourceLocation getLocation() const
QualType getPointeeType() const
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
bool isExternallyVisible() const
APValue * getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E, bool MayCreate)
Get the storage for the constant value of a materialized temporary of static storage duration...
A single template declaration.
void Profile(llvm::FoldingSetNodeID &ID)
CanQualType OCLClkEventTy
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
noexcept(expression), evals to 'true'
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth, signed/unsigned.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
CanQualType UnsignedIntTy
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
static unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ComparisonCategories CompCategories
Types and expressions required to build C++2a three-way comparisons using operator<=>, including the values return by builtin <=> operators.