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;
114 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
119 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
120 if (VD->isStaticDataMember() &&
125 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
130 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
137 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
141 if (
const auto *TD = dyn_cast<TagDecl>(D)) {
144 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
148 if (isa<ParmVarDecl>(D))
153 if (isa<TemplateTypeParmDecl>(D) ||
154 isa<NonTypeTemplateParmDecl>(D) ||
155 isa<TemplateTemplateParmDecl>(D))
165 if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) ||
166 isa<ObjCPropertyDecl>(D) ||
167 isa<RedeclarableTemplateDecl>(D) ||
168 isa<ClassTemplateSpecializationDecl>(D))
173 if (isa<TypedefDecl>(D)) {
178 }
else if (
const auto *TD = dyn_cast<TagDecl>(D)) {
185 TD->isCompleteDefinition())
201 assert(std::is_sorted(RawComments.begin(), RawComments.end(),
210 if (RawComments.empty())
223 bool Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
224 if (!Found && RawComments.size() >= 2) {
226 Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
230 Comment = MaybeBeforeDecl + 1;
232 llvm::lower_bound(RawComments, &CommentAtDeclLoc, Compare));
235 Comment = llvm::lower_bound(RawComments, &CommentAtDeclLoc, Compare);
241 std::pair<FileID, unsigned> DeclLocDecomp = SourceMgr.
getDecomposedLoc(DeclLoc);
244 if (Comment != RawComments.end() &&
246 && (*Comment)->isTrailingComment() &&
247 (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
248 isa<ObjCMethodDecl>(D) || isa<ObjCPropertyDecl>(D))) {
249 std::pair<FileID, unsigned> CommentBeginDecomp
253 if (DeclLocDecomp.first == CommentBeginDecomp.first &&
254 SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second)
256 CommentBeginDecomp.second)) {
257 (**Comment).setAttached();
264 if (Comment == RawComments.begin())
269 if (!((*Comment)->isDocumentation() ||
271 (*Comment)->isTrailingComment())
275 std::pair<FileID, unsigned> CommentEndDecomp
280 if (DeclLocDecomp.first != CommentEndDecomp.first)
284 bool Invalid =
false;
285 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
291 StringRef
Text(Buffer + CommentEndDecomp.second,
292 DeclLocDecomp.second - CommentEndDecomp.second);
296 if (Text.find_first_of(
";{}#@") != StringRef::npos)
299 (**Comment).setAttached();
307 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
327 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
330 if (VD->isStaticDataMember())
336 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
343 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
349 return PU.is<ClassTemplateDecl*>() ?
350 static_cast<const Decl*>(PU.get<ClassTemplateDecl *>()) :
351 static_cast<const Decl*>(
357 CRD->getMemberSpecializationInfo())
358 return Info->getInstantiatedFrom();
362 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
375 const Decl **OriginalDecl)
const {
380 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
394 const Decl *OriginalDeclForRC =
nullptr;
396 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
407 OriginalDeclForRC = I;
427 *OriginalDecl = OriginalDeclForRC;
447 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
456 Redeclared.push_back(RedeclaredMethod);
462 const Decl *D)
const {
465 ThisDeclInfo->IsFilled =
false;
466 ThisDeclInfo->fill();
467 ThisDeclInfo->CommentDecl = FC->
getDecl();
468 if (!ThisDeclInfo->TemplateParameters)
478 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
489 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
493 if (Canonical != D) {
501 const Decl *OriginalDecl;
505 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
508 if (OMD && OMD->isPropertyAccessor())
515 for (
unsigned i = 0, e = Overridden.size();
i < e;
i++)
519 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(D)) {
522 QualType QT = TD->getUnderlyingType();
524 if (
const Decl *TD = TT->getDecl())
528 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(D)) {
529 while (IC->getSuperClass()) {
530 IC = IC->getSuperClass();
535 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(D)) {
540 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
541 if (!(RD = RD->getDefinition()))
544 for (
const auto &I : RD->bases()) {
545 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
551 if (!(NonVirtualBase= NonVirtualBase->getDefinition()))
559 for (
const auto &I : RD->vbases()) {
566 if (!(VirtualBase= VirtualBase->getDefinition()))
580 if (D != OriginalDecl)
589 ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &
ID,
596 ID.AddInteger(Params->
size());
598 PEnd = Params->
end();
600 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
602 ID.AddBoolean(TTP->isParameterPack());
606 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
608 ID.AddBoolean(NTTP->isParameterPack());
609 ID.AddPointer(NTTP->getType().getCanonicalType().getAsOpaquePtr());
610 if (NTTP->isExpandedParameterPack()) {
612 ID.AddInteger(NTTP->getNumExpansionTypes());
613 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
614 QualType T = NTTP->getExpansionType(I);
618 ID.AddBoolean(
false);
622 auto *TTP = cast<TemplateTemplateParmDecl>(*P);
629 ASTContext::getCanonicalTemplateTemplateParmDecl(
632 llvm::FoldingSetNodeID
ID;
633 CanonicalTemplateTemplateParm::Profile(ID, TTP);
634 void *InsertPos =
nullptr;
635 CanonicalTemplateTemplateParm *Canonical
636 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
638 return Canonical->getParam();
643 CanonParams.reserve(Params->
size());
645 PEnd = Params->
end();
647 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P))
648 CanonParams.push_back(
655 else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
659 if (NTTP->isExpandedParameterPack()) {
662 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
664 ExpandedTInfos.push_back(
672 NTTP->getPosition(),
nullptr,
682 NTTP->getPosition(),
nullptr,
684 NTTP->isParameterPack(),
687 CanonParams.push_back(Param);
690 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
691 cast<TemplateTemplateParmDecl>(*
P)));
695 "Unexpected requires-clause on template template-parameter");
696 Expr *
const CanonRequiresClause =
nullptr;
708 CanonRequiresClause));
711 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
712 assert(!Canonical &&
"Shouldn't be in the map!");
716 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
717 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
722 if (!LangOpts.CPlusPlus)
return nullptr;
737 llvm_unreachable(
"Invalid CXXABI type!");
742 if (LOpts.FakeAddressSpaceMap) {
745 static const unsigned FakeAddrSpaceMap[] = {
756 return &FakeAddrSpaceMap;
764 switch (LangOpts.getAddressSpaceMapMangling()) {
772 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
778 : FunctionProtoTypes(this_()), TemplateSpecializationTypes(this_()),
779 DependentTemplateSpecializationTypes(this_()),
780 SubstTemplateTemplateParmPacks(this_()), SourceMgr(SM), LangOpts(LOpts),
783 LangOpts.XRayNeverInstrumentFiles,
784 LangOpts.XRayAttrListFiles, SM)),
787 CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
790 TraversalScope = {TUDecl};
796 ReleaseDeclContextMaps();
799 for (
auto &Pair : Deallocations)
800 (Pair.first)(Pair.second);
806 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
808 if (
auto *R = const_cast<ASTRecordLayout *>((I++)->second))
811 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
812 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
814 if (
auto *R = const_cast<ASTRecordLayout *>((I++)->second))
818 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
819 AEnd = DeclAttrs.end();
821 A->second->~AttrVec();
823 for (std::pair<const MaterializeTemporaryExpr *, APValue *> &MTVPair :
824 MaterializedTemporaryValues)
825 MTVPair.second->~APValue();
827 for (
const auto &
Value : ModuleInitializers)
828 Value.second->~PerModuleInitializers();
841 using ParentMapPointers = llvm::DenseMap<
843 llvm::PointerUnion4<
const Decl *,
const Stmt *,
848 using ParentMapOtherNodes = llvm::DenseMap<
850 llvm::PointerUnion4<
const Decl *,
const Stmt *,
851 ast_type_traits::DynTypedNode *, ParentVector *>>;
853 ParentMapPointers PointerParents;
854 ParentMapOtherNodes OtherParents;
857 static ast_type_traits::DynTypedNode
858 getSingleDynTypedNodeFromParentMap(ParentMapPointers::mapped_type U) {
859 if (
const auto *D = U.dyn_cast<
const Decl *>())
861 if (
const auto *S = U.dyn_cast<
const Stmt *>())
863 return *U.get<ast_type_traits::DynTypedNode *>();
866 template <
typename NodeTy,
typename MapTy>
869 auto I = Map.find(Node);
870 if (I == Map.end()) {
873 if (
const auto *
V = I->second.template dyn_cast<ParentVector *>()) {
874 return llvm::makeArrayRef(*
V);
876 return getSingleDynTypedNodeFromParentMap(I->second);
882 for (
const auto &Entry : PointerParents) {
883 if (Entry.second.is<ast_type_traits::DynTypedNode *>()) {
884 delete Entry.second.get<ast_type_traits::DynTypedNode *>();
885 }
else if (Entry.second.is<ParentVector *>()) {
886 delete Entry.second.get<ParentVector *>();
889 for (
const auto &Entry : OtherParents) {
890 if (Entry.second.is<ast_type_traits::DynTypedNode *>()) {
891 delete Entry.second.get<ast_type_traits::DynTypedNode *>();
892 }
else if (Entry.second.is<ParentVector *>()) {
893 delete Entry.second.get<ParentVector *>();
901 return getDynNodeFromMap(Node, OtherParents);
906 TraversalScope = TopLevelDecls;
911 Deallocations.push_back({Callback, Data});
920 llvm::errs() <<
"\n*** AST Context Stats:\n";
921 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
923 unsigned counts[] = {
924 #define TYPE(Name, Parent) 0, 925 #define ABSTRACT_TYPE(Name, Parent) 926 #include "clang/AST/TypeNodes.def" 930 for (
unsigned i = 0, e = Types.size();
i != e; ++
i) {
936 unsigned TotalBytes = 0;
937 #define TYPE(Name, Parent) \ 939 llvm::errs() << " " << counts[Idx] << " " << #Name \ 940 << " types, " << sizeof(Name##Type) << " each " \ 941 << "(" << counts[Idx] * sizeof(Name##Type) \ 943 TotalBytes += counts[Idx] * sizeof(Name##Type); \ 945 #define ABSTRACT_TYPE(Name, Parent) 946 #include "clang/AST/TypeNodes.def" 948 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
953 <<
" implicit default constructors created\n";
956 <<
" implicit copy constructors created\n";
960 <<
" implicit move constructors created\n";
963 <<
" implicit copy assignment operators created\n";
967 <<
" implicit move assignment operators created\n";
970 <<
" implicit destructors created\n";
973 llvm::errs() <<
"\n";
977 BumpAlloc.PrintStats();
981 bool NotifyListeners) {
991 if (It == MergedDefModules.end())
994 auto &Merged = It->second;
997 if (!Found.insert(M).second)
999 Merged.erase(
std::remove(Merged.begin(), Merged.end(),
nullptr), Merged.end());
1002 void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1003 if (LazyInitializers.empty())
1007 assert(Source &&
"lazy initializers but no external source");
1009 auto LazyInits = std::move(LazyInitializers);
1010 LazyInitializers.clear();
1012 for (
auto ID : LazyInits)
1013 Initializers.push_back(Source->GetExternalDecl(
ID));
1015 assert(LazyInitializers.empty() &&
1016 "GetExternalDecl for lazy module initializer added more inits");
1022 if (
const auto *
ID = dyn_cast<ImportDecl>(D)) {
1023 auto It = ModuleInitializers.find(
ID->getImportedModule());
1026 if (It == ModuleInitializers.end())
1030 auto &Imported = *It->second;
1031 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1032 Imported.resolve(*
this);
1033 auto *OnlyDecl = Imported.Initializers.front();
1034 if (isa<ImportDecl>(OnlyDecl))
1039 auto *&
Inits = ModuleInitializers[M];
1041 Inits =
new (*this) PerModuleInitializers;
1042 Inits->Initializers.push_back(D);
1046 auto *&
Inits = ModuleInitializers[M];
1048 Inits =
new (*this) PerModuleInitializers;
1049 Inits->LazyInitializers.insert(
Inits->LazyInitializers.end(),
1050 IDs.begin(), IDs.end());
1054 auto It = ModuleInitializers.find(M);
1055 if (It == ModuleInitializers.end())
1058 auto *
Inits = It->second;
1059 Inits->resolve(*
this);
1060 return Inits->Initializers;
1064 if (!ExternCContext)
1067 return ExternCContext;
1074 BuiltinTemplate->setImplicit();
1075 TUDecl->addDecl(BuiltinTemplate);
1077 return BuiltinTemplate;
1082 if (!MakeIntegerSeqDecl)
1085 return MakeIntegerSeqDecl;
1090 if (!TypePackElementDecl)
1093 return TypePackElementDecl;
1107 NewDecl->addAttr(TypeVisibilityAttr::CreateImplicit(
1113 StringRef Name)
const {
1137 Types.push_back(Ty);
1142 assert((!this->Target || this->Target == &Target) &&
1143 "Incorrect target reinitialization");
1146 this->Target = &Target;
1147 this->AuxTarget = AuxTarget;
1154 InitBuiltinType(
VoidTy, BuiltinType::Void);
1157 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1159 if (LangOpts.CharIsSigned)
1160 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1162 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1165 InitBuiltinType(
ShortTy, BuiltinType::Short);
1166 InitBuiltinType(
IntTy, BuiltinType::Int);
1167 InitBuiltinType(
LongTy, BuiltinType::Long);
1168 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1178 InitBuiltinType(
FloatTy, BuiltinType::Float);
1179 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1180 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1183 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1186 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1189 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1190 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1191 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1195 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1196 InitBuiltinType(
FractTy, BuiltinType::Fract);
1197 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1202 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1208 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1215 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1220 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1222 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1223 if (LangOpts.CPlusPlus && LangOpts.WChar)
1227 WideCharTy = getFromTargetType(Target.getWCharType());
1230 WIntTy = getFromTargetType(Target.getWIntType());
1233 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1235 if (LangOpts.CPlusPlus)
1236 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1238 Char16Ty = getFromTargetType(Target.getChar16Type());
1240 if (LangOpts.CPlusPlus)
1241 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1243 Char32Ty = getFromTargetType(Target.getChar32Type());
1250 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1253 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1262 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1268 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1271 if (LangOpts.OpenMP)
1285 if (LangOpts.OpenCL) {
1286 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1287 InitBuiltinType(SingletonId, BuiltinType::Id); 1288 #include "clang/Basic/OpenCLImageTypes.def" 1290 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1291 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1293 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1296 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 1297 InitBuiltinType(Id##Ty, BuiltinType::Id); 1298 #include "clang/Basic/OpenCLExtensionTypes.def" 1305 ObjCConstantStringType =
QualType();
1310 if (LangOpts.OpenCLVersion >= 200) {
1320 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1323 InitBuiltinType(
HalfTy, BuiltinType::Half);
1330 return SourceMgr.getDiagnostics();
1345 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1346 if (Pos != DeclAttrs.end()) {
1347 Pos->second->~AttrVec();
1348 DeclAttrs.erase(Pos);
1362 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1363 TemplateOrInstantiation.find(Var);
1364 if (Pos == TemplateOrInstantiation.end())
1377 Tmpl, TSK, PointOfInstantiation));
1383 assert(!TemplateOrInstantiation[Inst] &&
1384 "Already noted what the variable was instantiated from");
1385 TemplateOrInstantiation[Inst] = TSI;
1390 auto Pos = InstantiatedFromUsingDecl.find(UUD);
1391 if (Pos == InstantiatedFromUsingDecl.end())
1399 assert((isa<UsingDecl>(Pattern) ||
1400 isa<UnresolvedUsingValueDecl>(Pattern) ||
1401 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1402 "pattern decl is not a using decl");
1403 assert((isa<UsingDecl>(Inst) ||
1404 isa<UnresolvedUsingValueDecl>(Inst) ||
1405 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1406 "instantiation did not produce a using decl");
1407 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1408 InstantiatedFromUsingDecl[Inst] = Pattern;
1413 llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>::const_iterator Pos
1414 = InstantiatedFromUsingShadowDecl.find(Inst);
1415 if (Pos == InstantiatedFromUsingShadowDecl.end())
1424 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1425 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1429 llvm::DenseMap<FieldDecl *, FieldDecl *>::iterator Pos
1430 = InstantiatedFromUnnamedFieldDecl.find(Field);
1431 if (Pos == InstantiatedFromUnnamedFieldDecl.end())
1439 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1440 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1441 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1442 "Already noted what unnamed field was instantiated from");
1444 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1460 return Range.end() - Range.begin();
1465 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1467 if (Pos == OverriddenMethods.end())
1475 OverriddenMethods[Method].push_back(Overridden);
1483 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1494 Method->getOverriddenMethods(OverDecls);
1495 Overridden.append(OverDecls.begin(), OverDecls.end());
1499 assert(!Import->NextLocalImport &&
"Import declaration already in the chain");
1500 assert(!Import->
isFromASTFile() &&
"Non-local import declaration");
1501 if (!FirstLocalImport) {
1502 FirstLocalImport = Import;
1503 LastLocalImport = Import;
1507 LastLocalImport->NextLocalImport = Import;
1508 LastLocalImport = Import;
1519 assert(BT &&
"Not a floating point type!");
1520 switch (BT->getKind()) {
1521 default: llvm_unreachable(
"Not a floating point type!");
1522 case BuiltinType::Float16:
1523 case BuiltinType::Half:
1524 return Target->getHalfFormat();
1525 case BuiltinType::Float:
return Target->getFloatFormat();
1526 case BuiltinType::Double:
return Target->getDoubleFormat();
1527 case BuiltinType::LongDouble:
1529 return AuxTarget->getLongDoubleFormat();
1530 return Target->getLongDoubleFormat();
1531 case BuiltinType::Float128:
1533 return AuxTarget->getFloat128Format();
1534 return Target->getFloat128Format();
1539 unsigned Align =
Target->getCharWidth();
1541 bool UseAlignAttrOnly =
false;
1543 Align = AlignFromAttr;
1551 if (isa<FieldDecl>(D)) {
1552 UseAlignAttrOnly = D->
hasAttr<PackedAttr>() ||
1553 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1555 UseAlignAttrOnly =
true;
1558 else if (isa<FieldDecl>(D))
1561 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1565 if (UseAlignAttrOnly) {
1567 }
else if (
const auto *VD = dyn_cast<ValueDecl>(D)) {
1577 Align = getTypeInfoImpl(T.
getTypePtr()).Align;
1578 else if (!BaseT->isIncompleteType()) {
1582 unsigned MinWidth =
Target->getLargeArrayMinWidth();
1583 if (!ForAlignof && MinWidth) {
1586 else if (isa<ConstantArrayType>(
arrayType) &&
1587 MinWidth <= getTypeSize(cast<ConstantArrayType>(
arrayType)))
1592 if (BaseT.getQualifiers().hasUnaligned())
1593 Align =
Target->getCharWidth();
1594 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
1595 if (VD->hasGlobalStorage() && !ForAlignof) {
1607 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1621 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1622 if (LowBitOfOffset < FieldAlign)
1623 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1626 Align =
std::min(Align, FieldAlign);
1638 std::pair<CharUnits, CharUnits>
1652 return sizeAndAlign;
1657 std::pair<CharUnits, CharUnits>
1660 std::pair<CharUnits, CharUnits> EltInfo =
1662 uint64_t Size = CAT->
getSize().getZExtValue();
1663 assert((Size == 0 || static_cast<uint64_t>(EltInfo.first.getQuantity()) <=
1664 (uint64_t)(-1)/Size) &&
1665 "Overflow in array type char size evaluation");
1666 uint64_t Width = EltInfo.first.getQuantity() * Size;
1667 unsigned Align = EltInfo.second.getQuantity();
1670 Width = llvm::alignTo(Width, Align);
1675 std::pair<CharUnits, CharUnits>
1677 if (
const auto *CAT = dyn_cast<ConstantArrayType>(T))
1684 std::pair<CharUnits, CharUnits>
1700 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1711 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1716 return TT->getDecl()->getMaxAlignment();
1722 TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
1723 if (I != MemoizedTypeInfo.end())
1728 MemoizedTypeInfo[T] = TI;
1738 TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
1741 bool AlignIsRequired =
false;
1744 #define TYPE(Class, Base) 1745 #define ABSTRACT_TYPE(Class, Base) 1746 #define NON_CANONICAL_TYPE(Class, Base) 1747 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 1748 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \ 1750 assert(!T->isDependentType() && "should not see dependent types here"); \ 1751 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr()); 1752 #include "clang/AST/TypeNodes.def" 1753 llvm_unreachable(
"Should not see dependent types");
1755 case Type::FunctionNoProto:
1756 case Type::FunctionProto:
1762 case Type::IncompleteArray:
1763 case Type::VariableArray:
1765 Align =
getTypeAlign(cast<ArrayType>(T)->getElementType());
1768 case Type::ConstantArray: {
1769 const auto *CAT = cast<ConstantArrayType>(T);
1772 uint64_t Size = CAT->getSize().getZExtValue();
1773 assert((Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) &&
1774 "Overflow in array type bit size evaluation");
1775 Width = EltInfo.Width * Size;
1776 Align = EltInfo.Align;
1779 Width = llvm::alignTo(Width, Align);
1782 case Type::ExtVector:
1783 case Type::Vector: {
1784 const auto *VT = cast<VectorType>(T);
1786 Width = EltInfo.
Width * VT->getNumElements();
1790 if (Align & (Align-1)) {
1791 Align = llvm::NextPowerOf2(Align);
1792 Width = llvm::alignTo(Width, Align);
1795 uint64_t TargetVectorAlign =
Target->getMaxVectorAlign();
1796 if (TargetVectorAlign && TargetVectorAlign < Align)
1797 Align = TargetVectorAlign;
1802 switch (cast<BuiltinType>(T)->
getKind()) {
1803 default: llvm_unreachable(
"Unknown builtin type!");
1804 case BuiltinType::Void:
1809 case BuiltinType::Bool:
1810 Width =
Target->getBoolWidth();
1811 Align =
Target->getBoolAlign();
1813 case BuiltinType::Char_S:
1814 case BuiltinType::Char_U:
1815 case BuiltinType::UChar:
1816 case BuiltinType::SChar:
1817 case BuiltinType::Char8:
1818 Width =
Target->getCharWidth();
1819 Align =
Target->getCharAlign();
1821 case BuiltinType::WChar_S:
1822 case BuiltinType::WChar_U:
1823 Width =
Target->getWCharWidth();
1824 Align =
Target->getWCharAlign();
1826 case BuiltinType::Char16:
1827 Width =
Target->getChar16Width();
1828 Align =
Target->getChar16Align();
1830 case BuiltinType::Char32:
1831 Width =
Target->getChar32Width();
1832 Align =
Target->getChar32Align();
1834 case BuiltinType::UShort:
1835 case BuiltinType::Short:
1836 Width =
Target->getShortWidth();
1837 Align =
Target->getShortAlign();
1839 case BuiltinType::UInt:
1840 case BuiltinType::Int:
1841 Width =
Target->getIntWidth();
1842 Align =
Target->getIntAlign();
1844 case BuiltinType::ULong:
1845 case BuiltinType::Long:
1846 Width =
Target->getLongWidth();
1847 Align =
Target->getLongAlign();
1849 case BuiltinType::ULongLong:
1850 case BuiltinType::LongLong:
1851 Width =
Target->getLongLongWidth();
1852 Align =
Target->getLongLongAlign();
1854 case BuiltinType::Int128:
1855 case BuiltinType::UInt128:
1859 case BuiltinType::ShortAccum:
1860 case BuiltinType::UShortAccum:
1861 case BuiltinType::SatShortAccum:
1862 case BuiltinType::SatUShortAccum:
1863 Width =
Target->getShortAccumWidth();
1864 Align =
Target->getShortAccumAlign();
1866 case BuiltinType::Accum:
1867 case BuiltinType::UAccum:
1868 case BuiltinType::SatAccum:
1869 case BuiltinType::SatUAccum:
1870 Width =
Target->getAccumWidth();
1871 Align =
Target->getAccumAlign();
1873 case BuiltinType::LongAccum:
1874 case BuiltinType::ULongAccum:
1875 case BuiltinType::SatLongAccum:
1876 case BuiltinType::SatULongAccum:
1877 Width =
Target->getLongAccumWidth();
1878 Align =
Target->getLongAccumAlign();
1880 case BuiltinType::ShortFract:
1881 case BuiltinType::UShortFract:
1882 case BuiltinType::SatShortFract:
1883 case BuiltinType::SatUShortFract:
1884 Width =
Target->getShortFractWidth();
1885 Align =
Target->getShortFractAlign();
1887 case BuiltinType::Fract:
1888 case BuiltinType::UFract:
1889 case BuiltinType::SatFract:
1890 case BuiltinType::SatUFract:
1891 Width =
Target->getFractWidth();
1892 Align =
Target->getFractAlign();
1894 case BuiltinType::LongFract:
1895 case BuiltinType::ULongFract:
1896 case BuiltinType::SatLongFract:
1897 case BuiltinType::SatULongFract:
1898 Width =
Target->getLongFractWidth();
1899 Align =
Target->getLongFractAlign();
1901 case BuiltinType::Float16:
1902 case BuiltinType::Half:
1905 Width =
Target->getHalfWidth();
1906 Align =
Target->getHalfAlign();
1909 "Expected OpenMP device compilation.");
1910 Width = AuxTarget->getHalfWidth();
1911 Align = AuxTarget->getHalfAlign();
1914 case BuiltinType::Float:
1915 Width =
Target->getFloatWidth();
1916 Align =
Target->getFloatAlign();
1918 case BuiltinType::Double:
1919 Width =
Target->getDoubleWidth();
1920 Align =
Target->getDoubleAlign();
1922 case BuiltinType::LongDouble:
1924 (
Target->getLongDoubleWidth() != AuxTarget->getLongDoubleWidth() ||
1925 Target->getLongDoubleAlign() != AuxTarget->getLongDoubleAlign())) {
1926 Width = AuxTarget->getLongDoubleWidth();
1927 Align = AuxTarget->getLongDoubleAlign();
1929 Width =
Target->getLongDoubleWidth();
1930 Align =
Target->getLongDoubleAlign();
1933 case BuiltinType::Float128:
1936 Width =
Target->getFloat128Width();
1937 Align =
Target->getFloat128Align();
1940 "Expected OpenMP device compilation.");
1941 Width = AuxTarget->getFloat128Width();
1942 Align = AuxTarget->getFloat128Align();
1945 case BuiltinType::NullPtr:
1946 Width =
Target->getPointerWidth(0);
1947 Align =
Target->getPointerAlign(0);
1949 case BuiltinType::ObjCId:
1950 case BuiltinType::ObjCClass:
1951 case BuiltinType::ObjCSel:
1952 Width =
Target->getPointerWidth(0);
1953 Align =
Target->getPointerAlign(0);
1955 case BuiltinType::OCLSampler:
1956 case BuiltinType::OCLEvent:
1957 case BuiltinType::OCLClkEvent:
1958 case BuiltinType::OCLQueue:
1959 case BuiltinType::OCLReserveID:
1960 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1961 case BuiltinType::Id: 1962 #include "clang/Basic/OpenCLImageTypes.def" 1963 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 1964 case BuiltinType::Id: 1965 #include "clang/Basic/OpenCLExtensionTypes.def" 1968 Width =
Target->getPointerWidth(AS);
1969 Align =
Target->getPointerAlign(AS);
1973 case Type::ObjCObjectPointer:
1974 Width =
Target->getPointerWidth(0);
1975 Align =
Target->getPointerAlign(0);
1977 case Type::BlockPointer:
1979 Width =
Target->getPointerWidth(AS);
1980 Align =
Target->getPointerAlign(AS);
1982 case Type::LValueReference:
1983 case Type::RValueReference:
1987 Width =
Target->getPointerWidth(AS);
1988 Align =
Target->getPointerAlign(AS);
1992 Width =
Target->getPointerWidth(AS);
1993 Align =
Target->getPointerAlign(AS);
1995 case Type::MemberPointer: {
1996 const auto *MPT = cast<MemberPointerType>(T);
2002 case Type::Complex: {
2006 Width = EltInfo.
Width * 2;
2007 Align = EltInfo.
Align;
2010 case Type::ObjCObject:
2011 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr());
2012 case Type::Adjusted:
2015 case Type::ObjCInterface: {
2016 const auto *ObjCI = cast<ObjCInterfaceType>(T);
2018 Width =
toBits(Layout.getSize());
2019 Align =
toBits(Layout.getAlignment());
2024 const auto *TT = cast<TagType>(T);
2026 if (TT->getDecl()->isInvalidDecl()) {
2032 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
2033 const EnumDecl *ED = ET->getDecl();
2037 Info.
Align = AttrAlign;
2043 const auto *RT = cast<RecordType>(TT);
2048 AlignIsRequired = RD->hasAttr<AlignedAttr>();
2052 case Type::SubstTemplateTypeParm:
2053 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
2054 getReplacementType().getTypePtr());
2057 case Type::DeducedTemplateSpecialization: {
2058 const auto *A = cast<DeducedType>(T);
2059 assert(!A->getDeducedType().isNull() &&
2060 "cannot request the size of an undeduced or dependent auto type");
2061 return getTypeInfo(A->getDeducedType().getTypePtr());
2065 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr());
2067 case Type::MacroQualified:
2071 case Type::ObjCTypeParam:
2072 return getTypeInfo(cast<ObjCTypeParamType>(T)->desugar().getTypePtr());
2074 case Type::Typedef: {
2082 AlignIsRequired =
true;
2091 case Type::Elaborated:
2092 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
2094 case Type::Attributed:
2096 cast<AttributedType>(T)->getEquivalentType().getTypePtr());
2098 case Type::Atomic: {
2107 Width =
Target->getCharWidth();
2109 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2115 if (!llvm::isPowerOf2_64(Width))
2116 Width = llvm::NextPowerOf2(Width);
2119 Align =
static_cast<unsigned>(Width);
2130 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2131 return TypeInfo(Width, Align, AlignIsRequired);
2135 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(T);
2136 if (I != MemoizedUnadjustedAlign.end())
2139 unsigned UnadjustedAlign;
2151 MemoizedUnadjustedAlign[T] = UnadjustedAlign;
2152 return UnadjustedAlign;
2158 if ((
getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 ||
2159 getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) &&
2210 unsigned ABIAlign = TI.
Align;
2218 if (!
Target->allowsLargerPreferedTypeAlignment())
2223 T = CT->getElementType().getTypePtr();
2225 T = ET->getDecl()->getIntegerType().getTypePtr();
2278 for (
const auto *I : OI->
ivars())
2282 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2284 Ivars.push_back(Iv);
2291 llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols) {
2292 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2295 for (
auto *Proto : OI->all_referenced_protocols()) {
2300 for (
const auto *Cat : OI->visible_categories())
2306 SD = SD->getSuperClass();
2308 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2309 for (
auto *Proto : OC->protocols()) {
2312 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2314 if (!Protocols.insert(
2315 const_cast<ObjCProtocolDecl *>(OP->getCanonicalDecl())).second)
2318 for (
auto *Proto : OP->protocols())
2325 assert(RD->
isUnion() &&
"Must be union type");
2328 for (
const auto *Field : RD->
fields()) {
2332 if (FieldSize != UnionSize)
2344 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
2345 return ClassDecl->isEmpty();
2353 assert(!RD->
isUnion() &&
"Must be struct/class type");
2356 int64_t CurOffsetInBits = 0;
2357 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2358 if (ClassDecl->isDynamicClass())
2362 for (
const auto Base : ClassDecl->bases()) {
2370 Bases.emplace_back(
Base.getType(), Size.getValue());
2374 llvm::sort(Bases, [&](
const std::pair<QualType, int64_t> &L,
2375 const std::pair<QualType, int64_t> &R) {
2376 return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) <
2377 Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
2380 for (
const auto Base : Bases) {
2381 int64_t BaseOffset = Context.
toBits(
2382 Layout.getBaseClassOffset(
Base.first->getAsCXXRecordDecl()));
2383 int64_t BaseSize =
Base.second;
2384 if (BaseOffset != CurOffsetInBits)
2386 CurOffsetInBits = BaseOffset + BaseSize;
2390 for (
const auto *Field : RD->
fields()) {
2391 if (!Field->getType()->isReferenceType() &&
2395 int64_t FieldSizeInBits =
2397 if (Field->isBitField()) {
2398 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2400 if (BitfieldSize > FieldSizeInBits)
2402 FieldSizeInBits = BitfieldSize;
2407 if (FieldOffsetInBits != CurOffsetInBits)
2410 CurOffsetInBits = FieldSizeInBits + FieldOffsetInBits;
2413 return CurOffsetInBits;
2434 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2454 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2469 return StructSize &&
2470 StructSize.getValue() ==
static_cast<int64_t
>(
getTypeSize(Ty));
2491 count += Ext->ivar_size();
2496 count += ImplDecl->ivar_size();
2514 if (isa<GNUNullExpr>(E))
return true;
2522 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2523 I = ObjCImpls.find(D);
2524 if (I != ObjCImpls.end())
2525 return cast<ObjCImplementationDecl>(I->second);
2532 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2533 I = ObjCImpls.find(D);
2534 if (I != ObjCImpls.end())
2535 return cast<ObjCCategoryImplDecl>(I->second);
2542 assert(IFaceD && ImplD &&
"Passed null params");
2543 ObjCImpls[IFaceD] = ImplD;
2549 assert(CatD && ImplD &&
"Passed null params");
2550 ObjCImpls[CatD] = ImplD;
2555 return ObjCMethodRedecls.
lookup(MD);
2561 ObjCMethodRedecls[MD] = Redecl;
2568 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
2569 return CD->getClassInterface();
2570 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
2571 return IMD->getClassInterface();
2580 assert(VD &&
"Passed null params");
2581 assert(VD->
hasAttr<BlocksAttr>() &&
2582 "getBlockVarCopyInits - not __block var");
2583 auto I = BlockVarCopyInits.find(VD);
2584 if (I != BlockVarCopyInits.end())
2586 return {
nullptr,
false};
2592 assert(VD && CopyExpr &&
"Passed null params");
2593 assert(VD->
hasAttr<BlocksAttr>() &&
2594 "setBlockVarCopyInits - not __block var");
2595 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr, CanThrow);
2599 unsigned DataSize)
const {
2604 "incorrect data size provided to CreateTypeSourceInfo!");
2621 return getObjCLayout(D,
nullptr);
2635 ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
2640 llvm::FoldingSetNodeID
ID;
2642 void *insertPos =
nullptr;
2643 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
2644 assert(eq->getQualifiers() == quals);
2653 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
2656 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
2660 ExtQualNodes.InsertNode(eq, insertPos);
2665 LangAS AddressSpace)
const {
2678 "Type cannot be in multiple addr spaces!");
2681 return getExtQualType(TypeNode, Quals);
2700 return getExtQualType(TypeNode, Quals);
2727 "Type cannot have multiple ObjCGCs!");
2730 return getExtQualType(TypeNode, Quals);
2739 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(T)) {
2742 const auto *FPT = cast<FunctionProtoType>(T);
2745 Result =
getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI);
2748 return cast<FunctionType>(Result.
getTypePtr());
2764 L->DeducedReturnType(FD, ResultType);
2774 if (
const auto *PT = dyn_cast<ParenType>(Orig))
2779 if (
const auto *MQT = dyn_cast<MacroQualifiedType>(Orig))
2782 MQT->getMacroIdentifier());
2785 if (
const auto *AT = dyn_cast<AttributedType>(Orig))
2795 Proto->getReturnType(), Proto->getParamTypes(),
2796 Proto->getExtProtoInfo().withExceptionSpec(ESI));
2822 if (TSInfo->getType() != FD->
getType())
2830 "TypeLoc size mismatch from updating exception specification");
2831 TSInfo->overrideType(Updated);
2840 llvm::FoldingSetNodeID
ID;
2843 void *InsertPos =
nullptr;
2844 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
2854 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
2855 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2858 Types.push_back(New);
2859 ComplexTypes.InsertNode(New, InsertPos);
2868 llvm::FoldingSetNodeID
ID;
2871 void *InsertPos =
nullptr;
2872 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2882 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2883 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2886 Types.push_back(New);
2887 PointerTypes.InsertNode(New, InsertPos);
2892 llvm::FoldingSetNodeID
ID;
2894 void *InsertPos =
nullptr;
2895 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2902 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2903 assert(!AT &&
"Shouldn't be in the map!");
2907 Types.push_back(AT);
2908 AdjustedTypes.InsertNode(AT, InsertPos);
2932 llvm::FoldingSetNodeID
ID;
2934 void *InsertPos =
nullptr;
2935 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2942 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2943 assert(!AT &&
"Shouldn't be in the map!");
2946 Types.push_back(AT);
2947 AdjustedTypes.InsertNode(AT, InsertPos);
2957 llvm::FoldingSetNodeID
ID;
2960 void *InsertPos =
nullptr;
2962 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2973 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2974 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2977 Types.push_back(New);
2978 BlockPointerTypes.InsertNode(New, InsertPos);
2987 "Unresolved overloaded function type");
2991 llvm::FoldingSetNodeID
ID;
2994 void *InsertPos =
nullptr;
2996 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3004 if (!SpelledAsLValue || InnerRef || !T.
isCanonical()) {
3005 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
3010 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3011 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3016 Types.push_back(New);
3017 LValueReferenceTypes.InsertNode(New, InsertPos);
3027 llvm::FoldingSetNodeID
ID;
3030 void *InsertPos =
nullptr;
3032 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3041 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
3046 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3047 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3051 Types.push_back(New);
3052 RValueReferenceTypes.InsertNode(New, InsertPos);
3061 llvm::FoldingSetNodeID
ID;
3064 void *InsertPos =
nullptr;
3066 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3077 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3078 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3081 Types.push_back(New);
3082 MemberPointerTypes.InsertNode(New, InsertPos);
3089 const llvm::APInt &ArySizeIn,
3091 unsigned IndexTypeQuals)
const {
3094 "Constant array of VLAs is illegal!");
3098 llvm::APInt ArySize(ArySizeIn);
3099 ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
3101 llvm::FoldingSetNodeID
ID;
3104 void *InsertPos =
nullptr;
3106 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
3115 ASM, IndexTypeQuals);
3120 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
3121 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3126 ConstantArrayTypes.InsertNode(New, InsertPos);
3127 Types.push_back(New);
3141 const Type *ty = split.
Ty;
3143 #define TYPE(Class, Base) 3144 #define ABSTRACT_TYPE(Class, Base) 3145 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 3146 #include "clang/AST/TypeNodes.def" 3147 llvm_unreachable(
"didn't desugar past all non-canonical types?");
3153 case Type::DependentVector:
3154 case Type::ExtVector:
3155 case Type::DependentSizedExtVector:
3156 case Type::DependentAddressSpace:
3157 case Type::ObjCObject:
3158 case Type::ObjCInterface:
3159 case Type::ObjCObjectPointer:
3162 case Type::UnresolvedUsing:
3163 case Type::TypeOfExpr:
3165 case Type::Decltype:
3166 case Type::UnaryTransform:
3167 case Type::DependentName:
3168 case Type::InjectedClassName:
3169 case Type::TemplateSpecialization:
3170 case Type::DependentTemplateSpecialization:
3171 case Type::TemplateTypeParm:
3172 case Type::SubstTemplateTypeParmPack:
3174 case Type::DeducedTemplateSpecialization:
3175 case Type::PackExpansion:
3176 llvm_unreachable(
"type should never be variably-modified");
3180 case Type::FunctionNoProto:
3181 case Type::FunctionProto:
3182 case Type::BlockPointer:
3183 case Type::MemberPointer:
3193 cast<PointerType>(ty)->getPointeeType()));
3196 case Type::LValueReference: {
3197 const auto *lv = cast<LValueReferenceType>(ty);
3200 lv->isSpelledAsLValue());
3204 case Type::RValueReference: {
3205 const auto *lv = cast<RValueReferenceType>(ty);
3211 case Type::Atomic: {
3212 const auto *at = cast<AtomicType>(ty);
3217 case Type::ConstantArray: {
3218 const auto *
cat = cast<ConstantArrayType>(ty);
3222 cat->getSizeModifier(),
3223 cat->getIndexTypeCVRQualifiers());
3227 case Type::DependentSizedArray: {
3228 const auto *dat = cast<DependentSizedArrayType>(ty);
3232 dat->getSizeModifier(),
3233 dat->getIndexTypeCVRQualifiers(),
3234 dat->getBracketsRange());
3239 case Type::IncompleteArray: {
3240 const auto *iat = cast<IncompleteArrayType>(ty);
3245 iat->getIndexTypeCVRQualifiers(),
3251 case Type::VariableArray: {
3252 const auto *vat = cast<VariableArrayType>(ty);
3257 vat->getIndexTypeCVRQualifiers(),
3258 vat->getBracketsRange());
3272 unsigned IndexTypeQuals,
3282 IndexTypeQuals, Brackets);
3289 VariableArrayTypes.push_back(New);
3290 Types.push_back(New);
3300 unsigned elementTypeQuals,
3304 "Size must be type- or value-dependent!");
3314 numElements, ASM, elementTypeQuals,
3316 Types.push_back(newType);
3325 void *insertPos =
nullptr;
3326 llvm::FoldingSetNodeID
ID;
3329 ASM, elementTypeQuals, numElements);
3333 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3339 QualType(), numElements, ASM, elementTypeQuals,
3341 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
3342 Types.push_back(canonTy);
3347 canonElementType.
Quals);
3351 if (
QualType(canonElementType.
Ty, 0) == elementType &&
3360 ASM, elementTypeQuals, brackets);
3361 Types.push_back(sugaredType);
3367 unsigned elementTypeQuals)
const {
3368 llvm::FoldingSetNodeID
ID;
3371 void *insertPos =
nullptr;
3373 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
3384 ASM, elementTypeQuals);
3389 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3390 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
3396 IncompleteArrayTypes.InsertNode(newType, insertPos);
3397 Types.push_back(newType);
3408 llvm::FoldingSetNodeID
ID;
3411 void *InsertPos =
nullptr;
3412 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3422 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3423 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3426 VectorType(vecType, NumElts, Canonical, VecKind);
3427 VectorTypes.InsertNode(New, InsertPos);
3428 Types.push_back(New);
3436 llvm::FoldingSetNodeID
ID;
3439 void *InsertPos =
nullptr;
3441 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3446 *
this, VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
3449 if (CanonVecTy == VecType) {
3451 *
this, VecType,
QualType(), SizeExpr, AttrLoc, VecKind);
3454 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3455 assert(!CanonCheck &&
3456 "Dependent-sized vector_size canonical type broken");
3458 DependentVectorTypes.InsertNode(New, InsertPos);
3463 *
this, VecType, Canon, SizeExpr, AttrLoc, VecKind);
3467 Types.push_back(New);
3478 llvm::FoldingSetNodeID
ID;
3481 void *InsertPos =
nullptr;
3482 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3492 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3493 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3497 VectorTypes.InsertNode(New, InsertPos);
3498 Types.push_back(New);
3506 llvm::FoldingSetNodeID
ID;
3510 void *InsertPos =
nullptr;
3512 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3522 if (CanonVecTy == vecType) {
3528 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3529 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
3531 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
3540 Types.push_back(New);
3545 Expr *AddrSpaceExpr,
3551 void *insertPos =
nullptr;
3552 llvm::FoldingSetNodeID
ID;
3557 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
3562 QualType(), AddrSpaceExpr, AttrLoc);
3563 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
3564 Types.push_back(canonTy);
3567 if (canonPointeeType == PointeeType &&
3574 AddrSpaceExpr, AttrLoc);
3575 Types.push_back(sugaredType);
3592 llvm::FoldingSetNodeID
ID;
3595 void *InsertPos =
nullptr;
3597 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
3607 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3608 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3613 Types.push_back(New);
3614 FunctionNoProtoTypes.InsertNode(New, InsertPos);
3630 return CanResultType;
3637 if (!NoexceptInType)
3654 bool AnyPackExpansions =
false;
3659 AnyPackExpansions =
true;
3661 return AnyPackExpansions;
3667 QualType ASTContext::getFunctionTypeInternal(
3670 size_t NumArgs = ArgArray.size();
3674 llvm::FoldingSetNodeID
ID;
3679 bool Unique =
false;
3681 void *InsertPos =
nullptr;
3683 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
3692 EPI.ExceptionSpec.NoexceptExpr == FPT->getNoexceptExpr())
3703 bool IsCanonicalExceptionSpec =
3707 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
3709 for (
unsigned i = 0;
i != NumArgs && isCanonical; ++
i)
3710 if (!ArgArray[
i].isCanonicalAsParam())
3711 isCanonical =
false;
3713 if (OnlyWantCanonical)
3714 assert(isCanonical &&
3715 "given non-canonical parameters constructing canonical type");
3720 if (!isCanonical && Canonical.isNull()) {
3722 CanonicalArgs.reserve(NumArgs);
3723 for (
unsigned i = 0;
i != NumArgs; ++
i)
3730 if (IsCanonicalExceptionSpec) {
3732 }
else if (NoexceptInType) {
3733 switch (EPI.ExceptionSpec.Type) {
3745 bool AnyPacks =
false;
3746 for (
QualType ET : EPI.ExceptionSpec.Exceptions) {
3768 llvm_unreachable(
"dependent noexcept is already canonical");
3777 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
3781 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3782 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3787 auto ESH = FunctionProtoType::getExceptionSpecSize(
3788 EPI.ExceptionSpec.Type, EPI.ExceptionSpec.Exceptions.size());
3789 size_t Size = FunctionProtoType::totalSizeToAlloc<
3792 FunctionProtoType::ExtParameterInfo,
Qualifiers>(
3793 NumArgs, FunctionProtoType::hasExtraBitfields(EPI.ExceptionSpec.Type),
3794 ESH.NumExceptionType, ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
3795 EPI.ExtParameterInfos ? NumArgs : 0,
3796 EPI.TypeQuals.hasNonFastQualifiers() ? 1 : 0);
3801 Types.push_back(FTP);
3803 FunctionProtoTypes.InsertNode(FTP, InsertPos);
3804 return QualType(FTP, 0);
3808 llvm::FoldingSetNodeID
ID;
3811 void *InsertPos =
nullptr;
3812 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
3822 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
3823 assert(!NewIP &&
"Shouldn't be in the map!");
3827 Types.push_back(New);
3828 PipeTypes.InsertNode(New, InsertPos);
3839 return getPipeType(T,
true);
3843 return getPipeType(T,
false);
3848 if (!isa<CXXRecordDecl>(D))
return false;
3849 const auto *RD = cast<CXXRecordDecl>(D);
3850 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
3852 if (RD->getDescribedClassTemplate() &&
3853 !isa<ClassTemplateSpecializationDecl>(RD))
3864 if (Decl->TypeForDecl) {
3865 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3867 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
3868 Decl->TypeForDecl = PrevDecl->TypeForDecl;
3869 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3873 Decl->TypeForDecl = newType;
3874 Types.push_back(newType);
3876 return QualType(Decl->TypeForDecl, 0);
3882 assert(Decl &&
"Passed null for Decl param");
3883 assert(!Decl->TypeForDecl &&
"TypeForDecl present in slow case");
3885 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(Decl))
3888 assert(!isa<TemplateTypeParmDecl>(Decl) &&
3889 "Template type parameter types are always available.");
3891 if (
const auto *Record = dyn_cast<RecordDecl>(Decl)) {
3892 assert(Record->isFirstDecl() &&
"struct/union has previous declaration");
3895 }
else if (
const auto *
Enum = dyn_cast<EnumDecl>(Decl)) {
3896 assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
3898 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(Decl)) {
3900 Decl->TypeForDecl = newType;
3901 Types.push_back(newType);
3903 llvm_unreachable(
"TypeDecl without a type?");
3905 return QualType(Decl->TypeForDecl, 0);
3913 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3919 Decl->TypeForDecl = newType;
3920 Types.push_back(newType);
3925 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3928 if (PrevDecl->TypeForDecl)
3929 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3932 Decl->TypeForDecl = newType;
3933 Types.push_back(newType);
3938 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3941 if (PrevDecl->TypeForDecl)
3942 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3945 Decl->TypeForDecl = newType;
3946 Types.push_back(newType);
3953 llvm::FoldingSetNodeID
id;
3956 void *insertPos =
nullptr;
3958 if (type)
return QualType(type, 0);
3964 Types.push_back(type);
3965 AttributedTypes.InsertNode(type, insertPos);
3975 &&
"replacement types must always be canonical");
3977 llvm::FoldingSetNodeID
ID;
3979 void *InsertPos =
nullptr;
3981 = SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3986 Types.push_back(SubstParm);
3987 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
4000 assert(
P.getAsType().isCanonical() &&
"Pack contains non-canonical type");
4004 llvm::FoldingSetNodeID
ID;
4006 void *InsertPos =
nullptr;
4008 = SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
4016 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
4022 Types.push_back(SubstParm);
4023 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
4033 llvm::FoldingSetNodeID
ID;
4035 void *InsertPos =
nullptr;
4037 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4047 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4048 assert(!TypeCheck &&
"Template type parameter canonical type broken");
4054 Types.push_back(TypeParm);
4055 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
4066 "No dependent template names here!");
4086 "No dependent template names here!");
4089 ArgVec.reserve(Args.
size());
4091 ArgVec.push_back(Arg.getArgument());
4099 if (Arg.isPackExpansion())
4111 "No dependent template names here!");
4120 if (!Underlying.
isNull())
4126 "Caller must compute aliased type");
4127 IsTypeAlias =
false;
4136 (IsTypeAlias?
sizeof(
QualType) : 0),
4140 IsTypeAlias ? Underlying :
QualType());
4142 Types.push_back(Spec);
4149 "No dependent template names here!");
4158 unsigned NumArgs = Args.size();
4159 CanonArgs.reserve(NumArgs);
4165 llvm::FoldingSetNodeID
ID;
4169 void *InsertPos =
nullptr;
4171 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4181 Types.push_back(Spec);
4182 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
4186 "Non-dependent template-id type must have a canonical type");
4193 TagDecl *OwnedTagDecl)
const {
4194 llvm::FoldingSetNodeID
ID;
4197 void *InsertPos =
nullptr;
4198 ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4205 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4206 assert(!CheckT &&
"Elaborated canonical type broken");
4210 void *Mem =
Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
4212 T =
new (Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
4215 ElaboratedTypes.InsertNode(T, InsertPos);
4221 llvm::FoldingSetNodeID
ID;
4224 void *InsertPos =
nullptr;
4225 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4232 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4233 assert(!CheckT &&
"Paren canonical type broken");
4239 ParenTypes.InsertNode(T, InsertPos);
4252 Types.push_back(newType);
4262 if (CanonNNS != NNS)
4266 llvm::FoldingSetNodeID
ID;
4269 void *InsertPos =
nullptr;
4271 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
4277 DependentNameTypes.InsertNode(T, InsertPos);
4289 for (
unsigned I = 0, E = Args.
size(); I != E; ++I)
4290 ArgCopy.push_back(Args[I].getArgument());
4301 "nested-name-specifier must be dependent");
4303 llvm::FoldingSetNodeID
ID;
4307 void *InsertPos =
nullptr;
4309 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4318 bool AnyNonCanonArgs =
false;
4319 unsigned NumArgs = Args.size();
4321 for (
unsigned I = 0; I != NumArgs; ++I) {
4323 if (!CanonArgs[I].structurallyEquals(Args[I]))
4324 AnyNonCanonArgs =
true;
4328 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
4334 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4343 DependentTemplateSpecializationTypes.InsertNode(T, InsertPos);
4349 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
4355 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
4358 NTTP->getType().getNonLValueExprType(*
this),
4361 if (NTTP->isParameterPack())
4366 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
4382 Args.reserve(Args.size() + Params->
size());
4390 llvm::FoldingSetNodeID
ID;
4400 "Pack expansions must expand one or more parameter packs");
4401 void *InsertPos =
nullptr;
4403 = PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4418 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4425 PackExpansionTypes.InsertNode(T, InsertPos);
4437 if (Protocols.empty())
return true;
4442 for (
unsigned i = 1;
i != Protocols.size(); ++
i)
4444 Protocols[
i]->getCanonicalDecl() != Protocols[
i])
4452 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
4456 P =
P->getCanonicalDecl();
4459 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
4460 Protocols.erase(ProtocolsEnd, Protocols.end());
4465 unsigned NumProtocols)
const {
4467 llvm::makeArrayRef(Protocols, NumProtocols),
4475 bool isKindOf)
const {
4478 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
4479 isa<ObjCInterfaceType>(baseType))
4483 llvm::FoldingSetNodeID
ID;
4485 void *InsertPos =
nullptr;
4486 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
4493 if (effectiveTypeArgs.empty()) {
4495 effectiveTypeArgs = baseObject->getTypeArgs();
4502 bool typeArgsAreCanonical = std::all_of(effectiveTypeArgs.begin(),
4503 effectiveTypeArgs.end(),
4505 return type.isCanonical();
4508 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
4512 if (!typeArgsAreCanonical) {
4513 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
4514 for (
auto typeArg : effectiveTypeArgs)
4516 canonTypeArgs = canonTypeArgsVec;
4518 canonTypeArgs = effectiveTypeArgs;
4523 if (!protocolsSorted) {
4524 canonProtocolsVec.append(protocols.begin(), protocols.end());
4526 canonProtocols = canonProtocolsVec;
4528 canonProtocols = protocols;
4532 canonProtocols, isKindOf);
4535 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
4539 size += typeArgs.size() *
sizeof(
QualType);
4547 ObjCObjectTypes.InsertNode(T, InsertPos);
4557 bool allowOnPointerType)
const {
4560 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(type.
getTypePtr())) {
4565 if (allowOnPointerType) {
4566 if (
const auto *objPtr =
4567 dyn_cast<ObjCObjectPointerType>(type.
getTypePtr())) {
4573 protocolsVec.append(protocols.begin(), protocols.end());
4585 if (
const auto *objT = dyn_cast<ObjCObjectType>(type.
getTypePtr())){
4590 objT->getTypeArgsAsWritten(),
4592 objT->isKindOfTypeAsWritten());
4609 objPtr->isKindOfType());
4617 objPtr->isKindOfType());
4630 llvm::FoldingSetNodeID
ID;
4632 void *InsertPos =
nullptr;
4634 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
4637 if (Canonical.
isNull()) {
4640 if (!protocols.empty()) {
4644 Canonical, protocols, hasError,
true ));
4645 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
4654 Types.push_back(newType);
4655 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
4669 for (
auto *Proto : OPT->quals()) {
4690 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> InheritedProtocols;
4692 if (InheritedProtocols.empty())
4696 bool Conforms =
false;
4697 for (
auto *Proto : OPT->quals()) {
4699 for (
auto *PI : InheritedProtocols) {
4711 for (
auto *PI : InheritedProtocols) {
4713 bool Adopts =
false;
4714 for (
auto *Proto : OPT->quals()) {
4728 llvm::FoldingSetNodeID
ID;
4731 void *InsertPos =
nullptr;
4733 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4742 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4750 Types.push_back(QType);
4751 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
4759 if (Decl->TypeForDecl)
4760 return QualType(Decl->TypeForDecl, 0);
4763 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
4764 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4765 return QualType(PrevDecl->TypeForDecl, 0);
4774 Decl->TypeForDecl = T;
4787 llvm::FoldingSetNodeID
ID;
4790 void *InsertPos =
nullptr;
4792 = DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
4802 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
4809 Types.push_back(toe);
4821 Types.push_back(tot);
4837 llvm::FoldingSetNodeID
ID;
4840 void *InsertPos =
nullptr;
4842 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
4846 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
4854 Types.push_back(dt);
4868 llvm::FoldingSetNodeID
ID;
4871 void *InsertPos =
nullptr;
4873 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
4880 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
4888 UnderlyingType, Kind,
4891 Types.push_back(ut);
4899 bool IsDependent,
bool IsPack)
const {
4900 assert((!IsPack || IsDependent) &&
"only use IsPack for a dependent pack");
4905 void *InsertPos =
nullptr;
4906 llvm::FoldingSetNodeID
ID;
4908 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
4912 AutoType(DeducedType, Keyword, IsDependent, IsPack);
4913 Types.push_back(AT);
4915 AutoTypes.InsertNode(AT, InsertPos);
4925 void *InsertPos =
nullptr;
4926 llvm::FoldingSetNodeID
ID;
4930 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
4935 Types.push_back(DTST);
4937 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
4946 llvm::FoldingSetNodeID
ID;
4949 void *InsertPos =
nullptr;
4950 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
4960 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
4961 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4964 Types.push_back(New);
4965 AtomicTypes.InsertNode(New, InsertPos);
5000 return getFromTargetType(
Target->getSizeType());
5006 return getFromTargetType(
Target->getSignedSizeType());
5011 return getFromTargetType(
Target->getIntMaxType());
5016 return getFromTargetType(
Target->getUIntMaxType());
5034 return getFromTargetType(
Target->getIntPtrType());
5044 return getFromTargetType(
Target->getPtrDiffType(0));
5051 return getFromTargetType(
Target->getUnsignedPtrDiffType(0));
5057 return getFromTargetType(
Target->getProcessIDType());
5071 if (isa<ArrayType>(Ty)) {
5073 }
else if (isa<FunctionType>(Ty)) {
5095 quals = splitType.
Quals;
5100 QualType elementType = AT->getElementType();
5105 if (elementType == unqualElementType) {
5106 assert(quals.
empty());
5107 quals = splitType.
Quals;
5115 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
5117 CAT->getSizeModifier(), 0);
5120 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
5124 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
5127 VAT->getSizeModifier(),
5128 VAT->getIndexTypeCVRQualifiers(),
5129 VAT->getBracketsRange());
5132 const auto *DSAT = cast<DependentSizedArrayType>(AT);
5134 DSAT->getSizeModifier(), 0,
5142 bool UnwrappedAny =
false;
5145 if (!AT1)
return UnwrappedAny;
5148 if (!AT2)
return UnwrappedAny;
5152 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
5154 if (!CAT2 || CAT1->getSize() != CAT2->getSize())
5155 return UnwrappedAny;
5156 }
else if (!isa<IncompleteArrayType>(AT1) ||
5157 !isa<IncompleteArrayType>(AT2)) {
5158 return UnwrappedAny;
5161 T1 = AT1->getElementType();
5162 T2 = AT2->getElementType();
5163 UnwrappedAny =
true;
5184 if (T1PtrType && T2PtrType) {
5192 if (T1MPType && T2MPType &&
5203 if (T1OPType && T2OPType) {
5235 if (Quals1 != Quals2)
5298 llvm_unreachable(
"bad template name kind!");
5306 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
5307 Template = getCanonicalTemplateTemplateParmDecl(TTP);
5315 llvm_unreachable(
"cannot canonicalize unresolved template");
5319 assert(DTN &&
"Non-dependent template names must refer to template decls.");
5320 return DTN->CanonicalTemplateName;
5340 llvm_unreachable(
"bad template name!");
5389 A != AEnd; (void)++A, ++Idx)
5392 return TemplateArgument(llvm::makeArrayRef(CanonArgs, Arg.
pack_size()));
5397 llvm_unreachable(
"Unhandled template argument kind");
5453 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
5460 if (
const auto *AT = dyn_cast<ArrayType>(T))
5481 if (!ATy || qs.
empty())
5488 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
5490 CAT->getSizeModifier(),
5491 CAT->getIndexTypeCVRQualifiers()));
5492 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
5494 IAT->getSizeModifier(),
5495 IAT->getIndexTypeCVRQualifiers()));
5497 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
5498 return cast<ArrayType>(
5500 DSAT->getSizeExpr(),
5501 DSAT->getSizeModifier(),
5502 DSAT->getIndexTypeCVRQualifiers(),
5503 DSAT->getBracketsRange()));
5505 const auto *VAT = cast<VariableArrayType>(ATy);
5508 VAT->getSizeModifier(),
5509 VAT->getIndexTypeCVRQualifiers(),
5510 VAT->getBracketsRange()));
5550 assert(PrettyArrayType &&
"Not an array type!");
5587 uint64_t ElementCount = 1;
5589 ElementCount *= CA->
getSize().getZExtValue();
5590 CA = dyn_cast_or_null<ConstantArrayType>(
5593 return ElementCount;
5602 assert(T->
getAs<
BuiltinType>() &&
"getFloatingRank(): not a floating type");
5604 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
5606 case BuiltinType::Half:
return HalfRank;
5607 case BuiltinType::Float:
return FloatRank;
5624 case HalfRank: llvm_unreachable(
"Complex half is not supported");
5641 llvm_unreachable(
"getFloatingRank(): illegal value for rank");
5668 unsigned ASTContext::getIntegerRank(
const Type *T)
const {
5671 switch (cast<BuiltinType>(T)->getKind()) {
5672 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
5673 case BuiltinType::Bool:
5675 case BuiltinType::Char_S:
5676 case BuiltinType::Char_U:
5677 case BuiltinType::SChar:
5678 case BuiltinType::UChar:
5680 case BuiltinType::Short:
5681 case BuiltinType::UShort:
5683 case BuiltinType::Int:
5684 case BuiltinType::UInt:
5686 case BuiltinType::Long:
5687 case BuiltinType::ULong:
5689 case BuiltinType::LongLong:
5690 case BuiltinType::ULongLong:
5692 case BuiltinType::Int128:
5693 case BuiltinType::UInt128:
5741 if (BitWidth < IntSize)
5744 if (BitWidth == IntSize)
5759 assert(!Promotable.
isNull());
5762 return ET->getDecl()->getPromotionType();
5771 if (BT->getKind() == BuiltinType::WChar_S ||
5772 BT->getKind() == BuiltinType::WChar_U ||
5773 BT->getKind() == BuiltinType::Char8 ||
5774 BT->getKind() == BuiltinType::Char16 ||
5775 BT->getKind() == BuiltinType::Char32) {
5776 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
5780 for (
size_t Idx = 0; Idx < llvm::array_lengthof(PromoteTypes); ++Idx) {
5782 if (FromSize < ToSize ||
5783 (FromSize == ToSize &&
5784 FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType()))
5785 return PromoteTypes[Idx];
5787 llvm_unreachable(
"char type should fit into long long");
5794 uint64_t PromotableSize =
getIntWidth(Promotable);
5835 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
5837 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
5840 if (LHSC == RHSC)
return 0;
5845 unsigned LHSRank = getIntegerRank(LHSC);
5846 unsigned RHSRank = getIntegerRank(RHSC);
5848 if (LHSUnsigned == RHSUnsigned) {
5849 if (LHSRank == RHSRank)
return 0;
5850 return LHSRank > RHSRank ? 1 : -1;
5856 if (LHSRank >= RHSRank)
5866 if (RHSRank >= LHSRank)
5876 if (CFConstantStringTypeDecl)
5877 return CFConstantStringTypeDecl;
5879 assert(!CFConstantStringTagDecl &&
5880 "tag and typedef should be initialized together");
5882 CFConstantStringTagDecl->startDefinition();
5920 if (static_cast<unsigned>(CFRuntime) <
5923 Fields[Count++] = {
IntTy,
"flags" };
5925 Fields[Count++] = {
LongTy,
"length" };
5929 Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc" };
5933 Fields[Count++] = {
IntTy,
"_ptr" };
5939 for (
unsigned i = 0;
i < Count; ++
i) {
5943 Fields[
i].Type,
nullptr,
5946 CFConstantStringTagDecl->addDecl(Field);
5949 CFConstantStringTagDecl->completeDefinition();
5953 CFConstantStringTypeDecl =
5956 return CFConstantStringTypeDecl;
5960 if (!CFConstantStringTagDecl)
5962 return CFConstantStringTagDecl;
5971 if (ObjCSuperType.isNull()) {
5973 TUDecl->addDecl(ObjCSuperTypeDecl);
5976 return ObjCSuperType;
5981 assert(TD &&
"Invalid CFConstantStringType");
5982 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
5985 assert(TagType &&
"Invalid CFConstantStringType");
5986 CFConstantStringTagDecl = TagType->getDecl();
5990 if (BlockDescriptorType)
6003 static const char *
const FieldNames[] = {
6008 for (
size_t i = 0;
i < 2; ++
i) {
6011 &
Idents.
get(FieldNames[
i]), FieldTypes[
i],
nullptr,
6019 BlockDescriptorType = RD;
6025 if (BlockDescriptorExtendedType)
6040 static const char *
const FieldNames[] = {
6047 for (
size_t i = 0;
i < 4; ++
i) {
6050 &
Idents.
get(FieldNames[
i]), FieldTypes[
i],
nullptr,
6059 BlockDescriptorExtendedType = RD;
6067 if (isa<PipeType>(T))
6073 switch (BT->getKind()) {
6074 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6075 case BuiltinType::Id: \ 6076 return TargetInfo::OCLTK_Image; 6077 #include "clang/Basic/OpenCLImageTypes.def" 6079 case BuiltinType::OCLClkEvent:
6082 case BuiltinType::OCLEvent:
6085 case BuiltinType::OCLQueue:
6088 case BuiltinType::OCLReserveID:
6091 case BuiltinType::OCLSampler:
6110 if (!copyExpr && record->hasTrivialDestructor())
return false;
6138 llvm_unreachable(
"impossible");
6140 llvm_unreachable(
"fell out of lifetime switch!");
6148 bool &HasByrefExtendedLayout)
const {
6153 HasByrefExtendedLayout =
false;
6155 HasByrefExtendedLayout =
true;
6169 if (!ObjCInstanceTypeDecl)
6170 ObjCInstanceTypeDecl =
6172 return ObjCInstanceTypeDecl;
6178 if (
const auto *TT = dyn_cast<TypedefType>(T))
6180 return II->isStr(
"BOOL");
6216 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
6222 if (D->getLexicalDeclContext()->isFileContext() &&
6223 !D->isInlineSpecified() && (D->isConstexpr() ||
First->isConstexpr()))
6259 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
6268 ParmOffset = PtrSize;
6270 QualType PType = PVDecl->getOriginalType();
6271 if (
const auto *AT =
6275 if (!isa<ConstantArrayType>(AT))
6276 PType = PVDecl->getType();
6278 PType = PVDecl->getType();
6305 "getObjCEncodingForFunctionDecl - Incomplete param type");
6313 QualType PType = PVDecl->getOriginalType();
6314 if (
const auto *AT =
6318 if (!isa<ConstantArrayType>(AT))
6319 PType = PVDecl->getType();
6321 PType = PVDecl->getType();
6335 bool Extended)
const {
6339 ObjCEncOptions Options = ObjCEncOptions()
6340 .setExpandPointedToStructures()
6341 .setExpandStructures()
6342 .setIsOutermostType();
6344 Options.setEncodeBlockParameters().setEncodeClassNames();
6345 getObjCEncodingForTypeImpl(T, S, Options,
nullptr);
6351 bool Extended)
const {
6372 "getObjCEncodingForMethodDecl - Incomplete param type");
6380 ParmOffset = 2 * PtrSize;
6385 if (
const auto *AT =
6389 if (!isa<ConstantArrayType>(AT))
6394 PType, S, Extended);
6405 const Decl *Container)
const {
6408 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
6409 for (
auto *PID : CID->property_impls())
6410 if (PID->getPropertyDecl() == PD)
6413 const auto *OID = cast<ObjCImplementationDecl>(Container);
6414 for (
auto *PID : OID->property_impls())
6415 if (PID->getPropertyDecl() == PD)
6448 const Decl *Container)
const {
6450 bool Dynamic =
false;
6458 SynthesizePID = PropertyImpDecl;
6462 std::string S =
"T";
6504 if (SynthesizePID) {
6519 if (isa<TypedefType>(PointeeTy.
getTypePtr())) {
6521 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
6524 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
6537 getObjCEncodingForTypeImpl(T, S,
6539 .setExpandPointedToStructures()
6540 .setExpandStructures()
6541 .setIsOutermostType(),
6542 Field, NotEncodedT);
6546 std::string& S)
const {
6550 getObjCEncodingForTypeImpl(T, S,
6552 .setExpandPointedToStructures()
6553 .setExpandStructures()
6554 .setIsOutermostType()
6555 .setEncodingProperty(),
6562 case BuiltinType::Void:
return 'v';
6563 case BuiltinType::Bool:
return 'B';
6564 case BuiltinType::Char8:
6565 case BuiltinType::Char_U:
6566 case BuiltinType::UChar:
return 'C';
6567 case BuiltinType::Char16:
6568 case BuiltinType::UShort:
return 'S';
6569 case BuiltinType::Char32:
6570 case BuiltinType::UInt:
return 'I';
6571 case BuiltinType::ULong:
6573 case BuiltinType::UInt128:
return 'T';
6574 case BuiltinType::ULongLong:
return 'Q';
6575 case BuiltinType::Char_S:
6576 case BuiltinType::SChar:
return 'c';
6577 case BuiltinType::Short:
return 's';
6578 case BuiltinType::WChar_S:
6579 case BuiltinType::WChar_U:
6580 case BuiltinType::Int:
return 'i';
6581 case BuiltinType::Long:
6583 case BuiltinType::LongLong:
return 'q';
6584 case BuiltinType::Int128:
return 't';
6585 case BuiltinType::Float:
return 'f';
6586 case BuiltinType::Double:
return 'd';
6587 case BuiltinType::LongDouble:
return 'D';
6588 case BuiltinType::NullPtr:
return '*';
6590 case BuiltinType::Float16:
6591 case BuiltinType::Float128:
6592 case BuiltinType::Half:
6593 case BuiltinType::ShortAccum:
6594 case BuiltinType::Accum:
6595 case BuiltinType::LongAccum:
6596 case BuiltinType::UShortAccum:
6597 case BuiltinType::UAccum:
6598 case BuiltinType::ULongAccum:
6599 case BuiltinType::ShortFract:
6600 case BuiltinType::Fract:
6601 case BuiltinType::LongFract:
6602 case BuiltinType::UShortFract:
6603 case BuiltinType::UFract:
6604 case BuiltinType::ULongFract:
6605 case BuiltinType::SatShortAccum:
6606 case BuiltinType::SatAccum:
6607 case BuiltinType::SatLongAccum:
6608 case BuiltinType::SatUShortAccum:
6609 case BuiltinType::SatUAccum:
6610 case BuiltinType::SatULongAccum:
6611 case BuiltinType::SatShortFract:
6612 case BuiltinType::SatFract:
6613 case BuiltinType::SatLongFract:
6614 case BuiltinType::SatUShortFract:
6615 case BuiltinType::SatUFract:
6616 case BuiltinType::SatULongFract:
6620 case BuiltinType::ObjCId:
6621 case BuiltinType::ObjCClass:
6622 case BuiltinType::ObjCSel:
6623 llvm_unreachable(
"@encoding ObjC primitive type");
6626 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6627 case BuiltinType::Id: 6628 #include "clang/Basic/OpenCLImageTypes.def" 6629 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 6630 case BuiltinType::Id: 6631 #include "clang/Basic/OpenCLExtensionTypes.def" 6632 case BuiltinType::OCLEvent:
6633 case BuiltinType::OCLClkEvent:
6634 case BuiltinType::OCLQueue:
6635 case BuiltinType::OCLReserveID:
6636 case BuiltinType::OCLSampler:
6637 case BuiltinType::Dependent:
6638 #define BUILTIN_TYPE(KIND, ID) 6639 #define PLACEHOLDER_TYPE(KIND, ID) \ 6640 case BuiltinType::KIND: 6641 #include "clang/AST/BuiltinTypes.def" 6642 llvm_unreachable(
"invalid builtin type for @encode");
6644 llvm_unreachable(
"invalid BuiltinType::Kind value");
6661 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
6681 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
6690 S += llvm::utostr(Offset);
6703 void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string &S,
6704 const ObjCEncOptions Options,
6708 switch (CT->getTypeClass()) {
6713 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
6719 case Type::Complex: {
6722 getObjCEncodingForTypeImpl(CT->getElementType(), S, ObjCEncOptions(),
6727 case Type::Atomic: {
6730 getObjCEncodingForTypeImpl(AT->getValueType(), S, ObjCEncOptions(),
6737 case Type::LValueReference:
6738 case Type::RValueReference: {
6740 if (isa<PointerType>(CT)) {
6742 if (PT->isObjCSelType()) {
6751 bool isReadOnly =
false;
6761 }
else if (Options.IsOutermostType()) {
6774 if (StringRef(S).endswith(
"nr"))
6775 S.replace(S.end()-2, S.end(),
"rn");
6787 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
6792 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
6801 ObjCEncOptions NewOptions;
6802 if (Options.ExpandPointedToStructures())
6803 NewOptions.setExpandStructures();
6804 getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
6805 nullptr, NotEncodedT);
6809 case Type::ConstantArray:
6810 case Type::IncompleteArray:
6811 case Type::VariableArray: {
6812 const auto *AT = cast<ArrayType>(CT);
6814 if (isa<IncompleteArrayType>(AT) && !Options.IsStructField()) {
6818 getObjCEncodingForTypeImpl(
6819 AT->getElementType(), S,
6820 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
6824 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
6825 S += llvm::utostr(CAT->getSize().getZExtValue());
6828 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
6829 "Unknown array type!");
6833 getObjCEncodingForTypeImpl(
6834 AT->getElementType(), S,
6835 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
6842 case Type::FunctionNoProto:
6843 case Type::FunctionProto:
6847 case Type::Record: {
6848 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
6849 S += RDecl->
isUnion() ?
'(' :
'{';
6853 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
6855 llvm::raw_string_ostream OS(S);
6862 if (Options.ExpandStructures()) {
6865 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
6867 for (
const auto *Field : RDecl->
fields()) {
6870 S += Field->getNameAsString();
6875 if (Field->isBitField()) {
6876 getObjCEncodingForTypeImpl(Field->getType(), S,
6877 ObjCEncOptions().setExpandStructures(),
6882 getObjCEncodingForTypeImpl(
6884 ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
6890 S += RDecl->
isUnion() ?
')' :
'}';
6894 case Type::BlockPointer: {
6897 if (Options.EncodeBlockParameters()) {
6902 getObjCEncodingForTypeImpl(FT->getReturnType(), S,
6903 Options.forComponentType(), FD, NotEncodedT);
6907 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
6908 for (
const auto &I : FPT->param_types())
6909 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
6917 case Type::ObjCObject: {
6921 S +=
"{objc_object=}";
6925 S +=
"{objc_class=}";
6932 case Type::ObjCInterface: {
6938 if (Options.ExpandStructures()) {
6942 for (
unsigned i = 0, e = Ivars.size();
i != e; ++
i) {
6945 getObjCEncodingForTypeImpl(Field->
getType(), S,
6946 ObjCEncOptions().setExpandStructures(),
6949 getObjCEncodingForTypeImpl(Field->
getType(), S,
6950 ObjCEncOptions().setExpandStructures(), FD,
6958 case Type::ObjCObjectPointer: {
6960 if (OPT->isObjCIdType()) {
6965 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
6973 if (OPT->isObjCQualifiedIdType()) {
6974 getObjCEncodingForTypeImpl(
6976 Options.keepingOnly(ObjCEncOptions()
6977 .setExpandPointedToStructures()
6978 .setExpandStructures()),
6980 if (FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
6984 for (
const auto *I : OPT->quals()) {
6986 S += I->getObjCRuntimeNameAsString();
6995 if (OPT->getInterfaceDecl() &&
6996 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
6999 for (
const auto *I : OPT->quals()) {
7001 S += I->getObjCRuntimeNameAsString();
7011 case Type::MemberPointer:
7015 case Type::ExtVector:
7024 case Type::DeducedTemplateSpecialization:
7028 #define ABSTRACT_TYPE(KIND, BASE) 7029 #define TYPE(KIND, BASE) 7030 #define DEPENDENT_TYPE(KIND, BASE) \ 7032 #define NON_CANONICAL_TYPE(KIND, BASE) \ 7034 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \ 7036 #include "clang/AST/TypeNodes.def" 7037 llvm_unreachable(
"@encode for dependent type!");
7039 llvm_unreachable(
"bad type kind!");
7042 void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
7047 assert(RDecl &&
"Expected non-null RecordDecl");
7048 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
7053 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
7057 for (
const auto &BI : CXXRec->bases()) {
7058 if (!BI.isVirtual()) {
7063 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7064 std::make_pair(offs, base));
7070 for (
auto *Field : RDecl->
fields()) {
7072 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7073 std::make_pair(offs, Field));
7077 if (CXXRec && includeVBases) {
7078 for (
const auto &BI : CXXRec->vbases()) {
7084 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
7085 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
7086 std::make_pair(offs, base));
7098 uint64_t CurOffs = 0;
7100 std::multimap<uint64_t, NamedDecl *>::iterator
7101 CurLayObj = FieldOrBaseOffsets.begin();
7103 if (CXXRec && CXXRec->isDynamicClass() &&
7104 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
7107 std::string recname = CXXRec->getNameAsString();
7108 if (recname.empty()) recname =
"?";
7120 uint64_t offs =
toBits(size);
7121 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7122 std::make_pair(offs,
nullptr));
7125 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
7127 assert(CurOffs <= CurLayObj->first);
7128 if (CurOffs < CurLayObj->first) {
7129 uint64_t padding = CurLayObj->first - CurOffs;
7145 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
7150 getObjCEncodingForStructureImpl(base, S, FD,
false,
7152 assert(!base->isEmpty());
7157 const auto *field = cast<FieldDecl>(dcl);
7160 S += field->getNameAsString();
7164 if (field->isBitField()) {
7167 CurOffs += field->getBitWidthValue(*
this);
7172 getObjCEncodingForTypeImpl(
7173 qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
7184 std::string& S)
const {
7217 if (!ObjCClassDecl) {
7222 return ObjCClassDecl;
7226 if (!ObjCProtocolClassDecl) {
7227 ObjCProtocolClassDecl
7236 return ObjCProtocolClassDecl;
7282 const size_t NumFields = 5;
7284 const char *FieldNames[NumFields];
7288 FieldNames[0] =
"__stack";
7292 FieldNames[1] =
"__gr_top";
7296 FieldNames[2] =
"__vr_top";
7299 FieldTypes[3] = Context->
IntTy;
7300 FieldNames[3] =
"__gr_offs";
7303 FieldTypes[4] = Context->
IntTy;
7304 FieldNames[4] =
"__vr_offs";
7307 for (
unsigned i = 0;
i < NumFields; ++
i) {
7313 FieldTypes[
i],
nullptr,
7318 VaListTagDecl->
addDecl(Field);
7335 const size_t NumFields = 5;
7337 const char *FieldNames[NumFields];
7341 FieldNames[0] =
"gpr";
7345 FieldNames[1] =
"fpr";
7349 FieldNames[2] =
"reserved";
7353 FieldNames[3] =
"overflow_arg_area";
7357 FieldNames[4] =
"reg_save_area";
7360 for (
unsigned i = 0;
i < NumFields; ++
i) {
7365 FieldTypes[
i],
nullptr,
7370 VaListTagDecl->
addDecl(Field);
7398 const size_t NumFields = 4;
7400 const char *FieldNames[NumFields];
7404 FieldNames[0] =
"gp_offset";
7408 FieldNames[1] =
"fp_offset";
7412 FieldNames[2] =
"overflow_arg_area";
7416 FieldNames[3] =
"reg_save_area";
7419 for (
unsigned i = 0;
i < NumFields; ++
i) {
7425 FieldTypes[
i],
nullptr,
7430 VaListTagDecl->
addDecl(Field);
7501 const size_t NumFields = 4;
7503 const char *FieldNames[NumFields];
7506 FieldTypes[0] = Context->
LongTy;
7507 FieldNames[0] =
"__gpr";
7510 FieldTypes[1] = Context->
LongTy;
7511 FieldNames[1] =
"__fpr";
7515 FieldNames[2] =
"__overflow_arg_area";
7519 FieldNames[3] =
"__reg_save_area";
7522 for (
unsigned i = 0;
i < NumFields; ++
i) {
7528 FieldTypes[
i],
nullptr,
7533 VaListTagDecl->
addDecl(Field);
7570 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
7574 if (!BuiltinVaListDecl) {
7576 assert(BuiltinVaListDecl->isImplicit());
7579 return BuiltinVaListDecl;
7592 if (!BuiltinMSVaListDecl)
7595 return BuiltinMSVaListDecl;
7603 assert(ObjCConstantStringType.isNull() &&
7604 "'NSConstantString' type already set!");
7614 unsigned size = End -
Begin;
7615 assert(size > 1 &&
"set is not overloaded!");
7624 assert(isa<FunctionTemplateDecl>(D) ||
7625 isa<UnresolvedUsingValueDecl>(D) ||
7626 (isa<UsingShadowDecl>(D) &&
7645 bool TemplateKeyword,
7647 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
7650 llvm::FoldingSetNodeID
ID;
7653 void *InsertPos =
nullptr;
7655 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7659 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
7671 "Nested name specifier must be dependent");
7673 llvm::FoldingSetNodeID
ID;
7676 void *InsertPos =
nullptr;
7678 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7684 if (CanonNNS == NNS) {
7692 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7693 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
7697 DependentTemplateNames.InsertNode(QTN, InsertPos);
7707 "Nested name specifier must be dependent");
7709 llvm::FoldingSetNodeID
ID;
7712 void *InsertPos =
nullptr;
7714 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7720 if (CanonNNS == NNS) {
7729 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7730 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
7734 DependentTemplateNames.InsertNode(QTN, InsertPos);
7741 llvm::FoldingSetNodeID
ID;
7744 void *insertPos =
nullptr;
7746 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
7750 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
7759 auto &Self =
const_cast<ASTContext &
>(*this);
7760 llvm::FoldingSetNodeID
ID;
7763 void *InsertPos =
nullptr;
7765 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
7771 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
7795 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
7825 while (
const auto *AT = dyn_cast<ArrayType>(CT))
7826 CT = AT->getElementType();
7848 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
7849 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
7892 assert((lhsQID && rhsOPT) &&
"ObjCQualifiedClassTypesAreCompatible");
7894 for (
auto *lhsProto : lhsQID->quals()) {
7896 for (
auto *rhsProto : rhsOPT->
quals()) {
7923 if (!rhsOPT)
return false;
7925 if (rhsOPT->qual_empty()) {
7929 for (
auto *I : lhsQID->quals()) {
7933 if (!rhsID->ClassImplementsProtocol(I,
true))
7941 for (
auto *lhsProto : lhsQID->quals()) {
7947 for (
auto *rhsProto : rhsOPT->quals()) {
7957 for (
auto *I : lhsQID->quals()) {
7961 if (rhsID->ClassImplementsProtocol(I,
true)) {
7975 assert(rhsQID &&
"One of the LHS/RHS should be id<x>");
7980 for (
auto *lhsProto : lhsOPT->quals()) {
7988 for (
auto *rhsProto : rhsQID->
quals()) {
8002 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSInheritedProtocols;
8007 if (LHSInheritedProtocols.empty() && lhsOPT->qual_empty())
8009 for (
auto *lhsProto : LHSInheritedProtocols) {
8011 for (
auto *rhsProto : rhsQID->
quals()) {
8042 auto finish = [&](
bool succeeded) ->
bool {
8082 bool BlockReturnType) {
8086 auto finish = [&](
bool succeeded) ->
bool {
8120 return finish(BlockReturnType);
8122 return finish(!BlockReturnType);
8134 return (*lhs)->getName().compare((*rhs)->getName());
8151 assert(LHS->
getInterface() &&
"LHS must have an interface base");
8152 assert(RHS->
getInterface() &&
"RHS must have an interface base");
8155 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSProtocolSet;
8158 for (
auto proto : LHS->
quals()) {
8166 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> RHSProtocolSet;
8169 for (
auto proto : RHS->
quals()) {
8177 for (
auto proto : LHSProtocolSet) {
8178 if (RHSProtocolSet.count(proto))
8179 IntersectionSet.push_back(proto);
8184 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ImpliedProtocols;
8188 if (!ImpliedProtocols.empty()) {
8189 IntersectionSet.erase(
8190 std::remove_if(IntersectionSet.begin(),
8191 IntersectionSet.end(),
8193 return ImpliedProtocols.count(proto) > 0;
8195 IntersectionSet.end());
8199 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
8209 if (lhsOPT && rhsOPT)
8215 if (lhsBlock && rhsBlock)
8220 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
8233 if (lhsArgs.size() != rhsArgs.size())
8237 for (
unsigned i = 0, n = lhsArgs.size();
i != n; ++
i) {
8244 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
8245 rhsArgs[
i].stripObjCKindOfType(ctx))) {
8273 if (!LDecl || !RDecl)
8283 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
8293 bool anyChanges =
false;
8311 if (!Protocols.empty())
8329 if (LHSSuperType.
isNull())
8339 if (KnownLHS != LHSAncestors.end()) {
8340 LHS = KnownLHS->second;
8344 bool anyChanges =
false;
8362 if (!Protocols.empty())
8379 if (RHSSuperType.
isNull())
8390 assert(LHS->
getInterface() &&
"LHS is not an interface type");
8391 assert(RHS->
getInterface() &&
"RHS is not an interface type");
8408 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> SuperClassInheritedProtocols;
8412 for (
auto *RHSPI : RHS->
quals())
8415 if (SuperClassInheritedProtocols.empty())
8418 for (
const auto *LHSProto : LHS->
quals()) {
8419 bool SuperImplementsProtocol =
false;
8420 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
8421 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
8422 SuperImplementsProtocol =
true;
8425 if (!SuperImplementsProtocol)
8455 if (!LHSOPT || !RHSOPT)
8473 bool CompareUnqualified) {
8492 bool OfBlockPointer,
8496 if (UD->
hasAttr<TransparentUnionAttr>()) {
8497 for (
const auto *I : UD->
fields()) {
8498 QualType ET = I->getType().getUnqualifiedType();
8512 bool OfBlockPointer,
8527 return mergeTypes(lhs, rhs, OfBlockPointer, Unqualified);
8531 bool OfBlockPointer,
8537 bool allLTypes =
true;
8538 bool allRTypes =
true;
8542 if (OfBlockPointer) {
8544 QualType LHS = lbase->getReturnType();
8545 bool UnqualifiedResult = Unqualified;
8546 if (!UnqualifiedResult)
8548 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
8605 if (lproto && rproto) {
8606 assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
8607 "C++ shouldn't be here");
8609 if (lproto->getNumParams() != rproto->getNumParams())
8613 if (lproto->isVariadic() != rproto->isVariadic())
8616 if (lproto->getMethodQuals() != rproto->getMethodQuals())
8620 bool canUseLeft, canUseRight;
8632 for (
unsigned i = 0, n = lproto->getNumParams();
i < n;
i++) {
8633 QualType lParamType = lproto->getParamType(
i).getUnqualifiedType();
8634 QualType rParamType = rproto->getParamType(
i).getUnqualifiedType();
8636 lParamType, rParamType, OfBlockPointer, Unqualified);
8643 types.push_back(paramType);
8655 if (allLTypes)
return lhs;
8656 if (allRTypes)
return rhs;
8661 newParamInfos.empty() ? nullptr : newParamInfos.data();
8665 if (lproto) allRTypes =
false;
8666 if (rproto) allLTypes =
false;
8684 paramTy = Enum->getDecl()->getIntegerType();
8694 if (allLTypes)
return lhs;
8695 if (allRTypes)
return rhs;
8702 if (allLTypes)
return lhs;
8703 if (allRTypes)
return rhs;
8709 QualType other,
bool isBlockReturnType) {
8715 if (underlyingType.
isNull())
8730 bool OfBlockPointer,
8731 bool Unqualified,
bool BlockReturnType) {
8749 if (LHSCan == RHSCan)
8754 Qualifiers RQuals = RHSCan.getLocalQualifiers();
8755 if (LQuals != RQuals) {
8771 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
8792 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
8793 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
8796 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
8797 LHSClass = Type::ConstantArray;
8798 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
8799 RHSClass = Type::ConstantArray;
8802 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
8803 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
8806 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
8807 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
8810 if (LHSClass != RHSClass) {
8820 if (OfBlockPointer && !BlockReturnType) {
8832 #define TYPE(Class, Base) 8833 #define ABSTRACT_TYPE(Class, Base) 8834 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: 8835 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 8836 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 8837 #include "clang/AST/TypeNodes.def" 8838 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
8841 case Type::DeducedTemplateSpecialization:
8842 case Type::LValueReference:
8843 case Type::RValueReference:
8844 case Type::MemberPointer:
8845 llvm_unreachable(
"C++ should never be in mergeTypes");
8847 case Type::ObjCInterface:
8848 case Type::IncompleteArray:
8849 case Type::VariableArray:
8850 case Type::FunctionProto:
8851 case Type::ExtVector:
8852 llvm_unreachable(
"Types are eliminated above");
8873 case Type::BlockPointer:
8898 if (ResultType.isNull())
8925 case Type::ConstantArray:
8951 -> std::pair<bool,llvm::APInt> {
8953 llvm::APSInt TheInt;
8956 return std::make_pair(
true, TheInt);
8958 return std::make_pair(
false, TheInt);
8960 return std::make_pair(
true, CAT->getSize());
8962 return std::make_pair(
false, llvm::APInt());
8966 bool HaveLSize, HaveRSize;
8967 llvm::APInt LSize, RSize;
8968 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
8969 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
8970 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
9003 case Type::FunctionNoProto:
9020 case Type::ObjCObject: {
9031 case Type::ObjCObjectPointer:
9032 if (OfBlockPointer) {
9046 assert(LHS != RHS &&
9047 "Equivalent pipe types should have already been handled!");
9051 llvm_unreachable(
"Invalid Type::Class!");
9056 bool &CanUseFirst,
bool &CanUseSecond,
9058 assert(NewParamInfos.empty() &&
"param info list not empty");
9059 CanUseFirst = CanUseSecond =
true;
9065 if (!FirstHasInfo && !SecondHasInfo)
9068 bool NeedParamInfo =
false;
9072 for (
size_t I = 0; I < E; ++I) {
9083 bool FirstNoEscape = FirstParam.
isNoEscape();
9084 bool SecondNoEscape = SecondParam.
isNoEscape();
9085 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
9087 if (NewParamInfos.back().getOpaqueValue())
9088 NeedParamInfo =
true;
9089 if (FirstNoEscape != IsNoEscape)
9090 CanUseFirst =
false;
9091 if (SecondNoEscape != IsNoEscape)
9092 CanUseSecond =
false;
9096 NewParamInfos.clear();
9102 ObjCLayouts[CD] =
nullptr;
9112 if (LHSCan == RHSCan)
9114 if (RHSCan->isFunctionType()) {
9118 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
9120 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
9123 if (ResReturnType.
isNull())
9125 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
9129 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
9142 Qualifiers RQuals = RHSCan.getLocalQualifiers();
9143 if (LQuals != RQuals) {
9156 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
9172 if (ResQT == LHSBaseQT)
9174 if (ResQT == RHSBaseQT)
9186 T = ET->getDecl()->getIntegerType();
9200 VTy->getNumElements(), VTy->getVectorKind());
9204 T = ETy->getDecl()->getIntegerType();
9207 assert(BTy &&
"Unexpected signed integer or fixed point type");
9208 switch (BTy->getKind()) {
9209 case BuiltinType::Char_S:
9210 case BuiltinType::SChar:
9212 case BuiltinType::Short:
9214 case BuiltinType::Int:
9216 case BuiltinType::Long:
9218 case BuiltinType::LongLong:
9220 case BuiltinType::Int128:
9223 case BuiltinType::ShortAccum:
9225 case BuiltinType::Accum:
9227 case BuiltinType::LongAccum:
9229 case BuiltinType::SatShortAccum:
9231 case BuiltinType::SatAccum:
9233 case BuiltinType::SatLongAccum:
9235 case BuiltinType::ShortFract:
9237 case BuiltinType::Fract:
9239 case BuiltinType::LongFract:
9241 case BuiltinType::SatShortFract:
9243 case BuiltinType::SatFract:
9245 case BuiltinType::SatLongFract:
9248 llvm_unreachable(
"Unexpected signed integer or fixed point type");
9272 bool AllowTypeModifiers) {
9275 bool Signed =
false, Unsigned =
false;
9276 RequiresICE =
false;
9281 bool IsSpecial =
false;
9285 default: Done =
true; --Str;
break;
9290 assert(!Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
9291 assert(!Signed &&
"Can't use 'S' modifier multiple times!");
9295 assert(!Signed &&
"Can't use both 'S' and 'U' modifiers!");
9296 assert(!Unsigned &&
"Can't use 'U' modifier multiple times!");
9300 assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
9301 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
9306 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
9307 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
9316 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
9317 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
9323 llvm_unreachable(
"Unexpected integer type");
9334 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
9335 assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
9341 llvm_unreachable(
"Unexpected integer type");
9354 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
9355 assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
9371 default: llvm_unreachable(
"Unknown builtin type letter!");
9373 assert(HowLong == 0 && !Signed && !Unsigned &&
9374 "Bad modifiers used with 'v'!");
9378 assert(HowLong == 0 && !Signed && !Unsigned &&
9379 "Bad modifiers used with 'h'!");
9383 assert(HowLong == 0 && !Signed && !Unsigned &&
9384 "Bad modifiers used with 'f'!");
9388 assert(HowLong < 3 && !Signed && !Unsigned &&
9389 "Bad modifiers used with 'd'!");
9392 else if (HowLong == 2)
9398 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
9407 else if (HowLong == 2)
9409 else if (HowLong == 1)
9415 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
9424 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'b'!");
9428 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'z'!");
9432 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'w'!");
9449 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9461 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9469 unsigned NumElements = strtoul(Str, &End, 10);
9470 assert(End != Str &&
"Missing vector size");
9474 RequiresICE,
false);
9475 assert(!RequiresICE &&
"Can't require vector ICE");
9485 unsigned NumElements = strtoul(Str, &End, 10);
9486 assert(End != Str &&
"Missing vector size");
9498 assert(!RequiresICE &&
"Can't require complex ICE");
9524 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'K'!");
9538 Done = !AllowTypeModifiers;
9540 switch (
char c = *Str++) {
9541 default: Done =
true; --Str;
break;
9547 unsigned AddrSpace = strtoul(Str, &End, 10);
9575 "Integer constant 'I' type must be an integer");
9583 unsigned *IntegerConstantArgs)
const {
9585 if (TypeStr[0] ==
'\0') {
9592 bool RequiresICE =
false;
9599 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
9601 while (TypeStr[0] && TypeStr[0] !=
'.') {
9608 if (RequiresICE && IntegerConstantArgs)
9609 *IntegerConstantArgs |= 1 << ArgTypes.size();
9615 ArgTypes.push_back(Ty);
9618 if (Id == Builtin::BI__GetExceptionInfo)
9621 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
9622 "'.' should only occur at end of builtin type list!");
9624 bool Variadic = (TypeStr[0] ==
'.');
9627 Variadic,
false,
true));
9632 if (ArgTypes.empty() && Variadic && !
getLangOpts().CPlusPlus)
9652 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD))
9653 if (!MD->isUserProvided())
9685 !FD->
hasAttr<DLLExportAttr>()) ||
9686 FD->
hasAttr<GNUInlineAttr>()) {
9711 if (D->
hasAttr<DLLImportAttr>()) {
9714 }
else if (D->
hasAttr<DLLExportAttr>()) {
9718 D->
hasAttr<CUDAGlobalAttr>()) {
9765 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
9770 if (!LexicalContext)
9775 auto StaticLocalLinkage =
9787 return StaticLocalLinkage;
9814 return StrongLinkage;
9827 if (isa<VarTemplateSpecializationDecl>(VD) && VD->
isConstexpr())
9835 return StrongLinkage;
9847 llvm_unreachable(
"Invalid Linkage!");
9857 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
9858 if (!VD->isFileVarDecl())
9863 if (VD->getDescribedVarTemplate() ||
9864 isa<VarTemplatePartialSpecializationDecl>(VD))
9866 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
9870 }
else if (isa<PragmaCommentDecl>(D))
9872 else if (isa<PragmaDetectMismatchDecl>(D))
9874 else if (isa<OMPThreadPrivateDecl>(D))
9876 else if (isa<OMPAllocateDecl>(D))
9878 else if (isa<OMPDeclareReductionDecl>(D))
9880 else if (isa<ImportDecl>(D))
9885 if (D->
isFromASTFile() && !LangOpts.BuildingPCHWithObjectFile) {
9900 isa<FunctionDecl>(D) &&
9901 cast<FunctionDecl>(D)->getTemplateSpecializationKind() ==
9908 isa<CXXMethodDecl>(D) &&
9909 cast<CXXMethodDecl>(D)->getParent()->getTemplateSpecializationKind() ==
9921 if (D->
hasAttr<WeakRefAttr>())
9928 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
9930 if (!FD->doesThisDeclarationHaveABody())
9931 return FD->doesDeclarationForceExternallyVisibleDefinition();
9934 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
9940 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
9958 const auto *VD = cast<VarDecl>(D);
9959 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
9963 if (LangOpts.OpenMP &&
9964 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
9981 if (VD->getType().isDestructedType())
9985 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
9987 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
9992 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
9993 for (
const auto *BD : DD->bindings())
9994 if (
const auto *BindingVD = BD->getHoldingVar())
10003 llvm::function_ref<
void(
FunctionDecl *)> Pred)
const {
10004 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
10005 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
10007 for (
auto *CurDecl :
10011 std::end(SeenDecls) == llvm::find(SeenDecls, CurFD)) {
10012 SeenDecls.insert(CurFD);
10020 bool IsBuiltin)
const {
10023 return ABI->getDefaultMethodCallConv(IsVariadic);
10028 switch (LangOpts.getDefaultCallingConv()) {
10053 return Target->getDefaultCallingConv();
10058 return ABI->isNearlyEmpty(RD);
10062 if (!VTContext.get()) {
10063 if (
Target->getCXXABI().isMicrosoft())
10068 return VTContext.get();
10087 llvm_unreachable(
"Unsupported ABI");
10093 return ASTRecordLayouts.getMemorySize() +
10094 llvm::capacity_in_bytes(ObjCLayouts) +
10095 llvm::capacity_in_bytes(KeyFunctions) +
10096 llvm::capacity_in_bytes(ObjCImpls) +
10097 llvm::capacity_in_bytes(BlockVarCopyInits) +
10098 llvm::capacity_in_bytes(DeclAttrs) +
10099 llvm::capacity_in_bytes(TemplateOrInstantiation) +
10100 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
10101 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
10102 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
10103 llvm::capacity_in_bytes(OverriddenMethods) +
10104 llvm::capacity_in_bytes(Types) +
10105 llvm::capacity_in_bytes(VariableArrayTypes);
10113 unsigned Signed)
const {
10116 if (!QualTy && DestWidth == 128)
10139 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
10144 MangleNumbers[ND] = Number;
10148 auto I = MangleNumbers.find(ND);
10149 return I != MangleNumbers.end() ? I->second : 1;
10154 StaticLocalNumbers[VD] = Number;
10158 auto I = StaticLocalNumbers.find(VD);
10159 return I != StaticLocalNumbers.end() ? I->second : 1;
10164 assert(LangOpts.CPlusPlus);
10165 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
10171 std::unique_ptr<MangleNumberingContext>
10173 return ABI->createMangleNumberingContext();
10178 return ABI->getCopyConstructorForExceptionObject(
10184 return ABI->addCopyConstructorForExceptionObject(
10191 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
10196 return ABI->getTypedefNameForUnnamedTagDecl(TD);
10201 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
10205 return ABI->getDeclaratorForUnnamedTagDecl(TD);
10209 ParamIndices[D] = index;
10213 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
10214 assert(I != ParamIndices.end() &&
10215 "ParmIndices lacks entry set by ParmVarDecl");
10223 "don't need to cache the computed value for this temporary");
10225 APValue *&MTVI = MaterializedTemporaryValues[E];
10231 return MaterializedTemporaryValues.lookup(E);
10235 unsigned Length)
const {
10261 if (!T.isOSDarwin())
10264 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
10265 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
10274 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
10279 template <
typename T>
10312 bool shouldVisitTemplateInstantiations()
const {
return true; }
10314 bool shouldVisitImplicitCode()
const {
return true; }
10316 template <
typename T,
typename MapNodeTy,
typename BaseTraverseFn,
10318 bool TraverseNode(T
Node, MapNodeTy MapNode, BaseTraverseFn BaseTraverse,
10322 if (ParentStack.size() > 0) {
10333 auto &NodeOrVector = (*Parents)[MapNode];
10334 if (NodeOrVector.isNull()) {
10335 if (
const auto *D = ParentStack.back().get<Decl>())
10337 else if (
const auto *S = ParentStack.back().get<
Stmt>())
10342 if (!NodeOrVector.template is<ParentVector *>()) {
10344 1, getSingleDynTypedNodeFromParentMap(NodeOrVector));
10345 delete NodeOrVector
10347 NodeOrVector = Vector;
10350 auto *Vector = NodeOrVector.template get<ParentVector *>();
10356 std::find(Vector->begin(), Vector->end(),
10357 ParentStack.back()) != Vector->end();
10359 Vector->push_back(ParentStack.back());
10363 bool Result = BaseTraverse();
10364 ParentStack.pop_back();
10368 bool TraverseDecl(Decl *DeclNode) {
10369 return TraverseNode(
10370 DeclNode, DeclNode, [&] {
return VisitorBase::TraverseDecl(DeclNode); },
10371 &Map.PointerParents);
10374 bool TraverseStmt(
Stmt *StmtNode) {
10375 return TraverseNode(
10376 StmtNode, StmtNode, [&] {
return VisitorBase::TraverseStmt(StmtNode); },
10377 &Map.PointerParents);
10380 bool TraverseTypeLoc(
TypeLoc TypeLocNode) {
10381 return TraverseNode(
10383 [&] {
return VisitorBase::TraverseTypeLoc(TypeLocNode); },
10384 &Map.OtherParents);
10388 return TraverseNode(
10390 [&] {
return VisitorBase::TraverseNestedNameSpecifierLoc(NNSLocNode); },
10391 &Map.OtherParents);
10407 Parents = llvm::make_unique<ParentMap>(*this);
10408 return Parents->getParents(Node);
10415 if (MethodDecl->
hasAttr<UnavailableAttr>()
10416 || MethodDecl->
hasAttr<DeprecatedAttr>())
10430 IM != EM && IF != EF; ++IM, ++IF) {
10456 return (*AddrSpaceMap)[(unsigned)AS];
10465 switch (BT->getKind()) {
10467 llvm_unreachable(
"Not a fixed point type!");
10468 case BuiltinType::ShortAccum:
10470 case BuiltinType::Accum:
10472 case BuiltinType::LongAccum:
10474 case BuiltinType::UShortAccum:
10476 case BuiltinType::UAccum:
10478 case BuiltinType::ULongAccum:
10480 case BuiltinType::ShortFract:
10482 case BuiltinType::Fract:
10484 case BuiltinType::LongFract:
10486 case BuiltinType::UShortFract:
10488 case BuiltinType::UFract:
10490 case BuiltinType::ULongFract:
10496 if (LangOpts.OpenCL)
10519 switch (BT->getKind()) {
10521 llvm_unreachable(
"Not a fixed point type!");
10522 case BuiltinType::ShortAccum:
10523 case BuiltinType::SatShortAccum:
10524 return Target.getShortAccumScale();
10525 case BuiltinType::Accum:
10526 case BuiltinType::SatAccum:
10527 return Target.getAccumScale();
10528 case BuiltinType::LongAccum:
10529 case BuiltinType::SatLongAccum:
10530 return Target.getLongAccumScale();
10531 case BuiltinType::UShortAccum:
10532 case BuiltinType::SatUShortAccum:
10533 return Target.getUnsignedShortAccumScale();
10534 case BuiltinType::UAccum:
10535 case BuiltinType::SatUAccum:
10536 return Target.getUnsignedAccumScale();
10537 case BuiltinType::ULongAccum:
10538 case BuiltinType::SatULongAccum:
10539 return Target.getUnsignedLongAccumScale();
10540 case BuiltinType::ShortFract:
10541 case BuiltinType::SatShortFract:
10542 return Target.getShortFractScale();
10543 case BuiltinType::Fract:
10544 case BuiltinType::SatFract:
10545 return Target.getFractScale();
10546 case BuiltinType::LongFract:
10547 case BuiltinType::SatLongFract:
10548 return Target.getLongFractScale();
10549 case BuiltinType::UShortFract:
10550 case BuiltinType::SatUShortFract:
10551 return Target.getUnsignedShortFractScale();
10552 case BuiltinType::UFract:
10553 case BuiltinType::SatUFract:
10554 return Target.getUnsignedFractScale();
10555 case BuiltinType::ULongFract:
10556 case BuiltinType::SatULongFract:
10557 return Target.getUnsignedLongFractScale();
10566 switch (BT->getKind()) {
10568 llvm_unreachable(
"Not a fixed point type!");
10569 case BuiltinType::ShortAccum:
10570 case BuiltinType::SatShortAccum:
10571 return Target.getShortAccumIBits();
10572 case BuiltinType::Accum:
10573 case BuiltinType::SatAccum:
10574 return Target.getAccumIBits();
10575 case BuiltinType::LongAccum:
10576 case BuiltinType::SatLongAccum:
10577 return Target.getLongAccumIBits();
10578 case BuiltinType::UShortAccum:
10579 case BuiltinType::SatUShortAccum:
10580 return Target.getUnsignedShortAccumIBits();
10581 case BuiltinType::UAccum:
10582 case BuiltinType::SatUAccum:
10583 return Target.getUnsignedAccumIBits();
10584 case BuiltinType::ULongAccum:
10585 case BuiltinType::SatULongAccum:
10586 return Target.getUnsignedLongAccumIBits();
10587 case BuiltinType::ShortFract:
10588 case BuiltinType::SatShortFract:
10589 case BuiltinType::Fract:
10590 case BuiltinType::SatFract:
10591 case BuiltinType::LongFract:
10592 case BuiltinType::SatLongFract:
10593 case BuiltinType::UShortFract:
10594 case BuiltinType::SatUShortFract:
10595 case BuiltinType::UFract:
10596 case BuiltinType::SatUFract:
10597 case BuiltinType::ULongFract:
10598 case BuiltinType::SatULongFract:
10605 "Can only get the fixed point semantics for a " 10606 "fixed point or integer type.");
10630 "Expected unsigned fixed point type");
10633 switch (BTy->getKind()) {
10634 case BuiltinType::UShortAccum:
10636 case BuiltinType::UAccum:
10638 case BuiltinType::ULongAccum:
10640 case BuiltinType::SatUShortAccum:
10642 case BuiltinType::SatUAccum:
10644 case BuiltinType::SatULongAccum:
10646 case BuiltinType::UShortFract:
10648 case BuiltinType::UFract:
10650 case BuiltinType::ULongFract:
10652 case BuiltinType::SatUShortFract:
10654 case BuiltinType::SatUFract:
10656 case BuiltinType::SatULongFract:
10659 llvm_unreachable(
"Unexpected unsigned fixed point type");
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...
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
ASTMutationListener * Listener
IntType getInt64Type() const
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.
static APFixedPoint getMax(const FixedPointSemantics &Sema)
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.
bool isFixedPointType() const
Return true if this is a fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169.
ParentMap(ASTContext &Ctx)
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
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
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
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 getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target...
InlineVariableDefinitionKind
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>.
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
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.
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)
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
The fixed point semantics work similarly to llvm::fltSemantics.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
C Language Family Type Representation.
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...
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.
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
CoreFoundationABI CFRuntime
Decl - This represents one declaration (or definition), e.g.
bool isVariadic() const
Whether this function prototype is variadic.
EnumDecl * getPreviousDecl()
CanQualType ObjCBuiltinSelTy
SourceLocation getBeginLoc() const LLVM_READONLY
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.
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
QualType getCorrespondingSignedFixedPointType(QualType Ty) const
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.
unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
DeclarationName getDeclName() const
Get the name of the template.
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)
Interoperability with the latest known version of the Swift runtime.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
__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
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built...
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.
QualType getElementType() const
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
void AddDeallocation(void(*Callback)(void *), void *Data) const
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
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()
unsigned getNumParams() const
bool isEnumeralType() const
APFixedPoint getFixedPointMax(QualType Ty) 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>'.
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration...
Represents an empty template argument, e.g., one that has not been deduced.
Extra information about a function prototype.
Declaration context for names declared as extern "C" in C++.
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.
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.
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 getRegParm() 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 ...
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.
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.
static CGCXXABI * createCXXABI(CodeGenModule &CGM)
unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
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 (within the traversal scope).
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 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...
CharUnits getTypeUnadjustedAlignInChars(QualType T) const
getTypeUnadjustedAlignInChars - Return the ABI-specified alignment of a type, in characters, before alignment adjustments.
The iterator over UnresolvedSets.
Interoperability with the Swift 4.1 runtime.
Represents the result of substituting a set of types for a template type parameter pack...
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.
__DEVICE__ int max(int __a, int __b)
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
static ast_type_traits::DynTypedNode createDynTypedNode(const T &Node)
Template specializations to abstract away from pointers and TypeLocs.
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.
static APFixedPoint getMin(const FixedPointSemantics &Sema)
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.
Expr * getCopyExpr() const
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...
An unqualified-id that has been assumed to name a function template that will be found by ADL...
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.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
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.
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.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
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
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
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.
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...
Defines the Linkage enumeration and various utility functions.
Represents an Objective-C protocol declaration.
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...
ASTVisitor(ParentMap &Map)
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 getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
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.
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
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.
The APFixedPoint class works similarly to APInt/APSInt in that it is a functional replacement for a s...
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
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
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.
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
Represents a ValueDecl that came out of a declarator.
unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
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/...
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.
unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
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.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
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?
ExtParameterInfo withIsNoEscape(bool NoEscape) const
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.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
bool isMultiVersion() const
True if this function is considered a multiversioned function.
This represents one expression.
Defines the clang::LangOptions interface.
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...
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.
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 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.
ObjCLifetime getObjCLifetime() const
void removeFastQualifiers(unsigned mask)
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)
Set the copy initialization expression of a block var decl.
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)
LangAS getLangASForBuiltinAddressSpace(unsigned AS) const
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.
bool TraverseAST(ASTContext &AST)
Recursively visits an entire AST, starting from the top-level Decls in the AST traversal scope (by de...
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)
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
unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
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
static bool CanThrow(Expr *E, ASTContext &Ctx)
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...
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...
void setOriginalDecl(const Decl *Orig)
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.
QualType getAttributedType(attr::Kind attrKind, QualType modifiedType, QualType equivalentType)
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...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
noexcept(expression), evals to 'false'
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.
QualType getWideCharType() const
Return the type of wide characters.
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.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to...
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
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...
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.
StringLiteral * getPredefinedStringLiteralFromCache(StringRef Key) const
Return a string representing the human readable name for the specified function declaration or file n...
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.
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...
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.
virtual LangAS getOpenCLBuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space...
CallingConv getCC() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getElementType() const
static QualType getUnderlyingType(const SubRegion *R)
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
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.
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.
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 ...'
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
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
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...
FixedPointSemantics getFixedPointSemantics(QualType Ty) const
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
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)
Defines the fixed point number interface.
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.
void setTraversalScope(const std::vector< Decl *> &)
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
IntType
===-— Target Data Type Query Methods ----------------------------—===//
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.
CanQualType UnsignedShortTy
ObjCIvarDecl * getNextIvar()
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...
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.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
A RecursiveASTVisitor that builds a map from nodes to their parents as defined by the RecursiveASTVis...
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.
APFixedPoint getFixedPointMin(QualType Ty) const
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
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
CanQualType UnsignedLongLongTy
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built...
unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built...
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)
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()'.
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)
static FixedPointSemantics GetIntegerSemantics(unsigned Width, bool IsSigned)
Return the FixedPointSemantics for an integer type.
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.
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)
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.
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
CanQualType ObjCBuiltinBoolTy
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...
QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const
Return a type for a constant array for a string literal of the specified element type and length...
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.
bool doUnsignedFixedPointTypesHavePadding() const
In the event this target uses the same number of fractional bits for its unsigned types as it does wi...
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
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 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 ...
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.
int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const
Compare the rank of two floating point types as above, but compare equal if both types have the same ...
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.
Holds information about the various types of exception specification.
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
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)
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.
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...
DynTypedNodeList getParents(const ast_type_traits::DynTypedNode &Node)
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.
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)
Interoperability with the Swift 4.2 runtime.
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.
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. ...
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...
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
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.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
A structure for storing the information associated with a name that has been assumed to be a template...
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...
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.
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
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'.
virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space...
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
__DEVICE__ int min(int __a, int __b)
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
StringLiteral - This represents a string literal expression, e.g.
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.
static Decl::Kind getKind(const Decl *D)
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
unsigned getNumElements() const
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
static bool NeedsInjectedClassNameType(const RecordDecl *D)
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.
Microsoft __declspec(nothrow) extension.
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
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types ...
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false) const
C++11 deduced auto type.
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.
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
A simple holder for a QualType representing a type in an exception specification. ...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
void setAccess(AccessSpecifier AS)
unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
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 NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
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()
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.
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.