65 #include "llvm/ADT/APInt.h" 66 #include "llvm/ADT/APSInt.h" 67 #include "llvm/ADT/ArrayRef.h" 68 #include "llvm/ADT/DenseMap.h" 69 #include "llvm/ADT/DenseSet.h" 70 #include "llvm/ADT/FoldingSet.h" 71 #include "llvm/ADT/None.h" 72 #include "llvm/ADT/Optional.h" 73 #include "llvm/ADT/PointerUnion.h" 74 #include "llvm/ADT/STLExtras.h" 75 #include "llvm/ADT/SmallPtrSet.h" 76 #include "llvm/ADT/SmallVector.h" 77 #include "llvm/ADT/StringExtras.h" 78 #include "llvm/ADT/StringRef.h" 79 #include "llvm/ADT/Triple.h" 80 #include "llvm/Support/Capacity.h" 81 #include "llvm/Support/Casting.h" 82 #include "llvm/Support/Compiler.h" 83 #include "llvm/Support/ErrorHandling.h" 84 #include "llvm/Support/MathExtras.h" 85 #include "llvm/Support/raw_ostream.h" 97 using namespace clang;
118 llvm_unreachable(
"Invalid Traversal type!");
123 if (
const auto *E = N.
get<
Expr>()) {
140 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
145 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
146 if (VD->isStaticDataMember() &&
151 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(D)) {
156 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(D)) {
163 if (
const auto *ED = dyn_cast<EnumDecl>(D)) {
167 if (
const auto *TD = dyn_cast<TagDecl>(D)) {
170 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
174 if (isa<ParmVarDecl>(D))
179 if (isa<TemplateTypeParmDecl>(D) ||
180 isa<NonTypeTemplateParmDecl>(D) ||
181 isa<TemplateTemplateParmDecl>(D))
190 if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) ||
191 isa<ObjCPropertyDecl>(D) ||
192 isa<RedeclarableTemplateDecl>(D) ||
193 isa<ClassTemplateSpecializationDecl>(D) ||
200 if (isa<TypedefDecl>(D)) {
205 }
else if (
const auto *TD = dyn_cast<TagDecl>(D)) {
212 TD->isCompleteDefinition())
224 const std::map<unsigned, RawComment *> &CommentsInTheFile)
const {
227 if (RepresentativeLocForDecl.
isInvalid() ||
228 !RepresentativeLocForDecl.
isFileID())
232 if (CommentsInTheFile.empty())
237 const std::pair<FileID, unsigned> DeclLocDecomp =
241 auto OffsetCommentBehindDecl =
242 CommentsInTheFile.lower_bound(DeclLocDecomp.second);
245 if (OffsetCommentBehindDecl != CommentsInTheFile.end()) {
246 RawComment *CommentBehindDecl = OffsetCommentBehindDecl->second;
250 (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
251 isa<ObjCMethodDecl>(D) || isa<ObjCPropertyDecl>(D))) {
255 if (SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second) ==
257 OffsetCommentBehindDecl->first)) {
258 return CommentBehindDecl;
265 if (OffsetCommentBehindDecl == CommentsInTheFile.begin())
268 auto OffsetCommentBeforeDecl = --OffsetCommentBehindDecl;
269 RawComment *CommentBeforeDecl = OffsetCommentBeforeDecl->second;
278 const unsigned CommentEndOffset =
282 bool Invalid =
false;
283 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
289 StringRef
Text(Buffer + CommentEndOffset,
290 DeclLocDecomp.second - CommentEndOffset);
294 if (Text.find_first_of(
";{}#@") != StringRef::npos)
297 return CommentBeforeDecl;
318 if (!CommentsInThisFile || CommentsInThisFile->empty())
328 if (
const auto *FD = dyn_cast<FunctionDecl>(&D)) {
348 if (
const auto *VD = dyn_cast<VarDecl>(&D)) {
351 if (VD->isStaticDataMember())
357 if (
const auto *CRD = dyn_cast<CXXRecordDecl>(&D)) {
364 if (
const auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
370 return PU.is<ClassTemplateDecl *>()
371 ? *static_cast<const Decl *>(PU.get<ClassTemplateDecl *>())
372 : *static_cast<const Decl *>(
378 CRD->getMemberSpecializationInfo())
379 return *Info->getInstantiatedFrom();
383 if (
const auto *ED = dyn_cast<EnumDecl>(&D)) {
396 const Decl **OriginalDecl)
const {
399 OriginalDecl =
nullptr;
411 return DeclComment->second;
424 *OriginalDecl = RedeclComment->second;
427 "This decl is supposed to have comment attached.");
428 return CommentAtRedecl->second;
434 auto LastCheckedRedecl = [
this, CanonicalD]() ->
const Decl * {
437 return LookupRes->second;
441 for (
const auto Redecl : D->
redecls()) {
444 if (LastCheckedRedecl) {
445 if (LastCheckedRedecl == Redecl) {
446 LastCheckedRedecl =
nullptr;
454 *OriginalDecl = Redecl;
455 return RedeclComment;
461 *OriginalDecl =
nullptr;
477 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(DC)) {
486 Redeclared.push_back(RedeclaredMethod);
501 if (!CommentsInThisFile || CommentsInThisFile->empty() ||
502 CommentsInThisFile->rbegin()->second->isAttached())
513 for (
const Decl *D : Decls) {
515 if (D->isInvalidDecl())
538 const Decl *D)
const {
541 ThisDeclInfo->IsFilled =
false;
542 ThisDeclInfo->fill();
543 ThisDeclInfo->CommentDecl = FC->
getDecl();
544 if (!ThisDeclInfo->TemplateParameters)
554 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
565 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
569 if (Canonical != D) {
577 const Decl *OriginalDecl =
nullptr;
581 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
584 if (OMD && OMD->isPropertyAccessor())
591 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
595 else if (
const auto *TD = dyn_cast<TypedefNameDecl>(D)) {
598 QualType QT = TD->getUnderlyingType();
600 if (
const Decl *TD = TT->getDecl())
604 else if (
const auto *IC = dyn_cast<ObjCInterfaceDecl>(D)) {
605 while (IC->getSuperClass()) {
606 IC = IC->getSuperClass();
611 else if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(D)) {
616 else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
617 if (!(RD = RD->getDefinition()))
620 for (
const auto &I : RD->bases()) {
621 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
627 if (!(NonVirtualBase= NonVirtualBase->getDefinition()))
635 for (
const auto &I : RD->vbases()) {
642 if (!(VirtualBase= VirtualBase->getDefinition()))
656 if (D != OriginalDecl && OriginalDecl)
665 ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &
ID,
673 ID.AddInteger(Params->
size());
675 PEnd = Params->
end();
677 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
679 ID.AddBoolean(TTP->isParameterPack());
681 ID.AddBoolean(TC !=
nullptr);
685 if (TTP->isExpandedParameterPack()) {
687 ID.AddInteger(TTP->getNumExpansionParameters());
689 ID.AddBoolean(
false);
693 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
695 ID.AddBoolean(NTTP->isParameterPack());
696 ID.AddPointer(NTTP->getType().getCanonicalType().getAsOpaquePtr());
697 if (NTTP->isExpandedParameterPack()) {
699 ID.AddInteger(NTTP->getNumExpansionTypes());
700 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
701 QualType T = NTTP->getExpansionType(I);
705 ID.AddBoolean(
false);
709 auto *TTP = cast<TemplateTemplateParmDecl>(*P);
714 ID.AddBoolean(RequiresClause !=
nullptr);
730 if (
const auto *Fold = dyn_cast<CXXFoldExpr>(IDC))
731 CSE = cast<ConceptSpecializationExpr>(Fold->getLHS());
733 CSE = cast<ConceptSpecializationExpr>(IDC);
736 NewConverted.reserve(OldConverted.size());
741 NewConverted.push_back(ConstrainedType);
742 for (
auto &Arg : OldConverted.front().pack_elements().drop_front(1))
743 NewConverted.push_back(Arg);
746 NewConverted.clear();
747 NewConverted.push_back(NewPack);
748 assert(OldConverted.size() == 1 &&
749 "Template parameter pack should be the last parameter");
752 "Unexpected first argument kind for immediately-declared " 754 NewConverted.push_back(ConstrainedType);
755 for (
auto &Arg : OldConverted.drop_front(1))
756 NewConverted.push_back(Arg);
759 C, CSE->getNamedConcept(), NewConverted,
nullptr,
760 CSE->isInstantiationDependent(), CSE->containsUnexpandedParameterPack());
762 if (
auto *OrigFold = dyn_cast<CXXFoldExpr>(IDC))
764 BinaryOperatorKind::BO_LAnd,
771 ASTContext::getCanonicalTemplateTemplateParmDecl(
774 llvm::FoldingSetNodeID
ID;
775 CanonicalTemplateTemplateParm::Profile(ID, *
this, TTP);
776 void *InsertPos =
nullptr;
777 CanonicalTemplateTemplateParm *Canonical
778 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
780 return Canonical->getParam();
785 CanonParams.reserve(Params->
size());
787 PEnd = Params->
end();
789 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(*
P)) {
796 if (
const auto *TC = TTP->getTypeConstraint()) {
799 *
this, TC->getImmediatelyDeclaredConstraint(),
802 if (
auto *Args = TC->getTemplateArgsAsWritten())
803 for (
const auto &ArgLoc : Args->arguments())
813 TC->getNamedConcept(),
nullptr, NewIDC);
815 CanonParams.push_back(NewTTP);
816 }
else if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
820 if (NTTP->isExpandedParameterPack()) {
823 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
825 ExpandedTInfos.push_back(
833 NTTP->getPosition(),
nullptr,
843 NTTP->getPosition(),
nullptr,
845 NTTP->isParameterPack(),
849 if (AT->isConstrained()) {
852 *
this, NTTP->getPlaceholderTypeConstraint(), T));
855 CanonParams.push_back(Param);
858 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
859 cast<TemplateTemplateParmDecl>(*
P)));
862 Expr *CanonRequiresClause =
nullptr;
864 CanonRequiresClause = RequiresClause;
876 CanonRequiresClause));
879 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
880 assert(!Canonical &&
"Shouldn't be in the map!");
884 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
885 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
890 if (!LangOpts.CPlusPlus)
return nullptr;
906 llvm_unreachable(
"Invalid CXXABI type!");
910 if (!InterpContext) {
913 return *InterpContext.get();
918 if (LOpts.FakeAddressSpaceMap) {
921 static const unsigned FakeAddrSpaceMap[] = {
935 return &FakeAddrSpaceMap;
943 switch (LangOpts.getAddressSpaceMapMangling()) {
951 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
957 : ConstantArrayTypes(this_()), FunctionProtoTypes(this_()),
958 TemplateSpecializationTypes(this_()),
959 DependentTemplateSpecializationTypes(this_()), AutoTypes(this_()),
960 SubstTemplateTemplateParmPacks(this_()),
961 CanonTemplateTemplateParms(this_()), SourceMgr(SM), LangOpts(LOpts),
964 LangOpts.XRayNeverInstrumentFiles,
965 LangOpts.XRayAttrListFiles, SM)),
968 CommentCommandTraits(BumpAlloc, LOpts.CommentOpts),
971 TraversalScope = {TUDecl};
977 ReleaseDeclContextMaps();
980 for (
auto &Pair : Deallocations)
981 (Pair.first)(Pair.second);
987 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
989 if (
auto *R = const_cast<ASTRecordLayout *>((I++)->second))
992 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
993 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
995 if (
auto *R = const_cast<ASTRecordLayout *>((I++)->second))
999 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
1000 AEnd = DeclAttrs.end();
1002 A->second->~AttrVec();
1004 for (
const auto &
Value : ModuleInitializers)
1005 Value.second->~PerModuleInitializers();
1018 using ParentMapPointers = llvm::DenseMap<
1020 llvm::PointerUnion<
const Decl *,
const Stmt *,
1025 using ParentMapOtherNodes = llvm::DenseMap<
1027 llvm::PointerUnion<
const Decl *,
const Stmt *,
1028 ast_type_traits::DynTypedNode *, ParentVector *>>;
1030 ParentMapPointers PointerParents;
1031 ParentMapOtherNodes OtherParents;
1034 static ast_type_traits::DynTypedNode
1035 getSingleDynTypedNodeFromParentMap(ParentMapPointers::mapped_type U) {
1036 if (
const auto *D = U.dyn_cast<
const Decl *>())
1038 if (
const auto *S = U.dyn_cast<
const Stmt *>())
1040 return *U.get<ast_type_traits::DynTypedNode *>();
1043 template <
typename NodeTy,
typename MapTy>
1046 auto I = Map.find(Node);
1047 if (I == Map.end()) {
1050 if (
const auto *
V = I->second.template dyn_cast<ParentVector *>()) {
1051 return llvm::makeArrayRef(*
V);
1053 return getSingleDynTypedNodeFromParentMap(I->second);
1059 for (
const auto &Entry : PointerParents) {
1060 if (Entry.second.is<ast_type_traits::DynTypedNode *>()) {
1061 delete Entry.second.get<ast_type_traits::DynTypedNode *>();
1062 }
else if (Entry.second.is<ParentVector *>()) {
1063 delete Entry.second.get<ParentVector *>();
1066 for (
const auto &Entry : OtherParents) {
1067 if (Entry.second.is<ast_type_traits::DynTypedNode *>()) {
1068 delete Entry.second.get<ast_type_traits::DynTypedNode *>();
1069 }
else if (Entry.second.is<ParentVector *>()) {
1070 delete Entry.second.get<ParentVector *>();
1078 return getDynNodeFromMap(Node, OtherParents);
1083 TraversalScope = TopLevelDecls;
1088 Deallocations.push_back({Callback, Data});
1097 llvm::errs() <<
"\n*** AST Context Stats:\n";
1098 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
1100 unsigned counts[] = {
1101 #define TYPE(Name, Parent) 0, 1102 #define ABSTRACT_TYPE(Name, Parent) 1103 #include "clang/AST/TypeNodes.inc" 1107 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
1113 unsigned TotalBytes = 0;
1114 #define TYPE(Name, Parent) \ 1116 llvm::errs() << " " << counts[Idx] << " " << #Name \ 1117 << " types, " << sizeof(Name##Type) << " each " \ 1118 << "(" << counts[Idx] * sizeof(Name##Type) \ 1120 TotalBytes += counts[Idx] * sizeof(Name##Type); \ 1122 #define ABSTRACT_TYPE(Name, Parent) 1123 #include "clang/AST/TypeNodes.inc" 1125 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
1130 <<
" implicit default constructors created\n";
1133 <<
" implicit copy constructors created\n";
1137 <<
" implicit move constructors created\n";
1140 <<
" implicit copy assignment operators created\n";
1144 <<
" implicit move assignment operators created\n";
1147 <<
" implicit destructors created\n";
1150 llvm::errs() <<
"\n";
1154 BumpAlloc.PrintStats();
1158 bool NotifyListeners) {
1159 if (NotifyListeners)
1168 if (It == MergedDefModules.end())
1171 auto &Merged = It->second;
1173 for (
Module *&M : Merged)
1174 if (!Found.insert(M).second)
1176 Merged.erase(
std::remove(Merged.begin(), Merged.end(),
nullptr), Merged.end());
1179 void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
1180 if (LazyInitializers.empty())
1184 assert(Source &&
"lazy initializers but no external source");
1186 auto LazyInits = std::move(LazyInitializers);
1187 LazyInitializers.clear();
1189 for (
auto ID : LazyInits)
1190 Initializers.push_back(Source->GetExternalDecl(
ID));
1192 assert(LazyInitializers.empty() &&
1193 "GetExternalDecl for lazy module initializer added more inits");
1199 if (
const auto *
ID = dyn_cast<ImportDecl>(D)) {
1200 auto It = ModuleInitializers.find(
ID->getImportedModule());
1203 if (It == ModuleInitializers.end())
1207 auto &Imported = *It->second;
1208 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
1209 Imported.resolve(*
this);
1210 auto *OnlyDecl = Imported.Initializers.front();
1211 if (isa<ImportDecl>(OnlyDecl))
1216 auto *&
Inits = ModuleInitializers[M];
1218 Inits =
new (*this) PerModuleInitializers;
1219 Inits->Initializers.push_back(D);
1223 auto *&
Inits = ModuleInitializers[M];
1225 Inits =
new (*this) PerModuleInitializers;
1226 Inits->LazyInitializers.insert(
Inits->LazyInitializers.end(),
1227 IDs.begin(), IDs.end());
1231 auto It = ModuleInitializers.find(M);
1232 if (It == ModuleInitializers.end())
1235 auto *
Inits = It->second;
1236 Inits->resolve(*
this);
1237 return Inits->Initializers;
1241 if (!ExternCContext)
1244 return ExternCContext;
1251 BuiltinTemplate->setImplicit();
1252 TUDecl->addDecl(BuiltinTemplate);
1254 return BuiltinTemplate;
1259 if (!MakeIntegerSeqDecl)
1262 return MakeIntegerSeqDecl;
1267 if (!TypePackElementDecl)
1270 return TypePackElementDecl;
1284 NewDecl->addAttr(TypeVisibilityAttr::CreateImplicit(
1290 StringRef Name)
const {
1314 Types.push_back(Ty);
1319 assert((!this->Target || this->Target == &Target) &&
1320 "Incorrect target reinitialization");
1323 this->Target = &Target;
1324 this->AuxTarget = AuxTarget;
1331 InitBuiltinType(
VoidTy, BuiltinType::Void);
1334 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1336 if (LangOpts.CharIsSigned)
1337 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1339 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1342 InitBuiltinType(
ShortTy, BuiltinType::Short);
1343 InitBuiltinType(
IntTy, BuiltinType::Int);
1344 InitBuiltinType(
LongTy, BuiltinType::Long);
1345 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1355 InitBuiltinType(
FloatTy, BuiltinType::Float);
1356 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1357 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1360 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1363 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1366 InitBuiltinType(
ShortAccumTy, BuiltinType::ShortAccum);
1367 InitBuiltinType(
AccumTy, BuiltinType::Accum);
1368 InitBuiltinType(
LongAccumTy, BuiltinType::LongAccum);
1372 InitBuiltinType(
ShortFractTy, BuiltinType::ShortFract);
1373 InitBuiltinType(
FractTy, BuiltinType::Fract);
1374 InitBuiltinType(
LongFractTy, BuiltinType::LongFract);
1379 InitBuiltinType(
SatAccumTy, BuiltinType::SatAccum);
1385 InitBuiltinType(
SatFractTy, BuiltinType::SatFract);
1392 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1397 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1399 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1400 if (LangOpts.CPlusPlus && LangOpts.WChar)
1404 WideCharTy = getFromTargetType(Target.getWCharType());
1407 WIntTy = getFromTargetType(Target.getWIntType());
1410 InitBuiltinType(
Char8Ty, BuiltinType::Char8);
1412 if (LangOpts.CPlusPlus)
1413 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1415 Char16Ty = getFromTargetType(Target.getChar16Type());
1417 if (LangOpts.CPlusPlus)
1418 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1420 Char32Ty = getFromTargetType(Target.getChar32Type());
1427 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1430 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1439 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1445 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1448 if (LangOpts.OpenMP)
1462 if (LangOpts.OpenCL) {
1463 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1464 InitBuiltinType(SingletonId, BuiltinType::Id); 1465 #include "clang/Basic/OpenCLImageTypes.def" 1467 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1468 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1470 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1473 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 1474 InitBuiltinType(Id##Ty, BuiltinType::Id); 1475 #include "clang/Basic/OpenCLExtensionTypes.def" 1478 if (Target.hasAArch64SVETypes()) {
1479 #define SVE_TYPE(Name, Id, SingletonId) \ 1480 InitBuiltinType(SingletonId, BuiltinType::Id); 1481 #include "clang/Basic/AArch64SVEACLETypes.def" 1488 ObjCConstantStringType =
QualType();
1493 if (LangOpts.OpenCLVersion >= 200) {
1503 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1506 InitBuiltinType(
HalfTy, BuiltinType::Half);
1513 return SourceMgr.getDiagnostics();
1528 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1529 if (Pos != DeclAttrs.end()) {
1530 Pos->second->~AttrVec();
1531 DeclAttrs.erase(Pos);
1545 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1546 TemplateOrInstantiation.find(Var);
1547 if (Pos == TemplateOrInstantiation.end())
1560 Tmpl, TSK, PointOfInstantiation));
1566 assert(!TemplateOrInstantiation[Inst] &&
1567 "Already noted what the variable was instantiated from");
1568 TemplateOrInstantiation[Inst] = TSI;
1573 auto Pos = InstantiatedFromUsingDecl.find(UUD);
1574 if (Pos == InstantiatedFromUsingDecl.end())
1582 assert((isa<UsingDecl>(Pattern) ||
1583 isa<UnresolvedUsingValueDecl>(Pattern) ||
1584 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1585 "pattern decl is not a using decl");
1586 assert((isa<UsingDecl>(Inst) ||
1587 isa<UnresolvedUsingValueDecl>(Inst) ||
1588 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1589 "instantiation did not produce a using decl");
1590 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1591 InstantiatedFromUsingDecl[Inst] = Pattern;
1596 llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>::const_iterator Pos
1597 = InstantiatedFromUsingShadowDecl.find(Inst);
1598 if (Pos == InstantiatedFromUsingShadowDecl.end())
1607 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1608 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1612 llvm::DenseMap<FieldDecl *, FieldDecl *>::iterator Pos
1613 = InstantiatedFromUnnamedFieldDecl.find(Field);
1614 if (Pos == InstantiatedFromUnnamedFieldDecl.end())
1622 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1623 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1624 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1625 "Already noted what unnamed field was instantiated from");
1627 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1643 return Range.end() - Range.begin();
1648 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1650 if (Pos == OverriddenMethods.end())
1658 OverriddenMethods[Method].push_back(Overridden);
1666 if (
const auto *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1677 Method->getOverriddenMethods(OverDecls);
1678 Overridden.append(OverDecls.begin(), OverDecls.end());
1682 assert(!Import->NextLocalImport &&
"Import declaration already in the chain");
1683 assert(!Import->
isFromASTFile() &&
"Non-local import declaration");
1684 if (!FirstLocalImport) {
1685 FirstLocalImport = Import;
1686 LastLocalImport = Import;
1690 LastLocalImport->NextLocalImport = Import;
1691 LastLocalImport = Import;
1703 llvm_unreachable(
"Not a floating point type!");
1704 case BuiltinType::Float16:
1705 case BuiltinType::Half:
1706 return Target->getHalfFormat();
1707 case BuiltinType::Float:
return Target->getFloatFormat();
1708 case BuiltinType::Double:
return Target->getDoubleFormat();
1709 case BuiltinType::LongDouble:
1711 return AuxTarget->getLongDoubleFormat();
1712 return Target->getLongDoubleFormat();
1713 case BuiltinType::Float128:
1715 return AuxTarget->getFloat128Format();
1716 return Target->getFloat128Format();
1721 unsigned Align =
Target->getCharWidth();
1723 bool UseAlignAttrOnly =
false;
1725 Align = AlignFromAttr;
1733 if (isa<FieldDecl>(D)) {
1734 UseAlignAttrOnly = D->
hasAttr<PackedAttr>() ||
1735 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1737 UseAlignAttrOnly =
true;
1740 else if (isa<FieldDecl>(D))
1743 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1747 if (UseAlignAttrOnly) {
1749 }
else if (
const auto *VD = dyn_cast<ValueDecl>(D)) {
1759 Align = getTypeInfoImpl(T.
getTypePtr()).Align;
1760 else if (!BaseT->isIncompleteType()) {
1764 unsigned MinWidth =
Target->getLargeArrayMinWidth();
1765 if (!ForAlignof && MinWidth) {
1768 else if (isa<ConstantArrayType>(
arrayType) &&
1769 MinWidth <= getTypeSize(cast<ConstantArrayType>(
arrayType)))
1774 if (BaseT.getQualifiers().hasUnaligned())
1775 Align =
Target->getCharWidth();
1776 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
1777 if (VD->hasGlobalStorage() && !ForAlignof) {
1789 if (
const auto *Field = dyn_cast<FieldDecl>(VD)) {
1803 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1804 if (LowBitOfOffset < FieldAlign)
1805 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1808 Align =
std::min(Align, FieldAlign);
1820 std::pair<CharUnits, CharUnits>
1834 return sizeAndAlign;
1839 std::pair<CharUnits, CharUnits>
1842 std::pair<CharUnits, CharUnits> EltInfo =
1844 uint64_t Size = CAT->
getSize().getZExtValue();
1845 assert((Size == 0 || static_cast<uint64_t>(EltInfo.first.getQuantity()) <=
1846 (uint64_t)(-1)/Size) &&
1847 "Overflow in array type char size evaluation");
1848 uint64_t Width = EltInfo.first.getQuantity() * Size;
1849 unsigned Align = EltInfo.second.getQuantity();
1852 Width = llvm::alignTo(Width, Align);
1857 std::pair<CharUnits, CharUnits>
1859 if (
const auto *CAT = dyn_cast<ConstantArrayType>(T))
1866 std::pair<CharUnits, CharUnits>
1882 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1893 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1898 return TT->getDecl()->getMaxAlignment();
1904 TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
1905 if (I != MemoizedTypeInfo.end())
1910 MemoizedTypeInfo[T] = TI;
1920 TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
1923 bool AlignIsRequired =
false;
1926 #define TYPE(Class, Base) 1927 #define ABSTRACT_TYPE(Class, Base) 1928 #define NON_CANONICAL_TYPE(Class, Base) 1929 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 1930 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \ 1932 assert(!T->isDependentType() && "should not see dependent types here"); \ 1933 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr()); 1934 #include "clang/AST/TypeNodes.inc" 1935 llvm_unreachable(
"Should not see dependent types");
1937 case Type::FunctionNoProto:
1938 case Type::FunctionProto:
1944 case Type::IncompleteArray:
1945 case Type::VariableArray:
1947 Align =
getTypeAlign(cast<ArrayType>(T)->getElementType());
1950 case Type::ConstantArray: {
1951 const auto *CAT = cast<ConstantArrayType>(T);
1954 uint64_t Size = CAT->getSize().getZExtValue();
1955 assert((Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) &&
1956 "Overflow in array type bit size evaluation");
1957 Width = EltInfo.Width * Size;
1958 Align = EltInfo.Align;
1961 Width = llvm::alignTo(Width, Align);
1964 case Type::ExtVector:
1965 case Type::Vector: {
1966 const auto *VT = cast<VectorType>(T);
1968 Width = EltInfo.
Width * VT->getNumElements();
1972 if (Align & (Align-1)) {
1973 Align = llvm::NextPowerOf2(Align);
1974 Width = llvm::alignTo(Width, Align);
1977 uint64_t TargetVectorAlign =
Target->getMaxVectorAlign();
1978 if (TargetVectorAlign && TargetVectorAlign < Align)
1979 Align = TargetVectorAlign;
1984 switch (cast<BuiltinType>(T)->
getKind()) {
1985 default: llvm_unreachable(
"Unknown builtin type!");
1986 case BuiltinType::Void:
1991 case BuiltinType::Bool:
1992 Width =
Target->getBoolWidth();
1993 Align =
Target->getBoolAlign();
1995 case BuiltinType::Char_S:
1996 case BuiltinType::Char_U:
1997 case BuiltinType::UChar:
1998 case BuiltinType::SChar:
1999 case BuiltinType::Char8:
2000 Width =
Target->getCharWidth();
2001 Align =
Target->getCharAlign();
2003 case BuiltinType::WChar_S:
2004 case BuiltinType::WChar_U:
2005 Width =
Target->getWCharWidth();
2006 Align =
Target->getWCharAlign();
2008 case BuiltinType::Char16:
2009 Width =
Target->getChar16Width();
2010 Align =
Target->getChar16Align();
2012 case BuiltinType::Char32:
2013 Width =
Target->getChar32Width();
2014 Align =
Target->getChar32Align();
2016 case BuiltinType::UShort:
2017 case BuiltinType::Short:
2018 Width =
Target->getShortWidth();
2019 Align =
Target->getShortAlign();
2021 case BuiltinType::UInt:
2022 case BuiltinType::Int:
2023 Width =
Target->getIntWidth();
2024 Align =
Target->getIntAlign();
2026 case BuiltinType::ULong:
2027 case BuiltinType::Long:
2028 Width =
Target->getLongWidth();
2029 Align =
Target->getLongAlign();
2031 case BuiltinType::ULongLong:
2032 case BuiltinType::LongLong:
2033 Width =
Target->getLongLongWidth();
2034 Align =
Target->getLongLongAlign();
2036 case BuiltinType::Int128:
2037 case BuiltinType::UInt128:
2041 case BuiltinType::ShortAccum:
2042 case BuiltinType::UShortAccum:
2043 case BuiltinType::SatShortAccum:
2044 case BuiltinType::SatUShortAccum:
2045 Width =
Target->getShortAccumWidth();
2046 Align =
Target->getShortAccumAlign();
2048 case BuiltinType::Accum:
2049 case BuiltinType::UAccum:
2050 case BuiltinType::SatAccum:
2051 case BuiltinType::SatUAccum:
2052 Width =
Target->getAccumWidth();
2053 Align =
Target->getAccumAlign();
2055 case BuiltinType::LongAccum:
2056 case BuiltinType::ULongAccum:
2057 case BuiltinType::SatLongAccum:
2058 case BuiltinType::SatULongAccum:
2059 Width =
Target->getLongAccumWidth();
2060 Align =
Target->getLongAccumAlign();
2062 case BuiltinType::ShortFract:
2063 case BuiltinType::UShortFract:
2064 case BuiltinType::SatShortFract:
2065 case BuiltinType::SatUShortFract:
2066 Width =
Target->getShortFractWidth();
2067 Align =
Target->getShortFractAlign();
2069 case BuiltinType::Fract:
2070 case BuiltinType::UFract:
2071 case BuiltinType::SatFract:
2072 case BuiltinType::SatUFract:
2073 Width =
Target->getFractWidth();
2074 Align =
Target->getFractAlign();
2076 case BuiltinType::LongFract:
2077 case BuiltinType::ULongFract:
2078 case BuiltinType::SatLongFract:
2079 case BuiltinType::SatULongFract:
2080 Width =
Target->getLongFractWidth();
2081 Align =
Target->getLongFractAlign();
2083 case BuiltinType::Float16:
2084 case BuiltinType::Half:
2087 Width =
Target->getHalfWidth();
2088 Align =
Target->getHalfAlign();
2091 "Expected OpenMP device compilation.");
2092 Width = AuxTarget->getHalfWidth();
2093 Align = AuxTarget->getHalfAlign();
2096 case BuiltinType::Float:
2097 Width =
Target->getFloatWidth();
2098 Align =
Target->getFloatAlign();
2100 case BuiltinType::Double:
2101 Width =
Target->getDoubleWidth();
2102 Align =
Target->getDoubleAlign();
2104 case BuiltinType::LongDouble:
2106 (
Target->getLongDoubleWidth() != AuxTarget->getLongDoubleWidth() ||
2107 Target->getLongDoubleAlign() != AuxTarget->getLongDoubleAlign())) {
2108 Width = AuxTarget->getLongDoubleWidth();
2109 Align = AuxTarget->getLongDoubleAlign();
2111 Width =
Target->getLongDoubleWidth();
2112 Align =
Target->getLongDoubleAlign();
2115 case BuiltinType::Float128:
2118 Width =
Target->getFloat128Width();
2119 Align =
Target->getFloat128Align();
2122 "Expected OpenMP device compilation.");
2123 Width = AuxTarget->getFloat128Width();
2124 Align = AuxTarget->getFloat128Align();
2127 case BuiltinType::NullPtr:
2128 Width =
Target->getPointerWidth(0);
2129 Align =
Target->getPointerAlign(0);
2131 case BuiltinType::ObjCId:
2132 case BuiltinType::ObjCClass:
2133 case BuiltinType::ObjCSel:
2134 Width =
Target->getPointerWidth(0);
2135 Align =
Target->getPointerAlign(0);
2137 case BuiltinType::OCLSampler:
2138 case BuiltinType::OCLEvent:
2139 case BuiltinType::OCLClkEvent:
2140 case BuiltinType::OCLQueue:
2141 case BuiltinType::OCLReserveID:
2142 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 2143 case BuiltinType::Id: 2144 #include "clang/Basic/OpenCLImageTypes.def" 2145 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 2146 case BuiltinType::Id: 2147 #include "clang/Basic/OpenCLExtensionTypes.def" 2150 Width =
Target->getPointerWidth(AS);
2151 Align =
Target->getPointerAlign(AS);
2161 #define SVE_VECTOR_TYPE(Name, Id, SingletonId, ElKind, ElBits, IsSigned, IsFP)\ 2162 case BuiltinType::Id: \ 2166 #define SVE_PREDICATE_TYPE(Name, Id, SingletonId, ElKind) \ 2167 case BuiltinType::Id: \ 2171 #include "clang/Basic/AArch64SVEACLETypes.def" 2174 case Type::ObjCObjectPointer:
2175 Width =
Target->getPointerWidth(0);
2176 Align =
Target->getPointerAlign(0);
2178 case Type::BlockPointer:
2180 Width =
Target->getPointerWidth(AS);
2181 Align =
Target->getPointerAlign(AS);
2183 case Type::LValueReference:
2184 case Type::RValueReference:
2188 Width =
Target->getPointerWidth(AS);
2189 Align =
Target->getPointerAlign(AS);
2193 Width =
Target->getPointerWidth(AS);
2194 Align =
Target->getPointerAlign(AS);
2196 case Type::MemberPointer: {
2197 const auto *MPT = cast<MemberPointerType>(T);
2203 case Type::Complex: {
2207 Width = EltInfo.
Width * 2;
2208 Align = EltInfo.
Align;
2211 case Type::ObjCObject:
2212 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr());
2213 case Type::Adjusted:
2216 case Type::ObjCInterface: {
2217 const auto *ObjCI = cast<ObjCInterfaceType>(T);
2219 Width =
toBits(Layout.getSize());
2220 Align =
toBits(Layout.getAlignment());
2225 const auto *TT = cast<TagType>(T);
2227 if (TT->getDecl()->isInvalidDecl()) {
2233 if (
const auto *ET = dyn_cast<EnumType>(TT)) {
2234 const EnumDecl *ED = ET->getDecl();
2238 Info.
Align = AttrAlign;
2244 const auto *RT = cast<RecordType>(TT);
2249 AlignIsRequired = RD->hasAttr<AlignedAttr>();
2253 case Type::SubstTemplateTypeParm:
2254 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
2255 getReplacementType().getTypePtr());
2258 case Type::DeducedTemplateSpecialization: {
2259 const auto *A = cast<DeducedType>(T);
2260 assert(!A->getDeducedType().isNull() &&
2261 "cannot request the size of an undeduced or dependent auto type");
2262 return getTypeInfo(A->getDeducedType().getTypePtr());
2266 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr());
2268 case Type::MacroQualified:
2272 case Type::ObjCTypeParam:
2273 return getTypeInfo(cast<ObjCTypeParamType>(T)->desugar().getTypePtr());
2275 case Type::Typedef: {
2283 AlignIsRequired =
true;
2292 case Type::Elaborated:
2293 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
2295 case Type::Attributed:
2297 cast<AttributedType>(T)->getEquivalentType().getTypePtr());
2299 case Type::Atomic: {
2308 Width =
Target->getCharWidth();
2310 }
else if (Width <= Target->getMaxAtomicPromoteWidth()) {
2316 if (!llvm::isPowerOf2_64(Width))
2317 Width = llvm::NextPowerOf2(Width);
2320 Align =
static_cast<unsigned>(Width);
2331 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
2332 return TypeInfo(Width, Align, AlignIsRequired);
2336 UnadjustedAlignMap::iterator I = MemoizedUnadjustedAlign.find(T);
2337 if (I != MemoizedUnadjustedAlign.end())
2340 unsigned UnadjustedAlign;
2352 MemoizedUnadjustedAlign[T] = UnadjustedAlign;
2353 return UnadjustedAlign;
2359 if ((
getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 ||
2360 getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) &&
2411 unsigned ABIAlign = TI.
Align;
2419 if (!
Target->allowsLargerPreferedTypeAlignment())
2424 T = CT->getElementType().getTypePtr();
2426 T = ET->getDecl()->getIntegerType().getTypePtr();
2479 for (
const auto *I : OI->
ivars())
2483 for (
const ObjCIvarDecl *Iv = IDecl->all_declared_ivar_begin(); Iv;
2485 Ivars.push_back(Iv);
2492 llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols) {
2493 if (
const auto *OI = dyn_cast<ObjCInterfaceDecl>(CDecl)) {
2496 for (
auto *Proto : OI->all_referenced_protocols()) {
2501 for (
const auto *Cat : OI->visible_categories())
2507 SD = SD->getSuperClass();
2509 }
else if (
const auto *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2510 for (
auto *Proto : OC->protocols()) {
2513 }
else if (
const auto *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2515 if (!Protocols.insert(
2516 const_cast<ObjCProtocolDecl *>(OP->getCanonicalDecl())).second)
2519 for (
auto *Proto : OP->protocols())
2526 assert(RD->
isUnion() &&
"Must be union type");
2529 for (
const auto *Field : RD->
fields()) {
2533 if (FieldSize != UnionSize)
2545 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
2546 return ClassDecl->isEmpty();
2554 assert(!RD->
isUnion() &&
"Must be struct/class type");
2557 int64_t CurOffsetInBits = 0;
2558 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2559 if (ClassDecl->isDynamicClass())
2563 for (
const auto &
Base : ClassDecl->bases()) {
2571 Bases.emplace_back(
Base.getType(), Size.getValue());
2575 llvm::sort(Bases, [&](
const std::pair<QualType, int64_t> &L,
2576 const std::pair<QualType, int64_t> &R) {
2577 return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) <
2578 Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
2581 for (
const auto &
Base : Bases) {
2582 int64_t BaseOffset = Context.
toBits(
2583 Layout.getBaseClassOffset(
Base.first->getAsCXXRecordDecl()));
2584 int64_t BaseSize =
Base.second;
2585 if (BaseOffset != CurOffsetInBits)
2587 CurOffsetInBits = BaseOffset + BaseSize;
2591 for (
const auto *Field : RD->
fields()) {
2592 if (!Field->getType()->isReferenceType() &&
2596 int64_t FieldSizeInBits =
2598 if (Field->isBitField()) {
2599 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2601 if (BitfieldSize > FieldSizeInBits)
2603 FieldSizeInBits = BitfieldSize;
2608 if (FieldOffsetInBits != CurOffsetInBits)
2611 CurOffsetInBits = FieldSizeInBits + FieldOffsetInBits;
2614 return CurOffsetInBits;
2635 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2655 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2670 return StructSize &&
2671 StructSize.getValue() ==
static_cast<int64_t
>(
getTypeSize(Ty));
2692 count += Ext->ivar_size();
2697 count += ImplDecl->ivar_size();
2715 if (isa<GNUNullExpr>(E))
return true;
2723 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2724 I = ObjCImpls.find(D);
2725 if (I != ObjCImpls.end())
2726 return cast<ObjCImplementationDecl>(I->second);
2733 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2734 I = ObjCImpls.find(D);
2735 if (I != ObjCImpls.end())
2736 return cast<ObjCCategoryImplDecl>(I->second);
2743 assert(IFaceD && ImplD &&
"Passed null params");
2744 ObjCImpls[IFaceD] = ImplD;
2750 assert(CatD && ImplD &&
"Passed null params");
2751 ObjCImpls[CatD] = ImplD;
2756 return ObjCMethodRedecls.
lookup(MD);
2762 ObjCMethodRedecls[MD] = Redecl;
2769 if (
const auto *CD = dyn_cast<ObjCCategoryDecl>(ND->
getDeclContext()))
2770 return CD->getClassInterface();
2771 if (
const auto *IMD = dyn_cast<ObjCImplDecl>(ND->
getDeclContext()))
2772 return IMD->getClassInterface();
2780 assert(VD &&
"Passed null params");
2781 assert(VD->
hasAttr<BlocksAttr>() &&
2782 "getBlockVarCopyInits - not __block var");
2783 auto I = BlockVarCopyInits.find(VD);
2784 if (I != BlockVarCopyInits.end())
2786 return {
nullptr,
false};
2792 assert(VD && CopyExpr &&
"Passed null params");
2793 assert(VD->
hasAttr<BlocksAttr>() &&
2794 "setBlockVarCopyInits - not __block var");
2795 BlockVarCopyInits[VD].setExprAndFlag(CopyExpr, CanThrow);
2799 unsigned DataSize)
const {
2804 "incorrect data size provided to CreateTypeSourceInfo!");
2821 return getObjCLayout(D,
nullptr);
2835 ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
2840 llvm::FoldingSetNodeID
ID;
2842 void *insertPos =
nullptr;
2843 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
2844 assert(eq->getQualifiers() == quals);
2853 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
2856 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
2860 ExtQualNodes.InsertNode(eq, insertPos);
2865 LangAS AddressSpace)
const {
2878 "Type cannot be in multiple addr spaces!");
2881 return getExtQualType(TypeNode, Quals);
2900 return getExtQualType(TypeNode, Quals);
2927 "Type cannot have multiple ObjCGCs!");
2930 return getExtQualType(TypeNode, Quals);
2949 if (
const auto *FNPT = dyn_cast<FunctionNoProtoType>(T)) {
2952 const auto *FPT = cast<FunctionProtoType>(T);
2955 Result =
getFunctionType(FPT->getReturnType(), FPT->getParamTypes(), EPI);
2958 return cast<FunctionType>(Result.
getTypePtr());
2974 L->DeducedReturnType(FD, ResultType);
2984 if (
const auto *PT = dyn_cast<ParenType>(Orig))
2989 if (
const auto *MQT = dyn_cast<MacroQualifiedType>(Orig))
2992 MQT->getMacroIdentifier());
2995 if (
const auto *AT = dyn_cast<AttributedType>(Orig))
3005 Proto->getReturnType(), Proto->getParamTypes(),
3006 Proto->getExtProtoInfo().withExceptionSpec(ESI));
3021 for (
unsigned i = 0, n = Args.size(); i != n; ++i)
3055 if (TSInfo->getType() != FD->
getType())
3063 "TypeLoc size mismatch from updating exception specification");
3064 TSInfo->overrideType(Updated);
3073 llvm::FoldingSetNodeID
ID;
3076 void *InsertPos =
nullptr;
3077 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
3087 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
3088 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3091 Types.push_back(New);
3092 ComplexTypes.InsertNode(New, InsertPos);
3101 llvm::FoldingSetNodeID
ID;
3104 void *InsertPos =
nullptr;
3105 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3115 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3116 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3119 Types.push_back(New);
3120 PointerTypes.InsertNode(New, InsertPos);
3125 llvm::FoldingSetNodeID
ID;
3127 void *InsertPos =
nullptr;
3128 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3135 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3136 assert(!AT &&
"Shouldn't be in the map!");
3140 Types.push_back(AT);
3141 AdjustedTypes.InsertNode(AT, InsertPos);
3165 llvm::FoldingSetNodeID
ID;
3167 void *InsertPos =
nullptr;
3168 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3175 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
3176 assert(!AT &&
"Shouldn't be in the map!");
3179 Types.push_back(AT);
3180 AdjustedTypes.InsertNode(AT, InsertPos);
3190 llvm::FoldingSetNodeID
ID;
3193 void *InsertPos =
nullptr;
3195 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3206 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3207 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3210 Types.push_back(New);
3211 BlockPointerTypes.InsertNode(New, InsertPos);
3220 "Unresolved overloaded function type");
3224 llvm::FoldingSetNodeID
ID;
3227 void *InsertPos =
nullptr;
3229 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3237 if (!SpelledAsLValue || InnerRef || !T.
isCanonical()) {
3238 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
3243 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3244 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3249 Types.push_back(New);
3250 LValueReferenceTypes.InsertNode(New, InsertPos);
3260 llvm::FoldingSetNodeID
ID;
3263 void *InsertPos =
nullptr;
3265 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
3274 QualType PointeeType = (InnerRef ? InnerRef->getPointeeType() : T);
3279 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
3280 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3284 Types.push_back(New);
3285 RValueReferenceTypes.InsertNode(New, InsertPos);
3294 llvm::FoldingSetNodeID
ID;
3297 void *InsertPos =
nullptr;
3299 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3310 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3311 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3314 Types.push_back(New);
3315 MemberPointerTypes.InsertNode(New, InsertPos);
3323 const Expr *SizeExpr,
3325 unsigned IndexTypeQuals)
const {
3328 "Constant array of VLAs is illegal!");
3337 ArySize = ArySize.zextOrTrunc(
Target->getMaxPointerWidth());
3339 llvm::FoldingSetNodeID
ID;
3343 void *InsertPos =
nullptr;
3345 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
3355 ASM, IndexTypeQuals);
3360 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
3361 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3365 ConstantArrayType::totalSizeToAlloc<const Expr *>(SizeExpr ? 1 : 0),
3367 auto *New =
new (Mem)
3369 ConstantArrayTypes.InsertNode(New, InsertPos);
3370 Types.push_back(New);
3384 const Type *ty = split.
Ty;
3386 #define TYPE(Class, Base) 3387 #define ABSTRACT_TYPE(Class, Base) 3388 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 3389 #include "clang/AST/TypeNodes.inc" 3390 llvm_unreachable(
"didn't desugar past all non-canonical types?");
3396 case Type::DependentVector:
3397 case Type::ExtVector:
3398 case Type::DependentSizedExtVector:
3399 case Type::DependentAddressSpace:
3400 case Type::ObjCObject:
3401 case Type::ObjCInterface:
3402 case Type::ObjCObjectPointer:
3405 case Type::UnresolvedUsing:
3406 case Type::TypeOfExpr:
3408 case Type::Decltype:
3409 case Type::UnaryTransform:
3410 case Type::DependentName:
3411 case Type::InjectedClassName:
3412 case Type::TemplateSpecialization:
3413 case Type::DependentTemplateSpecialization:
3414 case Type::TemplateTypeParm:
3415 case Type::SubstTemplateTypeParmPack:
3417 case Type::DeducedTemplateSpecialization:
3418 case Type::PackExpansion:
3419 llvm_unreachable(
"type should never be variably-modified");
3423 case Type::FunctionNoProto:
3424 case Type::FunctionProto:
3425 case Type::BlockPointer:
3426 case Type::MemberPointer:
3436 cast<PointerType>(ty)->getPointeeType()));
3439 case Type::LValueReference: {
3440 const auto *lv = cast<LValueReferenceType>(ty);
3443 lv->isSpelledAsLValue());
3447 case Type::RValueReference: {
3448 const auto *lv = cast<RValueReferenceType>(ty);
3454 case Type::Atomic: {
3455 const auto *at = cast<AtomicType>(ty);
3460 case Type::ConstantArray: {
3461 const auto *
cat = cast<ConstantArrayType>(ty);
3466 cat->getSizeModifier(),
3467 cat->getIndexTypeCVRQualifiers());
3471 case Type::DependentSizedArray: {
3472 const auto *dat = cast<DependentSizedArrayType>(ty);
3476 dat->getSizeModifier(),
3477 dat->getIndexTypeCVRQualifiers(),
3478 dat->getBracketsRange());
3483 case Type::IncompleteArray: {
3484 const auto *iat = cast<IncompleteArrayType>(ty);
3489 iat->getIndexTypeCVRQualifiers(),
3495 case Type::VariableArray: {
3496 const auto *vat = cast<VariableArrayType>(ty);
3501 vat->getIndexTypeCVRQualifiers(),
3502 vat->getBracketsRange());
3516 unsigned IndexTypeQuals,
3526 IndexTypeQuals, Brackets);
3533 VariableArrayTypes.push_back(New);
3534 Types.push_back(New);
3544 unsigned elementTypeQuals,
3548 "Size must be type- or value-dependent!");
3558 numElements, ASM, elementTypeQuals,
3560 Types.push_back(newType);
3569 void *insertPos =
nullptr;
3570 llvm::FoldingSetNodeID
ID;
3573 ASM, elementTypeQuals, numElements);
3577 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3583 QualType(), numElements, ASM, elementTypeQuals,
3585 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
3586 Types.push_back(canonTy);
3591 canonElementType.
Quals);
3595 if (
QualType(canonElementType.
Ty, 0) == elementType &&
3604 ASM, elementTypeQuals, brackets);
3605 Types.push_back(sugaredType);
3611 unsigned elementTypeQuals)
const {
3612 llvm::FoldingSetNodeID
ID;
3615 void *insertPos =
nullptr;
3617 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
3628 ASM, elementTypeQuals);
3633 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3634 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
3640 IncompleteArrayTypes.InsertNode(newType, insertPos);
3641 Types.push_back(newType);
3652 llvm::FoldingSetNodeID
ID;
3655 void *InsertPos =
nullptr;
3656 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3666 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3667 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3670 VectorType(vecType, NumElts, Canonical, VecKind);
3671 VectorTypes.InsertNode(New, InsertPos);
3672 Types.push_back(New);
3680 llvm::FoldingSetNodeID
ID;
3683 void *InsertPos =
nullptr;
3685 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3690 *
this, VecType,
QualType(Canon, 0), SizeExpr, AttrLoc, VecKind);
3693 if (CanonVecTy == VecType) {
3695 *
this, VecType,
QualType(), SizeExpr, AttrLoc, VecKind);
3698 DependentVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3699 assert(!CanonCheck &&
3700 "Dependent-sized vector_size canonical type broken");
3702 DependentVectorTypes.InsertNode(New, InsertPos);
3707 *
this, VecType, CanonExtTy, SizeExpr, AttrLoc, VecKind);
3711 Types.push_back(New);
3722 llvm::FoldingSetNodeID
ID;
3725 void *InsertPos =
nullptr;
3726 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3736 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3737 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3741 VectorTypes.InsertNode(New, InsertPos);
3742 Types.push_back(New);
3750 llvm::FoldingSetNodeID
ID;
3754 void *InsertPos =
nullptr;
3756 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3766 if (CanonVecTy == vecType) {
3772 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3773 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
3775 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
3780 *
this, vecType, CanonExtTy, SizeExpr, AttrLoc);
3784 Types.push_back(New);
3789 Expr *AddrSpaceExpr,
3795 void *insertPos =
nullptr;
3796 llvm::FoldingSetNodeID
ID;
3801 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
3806 QualType(), AddrSpaceExpr, AttrLoc);
3807 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
3808 Types.push_back(canonTy);
3811 if (canonPointeeType == PointeeType &&
3818 AddrSpaceExpr, AttrLoc);
3819 Types.push_back(sugaredType);
3836 llvm::FoldingSetNodeID
ID;
3839 void *InsertPos =
nullptr;
3841 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
3851 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3852 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3857 Types.push_back(New);
3858 FunctionNoProtoTypes.InsertNode(New, InsertPos);
3874 return CanResultType;
3881 if (!NoexceptInType)
3898 bool AnyPackExpansions =
false;
3903 AnyPackExpansions =
true;
3905 return AnyPackExpansions;
3911 QualType ASTContext::getFunctionTypeInternal(
3914 size_t NumArgs = ArgArray.size();
3918 llvm::FoldingSetNodeID
ID;
3923 bool Unique =
false;
3925 void *InsertPos =
nullptr;
3927 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
3936 EPI.ExceptionSpec.NoexceptExpr == FPT->getNoexceptExpr())
3947 bool IsCanonicalExceptionSpec =
3951 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
3953 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
3954 if (!ArgArray[i].isCanonicalAsParam())
3955 isCanonical =
false;
3957 if (OnlyWantCanonical)
3958 assert(isCanonical &&
3959 "given non-canonical parameters constructing canonical type");
3964 if (!isCanonical && Canonical.isNull()) {
3966 CanonicalArgs.reserve(NumArgs);
3967 for (
unsigned i = 0; i != NumArgs; ++i)
3974 if (IsCanonicalExceptionSpec) {
3976 }
else if (NoexceptInType) {
3977 switch (EPI.ExceptionSpec.Type) {
3989 bool AnyPacks =
false;
3990 for (
QualType ET : EPI.ExceptionSpec.Exceptions) {
4012 llvm_unreachable(
"dependent noexcept is already canonical");
4021 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
4025 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
4026 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4031 auto ESH = FunctionProtoType::getExceptionSpecSize(
4032 EPI.ExceptionSpec.Type, EPI.ExceptionSpec.Exceptions.size());
4033 size_t Size = FunctionProtoType::totalSizeToAlloc<
4036 FunctionProtoType::ExtParameterInfo,
Qualifiers>(
4037 NumArgs, EPI.Variadic,
4038 FunctionProtoType::hasExtraBitfields(EPI.ExceptionSpec.Type),
4039 ESH.NumExceptionType, ESH.NumExprPtr, ESH.NumFunctionDeclPtr,
4040 EPI.ExtParameterInfos ? NumArgs : 0,
4041 EPI.TypeQuals.hasNonFastQualifiers() ? 1 : 0);
4046 Types.push_back(FTP);
4048 FunctionProtoTypes.InsertNode(FTP, InsertPos);
4049 return QualType(FTP, 0);
4053 llvm::FoldingSetNodeID
ID;
4056 void *InsertPos =
nullptr;
4057 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
4067 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
4068 assert(!NewIP &&
"Shouldn't be in the map!");
4072 Types.push_back(New);
4073 PipeTypes.InsertNode(New, InsertPos);
4084 return getPipeType(T,
true);
4088 return getPipeType(T,
false);
4093 if (!isa<CXXRecordDecl>(D))
return false;
4094 const auto *RD = cast<CXXRecordDecl>(D);
4095 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
4097 if (RD->getDescribedClassTemplate() &&
4098 !isa<ClassTemplateSpecializationDecl>(RD))
4109 if (Decl->TypeForDecl) {
4110 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
4112 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
4113 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4114 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
4118 Decl->TypeForDecl = newType;
4119 Types.push_back(newType);
4121 return QualType(Decl->TypeForDecl, 0);
4127 assert(Decl &&
"Passed null for Decl param");
4128 assert(!Decl->TypeForDecl &&
"TypeForDecl present in slow case");
4130 if (
const auto *Typedef = dyn_cast<TypedefNameDecl>(Decl))
4133 assert(!isa<TemplateTypeParmDecl>(Decl) &&
4134 "Template type parameter types are always available.");
4136 if (
const auto *Record = dyn_cast<RecordDecl>(Decl)) {
4137 assert(Record->isFirstDecl() &&
"struct/union has previous declaration");
4140 }
else if (
const auto *
Enum = dyn_cast<EnumDecl>(Decl)) {
4141 assert(
Enum->isFirstDecl() &&
"enum has previous declaration");
4143 }
else if (
const auto *Using = dyn_cast<UnresolvedUsingTypenameDecl>(Decl)) {
4145 Decl->TypeForDecl = newType;
4146 Types.push_back(newType);
4148 llvm_unreachable(
"TypeDecl without a type?");
4150 return QualType(Decl->TypeForDecl, 0);
4158 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
4164 Decl->TypeForDecl = newType;
4165 Types.push_back(newType);
4170 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
4173 if (PrevDecl->TypeForDecl)
4174 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
4177 Decl->TypeForDecl = newType;
4178 Types.push_back(newType);
4183 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
4186 if (PrevDecl->TypeForDecl)
4187 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
4190 Decl->TypeForDecl = newType;
4191 Types.push_back(newType);
4198 llvm::FoldingSetNodeID id;
4201 void *insertPos =
nullptr;
4203 if (type)
return QualType(type, 0);
4209 Types.push_back(type);
4210 AttributedTypes.InsertNode(type, insertPos);
4220 &&
"replacement types must always be canonical");
4222 llvm::FoldingSetNodeID
ID;
4224 void *InsertPos =
nullptr;
4226 = SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4231 Types.push_back(SubstParm);
4232 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
4245 assert(
P.getAsType().isCanonical() &&
"Pack contains non-canonical type");
4249 llvm::FoldingSetNodeID
ID;
4251 void *InsertPos =
nullptr;
4253 = SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
4261 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
4267 Types.push_back(SubstParm);
4268 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
4278 llvm::FoldingSetNodeID
ID;
4280 void *InsertPos =
nullptr;
4282 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4292 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
4293 assert(!TypeCheck &&
"Template type parameter canonical type broken");
4299 Types.push_back(TypeParm);
4300 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
4311 "No dependent template names here!");
4321 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
4331 "No dependent template names here!");
4334 ArgVec.reserve(Args.
size());
4336 ArgVec.push_back(Arg.getArgument());
4344 if (Arg.isPackExpansion())
4356 "No dependent template names here!");
4365 if (!Underlying.
isNull())
4371 "Caller must compute aliased type");
4372 IsTypeAlias =
false;
4381 (IsTypeAlias?
sizeof(
QualType) : 0),
4385 IsTypeAlias ? Underlying :
QualType());
4387 Types.push_back(Spec);
4394 "No dependent template names here!");
4403 unsigned NumArgs = Args.size();
4404 CanonArgs.reserve(NumArgs);
4410 llvm::FoldingSetNodeID
ID;
4414 void *InsertPos =
nullptr;
4416 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4426 Types.push_back(Spec);
4427 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
4431 "Non-dependent template-id type must have a canonical type");
4438 TagDecl *OwnedTagDecl)
const {
4439 llvm::FoldingSetNodeID
ID;
4442 void *InsertPos =
nullptr;
4443 ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4450 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4451 assert(!CheckT &&
"Elaborated canonical type broken");
4455 void *Mem =
Allocate(ElaboratedType::totalSizeToAlloc<TagDecl *>(!!OwnedTagDecl),
4457 T =
new (Mem)
ElaboratedType(Keyword, NNS, NamedType, Canon, OwnedTagDecl);
4460 ElaboratedTypes.InsertNode(T, InsertPos);
4466 llvm::FoldingSetNodeID
ID;
4469 void *InsertPos =
nullptr;
4470 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4477 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4478 assert(!CheckT &&
"Paren canonical type broken");
4484 ParenTypes.InsertNode(T, InsertPos);
4497 Types.push_back(newType);
4507 if (CanonNNS != NNS)
4511 llvm::FoldingSetNodeID
ID;
4514 void *InsertPos =
nullptr;
4516 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
4522 DependentNameTypes.InsertNode(T, InsertPos);
4534 for (
unsigned I = 0, E = Args.
size(); I != E; ++I)
4535 ArgCopy.push_back(Args[I].getArgument());
4546 "nested-name-specifier must be dependent");
4548 llvm::FoldingSetNodeID
ID;
4552 void *InsertPos =
nullptr;
4554 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4563 bool AnyNonCanonArgs =
false;
4564 unsigned NumArgs = Args.size();
4566 for (
unsigned I = 0; I != NumArgs; ++I) {
4568 if (!CanonArgs[I].structurallyEquals(Args[I]))
4569 AnyNonCanonArgs =
true;
4573 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
4579 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4588 DependentTemplateSpecializationTypes.InsertNode(T, InsertPos);
4594 if (
const auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
4600 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
4603 NTTP->getType().getNonLValueExprType(*
this),
4606 if (NTTP->isParameterPack())
4611 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
4627 Args.reserve(Args.size() + Params->
size());
4635 llvm::FoldingSetNodeID
ID;
4645 "Pack expansions must expand one or more parameter packs");
4646 void *InsertPos =
nullptr;
4648 = PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4663 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4670 PackExpansionTypes.InsertNode(T, InsertPos);
4682 if (Protocols.empty())
return true;
4687 for (
unsigned i = 1; i != Protocols.size(); ++i)
4689 Protocols[i]->getCanonicalDecl() != Protocols[i])
4697 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
4701 P =
P->getCanonicalDecl();
4704 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
4705 Protocols.erase(ProtocolsEnd, Protocols.end());
4710 unsigned NumProtocols)
const {
4712 llvm::makeArrayRef(Protocols, NumProtocols),
4720 bool isKindOf)
const {
4723 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
4724 isa<ObjCInterfaceType>(baseType))
4728 llvm::FoldingSetNodeID
ID;
4730 void *InsertPos =
nullptr;
4731 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
4738 if (effectiveTypeArgs.empty()) {
4740 effectiveTypeArgs = baseObject->getTypeArgs();
4747 bool typeArgsAreCanonical = std::all_of(effectiveTypeArgs.begin(),
4748 effectiveTypeArgs.end(),
4750 return type.isCanonical();
4753 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
4757 if (!typeArgsAreCanonical) {
4758 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
4759 for (
auto typeArg : effectiveTypeArgs)
4761 canonTypeArgs = canonTypeArgsVec;
4763 canonTypeArgs = effectiveTypeArgs;
4768 if (!protocolsSorted) {
4769 canonProtocolsVec.append(protocols.begin(), protocols.end());
4771 canonProtocols = canonProtocolsVec;
4773 canonProtocols = protocols;
4777 canonProtocols, isKindOf);
4780 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
4784 size += typeArgs.size() *
sizeof(
QualType);
4792 ObjCObjectTypes.InsertNode(T, InsertPos);
4802 bool allowOnPointerType)
const {
4805 if (
const auto *objT = dyn_cast<ObjCTypeParamType>(type.
getTypePtr())) {
4810 if (allowOnPointerType) {
4811 if (
const auto *objPtr =
4812 dyn_cast<ObjCObjectPointerType>(type.
getTypePtr())) {
4818 protocolsVec.append(protocols.begin(), protocols.end());
4830 if (
const auto *objT = dyn_cast<ObjCObjectType>(type.
getTypePtr())){
4835 objT->getTypeArgsAsWritten(),
4837 objT->isKindOfTypeAsWritten());
4854 objPtr->isKindOfType());
4862 objPtr->isKindOfType());
4874 llvm::FoldingSetNodeID
ID;
4876 void *InsertPos =
nullptr;
4878 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
4883 if (!protocols.empty()) {
4887 Canonical, protocols, hasError,
true ));
4888 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
4896 Types.push_back(newType);
4897 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
4911 for (
auto *Proto : OPT->quals()) {
4932 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> InheritedProtocols;
4934 if (InheritedProtocols.empty())
4938 bool Conforms =
false;
4939 for (
auto *Proto : OPT->quals()) {
4941 for (
auto *PI : InheritedProtocols) {
4953 for (
auto *PI : InheritedProtocols) {
4955 bool Adopts =
false;
4956 for (
auto *Proto : OPT->quals()) {
4970 llvm::FoldingSetNodeID
ID;
4973 void *InsertPos =
nullptr;
4975 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4984 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4992 Types.push_back(QType);
4993 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
5001 if (Decl->TypeForDecl)
5002 return QualType(Decl->TypeForDecl, 0);
5005 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
5006 Decl->TypeForDecl = PrevDecl->TypeForDecl;
5007 return QualType(PrevDecl->TypeForDecl, 0);
5016 Decl->TypeForDecl = T;
5029 llvm::FoldingSetNodeID
ID;
5032 void *InsertPos =
nullptr;
5034 = DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
5044 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
5051 Types.push_back(toe);
5063 Types.push_back(tot);
5079 llvm::FoldingSetNodeID
ID;
5082 void *InsertPos =
nullptr;
5084 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
5088 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
5096 Types.push_back(dt);
5110 llvm::FoldingSetNodeID
ID;
5113 void *InsertPos =
nullptr;
5115 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
5122 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
5130 UnderlyingType, Kind,
5133 Types.push_back(ut);
5142 bool IsDependent,
bool IsPack,
5145 assert((!IsPack || IsDependent) &&
"only use IsPack for a dependent pack");
5147 !TypeConstraintConcept && !IsDependent)
5151 void *InsertPos =
nullptr;
5152 llvm::FoldingSetNodeID
ID;
5154 TypeConstraintConcept, TypeConstraintArgs);
5155 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
5161 auto *AT =
new (Mem)
AutoType(DeducedType, Keyword, IsDependent, IsPack,
5162 TypeConstraintConcept, TypeConstraintArgs);
5163 Types.push_back(AT);
5165 AutoTypes.InsertNode(AT, InsertPos);
5175 void *InsertPos =
nullptr;
5176 llvm::FoldingSetNodeID
ID;
5180 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
5185 Types.push_back(DTST);
5187 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
5196 llvm::FoldingSetNodeID
ID;
5199 void *InsertPos =
nullptr;
5200 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
5210 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
5211 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
5214 Types.push_back(New);
5215 AtomicTypes.InsertNode(New, InsertPos);
5251 return getFromTargetType(
Target->getSizeType());
5257 return getFromTargetType(
Target->getSignedSizeType());
5262 return getFromTargetType(
Target->getIntMaxType());
5267 return getFromTargetType(
Target->getUIntMaxType());
5285 return getFromTargetType(
Target->getIntPtrType());
5295 return getFromTargetType(
Target->getPtrDiffType(0));
5302 return getFromTargetType(
Target->getUnsignedPtrDiffType(0));
5308 return getFromTargetType(
Target->getProcessIDType());
5322 if (isa<ArrayType>(Ty)) {
5324 }
else if (isa<FunctionType>(Ty)) {
5346 quals = splitType.
Quals;
5351 QualType elementType = AT->getElementType();
5356 if (elementType == unqualElementType) {
5357 assert(quals.
empty());
5358 quals = splitType.
Quals;
5366 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT)) {
5368 CAT->getSizeExpr(), CAT->getSizeModifier(), 0);
5371 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(AT)) {
5375 if (
const auto *VAT = dyn_cast<VariableArrayType>(AT)) {
5378 VAT->getSizeModifier(),
5379 VAT->getIndexTypeCVRQualifiers(),
5380 VAT->getBracketsRange());
5383 const auto *DSAT = cast<DependentSizedArrayType>(AT);
5385 DSAT->getSizeModifier(), 0,
5393 bool UnwrappedAny =
false;
5396 if (!AT1)
return UnwrappedAny;
5399 if (!AT2)
return UnwrappedAny;
5403 if (
auto *CAT1 = dyn_cast<ConstantArrayType>(AT1)) {
5405 if (!CAT2 || CAT1->getSize() != CAT2->getSize())
5406 return UnwrappedAny;
5407 }
else if (!isa<IncompleteArrayType>(AT1) ||
5408 !isa<IncompleteArrayType>(AT2)) {
5409 return UnwrappedAny;
5412 T1 = AT1->getElementType();
5413 T2 = AT2->getElementType();
5414 UnwrappedAny =
true;
5435 if (T1PtrType && T2PtrType) {
5443 if (T1MPType && T2MPType &&
5454 if (T1OPType && T2OPType) {
5486 if (Quals1 != Quals2)
5549 llvm_unreachable(
"bad template name kind!");
5557 if (
auto *TTP = dyn_cast<TemplateTemplateParmDecl>(Template))
5558 Template = getCanonicalTemplateTemplateParmDecl(TTP);
5566 llvm_unreachable(
"cannot canonicalize unresolved template");
5570 assert(DTN &&
"Non-dependent template names must refer to template decls.");
5571 return DTN->CanonicalTemplateName;
5591 llvm_unreachable(
"bad template name!");
5640 A != AEnd; (void)++A, ++Idx)
5643 return TemplateArgument(llvm::makeArrayRef(CanonArgs, Arg.
pack_size()));
5648 llvm_unreachable(
"Unhandled template argument kind");
5704 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
5711 if (
const auto *AT = dyn_cast<ArrayType>(T))
5732 if (!ATy || qs.
empty())
5739 if (
const auto *CAT = dyn_cast<ConstantArrayType>(ATy))
5742 CAT->getSizeModifier(),
5743 CAT->getIndexTypeCVRQualifiers()));
5744 if (
const auto *IAT = dyn_cast<IncompleteArrayType>(ATy))
5746 IAT->getSizeModifier(),
5747 IAT->getIndexTypeCVRQualifiers()));
5749 if (
const auto *DSAT = dyn_cast<DependentSizedArrayType>(ATy))
5750 return cast<ArrayType>(
5752 DSAT->getSizeExpr(),
5753 DSAT->getSizeModifier(),
5754 DSAT->getIndexTypeCVRQualifiers(),
5755 DSAT->getBracketsRange()));
5757 const auto *VAT = cast<VariableArrayType>(ATy);
5760 VAT->getSizeModifier(),
5761 VAT->getIndexTypeCVRQualifiers(),
5762 VAT->getBracketsRange()));
5802 assert(PrettyArrayType &&
"Not an array type!");
5839 uint64_t ElementCount = 1;
5841 ElementCount *= CA->
getSize().getZExtValue();
5842 CA = dyn_cast_or_null<ConstantArrayType>(
5845 return ElementCount;
5855 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
5857 case BuiltinType::Half:
return HalfRank;
5858 case BuiltinType::Float:
return FloatRank;
5875 case HalfRank: llvm_unreachable(
"Complex half is not supported");
5892 llvm_unreachable(
"getFloatingRank(): illegal value for rank");
5919 unsigned ASTContext::getIntegerRank(
const Type *T)
const {
5922 switch (cast<BuiltinType>(T)->getKind()) {
5923 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
5924 case BuiltinType::Bool:
5926 case BuiltinType::Char_S:
5927 case BuiltinType::Char_U:
5928 case BuiltinType::SChar:
5929 case BuiltinType::UChar:
5931 case BuiltinType::Short:
5932 case BuiltinType::UShort:
5934 case BuiltinType::Int:
5935 case BuiltinType::UInt:
5937 case BuiltinType::Long:
5938 case BuiltinType::ULong:
5940 case BuiltinType::LongLong:
5941 case BuiltinType::ULongLong:
5943 case BuiltinType::Int128:
5944 case BuiltinType::UInt128:
5992 if (BitWidth < IntSize)
5995 if (BitWidth == IntSize)
6010 assert(!Promotable.
isNull());
6013 return ET->getDecl()->getPromotionType();
6022 if (BT->getKind() == BuiltinType::WChar_S ||
6023 BT->getKind() == BuiltinType::WChar_U ||
6024 BT->getKind() == BuiltinType::Char8 ||
6025 BT->getKind() == BuiltinType::Char16 ||
6026 BT->getKind() == BuiltinType::Char32) {
6027 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
6031 for (
size_t Idx = 0; Idx < llvm::array_lengthof(PromoteTypes); ++Idx) {
6033 if (FromSize < ToSize ||
6034 (FromSize == ToSize &&
6035 FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType()))
6036 return PromoteTypes[Idx];
6038 llvm_unreachable(
"char type should fit into long long");
6045 uint64_t PromotableSize =
getIntWidth(Promotable);
6086 if (
const auto *ET = dyn_cast<EnumType>(LHSC))
6088 if (
const auto *ET = dyn_cast<EnumType>(RHSC))
6091 if (LHSC == RHSC)
return 0;
6096 unsigned LHSRank = getIntegerRank(LHSC);
6097 unsigned RHSRank = getIntegerRank(RHSC);
6099 if (LHSUnsigned == RHSUnsigned) {
6100 if (LHSRank == RHSRank)
return 0;
6101 return LHSRank > RHSRank ? 1 : -1;
6107 if (LHSRank >= RHSRank)
6117 if (RHSRank >= LHSRank)
6127 if (CFConstantStringTypeDecl)
6128 return CFConstantStringTypeDecl;
6130 assert(!CFConstantStringTagDecl &&
6131 "tag and typedef should be initialized together");
6133 CFConstantStringTagDecl->startDefinition();
6171 if (static_cast<unsigned>(CFRuntime) <
6174 Fields[Count++] = {
IntTy,
"flags" };
6176 Fields[Count++] = {
LongTy,
"length" };
6180 Fields[Count++] = { getFromTargetType(
Target->getUInt64Type()),
"_swift_rc" };
6184 Fields[Count++] = {
IntTy,
"_ptr" };
6190 for (
unsigned i = 0; i < Count; ++i) {
6194 Fields[i].Type,
nullptr,
6197 CFConstantStringTagDecl->addDecl(Field);
6200 CFConstantStringTagDecl->completeDefinition();
6204 CFConstantStringTypeDecl =
6207 return CFConstantStringTypeDecl;
6211 if (!CFConstantStringTagDecl)
6213 return CFConstantStringTagDecl;
6222 if (ObjCSuperType.isNull()) {
6224 TUDecl->addDecl(ObjCSuperTypeDecl);
6227 return ObjCSuperType;
6232 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->getDecl());
6235 CFConstantStringTagDecl = TagType->
getDecl();
6239 if (BlockDescriptorType)
6252 static const char *
const FieldNames[] = {
6257 for (
size_t i = 0; i < 2; ++i) {
6260 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
6268 BlockDescriptorType = RD;
6274 if (BlockDescriptorExtendedType)
6289 static const char *
const FieldNames[] = {
6296 for (
size_t i = 0; i < 4; ++i) {
6299 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
6308 BlockDescriptorExtendedType = RD;
6316 if (isa<PipeType>(T))
6322 switch (BT->getKind()) {
6323 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6324 case BuiltinType::Id: \ 6325 return TargetInfo::OCLTK_Image; 6326 #include "clang/Basic/OpenCLImageTypes.def" 6328 case BuiltinType::OCLClkEvent:
6331 case BuiltinType::OCLEvent:
6334 case BuiltinType::OCLQueue:
6337 case BuiltinType::OCLReserveID:
6340 case BuiltinType::OCLSampler:
6359 if (!copyExpr && record->hasTrivialDestructor())
return false;
6387 llvm_unreachable(
"impossible");
6389 llvm_unreachable(
"fell out of lifetime switch!");
6397 bool &HasByrefExtendedLayout)
const {
6402 HasByrefExtendedLayout =
false;
6404 HasByrefExtendedLayout =
true;
6418 if (!ObjCInstanceTypeDecl)
6419 ObjCInstanceTypeDecl =
6421 return ObjCInstanceTypeDecl;
6427 if (
const auto *TT = dyn_cast<TypedefType>(T))
6429 return II->isStr(
"BOOL");
6465 if (
First->isInlineSpecified() || !
First->isStaticDataMember())
6471 if (D->getLexicalDeclContext()->isFileContext() &&
6472 !D->isInlineSpecified() && (D->isConstexpr() ||
First->isConstexpr()))
6508 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
6517 ParmOffset = PtrSize;
6519 QualType PType = PVDecl->getOriginalType();
6520 if (
const auto *AT =
6524 if (!isa<ConstantArrayType>(AT))
6525 PType = PVDecl->getType();
6527 PType = PVDecl->getType();
6554 "getObjCEncodingForFunctionDecl - Incomplete param type");
6562 QualType PType = PVDecl->getOriginalType();
6563 if (
const auto *AT =
6567 if (!isa<ConstantArrayType>(AT))
6568 PType = PVDecl->getType();
6570 PType = PVDecl->getType();
6584 bool Extended)
const {
6588 ObjCEncOptions Options = ObjCEncOptions()
6589 .setExpandPointedToStructures()
6590 .setExpandStructures()
6591 .setIsOutermostType();
6593 Options.setEncodeBlockParameters().setEncodeClassNames();
6594 getObjCEncodingForTypeImpl(T, S, Options,
nullptr);
6600 bool Extended)
const {
6621 "getObjCEncodingForMethodDecl - Incomplete param type");
6629 ParmOffset = 2 * PtrSize;
6634 if (
const auto *AT =
6638 if (!isa<ConstantArrayType>(AT))
6643 PType, S, Extended);
6654 const Decl *Container)
const {
6657 if (
const auto *CID = dyn_cast<ObjCCategoryImplDecl>(Container)) {
6658 for (
auto *PID : CID->property_impls())
6659 if (PID->getPropertyDecl() == PD)
6662 const auto *OID = cast<ObjCImplementationDecl>(Container);
6663 for (
auto *PID : OID->property_impls())
6664 if (PID->getPropertyDecl() == PD)
6697 const Decl *Container)
const {
6699 bool Dynamic =
false;
6707 SynthesizePID = PropertyImpDecl;
6711 std::string S =
"T";
6753 if (SynthesizePID) {
6768 if (isa<TypedefType>(PointeeTy.
getTypePtr())) {
6770 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
6773 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
6786 getObjCEncodingForTypeImpl(T, S,
6788 .setExpandPointedToStructures()
6789 .setExpandStructures()
6790 .setIsOutermostType(),
6791 Field, NotEncodedT);
6795 std::string& S)
const {
6799 getObjCEncodingForTypeImpl(T, S,
6801 .setExpandPointedToStructures()
6802 .setExpandStructures()
6803 .setIsOutermostType()
6804 .setEncodingProperty(),
6812 case BuiltinType::Void:
return 'v';
6813 case BuiltinType::Bool:
return 'B';
6814 case BuiltinType::Char8:
6815 case BuiltinType::Char_U:
6816 case BuiltinType::UChar:
return 'C';
6817 case BuiltinType::Char16:
6818 case BuiltinType::UShort:
return 'S';
6819 case BuiltinType::Char32:
6820 case BuiltinType::UInt:
return 'I';
6821 case BuiltinType::ULong:
6823 case BuiltinType::UInt128:
return 'T';
6824 case BuiltinType::ULongLong:
return 'Q';
6825 case BuiltinType::Char_S:
6826 case BuiltinType::SChar:
return 'c';
6827 case BuiltinType::Short:
return 's';
6828 case BuiltinType::WChar_S:
6829 case BuiltinType::WChar_U:
6830 case BuiltinType::Int:
return 'i';
6831 case BuiltinType::Long:
6833 case BuiltinType::LongLong:
return 'q';
6834 case BuiltinType::Int128:
return 't';
6835 case BuiltinType::Float:
return 'f';
6836 case BuiltinType::Double:
return 'd';
6837 case BuiltinType::LongDouble:
return 'D';
6838 case BuiltinType::NullPtr:
return '*';
6840 case BuiltinType::Float16:
6841 case BuiltinType::Float128:
6842 case BuiltinType::Half:
6843 case BuiltinType::ShortAccum:
6844 case BuiltinType::Accum:
6845 case BuiltinType::LongAccum:
6846 case BuiltinType::UShortAccum:
6847 case BuiltinType::UAccum:
6848 case BuiltinType::ULongAccum:
6849 case BuiltinType::ShortFract:
6850 case BuiltinType::Fract:
6851 case BuiltinType::LongFract:
6852 case BuiltinType::UShortFract:
6853 case BuiltinType::UFract:
6854 case BuiltinType::ULongFract:
6855 case BuiltinType::SatShortAccum:
6856 case BuiltinType::SatAccum:
6857 case BuiltinType::SatLongAccum:
6858 case BuiltinType::SatUShortAccum:
6859 case BuiltinType::SatUAccum:
6860 case BuiltinType::SatULongAccum:
6861 case BuiltinType::SatShortFract:
6862 case BuiltinType::SatFract:
6863 case BuiltinType::SatLongFract:
6864 case BuiltinType::SatUShortFract:
6865 case BuiltinType::SatUFract:
6866 case BuiltinType::SatULongFract:
6870 #define SVE_TYPE(Name, Id, SingletonId) \ 6871 case BuiltinType::Id: 6872 #include "clang/Basic/AArch64SVEACLETypes.def" 6881 case BuiltinType::ObjCId:
6882 case BuiltinType::ObjCClass:
6883 case BuiltinType::ObjCSel:
6884 llvm_unreachable(
"@encoding ObjC primitive type");
6887 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6888 case BuiltinType::Id: 6889 #include "clang/Basic/OpenCLImageTypes.def" 6890 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 6891 case BuiltinType::Id: 6892 #include "clang/Basic/OpenCLExtensionTypes.def" 6893 case BuiltinType::OCLEvent:
6894 case BuiltinType::OCLClkEvent:
6895 case BuiltinType::OCLQueue:
6896 case BuiltinType::OCLReserveID:
6897 case BuiltinType::OCLSampler:
6898 case BuiltinType::Dependent:
6899 #define BUILTIN_TYPE(KIND, ID) 6900 #define PLACEHOLDER_TYPE(KIND, ID) \ 6901 case BuiltinType::KIND: 6902 #include "clang/AST/BuiltinTypes.def" 6903 llvm_unreachable(
"invalid builtin type for @encode");
6905 llvm_unreachable(
"invalid BuiltinType::Kind value");
6922 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
6942 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
6951 S += llvm::utostr(Offset);
6964 void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string &S,
6965 const ObjCEncOptions Options,
6969 switch (CT->getTypeClass()) {
6974 if (
const auto *BT = dyn_cast<BuiltinType>(CT))
6996 case Type::LValueReference:
6997 case Type::RValueReference: {
6999 if (isa<PointerType>(CT)) {
7001 if (PT->isObjCSelType()) {
7010 bool isReadOnly =
false;
7020 }
else if (Options.IsOutermostType()) {
7033 if (StringRef(S).endswith(
"nr"))
7034 S.replace(S.end()-2, S.end(),
"rn");
7046 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
7051 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
7060 ObjCEncOptions NewOptions;
7061 if (Options.ExpandPointedToStructures())
7062 NewOptions.setExpandStructures();
7063 getObjCEncodingForTypeImpl(PointeeTy, S, NewOptions,
7064 nullptr, NotEncodedT);
7068 case Type::ConstantArray:
7069 case Type::IncompleteArray:
7070 case Type::VariableArray: {
7071 const auto *AT = cast<ArrayType>(CT);
7073 if (isa<IncompleteArrayType>(AT) && !Options.IsStructField()) {
7077 getObjCEncodingForTypeImpl(
7078 AT->getElementType(), S,
7079 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD);
7083 if (
const auto *CAT = dyn_cast<ConstantArrayType>(AT))
7084 S += llvm::utostr(CAT->getSize().getZExtValue());
7087 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
7088 "Unknown array type!");
7092 getObjCEncodingForTypeImpl(
7093 AT->getElementType(), S,
7094 Options.keepingOnly(ObjCEncOptions().setExpandStructures()), FD,
7101 case Type::FunctionNoProto:
7102 case Type::FunctionProto:
7106 case Type::Record: {
7107 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
7108 S += RDecl->
isUnion() ?
'(' :
'{';
7112 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
7114 llvm::raw_string_ostream OS(S);
7121 if (Options.ExpandStructures()) {
7124 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
7126 for (
const auto *Field : RDecl->
fields()) {
7129 S += Field->getNameAsString();
7134 if (Field->isBitField()) {
7135 getObjCEncodingForTypeImpl(Field->getType(), S,
7136 ObjCEncOptions().setExpandStructures(),
7141 getObjCEncodingForTypeImpl(
7143 ObjCEncOptions().setExpandStructures().setIsStructField(), FD,
7149 S += RDecl->
isUnion() ?
')' :
'}';
7153 case Type::BlockPointer: {
7156 if (Options.EncodeBlockParameters()) {
7161 getObjCEncodingForTypeImpl(FT->getReturnType(), S,
7162 Options.forComponentType(), FD, NotEncodedT);
7166 if (
const auto *FPT = dyn_cast<FunctionProtoType>(FT)) {
7167 for (
const auto &I : FPT->param_types())
7168 getObjCEncodingForTypeImpl(I, S, Options.forComponentType(), FD,
7176 case Type::ObjCObject: {
7180 S +=
"{objc_object=}";
7184 S +=
"{objc_class=}";
7191 case Type::ObjCInterface: {
7197 if (Options.ExpandStructures()) {
7201 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
7204 getObjCEncodingForTypeImpl(Field->
getType(), S,
7205 ObjCEncOptions().setExpandStructures(),
7208 getObjCEncodingForTypeImpl(Field->
getType(), S,
7209 ObjCEncOptions().setExpandStructures(), FD,
7217 case Type::ObjCObjectPointer: {
7219 if (OPT->isObjCIdType()) {
7224 if (OPT->isObjCClassType() || OPT->isObjCQualifiedClassType()) {
7232 if (OPT->isObjCQualifiedIdType()) {
7233 getObjCEncodingForTypeImpl(
7235 Options.keepingOnly(ObjCEncOptions()
7236 .setExpandPointedToStructures()
7237 .setExpandStructures()),
7239 if (FD || Options.EncodingProperty() || Options.EncodeClassNames()) {
7243 for (
const auto *I : OPT->quals()) {
7245 S += I->getObjCRuntimeNameAsString();
7254 if (OPT->getInterfaceDecl() &&
7255 (FD || Options.EncodingProperty() || Options.EncodeClassNames())) {
7258 for (
const auto *I : OPT->quals()) {
7260 S += I->getObjCRuntimeNameAsString();
7270 case Type::MemberPointer:
7274 case Type::ExtVector:
7283 case Type::DeducedTemplateSpecialization:
7287 #define ABSTRACT_TYPE(KIND, BASE) 7288 #define TYPE(KIND, BASE) 7289 #define DEPENDENT_TYPE(KIND, BASE) \ 7291 #define NON_CANONICAL_TYPE(KIND, BASE) \ 7293 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \ 7295 #include "clang/AST/TypeNodes.inc" 7296 llvm_unreachable(
"@encode for dependent type!");
7298 llvm_unreachable(
"bad type kind!");
7301 void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
7306 assert(RDecl &&
"Expected non-null RecordDecl");
7307 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
7312 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
7316 for (
const auto &BI : CXXRec->bases()) {
7317 if (!BI.isVirtual()) {
7322 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7323 std::make_pair(offs, base));
7329 for (
auto *Field : RDecl->
fields()) {
7331 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7332 std::make_pair(offs, Field));
7336 if (CXXRec && includeVBases) {
7337 for (
const auto &BI : CXXRec->vbases()) {
7343 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
7344 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
7345 std::make_pair(offs, base));
7357 uint64_t CurOffs = 0;
7359 std::multimap<uint64_t, NamedDecl *>::iterator
7360 CurLayObj = FieldOrBaseOffsets.begin();
7362 if (CXXRec && CXXRec->isDynamicClass() &&
7363 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
7366 std::string recname = CXXRec->getNameAsString();
7367 if (recname.empty()) recname =
"?";
7379 uint64_t offs =
toBits(size);
7380 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
7381 std::make_pair(offs,
nullptr));
7384 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
7386 assert(CurOffs <= CurLayObj->first);
7387 if (CurOffs < CurLayObj->first) {
7388 uint64_t padding = CurLayObj->first - CurOffs;
7404 if (
auto *base = dyn_cast<CXXRecordDecl>(dcl)) {
7409 getObjCEncodingForStructureImpl(base, S, FD,
false,
7411 assert(!base->isEmpty());
7416 const auto *field = cast<FieldDecl>(dcl);
7419 S += field->getNameAsString();
7423 if (field->isBitField()) {
7426 CurOffs += field->getBitWidthValue(*
this);
7431 getObjCEncodingForTypeImpl(
7432 qt, S, ObjCEncOptions().setExpandStructures().setIsStructField(),
7443 std::string& S)
const {
7476 if (!ObjCClassDecl) {
7481 return ObjCClassDecl;
7485 if (!ObjCProtocolClassDecl) {
7486 ObjCProtocolClassDecl
7495 return ObjCProtocolClassDecl;
7541 const size_t NumFields = 5;
7543 const char *FieldNames[NumFields];
7547 FieldNames[0] =
"__stack";
7551 FieldNames[1] =
"__gr_top";
7555 FieldNames[2] =
"__vr_top";
7558 FieldTypes[3] = Context->
IntTy;
7559 FieldNames[3] =
"__gr_offs";
7562 FieldTypes[4] = Context->
IntTy;
7563 FieldNames[4] =
"__vr_offs";
7566 for (
unsigned i = 0; i < NumFields; ++i) {
7572 FieldTypes[i],
nullptr,
7577 VaListTagDecl->
addDecl(Field);
7594 const size_t NumFields = 5;
7596 const char *FieldNames[NumFields];
7600 FieldNames[0] =
"gpr";
7604 FieldNames[1] =
"fpr";
7608 FieldNames[2] =
"reserved";
7612 FieldNames[3] =
"overflow_arg_area";
7616 FieldNames[4] =
"reg_save_area";
7619 for (
unsigned i = 0; i < NumFields; ++i) {
7624 FieldTypes[i],
nullptr,
7629 VaListTagDecl->
addDecl(Field);
7657 const size_t NumFields = 4;
7659 const char *FieldNames[NumFields];
7663 FieldNames[0] =
"gp_offset";
7667 FieldNames[1] =
"fp_offset";
7671 FieldNames[2] =
"overflow_arg_area";
7675 FieldNames[3] =
"reg_save_area";
7678 for (
unsigned i = 0; i < NumFields; ++i) {
7684 FieldTypes[i],
nullptr,
7689 VaListTagDecl->
addDecl(Field);
7760 const size_t NumFields = 4;
7762 const char *FieldNames[NumFields];
7765 FieldTypes[0] = Context->
LongTy;
7766 FieldNames[0] =
"__gpr";
7769 FieldTypes[1] = Context->
LongTy;
7770 FieldNames[1] =
"__fpr";
7774 FieldNames[2] =
"__overflow_arg_area";
7778 FieldNames[3] =
"__reg_save_area";
7781 for (
unsigned i = 0; i < NumFields; ++i) {
7787 FieldTypes[i],
nullptr,
7792 VaListTagDecl->
addDecl(Field);
7829 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
7833 if (!BuiltinVaListDecl) {
7835 assert(BuiltinVaListDecl->isImplicit());
7838 return BuiltinVaListDecl;
7851 if (!BuiltinMSVaListDecl)
7854 return BuiltinMSVaListDecl;
7862 assert(ObjCConstantStringType.isNull() &&
7863 "'NSConstantString' type already set!");
7873 unsigned size = End -
Begin;
7874 assert(size > 1 &&
"set is not overloaded!");
7883 assert(isa<FunctionTemplateDecl>(D) ||
7884 isa<UnresolvedUsingValueDecl>(D) ||
7885 (isa<UsingShadowDecl>(D) &&
7904 bool TemplateKeyword,
7906 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
7909 llvm::FoldingSetNodeID
ID;
7912 void *InsertPos =
nullptr;
7914 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7918 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
7930 "Nested name specifier must be dependent");
7932 llvm::FoldingSetNodeID
ID;
7935 void *InsertPos =
nullptr;
7937 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7943 if (CanonNNS == NNS) {
7951 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7952 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
7956 DependentTemplateNames.InsertNode(QTN, InsertPos);
7966 "Nested name specifier must be dependent");
7968 llvm::FoldingSetNodeID
ID;
7971 void *InsertPos =
nullptr;
7973 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7979 if (CanonNNS == NNS) {
7988 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7989 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
7993 DependentTemplateNames.InsertNode(QTN, InsertPos);
8000 llvm::FoldingSetNodeID
ID;
8003 void *insertPos =
nullptr;
8005 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
8009 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
8018 auto &Self =
const_cast<ASTContext &
>(*this);
8019 llvm::FoldingSetNodeID
ID;
8022 void *InsertPos =
nullptr;
8024 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
8030 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
8054 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
8084 while (
const auto *AT = dyn_cast<ArrayType>(CT))
8085 CT = AT->getElementType();
8107 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
8108 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
8132 if (
Attr->getAttrKind() == attr::ObjCOwnership)
8135 Ty =
Attr->getModifiedType();
8139 Ty =
Paren->getInnerType();
8171 for (
auto *lhsProto : lhs->
quals()) {
8173 for (
auto *rhsProto : rhs->
quals()) {
8204 for (
auto *I : lhs->
quals()) {
8208 if (!rhsID->ClassImplementsProtocol(I,
true))
8216 for (
auto *lhsProto : lhs->
quals()) {
8222 for (
auto *rhsProto : rhs->
quals()) {
8232 for (
auto *I : lhs->
quals()) {
8236 if (rhsID->ClassImplementsProtocol(I,
true)) {
8253 for (
auto *lhsProto : lhs->
quals()) {
8261 for (
auto *rhsProto : rhs->
quals()) {
8275 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSInheritedProtocols;
8280 if (LHSInheritedProtocols.empty() && lhs->
qual_empty())
8282 for (
auto *lhsProto : LHSInheritedProtocols) {
8284 for (
auto *rhsProto : rhs->
quals()) {
8314 auto finish = [&](
bool succeeded) ->
bool {
8359 bool BlockReturnType) {
8363 auto finish = [&](
bool succeeded) ->
bool {
8389 (BlockReturnType ? LHSOPT : RHSOPT),
8390 (BlockReturnType ? RHSOPT : LHSOPT),
false));
8397 return finish(BlockReturnType);
8399 return finish(!BlockReturnType);
8411 return (*lhs)->getName().compare((*rhs)->getName());
8428 assert(LHS->
getInterface() &&
"LHS must have an interface base");
8429 assert(RHS->
getInterface() &&
"RHS must have an interface base");
8432 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSProtocolSet;
8435 for (
auto proto : LHS->
quals()) {
8443 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> RHSProtocolSet;
8446 for (
auto proto : RHS->
quals()) {
8454 for (
auto proto : LHSProtocolSet) {
8455 if (RHSProtocolSet.count(proto))
8456 IntersectionSet.push_back(proto);
8461 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ImpliedProtocols;
8465 if (!ImpliedProtocols.empty()) {
8466 IntersectionSet.erase(
8467 std::remove_if(IntersectionSet.begin(),
8468 IntersectionSet.end(),
8470 return ImpliedProtocols.count(proto) > 0;
8472 IntersectionSet.end());
8476 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
8486 if (lhsOPT && rhsOPT)
8492 if (lhsBlock && rhsBlock)
8497 if ((lhsOPT && lhsOPT->isObjCIdType() && rhsBlock) ||
8510 if (lhsArgs.size() != rhsArgs.size())
8514 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
8521 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
8522 rhsArgs[i].stripObjCKindOfType(ctx))) {
8550 if (!LDecl || !RDecl)
8560 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
8570 bool anyChanges =
false;
8588 if (!Protocols.empty())
8606 if (LHSSuperType.
isNull())
8616 if (KnownLHS != LHSAncestors.end()) {
8617 LHS = KnownLHS->second;
8621 bool anyChanges =
false;
8639 if (!Protocols.empty())
8656 if (RHSSuperType.
isNull())
8667 assert(LHS->
getInterface() &&
"LHS is not an interface type");
8668 assert(RHS->
getInterface() &&
"RHS is not an interface type");
8685 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> SuperClassInheritedProtocols;
8689 for (
auto *RHSPI : RHS->
quals())
8692 if (SuperClassInheritedProtocols.empty())
8695 for (
const auto *LHSProto : LHS->
quals()) {
8696 bool SuperImplementsProtocol =
false;
8697 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
8698 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
8699 SuperImplementsProtocol =
true;
8702 if (!SuperImplementsProtocol)
8732 if (!LHSOPT || !RHSOPT)
8750 bool CompareUnqualified) {
8769 bool OfBlockPointer,
8773 if (UD->
hasAttr<TransparentUnionAttr>()) {
8774 for (
const auto *I : UD->
fields()) {
8775 QualType ET = I->getType().getUnqualifiedType();
8789 bool OfBlockPointer,
8804 return mergeTypes(lhs, rhs, OfBlockPointer, Unqualified);
8808 bool OfBlockPointer,
8814 bool allLTypes =
true;
8815 bool allRTypes =
true;
8819 if (OfBlockPointer) {
8821 QualType LHS = lbase->getReturnType();
8822 bool UnqualifiedResult = Unqualified;
8823 if (!UnqualifiedResult)
8825 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
8882 if (lproto && rproto) {
8883 assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
8884 "C++ shouldn't be here");
8886 if (lproto->getNumParams() != rproto->getNumParams())
8890 if (lproto->isVariadic() != rproto->isVariadic())
8893 if (lproto->getMethodQuals() != rproto->getMethodQuals())
8897 bool canUseLeft, canUseRight;
8909 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
8910 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
8911 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
8913 lParamType, rParamType, OfBlockPointer, Unqualified);
8920 types.push_back(paramType);
8932 if (allLTypes)
return lhs;
8933 if (allRTypes)
return rhs;
8938 newParamInfos.empty() ? nullptr : newParamInfos.data();
8942 if (lproto) allRTypes =
false;
8943 if (rproto) allLTypes =
false;
8955 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
8961 paramTy = Enum->getDecl()->getIntegerType();
8971 if (allLTypes)
return lhs;
8972 if (allRTypes)
return rhs;
8979 if (allLTypes)
return lhs;
8980 if (allRTypes)
return rhs;
8986 QualType other,
bool isBlockReturnType) {
8992 if (underlyingType.
isNull())
9007 bool OfBlockPointer,
9008 bool Unqualified,
bool BlockReturnType) {
9026 if (LHSCan == RHSCan)
9031 Qualifiers RQuals = RHSCan.getLocalQualifiers();
9032 if (LQuals != RQuals) {
9048 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
9069 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
9070 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
9073 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
9074 LHSClass = Type::ConstantArray;
9075 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
9076 RHSClass = Type::ConstantArray;
9079 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
9080 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
9083 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
9084 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
9087 if (LHSClass != RHSClass) {
9097 if (OfBlockPointer && !BlockReturnType) {
9109 #define TYPE(Class, Base) 9110 #define ABSTRACT_TYPE(Class, Base) 9111 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: 9112 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 9113 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 9114 #include "clang/AST/TypeNodes.inc" 9115 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
9118 case Type::DeducedTemplateSpecialization:
9119 case Type::LValueReference:
9120 case Type::RValueReference:
9121 case Type::MemberPointer:
9122 llvm_unreachable(
"C++ should never be in mergeTypes");
9124 case Type::ObjCInterface:
9125 case Type::IncompleteArray:
9126 case Type::VariableArray:
9127 case Type::FunctionProto:
9128 case Type::ExtVector:
9129 llvm_unreachable(
"Types are eliminated above");
9150 case Type::BlockPointer:
9175 if (ResultType.isNull())
9202 case Type::ConstantArray:
9228 -> std::pair<bool,llvm::APInt> {
9233 return std::make_pair(
true, TheInt);
9235 return std::make_pair(
false, TheInt);
9237 return std::make_pair(
true, CAT->getSize());
9243 bool HaveLSize, HaveRSize;
9245 std::tie(HaveLSize, LSize) = SizeFetch(LVAT, LCAT);
9246 std::tie(HaveRSize, RSize) = SizeFetch(RVAT, RCAT);
9247 if (HaveLSize && HaveRSize && !llvm::APInt::isSameValue(LSize, RSize))
9284 case Type::FunctionNoProto:
9301 case Type::ObjCObject: {
9310 case Type::ObjCObjectPointer:
9311 if (OfBlockPointer) {
9323 assert(LHS != RHS &&
9324 "Equivalent pipe types should have already been handled!");
9328 llvm_unreachable(
"Invalid Type::Class!");
9333 bool &CanUseFirst,
bool &CanUseSecond,
9335 assert(NewParamInfos.empty() &&
"param info list not empty");
9336 CanUseFirst = CanUseSecond =
true;
9342 if (!FirstHasInfo && !SecondHasInfo)
9345 bool NeedParamInfo =
false;
9349 for (
size_t I = 0; I < E; ++I) {
9360 bool FirstNoEscape = FirstParam.
isNoEscape();
9361 bool SecondNoEscape = SecondParam.
isNoEscape();
9362 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
9364 if (NewParamInfos.back().getOpaqueValue())
9365 NeedParamInfo =
true;
9366 if (FirstNoEscape != IsNoEscape)
9367 CanUseFirst =
false;
9368 if (SecondNoEscape != IsNoEscape)
9369 CanUseSecond =
false;
9373 NewParamInfos.clear();
9379 ObjCLayouts[CD] =
nullptr;
9389 if (LHSCan == RHSCan)
9391 if (RHSCan->isFunctionType()) {
9395 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
9397 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
9400 if (ResReturnType.
isNull())
9402 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
9406 if (
const auto *FPT = cast<FunctionProtoType>(F)) {
9419 Qualifiers RQuals = RHSCan.getLocalQualifiers();
9420 if (LQuals != RQuals) {
9433 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
9449 if (ResQT == LHSBaseQT)
9451 if (ResQT == RHSBaseQT)
9463 T = ET->getDecl()->getIntegerType();
9477 VTy->getNumElements(), VTy->getVectorKind());
9481 T = ETy->getDecl()->getIntegerType();
9484 case BuiltinType::Char_S:
9485 case BuiltinType::SChar:
9487 case BuiltinType::Short:
9489 case BuiltinType::Int:
9491 case BuiltinType::Long:
9493 case BuiltinType::LongLong:
9495 case BuiltinType::Int128:
9498 case BuiltinType::ShortAccum:
9500 case BuiltinType::Accum:
9502 case BuiltinType::LongAccum:
9504 case BuiltinType::SatShortAccum:
9506 case BuiltinType::SatAccum:
9508 case BuiltinType::SatLongAccum:
9510 case BuiltinType::ShortFract:
9512 case BuiltinType::Fract:
9514 case BuiltinType::LongFract:
9516 case BuiltinType::SatShortFract:
9518 case BuiltinType::SatFract:
9520 case BuiltinType::SatLongFract:
9523 llvm_unreachable(
"Unexpected signed integer or fixed point type");
9547 bool AllowTypeModifiers) {
9550 bool Signed =
false, Unsigned =
false;
9551 RequiresICE =
false;
9556 bool IsSpecial =
false;
9560 default: Done =
true; --Str;
break;
9565 assert(!Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
9566 assert(!Signed &&
"Can't use 'S' modifier multiple times!");
9570 assert(!Signed &&
"Can't use both 'S' and 'U' modifiers!");
9571 assert(!Unsigned &&
"Can't use 'U' modifier multiple times!");
9575 assert(!IsSpecial &&
"Can't use 'L' with 'W', 'N', 'Z' or 'O' modifiers");
9576 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
9581 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
9582 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
9591 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
9592 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
9598 llvm_unreachable(
"Unexpected integer type");
9609 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
9610 assert(HowLong == 0 &&
"Can't use both 'L' and 'Z' modifiers!");
9616 llvm_unreachable(
"Unexpected integer type");
9629 assert(!IsSpecial &&
"Can't use two 'N', 'W', 'Z' or 'O' modifiers!");
9630 assert(HowLong == 0 &&
"Can't use both 'L' and 'O' modifiers!");
9646 default: llvm_unreachable(
"Unknown builtin type letter!");
9648 assert(HowLong == 0 && !Signed && !Unsigned &&
9649 "Bad modifiers used with 'v'!");
9653 assert(HowLong == 0 && !Signed && !Unsigned &&
9654 "Bad modifiers used with 'h'!");
9658 assert(HowLong == 0 && !Signed && !Unsigned &&
9659 "Bad modifiers used with 'f'!");
9663 assert(HowLong < 3 && !Signed && !Unsigned &&
9664 "Bad modifiers used with 'd'!");
9667 else if (HowLong == 2)
9673 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
9682 else if (HowLong == 2)
9684 else if (HowLong == 1)
9690 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
9699 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'b'!");
9703 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'z'!");
9707 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'w'!");
9724 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9736 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9744 unsigned NumElements = strtoul(Str, &End, 10);
9745 assert(End != Str &&
"Missing vector size");
9749 RequiresICE,
false);
9750 assert(!RequiresICE &&
"Can't require vector ICE");
9760 unsigned NumElements = strtoul(Str, &End, 10);
9761 assert(End != Str &&
"Missing vector size");
9773 assert(!RequiresICE &&
"Can't require complex ICE");
9799 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'K'!");
9813 Done = !AllowTypeModifiers;
9815 switch (
char c = *Str++) {
9816 default: Done =
true; --Str;
break;
9822 unsigned AddrSpace = strtoul(Str, &End, 10);
9850 "Integer constant 'I' type must be an integer");
9858 unsigned *IntegerConstantArgs)
const {
9860 if (TypeStr[0] ==
'\0') {
9867 bool RequiresICE =
false;
9874 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
9876 while (TypeStr[0] && TypeStr[0] !=
'.') {
9883 if (RequiresICE && IntegerConstantArgs)
9884 *IntegerConstantArgs |= 1 << ArgTypes.size();
9890 ArgTypes.push_back(Ty);
9893 if (Id == Builtin::BI__GetExceptionInfo)
9896 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
9897 "'.' should only occur at end of builtin type list!");
9899 bool Variadic = (TypeStr[0] ==
'.');
9902 Variadic,
false,
true));
9907 if (ArgTypes.empty() && Variadic && !
getLangOpts().CPlusPlus)
9927 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD))
9928 if (!MD->isUserProvided())
9960 !FD->
hasAttr<DLLExportAttr>()) ||
9961 FD->
hasAttr<GNUInlineAttr>()) {
9986 if (D->
hasAttr<DLLImportAttr>()) {
9989 }
else if (D->
hasAttr<DLLExportAttr>()) {
9993 D->
hasAttr<CUDAGlobalAttr>()) {
10040 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
10045 if (!LexicalContext)
10050 auto StaticLocalLinkage =
10062 return StaticLocalLinkage;
10089 return StrongLinkage;
10107 llvm_unreachable(
"Invalid Linkage!");
10117 if (
const auto *VD = dyn_cast<VarDecl>(D)) {
10118 if (!VD->isFileVarDecl())
10123 if (VD->getDescribedVarTemplate() ||
10124 isa<VarTemplatePartialSpecializationDecl>(VD))
10126 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
10130 }
else if (isa<PragmaCommentDecl>(D))
10132 else if (isa<PragmaDetectMismatchDecl>(D))
10134 else if (isa<OMPThreadPrivateDecl>(D))
10136 else if (isa<OMPAllocateDecl>(D))
10138 else if (isa<OMPDeclareReductionDecl>(D) || isa<OMPDeclareMapperDecl>(D))
10140 else if (isa<ImportDecl>(D))
10145 if (D->
isFromASTFile() && !LangOpts.BuildingPCHWithObjectFile) {
10159 bool IsExpInstDef =
10160 isa<FunctionDecl>(D) &&
10161 cast<FunctionDecl>(D)->getTemplateSpecializationKind() ==
10168 isa<CXXMethodDecl>(D) &&
10169 cast<CXXMethodDecl>(D)->getParent()->getTemplateSpecializationKind() ==
10181 if (D->
hasAttr<WeakRefAttr>())
10188 if (
const auto *FD = dyn_cast<FunctionDecl>(D)) {
10190 if (!FD->doesThisDeclarationHaveABody())
10191 return FD->doesDeclarationForceExternallyVisibleDefinition();
10194 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
10199 if (
getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {
10200 if (
const auto *MD = dyn_cast<CXXMethodDecl>(FD)) {
10218 const auto *VD = cast<VarDecl>(D);
10219 assert(VD->isFileVarDecl() &&
"Expected file scoped var");
10223 if (LangOpts.OpenMP &&
10224 OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration(VD))
10241 if (VD->needsDestruction(*
this))
10245 if (VD->getInit() && VD->getInit()->HasSideEffects(*
this) &&
10247 (VD->getInit()->isValueDependent() || !VD->evaluateValue()))
10252 if (
const auto *DD = dyn_cast<DecompositionDecl>(VD))
10253 for (
const auto *BD : DD->bindings())
10254 if (
const auto *BindingVD = BD->getHoldingVar())
10263 llvm::function_ref<
void(
FunctionDecl *)> Pred)
const {
10264 assert(FD->
isMultiVersion() &&
"Only valid for multiversioned functions");
10265 llvm::SmallDenseSet<const FunctionDecl*, 4> SeenDecls;
10267 for (
auto *CurDecl :
10271 std::end(SeenDecls) == llvm::find(SeenDecls, CurFD)) {
10272 SeenDecls.insert(CurFD);
10280 bool IsBuiltin)
const {
10283 return ABI->getDefaultMethodCallConv(IsVariadic);
10288 switch (LangOpts.getDefaultCallingConv()) {
10313 return Target->getDefaultCallingConv();
10318 return ABI->isNearlyEmpty(RD);
10322 if (!VTContext.get()) {
10323 if (
Target->getCXXABI().isMicrosoft())
10328 return VTContext.get();
10348 llvm_unreachable(
"Unsupported ABI");
10354 return ASTRecordLayouts.getMemorySize() +
10355 llvm::capacity_in_bytes(ObjCLayouts) +
10356 llvm::capacity_in_bytes(KeyFunctions) +
10357 llvm::capacity_in_bytes(ObjCImpls) +
10358 llvm::capacity_in_bytes(BlockVarCopyInits) +
10359 llvm::capacity_in_bytes(DeclAttrs) +
10360 llvm::capacity_in_bytes(TemplateOrInstantiation) +
10361 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
10362 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
10363 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
10364 llvm::capacity_in_bytes(OverriddenMethods) +
10365 llvm::capacity_in_bytes(Types) +
10366 llvm::capacity_in_bytes(VariableArrayTypes);
10374 unsigned Signed)
const {
10377 if (!QualTy && DestWidth == 128)
10400 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
10405 MangleNumbers[ND] = Number;
10409 auto I = MangleNumbers.find(ND);
10410 return I != MangleNumbers.end() ? I->second : 1;
10415 StaticLocalNumbers[VD] = Number;
10419 auto I = StaticLocalNumbers.find(VD);
10420 return I != StaticLocalNumbers.end() ? I->second : 1;
10425 assert(LangOpts.CPlusPlus);
10426 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
10434 assert(LangOpts.CPlusPlus);
10435 std::unique_ptr<MangleNumberingContext> &MCtx =
10436 ExtraMangleNumberingContexts[D];
10442 std::unique_ptr<MangleNumberingContext>
10444 return ABI->createMangleNumberingContext();
10449 return ABI->getCopyConstructorForExceptionObject(
10455 return ABI->addCopyConstructorForExceptionObject(
10462 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
10467 return ABI->getTypedefNameForUnnamedTagDecl(TD);
10472 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
10476 return ABI->getDeclaratorForUnnamedTagDecl(TD);
10480 ParamIndices[D] = index;
10484 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
10485 assert(I != ParamIndices.end() &&
10486 "ParmIndices lacks entry set by ParmVarDecl");
10491 unsigned Length)
const {
10517 if (!T.isOSDarwin())
10520 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
10521 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
10530 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
10535 template <
typename T>
10562 : Map(Map), Context(Context) {}
10569 bool shouldVisitTemplateInstantiations()
const {
return true; }
10571 bool shouldVisitImplicitCode()
const {
return true; }
10573 template <
typename T,
typename MapNodeTy,
typename BaseTraverseFn,
10575 bool TraverseNode(T
Node, MapNodeTy MapNode, BaseTraverseFn BaseTraverse,
10579 if (ParentStack.size() > 0) {
10590 auto &NodeOrVector = (*Parents)[MapNode];
10591 if (NodeOrVector.isNull()) {
10592 if (
const auto *D = ParentStack.back().get<Decl>())
10594 else if (
const auto *S = ParentStack.back().get<
Stmt>())
10599 if (!NodeOrVector.template is<ParentVector *>()) {
10601 1, getSingleDynTypedNodeFromParentMap(NodeOrVector));
10602 delete NodeOrVector
10604 NodeOrVector = Vector;
10607 auto *Vector = NodeOrVector.template get<ParentVector *>();
10613 std::find(Vector->begin(), Vector->end(),
10614 ParentStack.back()) != Vector->end();
10616 Vector->push_back(ParentStack.back());
10620 bool Result = BaseTraverse();
10621 ParentStack.pop_back();
10625 bool TraverseDecl(Decl *DeclNode) {
10626 return TraverseNode(
10627 DeclNode, DeclNode, [&] {
return VisitorBase::TraverseDecl(DeclNode); },
10628 &Map.PointerParents);
10631 bool TraverseStmt(
Stmt *StmtNode) {
10632 Stmt *FilteredNode = StmtNode;
10633 if (
auto *ExprNode = dyn_cast_or_null<Expr>(FilteredNode))
10635 return TraverseNode(FilteredNode, FilteredNode,
10636 [&] {
return VisitorBase::TraverseStmt(FilteredNode); },
10637 &Map.PointerParents);
10640 bool TraverseTypeLoc(
TypeLoc TypeLocNode) {
10641 return TraverseNode(
10643 [&] {
return VisitorBase::TraverseTypeLoc(TypeLocNode); },
10644 &Map.OtherParents);
10648 return TraverseNode(
10650 [&] {
return VisitorBase::TraverseNestedNameSpecifierLoc(NNSLocNode); },
10651 &Map.OtherParents);
10665 std::unique_ptr<ParentMap> &
P = Parents[
Traversal];
10669 P = std::make_unique<ParentMap>(*this);
10670 return P->getParents(Node);
10677 if (MethodDecl->
hasAttr<UnavailableAttr>()
10678 || MethodDecl->
hasAttr<DeprecatedAttr>())
10692 IM != EM && IF != EF; ++IM, ++IF) {
10718 return (*AddrSpaceMap)[(unsigned)AS];
10728 llvm_unreachable(
"Not a fixed point type!");
10729 case BuiltinType::ShortAccum:
10731 case BuiltinType::Accum:
10733 case BuiltinType::LongAccum:
10735 case BuiltinType::UShortAccum:
10737 case BuiltinType::UAccum:
10739 case BuiltinType::ULongAccum:
10741 case BuiltinType::ShortFract:
10743 case BuiltinType::Fract:
10745 case BuiltinType::LongFract:
10747 case BuiltinType::UShortFract:
10749 case BuiltinType::UFract:
10751 case BuiltinType::ULongFract:
10757 if (LangOpts.OpenCL)
10781 llvm_unreachable(
"Not a fixed point type!");
10782 case BuiltinType::ShortAccum:
10783 case BuiltinType::SatShortAccum:
10784 return Target.getShortAccumScale();
10785 case BuiltinType::Accum:
10786 case BuiltinType::SatAccum:
10787 return Target.getAccumScale();
10788 case BuiltinType::LongAccum:
10789 case BuiltinType::SatLongAccum:
10790 return Target.getLongAccumScale();
10791 case BuiltinType::UShortAccum:
10792 case BuiltinType::SatUShortAccum:
10793 return Target.getUnsignedShortAccumScale();
10794 case BuiltinType::UAccum:
10795 case BuiltinType::SatUAccum:
10796 return Target.getUnsignedAccumScale();
10797 case BuiltinType::ULongAccum:
10798 case BuiltinType::SatULongAccum:
10799 return Target.getUnsignedLongAccumScale();
10800 case BuiltinType::ShortFract:
10801 case BuiltinType::SatShortFract:
10802 return Target.getShortFractScale();
10803 case BuiltinType::Fract:
10804 case BuiltinType::SatFract:
10805 return Target.getFractScale();
10806 case BuiltinType::LongFract:
10807 case BuiltinType::SatLongFract:
10808 return Target.getLongFractScale();
10809 case BuiltinType::UShortFract:
10810 case BuiltinType::SatUShortFract:
10811 return Target.getUnsignedShortFractScale();
10812 case BuiltinType::UFract:
10813 case BuiltinType::SatUFract:
10814 return Target.getUnsignedFractScale();
10815 case BuiltinType::ULongFract:
10816 case BuiltinType::SatULongFract:
10817 return Target.getUnsignedLongFractScale();
10827 llvm_unreachable(
"Not a fixed point type!");
10828 case BuiltinType::ShortAccum:
10829 case BuiltinType::SatShortAccum:
10830 return Target.getShortAccumIBits();
10831 case BuiltinType::Accum:
10832 case BuiltinType::SatAccum:
10833 return Target.getAccumIBits();
10834 case BuiltinType::LongAccum:
10835 case BuiltinType::SatLongAccum:
10836 return Target.getLongAccumIBits();
10837 case BuiltinType::UShortAccum:
10838 case BuiltinType::SatUShortAccum:
10839 return Target.getUnsignedShortAccumIBits();
10840 case BuiltinType::UAccum:
10841 case BuiltinType::SatUAccum:
10842 return Target.getUnsignedAccumIBits();
10843 case BuiltinType::ULongAccum:
10844 case BuiltinType::SatULongAccum:
10845 return Target.getUnsignedLongAccumIBits();
10846 case BuiltinType::ShortFract:
10847 case BuiltinType::SatShortFract:
10848 case BuiltinType::Fract:
10849 case BuiltinType::SatFract:
10850 case BuiltinType::LongFract:
10851 case BuiltinType::SatLongFract:
10852 case BuiltinType::UShortFract:
10853 case BuiltinType::SatUShortFract:
10854 case BuiltinType::UFract:
10855 case BuiltinType::SatUFract:
10856 case BuiltinType::ULongFract:
10857 case BuiltinType::SatULongFract:
10864 "Can only get the fixed point semantics for a " 10865 "fixed point or integer type.");
10889 "Expected unsigned fixed point type");
10892 case BuiltinType::UShortAccum:
10894 case BuiltinType::UAccum:
10896 case BuiltinType::ULongAccum:
10898 case BuiltinType::SatUShortAccum:
10900 case BuiltinType::SatUAccum:
10902 case BuiltinType::SatULongAccum:
10904 case BuiltinType::UShortFract:
10906 case BuiltinType::UFract:
10908 case BuiltinType::ULongFract:
10910 case BuiltinType::SatUShortFract:
10912 case BuiltinType::SatUFract:
10914 case BuiltinType::SatULongFract:
10917 llvm_unreachable(
"Unexpected unsigned fixed point type");
10923 assert(TD !=
nullptr);
10927 llvm::remove_if(ParsedAttr.
Features,
10928 [&](
const std::string &Feat) {
10929 return !Target->isValidFeatureName(
10930 StringRef{Feat}.substr(1));
10942 Target->getTargetOpts().CPU,
10943 Target->getTargetOpts().Features);
10950 StringRef TargetCPU =
Target->getTargetOpts().CPU;
10952 if (
const auto *TD = FD->
getAttr<TargetAttr>()) {
10959 Target->getTargetOpts().FeaturesAsWritten.begin(),
10960 Target->getTargetOpts().FeaturesAsWritten.end());
10972 }
else if (
const auto *SD = FD->
getAttr<CPUSpecificAttr>()) {
10974 Target->getCPUSpecificCPUDispatchFeatures(
10976 std::vector<std::string> Features(FeaturesTmp.begin(), FeaturesTmp.end());
10980 Target->getTargetOpts().Features);
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)
std::vector< std::string > Features
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
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint, that is - the constraint expression that is added to the associated constraints of the enclosing declaration in practice.
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 ...
llvm::DenseMap< const Decl *, const Decl * > RedeclChainComments
Mapping from canonical declaration to the first redeclaration in chain that has a comment attached...
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...
StringRef getName(const PrintingPolicy &Policy) const
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
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
The iOS 64-bit ABI is follows ARM's published 64-bit ABI more closely, but we don't guarantee to foll...
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
bool isBlockPointerType() const
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool getNoCfCheck() const
bool isMemberPointerType() const
bool canBuiltinBeRedeclared(const FunctionDecl *) const
Return whether a declaration to a builtin is allowed to be overloaded/redeclared. ...
unsigned param_size() const
unsigned char getFixedPointScale(QualType Ty) const
MangleContext * createMangleContext(const TargetInfo *T=nullptr)
If T is null pointer, assume the target in ASTContext.
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins)
CanQualType UnsignedLongFractTy
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target...
InlineVariableDefinitionKind
ObjCIvarDecl * getPropertyIvarDecl() const
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
void Profile(llvm::FoldingSetNodeID &ID) const
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
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...
Expr * IgnoreUnlessSpelledInSource()
Skip past any invisble AST nodes which might surround this statement, such as ExprWithCleanups or Imp...
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
Represents a qualified type name for which the type name is dependent.
static TypedefDecl * CreateSystemZBuiltinVaListDecl(const ASTContext *Context)
The template argument is an expression, and we've not resolved it to one of the other forms yet...
void Profile(llvm::FoldingSetNodeID &ID)
bool isRecordType() const
unsigned getTypeAlignIfKnown(QualType T) const
Return the ABI-specified alignment of a type, in bits, or 0 if the type is incomplete and we cannot d...
CanQualType FloatComplexTy
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
RawCommentList Comments
All comments in this translation unit.
const T * get() const
Retrieve the stored node as type T.
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack, bool HasTypeConstraint=false, Optional< unsigned > NumExpanded=None)
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, possibly constrained by a type-constraint.
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.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
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
Expr * getCopyExpr() const
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
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
QualType getCorrespondingSignedFixedPointType(QualType Ty) const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getCorrespondingUnsignedType(QualType T) const
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
void Profile(llvm::FoldingSetNodeID &ID)
Represent a C++ namespace.
unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
DeclarationName getDeclName() const
Get the name of the template.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
void Profile(llvm::FoldingSetNodeID &ID)
virtual void completeDefinition()
Note that the definition of this type is now complete.
bool isZero() const
isZero - Test whether the quantity equals zero.
QualType withConst() const
const TargetInfo & getTargetInfo() const
QualType adjustStringLiteralBaseType(QualType StrLTy) const
A container of type source information.
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
llvm::DenseMap< Stmt *, Stmt * > MapTy
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl *> &Redeclared)
Interoperability with the latest known version of the Swift runtime.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
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.
unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built...
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
A template template parameter that has been substituted for some other template name.
QualType getElementType() const
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
void AddDeallocation(void(*Callback)(void *), void *Data) const
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
interp::Context & getInterpContext()
Returns the clang bytecode interpreter context.
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...
ASTVisitor(ParentMap &Map, ASTContext &Context)
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...
Represents a variable declaration or definition.
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
void removeObjCLifetime()
QualType getReturnType() const
LangAS getLangASFromTargetAS(unsigned TargetAS)
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
RecordDecl * getPreviousDecl()
unsigned getNumParams() const
bool isEnumeralType() const
APFixedPoint getFixedPointMax(QualType Ty) const
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
const T * getAs() const
Member-template getAs<specific type>'.
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration...
Represents an empty template argument, e.g., one that has not been deduced.
Extra information about a function prototype.
Declaration context for names declared as extern "C" in C++.
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context, bool Canonical) const
Produce a unique representation of the given statement.
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...
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...
Holds all information required to evaluate constexpr code in a module.
Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Defines the clang::Expr interface and subclasses for C++ expressions.
QualType getIntegralType() const
Retrieve the type of the integral value.
noexcept(expression), value-dependent
static TypedefDecl * CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context)
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
The collection of all-type qualifiers we support.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
bool UnwrapSimilarTypes(QualType &T1, QualType &T2)
Attempt to unwrap two types that may be similar (C++ [conv.qual]).
static void getIntersectionOfProtocols(ASTContext &Context, const ObjCInterfaceDecl *CommonBase, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, SmallVectorImpl< ObjCProtocolDecl *> &IntersectionSet)
getIntersectionOfProtocols - This routine finds the intersection of set of protocols inherited from t...
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers getQualifiers() const
Retrieve all qualifiers.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Base wrapper for a particular "section" of type source info.
Represents a struct/union/class.
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
RecordDecl * getCFConstantStringTagDecl() const
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement) const
Retrieve a substitution-result type.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
FunctionType::ExtInfo ExtInfo
bool isComplete() const
Returns true if this can be considered a complete type.
One of these records is kept for each identifier that is lexed.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool isObjCQualifiedClass() const
This table allows us to fully hide how we implement multi-keyword caching.
unsigned getRegParm() const
Represents a class type in Objective C.
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
QualType getPointeeType() const
void setManglingNumber(const NamedDecl *ND, unsigned Number)
CXXRecordDecl * getPreviousDecl()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
const ParmVarDecl *const * param_const_iterator
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Will traverse all child nodes.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
Missing a type from <ucontext.h>
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
CanQualType UnsignedFractTy
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
field_range fields() const
static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context, const Decl *D, GVALinkage L)
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
bool isObjCIdType() const
The generic Mips ABI is a modified version of the Itanium ABI.
Represents a member of a struct/union/class.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
static CGCXXABI * createCXXABI(CodeGenModule &CGM)
unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
DynTypedNodeList getParents(const NodeT &Node)
Returns the parents of the given node (within the traversal scope).
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
unsigned getStaticLocalNumber(const VarDecl *VD) const
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
void Profile(llvm::FoldingSetNodeID &ID)
RawComment * getRawCommentForDeclNoCacheImpl(const Decl *D, const SourceLocation RepresentativeLocForDecl, const std::map< unsigned, RawComment *> &CommentsInFile) 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)
bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
qual_iterator qual_begin() const
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache...
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
__DEVICE__ int max(int __a, int __b)
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
static ast_type_traits::DynTypedNode createDynTypedNode(const T &Node)
Template specializations to abstract away from pointers and TypeLocs.
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
CanQualType OCLReserveIDTy
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
TemplateName getReplacement() const
void Profile(llvm::FoldingSetNodeID &ID)
static TypedefDecl * CreateCharPtrNamedVaListDecl(const ASTContext *Context, StringRef Name)
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
QualType getParamTypeForDecl() const
Describes a module or submodule.
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
ArrayRef< ParmVarDecl * > parameters() const
bool getProducesResult() const
QualType mergeObjCGCQualifiers(QualType, QualType)
mergeObjCGCQualifiers - This routine merges ObjC's GC attribute of 'LHS' and 'RHS' attributes and ret...
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
void Profile(llvm::FoldingSetNodeID &ID)
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
An rvalue reference type, per C++11 [dcl.ref].
bool isBitField() const
Determines whether this field is a bitfield.
static APFixedPoint getMin(const FixedPointSemantics &Sema)
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
qual_iterator qual_end() const
A qualified template name, where the qualification is kept to describe the source code as written...
unsigned getAlignOfGlobalVar(QualType T) const
Return the alignment in bits that should be given to a global variable with type T.
static bool unionHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD)
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
const LangASMap & getAddressSpaceMap() const
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
static llvm::Optional< int64_t > structHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD)
ObjCContainerDecl - Represents a container for method declarations.
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
QualType getOriginalType() const
void addObjCGCAttr(GC type)
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
CharUnits - This is an opaque type for sizes expressed in character units.
Microsoft throw(...) extension.
A convenient class for passing around template argument information.
CanQualType SatShortFractTy
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers).
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
bool hasAddressSpace() const
CanQualType SatUnsignedShortAccumTy
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
An unqualified-id that has been assumed to name a function template that will be found by ADL...
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
PropertyAttributeKind getPropertyAttributes() const
unsigned toTargetAddressSpace(LangAS AS)
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
Concrete class used by the front-end to report problems and issues.
Sugar type that represents a type that was qualified by a qualifier written as a macro invocation...
Represents a typeof (or typeof) expression (a GCC extension).
const clang::PrintingPolicy & getPrintingPolicy() const
static char getObjCEncodingForPrimitiveType(const ASTContext *C, const BuiltinType *BT)
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...
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.
void attachCommentsToJustParsedDecls(ArrayRef< Decl *> Decls, const Preprocessor *PP)
Searches existing comments for doc comments that should be attached to Decls.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
Expr * getSizeExpr() const
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
unsigned getBitWidthValue(const ASTContext &Ctx) const
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
Defines the Linkage enumeration and various utility functions.
Represents an Objective-C protocol declaration.
TemplateTemplateParmDecl * getParameter() const
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeTransparentUnionType - if T is a transparent union type and a member of T is compatible with Sub...
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
ASTNodeKind getNodeKind() const
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
void * getAsOpaquePtr() const
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
unsigned getTypeUnadjustedAlign(QualType T) const
Return the ABI-specified natural alignment of a (complete) type T, before alignment adjustments...
Represents an ObjC class declaration.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs, typeofs, etc., as well as any qualifiers.
QualType getReturnType() const
unsigned getBuiltinID(bool ConsiderWrapperFunctions=false) const
Returns a value indicating whether this function corresponds to a builtin function.
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
bool isKindOfType() const
Whether this is a "__kindof" type.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SplitQualType getSplitDesugaredType() const
unsigned getNumArgs() const
The iOS ABI is a partial implementation of the ARM ABI.
IntrusiveRefCntPtr< ExternalASTSource > ExternalSource
CanQualType UnsignedCharTy
Expr * getSizeExpr() const
QualType removePtrSizeAddrSpace(QualType T) const
Remove the existing address space on the type if it is a pointer size address space and return the ty...
bool getNoCallerSavedRegs() const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
bool isUnsignedFixedPointType() const
Return true if this is a fixed point type that is unsigned according to ISO/IEC JTC1 SC22 WG14 N1169...
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod, bool IsBuiltin=false) const
Retrieves the default calling convention for the current target.
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
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.
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl *> protocols) const
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.
ast_type_traits::TraversalKind Traversal
QualType getBaseType() const
Gets the base type of this object type.
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
QualType getCorrespondingSaturatedType(QualType Ty) const
void Profile(llvm::FoldingSetNodeID &ID)
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
Contains information gathered from parsing the contents of TargetAttr.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
The generic ARM ABI is a modified version of the Itanium ABI proposed by ARM for use on ARM-based pla...
bool isDynamicClass() const
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl *> protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
Represents a ValueDecl that came out of a declarator.
unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
A dependent template name that has not been resolved to a template (or set of templates).
DeclarationNameTable DeclarationNames
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type...
bool UnwrapSimilarArrayTypes(QualType &T1, QualType &T2)
Attempt to unwrap two types that may both be array types with the same bound (or both be array types ...
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
void setCFConstantStringType(QualType T)
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
bool isSaturatedFixedPointType() const
Return true if this is a saturated fixed point type according to ISO/IEC JTC1 SC22 WG14 N1169...
CanQualType UnsignedAccumTy
void Profile(llvm::FoldingSetNodeID &ID)
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl *> &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized, ivars in super class and then collects all ivars, including those synthesized for current class.
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
typedef void* __builtin_va_list;
bool hasPointerIdentity() const
Check if the given ASTNodeKind identifies a type that offers pointer identity.
CanQualType UnsignedShortFractTy
Exposes information about the current target.
Represents an array type in C++ whose size is a value-dependent expression.
unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting...
CommentOptions CommentOpts
Options for parsing comments.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
PrimitiveCopyKind isNonTrivialToPrimitiveDestructiveMove() const
Check if this is a non-trivial type that would cause a C struct transitively containing this type to ...
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
QualType getElementType() const
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
ExtParameterInfo withIsNoEscape(bool NoEscape) const
QualType getVectorType(QualType VectorType, unsigned NumElts, VectorType::VectorKind VecKind) const
Return the unique reference to a vector type of the specified element type and size.
Represents a block literal declaration, which is like an unnamed FunctionDecl.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
bool isMultiVersion() const
True if this function is considered a multiversioned function.
This represents one expression.
Defines the clang::LangOptions interface.
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
known_extensions_range known_extensions() const
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
Selector getSetterName() const
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
static const LangASMap * getAddressSpaceMap(const TargetInfo &T, const LangOptions &LOpts)
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
unsigned getAsOpaqueValue() const
void ResetObjCLayout(const ObjCContainerDecl *CD)
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
static std::pair< CharUnits, CharUnits > getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
getConstantArrayInfoInChars - Performing the computation in CharUnits instead of in bits prevents ove...
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) const
Declaration of a template type parameter.
Will not traverse implicit casts and parentheses.
static Expr * canonicalizeImmediatelyDeclaredConstraint(const ASTContext &C, Expr *IDC, QualType ConstrainedType)
llvm::DenseMap< const Decl *, const RawComment * > DeclRawComments
Mapping from declaration to directly attached comment.
Internal representation of canonical, dependent decltype(expr) types.
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
Implements an efficient mapping from strings to IdentifierInfo nodes.
bool getHasRegParm() const
bool isObjCBuiltinType() const
const T * castAs() const
Member-template castAs<specific type>.
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
bool isNearlyEmpty(const CXXRecordDecl *RD) const
bool isObjCRetainableType() const
QualType getTypeOfExprType(Expr *e) const
GCC extension.
void Profile(llvm::FoldingSetNodeID &ID)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
QualType getParenType(QualType NamedType) const
CanQualType OMPArraySectionTy
static TypedefDecl * CreateX86_64ABIBuiltinVaListDecl(const ASTContext *Context)
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
bool hasUniqueObjectRepresentations(QualType Ty) const
Return true if the specified type has unique object representations according to (C++17 [meta...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
static std::string charUnitsToString(const CharUnits &CU)
void Profile(llvm::FoldingSetNodeID &ID)
bool isNullPtrType() const
unsigned getFastQualifiers() const
Ignore AST nodes not written in the source.
bool canBeRedeclared(unsigned ID) const
Returns true if this is a builtin that can be redeclared.
ObjCLifetime getObjCLifetime() const
void removeFastQualifiers(unsigned mask)
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
void setBlockVarCopyInit(const VarDecl *VD, Expr *CopyExpr, bool CanThrow)
Set the copy initialization expression of a block var decl.
bool isObjCClassType() const
void Profile(llvm::FoldingSetNodeID &ID)
DeclContext * getDeclContext()
A structure for storing the information associated with a substituted template template parameter...
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
ObjCInterfaceDecl * getSuperClass() const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
void Profile(llvm::FoldingSetNodeID &ID)
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
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.
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
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.
static SourceLocation getDeclLocForCommentSearch(const Decl *D, SourceManager &SourceMgr)
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
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.
void setAddressSpace(LangAS space)
Represents a folding of a pack over an operator.
bool isObjCUnqualifiedId() const
void setTypeConstraint(NestedNameSpecifierLoc NNS, DeclarationNameInfo NameInfo, NamedDecl *FoundDecl, ConceptDecl *CD, const ASTTemplateArgumentListInfo *ArgsAsWritten, Expr *ImmediatelyDeclaredConstraint)
QualType getRecordType(const RecordDecl *Decl) const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
QualType getFunctionTypeWithExceptionSpec(QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI)
Get a function type and produce the equivalent function type with the specified exception specificati...
bool isInstanceMethod() const
unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
QualType getBlockDescriptorType() const
Gets the struct used to keep track of the descriptor for pointer to blocks.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a GCC generic vector type.
struct CXXOpName CXXOperatorName
static bool CanThrow(Expr *E, ASTContext &Ctx)
An lvalue reference type, per C++11 [dcl.ref].
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
QualType getSubstTemplateTypeParmPackType(const TemplateTypeParmType *Replaced, const TemplateArgument &ArgPack)
Retrieve a.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
CanQualType SatLongAccumTy
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Implements C++ ABI-specific semantic analysis functions.
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it...
Selector getSelector() const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
bool 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 setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
GlobalDecl - represents a global declaration.
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 isConstQualified() const
Determine whether this type is const-qualified.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
RecordDecl * getDecl() const
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.
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
A template template parameter pack that has been substituted for a template template argument pack...
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
There is no lifetime qualification on this type.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to...
std::string getAsString() const
Derive the full selector name (e.g.
is AltiVec 'vector Pixel'
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
SelectorTable & Selectors
Assigning into this object requires the old value to be released and the new value to be retained...
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
QualType getCanonicalType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
not a target-specific vector type
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
ExceptionSpecificationType Type
The kind of exception specification this is.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType, TagDecl *OwnedTagDecl=nullptr) const
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
ExtParameterInfo getExtParameterInfo(unsigned I) const
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ExtProtoInfo getExtProtoInfo() const
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
const ExtParameterInfo * ExtParameterInfos
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
Sugar for parentheses used when specifying types.
StringLiteral * getPredefinedStringLiteralFromCache(StringRef Key) const
Return a string representing the human readable name for the specified function declaration or file n...
QualType getReturnType() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
bool hasSameTemplateName(TemplateName X, TemplateName Y)
Determine whether the given template names refer to the same template.
ParsedTargetAttr filterFunctionTargetAttrs(const TargetAttr *TD) const
Parses the target attributes passed in, and returns only the ones that are valid feature names...
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).
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
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...
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
QualType getElementType() const
const Decl * getDecl() const
static QualType getUnderlyingType(const SubRegion *R)
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
ParsedAttr - Represents a syntactic attribute.
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
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
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. ...
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...
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.
unsigned getCustomDiagID(Level L, const char(&FormatString)[N])
Return an ID for a diagnostic with the specified format string and level.
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
Qualifiers getIndexTypeQualifiers() const
TypeClass getTypeClass() const
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool typesAreBlockPointerCompatible(QualType, QualType)
CharUnits getDataSize() const
getDataSize() - Get the record data size, which is the record size without tail padding, in characters.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
ObjCDeclQualifier getObjCDeclQualifier() const
bool isTargetAddressSpace(LangAS AS)
EnumDecl * getDecl() const
bool isVectorType() const
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
Assigning into this object requires a lifetime extension.
static ConceptSpecializationExpr * Create(const ASTContext &C, NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc, DeclarationNameInfo ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const ASTTemplateArgumentListInfo *ArgsAsWritten, ArrayRef< TemplateArgument > ConvertedArgs, const ConstraintSatisfaction *Satisfaction)
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
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.
void addArgument(const TemplateArgumentLoc &Loc)
bool isPtrSizeAddressSpace(LangAS AS)
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
void Profile(llvm::FoldingSetNodeID &ID)
Defines the fixed point number interface.
CharUnits getUnadjustedAlignment() const
getUnadjustedAlignment - Get the record alignment in characters, before alignment adjustement...
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a pointer type decayed from an array or function type.
void setTraversalScope(const std::vector< Decl *> &)
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
The WebAssembly ABI is a modified version of the Itanium ABI.
The injected class name of a C++ class template or class template partial specialization.
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
Represents a pack expansion of types.
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
static QualType mergeEnumWithInteger(ASTContext &Context, const EnumType *ET, QualType other, bool isBlockReturnType)
Given that we have an enum type and a non-enum type, try to merge them.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
ast_type_traits::DynTypedNode DynTypedNode
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Defines various enumerations that describe declaration and type specifiers.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
void setTemplateKeywordLoc(SourceLocation Loc)
void * Allocate(size_t Size, unsigned Align=8) const
ObjCDeclQualifier getObjCDeclQualifier() const
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
CanQualType UnsignedShortTy
ObjCIvarDecl * getNextIvar()
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Canon=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
bool propertyTypesAreCompatible(QualType, QualType)
Represents a template argument.
static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)
DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the pointer over the consume...
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
QualType withRestrict() const
Represents a template name that was expressed as a qualified name.
TagTypeKind
The kind of a tag type.
bool hasSameFunctionTypeIgnoringPtrSizes(QualType T, QualType U)
Determine whether two function types are the same, ignoring pointer sizes in the return type and para...
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
void setPlaceholderTypeConstraint(Expr *E)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
CanQualType ObjCBuiltinIdTy
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
Dataflow Directional Tag Classes.
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i...
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list...
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
CharUnits getSize() const
getSize - Get the record size in characters.
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type...
A RecursiveASTVisitor that builds a map from nodes to their parents as defined by the RecursiveASTVis...
ExtInfo getExtInfo() const
TargetInfo::OpenCLTypeKind getOpenCLTypeKind(const Type *T) const
Map an AST Type to an OpenCLTypeKind enum value.
not evaluated yet, for special member function
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
A qualifier set is used to build a set of qualifiers.
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false)
bool hasDirectOwnershipQualifier(QualType Ty) const
Return true if the type has been explicitly qualified with ObjC ownership.
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...
static std::string getName(const CallEvent &Call)
const Expr * traverseIgnored(const Expr *E) const
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.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
unsigned[(unsigned) LangAS::FirstTargetAddressSpace] LangASMap
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
static bool areCompatVectorTypes(const VectorType *LHS, const VectorType *RHS)
areCompatVectorTypes - Return true if the two specified vector types are compatible.
QualType getUnderlyingType() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
CanQualType UnsignedLongLongTy
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built...
unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built...
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
bool hasCvrSimilarType(QualType T1, QualType T2)
Determine if two types are similar, ignoring only CVR qualifiers.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
This template specialization was instantiated from a template due to an explicit instantiation declar...
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>.
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
void Profile(llvm::FoldingSetNodeID &ID)
The name of a declaration.
VectorKind getVectorKind() const
Represents the declaration of an Objective-C type parameter.
void cacheRawCommentForDecl(const Decl &OriginalD, const RawComment &Comment) const
Attaches Comment to OriginalD and to its redeclaration chain and removes the redeclaration chain from...
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()'.
The Fuchsia ABI is a modified version of the Itanium ABI.
void Profile(llvm::FoldingSetNodeID &ID)
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
void Profile(llvm::FoldingSetNodeID &ID)
static FixedPointSemantics GetIntegerSemantics(unsigned Width, bool IsSigned)
Return the FixedPointSemantics for an integer type.
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
void Profile(llvm::FoldingSetNodeID &ID)
A pointer to member type per C++ 8.3.3 - Pointers to members.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
isIntegerConstantExpr - Return true if this expression is a valid integer constant expression...
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
virtual ~ASTMutationListener()
This names the __type_pack_element BuiltinTemplateDecl.
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
canAssignObjCInterfacesInBlockPointer - This routine is specifically written for providing type-safet...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool hasObjCLifetime() const
QualType AutoRRefDeductTy
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
A type that was preceded by the 'template' keyword, stored as a Type*.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
void Profile(llvm::FoldingSetNodeID &ID)
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
Expr * IgnoreParenImpCasts() LLVM_READONLY
Skip past any parentheses and implicit casts which might surround this expression until reaching a fi...
bool ObjCQualifiedClassTypesAreCompatible(const ObjCObjectPointerType *LHS, const ObjCObjectPointerType *RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>. ...
GVALinkage GetGVALinkageForVariable(const VarDecl *VD)
A dynamically typed AST node container.
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
Represents a pointer to an Objective C object.
unsigned getMultiVersionIndex() const
CanQualType ObjCBuiltinBoolTy
unsigned getIntWidth(QualType T) const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
Loading virtual member pointers using the virtual inheritance model always results in an adjustment u...
virtual ExtKind hasExternalDefinitions(const Decl *D)
bool isIncompleteArrayType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
BuiltinTemplateDecl * getTypePackElementDecl() const
bool isMacroArgExpansion(SourceLocation Loc, SourceLocation *StartLoc=nullptr) const
Tests whether the given source location represents a macro argument's expansion into the function-lik...
QualType getStringLiteralArrayType(QualType EltTy, unsigned Length) const
Return a type for a constant array for a string literal of the specified element type and length...
bool isObjCQualifiedId() const
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
bool doUnsignedFixedPointTypesHavePadding() const
In the event this target uses the same number of fractional bits for its unsigned types as it does wi...
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
QualType getCanonicalTypeInternal() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
This template specialization was declared or defined by an explicit specialization (C++ [temp...
CanQualType UnsignedLongTy
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
void Profile(llvm::FoldingSetNodeID &ID)
const llvm::APInt & getSize() const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize, QualType typeDomain) const
Return a real floating point or a complex type (based on typeDomain/typeSize).
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
bool isFunctionType() const
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated...
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
bool isObjCQualifiedIdType() const
static char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
TypeSourceInfo * getTypeSourceInfo() const
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required...
ExtVectorType - Extended vector type.
CanQualType ObjCBuiltinClassTy
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
param_const_iterator param_begin() const
Base for LValueReferenceType and RValueReferenceType.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
CanQualType BoundMemberTy
const Expr * getSizeExpr() const
static TypedefDecl * CreateCharPtrBuiltinVaListDecl(const ASTContext *Context)
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
int getFloatingTypeSemanticOrder(QualType LHS, QualType RHS) const
Compare the rank of two floating point types as above, but compare equal if both types have the same ...
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, const Expr *SizeExpr, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
The template argument is a type.
Holds information about the various types of exception specification.
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
void addDecl(Decl *D)
Add the declaration D into this context.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl)
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
The template argument is actually a parameter pack.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
bool isObjCObjectType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
bool hasObjCGCAttr() const
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
DynTypedNodeList getParents(const ast_type_traits::DynTypedNode &Node)
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
A template argument list.
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
BuiltinTemplateDecl * buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, const IdentifierInfo *II) const
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
Reading or writing from this object requires a barrier call.
ExternCContextDecl * getExternCContextDecl() const
bool hasSimilarType(QualType T1, QualType T2)
Determine if two types are similar, according to the C++ rules.
ArgKind getKind() const
Return the kind of stored template argument.
An attributed type is a type to which a type attribute has been applied.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
QualType getParamType(unsigned i) const
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
Represents a type parameter type in Objective C.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
TranslationUnitDecl * getTranslationUnitDecl() const
Defines the clang::SourceLocation class and associated facilities.
void Profile(llvm::FoldingSetNodeID &ID)
Interoperability with the Swift 4.2 runtime.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool hasUnaligned() const
bool mergeExtParameterInfo(const FunctionProtoType *FirstFnType, const FunctionProtoType *SecondFnType, bool &CanUseFirst, bool &CanUseSecond, SmallVectorImpl< FunctionProtoType::ExtParameterInfo > &NewParamInfos)
This function merges the ExtParameterInfo lists of two functions.
void addModuleInitializer(Module *M, Decl *Init)
Add a declaration to the list of declarations that are initialized for a module.
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g., it is an signed integer type or a vector.
Represents a C++ struct/union/class.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
IdentifierInfo * getTypePackElementName() const
Represents a template specialization type whose template cannot be resolved, e.g. ...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
The template argument is a template name that was provided for a template template parameter...
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
Represents a C array with an unspecified size.
VTableContextBase * getVTableContext()
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
Missing a type from <stdio.h>
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
static TranslationUnitDecl * Create(ASTContext &C)
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl *> &Protocols)
IdentifierInfo * getMakeIntegerSeqName() const
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
ObjCIvarDecl - Represents an ObjC instance variable.
static int compare(DeclarationName LHS, DeclarationName RHS)
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
Provides information a specialization of a member of a class template, which may be a member function...
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
A structure for storing the information associated with an overloaded template name.
QualType getMacroQualifiedType(QualType UnderlyingTy, const IdentifierInfo *MacroII) const
Represents the specialization of a concept - evaluates to a prvalue of type bool. ...
A structure for storing the information associated with a name that has been assumed to be a template...
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
getObjCEncodingForMethodParameter - Return the encoded type for a single method parameter or return t...
Builtin::Context & BuiltinInfo
Location information for a TemplateArgument.
Weak definition of inline variable.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a class template.
static bool isAddressSpaceSupersetOf(LangAS A, LangAS B)
Returns true if address space A is equal to or a superset of B.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
void getFunctionFeatureMap(llvm::StringMap< bool > &FeatureMap, const FunctionDecl *) const
virtual LangAS getCUDABuiltinAddressSpace(unsigned AS) const
Map from the address space field in builtin description strings to the language address space...
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type...
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
param_const_iterator sel_param_end() const
__DEVICE__ int min(int __a, int __b)
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
StringLiteral - This represents a string literal expression, e.g.
Defines the clang::TargetInfo interface.
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U)
Determine whether two function types are the same, ignoring exception specifications in cases where t...
unsigned getSimdDefaultAlign() const
Return default simd alignment for the given target.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
static const Decl & adjustDeclToTemplate(const Decl &D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template...
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
void setRAngleLoc(SourceLocation Loc)
unsigned getCVRQualifiers() const
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
SourceLocation getLAngleLoc() const
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated, or computed.
const VariableArrayType * getAsVariableArrayType(QualType T) const
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
static Decl::Kind getKind(const Decl *D)
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
unsigned getNumElements() const
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
static bool NeedsInjectedClassNameType(const RecordDecl *D)
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
QualType getRealTypeForBitwidth(unsigned DestWidth) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
Microsoft __declspec(nothrow) extension.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
QualType getAsType() const
Retrieve the type for a type template argument.
A reference to a declared variable, function, enum, etc.
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
Represents an extended address space qualifier where the input address space value is dependent...
Represents a type template specialization; the template must be a class template, a type alias templa...
ArrayRef< ParmVarDecl * > parameters() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
GVALinkage
A more specific kind of linkage than enum Linkage.
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
bool isPointerType() const
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types ...
void addAddressSpace(LangAS space)
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
llvm::DenseMap< const Decl *, const Decl * > CommentlessRedeclChains
Keeps track of redeclaration chains that don't have any comment attached.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
bool isStaticDataMember() const
Determines whether this is a static data member.
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
A set of overloaded template declarations.
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
A simple holder for a QualType representing a type in an exception specification. ...
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
void setAccess(AccessSpecifier AS)
unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
Represents a C array with a specified size that is not an integer-constant-expression.
void setTemplateNameLoc(SourceLocation Loc)
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
No keyword precedes the qualified type name.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
bool isInline() const
Whether this variable is (C++1z) inline.
void Profile(llvm::FoldingSetNodeID &ID)
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
unsigned getTargetAddressSpace(QualType T) const
Selector getGetterName() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
SourceLocation getRAngleLoc() const
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
QualType getFunctionTypeWithoutPtrSizes(QualType T)
Get a function type and produce the equivalent function type where pointer size address spaces in the...
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()
This file provides AST data structures related to concepts.
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...
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent, bool IsPack=false, ConceptDecl *TypeConstraintConcept=nullptr, ArrayRef< TemplateArgument > TypeConstraintArgs={}) const
C++11 deduced auto type.
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.
Attr - This represents one attribute.
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
A single template declaration.
CanQualType OCLClkEventTy
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
noexcept(expression), evals to 'true'
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth, signed/unsigned.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
CanQualType UnsignedIntTy
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
ComparisonCategories CompCategories
Types and expressions required to build C++2a three-way comparisons using operator<=>, including the values return by builtin <=> operators.