64 #include "llvm/ADT/APInt.h" 65 #include "llvm/ADT/APSInt.h" 66 #include "llvm/ADT/ArrayRef.h" 67 #include "llvm/ADT/DenseMap.h" 68 #include "llvm/ADT/DenseSet.h" 69 #include "llvm/ADT/FoldingSet.h" 70 #include "llvm/ADT/None.h" 71 #include "llvm/ADT/Optional.h" 72 #include "llvm/ADT/PointerUnion.h" 73 #include "llvm/ADT/STLExtras.h" 74 #include "llvm/ADT/SmallPtrSet.h" 75 #include "llvm/ADT/SmallVector.h" 76 #include "llvm/ADT/StringExtras.h" 77 #include "llvm/ADT/StringRef.h" 78 #include "llvm/ADT/Triple.h" 79 #include "llvm/Support/Capacity.h" 80 #include "llvm/Support/Casting.h" 81 #include "llvm/Support/Compiler.h" 82 #include "llvm/Support/ErrorHandling.h" 83 #include "llvm/Support/MathExtras.h" 84 #include "llvm/Support/raw_ostream.h" 96 using namespace clang;
121 assert(std::is_sorted(RawComments.begin(), RawComments.end(),
135 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
140 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
141 if (VD->isStaticDataMember() &&
146 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
151 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
158 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
162 if (
const auto *TD = dyn_cast<TagDecl>(D)) {
165 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
169 if (isa<ParmVarDecl>(D))
174 if (isa<TemplateTypeParmDecl>(D) ||
175 isa<NonTypeTemplateParmDecl>(D) ||
176 isa<TemplateTemplateParmDecl>(D))
182 if (RawComments.empty())
192 if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) ||
193 isa<ObjCPropertyDecl>(D) ||
194 isa<RedeclarableTemplateDecl>(D) ||
195 isa<ClassTemplateSpecializationDecl>(D))
200 if (isa<TypedefDecl>(D)) {
205 }
else if (
const auto *TD = dyn_cast<TagDecl>(D)) {
212 TD->isCompleteDefinition())
233 bool Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
234 if (!Found && RawComments.size() >= 2) {
236 Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
240 Comment = MaybeBeforeDecl + 1;
241 assert(Comment == std::lower_bound(RawComments.begin(), RawComments.end(),
242 &CommentAtDeclLoc, Compare));
245 Comment = std::lower_bound(RawComments.begin(), RawComments.end(),
246 &CommentAtDeclLoc, Compare);
252 std::pair<FileID, unsigned> DeclLocDecomp = SourceMgr.
getDecomposedLoc(DeclLoc);
255 if (Comment != RawComments.end() &&
257 && (*Comment)->isTrailingComment() &&
258 (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
259 isa<ObjCMethodDecl>(D) || isa<ObjCPropertyDecl>(D))) {
260 std::pair<FileID, unsigned> CommentBeginDecomp
264 if (DeclLocDecomp.first == CommentBeginDecomp.first &&
265 SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second)
267 CommentBeginDecomp.second)) {
274 if (Comment == RawComments.begin())
279 if (!((*Comment)->isDocumentation() ||
281 (*Comment)->isTrailingComment())
285 std::pair<FileID, unsigned> CommentEndDecomp
290 if (DeclLocDecomp.first != CommentEndDecomp.first)
294 bool Invalid =
false;
295 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
301 StringRef
Text(Buffer + CommentEndDecomp.second,
302 DeclLocDecomp.second - CommentEndDecomp.second);
306 if (Text.find_first_of(
";{}#@") != StringRef::npos)
316 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
336 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
339 if (VD->isStaticDataMember())
345 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
352 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
358 return PU.is<ClassTemplateDecl*>() ?
359 static_cast<const Decl*>(PU.get<ClassTemplateDecl *>()) :
360 static_cast<const Decl*>(
366 CRD->getMemberSpecializationInfo())
367 return Info->getInstantiatedFrom();
371 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
384 const Decl **OriginalDecl)
const {
389 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
403 const Decl *OriginalDeclForRC =
nullptr;
405 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
416 OriginalDeclForRC = I;
436 *OriginalDecl = OriginalDeclForRC;
456 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
465 Redeclared.push_back(RedeclaredMethod);
471 const Decl *D)
const {
474 ThisDeclInfo->IsFilled =
false;
475 ThisDeclInfo->fill();
476 ThisDeclInfo->CommentDecl = FC->
getDecl();
477 if (!ThisDeclInfo->TemplateParameters)
487 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
498 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
502 if (Canonical != D) {
510 const Decl *OriginalDecl;
514 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
517 if (OMD && OMD->isPropertyAccessor())
524 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
528 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(D)) {
531 QualType QT = TD->getUnderlyingType();
533 if (
const Decl *TD = TT->getDecl())
537 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(D)) {
538 while (IC->getSuperClass()) {
539 IC = IC->getSuperClass();
544 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(D)) {
549 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
550 if (!(RD = RD->getDefinition()))
553 for (
const auto &I : RD->bases()) {
554 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
560 if (!(NonVirtualBase= NonVirtualBase->getDefinition()))
568 for (
const auto &I : RD->vbases()) {
575 if (!(VirtualBase= VirtualBase->getDefinition()))
589 if (D != OriginalDecl)
598 ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &
ID,
605 ID.AddInteger(Params->
size());
607 PEnd = Params->
end();
609 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
611 ID.AddBoolean(TTP->isParameterPack());
615 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
617 ID.AddBoolean(NTTP->isParameterPack());
618 ID.AddPointer(NTTP->getType().getCanonicalType().getAsOpaquePtr());
619 if (NTTP->isExpandedParameterPack()) {
621 ID.AddInteger(NTTP->getNumExpansionTypes());
622 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
623 QualType T = NTTP->getExpansionType(I);
627 ID.AddBoolean(
false);
631 auto *TTP = cast<TemplateTemplateParmDecl>(*P);
638 ASTContext::getCanonicalTemplateTemplateParmDecl(
641 llvm::FoldingSetNodeID
ID;
642 CanonicalTemplateTemplateParm::Profile(ID, TTP);
643 void *InsertPos =
nullptr;
644 CanonicalTemplateTemplateParm *Canonical
645 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
647 return Canonical->getParam();
652 CanonParams.reserve(Params->
size());
654 PEnd = Params->
end();
656 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P))
657 CanonParams.push_back(
664 else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
668 if (NTTP->isExpandedParameterPack()) {
671 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
673 ExpandedTInfos.push_back(
681 NTTP->getPosition(),
nullptr,
691 NTTP->getPosition(),
nullptr,
693 NTTP->isParameterPack(),
696 CanonParams.push_back(Param);
699 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
700 cast<TemplateTemplateParmDecl>(*
P)));
704 "Unexpected requires-clause on template template-parameter");
705 Expr *
const CanonRequiresClause =
nullptr;
717 CanonRequiresClause));
720 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
721 assert(!Canonical &&
"Shouldn't be in the map!");
725 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
726 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
731 if (!LangOpts.CPlusPlus)
return nullptr;
746 llvm_unreachable(
"Invalid CXXABI type!");
751 if (LOpts.FakeAddressSpaceMap) {
754 static const unsigned FakeAddrSpaceMap[] = {
765 return &FakeAddrSpaceMap;
773 switch (LangOpts.getAddressSpaceMapMangling()) {
781 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
787 : FunctionProtoTypes(this_()), TemplateSpecializationTypes(this_()),
788 DependentTemplateSpecializationTypes(this_()),
789 SubstTemplateTemplateParmPacks(this_()), SourceMgr(SM), LangOpts(LOpts),
792 LangOpts.XRayNeverInstrumentFiles,
793 LangOpts.XRayAttrListFiles, SM)),
796 CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
799 TraversalScope = {TUDecl};
805 ReleaseDeclContextMaps();
808 for (
auto &Pair : Deallocations)
809 (Pair.first)(Pair.second);
815 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
817 if (
auto *R = const_cast<ASTRecordLayout *>((I++)->second))
820 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
821 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
823 if (
auto *R = const_cast<ASTRecordLayout *>((I++)->second))
827 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
828 AEnd = DeclAttrs.end();
830 A->second->~AttrVec();
832 for (std::pair<const MaterializeTemporaryExpr *, APValue *> &MTVPair :
833 MaterializedTemporaryValues)
834 MTVPair.second->~APValue();
836 for (
const auto &
Value : ModuleInitializers)
837 Value.second->~PerModuleInitializers();
847 using ParentMapPointers = llvm::DenseMap<
849 llvm::PointerUnion4<
const Decl *,
const Stmt *,
854 using ParentMapOtherNodes = llvm::DenseMap<
856 llvm::PointerUnion4<
const Decl *,
const Stmt *,
857 ast_type_traits::DynTypedNode *, ParentVector *>>;
859 ParentMapPointers PointerParents;
860 ParentMapOtherNodes OtherParents;
863 static ast_type_traits::DynTypedNode
864 getSingleDynTypedNodeFromParentMap(ParentMapPointers::mapped_type U) {
865 if (
const auto *D = U.dyn_cast<
const Decl *>())
867 if (
const auto *S = U.dyn_cast<
const Stmt *>())
869 return *U.get<ast_type_traits::DynTypedNode *>();
872 template <
typename NodeTy,
typename MapTy>
875 auto I = Map.find(Node);
876 if (I == Map.end()) {
879 if (
const auto *V = I->second.template dyn_cast<ParentVector *>()) {
880 return llvm::makeArrayRef(*V);
882 return getSingleDynTypedNodeFromParentMap(I->second);
888 for (
const auto &Entry : PointerParents) {
889 if (Entry.second.is<ast_type_traits::DynTypedNode *>()) {
890 delete Entry.second.get<ast_type_traits::DynTypedNode *>();
891 }
else if (Entry.second.is<ParentVector *>()) {
892 delete Entry.second.get<ParentVector *>();
895 for (
const auto &Entry : OtherParents) {
896 if (Entry.second.is<ast_type_traits::DynTypedNode *>()) {
897 delete Entry.second.get<ast_type_traits::DynTypedNode *>();
898 }
else if (Entry.second.is<ParentVector *>()) {
899 delete Entry.second.get<ParentVector *>();
907 return getDynNodeFromMap(Node, OtherParents);
912 TraversalScope = TopLevelDecls;
917 Deallocations.push_back({Callback, Data});
926 llvm::errs() <<
"\n*** AST Context Stats:\n";
927 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
929 unsigned counts[] = {
930 #define TYPE(Name, Parent) 0, 931 #define ABSTRACT_TYPE(Name, Parent) 932 #include "clang/AST/TypeNodes.def" 936 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
942 unsigned TotalBytes = 0;
943 #define TYPE(Name, Parent) \ 945 llvm::errs() << " " << counts[Idx] << " " << #Name \ 946 << " types, " << sizeof(Name##Type) << " each " \ 947 << "(" << counts[Idx] * sizeof(Name##Type) \ 949 TotalBytes += counts[Idx] * sizeof(Name##Type); \ 951 #define ABSTRACT_TYPE(Name, Parent) 952 #include "clang/AST/TypeNodes.def" 954 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
959 <<
" implicit default constructors created\n";
962 <<
" implicit copy constructors created\n";
966 <<
" implicit move constructors created\n";
969 <<
" implicit copy assignment operators created\n";
973 <<
" implicit move assignment operators created\n";
976 <<
" implicit destructors created\n";
979 llvm::errs() <<
"\n";
983 BumpAlloc.PrintStats();
987 bool NotifyListeners) {
997 if (It == MergedDefModules.end())
1000 auto &Merged = It->second;
1002 for (
Module *&M : Merged)
1003 if (!Found.insert(M).second)
1005 Merged.erase(std::remove(Merged.begin(), Merged.end(),
nullptr), Merged.end());
1008 void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1009 if (LazyInitializers.empty())
1013 assert(Source &&
"lazy initializers but no external source");
1015 auto LazyInits = std::move(LazyInitializers);
1016 LazyInitializers.clear();
1018 for (
auto ID : LazyInits)
1019 Initializers.push_back(Source->GetExternalDecl(
ID));
1021 assert(LazyInitializers.empty() &&
1022 "GetExternalDecl for lazy module initializer added more inits");
1028 if (
const auto *
ID = dyn_cast<ImportDecl>(D)) {
1029 auto It = ModuleInitializers.find(
ID->getImportedModule());
1032 if (It == ModuleInitializers.end())
1036 auto &Imported = *It->second;
1037 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1038 Imported.resolve(*
this);
1039 auto *OnlyDecl = Imported.Initializers.front();
1040 if (isa<ImportDecl>(OnlyDecl))
1045 auto *&
Inits = ModuleInitializers[M];
1047 Inits =
new (*this) PerModuleInitializers;
1048 Inits->Initializers.push_back(D);
1052 auto *&
Inits = ModuleInitializers[M];
1054 Inits =
new (*this) PerModuleInitializers;
1055 Inits->LazyInitializers.insert(
Inits->LazyInitializers.end(),
1056 IDs.begin(), IDs.end());
1060 auto It = ModuleInitializers.find(M);
1061 if (It == ModuleInitializers.end())
1064 auto *
Inits = It->second;
1065 Inits->resolve(*
this);
1066 return Inits->Initializers;
1070 if (!ExternCContext)
1073 return ExternCContext;
1080 BuiltinTemplate->setImplicit();
1081 TUDecl->addDecl(BuiltinTemplate);
1083 return BuiltinTemplate;
1088 if (!MakeIntegerSeqDecl)
1091 return MakeIntegerSeqDecl;
1096 if (!TypePackElementDecl)
1099 return TypePackElementDecl;
1113 NewDecl->addAttr(TypeVisibilityAttr::CreateImplicit(
1119 StringRef Name)
const {
1143 Types.push_back(Ty);
1148 assert((!this->Target || this->Target == &Target) &&
1149 "Incorrect target reinitialization");
1152 this->Target = &Target;
1153 this->AuxTarget = AuxTarget;
1160 InitBuiltinType(
VoidTy, BuiltinType::Void);
1163 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1165 if (LangOpts.CharIsSigned)
1166 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1168 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1171 InitBuiltinType(
ShortTy, BuiltinType::Short);
1172 InitBuiltinType(
IntTy, BuiltinType::Int);
1173 InitBuiltinType(
LongTy, BuiltinType::Long);
1174 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1184 InitBuiltinType(
FloatTy, BuiltinType::Float);
1185 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1186 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1189 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1192 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1195 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1196 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1197 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1201 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1202 InitBuiltinType(
FractTy, BuiltinType::Fract);
1203 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1208 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1214 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1221 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1226 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1228 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1229 if (LangOpts.CPlusPlus && LangOpts.WChar)
1233 WideCharTy = getFromTargetType(Target.getWCharType());
1236 WIntTy = getFromTargetType(Target.getWIntType());
1239 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1241 if (LangOpts.CPlusPlus)
1242 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1244 Char16Ty = getFromTargetType(Target.getChar16Type());
1246 if (LangOpts.CPlusPlus)
1247 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1249 Char32Ty = getFromTargetType(Target.getChar32Type());
1256 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1259 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1268 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1274 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1277 if (LangOpts.OpenMP)
1291 if (LangOpts.OpenCL) {
1292 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1293 InitBuiltinType(SingletonId, BuiltinType::Id); 1294 #include "clang/Basic/OpenCLImageTypes.def" 1296 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1297 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1299 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1302 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 1303 InitBuiltinType(Id##Ty, BuiltinType::Id); 1304 #include "clang/Basic/OpenCLExtensionTypes.def" 1311 ObjCConstantStringType =
QualType();
1316 if (LangOpts.OpenCLVersion >= 200) {
1326 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1329 InitBuiltinType(
HalfTy, BuiltinType::Half);
1336 return SourceMgr.getDiagnostics();
1351 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1352 if (Pos != DeclAttrs.end()) {
1353 Pos->second->~AttrVec();
1354 DeclAttrs.erase(Pos);
1368 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1369 TemplateOrInstantiation.find(Var);
1370 if (Pos == TemplateOrInstantiation.end())
1383 Tmpl, TSK, PointOfInstantiation));
1389 assert(!TemplateOrInstantiation[Inst] &&
1390 "Already noted what the variable was instantiated from");
1391 TemplateOrInstantiation[Inst] = TSI;
1396 assert(FD &&
"Specialization is 0");
1397 llvm::DenseMap<const FunctionDecl*, FunctionDecl *>::const_iterator Pos
1398 = ClassScopeSpecializationPattern.find(FD);
1399 if (Pos == ClassScopeSpecializationPattern.end())
1407 assert(FD &&
"Specialization is 0");
1408 assert(Pattern &&
"Class scope specialization pattern is 0");
1409 ClassScopeSpecializationPattern[FD] = Pattern;
1414 auto Pos = InstantiatedFromUsingDecl.find(UUD);
1415 if (Pos == InstantiatedFromUsingDecl.end())
1423 assert((isa<UsingDecl>(Pattern) ||
1424 isa<UnresolvedUsingValueDecl>(Pattern) ||
1425 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1426 "pattern decl is not a using decl");
1427 assert((isa<UsingDecl>(Inst) ||
1428 isa<UnresolvedUsingValueDecl>(Inst) ||
1429 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1430 "instantiation did not produce a using decl");
1431 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1432 InstantiatedFromUsingDecl[Inst] = Pattern;
1437 llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>::const_iterator Pos
1438 = InstantiatedFromUsingShadowDecl.find(Inst);
1439 if (Pos == InstantiatedFromUsingShadowDecl.end())
1448 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1449 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1453 llvm::DenseMap<FieldDecl *, FieldDecl *>::iterator Pos
1454 = InstantiatedFromUnnamedFieldDecl.find(Field);
1455 if (Pos == InstantiatedFromUnnamedFieldDecl.end())
1463 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1464 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1465 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1466 "Already noted what unnamed field was instantiated from");
1468 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1484 return Range.end() - Range.begin();
1489 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1491 if (Pos == OverriddenMethods.end())
1499 OverriddenMethods[Method].push_back(Overridden);
1507 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1518 Method->getOverriddenMethods(OverDecls);
1519 Overridden.append(OverDecls.begin(), OverDecls.end());
1523 assert(!Import->NextLocalImport &&
"Import declaration already in the chain");
1524 assert(!Import->
isFromASTFile() &&
"Non-local import declaration");
1525 if (!FirstLocalImport) {
1526 FirstLocalImport = Import;
1527 LastLocalImport = Import;
1531 LastLocalImport->NextLocalImport = Import;
1532 LastLocalImport = Import;
1543 assert(BT &&
"Not a floating point type!");
1544 switch (BT->getKind()) {
1545 default: llvm_unreachable(
"Not a floating point type!");
1546 case BuiltinType::Float16:
1547 case BuiltinType::Half:
1548 return Target->getHalfFormat();
1549 case BuiltinType::Float:
return Target->getFloatFormat();
1550 case BuiltinType::Double:
return Target->getDoubleFormat();
1551 case BuiltinType::LongDouble:
return Target->getLongDoubleFormat();
1552 case BuiltinType::Float128:
return Target->getFloat128Format();
1557 unsigned Align =
Target->getCharWidth();
1559 bool UseAlignAttrOnly =
false;
1561 Align = AlignFromAttr;
1569 if (isa<FieldDecl>(D)) {
1570 UseAlignAttrOnly = D->
hasAttr<PackedAttr>() ||
1571 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1573 UseAlignAttrOnly =
true;
1576 else if (isa<FieldDecl>(D))
1579 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1583 if (UseAlignAttrOnly) {
1585 }
else if (
const auto *VD = dyn_cast<ValueDecl>(D)) {
1595 Align = getTypeInfoImpl(T.
getTypePtr()).Align;
1596 else if (!BaseT->isIncompleteType()) {
1600 unsigned MinWidth =
Target->getLargeArrayMinWidth();
1601 if (!ForAlignof && MinWidth) {
1604 else if (isa<ConstantArrayType>(
arrayType) &&
1605 MinWidth <= getTypeSize(cast<ConstantArrayType>(
arrayType)))
1610 if (BaseT.getQualifiers().hasUnaligned())
1611 Align =
Target->getCharWidth();
1612 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
1613 if (VD->hasGlobalStorage() && !ForAlignof)
1623 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1637 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1638 if (LowBitOfOffset < FieldAlign)
1639 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1642 Align =
std::min(Align, FieldAlign);
1654 std::pair<CharUnits, CharUnits>
1668 return sizeAndAlign;
1673 std::pair<CharUnits, CharUnits>
1676 std::pair<CharUnits, CharUnits> EltInfo =
1678 uint64_t Size = CAT->
getSize().getZExtValue();
1679 assert((Size == 0 || static_cast<uint64_t>(EltInfo.first.getQuantity()) <=
1680 (uint64_t)(-1)/Size) &&
1681 "Overflow in array type char size evaluation");
1682 uint64_t Width = EltInfo.first.getQuantity() * Size;
1683 unsigned Align = EltInfo.second.getQuantity();
1686 Width = llvm::alignTo(Width, Align);
1691 std::pair<CharUnits, CharUnits>
1693 if (
const auto *CAT = dyn_cast<ConstantArrayType>(T))
1700 std::pair<CharUnits, CharUnits>
1716 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1727 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1732 return TT->getDecl()->getMaxAlignment();
1738 TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
1739 if (I != MemoizedTypeInfo.end())
1744 MemoizedTypeInfo[T] = TI;
1754 TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
1757 bool AlignIsRequired =
false;
1760 #define TYPE(Class, Base) 1761 #define ABSTRACT_TYPE(Class, Base) 1762 #define NON_CANONICAL_TYPE(Class, Base) 1763 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 1764 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \ 1766 assert(!T->isDependentType() && "should not see dependent types here"); \ 1767 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr()); 1768 #include "clang/AST/TypeNodes.def" 1769 llvm_unreachable(
"Should not see dependent types");
1771 case Type::FunctionNoProto:
1772 case Type::FunctionProto:
1778 case Type::IncompleteArray:
1779 case Type::VariableArray:
1781 Align =
getTypeAlign(cast<ArrayType>(T)->getElementType());
1784 case Type::ConstantArray: {
1785 const auto *CAT = cast<ConstantArrayType>(T);
1788 uint64_t Size = CAT->getSize().getZExtValue();
1789 assert((Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) &&
1790 "Overflow in array type bit size evaluation");
1791 Width = EltInfo.Width * Size;
1792 Align = EltInfo.Align;
1795 Width = llvm::alignTo(Width, Align);
1798 case Type::ExtVector:
1799 case Type::Vector: {
1800 const auto *VT = cast<VectorType>(T);
1802 Width = EltInfo.
Width * VT->getNumElements();
1806 if (Align & (Align-1)) {
1807 Align = llvm::NextPowerOf2(Align);
1808 Width = llvm::alignTo(Width, Align);
1811 uint64_t TargetVectorAlign =
Target->getMaxVectorAlign();
1812 if (TargetVectorAlign && TargetVectorAlign < Align)
1813 Align = TargetVectorAlign;
1818 switch (cast<BuiltinType>(T)->
getKind()) {
1819 default: llvm_unreachable(
"Unknown builtin type!");
1820 case BuiltinType::Void:
1825 case BuiltinType::Bool:
1826 Width =
Target->getBoolWidth();
1827 Align =
Target->getBoolAlign();
1829 case BuiltinType::Char_S:
1830 case BuiltinType::Char_U:
1831 case BuiltinType::UChar:
1832 case BuiltinType::SChar:
1833 case BuiltinType::Char8:
1834 Width =
Target->getCharWidth();
1835 Align =
Target->getCharAlign();
1837 case BuiltinType::WChar_S:
1838 case BuiltinType::WChar_U:
1839 Width =
Target->getWCharWidth();
1840 Align =
Target->getWCharAlign();
1842 case BuiltinType::Char16:
1843 Width =
Target->getChar16Width();
1844 Align =
Target->getChar16Align();
1846 case BuiltinType::Char32:
1847 Width =
Target->getChar32Width();
1848 Align =
Target->getChar32Align();
1850 case BuiltinType::UShort:
1851 case BuiltinType::Short:
1852 Width =
Target->getShortWidth();
1853 Align =
Target->getShortAlign();
1855 case BuiltinType::UInt:
1856 case BuiltinType::Int:
1857 Width =
Target->getIntWidth();
1858 Align =
Target->getIntAlign();
1860 case BuiltinType::ULong:
1861 case BuiltinType::Long:
1862 Width =
Target->getLongWidth();
1863 Align =
Target->getLongAlign();
1865 case BuiltinType::ULongLong:
1866 case BuiltinType::LongLong:
1867 Width =
Target->getLongLongWidth();
1868 Align =
Target->getLongLongAlign();
1870 case BuiltinType::Int128:
1871 case BuiltinType::UInt128:
1875 case BuiltinType::ShortAccum:
1876 case BuiltinType::UShortAccum:
1877 case BuiltinType::SatShortAccum:
1878 case BuiltinType::SatUShortAccum:
1879 Width =
Target->getShortAccumWidth();
1880 Align =
Target->getShortAccumAlign();
1882 case BuiltinType::Accum:
1883 case BuiltinType::UAccum:
1884 case BuiltinType::SatAccum:
1885 case BuiltinType::SatUAccum:
1886 Width =
Target->getAccumWidth();
1887 Align =
Target->getAccumAlign();
1889 case BuiltinType::LongAccum:
1890 case BuiltinType::ULongAccum:
1891 case BuiltinType::SatLongAccum:
1892 case BuiltinType::SatULongAccum:
1893 Width =
Target->getLongAccumWidth();
1894 Align =
Target->getLongAccumAlign();
1896 case BuiltinType::ShortFract:
1897 case BuiltinType::UShortFract:
1898 case BuiltinType::SatShortFract:
1899 case BuiltinType::SatUShortFract:
1900 Width =
Target->getShortFractWidth();
1901 Align =
Target->getShortFractAlign();
1903 case BuiltinType::Fract:
1904 case BuiltinType::UFract:
1905 case BuiltinType::SatFract:
1906 case BuiltinType::SatUFract:
1907 Width =
Target->getFractWidth();
1908 Align =
Target->getFractAlign();
1910 case BuiltinType::LongFract:
1911 case BuiltinType::ULongFract:
1912 case BuiltinType::SatLongFract:
1913 case BuiltinType::SatULongFract:
1914 Width =
Target->getLongFractWidth();
1915 Align =
Target->getLongFractAlign();
1917 case BuiltinType::Float16:
1918 case BuiltinType::Half:
1919 Width =
Target->getHalfWidth();
1920 Align =
Target->getHalfAlign();
1922 case BuiltinType::Float:
1923 Width =
Target->getFloatWidth();
1924 Align =
Target->getFloatAlign();
1926 case BuiltinType::Double:
1927 Width =
Target->getDoubleWidth();
1928 Align =
Target->getDoubleAlign();
1930 case BuiltinType::LongDouble:
1931 Width =
Target->getLongDoubleWidth();
1932 Align =
Target->getLongDoubleAlign();
1934 case BuiltinType::Float128:
1935 Width =
Target->getFloat128Width();
1936 Align =
Target->getFloat128Align();
1938 case BuiltinType::NullPtr:
1939 Width =
Target->getPointerWidth(0);
1940 Align =
Target->getPointerAlign(0);
1942 case BuiltinType::ObjCId:
1943 case BuiltinType::ObjCClass:
1944 case BuiltinType::ObjCSel:
1945 Width =
Target->getPointerWidth(0);
1946 Align =
Target->getPointerAlign(0);
1948 case BuiltinType::OCLSampler:
1949 case BuiltinType::OCLEvent:
1950 case BuiltinType::OCLClkEvent:
1951 case BuiltinType::OCLQueue:
1952 case BuiltinType::OCLReserveID:
1953 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1954 case BuiltinType::Id: 1955 #include "clang/Basic/OpenCLImageTypes.def" 1956 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 1957 case BuiltinType::Id: 1958 #include "clang/Basic/OpenCLExtensionTypes.def" 1961 Width =
Target->getPointerWidth(AS);
1962 Align =
Target->getPointerAlign(AS);
1966 case Type::ObjCObjectPointer:
1967 Width =
Target->getPointerWidth(0);
1968 Align =
Target->getPointerAlign(0);
1970 case Type::BlockPointer:
1972 Width =
Target->getPointerWidth(AS);
1973 Align =
Target->getPointerAlign(AS);
1975 case Type::LValueReference:
1976 case Type::RValueReference:
1980 Width =
Target->getPointerWidth(AS);
1981 Align =
Target->getPointerAlign(AS);
1985 Width =
Target->getPointerWidth(AS);
1986 Align =
Target->getPointerAlign(AS);
1988 case Type::MemberPointer: {
1989 const auto *MPT = cast<MemberPointerType>(T);
1995 case Type::Complex: {
1999 Width = EltInfo.
Width * 2;
2000 Align = EltInfo.
Align;
2003 case Type::ObjCObject:
2004 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr());
2005 case Type::Adjusted:
2008 case Type::ObjCInterface: {
2009 const auto *ObjCI = cast<ObjCInterfaceType>(T);
2011 Width =
toBits(Layout.getSize());
2012 Align =
toBits(Layout.getAlignment());
2017 const auto *TT = cast<TagType>(T);
2019 if (TT->getDecl()->isInvalidDecl()) {
2025 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
2026 const EnumDecl *ED = ET->getDecl();
2030 Info.
Align = AttrAlign;
2036 const auto *RT = cast<RecordType>(TT);
2041 AlignIsRequired = RD->hasAttr<AlignedAttr>();
2045 case Type::SubstTemplateTypeParm:
2046 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
2047 getReplacementType().getTypePtr());
2050 case Type::DeducedTemplateSpecialization: {
2051 const auto *A = cast<DeducedType>(T);
2052 assert(!A->getDeducedType().isNull() &&
2053 "cannot request the size of an undeduced or dependent auto type");
2054 return getTypeInfo(A->getDeducedType().getTypePtr());
2058 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr());
2060 case Type::ObjCTypeParam:
2061 return getTypeInfo(cast<ObjCTypeParamType>(T)->desugar().getTypePtr());
2063 case Type::Typedef: {
2071 AlignIsRequired =
true;
2080 case Type::Elaborated:
2081 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
2083 case Type::Attributed:
2085 cast<AttributedType>(T)->getEquivalentType().getTypePtr());
2087 case Type::Atomic: {
2096 Width =
Target->getCharWidth();
2098 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2104 if (!llvm::isPowerOf2_64(Width))
2105 Width = llvm::NextPowerOf2(Width);
2108 Align =
static_cast<unsigned>(Width);
2119 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2120 return TypeInfo(Width, Align, AlignIsRequired);
2124 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(T);
2125 if (I != MemoizedUnadjustedAlign.end())
2128 unsigned UnadjustedAlign;
2140 MemoizedUnadjustedAlign[T] = UnadjustedAlign;
2141 return UnadjustedAlign;
2147 if ((
getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 ||
2148 getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) &&
2199 unsigned ABIAlign = TI.
Align;
2207 if (!
Target->allowsLargerPreferedTypeAlignment())
2212 T = CT->getElementType().getTypePtr();
2214 T = ET->getDecl()->getIntegerType().getTypePtr();
2266 for (
const auto *I : OI->
ivars())
2270 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2272 Ivars.push_back(Iv);
2279 llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols) {
2280 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2283 for (
auto *Proto : OI->all_referenced_protocols()) {
2288 for (
const auto *Cat : OI->visible_categories())
2294 SD = SD->getSuperClass();
2296 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2297 for (
auto *Proto : OC->protocols()) {
2300 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2302 if (!Protocols.insert(
2303 const_cast<ObjCProtocolDecl *>(OP->getCanonicalDecl())).second)
2306 for (
auto *Proto : OP->protocols())
2313 assert(RD->
isUnion() &&
"Must be union type");
2316 for (
const auto *Field : RD->
fields()) {
2320 if (FieldSize != UnionSize)
2332 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
2333 return ClassDecl->isEmpty();
2341 assert(!RD->
isUnion() &&
"Must be struct/class type");
2344 int64_t CurOffsetInBits = 0;
2345 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2346 if (ClassDecl->isDynamicClass())
2350 for (
const auto Base : ClassDecl->bases()) {
2358 Bases.emplace_back(
Base.getType(), Size.getValue());
2362 llvm::sort(Bases, [&](
const std::pair<QualType, int64_t> &L,
2363 const std::pair<QualType, int64_t> &R) {
2364 return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) <
2365 Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
2368 for (
const auto Base : Bases) {
2369 int64_t BaseOffset = Context.
toBits(
2370 Layout.getBaseClassOffset(
Base.first->getAsCXXRecordDecl()));
2371 int64_t BaseSize =
Base.second;
2372 if (BaseOffset != CurOffsetInBits)
2374 CurOffsetInBits = BaseOffset + BaseSize;
2378 for (
const auto *Field : RD->
fields()) {
2379 if (!Field->getType()->isReferenceType() &&
2383 int64_t FieldSizeInBits =
2385 if (Field->isBitField()) {
2386 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2388 if (BitfieldSize > FieldSizeInBits)
2390 FieldSizeInBits = BitfieldSize;
2395 if (FieldOffsetInBits != CurOffsetInBits)
2398 CurOffsetInBits = FieldSizeInBits + FieldOffsetInBits;
2401 return CurOffsetInBits;
2422 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2442 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2457 return StructSize &&
2458 StructSize.getValue() ==
static_cast<int64_t
>(
getTypeSize(Ty));
2479 count += Ext->ivar_size();
2484 count += ImplDecl->ivar_size();
2502 if (isa<GNUNullExpr>(E))
return true;
2510 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2511 I = ObjCImpls.find(D);
2512 if (I != ObjCImpls.end())
2513 return cast<ObjCImplementationDecl>(I->second);
2520 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2521 I = ObjCImpls.find(D);
2522 if (I != ObjCImpls.end())
2523 return cast<ObjCCategoryImplDecl>(I->second);
2530 assert(IFaceD && ImplD &&
"Passed null params");
2531 ObjCImpls[IFaceD] = ImplD;
2537 assert(CatD && ImplD &&
"Passed null params");
2538 ObjCImpls[CatD] = ImplD;
2543 return ObjCMethodRedecls.
lookup(MD);
2549 ObjCMethodRedecls[MD] = Redecl;
2556 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
2557 return CD->getClassInterface();
2558 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
2559 return IMD->getClassInterface();
2568 assert(VD &&
"Passed null params");
2569 assert(VD->
hasAttr<BlocksAttr>() &&
2570 "getBlockVarCopyInits - not __block var");
2571 auto I = BlockVarCopyInits.find(VD);
2572 if (I != BlockVarCopyInits.end())
2574 return {
nullptr,
false};
2580 assert(VD && CopyExpr &&
"Passed null params");
2581 assert(VD->
hasAttr<BlocksAttr>() &&
2582 "setBlockVarCopyInits - not __block var");
2583 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr, CanThrow);
2587 unsigned DataSize)
const {
2592 "incorrect data size provided to CreateTypeSourceInfo!");
2609 return getObjCLayout(D,
nullptr);
2623 ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
2628 llvm::FoldingSetNodeID
ID;
2630 void *insertPos =
nullptr;
2631 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
2632 assert(eq->getQualifiers() == quals);
2641 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
2644 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
2648 ExtQualNodes.InsertNode(eq, insertPos);
2653 LangAS AddressSpace)
const {
2666 "Type cannot be in multiple addr spaces!");
2669 return getExtQualType(TypeNode, Quals);
2688 return getExtQualType(TypeNode, Quals);
2715 "Type cannot have multiple ObjCGCs!");
2718 return getExtQualType(TypeNode, Quals);
2727 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(T)) {
2730 const auto *FPT = cast<FunctionProtoType>(T);
2733 Result =
getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI);
2736 return cast<FunctionType>(Result.
getTypePtr());
2752 L->DeducedReturnType(FD, ResultType);
2762 if (
const auto *PT = dyn_cast<ParenType>(Orig))
2767 if (
const auto *AT = dyn_cast<AttributedType>(Orig))
2775 const auto *Proto = cast<FunctionProtoType>(Orig);
2777 Proto->getReturnType(), Proto->getParamTypes(),
2778 Proto->getExtProtoInfo().withExceptionSpec(ESI));
2804 if (TSInfo->getType() != FD->
getType())
2812 "TypeLoc size mismatch from updating exception specification");
2813 TSInfo->overrideType(Updated);
2822 llvm::FoldingSetNodeID
ID;
2825 void *InsertPos =
nullptr;
2826 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
2836 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
2837 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2840 Types.push_back(New);
2841 ComplexTypes.InsertNode(New, InsertPos);
2850 llvm::FoldingSetNodeID
ID;
2853 void *InsertPos =
nullptr;
2854 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2864 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2865 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2868 Types.push_back(New);
2869 PointerTypes.InsertNode(New, InsertPos);
2874 llvm::FoldingSetNodeID
ID;
2876 void *InsertPos =
nullptr;
2877 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2884 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2885 assert(!AT &&
"Shouldn't be in the map!");
2889 Types.push_back(AT);
2890 AdjustedTypes.InsertNode(AT, InsertPos);
2914 llvm::FoldingSetNodeID
ID;
2916 void *InsertPos =
nullptr;
2917 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2924 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2925 assert(!AT &&
"Shouldn't be in the map!");
2928 Types.push_back(AT);
2929 AdjustedTypes.InsertNode(AT, InsertPos);
2939 llvm::FoldingSetNodeID
ID;
2942 void *InsertPos =
nullptr;
2944 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2955 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2956 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2959 Types.push_back(New);
2960 BlockPointerTypes.InsertNode(New, InsertPos);
2969 "Unresolved overloaded function type");
2973 llvm::FoldingSetNodeID
ID;
2976 void *InsertPos =
nullptr;
2978 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2986 if (!SpelledAsLValue || InnerRef || !T.
isCanonical()) {
2987 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
2992 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2993 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2998 Types.push_back(New);
2999 LValueReferenceTypes.InsertNode(New, InsertPos);
3009 llvm::FoldingSetNodeID
ID;
3012 void *InsertPos =
nullptr;
3014 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3023 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
3028 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3029 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3033 Types.push_back(New);
3034 RValueReferenceTypes.InsertNode(New, InsertPos);
3043 llvm::FoldingSetNodeID
ID;
3046 void *InsertPos =
nullptr;
3048 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3059 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3060 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3063 Types.push_back(New);
3064 MemberPointerTypes.InsertNode(New, InsertPos);
3071 const llvm::APInt &ArySizeIn,
3073 unsigned IndexTypeQuals)
const {
3076 "Constant array of VLAs is illegal!");
3080 llvm::APInt ArySize(ArySizeIn);
3081 ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
3083 llvm::FoldingSetNodeID
ID;
3086 void *InsertPos =
nullptr;
3088 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
3097 ASM, IndexTypeQuals);
3102 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
3103 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3108 ConstantArrayTypes.InsertNode(New, InsertPos);
3109 Types.push_back(New);
3123 const Type *ty = split.
Ty;
3125 #define TYPE(Class, Base) 3126 #define ABSTRACT_TYPE(Class, Base) 3127 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 3128 #include "clang/AST/TypeNodes.def" 3129 llvm_unreachable(
"didn't desugar past all non-canonical types?");
3135 case Type::DependentVector:
3136 case Type::ExtVector:
3137 case Type::DependentSizedExtVector:
3138 case Type::DependentAddressSpace:
3139 case Type::ObjCObject:
3140 case Type::ObjCInterface:
3141 case Type::ObjCObjectPointer:
3144 case Type::UnresolvedUsing:
3145 case Type::TypeOfExpr:
3147 case Type::Decltype:
3148 case Type::UnaryTransform:
3149 case Type::DependentName:
3150 case Type::InjectedClassName:
3151 case Type::TemplateSpecialization:
3152 case Type::DependentTemplateSpecialization:
3153 case Type::TemplateTypeParm:
3154 case Type::SubstTemplateTypeParmPack:
3156 case Type::DeducedTemplateSpecialization:
3157 case Type::PackExpansion:
3158 llvm_unreachable(
"type should never be variably-modified");
3162 case Type::FunctionNoProto:
3163 case Type::FunctionProto:
3164 case Type::BlockPointer:
3165 case Type::MemberPointer:
3175 cast<PointerType>(ty)->getPointeeType()));
3178 case Type::LValueReference: {
3179 const auto *lv = cast<LValueReferenceType>(ty);
3182 lv->isSpelledAsLValue());
3186 case Type::RValueReference: {
3187 const auto *lv = cast<RValueReferenceType>(ty);
3193 case Type::Atomic: {
3194 const auto *at = cast<AtomicType>(ty);
3199 case Type::ConstantArray: {
3200 const auto *cat = cast<ConstantArrayType>(ty);
3204 cat->getSizeModifier(),
3205 cat->getIndexTypeCVRQualifiers());
3209 case Type::DependentSizedArray: {
3210 const auto *dat = cast<DependentSizedArrayType>(ty);
3214 dat->getSizeModifier(),
3215 dat->getIndexTypeCVRQualifiers(),
3216 dat->getBracketsRange());
3221 case Type::IncompleteArray: {
3222 const auto *iat = cast<IncompleteArrayType>(ty);
3227 iat->getIndexTypeCVRQualifiers(),
3233 case Type::VariableArray: {
3234 const auto *vat = cast<VariableArrayType>(ty);
3239 vat->getIndexTypeCVRQualifiers(),
3240 vat->getBracketsRange());
3254 unsigned IndexTypeQuals,
3264 IndexTypeQuals, Brackets);
3271 VariableArrayTypes.push_back(New);
3272 Types.push_back(New);
3282 unsigned elementTypeQuals,
3286 "Size must be type- or value-dependent!");
3296 numElements, ASM, elementTypeQuals,
3298 Types.push_back(newType);
3307 void *insertPos =
nullptr;
3308 llvm::FoldingSetNodeID
ID;
3311 ASM, elementTypeQuals, numElements);
3315 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3321 QualType(), numElements, ASM, elementTypeQuals,
3323 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
3324 Types.push_back(canonTy);
3329 canonElementType.
Quals);
3333 if (
QualType(canonElementType.
Ty, 0) == elementType &&
3342 ASM, elementTypeQuals, brackets);
3343 Types.push_back(sugaredType);
3349 unsigned elementTypeQuals)
const {
3350 llvm::FoldingSetNodeID
ID;
3353 void *insertPos =
nullptr;
3355 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
3366 ASM, elementTypeQuals);
3371 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3372 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
3378 IncompleteArrayTypes.InsertNode(newType, insertPos);
3379 Types.push_back(newType);
3390 llvm::FoldingSetNodeID
ID;
3393 void *InsertPos =
nullptr;
3394 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3404 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3405 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3408 VectorType(vecType, NumElts, Canonical, VecKind);
3409 VectorTypes.InsertNode(New, InsertPos);
3410 Types.push_back(New);
3418 llvm::FoldingSetNodeID
ID;
3421 void *InsertPos =
nullptr;
3423 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3428 *
this, VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
3431 if (CanonVecTy == VecType) {
3433 *
this, VecType,
QualType(), SizeExpr, AttrLoc, VecKind);
3436 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3437 assert(!CanonCheck &&
3438 "Dependent-sized vector_size canonical type broken");
3440 DependentVectorTypes.InsertNode(New, InsertPos);
3445 *
this, VecType, Canon, SizeExpr, AttrLoc, VecKind);
3449 Types.push_back(New);
3460 llvm::FoldingSetNodeID
ID;
3463 void *InsertPos =
nullptr;
3464 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3474 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3475 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3479 VectorTypes.InsertNode(New, InsertPos);
3480 Types.push_back(New);
3488 llvm::FoldingSetNodeID
ID;
3492 void *InsertPos =
nullptr;
3494 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3504 if (CanonVecTy == vecType) {
3510 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3511 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
3513 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
3522 Types.push_back(New);
3527 Expr *AddrSpaceExpr,
3533 void *insertPos =
nullptr;
3534 llvm::FoldingSetNodeID
ID;
3539 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
3544 QualType(), AddrSpaceExpr, AttrLoc);
3545 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
3546 Types.push_back(canonTy);
3549 if (canonPointeeType == PointeeType &&
3556 AddrSpaceExpr, AttrLoc);
3557 Types.push_back(sugaredType);
3574 llvm::FoldingSetNodeID
ID;
3577 void *InsertPos =
nullptr;
3579 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
3589 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3590 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3595 Types.push_back(New);
3596 FunctionNoProtoTypes.InsertNode(New, InsertPos);
3612 return CanResultType;
3619 if (!NoexceptInType)
3636 bool AnyPackExpansions =
false;
3641 AnyPackExpansions =
true;
3643 return AnyPackExpansions;
3649 QualType ASTContext::getFunctionTypeInternal(
3652 size_t NumArgs = ArgArray.size();
3656 llvm::FoldingSetNodeID
ID;
3661 bool Unique =
false;
3663 void *InsertPos =
nullptr;
3665 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
3674 EPI.ExceptionSpec.NoexceptExpr == FPT->getNoexceptExpr())
3685 bool IsCanonicalExceptionSpec =
3689 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
3691 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
3692 if (!ArgArray[i].isCanonicalAsParam())
3693 isCanonical =
false;
3695 if (OnlyWantCanonical)
3696 assert(isCanonical &&
3697 "given non-canonical parameters constructing canonical type");
3702 if (!isCanonical && Canonical.isNull()) {
3704 CanonicalArgs.reserve(NumArgs);
3705 for (
unsigned i = 0; i != NumArgs; ++i)
3712 if (IsCanonicalExceptionSpec) {
3714 }
else if (NoexceptInType) {
3715 switch (EPI.ExceptionSpec.Type) {
3727 bool AnyPacks =
false;
3728 for (
QualType ET : EPI.ExceptionSpec.Exceptions) {
3747 llvm_unreachable(
"dependent noexcept is already canonical");
3756 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
3760 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3761 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3766 auto ESH = FunctionProtoType::getExceptionSpecSize(
3767 EPI.ExceptionSpec.Type, EPI.ExceptionSpec.Exceptions.size());
3768 size_t Size = FunctionProtoType::totalSizeToAlloc<
3771 FunctionProtoType::ExtParameterInfo,
Qualifiers>(
3772 NumArgs, FunctionProtoType::hasExtraBitfields(EPI.ExceptionSpec.Type),
3773 ESH.NumExceptionType, ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
3774 EPI.ExtParameterInfos ? NumArgs : 0,
3775 EPI.TypeQuals.hasNonFastQualifiers() ? 1 : 0);
3780 Types.push_back(FTP);
3782 FunctionProtoTypes.InsertNode(FTP, InsertPos);
3783 return QualType(FTP, 0);
3787 llvm::FoldingSetNodeID
ID;
3790 void *InsertPos =
nullptr;
3791 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
3801 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
3802 assert(!NewIP &&
"Shouldn't be in the map!");
3806 Types.push_back(New);
3807 PipeTypes.InsertNode(New, InsertPos);
3818 return getPipeType(T,
true);
3822 return getPipeType(T,
false);
3827 if (!isa<CXXRecordDecl>(D))
return false;
3828 const auto *RD = cast<CXXRecordDecl>(D);
3829 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
3831 if (RD->getDescribedClassTemplate() &&
3832 !isa<ClassTemplateSpecializationDecl>(RD))
3843 if (Decl->TypeForDecl) {
3844 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3846 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
3847 Decl->TypeForDecl = PrevDecl->TypeForDecl;
3848 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3852 Decl->TypeForDecl = newType;
3853 Types.push_back(newType);
3855 return QualType(Decl->TypeForDecl, 0);
3861 assert(Decl &&
"Passed null for Decl param");
3862 assert(!Decl->TypeForDecl &&
"TypeForDecl present in slow case");
3864 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(Decl))
3867 assert(!isa<TemplateTypeParmDecl>(Decl) &&
3868 "Template type parameter types are always available.");
3870 if (
const auto *Record = dyn_cast<RecordDecl>(Decl)) {
3871 assert(Record->isFirstDecl() &&
"struct/union has previous declaration");
3874 }
else if (
const auto *
Enum = dyn_cast<EnumDecl>(Decl)) {
3875 assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
3877 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(Decl)) {
3879 Decl->TypeForDecl = newType;
3880 Types.push_back(newType);
3882 llvm_unreachable(
"TypeDecl without a type?");
3884 return QualType(Decl->TypeForDecl, 0);
3892 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3898 Decl->TypeForDecl = newType;
3899 Types.push_back(newType);
3904 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3907 if (PrevDecl->TypeForDecl)
3908 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3911 Decl->TypeForDecl = newType;
3912 Types.push_back(newType);
3917 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3920 if (PrevDecl->TypeForDecl)
3921 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3924 Decl->TypeForDecl = newType;
3925 Types.push_back(newType);
3932 llvm::FoldingSetNodeID
id;
3935 void *insertPos =
nullptr;
3937 if (type)
return QualType(type, 0);
3943 Types.push_back(type);
3944 AttributedTypes.InsertNode(type, insertPos);
3954 &&
"replacement types must always be canonical");
3956 llvm::FoldingSetNodeID
ID;
3958 void *InsertPos =
nullptr;
3960 = SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3965 Types.push_back(SubstParm);
3966 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
3979 assert(
P.getAsType().isCanonical() &&
"Pack contains non-canonical type");
3983 llvm::FoldingSetNodeID
ID;
3985 void *InsertPos =
nullptr;
3987 = SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
3995 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
4001 Types.push_back(SubstParm);
4002 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
4012 llvm::FoldingSetNodeID
ID;
4014 void *InsertPos =
nullptr;
4016 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4026 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4027 assert(!TypeCheck &&
"Template type parameter canonical type broken");
4033 Types.push_back(TypeParm);
4034 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
4045 "No dependent template names here!");
4055 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
4065 "No dependent template names here!");
4068 ArgVec.reserve(Args.
size());
4070 ArgVec.push_back(Arg.getArgument());
4078 if (Arg.isPackExpansion())
4090 "No dependent template names here!");
4099 if (!Underlying.
isNull())
4105 "Caller must compute aliased type");
4106 IsTypeAlias =
false;
4115 (IsTypeAlias?
sizeof(
QualType) : 0),
4119 IsTypeAlias ? Underlying :
QualType());
4121 Types.push_back(Spec);
4128 "No dependent template names here!");
4137 unsigned NumArgs = Args.size();
4138 CanonArgs.reserve(NumArgs);
4144 llvm::FoldingSetNodeID
ID;
4148 void *InsertPos =
nullptr;
4150 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4160 Types.push_back(Spec);
4161 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
4165 "Non-dependent template-id type must have a canonical type");
4172 TagDecl *OwnedTagDecl)
const {
4173 llvm::FoldingSetNodeID
ID;
4176 void *InsertPos =
nullptr;
4177 ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4184 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4185 assert(!CheckT &&
"Elaborated canonical type broken");
4189 void *Mem =
Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
4191 T =
new (Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
4194 ElaboratedTypes.InsertNode(T, InsertPos);
4200 llvm::FoldingSetNodeID
ID;
4203 void *InsertPos =
nullptr;
4204 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4211 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4212 assert(!CheckT &&
"Paren canonical type broken");
4218 ParenTypes.InsertNode(T, InsertPos);
4228 if (CanonNNS != NNS)
4232 llvm::FoldingSetNodeID
ID;
4235 void *InsertPos =
nullptr;
4237 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
4243 DependentNameTypes.InsertNode(T, InsertPos);
4255 for (
unsigned I = 0, E = Args.
size(); I != E; ++I)
4256 ArgCopy.push_back(Args[I].getArgument());
4267 "nested-name-specifier must be dependent");
4269 llvm::FoldingSetNodeID
ID;
4273 void *InsertPos =
nullptr;
4275 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4284 bool AnyNonCanonArgs =
false;
4285 unsigned NumArgs = Args.size();
4287 for (
unsigned I = 0; I != NumArgs; ++I) {
4289 if (!CanonArgs[I].structurallyEquals(Args[I]))
4290 AnyNonCanonArgs =
true;
4294 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
4300 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4309 DependentTemplateSpecializationTypes.InsertNode(T, InsertPos);
4315 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
4321 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
4324 NTTP->getType().getNonLValueExprType(*
this),
4327 if (NTTP->isParameterPack())
4332 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
4348 Args.reserve(Args.size() + Params->
size());
4356 llvm::FoldingSetNodeID
ID;
4360 "Pack expansions must expand one or more parameter packs");
4361 void *InsertPos =
nullptr;
4363 = PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4378 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4385 PackExpansionTypes.InsertNode(T, InsertPos);
4397 if (Protocols.empty())
return true;
4402 for (
unsigned i = 1; i != Protocols.size(); ++i)
4404 Protocols[i]->getCanonicalDecl() != Protocols[i])
4412 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
4416 P =
P->getCanonicalDecl();
4419 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
4420 Protocols.erase(ProtocolsEnd, Protocols.end());
4425 unsigned NumProtocols)
const {
4427 llvm::makeArrayRef(Protocols, NumProtocols),
4435 bool isKindOf)
const {
4438 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
4439 isa<ObjCInterfaceType>(baseType))
4443 llvm::FoldingSetNodeID
ID;
4445 void *InsertPos =
nullptr;
4446 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
4453 if (effectiveTypeArgs.empty()) {
4455 effectiveTypeArgs = baseObject->getTypeArgs();
4462 bool typeArgsAreCanonical = std::all_of(effectiveTypeArgs.begin(),
4463 effectiveTypeArgs.end(),
4465 return type.isCanonical();
4468 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
4472 if (!typeArgsAreCanonical) {
4473 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
4474 for (
auto typeArg : effectiveTypeArgs)
4476 canonTypeArgs = canonTypeArgsVec;
4478 canonTypeArgs = effectiveTypeArgs;
4483 if (!protocolsSorted) {
4484 canonProtocolsVec.append(protocols.begin(), protocols.end());
4486 canonProtocols = canonProtocolsVec;
4488 canonProtocols = protocols;
4492 canonProtocols, isKindOf);
4495 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
4499 size += typeArgs.size() *
sizeof(
QualType);
4507 ObjCObjectTypes.InsertNode(T, InsertPos);
4517 bool allowOnPointerType)
const {
4520 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(type.
getTypePtr())) {
4525 if (allowOnPointerType) {
4526 if (
const auto *objPtr =
4527 dyn_cast<ObjCObjectPointerType>(type.
getTypePtr())) {
4533 protocolsVec.append(protocols.begin(), protocols.end());
4545 if (
const auto *objT = dyn_cast<ObjCObjectType>(type.
getTypePtr())){
4550 objT->getTypeArgsAsWritten(),
4552 objT->isKindOfTypeAsWritten());
4569 objPtr->isKindOfType());
4577 objPtr->isKindOfType());
4590 llvm::FoldingSetNodeID
ID;
4592 void *InsertPos =
nullptr;
4594 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
4597 if (Canonical.
isNull()) {
4600 if (!protocols.empty()) {
4604 Canonical, protocols, hasError,
true ));
4605 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
4614 Types.push_back(newType);
4615 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
4629 for (
auto *Proto : OPT->quals()) {
4650 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> InheritedProtocols;
4652 if (InheritedProtocols.empty())
4656 bool Conforms =
false;
4657 for (
auto *Proto : OPT->quals()) {
4659 for (
auto *PI : InheritedProtocols) {
4671 for (
auto *PI : InheritedProtocols) {
4673 bool Adopts =
false;
4674 for (
auto *Proto : OPT->quals()) {
4688 llvm::FoldingSetNodeID
ID;
4691 void *InsertPos =
nullptr;
4693 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4702 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4710 Types.push_back(QType);
4711 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
4719 if (Decl->TypeForDecl)
4720 return QualType(Decl->TypeForDecl, 0);
4723 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
4724 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4725 return QualType(PrevDecl->TypeForDecl, 0);
4734 Decl->TypeForDecl = T;
4747 llvm::FoldingSetNodeID
ID;
4750 void *InsertPos =
nullptr;
4752 = DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
4762 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
4769 Types.push_back(toe);
4781 Types.push_back(tot);
4797 llvm::FoldingSetNodeID
ID;
4800 void *InsertPos =
nullptr;
4802 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
4806 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
4814 Types.push_back(dt);
4828 llvm::FoldingSetNodeID
ID;
4831 void *InsertPos =
nullptr;
4833 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
4840 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
4848 UnderlyingType, Kind,
4851 Types.push_back(ut);
4859 bool IsDependent)
const {
4864 void *InsertPos =
nullptr;
4865 llvm::FoldingSetNodeID
ID;
4867 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
4871 AutoType(DeducedType, Keyword, IsDependent);
4872 Types.push_back(AT);
4874 AutoTypes.InsertNode(AT, InsertPos);
4884 void *InsertPos =
nullptr;
4885 llvm::FoldingSetNodeID
ID;
4889 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
4894 Types.push_back(DTST);
4896 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
4905 llvm::FoldingSetNodeID
ID;
4908 void *InsertPos =
nullptr;
4909 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
4919 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
4920 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4923 Types.push_back(New);
4924 AtomicTypes.InsertNode(New, InsertPos);
4959 return getFromTargetType(
Target->getSizeType());
4965 return getFromTargetType(
Target->getSignedSizeType());
4970 return getFromTargetType(
Target->getIntMaxType());
4975 return getFromTargetType(
Target->getUIntMaxType());
4993 return getFromTargetType(
Target->getIntPtrType());
5003 return getFromTargetType(
Target->getPtrDiffType(0));
5010 return getFromTargetType(
Target->getUnsignedPtrDiffType(0));
5016 return getFromTargetType(
Target->getProcessIDType());
5030 if (isa<ArrayType>(Ty)) {
5032 }
else if (isa<FunctionType>(Ty)) {
5054 quals = splitType.
Quals;
5059 QualType elementType = AT->getElementType();
5064 if (elementType == unqualElementType) {
5065 assert(quals.
empty());
5066 quals = splitType.
Quals;
5074 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
5076 CAT->getSizeModifier(), 0);
5079 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
5083 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
5086 VAT->getSizeModifier(),
5087 VAT->getIndexTypeCVRQualifiers(),
5088 VAT->getBracketsRange());
5091 const auto *DSAT = cast<DependentSizedArrayType>(AT);
5093 DSAT->getSizeModifier(), 0,
5101 bool UnwrappedAny =
false;
5104 if (!AT1)
return UnwrappedAny;
5107 if (!AT2)
return UnwrappedAny;
5111 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
5113 if (!CAT2 || CAT1->getSize() != CAT2->getSize())
5114 return UnwrappedAny;
5115 }
else if (!isa<IncompleteArrayType>(AT1) ||
5116 !isa<IncompleteArrayType>(AT2)) {
5117 return UnwrappedAny;
5120 T1 = AT1->getElementType();
5121 T2 = AT2->getElementType();
5122 UnwrappedAny =
true;
5143 if (T1PtrType && T2PtrType) {
5151 if (T1MPType && T2MPType &&
5162 if (T1OPType && T2OPType) {
5194 if (Quals1 != Quals2)
5252 llvm_unreachable(
"bad template name kind!");
5260 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
5261 Template = getCanonicalTemplateTemplateParmDecl(TTP);
5268 llvm_unreachable(
"cannot canonicalize overloaded template");
5272 assert(DTN &&
"Non-dependent template names must refer to template decls.");
5273 return DTN->CanonicalTemplateName;
5293 llvm_unreachable(
"bad template name!");
5342 A != AEnd; (void)++A, ++Idx)
5345 return TemplateArgument(llvm::makeArrayRef(CanonArgs, Arg.
pack_size()));
5350 llvm_unreachable(
"Unhandled template argument kind");
5406 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
5413 if (
const auto *AT = dyn_cast<ArrayType>(T))
5434 if (!ATy || qs.
empty())
5441 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
5443 CAT->getSizeModifier(),
5444 CAT->getIndexTypeCVRQualifiers()));
5445 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
5447 IAT->getSizeModifier(),
5448 IAT->getIndexTypeCVRQualifiers()));
5450 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
5451 return cast<ArrayType>(
5453 DSAT->getSizeExpr(),
5454 DSAT->getSizeModifier(),
5455 DSAT->getIndexTypeCVRQualifiers(),
5456 DSAT->getBracketsRange()));
5458 const auto *VAT = cast<VariableArrayType>(ATy);
5461 VAT->getSizeModifier(),
5462 VAT->getIndexTypeCVRQualifiers(),
5463 VAT->getBracketsRange()));
5503 assert(PrettyArrayType &&
"Not an array type!");
5540 uint64_t ElementCount = 1;
5542 ElementCount *= CA->
getSize().getZExtValue();
5543 CA = dyn_cast_or_null<ConstantArrayType>(
5546 return ElementCount;
5555 assert(T->
getAs<
BuiltinType>() &&
"getFloatingRank(): not a floating type");
5557 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
5559 case BuiltinType::Half:
return HalfRank;
5560 case BuiltinType::Float:
return FloatRank;
5577 case HalfRank: llvm_unreachable(
"Complex half is not supported");
5594 llvm_unreachable(
"getFloatingRank(): illegal value for rank");
5615 unsigned ASTContext::getIntegerRank(
const Type *T)
const {
5618 switch (cast<BuiltinType>(T)->getKind()) {
5619 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
5620 case BuiltinType::Bool:
5622 case BuiltinType::Char_S:
5623 case BuiltinType::Char_U:
5624 case BuiltinType::SChar:
5625 case BuiltinType::UChar:
5627 case BuiltinType::Short:
5628 case BuiltinType::UShort:
5630 case BuiltinType::Int:
5631 case BuiltinType::UInt:
5633 case BuiltinType::Long:
5634 case BuiltinType::ULong:
5636 case BuiltinType::LongLong:
5637 case BuiltinType::ULongLong:
5639 case BuiltinType::Int128:
5640 case BuiltinType::UInt128:
5688 if (BitWidth < IntSize)
5691 if (BitWidth == IntSize)
5706 assert(!Promotable.
isNull());
5709 return ET->getDecl()->getPromotionType();
5718 if (BT->getKind() == BuiltinType::WChar_S ||
5719 BT->getKind() == BuiltinType::WChar_U ||
5720 BT->getKind() == BuiltinType::Char8 ||
5721 BT->getKind() == BuiltinType::Char16 ||
5722 BT->getKind() == BuiltinType::Char32) {
5723 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
5727 for (
size_t Idx = 0; Idx < llvm::array_lengthof(PromoteTypes); ++Idx) {
5729 if (FromSize < ToSize ||
5730 (FromSize == ToSize &&
5731 FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType()))
5732 return PromoteTypes[Idx];
5734 llvm_unreachable(
"char type should fit into long long");
5741 uint64_t PromotableSize =
getIntWidth(Promotable);
5782 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
5784 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
5787 if (LHSC == RHSC)
return 0;
5792 unsigned LHSRank = getIntegerRank(LHSC);
5793 unsigned RHSRank = getIntegerRank(RHSC);
5795 if (LHSUnsigned == RHSUnsigned) {
5796 if (LHSRank == RHSRank)
return 0;
5797 return LHSRank > RHSRank ? 1 : -1;
5803 if (LHSRank >= RHSRank)
5813 if (RHSRank >= LHSRank)
5823 if (CFConstantStringTypeDecl)
5824 return CFConstantStringTypeDecl;
5826 assert(!CFConstantStringTagDecl &&
5827 "tag and typedef should be initialized together");
5829 CFConstantStringTagDecl->startDefinition();
5867 if (static_cast<unsigned>(CFRuntime) <
5870 Fields[Count++] = {
IntTy,
"flags" };
5872 Fields[Count++] = {
LongTy,
"length" };
5876 Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc" };
5880 Fields[Count++] = {
IntTy,
"_ptr" };
5886 for (
unsigned i = 0; i < Count; ++i) {
5890 Fields[i].Type,
nullptr,
5893 CFConstantStringTagDecl->addDecl(Field);
5896 CFConstantStringTagDecl->completeDefinition();
5900 CFConstantStringTypeDecl =
5903 return CFConstantStringTypeDecl;
5907 if (!CFConstantStringTagDecl)
5909 return CFConstantStringTagDecl;
5918 if (ObjCSuperType.isNull()) {
5920 TUDecl->addDecl(ObjCSuperTypeDecl);
5923 return ObjCSuperType;
5928 assert(TD &&
"Invalid CFConstantStringType");
5929 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
5932 assert(TagType &&
"Invalid CFConstantStringType");
5933 CFConstantStringTagDecl = TagType->getDecl();
5937 if (BlockDescriptorType)
5950 static const char *
const FieldNames[] = {
5955 for (
size_t i = 0; i < 2; ++i) {
5958 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
5966 BlockDescriptorType = RD;
5972 if (BlockDescriptorExtendedType)
5987 static const char *
const FieldNames[] = {
5994 for (
size_t i = 0; i < 4; ++i) {
5997 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
6006 BlockDescriptorExtendedType = RD;
6014 if (isa<PipeType>(T))
6020 switch (BT->getKind()) {
6021 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6022 case BuiltinType::Id: \ 6023 return TargetInfo::OCLTK_Image; 6024 #include "clang/Basic/OpenCLImageTypes.def" 6026 case BuiltinType::OCLClkEvent:
6029 case BuiltinType::OCLEvent:
6032 case BuiltinType::OCLQueue:
6035 case BuiltinType::OCLReserveID:
6038 case BuiltinType::OCLSampler:
6057 if (!copyExpr && record->hasTrivialDestructor())
return false;
6085 llvm_unreachable(
"impossible");
6087 llvm_unreachable(
"fell out of lifetime switch!");
6095 bool &HasByrefExtendedLayout)
const {
6100 HasByrefExtendedLayout =
false;
6102 HasByrefExtendedLayout =
true;
6116 if (!ObjCInstanceTypeDecl)
6117 ObjCInstanceTypeDecl =
6119 return ObjCInstanceTypeDecl;
6125 if (
const auto *TT = dyn_cast<TypedefType>(T))
6127 return II->isStr(
"BOOL");
6163 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
6169 if (D->getLexicalDeclContext()->isFileContext() &&
6170 !D->isInlineSpecified() && (D->isConstexpr() ||
First->isConstexpr()))
6206 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
6215 ParmOffset = PtrSize;
6217 QualType PType = PVDecl->getOriginalType();
6218 if (
const auto *AT =
6222 if (!isa<ConstantArrayType>(AT))
6223 PType = PVDecl->getType();
6225 PType = PVDecl->getType();
6252 "getObjCEncodingForFunctionDecl - Incomplete param type");
6260 QualType PType = PVDecl->getOriginalType();
6261 if (
const auto *AT =
6265 if (!isa<ConstantArrayType>(AT))
6266 PType = PVDecl->getType();
6268 PType = PVDecl->getType();
6282 bool Extended)
const {
6286 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
6297 bool Extended)
const {
6318 "getObjCEncodingForMethodDecl - Incomplete param type");
6326 ParmOffset = 2 * PtrSize;
6331 if (
const auto *AT =
6335 if (!isa<ConstantArrayType>(AT))
6340 PType, S, Extended);
6351 const Decl *Container)
const {
6354 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
6355 for (
auto *PID : CID->property_impls())
6356 if (PID->getPropertyDecl() == PD)
6359 const auto *OID = cast<ObjCImplementationDecl>(Container);
6360 for (
auto *PID : OID->property_impls())
6361 if (PID->getPropertyDecl() == PD)
6394 const Decl *Container)
const {
6396 bool Dynamic =
false;
6404 SynthesizePID = PropertyImpDecl;
6408 std::string S =
"T";
6450 if (SynthesizePID) {
6465 if (isa<TypedefType>(PointeeTy.
getTypePtr())) {
6467 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
6470 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
6483 getObjCEncodingForTypeImpl(T, S,
true,
true, Field,
6484 true ,
false,
false,
6485 false,
false,
false, NotEncodedT);
6489 std::string& S)
const {
6493 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
6501 case BuiltinType::Void:
return 'v';
6502 case BuiltinType::Bool:
return 'B';
6503 case BuiltinType::Char8:
6504 case BuiltinType::Char_U:
6505 case BuiltinType::UChar:
return 'C';
6506 case BuiltinType::Char16:
6507 case BuiltinType::UShort:
return 'S';
6508 case BuiltinType::Char32:
6509 case BuiltinType::UInt:
return 'I';
6510 case BuiltinType::ULong:
6512 case BuiltinType::UInt128:
return 'T';
6513 case BuiltinType::ULongLong:
return 'Q';
6514 case BuiltinType::Char_S:
6515 case BuiltinType::SChar:
return 'c';
6516 case BuiltinType::Short:
return 's';
6517 case BuiltinType::WChar_S:
6518 case BuiltinType::WChar_U:
6519 case BuiltinType::Int:
return 'i';
6520 case BuiltinType::Long:
6522 case BuiltinType::LongLong:
return 'q';
6523 case BuiltinType::Int128:
return 't';
6524 case BuiltinType::Float:
return 'f';
6525 case BuiltinType::Double:
return 'd';
6526 case BuiltinType::LongDouble:
return 'D';
6527 case BuiltinType::NullPtr:
return '*';
6529 case BuiltinType::Float16:
6530 case BuiltinType::Float128:
6531 case BuiltinType::Half:
6532 case BuiltinType::ShortAccum:
6533 case BuiltinType::Accum:
6534 case BuiltinType::LongAccum:
6535 case BuiltinType::UShortAccum:
6536 case BuiltinType::UAccum:
6537 case BuiltinType::ULongAccum:
6538 case BuiltinType::ShortFract:
6539 case BuiltinType::Fract:
6540 case BuiltinType::LongFract:
6541 case BuiltinType::UShortFract:
6542 case BuiltinType::UFract:
6543 case BuiltinType::ULongFract:
6544 case BuiltinType::SatShortAccum:
6545 case BuiltinType::SatAccum:
6546 case BuiltinType::SatLongAccum:
6547 case BuiltinType::SatUShortAccum:
6548 case BuiltinType::SatUAccum:
6549 case BuiltinType::SatULongAccum:
6550 case BuiltinType::SatShortFract:
6551 case BuiltinType::SatFract:
6552 case BuiltinType::SatLongFract:
6553 case BuiltinType::SatUShortFract:
6554 case BuiltinType::SatUFract:
6555 case BuiltinType::SatULongFract:
6559 case BuiltinType::ObjCId:
6560 case BuiltinType::ObjCClass:
6561 case BuiltinType::ObjCSel:
6562 llvm_unreachable(
"@encoding ObjC primitive type");
6565 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6566 case BuiltinType::Id: 6567 #include "clang/Basic/OpenCLImageTypes.def" 6568 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 6569 case BuiltinType::Id: 6570 #include "clang/Basic/OpenCLExtensionTypes.def" 6571 case BuiltinType::OCLEvent:
6572 case BuiltinType::OCLClkEvent:
6573 case BuiltinType::OCLQueue:
6574 case BuiltinType::OCLReserveID:
6575 case BuiltinType::OCLSampler:
6576 case BuiltinType::Dependent:
6577 #define BUILTIN_TYPE(KIND, ID) 6578 #define PLACEHOLDER_TYPE(KIND, ID) \ 6579 case BuiltinType::KIND: 6580 #include "clang/AST/BuiltinTypes.def" 6581 llvm_unreachable(
"invalid builtin type for @encode");
6583 llvm_unreachable(
"invalid BuiltinType::Kind value");
6600 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
6620 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
6629 S += llvm::utostr(Offset);
6642 void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string& S,
6643 bool ExpandPointedToStructures,
6644 bool ExpandStructures,
6647 bool EncodingProperty,
6649 bool EncodeBlockParameters,
6650 bool EncodeClassNames,
6651 bool EncodePointerToObjCTypedef,
6654 switch (CT->getTypeClass()) {
6659 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
6665 case Type::Complex: {
6668 getObjCEncodingForTypeImpl(CT->getElementType(), S,
false,
false,
nullptr);
6672 case Type::Atomic: {
6675 getObjCEncodingForTypeImpl(AT->getValueType(), S,
false,
false,
nullptr);
6681 case Type::LValueReference:
6682 case Type::RValueReference: {
6684 if (isa<PointerType>(CT)) {
6686 if (PT->isObjCSelType()) {
6695 bool isReadOnly =
false;
6705 }
else if (OutermostType) {
6718 if (StringRef(S).endswith(
"nr"))
6719 S.replace(S.end()-2, S.end(),
"rn");
6731 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
6736 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
6745 getObjCEncodingForTypeImpl(PointeeTy, S,
false, ExpandPointedToStructures,
6746 nullptr,
false,
false,
false,
false,
false,
false,
6751 case Type::ConstantArray:
6752 case Type::IncompleteArray:
6753 case Type::VariableArray: {
6754 const auto *AT = cast<ArrayType>(CT);
6756 if (isa<IncompleteArrayType>(AT) && !StructField) {
6760 getObjCEncodingForTypeImpl(AT->getElementType(), S,
6761 false, ExpandStructures, FD);
6765 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
6766 S += llvm::utostr(CAT->getSize().getZExtValue());
6769 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
6770 "Unknown array type!");
6774 getObjCEncodingForTypeImpl(AT->getElementType(), S,
6775 false, ExpandStructures, FD,
6776 false,
false,
false,
false,
false,
false,
6783 case Type::FunctionNoProto:
6784 case Type::FunctionProto:
6788 case Type::Record: {
6789 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
6790 S += RDecl->
isUnion() ?
'(' :
'{';
6794 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
6796 llvm::raw_string_ostream OS(S);
6803 if (ExpandStructures) {
6806 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
6808 for (
const auto *Field : RDecl->
fields()) {
6811 S += Field->getNameAsString();
6816 if (Field->isBitField()) {
6817 getObjCEncodingForTypeImpl(Field->getType(), S,
false,
true,
6822 getObjCEncodingForTypeImpl(qt, S,
false,
true,
6826 false,
false,
false, NotEncodedT);
6831 S += RDecl->
isUnion() ?
')' :
'}';
6835 case Type::BlockPointer: {
6838 if (EncodeBlockParameters) {
6843 getObjCEncodingForTypeImpl(
6844 FT->getReturnType(), S, ExpandPointedToStructures, ExpandStructures,
6845 FD,
false , EncodingProperty,
6846 false , EncodeBlockParameters, EncodeClassNames,
false,
6851 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
6852 for (
const auto &I : FPT->param_types())
6853 getObjCEncodingForTypeImpl(
6854 I, S, ExpandPointedToStructures, ExpandStructures, FD,
6855 false , EncodingProperty,
6856 false , EncodeBlockParameters, EncodeClassNames,
6857 false, NotEncodedT);
6864 case Type::ObjCObject: {
6868 S +=
"{objc_object=}";
6872 S +=
"{objc_class=}";
6879 case Type::ObjCInterface: {
6885 if (ExpandStructures) {
6889 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
6892 getObjCEncodingForTypeImpl(Field->
getType(), S,
false,
true, Field);
6894 getObjCEncodingForTypeImpl(Field->
getType(), S,
false,
true, FD,
6895 false,
false,
false,
false,
false,
6896 EncodePointerToObjCTypedef,
6904 case Type::ObjCObjectPointer: {
6906 if (OPT->isObjCIdType()) {
6911 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
6919 if (OPT->isObjCQualifiedIdType()) {
6921 ExpandPointedToStructures,
6922 ExpandStructures, FD);
6923 if (FD || EncodingProperty || EncodeClassNames) {
6927 for (
const auto *I : OPT->quals()) {
6929 S += I->getObjCRuntimeNameAsString();
6938 if (!EncodingProperty &&
6940 !EncodePointerToObjCTypedef) {
6945 if (FD && OPT->getInterfaceDecl()) {
6950 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
6951 if (Ivars[i] == FD) {
6959 getObjCEncodingForTypeImpl(PointeeTy, S,
6960 false, ExpandPointedToStructures,
6962 false,
false,
false,
false,
false,
6968 if (OPT->getInterfaceDecl() &&
6969 (FD || EncodingProperty || EncodeClassNames)) {
6971 S += OPT->getInterfaceDecl()->getObjCRuntimeNameAsString();
6972 for (
const auto *I : OPT->quals()) {
6974 S += I->getObjCRuntimeNameAsString();
6984 case Type::MemberPointer:
6988 case Type::ExtVector:
6997 case Type::DeducedTemplateSpecialization:
7001 #define ABSTRACT_TYPE(KIND, BASE) 7002 #define TYPE(KIND, BASE) 7003 #define DEPENDENT_TYPE(KIND, BASE) \ 7005 #define NON_CANONICAL_TYPE(KIND, BASE) \ 7007 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \ 7009 #include "clang/AST/TypeNodes.def" 7010 llvm_unreachable(
"@encode for dependent type!");
7012 llvm_unreachable(
"bad type kind!");
7015 void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
7020 assert(RDecl &&
"Expected non-null RecordDecl");
7021 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
7026 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
7030 for (
const auto &BI : CXXRec->bases()) {
7031 if (!BI.isVirtual()) {
7036 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7037 std::make_pair(offs, base));
7043 for (
auto *Field : RDecl->
fields()) {
7045 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7046 std::make_pair(offs, Field));
7050 if (CXXRec && includeVBases) {
7051 for (
const auto &BI : CXXRec->vbases()) {
7057 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
7058 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
7059 std::make_pair(offs, base));
7071 uint64_t CurOffs = 0;
7073 std::multimap<uint64_t, NamedDecl *>::iterator
7074 CurLayObj = FieldOrBaseOffsets.begin();
7076 if (CXXRec && CXXRec->isDynamicClass() &&
7077 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
7080 std::string recname = CXXRec->getNameAsString();
7081 if (recname.empty()) recname =
"?";
7093 uint64_t offs =
toBits(size);
7094 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7095 std::make_pair(offs,
nullptr));
7098 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
7100 assert(CurOffs <= CurLayObj->first);
7101 if (CurOffs < CurLayObj->first) {
7102 uint64_t padding = CurLayObj->first - CurOffs;
7118 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
7123 getObjCEncodingForStructureImpl(base, S, FD,
false,
7125 assert(!base->isEmpty());
7130 const auto *field = cast<FieldDecl>(dcl);
7133 S += field->getNameAsString();
7137 if (field->isBitField()) {
7140 CurOffs += field->getBitWidthValue(*
this);
7145 getObjCEncodingForTypeImpl(qt, S,
false,
true, FD,
7149 false,
false,
false, NotEncodedT);
7159 std::string& S)
const {
7192 if (!ObjCClassDecl) {
7197 return ObjCClassDecl;
7201 if (!ObjCProtocolClassDecl) {
7202 ObjCProtocolClassDecl
7211 return ObjCProtocolClassDecl;
7257 const size_t NumFields = 5;
7259 const char *FieldNames[NumFields];
7263 FieldNames[0] =
"__stack";
7267 FieldNames[1] =
"__gr_top";
7271 FieldNames[2] =
"__vr_top";
7274 FieldTypes[3] = Context->
IntTy;
7275 FieldNames[3] =
"__gr_offs";
7278 FieldTypes[4] = Context->
IntTy;
7279 FieldNames[4] =
"__vr_offs";
7282 for (
unsigned i = 0; i < NumFields; ++i) {
7288 FieldTypes[i],
nullptr,
7293 VaListTagDecl->
addDecl(Field);
7310 const size_t NumFields = 5;
7312 const char *FieldNames[NumFields];
7316 FieldNames[0] =
"gpr";
7320 FieldNames[1] =
"fpr";
7324 FieldNames[2] =
"reserved";
7328 FieldNames[3] =
"overflow_arg_area";
7332 FieldNames[4] =
"reg_save_area";
7335 for (
unsigned i = 0; i < NumFields; ++i) {
7340 FieldTypes[i],
nullptr,
7345 VaListTagDecl->
addDecl(Field);
7373 const size_t NumFields = 4;
7375 const char *FieldNames[NumFields];
7379 FieldNames[0] =
"gp_offset";
7383 FieldNames[1] =
"fp_offset";
7387 FieldNames[2] =
"overflow_arg_area";
7391 FieldNames[3] =
"reg_save_area";
7394 for (
unsigned i = 0; i < NumFields; ++i) {
7400 FieldTypes[i],
nullptr,
7405 VaListTagDecl->
addDecl(Field);
7476 const size_t NumFields = 4;
7478 const char *FieldNames[NumFields];
7481 FieldTypes[0] = Context->
LongTy;
7482 FieldNames[0] =
"__gpr";
7485 FieldTypes[1] = Context->
LongTy;
7486 FieldNames[1] =
"__fpr";
7490 FieldNames[2] =
"__overflow_arg_area";
7494 FieldNames[3] =
"__reg_save_area";
7497 for (
unsigned i = 0; i < NumFields; ++i) {
7503 FieldTypes[i],
nullptr,
7508 VaListTagDecl->
addDecl(Field);
7545 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
7549 if (!BuiltinVaListDecl) {
7551 assert(BuiltinVaListDecl->isImplicit());
7554 return BuiltinVaListDecl;
7567 if (!BuiltinMSVaListDecl)
7570 return BuiltinMSVaListDecl;
7578 assert(ObjCConstantStringType.isNull() &&
7579 "'NSConstantString' type already set!");
7589 unsigned size = End -
Begin;
7590 assert(size > 1 &&
"set is not overloaded!");
7599 assert(isa<FunctionTemplateDecl>(D) ||
7600 isa<UnresolvedUsingValueDecl>(D) ||
7601 (isa<UsingShadowDecl>(D) &&
7613 bool TemplateKeyword,
7615 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
7618 llvm::FoldingSetNodeID
ID;
7621 void *InsertPos =
nullptr;
7623 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7627 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
7639 "Nested name specifier must be dependent");
7641 llvm::FoldingSetNodeID
ID;
7644 void *InsertPos =
nullptr;
7646 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7652 if (CanonNNS == NNS) {
7660 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7661 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
7665 DependentTemplateNames.InsertNode(QTN, InsertPos);
7675 "Nested name specifier must be dependent");
7677 llvm::FoldingSetNodeID
ID;
7680 void *InsertPos =
nullptr;
7682 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7688 if (CanonNNS == NNS) {
7697 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7698 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
7702 DependentTemplateNames.InsertNode(QTN, InsertPos);
7709 llvm::FoldingSetNodeID
ID;
7712 void *insertPos =
nullptr;
7714 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
7718 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
7727 auto &Self =
const_cast<ASTContext &
>(*this);
7728 llvm::FoldingSetNodeID
ID;
7731 void *InsertPos =
nullptr;
7733 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
7739 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
7763 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
7793 while (
const auto *AT = dyn_cast<ArrayType>(CT))
7794 CT = AT->getElementType();
7816 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
7817 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
7860 assert((lhsQID && rhsOPT) &&
"ObjCQualifiedClassTypesAreCompatible");
7862 for (
auto *lhsProto : lhsQID->quals()) {
7864 for (
auto *rhsProto : rhsOPT->
quals()) {
7891 if (!rhsOPT)
return false;
7893 if (rhsOPT->qual_empty()) {
7897 for (
auto *I : lhsQID->quals()) {
7901 if (!rhsID->ClassImplementsProtocol(I,
true))
7909 for (
auto *lhsProto : lhsQID->quals()) {
7915 for (
auto *rhsProto : rhsOPT->quals()) {
7925 for (
auto *I : lhsQID->quals()) {
7929 if (rhsID->ClassImplementsProtocol(I,
true)) {
7943 assert(rhsQID &&
"One of the LHS/RHS should be id<x>");
7948 for (
auto *lhsProto : lhsOPT->quals()) {
7956 for (
auto *rhsProto : rhsQID->
quals()) {
7970 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSInheritedProtocols;
7975 if (LHSInheritedProtocols.empty() && lhsOPT->qual_empty())
7977 for (
auto *lhsProto : LHSInheritedProtocols) {
7979 for (
auto *rhsProto : rhsQID->
quals()) {
8010 auto finish = [&](
bool succeeded) ->
bool {
8050 bool BlockReturnType) {
8054 auto finish = [&](
bool succeeded) ->
bool {
8088 return finish(BlockReturnType);
8090 return finish(!BlockReturnType);
8102 return (*lhs)->getName().compare((*rhs)->getName());
8119 assert(LHS->
getInterface() &&
"LHS must have an interface base");
8120 assert(RHS->
getInterface() &&
"RHS must have an interface base");
8123 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSProtocolSet;
8126 for (
auto proto : LHS->
quals()) {
8134 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> RHSProtocolSet;
8137 for (
auto proto : RHS->
quals()) {
8145 for (
auto proto : LHSProtocolSet) {
8146 if (RHSProtocolSet.count(proto))
8147 IntersectionSet.push_back(proto);
8152 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ImpliedProtocols;
8156 if (!ImpliedProtocols.empty()) {
8157 IntersectionSet.erase(
8158 std::remove_if(IntersectionSet.begin(),
8159 IntersectionSet.end(),
8161 return ImpliedProtocols.count(proto) > 0;
8163 IntersectionSet.end());
8167 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
8177 if (lhsOPT && rhsOPT)
8183 if (lhsBlock && rhsBlock)
8188 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
8201 if (lhsArgs.size() != rhsArgs.size())
8205 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
8212 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
8213 rhsArgs[i].stripObjCKindOfType(ctx))) {
8241 if (!LDecl || !RDecl)
8251 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
8261 bool anyChanges =
false;
8279 if (!Protocols.empty())
8297 if (LHSSuperType.
isNull())
8307 if (KnownLHS != LHSAncestors.end()) {
8308 LHS = KnownLHS->second;
8312 bool anyChanges =
false;
8330 if (!Protocols.empty())
8347 if (RHSSuperType.
isNull())
8358 assert(LHS->
getInterface() &&
"LHS is not an interface type");
8359 assert(RHS->
getInterface() &&
"RHS is not an interface type");
8376 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> SuperClassInheritedProtocols;
8380 for (
auto *RHSPI : RHS->
quals())
8383 if (SuperClassInheritedProtocols.empty())
8386 for (
const auto *LHSProto : LHS->
quals()) {
8387 bool SuperImplementsProtocol =
false;
8388 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
8389 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
8390 SuperImplementsProtocol =
true;
8393 if (!SuperImplementsProtocol)
8423 if (!LHSOPT || !RHSOPT)
8441 bool CompareUnqualified) {
8460 bool OfBlockPointer,
8464 if (UD->
hasAttr<TransparentUnionAttr>()) {
8465 for (
const auto *I : UD->
fields()) {
8466 QualType ET = I->getType().getUnqualifiedType();
8480 bool OfBlockPointer,
8495 return mergeTypes(lhs, rhs, OfBlockPointer, Unqualified);
8499 bool OfBlockPointer,
8505 bool allLTypes =
true;
8506 bool allRTypes =
true;
8510 if (OfBlockPointer) {
8512 QualType LHS = lbase->getReturnType();
8513 bool UnqualifiedResult = Unqualified;
8514 if (!UnqualifiedResult)
8516 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
8573 if (lproto && rproto) {
8574 assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
8575 "C++ shouldn't be here");
8577 if (lproto->getNumParams() != rproto->getNumParams())
8581 if (lproto->isVariadic() != rproto->isVariadic())
8584 if (lproto->getTypeQuals() != rproto->getTypeQuals())
8588 bool canUseLeft, canUseRight;
8600 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
8601 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
8602 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
8604 lParamType, rParamType, OfBlockPointer, Unqualified);
8611 types.push_back(paramType);
8623 if (allLTypes)
return lhs;
8624 if (allRTypes)
return rhs;
8629 newParamInfos.empty() ? nullptr : newParamInfos.data();
8633 if (lproto) allRTypes =
false;
8634 if (rproto) allLTypes =
false;
8646 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
8652 paramTy = Enum->getDecl()->getIntegerType();
8662 if (allLTypes)
return lhs;
8663 if (allRTypes)
return rhs;
8670 if (allLTypes)
return lhs;
8671 if (allRTypes)
return rhs;
8677 QualType other,
bool isBlockReturnType) {
8683 if (underlyingType.
isNull())
8698 bool OfBlockPointer,
8699 bool Unqualified,
bool BlockReturnType) {
8717 if (LHSCan == RHSCan)
8722 Qualifiers RQuals = RHSCan.getLocalQualifiers();
8723 if (LQuals != RQuals) {
8739 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
8760 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
8761 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
8764 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
8765 LHSClass = Type::ConstantArray;
8766 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
8767 RHSClass = Type::ConstantArray;
8770 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
8771 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
8774 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
8775 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
8778 if (LHSClass != RHSClass) {
8788 if (OfBlockPointer && !BlockReturnType) {
8800 #define TYPE(Class, Base) 8801 #define ABSTRACT_TYPE(Class, Base) 8802 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: 8803 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 8804 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 8805 #include "clang/AST/TypeNodes.def" 8806 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
8809 case Type::DeducedTemplateSpecialization:
8810 case Type::LValueReference:
8811 case Type::RValueReference:
8812 case Type::MemberPointer:
8813 llvm_unreachable(
"C++ should never be in mergeTypes");
8815 case Type::ObjCInterface:
8816 case Type::IncompleteArray:
8817 case Type::VariableArray:
8818 case Type::FunctionProto:
8819 case Type::ExtVector:
8820 llvm_unreachable(
"Types are eliminated above");
8841 case Type::BlockPointer:
8866 if (ResultType.isNull())
8893 case Type::ConstantArray:
8919 -> std::pair<bool,llvm::APInt> {
8921 llvm::APSInt TheInt;
8924 return std::make_pair(
true, TheInt);
8926 return std::make_pair(
false, TheInt);
8928 return std::make_pair(
true, CAT->getSize());
8930 return std::make_pair(
false, llvm::APInt());
8934 bool HaveLSize, HaveRSize;
8935 llvm::APInt LSize, RSize;
8936 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
8937 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
8938 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
8971 case Type::FunctionNoProto:
8988 case Type::ObjCObject: {
8999 case Type::ObjCObjectPointer:
9000 if (OfBlockPointer) {
9014 assert(LHS != RHS &&
9015 "Equivalent pipe types should have already been handled!");
9019 llvm_unreachable(
"Invalid Type::Class!");
9024 bool &CanUseFirst,
bool &CanUseSecond,
9026 assert(NewParamInfos.empty() &&
"param info list not empty");
9027 CanUseFirst = CanUseSecond =
true;
9033 if (!FirstHasInfo && !SecondHasInfo)
9036 bool NeedParamInfo =
false;
9040 for (
size_t I = 0; I < E; ++I) {
9051 bool FirstNoEscape = FirstParam.
isNoEscape();
9052 bool SecondNoEscape = SecondParam.
isNoEscape();
9053 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
9055 if (NewParamInfos.back().getOpaqueValue())
9056 NeedParamInfo =
true;
9057 if (FirstNoEscape != IsNoEscape)
9058 CanUseFirst =
false;
9059 if (SecondNoEscape != IsNoEscape)
9060 CanUseSecond =
false;
9064 NewParamInfos.clear();
9070 ObjCLayouts[CD] =
nullptr;
9080 if (LHSCan == RHSCan)
9082 if (RHSCan->isFunctionType()) {
9086 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
9088 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
9091 if (ResReturnType.
isNull())
9093 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
9097 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
9110 Qualifiers RQuals = RHSCan.getLocalQualifiers();
9111 if (LQuals != RQuals) {
9124 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
9140 if (ResQT == LHSBaseQT)
9142 if (ResQT == RHSBaseQT)
9154 T = ET->getDecl()->getIntegerType();
9168 VTy->getNumElements(), VTy->getVectorKind());
9172 T = ETy->getDecl()->getIntegerType();
9175 assert(BTy &&
"Unexpected signed integer or fixed point type");
9176 switch (BTy->getKind()) {
9177 case BuiltinType::Char_S:
9178 case BuiltinType::SChar:
9180 case BuiltinType::Short:
9182 case BuiltinType::Int:
9184 case BuiltinType::Long:
9186 case BuiltinType::LongLong:
9188 case BuiltinType::Int128:
9191 case BuiltinType::ShortAccum:
9193 case BuiltinType::Accum:
9195 case BuiltinType::LongAccum:
9197 case BuiltinType::SatShortAccum:
9199 case BuiltinType::SatAccum:
9201 case BuiltinType::SatLongAccum:
9203 case BuiltinType::ShortFract:
9205 case BuiltinType::Fract:
9207 case BuiltinType::LongFract:
9209 case BuiltinType::SatShortFract:
9211 case BuiltinType::SatFract:
9213 case BuiltinType::SatLongFract:
9216 llvm_unreachable(
"Unexpected signed integer or fixed point type");
9240 bool AllowTypeModifiers) {
9243 bool Signed =
false, Unsigned =
false;
9244 RequiresICE =
false;
9249 bool IsSpecialLong =
false;
9253 default: Done =
true; --Str;
break;
9258 assert(!Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
9259 assert(!Signed &&
"Can't use 'S' modifier multiple times!");
9263 assert(!Signed &&
"Can't use both 'S' and 'U' modifiers!");
9264 assert(!Unsigned &&
"Can't use 'U' modifier multiple times!");
9268 assert(!IsSpecialLong &&
"Can't use 'L' with 'W' or 'N' modifiers");
9269 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
9274 assert(!IsSpecialLong &&
"Can't use two 'N' or 'W' modifiers!");
9275 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
9277 IsSpecialLong =
true;
9284 assert(!IsSpecialLong &&
"Can't use two 'N' or 'W' modifiers!");
9285 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
9287 IsSpecialLong =
true;
9291 llvm_unreachable(
"Unexpected integer type");
9307 default: llvm_unreachable(
"Unknown builtin type letter!");
9309 assert(HowLong == 0 && !Signed && !Unsigned &&
9310 "Bad modifiers used with 'v'!");
9314 assert(HowLong == 0 && !Signed && !Unsigned &&
9315 "Bad modifiers used with 'h'!");
9319 assert(HowLong == 0 && !Signed && !Unsigned &&
9320 "Bad modifiers used with 'f'!");
9324 assert(HowLong < 3 && !Signed && !Unsigned &&
9325 "Bad modifiers used with 'd'!");
9328 else if (HowLong == 2)
9334 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
9343 else if (HowLong == 2)
9345 else if (HowLong == 1)
9351 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
9360 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'b'!");
9364 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'z'!");
9368 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'w'!");
9385 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9397 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9405 unsigned NumElements = strtoul(Str, &End, 10);
9406 assert(End != Str &&
"Missing vector size");
9410 RequiresICE,
false);
9411 assert(!RequiresICE &&
"Can't require vector ICE");
9421 unsigned NumElements = strtoul(Str, &End, 10);
9422 assert(End != Str &&
"Missing vector size");
9434 assert(!RequiresICE &&
"Can't require complex ICE");
9460 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'K'!");
9474 Done = !AllowTypeModifiers;
9476 switch (
char c = *Str++) {
9477 default: Done =
true; --Str;
break;
9483 unsigned AddrSpace = strtoul(Str, &End, 10);
9511 "Integer constant 'I' type must be an integer");
9519 unsigned *IntegerConstantArgs)
const {
9524 bool RequiresICE =
false;
9531 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
9533 while (TypeStr[0] && TypeStr[0] !=
'.') {
9540 if (RequiresICE && IntegerConstantArgs)
9541 *IntegerConstantArgs |= 1 << ArgTypes.size();
9547 ArgTypes.push_back(Ty);
9550 if (Id == Builtin::BI__GetExceptionInfo)
9553 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
9554 "'.' should only occur at end of builtin type list!");
9559 bool Variadic = (TypeStr[0] ==
'.');
9562 if (ArgTypes.empty() && Variadic && !
getLangOpts().CPlusPlus)
9582 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD))
9583 if (!MD->isUserProvided())
9615 !FD->
hasAttr<DLLExportAttr>()) ||
9616 FD->
hasAttr<GNUInlineAttr>()) {
9641 if (D->
hasAttr<DLLImportAttr>()) {
9644 }
else if (D->
hasAttr<DLLExportAttr>()) {
9648 D->
hasAttr<CUDAGlobalAttr>()) {
9695 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
9700 if (!LexicalContext)
9705 auto StaticLocalLinkage =
9717 return StaticLocalLinkage;
9744 return StrongLinkage;
9762 llvm_unreachable(
"Invalid Linkage!");
9772 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
9773 if (!VD->isFileVarDecl())
9778 if (VD->getDescribedVarTemplate() ||
9779 isa<VarTemplatePartialSpecializationDecl>(VD))
9781 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
9785 }
else if (isa<PragmaCommentDecl>(D))
9787 else if (isa<OMPThreadPrivateDecl>(D))
9789 else if (isa<PragmaDetectMismatchDecl>(D))
9791 else if (isa<OMPThreadPrivateDecl>(D))
9793 else if (isa<OMPDeclareReductionDecl>(D))
9795 else if (isa<ImportDecl>(D))
9800 if (D->
isFromASTFile() && !LangOpts.BuildingPCHWithObjectFile) {
9815 isa<FunctionDecl>(D) &&
9816 cast<FunctionDecl>(D)->getTemplateSpecializationKind() ==
9823 isa<CXXMethodDecl>(D) &&
9824 cast<CXXMethodDecl>(D)->getParent()->getTemplateSpecializationKind() ==
9836 if (D->
hasAttr<WeakRefAttr>())
9843 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
9845 if (!FD->doesThisDeclarationHaveABody())
9846 return FD->doesDeclarationForceExternallyVisibleDefinition();
9849 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
9855 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
9873 const auto *VD = cast<VarDecl>(D);
9874 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
9878 if (LangOpts.OpenMP &&
9879 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
9896 if (VD->getType().isDestructedType())
9900 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
9902 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
9907 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
9908 for (
const auto *BD : DD->bindings())
9909 if (
const auto *BindingVD = BD->getHoldingVar())
9919 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
9920 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
9922 for (
auto *CurDecl :
9926 std::end(SeenDecls) == llvm::find(SeenDecls, CurFD)) {
9927 SeenDecls.insert(CurFD);
9934 bool IsCXXMethod)
const {
9937 return ABI->getDefaultMethodCallConv(IsVariadic);
9939 switch (LangOpts.getDefaultCallingConv()) {
9968 return ABI->isNearlyEmpty(RD);
9972 if (!VTContext.get()) {
9973 if (
Target->getCXXABI().isMicrosoft())
9978 return VTContext.get();
9982 switch (
Target->getCXXABI().getKind()) {
9995 llvm_unreachable(
"Unsupported ABI");
10001 return ASTRecordLayouts.getMemorySize() +
10002 llvm::capacity_in_bytes(ObjCLayouts) +
10003 llvm::capacity_in_bytes(KeyFunctions) +
10004 llvm::capacity_in_bytes(ObjCImpls) +
10005 llvm::capacity_in_bytes(BlockVarCopyInits) +
10006 llvm::capacity_in_bytes(DeclAttrs) +
10007 llvm::capacity_in_bytes(TemplateOrInstantiation) +
10008 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
10009 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
10010 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
10011 llvm::capacity_in_bytes(OverriddenMethods) +
10012 llvm::capacity_in_bytes(Types) +
10013 llvm::capacity_in_bytes(VariableArrayTypes) +
10014 llvm::capacity_in_bytes(ClassScopeSpecializationPattern);
10022 unsigned Signed)
const {
10025 if (!QualTy && DestWidth == 128)
10048 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
10053 MangleNumbers[ND] = Number;
10057 auto I = MangleNumbers.find(ND);
10058 return I != MangleNumbers.end() ? I->second : 1;
10063 StaticLocalNumbers[VD] = Number;
10067 auto I = StaticLocalNumbers.find(VD);
10068 return I != StaticLocalNumbers.end() ? I->second : 1;
10073 assert(LangOpts.CPlusPlus);
10074 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
10080 std::unique_ptr<MangleNumberingContext>
10082 return ABI->createMangleNumberingContext();
10087 return ABI->getCopyConstructorForExceptionObject(
10093 return ABI->addCopyConstructorForExceptionObject(
10100 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
10105 return ABI->getTypedefNameForUnnamedTagDecl(TD);
10110 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
10114 return ABI->getDeclaratorForUnnamedTagDecl(TD);
10118 ParamIndices[D] = index;
10122 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
10123 assert(I != ParamIndices.end() &&
10124 "ParmIndices lacks entry set by ParmVarDecl");
10132 "don't need to cache the computed value for this temporary");
10134 APValue *&MTVI = MaterializedTemporaryValues[E];
10140 return MaterializedTemporaryValues.lookup(E);
10145 if (!T.isOSDarwin())
10148 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
10149 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
10158 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
10163 template <
typename T>
10196 bool shouldVisitTemplateInstantiations()
const {
return true; }
10198 bool shouldVisitImplicitCode()
const {
return true; }
10200 template <
typename T,
typename MapNodeTy,
typename BaseTraverseFn,
10202 bool TraverseNode(T
Node, MapNodeTy MapNode, BaseTraverseFn BaseTraverse,
10206 if (ParentStack.size() > 0) {
10217 auto &NodeOrVector = (*Parents)[MapNode];
10218 if (NodeOrVector.isNull()) {
10219 if (
const auto *D = ParentStack.back().get<Decl>())
10221 else if (
const auto *S = ParentStack.back().get<
Stmt>())
10226 if (!NodeOrVector.template is<ParentVector *>()) {
10228 1, getSingleDynTypedNodeFromParentMap(NodeOrVector));
10229 delete NodeOrVector
10231 NodeOrVector = Vector;
10234 auto *Vector = NodeOrVector.template get<ParentVector *>();
10240 std::find(Vector->begin(), Vector->end(),
10241 ParentStack.back()) != Vector->end();
10243 Vector->push_back(ParentStack.back());
10247 bool Result = BaseTraverse();
10248 ParentStack.pop_back();
10252 bool TraverseDecl(Decl *DeclNode) {
10253 return TraverseNode(
10254 DeclNode, DeclNode, [&] {
return VisitorBase::TraverseDecl(DeclNode); },
10255 &Map.PointerParents);
10258 bool TraverseStmt(
Stmt *StmtNode) {
10259 return TraverseNode(
10260 StmtNode, StmtNode, [&] {
return VisitorBase::TraverseStmt(StmtNode); },
10261 &Map.PointerParents);
10264 bool TraverseTypeLoc(
TypeLoc TypeLocNode) {
10265 return TraverseNode(
10267 [&] {
return VisitorBase::TraverseTypeLoc(TypeLocNode); },
10268 &Map.OtherParents);
10272 return TraverseNode(
10274 [&] {
return VisitorBase::TraverseNestedNameSpecifierLoc(NNSLocNode); },
10275 &Map.OtherParents);
10291 Parents = llvm::make_unique<ParentMap>(*this);
10292 return Parents->getParents(Node);
10299 if (MethodDecl->
hasAttr<UnavailableAttr>()
10300 || MethodDecl->
hasAttr<DeprecatedAttr>())
10314 IM != EM && IF != EF; ++IM, ++IF) {
10340 return (*AddrSpaceMap)[(unsigned)AS];
10349 switch (BT->getKind()) {
10351 llvm_unreachable(
"Not a fixed point type!");
10352 case BuiltinType::ShortAccum:
10354 case BuiltinType::Accum:
10356 case BuiltinType::LongAccum:
10358 case BuiltinType::UShortAccum:
10360 case BuiltinType::UAccum:
10362 case BuiltinType::ULongAccum:
10364 case BuiltinType::ShortFract:
10366 case BuiltinType::Fract:
10368 case BuiltinType::LongFract:
10370 case BuiltinType::UShortFract:
10372 case BuiltinType::UFract:
10374 case BuiltinType::ULongFract:
10380 if (LangOpts.OpenCL)
10403 switch (BT->getKind()) {
10405 llvm_unreachable(
"Not a fixed point type!");
10406 case BuiltinType::ShortAccum:
10407 case BuiltinType::SatShortAccum:
10408 return Target.getShortAccumScale();
10409 case BuiltinType::Accum:
10410 case BuiltinType::SatAccum:
10411 return Target.getAccumScale();
10412 case BuiltinType::LongAccum:
10413 case BuiltinType::SatLongAccum:
10414 return Target.getLongAccumScale();
10415 case BuiltinType::UShortAccum:
10416 case BuiltinType::SatUShortAccum:
10417 return Target.getUnsignedShortAccumScale();
10418 case BuiltinType::UAccum:
10419 case BuiltinType::SatUAccum:
10420 return Target.getUnsignedAccumScale();
10421 case BuiltinType::ULongAccum:
10422 case BuiltinType::SatULongAccum:
10423 return Target.getUnsignedLongAccumScale();
10424 case BuiltinType::ShortFract:
10425 case BuiltinType::SatShortFract:
10426 return Target.getShortFractScale();
10427 case BuiltinType::Fract:
10428 case BuiltinType::SatFract:
10429 return Target.getFractScale();
10430 case BuiltinType::LongFract:
10431 case BuiltinType::SatLongFract:
10432 return Target.getLongFractScale();
10433 case BuiltinType::UShortFract:
10434 case BuiltinType::SatUShortFract:
10435 return Target.getUnsignedShortFractScale();
10436 case BuiltinType::UFract:
10437 case BuiltinType::SatUFract:
10438 return Target.getUnsignedFractScale();
10439 case BuiltinType::ULongFract:
10440 case BuiltinType::SatULongFract:
10441 return Target.getUnsignedLongFractScale();
10450 switch (BT->getKind()) {
10452 llvm_unreachable(
"Not a fixed point type!");
10453 case BuiltinType::ShortAccum:
10454 case BuiltinType::SatShortAccum:
10455 return Target.getShortAccumIBits();
10456 case BuiltinType::Accum:
10457 case BuiltinType::SatAccum:
10458 return Target.getAccumIBits();
10459 case BuiltinType::LongAccum:
10460 case BuiltinType::SatLongAccum:
10461 return Target.getLongAccumIBits();
10462 case BuiltinType::UShortAccum:
10463 case BuiltinType::SatUShortAccum:
10464 return Target.getUnsignedShortAccumIBits();
10465 case BuiltinType::UAccum:
10466 case BuiltinType::SatUAccum:
10467 return Target.getUnsignedAccumIBits();
10468 case BuiltinType::ULongAccum:
10469 case BuiltinType::SatULongAccum:
10470 return Target.getUnsignedLongAccumIBits();
10471 case BuiltinType::ShortFract:
10472 case BuiltinType::SatShortFract:
10473 case BuiltinType::Fract:
10474 case BuiltinType::SatFract:
10475 case BuiltinType::LongFract:
10476 case BuiltinType::SatLongFract:
10477 case BuiltinType::UShortFract:
10478 case BuiltinType::SatUShortFract:
10479 case BuiltinType::UFract:
10480 case BuiltinType::SatUFract:
10481 case BuiltinType::ULongFract:
10482 case BuiltinType::SatULongFract:
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=TTK_Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
Internal representation of canonical, dependent typeof(expr) types.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
static bool canAssignObjCObjectTypes(ASTContext &ctx, QualType lhs, QualType rhs)
Determine whether the first type is a subtype of the second.
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
CanQualType SatShortAccumTy
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
static void EncodeBitField(const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
CanQualType SatUnsignedLongFractTy
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Defines the clang::ASTContext interface.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
const BlockDecl * getBlockDecl() const
bool hasDefinition() const
Determine whether this class has been defined.
The generic AArch64 ABI is also a modified version of the Itanium ABI, but it has fewer divergences t...
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
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
static unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built...
ObjCIvarDecl * getPropertyIvarDecl() const
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
void Profile(llvm::FoldingSetNodeID &ID) const
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
static unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
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...
static unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
Represents a qualified type name for which the type name is dependent.
static TypedefDecl * CreateSystemZBuiltinVaListDecl(const ASTContext *Context)
The template argument is an expression, and we've not resolved it to one of the other forms yet...
void Profile(llvm::FoldingSetNodeID &ID)
bool isRecordType() const
unsigned getTypeAlignIfKnown(QualType T) const
Return the ABI-specified alignment of a type, in bits, or 0 if the type is incomplete and we cannot d...
CanQualType FloatComplexTy
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
RawCommentList Comments
All comments in this translation unit.
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
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getCorrespondingUnsignedType(QualType T) const
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
void Profile(llvm::FoldingSetNodeID &ID)
Represent a C++ namespace.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
void Profile(llvm::FoldingSetNodeID &ID)
virtual void completeDefinition()
Note that the definition of this type is now complete.
bool isZero() const
isZero - Test whether the quantity equals zero.
QualType withConst() const
const TargetInfo & getTargetInfo() const
QualType adjustStringLiteralBaseType(QualType StrLTy) const
A container of type source information.
llvm::DenseMap< Stmt *, Stmt * > MapTy
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl *> &Redeclared)
Interoperability with the latest known version of the Swift runtime.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
const Expr * getRequiresClause() const
Get the constraint-expression from the associated requires-clause (if any)
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
param_const_iterator param_end() const
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
A template template parameter that has been substituted for some other template name.
QualType getElementType() const
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
An identifier, stored as an IdentifierInfo*.
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
unsigned getDepth() const
Get the nesting depth of the template parameter.
static const Type * getIntegerTypeForEnum(const EnumType *ET)
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one...
const RawComment * getRaw() const LLVM_READONLY
Represents a variable declaration or definition.
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
void removeObjCLifetime()
QualType getReturnType() const
LangAS getLangASFromTargetAS(unsigned TargetAS)
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
RecordDecl * getPreviousDecl()
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>'.
void setClassScopeSpecializationPattern(FunctionDecl *FD, FunctionDecl *Pattern)
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration...
MangleContext * createMangleContext()
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 ...
static unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
const ParmVarDecl *const * param_const_iterator
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
Missing a type from <ucontext.h>
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
CanQualType UnsignedFractTy
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
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)
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.
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...
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
PropertyAttributeKind getPropertyAttributes() const
unsigned toTargetAddressSpace(LangAS AS)
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
Concrete class used by the front-end to report problems and issues.
Represents a typeof (or typeof) expression (a GCC extension).
const clang::PrintingPolicy & getPrintingPolicy() const
static const Decl * adjustDeclToTemplate(const Decl *D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
Represents a declaration of a type.
CanQualType PseudoObjectTy
LangAS getAddressSpace() const
QualType getExceptionObjectType(QualType T) const
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
const Type * getClass() const
CXXMethodVector::const_iterator overridden_cxx_method_iterator
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
void Profile(llvm::FoldingSetNodeID &ID)
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
Expr * IgnoreParenCasts() LLVM_READONLY
IgnoreParenCasts - Ignore parentheses and casts.
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
Expr * getSizeExpr() const
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
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.
static unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built...
TemplateTemplateParmDecl * getParameter() const
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeTransparentUnionType - if T is a transparent union type and a member of T is compatible with Sub...
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
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
bool isKindOfType() const
Whether this is a "__kindof" type.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SplitQualType getSplitDesugaredType() const
unsigned getNumArgs() const
The iOS ABI is a partial implementation of the ARM ABI.
IntrusiveRefCntPtr< ExternalASTSource > ExternalSource
CanQualType UnsignedCharTy
Expr * getSizeExpr() const
bool getNoCallerSavedRegs() const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
static char getObjCEncodingForPrimitiveKind(const ASTContext *C, BuiltinType::Kind kind)
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
Represents an extended vector type where either the type or size is dependent.
This object can be modified without requiring retains or releases.
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
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
unsigned getMinGlobalAlign() const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
void Profile(llvm::FoldingSetNodeID &ID)
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
The generic ARM ABI is a modified version of the Itanium ABI proposed by ARM for use on ARM-based pla...
bool isDynamicClass() const
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl *> protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
static unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
Represents a ValueDecl that came out of a declarator.
A dependent template name that has not been resolved to a template (or set of templates).
DeclarationNameTable DeclarationNames
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type...
bool UnwrapSimilarArrayTypes(QualType &T1, QualType &T2)
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
void setCFConstantStringType(QualType T)
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169...
CanQualType UnsignedAccumTy
void Profile(llvm::FoldingSetNodeID &ID)
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl *> &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized, ivars in super class and then collects all ivars, including those synthesized for current class.
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
typedef void* __builtin_va_list;
bool hasPointerIdentity() const
Check if the given ASTNodeKind identifies a type that offers pointer identity.
CanQualType UnsignedShortFractTy
Exposes information about the current target.
Represents an array type in C++ whose size is a value-dependent expression.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting...
CommentOptions CommentOpts
Options for parsing comments.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
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.
Pepresents 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 unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
bool hasUniqueObjectRepresentations(QualType Ty) const
Return true if the specified type has unique object representations according to (C++17 [meta...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
static std::string charUnitsToString(const CharUnits &CU)
void Profile(llvm::FoldingSetNodeID &ID)
bool isNullPtrType() const
unsigned getFastQualifiers() const
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
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 inialization 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
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...
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent) const
C++11 deduced auto type.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
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.
static unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
std::string getAsString() const
Derive the full selector name (e.g.
is AltiVec 'vector Pixel'
This declaration does not have an attached comment, and we have searched the redeclaration chain...
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
SelectorTable & Selectors
Assigning into this object requires the old value to be released and the new value to be retained...
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
QualType getCanonicalType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
not a target-specific vector type
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
ExceptionSpecificationType Type
The kind of exception specification this is.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
ExtParameterInfo getExtParameterInfo(unsigned I) const
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ExtProtoInfo getExtProtoInfo() const
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
const ExtParameterInfo * ExtParameterInfos
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
void AddDeallocation(void(*Callback)(void *), void *Data)
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
Sugar for parentheses used when specifying types.
QualType getReturnType() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
bool hasSameTemplateName(TemplateName X, TemplateName Y)
Determine whether the given template names refer to the same template.
LangAS getAddressSpace() const
Return the address space of this type.
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
CanQualType UnsignedLongAccumTy
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
This names the __make_integer_seq BuiltinTemplateDecl.
unsigned getManglingNumber(const NamedDecl *ND) const
A structure for storing an already-substituted template template parameter pack.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
static unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built...
Kind getKind() const LLVM_READONLY
Represents the declaration of a struct/union/class/enum.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
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
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
FunctionDecl * getClassScopeSpecializationPattern(const FunctionDecl *FD)
Assigning into this object requires a lifetime extension.
CanQualType SatUnsignedFractTy
unsigned getPreferredTypeAlign(const Type *T) const
Return the "preferred" alignment of the specified type T for the current target, in bits...
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
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()
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod) const
Retrieves the default calling convention for the current target.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Canon=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
bool propertyTypesAreCompatible(QualType, QualType)
Represents a template argument.
static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)
DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the pointer over the consume...
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
IntType
===-— Target Data Type Query Methods ----------------------------—===//
QualType withRestrict() const
Represents a template name that was expressed as a qualified name.
TagTypeKind
The kind of a tag type.
RealType getRealTypeByWidth(unsigned BitWidth) const
Return floating point type with specified width.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getTypeOfType(QualType t) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
const ObjCInterfaceDecl * getClassInterface() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
CanQualType ObjCBuiltinIdTy
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
Dataflow Directional Tag Classes.
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i...
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list...
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
CharUnits getSize() const
getSize - Get the record size in characters.
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.
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)
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)
static unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
bool isObjCUnqualifiedIdOrClass() const
GVALinkage GetGVALinkageForVariable(const VarDecl *VD)
A dynamically typed AST node container.
const Decl * getOriginalDecl() const LLVM_READONLY
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
Represents a pointer to an Objective C object.
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...
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...
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
QualType getCanonicalTypeInternal() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
This template specialization was declared or defined by an explicit specialization (C++ [temp...
CanQualType UnsignedLongTy
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
void Profile(llvm::FoldingSetNodeID &ID)
const llvm::APInt & getSize() const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize, QualType typeDomain) const
Return a real floating point or a complex type (based on typeDomain/typeSize).
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
bool isFunctionType() const
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated...
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if this address space is a superset of the other one.
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.
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.
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...
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
Represents a C array with an unspecified size.
VTableContextBase * getVTableContext()
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
Missing a type from <stdio.h>
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
static TranslationUnitDecl * Create(ASTContext &C)
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl *> &Protocols)
IdentifierInfo * getMakeIntegerSeqName() const
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
ObjCIvarDecl - Represents an ObjC instance variable.
static int compare(DeclarationName LHS, DeclarationName RHS)
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
Provides information a specialization of a member of a class template, which may be a member function...
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
A structure for storing the information associated with an overloaded template name.
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
getObjCEncodingForMethodParameter - Return the encoded type for a single method parameter or return t...
We searched for a comment attached to the particular declaration, but didn't find any...
static unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
Builtin::Context & BuiltinInfo
Weak definition of inline variable.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a class template.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
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
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)
Defines the clang::TargetInfo interface.
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U)
Determine whether two function types are the same, ignoring exception specifications in cases where t...
unsigned getSimdDefaultAlign() const
Return default simd alignment for the given target.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
void setRAngleLoc(SourceLocation Loc)
unsigned getCVRQualifiers() const
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
SourceLocation getLAngleLoc() const
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated, or computed.
const VariableArrayType * getAsVariableArrayType(QualType T) const
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
__DEVICE__ int max(int __a, int __b)
static Decl::Kind getKind(const Decl *D)
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
unsigned getNumElements() const
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.
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 ...
__DEVICE__ int min(int __a, int __b)
void addAddressSpace(LangAS space)
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
bool isStaticDataMember() const
Determines whether this is a static data member.
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
A set of overloaded template declarations.
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)
Represents a C array with a specified size that is not an integer-constant-expression.
void setTemplateNameLoc(SourceLocation Loc)
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
No keyword precedes the qualified type name.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
bool isInline() const
Whether this variable is (C++1z) inline.
void Profile(llvm::FoldingSetNodeID &ID)
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
unsigned getTargetAddressSpace(QualType T) const
Selector getGetterName() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
SourceLocation getRAngleLoc() const
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
The global specifier '::'. There is no stored value.
static bool isStructEmpty(QualType Ty)
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Missing a type from <setjmp.h>
void setType(QualType newType)
void removeAddressSpace()
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
const LangOptions & getLangOpts() const
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
Represents the canonical version of C arrays with a specified constant size.
This class handles loading and caching of source files into memory.
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
Defines enum values for all the target-independent builtin functions.
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
Declaration of a template function.
const void * getMemoizationData() const
Returns a pointer that identifies the stored AST node.
A class which abstracts out some details necessary for making a call.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
SourceLocation getLocation() const
QualType getPointeeType() const
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
bool isExternallyVisible() const
APValue * getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E, bool MayCreate)
Get the storage for the constant value of a materialized temporary of static storage duration...
A single template declaration.
void Profile(llvm::FoldingSetNodeID &ID)
CanQualType OCLClkEventTy
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
noexcept(expression), evals to 'true'
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth, signed/unsigned.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
CanQualType UnsignedIntTy
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
static unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ComparisonCategories CompCategories
Types and expressions required to build C++2a three-way comparisons using operator<=>, including the values return by builtin <=> operators.