37 #include "llvm/ADT/StringExtras.h"
38 #include "llvm/ADT/Triple.h"
39 #include "llvm/Support/Capacity.h"
40 #include "llvm/Support/MathExtras.h"
41 #include "llvm/Support/raw_ostream.h"
44 using namespace clang;
69 assert(std::is_sorted(RawComments.begin(), RawComments.end(),
83 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
88 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
89 if (VD->isStaticDataMember() &&
100 dyn_cast<ClassTemplateSpecializationDecl>(D)) {
107 if (
const EnumDecl *ED = dyn_cast<EnumDecl>(D)) {
111 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
114 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
118 if (isa<ParmVarDecl>(D))
123 if (isa<TemplateTypeParmDecl>(D) ||
124 isa<NonTypeTemplateParmDecl>(D) ||
125 isa<TemplateTemplateParmDecl>(D))
131 if (RawComments.empty())
141 if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) ||
142 isa<ObjCPropertyDecl>(D) ||
143 isa<RedeclarableTemplateDecl>(D) ||
144 isa<ClassTemplateSpecializationDecl>(D))
149 if (isa<TypedefDecl>(D)) {
154 }
else if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
161 TD->isCompleteDefinition())
183 bool Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
184 if (!Found && RawComments.size() >= 2) {
186 Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
190 Comment = MaybeBeforeDecl + 1;
191 assert(Comment == std::lower_bound(RawComments.begin(), RawComments.end(),
192 &CommentAtDeclLoc, Compare));
195 Comment = std::lower_bound(RawComments.begin(), RawComments.end(),
196 &CommentAtDeclLoc, Compare);
202 std::pair<FileID, unsigned> DeclLocDecomp = SourceMgr.
getDecomposedLoc(DeclLoc);
205 if (Comment != RawComments.end() &&
206 (*Comment)->isDocumentation() && (*Comment)->isTrailingComment() &&
207 (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
208 isa<ObjCMethodDecl>(D) || isa<ObjCPropertyDecl>(D))) {
209 std::pair<FileID, unsigned> CommentBeginDecomp
213 if (DeclLocDecomp.first == CommentBeginDecomp.first &&
214 SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second)
216 CommentBeginDecomp.second)) {
223 if (Comment == RawComments.begin())
228 if (!(*Comment)->isDocumentation() || (*Comment)->isTrailingComment())
232 std::pair<FileID, unsigned> CommentEndDecomp
237 if (DeclLocDecomp.first != CommentEndDecomp.first)
241 bool Invalid =
false;
248 StringRef
Text(Buffer + CommentEndDecomp.second,
249 DeclLocDecomp.second - CommentEndDecomp.second);
253 if (Text.find_first_of(
";{}#@") != StringRef::npos)
263 const Decl *adjustDeclToTemplate(
const Decl *D) {
264 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
284 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
287 if (VD->isStaticDataMember())
301 dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
307 return PU.is<ClassTemplateDecl*>() ?
308 static_cast<const Decl*>(PU.get<ClassTemplateDecl *>()) :
309 static_cast<const Decl*>(
315 CRD->getMemberSpecializationInfo())
316 return Info->getInstantiatedFrom();
320 if (
const EnumDecl *ED = dyn_cast<EnumDecl>(D)) {
334 const Decl **OriginalDecl)
const {
335 D = adjustDeclToTemplate(D);
339 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
353 const Decl *OriginalDeclForRC =
nullptr;
355 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
366 OriginalDeclForRC =
I;
386 *OriginalDecl = OriginalDeclForRC;
406 if (
const ObjCImplDecl *IMD = dyn_cast<ObjCImplDecl>(DC)) {
415 Redeclared.push_back(RedeclaredMethod);
421 const Decl *D)
const {
425 ThisDeclInfo->
fill();
437 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
445 D = adjustDeclToTemplate(D);
448 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
452 if (Canonical != D) {
460 const Decl *OriginalDecl;
464 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
474 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
481 QualType QT = TD->getUnderlyingType();
483 if (
const Decl *TD = TT->getDecl())
488 while (IC->getSuperClass()) {
489 IC = IC->getSuperClass();
499 else if (
const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
500 if (!(RD = RD->getDefinition()))
503 for (
const auto &
I : RD->bases()) {
504 if (
I.isVirtual() || (
I.getAccessSpecifier() !=
AS_public))
510 if (!(NonVirtualBase= NonVirtualBase->getDefinition()))
518 for (
const auto &
I : RD->vbases()) {
525 if (!(VirtualBase= VirtualBase->getDefinition()))
539 if (D != OriginalDecl)
548 ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &
ID,
555 ID.AddInteger(Params->
size());
557 PEnd = Params->
end();
561 ID.AddBoolean(TTP->isParameterPack());
567 ID.AddBoolean(NTTP->isParameterPack());
568 ID.AddPointer(NTTP->getType().getCanonicalType().getAsOpaquePtr());
569 if (NTTP->isExpandedParameterPack()) {
571 ID.AddInteger(NTTP->getNumExpansionTypes());
572 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes();
I != N; ++
I) {
577 ID.AddBoolean(
false);
588 ASTContext::getCanonicalTemplateTemplateParmDecl(
591 llvm::FoldingSetNodeID
ID;
592 CanonicalTemplateTemplateParm::Profile(ID, TTP);
593 void *InsertPos =
nullptr;
594 CanonicalTemplateTemplateParm *Canonical
595 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
597 return Canonical->getParam();
602 CanonParams.reserve(Params->
size());
604 PEnd = Params->
end();
607 CanonParams.push_back(
615 = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
619 if (NTTP->isExpandedParameterPack()) {
622 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes();
I != N; ++
I) {
624 ExpandedTInfos.push_back(
632 NTTP->getPosition(),
nullptr,
642 NTTP->getPosition(),
nullptr,
644 NTTP->isParameterPack(),
647 CanonParams.push_back(Param);
650 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
651 cast<TemplateTemplateParmDecl>(*
P)));
655 "Unexpected requires-clause on template template-parameter");
656 Expr *
const CanonRequiresClause =
nullptr;
668 CanonRequiresClause));
671 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
672 assert(!Canonical &&
"Shouldn't be in the map!");
676 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
677 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
682 if (!LangOpts.CPlusPlus)
return nullptr;
697 llvm_unreachable(
"Invalid CXXABI type!");
702 if (LOpts.FakeAddressSpaceMap) {
705 static const unsigned FakeAddrSpaceMap[] = {
715 return &FakeAddrSpaceMap;
723 switch (LangOpts.getAddressSpaceMapMangling()) {
731 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
737 : FunctionProtoTypes(this_()), TemplateSpecializationTypes(this_()),
738 DependentTemplateSpecializationTypes(this_()),
739 SubstTemplateTemplateParmPacks(this_()),
740 GlobalNestedNameSpecifier(nullptr), Int128Decl(nullptr),
741 UInt128Decl(nullptr), BuiltinVaListDecl(nullptr),
742 BuiltinMSVaListDecl(nullptr), ObjCIdDecl(nullptr), ObjCSelDecl(nullptr),
743 ObjCClassDecl(nullptr), ObjCProtocolClassDecl(nullptr), BOOLDecl(nullptr),
744 CFConstantStringTagDecl(nullptr), CFConstantStringTypeDecl(nullptr),
745 ObjCInstanceTypeDecl(nullptr), FILEDecl(nullptr), jmp_bufDecl(nullptr),
746 sigjmp_bufDecl(nullptr), ucontext_tDecl(nullptr),
747 BlockDescriptorType(nullptr), BlockDescriptorExtendedType(nullptr),
748 cudaConfigureCallDecl(nullptr), FirstLocalImport(), LastLocalImport(),
749 ExternCContext(nullptr), MakeIntegerSeqDecl(nullptr),
750 TypePackElementDecl(nullptr),
SourceMgr(SM), LangOpts(LOpts),
753 LangOpts.XRayNeverInstrumentFiles, SM)),
754 AddrSpaceMap(nullptr), Target(nullptr), AuxTarget(nullptr),
756 BuiltinInfo(builtins), DeclarationNames(*this), ExternalSource(nullptr),
757 Listener(nullptr), Comments(SM), CommentsLoaded(
false),
758 CommentCommandTraits(BumpAlloc, LOpts.CommentOpts), LastSDM(nullptr, 0) {
763 ReleaseParentMapEntries();
767 ReleaseDeclContextMaps();
770 for (
auto &Pair : Deallocations)
771 (Pair.first)(Pair.second);
777 I = ObjCLayouts.begin(),
E = ObjCLayouts.end();
I !=
E; )
782 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
783 I = ASTRecordLayouts.begin(),
E = ASTRecordLayouts.end();
I !=
E; ) {
789 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
790 AEnd = DeclAttrs.end();
792 A->second->~AttrVec();
794 for (std::pair<const MaterializeTemporaryExpr *, APValue *> &MTVPair :
795 MaterializedTemporaryValues)
796 MTVPair.second->~APValue();
798 for (
const auto &
Value : ModuleInitializers)
799 Value.second->~PerModuleInitializers();
802 void ASTContext::ReleaseParentMapEntries() {
803 if (!PointerParents)
return;
804 for (
const auto &Entry : *PointerParents) {
811 for (
const auto &Entry : *OtherParents) {
821 Deallocations.push_back({
Callback, Data});
830 llvm::errs() <<
"\n*** AST Context Stats:\n";
831 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
833 unsigned counts[] = {
834 #define TYPE(Name, Parent) 0,
835 #define ABSTRACT_TYPE(Name, Parent)
836 #include "clang/AST/TypeNodes.def"
840 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
846 unsigned TotalBytes = 0;
847 #define TYPE(Name, Parent) \
849 llvm::errs() << " " << counts[Idx] << " " << #Name \
851 TotalBytes += counts[Idx] * sizeof(Name##Type); \
853 #define ABSTRACT_TYPE(Name, Parent)
854 #include "clang/AST/TypeNodes.def"
856 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
861 <<
" implicit default constructors created\n";
864 <<
" implicit copy constructors created\n";
868 <<
" implicit move constructors created\n";
871 <<
" implicit copy assignment operators created\n";
875 <<
" implicit move assignment operators created\n";
878 <<
" implicit destructors created\n";
881 llvm::errs() <<
"\n";
885 BumpAlloc.PrintStats();
889 bool NotifyListeners) {
895 MergedDefModules[ND].push_back(M);
901 auto It = MergedDefModules.find(ND);
902 if (It == MergedDefModules.end())
905 auto &Merged = It->second;
908 if (!Found.insert(M).second)
910 Merged.erase(std::remove(Merged.begin(), Merged.end(),
nullptr), Merged.end());
913 void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
914 if (LazyInitializers.empty())
918 assert(Source &&
"lazy initializers but no external source");
920 auto LazyInits = std::move(LazyInitializers);
921 LazyInitializers.clear();
923 for (
auto ID : LazyInits)
924 Initializers.push_back(Source->GetExternalDecl(ID));
926 assert(LazyInitializers.empty() &&
927 "GetExternalDecl for lazy module initializer added more inits");
933 if (
auto *ID = dyn_cast<ImportDecl>(D)) {
934 auto It = ModuleInitializers.find(ID->getImportedModule());
937 if (It == ModuleInitializers.end())
941 auto &Imported = *It->second;
942 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
943 Imported.resolve(*
this);
944 auto *OnlyDecl = Imported.Initializers.front();
945 if (isa<ImportDecl>(OnlyDecl))
950 auto *&
Inits = ModuleInitializers[M];
952 Inits =
new (*this) PerModuleInitializers;
953 Inits->Initializers.push_back(D);
957 auto *&
Inits = ModuleInitializers[M];
959 Inits =
new (*this) PerModuleInitializers;
960 Inits->LazyInitializers.insert(
Inits->LazyInitializers.end(),
961 IDs.begin(), IDs.end());
965 auto It = ModuleInitializers.find(M);
966 if (It == ModuleInitializers.end())
969 auto *
Inits = It->second;
970 Inits->resolve(*
this);
971 return Inits->Initializers;
978 return ExternCContext;
985 BuiltinTemplate->setImplicit();
986 TUDecl->
addDecl(BuiltinTemplate);
988 return BuiltinTemplate;
993 if (!MakeIntegerSeqDecl)
996 return MakeIntegerSeqDecl;
1001 if (!TypePackElementDecl)
1004 return TypePackElementDecl;
1018 NewDecl->addAttr(TypeVisibilityAttr::CreateImplicit(
1024 StringRef
Name)
const {
1048 Types.push_back(Ty);
1053 assert((!this->Target || this->Target == &Target) &&
1054 "Incorrect target reinitialization");
1057 this->Target = &Target;
1058 this->AuxTarget = AuxTarget;
1060 ABI.reset(createCXXABI(Target));
1065 InitBuiltinType(
VoidTy, BuiltinType::Void);
1068 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1070 if (LangOpts.CharIsSigned)
1071 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1073 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1076 InitBuiltinType(
ShortTy, BuiltinType::Short);
1077 InitBuiltinType(
IntTy, BuiltinType::Int);
1078 InitBuiltinType(
LongTy, BuiltinType::Long);
1079 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1089 InitBuiltinType(
FloatTy, BuiltinType::Float);
1090 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1091 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1094 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1097 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1102 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1104 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1105 if (LangOpts.CPlusPlus && LangOpts.WChar)
1109 WideCharTy = getFromTargetType(Target.getWCharType());
1112 WIntTy = getFromTargetType(Target.getWIntType());
1114 if (LangOpts.CPlusPlus)
1115 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1117 Char16Ty = getFromTargetType(Target.getChar16Type());
1119 if (LangOpts.CPlusPlus)
1120 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1122 Char32Ty = getFromTargetType(Target.getChar32Type());
1129 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1132 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1141 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1147 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1150 if (LangOpts.OpenMP)
1164 if (LangOpts.OpenCL) {
1165 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1166 InitBuiltinType(SingletonId, BuiltinType::Id);
1167 #include "clang/Basic/OpenCLImageTypes.def"
1169 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1170 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1172 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1180 ObjCConstantStringType =
QualType();
1188 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1191 InitBuiltinType(
HalfTy, BuiltinType::Half);
1213 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1214 if (Pos != DeclAttrs.end()) {
1215 Pos->second->~AttrVec();
1216 DeclAttrs.erase(Pos);
1230 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1231 TemplateOrInstantiation.find(Var);
1232 if (Pos == TemplateOrInstantiation.end())
1245 Tmpl, TSK, PointOfInstantiation));
1251 assert(!TemplateOrInstantiation[Inst] &&
1252 "Already noted what the variable was instantiated from");
1253 TemplateOrInstantiation[Inst] = TSI;
1258 assert(FD &&
"Specialization is 0");
1259 llvm::DenseMap<const FunctionDecl*, FunctionDecl *>::const_iterator Pos
1260 = ClassScopeSpecializationPattern.find(FD);
1261 if (Pos == ClassScopeSpecializationPattern.end())
1269 assert(FD &&
"Specialization is 0");
1270 assert(Pattern &&
"Class scope specialization pattern is 0");
1271 ClassScopeSpecializationPattern[FD] = Pattern;
1276 auto Pos = InstantiatedFromUsingDecl.find(UUD);
1277 if (Pos == InstantiatedFromUsingDecl.end())
1285 assert((isa<UsingDecl>(Pattern) ||
1286 isa<UnresolvedUsingValueDecl>(Pattern) ||
1287 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1288 "pattern decl is not a using decl");
1289 assert((isa<UsingDecl>(Inst) ||
1290 isa<UnresolvedUsingValueDecl>(Inst) ||
1291 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1292 "instantiation did not produce a using decl");
1293 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1294 InstantiatedFromUsingDecl[Inst] = Pattern;
1299 llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>::const_iterator Pos
1300 = InstantiatedFromUsingShadowDecl.find(Inst);
1301 if (Pos == InstantiatedFromUsingShadowDecl.end())
1310 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1311 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1315 llvm::DenseMap<FieldDecl *, FieldDecl *>::iterator Pos
1316 = InstantiatedFromUnnamedFieldDecl.find(Field);
1317 if (Pos == InstantiatedFromUnnamedFieldDecl.end())
1325 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1326 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1327 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1328 "Already noted what unnamed field was instantiated from");
1330 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1335 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1337 if (Pos == OverriddenMethods.end())
1339 return Pos->second.begin();
1344 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1346 if (Pos == OverriddenMethods.end())
1348 return Pos->second.end();
1353 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1355 if (Pos == OverriddenMethods.end())
1357 return Pos->second.size();
1369 OverriddenMethods[Method].push_back(Overridden);
1377 if (
const CXXMethodDecl *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1389 Overridden.append(OverDecls.begin(), OverDecls.end());
1393 assert(!Import->NextLocalImport &&
"Import declaration already in the chain");
1394 assert(!Import->
isFromASTFile() &&
"Non-local import declaration");
1395 if (!FirstLocalImport) {
1396 FirstLocalImport = Import;
1397 LastLocalImport = Import;
1401 LastLocalImport->NextLocalImport = Import;
1402 LastLocalImport = Import;
1413 assert(BT &&
"Not a floating point type!");
1415 default: llvm_unreachable(
"Not a floating point type!");
1427 bool UseAlignAttrOnly =
false;
1429 Align = AlignFromAttr;
1437 if (isa<FieldDecl>(D)) {
1438 UseAlignAttrOnly = D->
hasAttr<PackedAttr>() ||
1439 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1441 UseAlignAttrOnly =
true;
1444 else if (isa<FieldDecl>(D))
1447 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1451 if (UseAlignAttrOnly) {
1454 }
else if (
const ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
1464 Align = getTypeInfoImpl(T.
getTypePtr()).Align;
1470 if (!ForAlignof && MinWidth) {
1471 if (isa<VariableArrayType>(arrayType))
1473 else if (isa<ConstantArrayType>(arrayType) &&
1474 MinWidth <= getTypeSize(cast<ConstantArrayType>(arrayType)))
1481 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
1482 if (VD->hasGlobalStorage() && !ForAlignof)
1492 if (
const FieldDecl *Field = dyn_cast<FieldDecl>(VD)) {
1493 const RecordDecl *Parent = Field->getParent();
1506 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1507 if (LowBitOfOffset < FieldAlign)
1508 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1511 Align =
std::min(Align, FieldAlign);
1523 std::pair<CharUnits, CharUnits>
1537 return sizeAndAlign;
1542 std::pair<CharUnits, CharUnits>
1545 std::pair<CharUnits, CharUnits> EltInfo =
1547 uint64_t Size = CAT->
getSize().getZExtValue();
1548 assert((Size == 0 || static_cast<uint64_t>(EltInfo.first.getQuantity()) <=
1549 (uint64_t)(-1)/Size) &&
1550 "Overflow in array type char size evaluation");
1551 uint64_t Width = EltInfo.first.getQuantity() * Size;
1552 unsigned Align = EltInfo.second.getQuantity();
1555 Width = llvm::alignTo(Width, Align);
1560 std::pair<CharUnits, CharUnits>
1569 std::pair<CharUnits, CharUnits>
1585 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1596 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1601 return TT->getDecl()->getMaxAlignment();
1607 TypeInfoMap::iterator
I = MemoizedTypeInfo.find(T);
1608 if (I != MemoizedTypeInfo.end())
1613 MemoizedTypeInfo[T] = TI;
1623 TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
1626 bool AlignIsRequired =
false;
1628 #define TYPE(Class, Base)
1629 #define ABSTRACT_TYPE(Class, Base)
1630 #define NON_CANONICAL_TYPE(Class, Base)
1631 #define DEPENDENT_TYPE(Class, Base) case Type::Class:
1632 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \
1634 assert(!T->isDependentType() && "should not see dependent types here"); \
1635 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr());
1636 #include "clang/AST/TypeNodes.def"
1637 llvm_unreachable(
"Should not see dependent types");
1639 case Type::FunctionNoProto:
1640 case Type::FunctionProto:
1646 case Type::IncompleteArray:
1647 case Type::VariableArray:
1649 Align =
getTypeAlign(cast<ArrayType>(T)->getElementType());
1652 case Type::ConstantArray: {
1656 uint64_t Size = CAT->
getSize().getZExtValue();
1657 assert((Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) &&
1658 "Overflow in array type bit size evaluation");
1659 Width = EltInfo.Width * Size;
1660 Align = EltInfo.Align;
1663 Width = llvm::alignTo(Width, Align);
1666 case Type::ExtVector:
1667 case Type::Vector: {
1674 if (Align & (Align-1)) {
1675 Align = llvm::NextPowerOf2(Align);
1676 Width = llvm::alignTo(Width, Align);
1680 if (TargetVectorAlign && TargetVectorAlign < Align)
1681 Align = TargetVectorAlign;
1686 switch (cast<BuiltinType>(T)->
getKind()) {
1687 default: llvm_unreachable(
"Unknown builtin type!");
1688 case BuiltinType::Void:
1694 case BuiltinType::Bool:
1698 case BuiltinType::Char_S:
1699 case BuiltinType::Char_U:
1700 case BuiltinType::UChar:
1701 case BuiltinType::SChar:
1705 case BuiltinType::WChar_S:
1706 case BuiltinType::WChar_U:
1710 case BuiltinType::Char16:
1714 case BuiltinType::Char32:
1718 case BuiltinType::UShort:
1719 case BuiltinType::Short:
1723 case BuiltinType::UInt:
1724 case BuiltinType::Int:
1728 case BuiltinType::ULong:
1729 case BuiltinType::Long:
1733 case BuiltinType::ULongLong:
1734 case BuiltinType::LongLong:
1738 case BuiltinType::Int128:
1739 case BuiltinType::UInt128:
1743 case BuiltinType::Half:
1747 case BuiltinType::Float:
1751 case BuiltinType::Double:
1755 case BuiltinType::LongDouble:
1759 case BuiltinType::Float128:
1763 case BuiltinType::NullPtr:
1767 case BuiltinType::ObjCId:
1768 case BuiltinType::ObjCClass:
1769 case BuiltinType::ObjCSel:
1773 case BuiltinType::OCLSampler: {
1779 case BuiltinType::OCLEvent:
1780 case BuiltinType::OCLClkEvent:
1781 case BuiltinType::OCLQueue:
1782 case BuiltinType::OCLReserveID:
1787 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
1788 case BuiltinType::Id:
1789 #include "clang/Basic/OpenCLImageTypes.def"
1797 case Type::ObjCObjectPointer:
1801 case Type::BlockPointer: {
1803 cast<BlockPointerType>(T)->getPointeeType());
1808 case Type::LValueReference:
1809 case Type::RValueReference: {
1813 cast<ReferenceType>(T)->getPointeeType());
1818 case Type::Pointer: {
1824 case Type::MemberPointer: {
1826 std::tie(Width, Align) = ABI->getMemberPointerWidthAndAlign(MPT);
1829 case Type::Complex: {
1833 Width = EltInfo.
Width * 2;
1834 Align = EltInfo.
Align;
1837 case Type::ObjCObject:
1838 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr());
1839 case Type::Adjusted:
1842 case Type::ObjCInterface: {
1845 Width =
toBits(Layout.getSize());
1846 Align =
toBits(Layout.getAlignment());
1851 const TagType *TT = cast<TagType>(T);
1859 if (
const EnumType *ET = dyn_cast<EnumType>(TT)) {
1860 const EnumDecl *ED = ET->getDecl();
1864 Info.
Align = AttrAlign;
1875 AlignIsRequired = RD->hasAttr<AlignedAttr>();
1879 case Type::SubstTemplateTypeParm:
1880 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
1881 getReplacementType().getTypePtr());
1884 case Type::DeducedTemplateSpecialization: {
1887 "cannot request the size of an undeduced or dependent auto type");
1892 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr());
1894 case Type::ObjCTypeParam:
1895 return getTypeInfo(cast<ObjCTypeParamType>(T)->desugar().getTypePtr());
1897 case Type::Typedef: {
1905 AlignIsRequired =
true;
1914 case Type::Elaborated:
1915 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
1917 case Type::Attributed:
1919 cast<AttributedType>(T)->getEquivalentType().getTypePtr());
1921 case Type::Atomic: {
1930 if (Width != 0 && Width <= Target->getMaxAtomicPromoteWidth()) {
1932 if (!llvm::isPowerOf2_64(Width))
1933 Width = llvm::NextPowerOf2(Width);
1936 Align =
static_cast<unsigned>(Width);
1948 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
1949 return TypeInfo(Width, Align, AlignIsRequired);
1955 if ((
getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 ||
1956 getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) &&
1997 unsigned ABIAlign = TI.
Align;
2010 T = CT->getElementType().getTypePtr();
2012 T = ET->getDecl()->getIntegerType().getTypePtr();
2065 for (
const auto *
I : OI->
ivars())
2071 Ivars.push_back(Iv);
2078 llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols) {
2082 for (
auto *Proto : OI->all_referenced_protocols()) {
2087 for (
const auto *Cat : OI->visible_categories())
2093 SD = SD->getSuperClass();
2095 }
else if (
const ObjCCategoryDecl *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2096 for (
auto *Proto : OC->protocols()) {
2099 }
else if (
const ObjCProtocolDecl *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2101 if (!Protocols.insert(
2102 const_cast<ObjCProtocolDecl *>(OP->getCanonicalDecl())).second)
2105 for (
auto *Proto : OP->protocols())
2114 count += Ext->ivar_size();
2119 count += ImplDecl->ivar_size();
2137 if (isa<GNUNullExpr>(E))
return true;
2144 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2145 I = ObjCImpls.find(D);
2146 if (I != ObjCImpls.end())
2147 return cast<ObjCImplementationDecl>(I->second);
2152 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2153 I = ObjCImpls.find(D);
2154 if (I != ObjCImpls.end())
2155 return cast<ObjCCategoryImplDecl>(I->second);
2162 assert(IFaceD && ImplD &&
"Passed null params");
2163 ObjCImpls[IFaceD] = ImplD;
2168 assert(CatD && ImplD &&
"Passed null params");
2169 ObjCImpls[CatD] = ImplD;
2174 return ObjCMethodRedecls.lookup(MD);
2180 ObjCMethodRedecls[MD] = Redecl;
2190 return CD->getClassInterface();
2193 return IMD->getClassInterface();
2201 assert(VD &&
"Passed null params");
2202 assert(VD->
hasAttr<BlocksAttr>() &&
2203 "getBlockVarCopyInits - not __block var");
2204 llvm::DenseMap<const VarDecl*, Expr*>::iterator
2205 I = BlockVarCopyInits.find(VD);
2206 return (I != BlockVarCopyInits.end()) ? cast<Expr>(I->second) :
nullptr;
2211 assert(VD && Init &&
"Passed null params");
2212 assert(VD->
hasAttr<BlocksAttr>() &&
2213 "setBlockVarCopyInits - not __block var");
2214 BlockVarCopyInits[VD] = Init;
2218 unsigned DataSize)
const {
2223 "incorrect data size provided to CreateTypeSourceInfo!");
2240 return getObjCLayout(D,
nullptr);
2254 ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
2259 llvm::FoldingSetNodeID
ID;
2261 void *insertPos =
nullptr;
2262 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
2263 assert(eq->getQualifiers() == quals);
2272 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
2275 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
2279 ExtQualNodes.InsertNode(eq, insertPos);
2297 "Type cannot be in multiple addr spaces!");
2300 return getExtQualType(TypeNode, Quals);
2325 "Type cannot have multiple ObjCGCs!");
2328 return getExtQualType(TypeNode, Quals);
2346 return cast<FunctionType>(Result.
getTypePtr());
2362 L->DeducedReturnType(FD, ResultType);
2373 if (
auto *PT = dyn_cast<ParenType>(Orig))
2378 if (
auto *AT = dyn_cast<AttributedType>(Orig))
2416 if (TSInfo->getType() != FD->
getType())
2424 "TypeLoc size mismatch from updating exception specification");
2425 TSInfo->overrideType(Updated);
2434 llvm::FoldingSetNodeID
ID;
2437 void *InsertPos =
nullptr;
2438 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
2448 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
2449 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2452 Types.push_back(New);
2453 ComplexTypes.InsertNode(New, InsertPos);
2462 llvm::FoldingSetNodeID
ID;
2465 void *InsertPos =
nullptr;
2466 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2476 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2477 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2480 Types.push_back(New);
2481 PointerTypes.InsertNode(New, InsertPos);
2486 llvm::FoldingSetNodeID
ID;
2488 void *InsertPos =
nullptr;
2489 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2496 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2497 assert(!AT &&
"Shouldn't be in the map!");
2501 Types.push_back(AT);
2502 AdjustedTypes.InsertNode(AT, InsertPos);
2526 llvm::FoldingSetNodeID
ID;
2528 void *InsertPos =
nullptr;
2529 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2536 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2537 assert(!AT &&
"Shouldn't be in the map!");
2540 Types.push_back(AT);
2541 AdjustedTypes.InsertNode(AT, InsertPos);
2551 llvm::FoldingSetNodeID
ID;
2554 void *InsertPos =
nullptr;
2556 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2567 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2568 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2572 Types.push_back(New);
2573 BlockPointerTypes.InsertNode(New, InsertPos);
2582 "Unresolved overloaded function type");
2586 llvm::FoldingSetNodeID
ID;
2589 void *InsertPos =
nullptr;
2591 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2599 if (!SpelledAsLValue || InnerRef || !T.
isCanonical()) {
2605 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2606 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2612 Types.push_back(New);
2613 LValueReferenceTypes.InsertNode(New, InsertPos);
2623 llvm::FoldingSetNodeID
ID;
2626 void *InsertPos =
nullptr;
2628 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2642 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2643 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2648 Types.push_back(New);
2649 RValueReferenceTypes.InsertNode(New, InsertPos);
2658 llvm::FoldingSetNodeID
ID;
2661 void *InsertPos =
nullptr;
2663 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2674 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2675 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2679 Types.push_back(New);
2680 MemberPointerTypes.InsertNode(New, InsertPos);
2687 const llvm::APInt &ArySizeIn,
2689 unsigned IndexTypeQuals)
const {
2692 "Constant array of VLAs is illegal!");
2696 llvm::APInt ArySize(ArySizeIn);
2699 llvm::FoldingSetNodeID
ID;
2702 void *InsertPos =
nullptr;
2704 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
2713 ASM, IndexTypeQuals);
2718 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
2719 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2724 ConstantArrayTypes.InsertNode(New, InsertPos);
2725 Types.push_back(New);
2739 const Type *ty = split.
Ty;
2741 #define TYPE(Class, Base)
2742 #define ABSTRACT_TYPE(Class, Base)
2743 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
2744 #include "clang/AST/TypeNodes.def"
2745 llvm_unreachable(
"didn't desugar past all non-canonical types?");
2751 case Type::ExtVector:
2752 case Type::DependentSizedExtVector:
2753 case Type::ObjCObject:
2754 case Type::ObjCInterface:
2755 case Type::ObjCObjectPointer:
2758 case Type::UnresolvedUsing:
2759 case Type::TypeOfExpr:
2761 case Type::Decltype:
2762 case Type::UnaryTransform:
2763 case Type::DependentName:
2764 case Type::InjectedClassName:
2765 case Type::TemplateSpecialization:
2766 case Type::DependentTemplateSpecialization:
2767 case Type::TemplateTypeParm:
2768 case Type::SubstTemplateTypeParmPack:
2770 case Type::DeducedTemplateSpecialization:
2771 case Type::PackExpansion:
2772 llvm_unreachable(
"type should never be variably-modified");
2776 case Type::FunctionNoProto:
2777 case Type::FunctionProto:
2778 case Type::BlockPointer:
2779 case Type::MemberPointer:
2789 cast<PointerType>(ty)->getPointeeType()));
2792 case Type::LValueReference: {
2800 case Type::RValueReference: {
2807 case Type::Atomic: {
2813 case Type::ConstantArray: {
2823 case Type::DependentSizedArray: {
2835 case Type::IncompleteArray: {
2847 case Type::VariableArray: {
2868 unsigned IndexTypeQuals,
2878 IndexTypeQuals, Brackets);
2885 VariableArrayTypes.push_back(New);
2886 Types.push_back(New);
2896 unsigned elementTypeQuals,
2900 "Size must be type- or value-dependent!");
2910 numElements, ASM, elementTypeQuals,
2912 Types.push_back(newType);
2921 void *insertPos =
nullptr;
2922 llvm::FoldingSetNodeID
ID;
2925 ASM, elementTypeQuals, numElements);
2929 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
2935 QualType(), numElements, ASM, elementTypeQuals,
2937 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
2938 Types.push_back(canonTy);
2943 canonElementType.
Quals);
2947 if (
QualType(canonElementType.
Ty, 0) == elementType &&
2956 ASM, elementTypeQuals, brackets);
2957 Types.push_back(sugaredType);
2963 unsigned elementTypeQuals)
const {
2964 llvm::FoldingSetNodeID
ID;
2967 void *insertPos =
nullptr;
2969 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
2980 ASM, elementTypeQuals);
2985 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
2986 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
2992 IncompleteArrayTypes.InsertNode(newType, insertPos);
2993 Types.push_back(newType);
3004 llvm::FoldingSetNodeID
ID;
3007 void *InsertPos =
nullptr;
3008 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3018 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3019 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3022 VectorType(vecType, NumElts, Canonical, VecKind);
3023 VectorTypes.InsertNode(New, InsertPos);
3024 Types.push_back(New);
3035 llvm::FoldingSetNodeID
ID;
3038 void *InsertPos =
nullptr;
3039 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3049 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3050 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3054 VectorTypes.InsertNode(New, InsertPos);
3055 Types.push_back(New);
3063 llvm::FoldingSetNodeID
ID;
3067 void *InsertPos =
nullptr;
3069 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3079 if (CanonVecTy == vecType) {
3085 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3086 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
3088 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
3097 Types.push_back(New);
3115 llvm::FoldingSetNodeID
ID;
3118 void *InsertPos =
nullptr;
3120 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
3130 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3131 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3136 Types.push_back(New);
3137 FunctionNoProtoTypes.InsertNode(New, InsertPos);
3153 return CanResultType;
3160 if (!NoexceptInType)
3172 bool AnyPackExpansions =
false;
3177 AnyPackExpansions =
true;
3179 return AnyPackExpansions;
3190 QualType ASTContext::getFunctionTypeInternal(
3193 size_t NumArgs = ArgArray.size();
3197 llvm::FoldingSetNodeID
ID;
3202 bool Unique =
false;
3204 void *InsertPos =
nullptr;
3206 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
3215 EPI.ExceptionSpec.NoexceptExpr == FPT->getNoexceptExpr())
3226 bool IsCanonicalExceptionSpec =
3230 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
3232 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
3233 if (!ArgArray[i].isCanonicalAsParam())
3234 isCanonical =
false;
3236 if (OnlyWantCanonical)
3237 assert(isCanonical &&
3238 "given non-canonical parameters constructing canonical type");
3243 if (!isCanonical && Canonical.isNull()) {
3245 CanonicalArgs.reserve(NumArgs);
3246 for (
unsigned i = 0; i != NumArgs; ++i)
3253 if (IsCanonicalExceptionSpec) {
3255 }
else if (NoexceptInType) {
3256 switch (EPI.ExceptionSpec.Type) {
3268 bool AnyPacks =
false;
3269 for (
QualType ET : EPI.ExceptionSpec.Exceptions) {
3288 llvm::APSInt
Value(1);
3290 if (!
E || !
E->isIntegerConstantExpr(
Value, *
this,
nullptr,
3309 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
3313 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3314 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3329 Size += EPI.ExceptionSpec.Exceptions.size() *
sizeof(
QualType);
3331 Size +=
sizeof(
Expr*);
3344 if (EPI.ExtParameterInfos) {
3351 Types.push_back(FTP);
3353 FunctionProtoTypes.InsertNode(FTP, InsertPos);
3358 llvm::FoldingSetNodeID
ID;
3361 void *InsertPos = 0;
3362 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
3372 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
3373 assert(!NewIP &&
"Shouldn't be in the map!");
3377 Types.push_back(New);
3378 PipeTypes.InsertNode(New, InsertPos);
3383 return getPipeType(T,
true);
3387 return getPipeType(T,
false);
3392 if (!isa<CXXRecordDecl>(D))
return false;
3394 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
3397 !isa<ClassTemplateSpecializationDecl>(RD))
3408 if (Decl->TypeForDecl) {
3409 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3411 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
3412 Decl->TypeForDecl = PrevDecl->TypeForDecl;
3413 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3417 Decl->TypeForDecl = newType;
3418 Types.push_back(newType);
3420 return QualType(Decl->TypeForDecl, 0);
3426 assert(Decl &&
"Passed null for Decl param");
3427 assert(!Decl->TypeForDecl &&
"TypeForDecl present in slow case");
3432 assert(!isa<TemplateTypeParmDecl>(Decl) &&
3433 "Template type parameter types are always available.");
3435 if (
const RecordDecl *Record = dyn_cast<RecordDecl>(Decl)) {
3436 assert(Record->isFirstDecl() &&
"struct/union has previous declaration");
3439 }
else if (
const EnumDecl *Enum = dyn_cast<EnumDecl>(Decl)) {
3440 assert(Enum->isFirstDecl() &&
"enum has previous declaration");
3443 dyn_cast<UnresolvedUsingTypenameDecl>(Decl)) {
3445 Decl->TypeForDecl = newType;
3446 Types.push_back(newType);
3448 llvm_unreachable(
"TypeDecl without a type?");
3450 return QualType(Decl->TypeForDecl, 0);
3458 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3464 Decl->TypeForDecl = newType;
3465 Types.push_back(newType);
3470 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3473 if (PrevDecl->TypeForDecl)
3474 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3477 Decl->TypeForDecl = newType;
3478 Types.push_back(newType);
3483 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3486 if (PrevDecl->TypeForDecl)
3487 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3490 Decl->TypeForDecl = newType;
3491 Types.push_back(newType);
3498 llvm::FoldingSetNodeID
id;
3501 void *insertPos =
nullptr;
3503 if (type)
return QualType(type, 0);
3509 Types.push_back(type);
3510 AttributedTypes.InsertNode(type, insertPos);
3520 &&
"replacement types must always be canonical");
3522 llvm::FoldingSetNodeID
ID;
3524 void *InsertPos =
nullptr;
3526 = SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3531 Types.push_back(SubstParm);
3532 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
3545 assert(
P.getAsType().isCanonical() &&
"Pack contains non-canonical type");
3549 llvm::FoldingSetNodeID
ID;
3551 void *InsertPos =
nullptr;
3553 = SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
3561 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
3567 Types.push_back(SubstParm);
3568 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
3578 llvm::FoldingSetNodeID
ID;
3580 void *InsertPos =
nullptr;
3582 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3592 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3593 assert(!TypeCheck &&
"Template type parameter canonical type broken");
3599 Types.push_back(TypeParm);
3600 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
3611 "No dependent template names here!");
3621 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
3631 "No dependent template names here!");
3634 ArgVec.reserve(Args.
size());
3636 ArgVec.push_back(Arg.getArgument());
3644 if (Arg.isPackExpansion())
3656 "No dependent template names here!");
3665 if (!Underlying.
isNull())
3671 "Caller must compute aliased type");
3672 IsTypeAlias =
false;
3681 (IsTypeAlias?
sizeof(
QualType) : 0),
3685 IsTypeAlias ? Underlying :
QualType());
3687 Types.push_back(Spec);
3694 "No dependent template names here!");
3703 unsigned NumArgs = Args.size();
3704 CanonArgs.reserve(NumArgs);
3710 llvm::FoldingSetNodeID
ID;
3714 void *InsertPos =
nullptr;
3716 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
3726 Types.push_back(Spec);
3727 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
3731 "Non-dependent template-id type must have a canonical type");
3739 llvm::FoldingSetNodeID
ID;
3742 void *InsertPos =
nullptr;
3743 ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
3750 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
3751 assert(!CheckT &&
"Elaborated canonical type broken");
3757 ElaboratedTypes.InsertNode(T, InsertPos);
3763 llvm::FoldingSetNodeID
ID;
3766 void *InsertPos =
nullptr;
3767 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
3774 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
3775 assert(!CheckT &&
"Paren canonical type broken");
3781 ParenTypes.InsertNode(T, InsertPos);
3791 if (CanonNNS != NNS)
3795 llvm::FoldingSetNodeID
ID;
3798 void *InsertPos =
nullptr;
3800 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
3806 DependentNameTypes.InsertNode(T, InsertPos);
3818 for (
unsigned I = 0,
E = Args.
size();
I !=
E; ++
I)
3819 ArgCopy.push_back(Args[
I].getArgument());
3830 "nested-name-specifier must be dependent");
3832 llvm::FoldingSetNodeID
ID;
3836 void *InsertPos =
nullptr;
3838 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
3847 bool AnyNonCanonArgs =
false;
3848 unsigned NumArgs = Args.size();
3850 for (
unsigned I = 0;
I != NumArgs; ++
I) {
3852 if (!CanonArgs[I].structurallyEquals(Args[I]))
3853 AnyNonCanonArgs =
true;
3857 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
3863 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
3872 DependentTemplateSpecializationTypes.InsertNode(T, InsertPos);
3878 if (
auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
3884 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
3887 NTTP->getType().getNonLValueExprType(*
this),
3890 if (NTTP->isParameterPack())
3895 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
3911 Args.reserve(Args.size() + Params->
size());
3919 llvm::FoldingSetNodeID
ID;
3923 "Pack expansions must expand one or more parameter packs");
3924 void *InsertPos =
nullptr;
3926 = PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
3941 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
3948 PackExpansionTypes.InsertNode(T, InsertPos);
3960 if (Protocols.empty())
return true;
3965 for (
unsigned i = 1; i != Protocols.size(); ++i)
3967 Protocols[i]->getCanonicalDecl() != Protocols[i])
3975 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
3979 P =
P->getCanonicalDecl();
3982 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
3983 Protocols.erase(ProtocolsEnd, Protocols.end());
3988 unsigned NumProtocols)
const {
3990 llvm::makeArrayRef(Protocols, NumProtocols),
3998 bool isKindOf)
const {
4001 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
4002 isa<ObjCInterfaceType>(baseType))
4006 llvm::FoldingSetNodeID
ID;
4008 void *InsertPos =
nullptr;
4009 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
4016 if (effectiveTypeArgs.empty()) {
4018 effectiveTypeArgs = baseObject->getTypeArgs();
4025 bool typeArgsAreCanonical = std::all_of(effectiveTypeArgs.begin(),
4026 effectiveTypeArgs.end(),
4028 return type.isCanonical();
4031 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
4035 if (!typeArgsAreCanonical) {
4036 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
4037 for (
auto typeArg : effectiveTypeArgs)
4039 canonTypeArgs = canonTypeArgsVec;
4041 canonTypeArgs = effectiveTypeArgs;
4046 if (!protocolsSorted) {
4047 canonProtocolsVec.append(protocols.begin(), protocols.end());
4049 canonProtocols = canonProtocolsVec;
4051 canonProtocols = protocols;
4055 canonProtocols, isKindOf);
4058 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
4062 size += typeArgs.size() *
sizeof(
QualType);
4070 ObjCObjectTypes.InsertNode(T, InsertPos);
4080 bool allowOnPointerType)
const {
4084 dyn_cast<ObjCTypeParamType>(type.
getTypePtr())) {
4089 if (allowOnPointerType) {
4091 dyn_cast<ObjCObjectPointerType>(type.
getTypePtr())) {
4097 protocolsVec.append(protocols.begin(), protocols.end());
4114 objT->getTypeArgsAsWritten(),
4116 objT->isKindOfTypeAsWritten());
4154 llvm::FoldingSetNodeID
ID;
4156 void *InsertPos =
nullptr;
4158 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
4161 if (Canonical.
isNull()) {
4164 if (!protocols.empty()) {
4169 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
4179 Types.push_back(newType);
4180 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
4194 for (
auto *Proto : OPT->quals()) {
4215 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> InheritedProtocols;
4217 if (InheritedProtocols.empty())
4221 bool Conforms =
false;
4222 for (
auto *Proto : OPT->
quals()) {
4224 for (
auto *PI : InheritedProtocols) {
4236 for (
auto *PI : InheritedProtocols) {
4238 bool Adopts =
false;
4239 for (
auto *Proto : OPT->
quals()) {
4253 llvm::FoldingSetNodeID
ID;
4256 void *InsertPos =
nullptr;
4258 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4267 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4275 Types.push_back(QType);
4276 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
4284 if (Decl->TypeForDecl)
4285 return QualType(Decl->TypeForDecl, 0);
4288 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
4289 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4290 return QualType(PrevDecl->TypeForDecl, 0);
4299 Decl->TypeForDecl = T;
4312 llvm::FoldingSetNodeID
ID;
4315 void *InsertPos =
nullptr;
4317 = DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
4327 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
4334 Types.push_back(toe);
4346 Types.push_back(tot);
4362 llvm::FoldingSetNodeID
ID;
4365 void *InsertPos =
nullptr;
4367 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
4371 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
4379 Types.push_back(dt);
4393 llvm::FoldingSetNodeID
ID;
4396 void *InsertPos =
nullptr;
4398 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
4405 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
4413 UnderlyingType, Kind,
4416 Types.push_back(ut);
4424 bool IsDependent)
const {
4429 void *InsertPos =
nullptr;
4430 llvm::FoldingSetNodeID
ID;
4432 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
4438 Types.push_back(AT);
4440 AutoTypes.InsertNode(AT, InsertPos);
4450 void *InsertPos =
nullptr;
4451 llvm::FoldingSetNodeID
ID;
4455 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
4460 Types.push_back(DTST);
4462 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
4471 llvm::FoldingSetNodeID
ID;
4474 void *InsertPos =
nullptr;
4475 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
4485 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
4486 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4489 Types.push_back(New);
4490 AtomicTypes.InsertNode(New, InsertPos);
4589 if (isa<ArrayType>(Ty)) {
4591 }
else if (isa<FunctionType>(Ty)) {
4613 quals = splitType.
Quals;
4623 if (elementType == unqualElementType) {
4624 assert(quals.
empty());
4625 quals = splitType.
Quals;
4645 VAT->getSizeModifier(),
4646 VAT->getIndexTypeCVRQualifiers(),
4647 VAT->getBracketsRange());
4667 if (T1PtrType && T2PtrType) {
4675 if (T1MPType && T2MPType &&
4677 QualType(T2MPType->getClass(), 0))) {
4686 if (T1OPType && T2OPType) {
4745 llvm_unreachable(
"bad template name kind!");
4754 = dyn_cast<TemplateTemplateParmDecl>(Template))
4755 Template = getCanonicalTemplateTemplateParmDecl(TTP);
4762 llvm_unreachable(
"cannot canonicalize overloaded template");
4766 assert(DTN &&
"Non-dependent template names must refer to template decls.");
4767 return DTN->CanonicalTemplateName;
4787 llvm_unreachable(
"bad template name!");
4837 A != AEnd; (void)++A, ++Idx)
4840 return TemplateArgument(llvm::makeArrayRef(CanonArgs, Arg.
pack_size()));
4845 llvm_unreachable(
"Unhandled template argument kind");
4901 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
4908 if (
const ArrayType *AT = dyn_cast<ArrayType>(T))
4929 if (!ATy || qs.
empty())
4942 IAT->getSizeModifier(),
4943 IAT->getIndexTypeCVRQualifiers()));
4946 = dyn_cast<DependentSizedArrayType>(ATy))
4947 return cast<ArrayType>(
4949 DSAT->getSizeExpr(),
4950 DSAT->getSizeModifier(),
4951 DSAT->getIndexTypeCVRQualifiers(),
4952 DSAT->getBracketsRange()));
4999 assert(PrettyArrayType &&
"Not an array type!");
5036 uint64_t ElementCount = 1;
5038 ElementCount *= CA->
getSize().getZExtValue();
5039 CA = dyn_cast_or_null<ConstantArrayType>(
5042 return ElementCount;
5051 assert(T->
getAs<
BuiltinType>() &&
"getFloatingRank(): not a floating type");
5053 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
5054 case BuiltinType::Half:
return HalfRank;
5055 case BuiltinType::Float:
return FloatRank;
5071 case HalfRank: llvm_unreachable(
"Complex half is not supported");
5087 llvm_unreachable(
"getFloatingRank(): illegal value for rank");
5108 unsigned ASTContext::getIntegerRank(
const Type *T)
const {
5111 switch (cast<BuiltinType>(T)->getKind()) {
5112 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
5113 case BuiltinType::Bool:
5115 case BuiltinType::Char_S:
5116 case BuiltinType::Char_U:
5117 case BuiltinType::SChar:
5118 case BuiltinType::UChar:
5120 case BuiltinType::Short:
5121 case BuiltinType::UShort:
5123 case BuiltinType::Int:
5124 case BuiltinType::UInt:
5126 case BuiltinType::Long:
5127 case BuiltinType::ULong:
5129 case BuiltinType::LongLong:
5130 case BuiltinType::ULongLong:
5132 case BuiltinType::Int128:
5133 case BuiltinType::UInt128:
5173 if (BitWidth < IntSize)
5176 if (BitWidth == IntSize)
5191 assert(!Promotable.
isNull());
5194 return ET->getDecl()->getPromotionType();
5203 if (BT->getKind() == BuiltinType::WChar_S ||
5204 BT->getKind() == BuiltinType::WChar_U ||
5205 BT->getKind() == BuiltinType::Char16 ||
5206 BT->getKind() == BuiltinType::Char32) {
5207 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
5211 for (
size_t Idx = 0; Idx < llvm::array_lengthof(PromoteTypes); ++Idx) {
5213 if (FromSize < ToSize ||
5214 (FromSize == ToSize &&
5215 FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType()))
5216 return PromoteTypes[Idx];
5218 llvm_unreachable(
"char type should fit into long long");
5225 uint64_t PromotableSize =
getIntWidth(Promotable);
5266 if (
const EnumType *ET = dyn_cast<EnumType>(LHSC))
5268 if (
const EnumType *ET = dyn_cast<EnumType>(RHSC))
5271 if (LHSC == RHSC)
return 0;
5276 unsigned LHSRank = getIntegerRank(LHSC);
5277 unsigned RHSRank = getIntegerRank(RHSC);
5279 if (LHSUnsigned == RHSUnsigned) {
5280 if (LHSRank == RHSRank)
return 0;
5281 return LHSRank > RHSRank ? 1 : -1;
5287 if (LHSRank >= RHSRank)
5297 if (RHSRank >= LHSRank)
5307 if (!CFConstantStringTypeDecl) {
5308 assert(!CFConstantStringTagDecl &&
5309 "tag and typedef should be initialized together");
5314 const char *FieldNames[4];
5318 FieldNames[0] =
"isa";
5320 FieldTypes[1] =
IntTy;
5321 FieldNames[1] =
"flags";
5324 FieldNames[2] =
"str";
5327 FieldNames[3] =
"length";
5330 for (
unsigned i = 0; i < 4; ++i) {
5335 FieldTypes[i],
nullptr,
5340 CFConstantStringTagDecl->
addDecl(Field);
5347 CFConstantStringTypeDecl =
5351 return CFConstantStringTypeDecl;
5355 if (!CFConstantStringTagDecl)
5357 return CFConstantStringTagDecl;
5366 if (ObjCSuperType.
isNull()) {
5368 TUDecl->
addDecl(ObjCSuperTypeDecl);
5371 return ObjCSuperType;
5376 assert(TD &&
"Invalid CFConstantStringType");
5377 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->
getDecl());
5380 assert(TagType &&
"Invalid CFConstantStringType");
5381 CFConstantStringTagDecl = TagType->getDecl();
5385 if (BlockDescriptorType)
5398 static const char *
const FieldNames[] = {
5403 for (
size_t i = 0; i < 2; ++i) {
5406 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
5414 BlockDescriptorType = RD;
5420 if (BlockDescriptorExtendedType)
5435 static const char *
const FieldNames[] = {
5442 for (
size_t i = 0; i < 4; ++i) {
5445 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
5454 BlockDescriptorExtendedType = RD;
5465 if (!copyExpr && record->hasTrivialDestructor())
return false;
5491 llvm_unreachable(
"fell out of lifetime switch!");
5499 bool &HasByrefExtendedLayout)
const {
5505 HasByrefExtendedLayout =
false;
5507 HasByrefExtendedLayout =
true;
5521 if (!ObjCInstanceTypeDecl)
5522 ObjCInstanceTypeDecl =
5524 return ObjCInstanceTypeDecl;
5530 if (
const TypedefType *TT = dyn_cast<TypedefType>(T))
5532 return II->isStr(
"BOOL");
5568 if (!First->isConstexpr() || First->isInlineSpecified() ||
5613 assert (sz.
isPositive() &&
"BlockExpr - Incomplete param type");
5622 ParmOffset = PtrSize;
5624 QualType PType = PVDecl->getOriginalType();
5629 if (!isa<ConstantArrayType>(AT))
5630 PType = PVDecl->getType();
5632 PType = PVDecl->getType();
5659 "getObjCEncodingForFunctionDecl - Incomplete param type");
5667 QualType PType = PVDecl->getOriginalType();
5672 if (!isa<ConstantArrayType>(AT))
5673 PType = PVDecl->getType();
5675 PType = PVDecl->getType();
5689 bool Extended)
const {
5693 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
5704 bool Extended)
const {
5726 "getObjCEncodingForMethodDecl - Incomplete param type");
5734 ParmOffset = 2 * PtrSize;
5743 if (!isa<ConstantArrayType>(AT))
5748 PType,
S, Extended);
5759 const Decl *Container)
const {
5763 dyn_cast<ObjCCategoryImplDecl>(Container)) {
5764 for (
auto *PID : CID->property_impls())
5765 if (PID->getPropertyDecl() == PD)
5770 if (PID->getPropertyDecl() == PD)
5803 const Decl *Container)
const {
5805 bool Dynamic =
false;
5813 SynthesizePID = PropertyImpDecl;
5817 std::string
S =
"T";
5859 if (SynthesizePID) {
5875 if (isa<TypedefType>(PointeeTy.
getTypePtr())) {
5877 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
5880 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
5893 getObjCEncodingForTypeImpl(T, S,
true,
true, Field,
5894 true ,
false,
false,
5895 false,
false,
false, NotEncodedT);
5899 std::string&
S)
const {
5903 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
5911 case BuiltinType::Void:
return 'v';
5912 case BuiltinType::Bool:
return 'B';
5913 case BuiltinType::Char_U:
5914 case BuiltinType::UChar:
return 'C';
5915 case BuiltinType::Char16:
5916 case BuiltinType::UShort:
return 'S';
5917 case BuiltinType::Char32:
5918 case BuiltinType::UInt:
return 'I';
5919 case BuiltinType::ULong:
5921 case BuiltinType::UInt128:
return 'T';
5922 case BuiltinType::ULongLong:
return 'Q';
5923 case BuiltinType::Char_S:
5924 case BuiltinType::SChar:
return 'c';
5925 case BuiltinType::Short:
return 's';
5926 case BuiltinType::WChar_S:
5927 case BuiltinType::WChar_U:
5928 case BuiltinType::Int:
return 'i';
5929 case BuiltinType::Long:
5931 case BuiltinType::LongLong:
return 'q';
5932 case BuiltinType::Int128:
return 't';
5933 case BuiltinType::Float:
return 'f';
5934 case BuiltinType::Double:
return 'd';
5935 case BuiltinType::LongDouble:
return 'D';
5936 case BuiltinType::NullPtr:
return '*';
5938 case BuiltinType::Float128:
5939 case BuiltinType::Half:
5943 case BuiltinType::ObjCId:
5944 case BuiltinType::ObjCClass:
5945 case BuiltinType::ObjCSel:
5946 llvm_unreachable(
"@encoding ObjC primitive type");
5949 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
5950 case BuiltinType::Id:
5951 #include "clang/Basic/OpenCLImageTypes.def"
5952 case BuiltinType::OCLEvent:
5953 case BuiltinType::OCLClkEvent:
5954 case BuiltinType::OCLQueue:
5955 case BuiltinType::OCLReserveID:
5956 case BuiltinType::OCLSampler:
5957 case BuiltinType::Dependent:
5958 #define BUILTIN_TYPE(KIND, ID)
5959 #define PLACEHOLDER_TYPE(KIND, ID) \
5960 case BuiltinType::KIND:
5961 #include "clang/AST/BuiltinTypes.def"
5962 llvm_unreachable(
"invalid builtin type for @encode");
5964 llvm_unreachable(
"invalid BuiltinType::Kind value");
5981 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
6001 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
6010 S += llvm::utostr(Offset);
6023 void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string&
S,
6024 bool ExpandPointedToStructures,
6025 bool ExpandStructures,
6028 bool EncodingProperty,
6030 bool EncodeBlockParameters,
6031 bool EncodeClassNames,
6032 bool EncodePointerToObjCTypedef,
6035 switch (CT->getTypeClass()) {
6040 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CT))
6046 case Type::Complex: {
6049 getObjCEncodingForTypeImpl(CT->
getElementType(),
S,
false,
false,
nullptr);
6053 case Type::Atomic: {
6056 getObjCEncodingForTypeImpl(AT->
getValueType(),
S,
false,
false,
nullptr);
6062 case Type::LValueReference:
6063 case Type::RValueReference: {
6065 if (isa<PointerType>(CT)) {
6076 bool isReadOnly =
false;
6086 }
else if (OutermostType) {
6099 if (StringRef(S).endswith(
"nr"))
6100 S.replace(S.end()-2, S.end(),
"rn");
6112 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
6117 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
6126 getObjCEncodingForTypeImpl(PointeeTy, S,
false, ExpandPointedToStructures,
6127 nullptr,
false,
false,
false,
false,
false,
false,
6132 case Type::ConstantArray:
6133 case Type::IncompleteArray:
6134 case Type::VariableArray: {
6135 const ArrayType *AT = cast<ArrayType>(CT);
6137 if (isa<IncompleteArrayType>(AT) && !StructField) {
6142 false, ExpandStructures, FD);
6147 S += llvm::utostr(CAT->
getSize().getZExtValue());
6150 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
6151 "Unknown array type!");
6156 false, ExpandStructures, FD,
6157 false,
false,
false,
false,
false,
false,
6164 case Type::FunctionNoProto:
6165 case Type::FunctionProto:
6169 case Type::Record: {
6170 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
6171 S += RDecl->
isUnion() ?
'(' :
'{';
6176 = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
6178 llvm::raw_string_ostream OS(S);
6181 (*this).getPrintingPolicy());
6186 if (ExpandStructures) {
6189 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
6191 for (
const auto *Field : RDecl->
fields()) {
6194 S +=
Field->getNameAsString();
6199 if (
Field->isBitField()) {
6200 getObjCEncodingForTypeImpl(
Field->getType(),
S,
false,
true,
6205 getObjCEncodingForTypeImpl(qt, S,
false,
true,
6209 false,
false,
false, NotEncodedT);
6214 S += RDecl->
isUnion() ?
')' :
'}';
6218 case Type::BlockPointer: {
6221 if (EncodeBlockParameters) {
6226 getObjCEncodingForTypeImpl(
6227 FT->
getReturnType(),
S, ExpandPointedToStructures, ExpandStructures,
6228 FD,
false , EncodingProperty,
6229 false , EncodeBlockParameters, EncodeClassNames,
false,
6235 for (
const auto &
I : FPT->param_types())
6236 getObjCEncodingForTypeImpl(
6237 I, S, ExpandPointedToStructures, ExpandStructures, FD,
6238 false , EncodingProperty,
6239 false , EncodeBlockParameters, EncodeClassNames,
6240 false, NotEncodedT);
6247 case Type::ObjCObject: {
6251 S +=
"{objc_object=}";
6255 S +=
"{objc_class=}";
6262 case Type::ObjCInterface: {
6268 if (ExpandStructures) {
6272 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
6275 getObjCEncodingForTypeImpl(Field->
getType(),
S,
false,
true, Field);
6277 getObjCEncodingForTypeImpl(Field->
getType(),
S,
false,
true, FD,
6278 false,
false,
false,
false,
false,
6279 EncodePointerToObjCTypedef,
6287 case Type::ObjCObjectPointer: {
6304 ExpandPointedToStructures,
6305 ExpandStructures, FD);
6306 if (FD || EncodingProperty || EncodeClassNames) {
6310 for (
const auto *
I : OPT->
quals()) {
6312 S +=
I->getObjCRuntimeNameAsString();
6321 if (!EncodingProperty &&
6323 !EncodePointerToObjCTypedef) {
6333 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
6334 if (cast<FieldDecl>(Ivars[i]) == FD) {
6342 getObjCEncodingForTypeImpl(PointeeTy, S,
6343 false, ExpandPointedToStructures,
6345 false,
false,
false,
false,
false,
6352 (FD || EncodingProperty || EncodeClassNames)) {
6355 for (
const auto *
I : OPT->
quals()) {
6357 S +=
I->getObjCRuntimeNameAsString();
6367 case Type::MemberPointer:
6371 case Type::ExtVector:
6381 case Type::DeducedTemplateSpecialization:
6385 #define ABSTRACT_TYPE(KIND, BASE)
6386 #define TYPE(KIND, BASE)
6387 #define DEPENDENT_TYPE(KIND, BASE) \
6389 #define NON_CANONICAL_TYPE(KIND, BASE) \
6391 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \
6393 #include "clang/AST/TypeNodes.def"
6394 llvm_unreachable(
"@encode for dependent type!");
6396 llvm_unreachable(
"bad type kind!");
6399 void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
6404 assert(RDecl &&
"Expected non-null RecordDecl");
6405 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
6410 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
6414 for (
const auto &BI : CXXRec->
bases()) {
6415 if (!BI.isVirtual()) {
6420 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6421 std::make_pair(offs, base));
6427 for (
auto *Field : RDecl->
fields()) {
6429 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6430 std::make_pair(offs, Field));
6434 if (CXXRec && includeVBases) {
6435 for (
const auto &BI : CXXRec->
vbases()) {
6441 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
6442 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
6443 std::make_pair(offs, base));
6455 uint64_t CurOffs = 0;
6457 std::multimap<uint64_t, NamedDecl *>::iterator
6458 CurLayObj = FieldOrBaseOffsets.begin();
6461 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
6465 if (recname.empty()) recname =
"?";
6477 uint64_t offs =
toBits(size);
6478 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6479 std::make_pair(offs,
nullptr));
6482 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
6484 assert(CurOffs <= CurLayObj->first);
6485 if (CurOffs < CurLayObj->first) {
6486 uint64_t padding = CurLayObj->first - CurOffs;
6507 getObjCEncodingForStructureImpl(base, S, FD,
false,
6514 FieldDecl *field = cast<FieldDecl>(dcl);
6529 getObjCEncodingForTypeImpl(qt, S,
false,
true, FD,
6533 false,
false,
false, NotEncodedT);
6543 std::string& S)
const {
6576 if (!ObjCClassDecl) {
6581 return ObjCClassDecl;
6585 if (!ObjCProtocolClassDecl) {
6586 ObjCProtocolClassDecl
6595 return ObjCProtocolClassDecl;
6641 const size_t NumFields = 5;
6643 const char *FieldNames[NumFields];
6647 FieldNames[0] =
"__stack";
6651 FieldNames[1] =
"__gr_top";
6655 FieldNames[2] =
"__vr_top";
6658 FieldTypes[3] = Context->
IntTy;
6659 FieldNames[3] =
"__gr_offs";
6662 FieldTypes[4] = Context->
IntTy;
6663 FieldNames[4] =
"__vr_offs";
6666 for (
unsigned i = 0; i < NumFields; ++i) {
6672 FieldTypes[i],
nullptr,
6677 VaListTagDecl->
addDecl(Field);
6694 const size_t NumFields = 5;
6696 const char *FieldNames[NumFields];
6700 FieldNames[0] =
"gpr";
6704 FieldNames[1] =
"fpr";
6708 FieldNames[2] =
"reserved";
6712 FieldNames[3] =
"overflow_arg_area";
6716 FieldNames[4] =
"reg_save_area";
6719 for (
unsigned i = 0; i < NumFields; ++i) {
6724 FieldTypes[i],
nullptr,
6729 VaListTagDecl->
addDecl(Field);
6757 const size_t NumFields = 4;
6759 const char *FieldNames[NumFields];
6763 FieldNames[0] =
"gp_offset";
6767 FieldNames[1] =
"fp_offset";
6771 FieldNames[2] =
"overflow_arg_area";
6775 FieldNames[3] =
"reg_save_area";
6778 for (
unsigned i = 0; i < NumFields; ++i) {
6784 FieldTypes[i],
nullptr,
6789 VaListTagDecl->
addDecl(Field);
6860 const size_t NumFields = 4;
6862 const char *FieldNames[NumFields];
6865 FieldTypes[0] = Context->
LongTy;
6866 FieldNames[0] =
"__gpr";
6869 FieldTypes[1] = Context->
LongTy;
6870 FieldNames[1] =
"__fpr";
6874 FieldNames[2] =
"__overflow_arg_area";
6878 FieldNames[3] =
"__reg_save_area";
6881 for (
unsigned i = 0; i < NumFields; ++i) {
6887 FieldTypes[i],
nullptr,
6892 VaListTagDecl->
addDecl(Field);
6929 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
6933 if (!BuiltinVaListDecl) {
6938 return BuiltinVaListDecl;
6951 if (!BuiltinMSVaListDecl)
6954 return BuiltinMSVaListDecl;
6958 assert(ObjCConstantStringType.
isNull() &&
6959 "'NSConstantString' type already set!");
6969 unsigned size = End -
Begin;
6970 assert(size > 1 &&
"set is not overloaded!");
6979 assert(isa<FunctionTemplateDecl>(D) ||
6980 (isa<UsingShadowDecl>(D) &&
6992 bool TemplateKeyword,
6994 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
6997 llvm::FoldingSetNodeID
ID;
7000 void *InsertPos =
nullptr;
7002 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7006 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
7018 "Nested name specifier must be dependent");
7020 llvm::FoldingSetNodeID
ID;
7023 void *InsertPos =
nullptr;
7025 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7031 if (CanonNNS == NNS) {
7039 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7040 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
7044 DependentTemplateNames.InsertNode(QTN, InsertPos);
7054 "Nested name specifier must be dependent");
7056 llvm::FoldingSetNodeID
ID;
7059 void *InsertPos =
nullptr;
7061 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7067 if (CanonNNS == NNS) {
7076 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7077 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
7081 DependentTemplateNames.InsertNode(QTN, InsertPos);
7088 llvm::FoldingSetNodeID
ID;
7091 void *insertPos =
nullptr;
7093 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
7097 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
7107 llvm::FoldingSetNodeID
ID;
7110 void *InsertPos =
nullptr;
7112 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
7118 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
7142 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
7172 while (
const ArrayType *AT = dyn_cast<ArrayType>(CT))
7195 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
7196 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
7239 assert ((lhsQID && rhsOPT) &&
"ObjCQualifiedClassTypesAreCompatible");
7241 for (
auto *lhsProto : lhsQID->
quals()) {
7243 for (
auto *rhsProto : rhsOPT->quals()) {
7270 if (!rhsOPT)
return false;
7276 for (
auto *
I : lhsQID->quals()) {
7280 if (!rhsID->ClassImplementsProtocol(
I,
true))
7288 for (
auto *lhsProto : lhsQID->quals()) {
7294 for (
auto *rhsProto : rhsOPT->
quals()) {
7304 for (
auto *
I : lhsQID->quals()) {
7308 if (rhsID->ClassImplementsProtocol(
I,
true)) {
7322 assert(rhsQID &&
"One of the LHS/RHS should be id<x>");
7327 for (
auto *lhsProto : lhsOPT->quals()) {
7335 for (
auto *rhsProto : rhsQID->
quals()) {
7349 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSInheritedProtocols;
7354 if (LHSInheritedProtocols.empty() && lhsOPT->qual_empty())
7356 for (
auto *lhsProto : LHSInheritedProtocols) {
7358 for (
auto *rhsProto : rhsQID->
quals()) {
7390 auto finish = [&](
bool succeeded) ->
bool {
7430 bool BlockReturnType) {
7434 auto finish = [&](
bool succeeded) ->
bool {
7468 return finish(BlockReturnType);
7470 return finish(!BlockReturnType);
7482 return (*lhs)->getName().compare((*rhs)->getName());
7500 assert(LHS->
getInterface() &&
"LHS must have an interface base");
7501 assert(RHS->
getInterface() &&
"RHS must have an interface base");
7504 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSProtocolSet;
7507 for (
auto proto : LHS->
quals()) {
7515 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> RHSProtocolSet;
7518 for (
auto proto : RHS->
quals()) {
7526 for (
auto proto : LHSProtocolSet) {
7527 if (RHSProtocolSet.count(proto))
7528 IntersectionSet.push_back(proto);
7533 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ImpliedProtocols;
7537 if (!ImpliedProtocols.empty()) {
7538 IntersectionSet.erase(
7539 std::remove_if(IntersectionSet.begin(),
7540 IntersectionSet.end(),
7542 return ImpliedProtocols.count(proto) > 0;
7544 IntersectionSet.end());
7548 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
7558 if (lhsOPT && rhsOPT)
7564 if (lhsBlock && rhsBlock)
7570 (rhsOPT && rhsOPT->isObjCIdType() && lhsBlock))
7582 if (lhsArgs.size() != rhsArgs.size())
7586 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
7593 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
7594 rhsArgs[i].stripObjCKindOfType(ctx))) {
7622 if (!LDecl || !RDecl)
7632 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
7642 bool anyChanges =
false;
7660 if (!Protocols.empty())
7678 if (LHSSuperType.
isNull())
7688 if (KnownLHS != LHSAncestors.end()) {
7689 LHS = KnownLHS->second;
7693 bool anyChanges =
false;
7711 if (!Protocols.empty())
7728 if (RHSSuperType.
isNull())
7739 assert(LHS->
getInterface() &&
"LHS is not an interface type");
7740 assert(RHS->
getInterface() &&
"RHS is not an interface type");
7757 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> SuperClassInheritedProtocols;
7761 for (
auto *RHSPI : RHS->
quals())
7764 if (SuperClassInheritedProtocols.empty())
7767 for (
const auto *LHSProto : LHS->
quals()) {
7768 bool SuperImplementsProtocol =
false;
7769 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
7770 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
7771 SuperImplementsProtocol =
true;
7774 if (!SuperImplementsProtocol)
7804 if (!LHSOPT || !RHSOPT)
7822 bool CompareUnqualified) {
7841 bool OfBlockPointer,
7845 if (UD->
hasAttr<TransparentUnionAttr>()) {
7846 for (
const auto *
I : UD->
fields()) {
7847 QualType ET =
I->getType().getUnqualifiedType();
7861 bool OfBlockPointer,
7876 return mergeTypes(lhs, rhs, OfBlockPointer, Unqualified);
7880 bool OfBlockPointer,
7886 bool allLTypes =
true;
7887 bool allRTypes =
true;
7891 if (OfBlockPointer) {
7892 QualType RHS = rbase->getReturnType();
7894 bool UnqualifiedResult = Unqualified;
7895 if (!UnqualifiedResult)
7897 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
7951 if (lproto && rproto) {
7952 assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
7953 "C++ shouldn't be here");
7955 if (lproto->getNumParams() != rproto->getNumParams())
7959 if (lproto->isVariadic() != rproto->isVariadic())
7962 if (lproto->getTypeQuals() != rproto->getTypeQuals())
7970 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
7971 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
7972 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
7974 lParamType, rParamType, OfBlockPointer, Unqualified);
7981 types.push_back(paramType);
7993 if (allLTypes)
return lhs;
7994 if (allRTypes)
return rhs;
8001 if (lproto) allRTypes =
false;
8002 if (rproto) allLTypes =
false;
8013 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
8019 paramTy = Enum->getDecl()->getIntegerType();
8029 if (allLTypes)
return lhs;
8030 if (allRTypes)
return rhs;
8037 if (allLTypes)
return lhs;
8038 if (allRTypes)
return rhs;
8044 QualType other,
bool isBlockReturnType) {
8064 bool OfBlockPointer,
8065 bool Unqualified,
bool BlockReturnType) {
8083 if (LHSCan == RHSCan)
8088 Qualifiers RQuals = RHSCan.getLocalQualifiers();
8089 if (LQuals != RQuals) {
8105 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
8126 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
8127 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
8130 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
8131 LHSClass = Type::ConstantArray;
8132 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
8133 RHSClass = Type::ConstantArray;
8136 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
8137 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
8140 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
8141 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
8144 if (LHSClass != RHSClass) {
8154 if (OfBlockPointer && !BlockReturnType) {
8166 #define TYPE(Class, Base)
8167 #define ABSTRACT_TYPE(Class, Base)
8168 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
8169 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
8170 #define DEPENDENT_TYPE(Class, Base) case Type::Class:
8171 #include "clang/AST/TypeNodes.def"
8172 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
8175 case Type::DeducedTemplateSpecialization:
8176 case Type::LValueReference:
8177 case Type::RValueReference:
8178 case Type::MemberPointer:
8179 llvm_unreachable(
"C++ should never be in mergeTypes");
8181 case Type::ObjCInterface:
8182 case Type::IncompleteArray:
8183 case Type::VariableArray:
8184 case Type::FunctionProto:
8185 case Type::ExtVector:
8186 llvm_unreachable(
"Types are eliminated above");
8206 case Type::BlockPointer:
8256 case Type::ConstantArray:
8303 case Type::FunctionNoProto:
8320 case Type::ObjCObject: {
8331 case Type::ObjCObjectPointer: {
8332 if (OfBlockPointer) {
8348 assert(LHS != RHS &&
8349 "Equivalent pipe types should have already been handled!");
8354 llvm_unreachable(
"Invalid Type::Class!");
8371 assert(firstEPI.size() == secondEPI.size());
8373 for (
size_t i = 0, n = firstEPI.size(); i != n; ++i) {
8374 if (firstEPI[i] != secondEPI[i])
8381 ObjCLayouts[CD] =
nullptr;
8391 if (LHSCan == RHSCan)
8393 if (RHSCan->isFunctionType()) {
8397 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
8399 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
8402 if (ResReturnType.
isNull())
8404 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
8421 Qualifiers RQuals = RHSCan.getLocalQualifiers();
8422 if (LQuals != RQuals) {
8435 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
8451 if (ResQT == LHSBaseQT)
8453 if (ResQT == RHSBaseQT)
8465 T = ET->getDecl()->getIntegerType();
8478 VTy->getNumElements(), VTy->getVectorKind());
8482 T = ETy->getDecl()->getIntegerType();
8485 assert(BTy &&
"Unexpected signed integer type");
8487 case BuiltinType::Char_S:
8488 case BuiltinType::SChar:
8490 case BuiltinType::Short:
8492 case BuiltinType::Int:
8494 case BuiltinType::Long:
8496 case BuiltinType::LongLong:
8498 case BuiltinType::Int128:
8501 llvm_unreachable(
"Unexpected signed integer type");
8525 bool AllowTypeModifiers) {
8528 bool Signed =
false, Unsigned =
false;
8529 RequiresICE =
false;
8534 bool IsSpecialLong =
false;
8538 default: Done =
true; --Str;
break;
8543 assert(!Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
8544 assert(!Signed &&
"Can't use 'S' modifier multiple times!");
8548 assert(!Signed &&
"Can't use both 'S' and 'U' modifiers!");
8549 assert(!Unsigned &&
"Can't use 'U' modifier multiple times!");
8553 assert(!IsSpecialLong &&
"Can't use 'L' with 'W' or 'N' modifiers");
8554 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
8559 assert(!IsSpecialLong &&
"Can't use two 'N' or 'W' modifiers!");
8560 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
8562 IsSpecialLong =
true;
8570 assert(!IsSpecialLong &&
"Can't use two 'N' or 'W' modifiers!");
8571 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
8573 IsSpecialLong =
true;
8577 llvm_unreachable(
"Unexpected integer type");
8593 default: llvm_unreachable(
"Unknown builtin type letter!");
8595 assert(HowLong == 0 && !Signed && !Unsigned &&
8596 "Bad modifiers used with 'v'!");
8600 assert(HowLong == 0 && !Signed && !Unsigned &&
8601 "Bad modifiers used with 'h'!");
8605 assert(HowLong == 0 && !Signed && !Unsigned &&
8606 "Bad modifiers used with 'f'!");
8610 assert(HowLong < 2 && !Signed && !Unsigned &&
8611 "Bad modifiers used with 'd'!");
8618 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
8627 else if (HowLong == 2)
8629 else if (HowLong == 1)
8635 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
8644 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'b'!");
8648 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'z'!");
8652 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'w'!");
8669 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
8681 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
8689 unsigned NumElements = strtoul(Str, &End, 10);
8690 assert(End != Str &&
"Missing vector size");
8694 RequiresICE,
false);
8695 assert(!RequiresICE &&
"Can't require vector ICE");
8705 unsigned NumElements = strtoul(Str, &End, 10);
8706 assert(End != Str &&
"Missing vector size");
8718 assert(!RequiresICE &&
"Can't require complex ICE");
8745 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'K'!");
8759 Done = !AllowTypeModifiers;
8761 switch (
char c = *Str++) {
8762 default: Done =
true; --Str;
break;
8768 unsigned AddrSpace = strtoul(Str, &End, 10);
8769 if (End != Str && AddrSpace != 0) {
8794 "Integer constant 'I' type must be an integer");
8802 unsigned *IntegerConstantArgs)
const {
8807 bool RequiresICE =
false;
8814 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
8816 while (TypeStr[0] && TypeStr[0] !=
'.') {
8823 if (RequiresICE && IntegerConstantArgs)
8824 *IntegerConstantArgs |= 1 << ArgTypes.size();
8830 ArgTypes.push_back(Ty);
8833 if (Id == Builtin::BI__GetExceptionInfo)
8836 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
8837 "'.' should only occur at end of builtin type list!");
8842 bool Variadic = (TypeStr[0] ==
'.');
8845 if (ArgTypes.empty() && Variadic && !
getLangOpts().CPlusPlus)
8892 !FD->
hasAttr<DLLExportAttr>()) ||
8893 FD->
hasAttr<GNUInlineAttr>()) {
8918 if (D->
hasAttr<DLLImportAttr>()) {
8921 }
else if (D->
hasAttr<DLLExportAttr>()) {
8925 D->
hasAttr<CUDAGlobalAttr>()) {
8939 EK = Ext->hasExternalDefinitions(FD);
8960 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
8965 if (!LexicalContext)
8970 auto StaticLocalLinkage =
8982 return StaticLocalLinkage;
9009 return StrongLinkage;
9027 llvm_unreachable(
"Invalid Linkage!");
9036 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
9037 if (!VD->isFileVarDecl())
9042 if (VD->getDescribedVarTemplate() ||
9043 isa<VarTemplatePartialSpecializationDecl>(VD))
9045 }
else if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
9049 }
else if (isa<PragmaCommentDecl>(D))
9051 else if (isa<OMPThreadPrivateDecl>(D) ||
9052 D->
hasAttr<OMPDeclareTargetDeclAttr>())
9054 else if (isa<PragmaDetectMismatchDecl>(D))
9056 else if (isa<OMPThreadPrivateDecl>(D))
9058 else if (isa<OMPDeclareReductionDecl>(D))
9060 else if (isa<ImportDecl>(D))
9070 if (D->
hasAttr<WeakRefAttr>())
9077 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
9079 if (!FD->doesThisDeclarationHaveABody())
9080 return FD->doesDeclarationForceExternallyVisibleDefinition();
9083 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
9089 if (
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
9107 const VarDecl *VD = cast<VarDecl>(D);
9130 if (
auto *DD = dyn_cast<DecompositionDecl>(VD))
9131 for (
auto *BD : DD->bindings())
9132 if (
auto *BindingVD = BD->getHoldingVar())
9140 bool IsCXXMethod)
const {
9143 return ABI->getDefaultMethodCallConv(IsVariadic);
9145 switch (LangOpts.getDefaultCallingConv()) {
9169 return ABI->isNearlyEmpty(RD);
9173 if (!VTContext.get()) {
9179 return VTContext.get();
9196 llvm_unreachable(
"Unsupported ABI");
9202 return ASTRecordLayouts.getMemorySize() +
9203 llvm::capacity_in_bytes(ObjCLayouts) +
9204 llvm::capacity_in_bytes(KeyFunctions) +
9205 llvm::capacity_in_bytes(ObjCImpls) +
9206 llvm::capacity_in_bytes(BlockVarCopyInits) +
9207 llvm::capacity_in_bytes(DeclAttrs) +
9208 llvm::capacity_in_bytes(TemplateOrInstantiation) +
9209 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
9210 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
9211 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
9212 llvm::capacity_in_bytes(OverriddenMethods) +
9213 llvm::capacity_in_bytes(Types) +
9214 llvm::capacity_in_bytes(VariableArrayTypes) +
9215 llvm::capacity_in_bytes(ClassScopeSpecializationPattern);
9223 unsigned Signed)
const {
9226 if (!QualTy && DestWidth == 128)
9249 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
9254 MangleNumbers[ND] = Number;
9258 auto I = MangleNumbers.find(ND);
9259 return I != MangleNumbers.end() ?
I->second : 1;
9264 StaticLocalNumbers[VD] = Number;
9268 auto I = StaticLocalNumbers.find(VD);
9269 return I != StaticLocalNumbers.end() ?
I->second : 1;
9274 assert(LangOpts.CPlusPlus);
9275 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
9281 std::unique_ptr<MangleNumberingContext>
9283 return ABI->createMangleNumberingContext();
9288 return ABI->getCopyConstructorForExceptionObject(
9294 return ABI->addCopyConstructorForExceptionObject(
9301 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
9306 return ABI->getTypedefNameForUnnamedTagDecl(TD);
9311 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
9315 return ABI->getDeclaratorForUnnamedTagDecl(TD);
9319 ParamIndices[D] = index;
9323 ParameterIndexTable::const_iterator
I = ParamIndices.find(D);
9324 assert(I != ParamIndices.end() &&
9325 "ParmIndices lacks entry set by ParmVarDecl");
9333 "don't need to cache the computed value for this temporary");
9335 APValue *&MTVI = MaterializedTemporaryValues[
E];
9341 return MaterializedTemporaryValues.lookup(E);
9346 if (!T.isOSDarwin())
9349 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
9350 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
9359 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
9365 ASTContext::ParentMapPointers::mapped_type U) {
9366 if (
const auto *D = U.dyn_cast<
const Decl *>())
9368 if (
const auto *S = U.dyn_cast<
const Stmt *>())
9375 template <
typename T>
9408 Visitor.TraverseDecl(&TU);
9409 return std::make_pair(Visitor.Parents, Visitor.OtherParents);
9417 : Parents(Parents), OtherParents(OtherParents) {}
9419 bool shouldVisitTemplateInstantiations()
const {
9422 bool shouldVisitImplicitCode()
const {
9426 template <
typename T,
typename MapNodeTy,
typename BaseTraverseFn,
9428 bool TraverseNode(T
Node, MapNodeTy MapNode,
9429 BaseTraverseFn BaseTraverse,
MapTy *Parents) {
9432 if (ParentStack.size() > 0) {
9443 auto &NodeOrVector = (*Parents)[MapNode];
9444 if (NodeOrVector.isNull()) {
9445 if (
const auto *D = ParentStack.back().get<Decl>())
9447 else if (
const auto *S = ParentStack.back().get<
Stmt>())
9453 if (!NodeOrVector.template is<ASTContext::ParentVector *>()) {
9455 1, getSingleDynTypedNodeFromParentMap(NodeOrVector));
9458 NodeOrVector = Vector;
9462 NodeOrVector.template get<ASTContext::ParentVector *>();
9468 std::find(Vector->begin(), Vector->end(),
9469 ParentStack.back()) != Vector->end();
9471 Vector->push_back(ParentStack.back());
9474 ParentStack.push_back(createDynTypedNode(Node));
9475 bool Result = BaseTraverse();
9476 ParentStack.pop_back();
9480 bool TraverseDecl(Decl *DeclNode) {
9481 return TraverseNode(DeclNode, DeclNode,
9482 [&] {
return VisitorBase::TraverseDecl(DeclNode); },
9486 bool TraverseStmt(
Stmt *StmtNode) {
9487 return TraverseNode(StmtNode, StmtNode,
9488 [&] {
return VisitorBase::TraverseStmt(StmtNode); },
9492 bool TraverseTypeLoc(
TypeLoc TypeLocNode) {
9493 return TraverseNode(
9495 [&] {
return VisitorBase::TraverseTypeLoc(TypeLocNode); },
9500 return TraverseNode(
9503 return VisitorBase::TraverseNestedNameSpecifierLoc(NNSLocNode);
9517 template <
typename NodeTy,
typename MapTy>
9520 auto I = Map.find(Node);
9521 if (
I == Map.end()) {
9524 if (
auto *V =
I->second.template dyn_cast<ASTContext::ParentVector *>()) {
9525 return llvm::makeArrayRef(*V);
9527 return getSingleDynTypedNodeFromParentMap(
I->second);
9532 if (!PointerParents) {
9536 PointerParents.reset(Maps.first);
9537 OtherParents.reset(Maps.second);
9548 if (MethodDecl->
hasAttr<UnavailableAttr>()
9549 || MethodDecl->
hasAttr<DeprecatedAttr>())
9563 IM != EM && IF != EF; ++IM, ++IF) {
9589 return (*AddrSpaceMap)[AS];
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
bool isObjCSelType() const
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
Internal representation of canonical, dependent typeof(expr) types.
unsigned getNumElements() const
bool hasObjCGCAttr() const
unsigned getAddressSpace() const
Return the address space of this type.
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
static bool canAssignObjCObjectTypes(ASTContext &ctx, QualType lhs, QualType rhs)
Determine whether the first type is a subtype of the second.
param_const_iterator param_begin() const
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i...
static void EncodeBitField(const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
void Profile(llvm::FoldingSetNodeID &ID) const
bool hasDefinition() const
Determine whether this class has been defined.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType) 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...
Defines the clang::ASTContext interface.
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
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
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
const Type * Ty
The locally-unqualified type.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
static bool isTypeTypedefedAsBOOL(QualType T)
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
static const Decl * getCanonicalDecl(const Decl *D)
RealType getRealTypeByWidth(unsigned BitWidth) const
Return floating point type with specified width.
void setImplicit(bool I=true)
FunctionDecl - An instance of this class is created to represent 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::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
unsigned getSimdDefaultAlign() const
Return default simd alignment for the given target.
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
bool isNullPtrType() const
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
protocol_range protocols() const
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
no exception specification
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
PointerType - C99 6.7.5.1 - Pointer Declarators.
CanQualType LongDoubleComplexTy
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
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...
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
TemplateName getReplacement() const
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
SourceRange getBracketsRange() const
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
bool isBitField() const
Determines whether this field is a bitfield.
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins)
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
bool isMemberPointerType() const
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
void getOverriddenMethods(SmallVectorImpl< const ObjCMethodDecl * > &Overridden) const
Return overridden methods for the given Method.
InlineVariableDefinitionKind
static unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built...
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=TTK_Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
unsigned getFastQualifiers() const
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
static unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
Stmt - This represents one statement.
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
void setLAngleLoc(SourceLocation Loc)
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
FunctionType - C99 6.7.5.3 - Function Declarators.
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
unsigned getChar16Width() const
getChar16Width/Align - Return the size of 'char16_t' for this target, in bits.
void Profile(llvm::FoldingSetNodeID &ID)
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
unsigned getIntWidth(QualType T) const
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth, signed/unsigned.
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
Defines the SourceManager interface.
void Profile(llvm::FoldingSetNodeID &ID)
static const Builtin::Info BuiltinInfo[]
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
static unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
Represents a qualified type name for which the type name is dependent.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
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)
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
CanQualType FloatComplexTy
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
RawCommentList Comments
All comments in this translation unit.
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
bool isRecordType() const
QualType getUnderlyingType() const
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
Decl - This represents one declaration (or definition), e.g.
static QualType getFunctionTypeWithExceptionSpec(ASTContext &Context, QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI)
Get a function type and produce the equivalent function type with the specified exception specificati...
EnumDecl * getPreviousDecl()
CanQualType ObjCBuiltinSelTy
bool isDiscardableGVALinkage(GVALinkage L)
IntType getSizeType() const
virtual uint64_t getNullPointerValue(unsigned AddrSpace) const
Get integer value for null pointer.
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
Defines the C++ template declaration subclasses.
unsigned getChar16Align() const
bool isVoidPointerType() const
Represents a C++11 auto or C++14 decltype(auto) type.
const Expr * getRequiresClause() const
Get the constraint-expression from the associated requires-clause (if any)
bool isObjCQualifiedId() const
bool hasFlexibleArrayMember() const
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
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 getLargeArrayAlign() const
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
CanQualType ARCUnbridgedCastTy
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type...
QualType getPointeeType() const
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...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
QualType getRecordType(const RecordDecl *Decl) const
std::unique_ptr< llvm::MemoryBuffer > Buffer
Represents an array type, per C99 6.7.5.2 - Array Declarators.
const Expr * getInit() const
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
NamespaceDecl - Represent a C++ namespace.
static void PrintTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy, bool SkipBrackets=false)
Print a template argument list, including the '<' and '>' enclosing the template arguments...
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl * > &Protocols)
void Profile(llvm::FoldingSetNodeID &ID)
virtual void completeDefinition()
completeDefinition - Notes that the definition of this type is now complete.
ObjCDeclQualifier getObjCDeclQualifier() const
bool isBooleanType() const
A container of type source information.
llvm::DenseMap< Stmt *, Stmt * > MapTy
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
bool isBlockPointerType() const
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
Represents a C++ constructor within a class.
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
bool isSpelledAsLValue() const
A template template parameter that has been substituted for some other template name.
unsigned getBoolAlign() const
Return the alignment of '_Bool' and C++ 'bool' for this target.
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
const llvm::APInt & getSize() const
unsigned getFloat128Align() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
void * getAsOpaquePtr() const
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl * > &Redeclared)
An identifier, stored as an IdentifierInfo*.
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
static const Type * getIntegerTypeForEnum(const EnumType *ET)
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
unsigned getChar32Width() const
getChar32Width/Align - Return the size of 'char32_t' for this target, in bits.
const RawComment * getRaw() const LLVM_READONLY
VarDecl - An instance of this class is created to represent a variable declaration or definition...
bool isFileVarDecl() const
isFileVarDecl - Returns true for file scoped variable declaration.
QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize, QualType typeDomain) const
Return a real floating point or a complex type (based on typeDomain/typeSize).
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type...
void removeObjCLifetime()
RecordDecl * getPreviousDecl()
ObjCLifetime getObjCLifetime() const
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
void setClassScopeSpecializationPattern(FunctionDecl *FD, FunctionDecl *Pattern)
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration...
MangleContext * createMangleContext()
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
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++.
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
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
ObjCMethodDecl - Represents an instance or class method declaration.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
unsigned getFloat128Width() const
getFloat128Width/Align/Format - Return the size/align/format of '__float128'.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or NULL if none exists.
A namespace, stored as a NamespaceDecl*.
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class...
void addAddressSpace(unsigned space)
void setRaw(const RawComment *RC)
unsigned getLongDoubleWidth() const
getLongDoubleWidth/Align/Format - Return the size/align/format of 'long double'.
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
Qualifiers getIndexTypeQualifiers() const
unsigned param_size() const
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
TemplateTemplateParmDecl * getParameter() const
ParmVarDecl - Represents a parameter to a function.
bool isObjCRetainableType() const
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
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.
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.
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
static TypedefDecl * CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context)
unsigned getFloatAlign() const
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.
QualType withConst() const
Retrieves a version of this type with const applied.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
unsigned getStaticLocalNumber(const VarDecl *VD) const
unsigned getLargeArrayMinWidth() const
Base wrapper for a particular "section" of type source info.
unsigned getNumParams() const
RecordDecl - Represents a struct/union/class.
bool doFunctionTypesMatchOnExtParameterInfos(const FunctionProtoType *FromFunctionType, const FunctionProtoType *ToFunctionType)
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class...
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
Loading virtual member pointers using the virtual inheritance model always results in an adjustment u...
unsigned getMaxAlignment() const
getMaxAlignment - return the maximum alignment specified by attributes on this decl, 0 if there are none.
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
param_const_iterator sel_param_end() const
FunctionType::ExtInfo ExtInfo
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
One of these records is kept for each identifier that is lexed.
Represents a class template specialization, which refers to a class template with a given set of temp...
unsigned getIndexTypeCVRQualifiers() const
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
This table allows us to fully hide how we implement multi-keyword caching.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl * > &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
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)
qual_iterator qual_begin() const
void setManglingNumber(const NamedDecl *ND, unsigned Number)
Expr * getSizeExpr() const
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
CXXRecordDecl * getPreviousDecl()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
unsigned getNumArgs() const
static int compare(DeclarationName LHS, DeclarationName RHS)
ArrayRef< QualType > getParamTypes() const
bool isIdentifier() const
Determine whether this template name refers to an identifier.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
Missing a type from <ucontext.h>
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
QualType getAddrSpaceQualType(QualType T, unsigned AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
QualType getReturnType() const
The generic Mips ABI is a modified version of the Itanium ABI.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
bool isAnyPointerType() const
DynTypedNodeList getParents(const NodeT &Node)
Returns the parents of the given node.
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.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
void Profile(llvm::FoldingSetNodeID &ID)
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) 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...
QualType getBlockDescriptorType() const
Gets the struct used to keep track of the descriptor for pointer to blocks.
void startDefinition()
Starts the definition of this tag declaration.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
unsigned getCVRQualifiers() const
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
The iterator over UnresolvedSets.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
Represents the result of substituting a set of types for a template type parameter pack...
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...
Container for either a single DynTypedNode or for an ArrayRef to DynTypedNode.
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
QualType getTypeOfType(QualType t) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes...
unsigned getAsOpaqueValue() const
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
CanQualType OCLReserveIDTy
unsigned getRegParm() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
void Profile(llvm::FoldingSetNodeID &ID)
static TypedefDecl * CreateCharPtrNamedVaListDecl(const ASTContext *Context, StringRef Name)
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
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...
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
bool isNearlyEmpty(const CXXRecordDecl *RD) const
virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const
Gets the default calling convention for the given target and declaration context. ...
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
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.
An rvalue reference type, per C++11 [dcl.ref].
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...
QualType getParenType(QualType NamedType) const
CanQualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t. ...
A qualified template name, where the qualification is kept to describe the source code as written...
const TargetInfo & getTargetInfo() const
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
bool UnwrapSimilarPointerTypes(QualType &T1, QualType &T2)
UnwrapSimilarPointerTypes - If T1 and T2 are pointer types that may be similar (C++ 4...
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
QualType getOriginalType() const
ObjCContainerDecl - Represents a container for method declarations.
const LangOptions & getLangOpts() const
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
void addObjCGCAttr(GC type)
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
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.
const llvm::fltSemantics & getDoubleFormat() const
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
QualType getBaseType() const
Gets the base type of this object type.
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers).
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
QualType getReturnType() const
unsigned getLongDoubleAlign() const
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
IdentifierInfo * getTypePackElementName() const
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
IntType getIntMaxType() const
field_range fields() const
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool hasPointerIdentity() const
Check if the given ASTNodeKind identifies a type that offers pointer identity.
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
Concrete class used by the front-end to report problems and issues.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
Represents a typeof (or typeof) expression (a GCC extension).
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
TypeDecl - Represents a declaration of a type.
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
CanQualType PseudoObjectTy
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
RecordDecl * getDecl() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
Selector getSetterName() const
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
void Profile(llvm::FoldingSetNodeID &ID)
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
Expr * IgnoreParenCasts() LLVM_READONLY
IgnoreParenCasts - Ignore parentheses and casts.
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
unsigned getDoubleAlign() const
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
SourceLocation getRAngleLoc() const
SplitQualType split() const
TypeClass getTypeClass() const
Represents an Objective-C protocol declaration.
static unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built...
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
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 isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
A class that does preordor or postorder depth-first traversal on the entire Clang AST and visits each...
Represents an ObjC class declaration.
propimpl_range property_impls() const
detail::InMemoryDirectory::const_iterator I
PropertyAttributeKind getPropertyAttributes() const
The iOS ABI is a partial implementation of the ARM ABI.
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type...
QualType getCanonicalTypeInternal() const
unsigned getWCharWidth() const
getWCharWidth/Align - Return the size of 'wchar_t' for this target, in bits.
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
unsigned getHalfAlign() const
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
IntrusiveRefCntPtr< ExternalASTSource > ExternalSource
CanQualType UnsignedCharTy
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
static char getObjCEncodingForPrimitiveKind(const ASTContext *C, BuiltinType::Kind kind)
unsigned getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of 'half'.
Represents an extended vector type where either the type or size is dependent.
This object can be modified without requiring retains or releases.
DiagnosticsEngine & getDiagnostics() const
unsigned getPreferredTypeAlign(const Type *T) const
Return the "preferred" alignment of the specified type T for the current target, in bits...
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
EnumDecl * getDecl() const
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
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
void Profile(llvm::FoldingSetNodeID &ID)
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
const ParmVarDecl *const * param_const_iterator
ExtInfo getExtInfo() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
QualType getParamType(unsigned i) const
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...
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
static unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
Represents a ValueDecl that came out of a declarator.
DeclarationNameTable DeclarationNames
A dependent template name that has not been resolved to a template (or set of templates).
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.
ArraySizeModifier
Capture whether this is a normal array (e.g.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
ObjCDeclQualifier getObjCDeclQualifier() const
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
void setCFConstantStringType(QualType T)
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
bool getNoCallerSavedRegs() const
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
unsigned getCharAlign() const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
void Profile(llvm::FoldingSetNodeID &ID)
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
std::pair< CharUnits, CharUnits > getTypeInfoDataSizeInChars(QualType T) const
bool hasUnaligned() const
bool isRealFloatingType() const
Floating point categories.
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
typedef void* __builtin_va_list;
Exposes information about the current target.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
bool isKindOfType() const
Whether this is a "__kindof" type.
Represents an array type in C++ whose size is a value-dependent expression.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
CommentOptions CommentOpts
Options for parsing comments.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
QualType getPointeeType() const
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
QualType getBlockDescriptorExtendedType() const
Gets the struct used to keep track of the extended descriptor for pointer to blocks.
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
Qualifiers getQualifiers() const
Retrieve all qualifiers.
void ResetObjCLayout(const ObjCContainerDecl *CD)
IntType getIntPtrType() const
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
MatchFinder::MatchCallback * Callback
static std::pair< CharUnits, CharUnits > getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
getConstantArrayInfoInChars - Performing the computation in CharUnits instead of in bits prevents ove...
bool isObjCClassType() const
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
Declaration of a template type parameter.
Internal representation of canonical, dependent decltype(expr) types.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
ObjCIvarDecl * getPropertyIvarDecl() const
Implements an efficient mapping from strings to IdentifierInfo nodes.
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...
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
const llvm::fltSemantics & getFloatFormat() const
void Profile(llvm::FoldingSetNodeID &ID)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
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...
CanQualType OMPArraySectionTy
static TypedefDecl * CreateX86_64ABIBuiltinVaListDecl(const ASTContext *Context)
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
TranslationUnitDecl * getTranslationUnitDecl() const
static unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
static std::string charUnitsToString(const CharUnits &CU)
void Profile(llvm::FoldingSetNodeID &ID)
ArgKind getKind() const
Return the kind of stored template argument.
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...
ExtProtoInfo getExtProtoInfo() const
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &O)
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
void removeFastQualifiers(unsigned mask)
void Profile(llvm::FoldingSetNodeID &ID)
DeclContext * getDeclContext()
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
A structure for storing the information associated with a substituted template template parameter...
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...
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
internal::Matcher< T > id(StringRef ID, const internal::BindableMatcher< T > &InnerMatcher)
If the provided matcher matches a node, binds the node to ID.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
static TypedefDecl * CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context)
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
Defines the clang::TypeLoc interface and its subclasses.
A namespace alias, stored as a NamespaceAliasDecl*.
bool isObjCIdType() const
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
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 isParameterPack() const
Whether this template template parameter is a template parameter pack.
const CXXRecordDecl * getBaseSharingVBPtr() const
IntType getProcessIDType() const
QualType getFILEType() const
Retrieve the C FILE type.
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
bool isInstanceMethod() const
clang::ObjCRuntime ObjCRuntime
Qualifiers Quals
The local qualifiers.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
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.
QualType getObjCIdType() const
Represents the Objective-CC id type.
bool isExternallyVisible() const
unsigned Map[FirstTargetAddressSpace]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
ArrayRef< ParmVarDecl * > parameters() const
Represents a GCC generic vector type.
struct CXXOpName CXXOperatorName
unsigned getChar32Align() const
An lvalue reference type, per C++11 [dcl.ref].
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
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.
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Implements C++ ABI-specific semantic analysis functions.
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.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it...
QualType getElementType() const
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
The result type of a method or function.
unsigned getWCharAlign() const
This template specialization was implicitly instantiated from a template.
bool ObjCQualifiedClassTypesAreCompatible(QualType LHS, QualType RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>. ...
const T * get() const
Retrieve the stored node as type T.
RecordDecl * getDefinition() const
getDefinition - Returns the RecordDecl that actually defines this struct/union/class.
const LangAS::Map & getAddressSpaceMap() const
A type, stored as a Type*.
unsigned getIntAlign() const
void setOriginalDecl(const Decl *Orig)
TypeSourceInfo * getTypeSourceInfo() const
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
unsigned getLongAlign() const
QualType getWideCharType() const
Return the type of wide characters.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
bool hasObjCLifetime() const
SourceRange getBracketsRange() const
WatchOS is a modernisation of the iOS ABI, which roughly means it's the iOS64 ABI ported to 32-bits...
param_const_iterator param_end() const
unsigned getMaxVectorAlign() const
Return the maximum vector alignment supported for the given target.
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
SourceLocation getLocStart() const LLVM_READONLY
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
llvm::SmallVector< ast_type_traits::DynTypedNode, 2 > ParentVector
Contains parents of a node.
A template template parameter pack that has been substituted for a template template argument pack...
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
There is no lifetime qualification on this type.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
static unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
is AltiVec 'vector Pixel'
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
This declaration does not have an attached comment, and we have searched the redeclaration chain...
Assigning into this object requires the old value to be released and the new value to be retained...
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
uint64_t getPointerAlign(unsigned AddrSpace) const
not a target-specific vector type
ExceptionSpecificationType Type
The kind of exception specification this is.
unsigned getMinGlobalAlign() const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
Expr * getBlockVarCopyInits(const VarDecl *VD)
Get the copy initialization expression of the VarDecl VD, or NULL if none exists. ...
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
void AddDeallocation(void(*Callback)(void *), void *Data)
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
ExternCContextDecl * getExternCContextDecl() const
Encodes a location in the source.
Sugar for parentheses used when specifying types.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
bool hasSameTemplateName(TemplateName X, TemplateName Y)
Determine whether the given template names refer to the same template.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
CharUnits getSize() const
getSize - Get the record size in characters.
QualType getElementType() const
unsigned getBitWidthValue(const ASTContext &Ctx) const
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists...
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
static const LangAS::Map * getAddressSpaceMap(const TargetInfo &T, const LangOptions &LOpts)
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache...
This names the __make_integer_seq BuiltinTemplateDecl.
A structure for storing an already-substituted template template parameter pack.
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
bool isBuiltinType() const
Helper methods to distinguish type categories.
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
static unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built...
Kind getKind() const LLVM_READONLY
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
TagDecl - Represents the declaration of a struct/union/class/enum.
const void * getMemoizationData() const
Returns a pointer that identifies the stored AST node.
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
IdentifierInfo * getMakeIntegerSeqName() const
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.
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...
void Profile(llvm::FoldingSetNodeID &ID)
bool isObjCUnqualifiedIdOrClass() const
VectorKind getVectorKind() const
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required...
void Profile(llvm::FoldingSetNodeID &ID)
QualType withConst() const
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
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.
bool isObjCBuiltinType() const
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one...
Weak for now, might become strong later in this TU.
void Profile(llvm::FoldingSetNodeID &ID)
DiagnosticsEngine & getDiagnostics() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
ArrayRef< ParmVarDecl * > parameters() const
ExtInfo withNoReturn(bool noReturn) const
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...
virtual bool allowsLargerPreferedTypeAlignment() const
Whether target allows to overalign ABI-specified preferred alignment.
const ConstantArrayType * getAsConstantArrayType(QualType T) const
ObjCCategoryDecl - Represents a category declaration.
const ObjCInterfaceDecl * getClassInterface() const
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>.
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
bool isPropertyAccessor() const
static bool areSortedAndUniqued(ArrayRef< ObjCProtocolDecl * > Protocols)
SplitQualType getSplitDesugaredType() const
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
This declaration is only a declaration.
is AltiVec 'vector bool ...'
virtual BuiltinVaListKind getBuiltinVaListKind() const =0
Returns the kind of __builtin_va_list type that should be used with this target.
SourceLocation getLAngleLoc() const
std::string getAsString() const
Derive the full selector name (e.g.
IntType getUIntMaxType() const
Represents one property declaration in an Objective-C interface.
TypedefNameDecl * getDecl() const
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
bool canBindObjCObjectType(QualType To, QualType From)
virtual LangAS::ID getOpenCLImageAddrSpace() const
Get OpenCL image type address space.
We have found a comment attached to this particular declaration.
ASTNodeKind getNodeKind() const
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
The generic Itanium ABI is the standard ABI of most open-source and Unix-like platforms.
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
void InitBuiltinTypes(const TargetInfo &Target, const TargetInfo *AuxTarget=nullptr)
Initialize built-in types.
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
QualType getReturnType() const
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.
const T * castAs() const
Member-template castAs<specific type>.
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
This template specialization was instantiated from a template due to an explicit instantiation defini...
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent) const
C++11 deduced auto type.
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool typesAreBlockPointerCompatible(QualType, QualType)
bool isFileContext() const
bool isVectorType() const
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
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.
QualType getRealTypeForBitwidth(unsigned DestWidth) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
FunctionDecl * getClassScopeSpecializationPattern(const FunctionDecl *FD)
Assigning into this object requires a lifetime extension.
llvm::DenseMap< const Decl *, RawCommentAndCacheFlags > RedeclComments
Mapping from declarations to comments attached to any redeclaration.
static DynTypedNode create(const T &Node)
Creates a DynTypedNode from Node.
const BlockDecl * getBlockDecl() const
bool isDynamicClass() const
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
void Profile(llvm::FoldingSetNodeID &ID)
bool isObjCQualifiedClass() const
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.
unsigned getManglingNumber(const NamedDecl *ND) const
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.
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
QualType getPointeeType() const
Represents a pack expansion of types.
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) 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< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
void setTemplateKeywordLoc(SourceLocation Loc)
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
Expr * getSizeExpr() const
CanQualType UnsignedShortTy
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
ObjCIvarDecl * getNextIvar()
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
bool propertyTypesAreCompatible(QualType, QualType)
Represents a template argument.
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
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 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 ...
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
QualType getAsType() const
Retrieve the type for a type template argument.
IntType
===-— Target Data Type Query Methods ----------------------------—===//
Represents a template name that was expressed as a qualified name.
TagTypeKind
The kind of a tag type.
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
CanQualType ObjCBuiltinIdTy
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list...
const llvm::fltSemantics & getLongDoubleFormat() const
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
not evaluated yet, for special member function
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
A qualifier set is used to build a set of qualifiers.
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isSentinelNullExpr(const Expr *E)
The base class of all kinds of template declarations (e.g., class, function, etc.).
CanQualType DoubleComplexTy
IntType getSignedSizeType() const
bool isZero() const
isZero - Test whether the quantity equals zero.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
typedef char* __builtin_va_list;
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
static FloatingRank getFloatingRank(QualType T)
getFloatingRank - Return a relative rank for floating point types.
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
The template argument is a pack expansion of a template name that was provided for a template templat...
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
bool isInvalidDecl() const
static bool areCompatVectorTypes(const VectorType *LHS, const VectorType *RHS)
areCompatVectorTypes - Return true if the two specified vector types are compatible.
unsigned getCharWidth() const
bool getProducesResult() const
CanQualType UnsignedLongLongTy
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
This template specialization was instantiated from a template due to an explicit instantiation declar...
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
QualType getEnumType(const EnumDecl *Decl) const
QualType getExceptionObjectType(QualType T) const
unsigned getShortWidth() const
Return the size of 'signed short' and 'unsigned short' for this target, in bits.
Represents a dependent using declaration which was marked with typename.
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
void Profile(llvm::FoldingSetNodeID &ID)
DeclarationName - The name of a declaration.
Represents the declaration of an Objective-C type parameter.
CallingConv getCC() const
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
Selector getGetterName() const
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
Represents a C++11 pack expansion that produces a sequence of expressions.
static ASTContext::DynTypedNodeList getDynNodeFromMap(const NodeTy &Node, const MapTy &Map)
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid=nullptr) const
Given a SourceLocation, return the spelling line number for the position indicated.
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
void Profile(llvm::FoldingSetNodeID &ID)
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...
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context, GVALinkage L, const Decl *D)
Selector getSelector() const
EnumDecl - Represents an enum.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
void Profile(llvm::FoldingSetNodeID &ID)
detail::InMemoryDirectory::const_iterator E
A pointer to member type per C++ 8.3.3 - Pointers to members.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
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...
const llvm::fltSemantics & getHalfFormat() const
QualType AutoRRefDeductTy
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
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*.
QualType getCorrespondingUnsignedType(QualType T) const
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
void Profile(llvm::FoldingSetNodeID &ID)
BuiltinTemplateDecl * getTypePackElementDecl() const
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
static unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
known_extensions_range known_extensions() const
const VariableArrayType * getAsVariableArrayType(QualType T) const
unsigned getDepth() const
Get the nesting depth of the template parameter.
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD)
A dynamically typed AST node container.
const Decl * getOriginalDecl() const LLVM_READONLY
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
Represents a pointer to an Objective C object.
CanQualType ObjCBuiltinBoolTy
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
bool isObjCObjectType() const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
unsigned getAlignOfGlobalVar(QualType T) const
Return the alignment in bits that should be given to a global variable with type T.
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl * > protocols, QualType Canonical=QualType()) const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
BuiltinTemplateDecl * buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, const IdentifierInfo *II) const
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
qual_iterator qual_end() const
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
const T * getAs() const
Member-template getAs<specific type>'.
QualType getCanonicalType() const
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
This template specialization was declared or defined by an explicit specialization (C++ [temp...
CanQualType UnsignedLongTy
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
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...
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getIntegralType() const
Retrieve the type of the integral value.
bool isObjCQualifiedIdType() const
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
static char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
bool isFunctionType() const
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
ExtVectorType - Extended vector type.
CanQualType ObjCBuiltinClassTy
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
bool isComplete() const
Returns true if this can be considered a complete type.
Base for LValueReferenceType and RValueReferenceType.
CanQualType BoundMemberTy
static TypedefDecl * CreateCharPtrBuiltinVaListDecl(const ASTContext *Context)
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
unsigned getAddressSpace() const
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
QualType withRestrict() const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
The template argument is a type.
ObjCImplementationDecl * getImplementation() const
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)
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
void setBlockVarCopyInits(VarDecl *VD, Expr *Init)
Set the copy inialization expression of a block var decl.
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target, in bits.
The template argument is actually a parameter pack.
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of 'signed long long' and 'unsigned long long' for this targ...
const llvm::fltSemantics & getFloat128Format() const
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
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]...
bool isStaticDataMember() const
Determines whether this is a static data member.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
unsigned getFieldIndex() const
getFieldIndex - Returns the index of this field within its record, as appropriate for passing to ASTR...
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
QualType getPointeeType() const
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
A template argument list.
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
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...
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
const Type * getClass() const
Reading or writing from this object requires a barrier call.
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Canon=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
QualType getTypeOfExprType(Expr *e) const
GCC extension.
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).
bool hasAddressSpace() const
Represents a type parameter type in Objective C.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
void Profile(llvm::FoldingSetNodeID &ID)
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...
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
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 NULL if there isn't one...
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
Represents a template specialization type whose template cannot be resolved, e.g. ...
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
bool isObjCObjectPointerType() const
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...
Represents a C array with an unspecified size.
VTableContextBase * getVTableContext()
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
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)
ObjCIvarDecl - Represents an ObjC instance variable.
unsigned getBoolWidth() const
Return the size of '_Bool' and C++ 'bool' for this target, in bits.
void * Allocate(size_t Size, unsigned Align=8) const
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
CallingConv getDefaultCallingConvention(bool isVariadic, bool IsCXXMethod) const
Retrieves the default calling convention for the current target.
Provides information a specialization of a member of a class template, which may be a member function...
ArraySizeModifier getSizeModifier() const
A structure for storing the information associated with an overloaded template name.
IntType getInt64Type() const
bool isInline() const
Whether this variable is (C++1z) inline.
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
CharUnits getDataSize() const
getDataSize() - Get the record data size, which is the record size without tail padding, in characters.
We searched for a comment attached to the particular declaration, but didn't find any...
static unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
Builtin::Context & BuiltinInfo
Weak definition of inline variable.
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a class template.
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.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
TypedefDecl * getCFConstantStringDecl() const
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target...
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
QualType getParamTypeForDecl() const
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...
ObjCInterfaceDecl * getSuperClass() const
void setRAngleLoc(SourceLocation Loc)
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
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.
CXXMethodVector::const_iterator overridden_cxx_method_iterator
bool getHasRegParm() const
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
TagDecl * getDecl() const
bool isIncompleteArrayType() const
static Decl::Kind getKind(const Decl *D)
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl * > protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
static bool NeedsInjectedClassNameType(const RecordDecl *D)
TranslationUnitDecl - The top declaration context.
unsigned getTargetAddressSpace(QualType T) const
A reference to a declared variable, function, enum, etc.
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
Represents a type template specialization; the template must be a class template, a type alias templa...
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
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...
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
QualType getElementType() const
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types ...
bool hasQualifiers() const
Determine whether this type has any qualifiers.
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...
RecordDecl * getCFConstantStringTagDecl() const
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type...
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
A set of overloaded template declarations.
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
NamedDecl - This represents a decl with a name.
ObjCIvarDecl * all_declared_ivar_begin()
all_declared_ivar_begin - return first ivar declared in this class, its extensions and its implementa...
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.
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
void setAccess(AccessSpecifier AS)
Represents a C array with a specified size that is not an integer-constant-expression.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
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.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
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.
llvm::DenseMap< const void *, llvm::PointerUnion4< const Decl *, const Stmt *, ast_type_traits::DynTypedNode *, ParentVector * > > ParentMapPointers
Maps from a node to its parents.
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...
bool isConstQualified() const
Determine whether this type is const-qualified.
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.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
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.
IntType getPtrDiffType(unsigned AddrSpace) 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)
unsigned getShortAlign() const
Return the alignment of 'signed short' and 'unsigned short' for this target.
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement) const
Retrieve a substitution-result type.
The global specifier '::'. There is no stored value.
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
Missing a type from <setjmp.h>
void removeAddressSpace()
void setType(QualType newType)
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
base_class_range vbases()
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 getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
llvm::DenseMap< ast_type_traits::DynTypedNode, llvm::PointerUnion4< const Decl *, const Stmt *, ast_type_traits::DynTypedNode *, ParentVector * > > ParentMapOtherNodes
Parent map for nodes without pointer identity.
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...
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
unsigned getLongLongAlign() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
APValue * getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E, bool MayCreate)
Get the storage for the constant value of a materialized temporary of static storage duration...
A single template declaration.
void Profile(llvm::FoldingSetNodeID &ID)
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
CanQualType OCLClkEventTy
const RecordDecl * getParent() const
getParent - Returns the parent of this field declaration, which is the struct in which this field is ...
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
CanQualType UnsignedIntTy
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if this address space is a superset of the other one.
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>.
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isPointerType() const
static unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++1z deduced class template specialization type.
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.