36 #include "llvm/ADT/SmallString.h"
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);
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 &&
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;
384 *OriginalDecl = OriginalDeclForRC;
404 if (
const ObjCImplDecl *IMD = dyn_cast<ObjCImplDecl>(DC)) {
413 Redeclared.push_back(RedeclaredMethod);
419 const Decl *D)
const {
423 ThisDeclInfo->
fill();
436 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
444 D = adjustDeclToTemplate(D);
447 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
451 if (Canonical != D) {
459 const Decl *OriginalDecl;
463 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
473 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
480 QualType QT = TD->getUnderlyingType();
482 if (
const Decl *TD = TT->getDecl())
487 while (IC->getSuperClass()) {
488 IC = IC->getSuperClass();
498 else if (
const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
499 if (!(RD = RD->getDefinition()))
502 for (
const auto &I : RD->bases()) {
503 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
509 if (!(NonVirtualBase= NonVirtualBase->getDefinition()))
517 for (
const auto &I : RD->vbases()) {
524 if (!(VirtualBase= VirtualBase->getDefinition()))
538 if (D != OriginalDecl)
547 ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &
ID,
554 ID.AddInteger(Params->
size());
556 PEnd = Params->
end();
560 ID.AddBoolean(TTP->isParameterPack());
566 ID.AddBoolean(NTTP->isParameterPack());
567 ID.AddPointer(NTTP->getType().getCanonicalType().getAsOpaquePtr());
568 if (NTTP->isExpandedParameterPack()) {
570 ID.AddInteger(NTTP->getNumExpansionTypes());
571 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
572 QualType T = NTTP->getExpansionType(I);
576 ID.AddBoolean(
false);
587 ASTContext::getCanonicalTemplateTemplateParmDecl(
590 llvm::FoldingSetNodeID
ID;
591 CanonicalTemplateTemplateParm::Profile(ID, TTP);
592 void *InsertPos =
nullptr;
593 CanonicalTemplateTemplateParm *Canonical
594 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
596 return Canonical->getParam();
601 CanonParams.reserve(Params->
size());
603 PEnd = Params->
end();
606 CanonParams.push_back(
614 = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
618 if (NTTP->isExpandedParameterPack()) {
621 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
623 ExpandedTInfos.push_back(
631 NTTP->getPosition(),
nullptr,
634 ExpandedTypes.data(),
635 ExpandedTypes.size(),
636 ExpandedTInfos.data());
642 NTTP->getPosition(),
nullptr,
644 NTTP->isParameterPack(),
647 CanonParams.push_back(Param);
650 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
651 cast<TemplateTemplateParmDecl>(*
P)));
667 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
668 assert(!Canonical &&
"Shouldn't be in the map!");
672 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
673 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
678 if (!LangOpts.CPlusPlus)
return nullptr;
691 llvm_unreachable(
"Invalid CXXABI type!");
696 if (LOpts.FakeAddressSpaceMap) {
699 static const unsigned FakeAddrSpaceMap[] = {
708 return &FakeAddrSpaceMap;
716 switch (LangOpts.getAddressSpaceMapMangling()) {
724 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
730 : FunctionProtoTypes(this_()), TemplateSpecializationTypes(this_()),
731 DependentTemplateSpecializationTypes(this_()),
732 SubstTemplateTemplateParmPacks(this_()),
733 GlobalNestedNameSpecifier(nullptr), Int128Decl(nullptr),
734 UInt128Decl(nullptr), Float128StubDecl(nullptr),
735 BuiltinVaListDecl(nullptr), ObjCIdDecl(nullptr), ObjCSelDecl(nullptr),
736 ObjCClassDecl(nullptr), ObjCProtocolClassDecl(nullptr), BOOLDecl(nullptr),
737 CFConstantStringTypeDecl(nullptr), ObjCInstanceTypeDecl(nullptr),
738 FILEDecl(nullptr), jmp_bufDecl(nullptr), sigjmp_bufDecl(nullptr),
739 ucontext_tDecl(nullptr), BlockDescriptorType(nullptr),
740 BlockDescriptorExtendedType(nullptr), cudaConfigureCallDecl(nullptr),
741 FirstLocalImport(), LastLocalImport(), ExternCContext(nullptr),
745 Idents(idents), Selectors(sels),
BuiltinInfo(builtins),
746 DeclarationNames(*this), ExternalSource(nullptr), Listener(nullptr),
747 Comments(SM), CommentsLoaded(
false),
748 CommentCommandTraits(BumpAlloc, LOpts.CommentOpts), LastSDM(nullptr, 0) {
753 ReleaseParentMapEntries();
757 ReleaseDeclContextMaps();
760 for (DeallocationMap::const_iterator I = Deallocations.begin(),
761 E = Deallocations.end(); I != E; ++I)
762 for (
unsigned J = 0, N = I->second.size(); J != N; ++J)
763 (I->first)((I->second)[J]);
769 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
774 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
775 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
781 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
782 AEnd = DeclAttrs.end();
784 A->second->~AttrVec();
786 llvm::DeleteContainerSeconds(MangleNumberingContexts);
789 void ASTContext::ReleaseParentMapEntries() {
790 if (!AllParents)
return;
791 for (
const auto &Entry : *AllParents) {
802 Deallocations[
Callback].push_back(Data);
811 llvm::errs() <<
"\n*** AST Context Stats:\n";
812 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
814 unsigned counts[] = {
815 #define TYPE(Name, Parent) 0,
816 #define ABSTRACT_TYPE(Name, Parent)
817 #include "clang/AST/TypeNodes.def"
821 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
827 unsigned TotalBytes = 0;
828 #define TYPE(Name, Parent) \
830 llvm::errs() << " " << counts[Idx] << " " << #Name \
832 TotalBytes += counts[Idx] * sizeof(Name##Type); \
834 #define ABSTRACT_TYPE(Name, Parent)
835 #include "clang/AST/TypeNodes.def"
837 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
842 <<
" implicit default constructors created\n";
845 <<
" implicit copy constructors created\n";
849 <<
" implicit move constructors created\n";
852 <<
" implicit copy assignment operators created\n";
856 <<
" implicit move assignment operators created\n";
859 <<
" implicit destructors created\n";
862 llvm::errs() <<
"\n";
866 BumpAlloc.PrintStats();
870 bool NotifyListeners) {
876 MergedDefModules[ND].push_back(M);
882 auto It = MergedDefModules.find(ND);
883 if (It == MergedDefModules.end())
886 auto &Merged = It->second;
889 if (!Found.insert(M).second)
891 Merged.erase(std::remove(Merged.begin(), Merged.end(),
nullptr), Merged.end());
898 return ExternCContext;
912 NewDecl->addAttr(TypeVisibilityAttr::CreateImplicit(
913 const_cast<ASTContext &>(*
this), TypeVisibilityAttr::Default));
918 StringRef Name)
const {
940 assert(LangOpts.CPlusPlus &&
"should only be called for c++");
941 if (!Float128StubDecl)
944 return Float128StubDecl;
954 assert((!this->Target || this->Target == &Target) &&
955 "Incorrect target reinitialization");
958 this->Target = &Target;
960 ABI.reset(createCXXABI(Target));
965 InitBuiltinType(
VoidTy, BuiltinType::Void);
968 InitBuiltinType(
BoolTy, BuiltinType::Bool);
970 if (LangOpts.CharIsSigned)
971 InitBuiltinType(
CharTy, BuiltinType::Char_S);
973 InitBuiltinType(
CharTy, BuiltinType::Char_U);
976 InitBuiltinType(
ShortTy, BuiltinType::Short);
977 InitBuiltinType(
IntTy, BuiltinType::Int);
978 InitBuiltinType(
LongTy, BuiltinType::Long);
979 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
989 InitBuiltinType(
FloatTy, BuiltinType::Float);
990 InitBuiltinType(
DoubleTy, BuiltinType::Double);
994 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
999 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1001 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1002 if (LangOpts.CPlusPlus && LangOpts.WChar)
1006 WideCharTy = getFromTargetType(Target.getWCharType());
1009 WIntTy = getFromTargetType(Target.getWIntType());
1011 if (LangOpts.CPlusPlus)
1012 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1014 Char16Ty = getFromTargetType(Target.getChar16Type());
1016 if (LangOpts.CPlusPlus)
1017 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1019 Char32Ty = getFromTargetType(Target.getChar32Type());
1026 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1029 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1038 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1044 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1056 if (LangOpts.OpenCL) {
1057 InitBuiltinType(
OCLImage1dTy, BuiltinType::OCLImage1d);
1060 InitBuiltinType(
OCLImage2dTy, BuiltinType::OCLImage2d);
1062 InitBuiltinType(
OCLImage3dTy, BuiltinType::OCLImage3d);
1064 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1065 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1072 ObjCConstantStringType =
QualType();
1080 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1083 InitBuiltinType(
HalfTy, BuiltinType::Half);
1105 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1106 if (Pos != DeclAttrs.end()) {
1107 Pos->second->~AttrVec();
1108 DeclAttrs.erase(Pos);
1122 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1123 TemplateOrInstantiation.find(Var);
1124 if (Pos == TemplateOrInstantiation.end())
1137 Tmpl, TSK, PointOfInstantiation));
1143 assert(!TemplateOrInstantiation[Inst] &&
1144 "Already noted what the variable was instantiated from");
1145 TemplateOrInstantiation[Inst] = TSI;
1150 assert(FD &&
"Specialization is 0");
1151 llvm::DenseMap<const FunctionDecl*, FunctionDecl *>::const_iterator Pos
1152 = ClassScopeSpecializationPattern.find(FD);
1153 if (Pos == ClassScopeSpecializationPattern.end())
1161 assert(FD &&
"Specialization is 0");
1162 assert(Pattern &&
"Class scope specialization pattern is 0");
1163 ClassScopeSpecializationPattern[FD] = Pattern;
1168 llvm::DenseMap<UsingDecl *, NamedDecl *>::const_iterator Pos
1169 = InstantiatedFromUsingDecl.find(UUD);
1170 if (Pos == InstantiatedFromUsingDecl.end())
1178 assert((isa<UsingDecl>(Pattern) ||
1179 isa<UnresolvedUsingValueDecl>(Pattern) ||
1180 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1181 "pattern decl is not a using decl");
1182 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1183 InstantiatedFromUsingDecl[Inst] = Pattern;
1188 llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>::const_iterator Pos
1189 = InstantiatedFromUsingShadowDecl.find(Inst);
1190 if (Pos == InstantiatedFromUsingShadowDecl.end())
1199 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1200 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1204 llvm::DenseMap<FieldDecl *, FieldDecl *>::iterator Pos
1205 = InstantiatedFromUnnamedFieldDecl.find(Field);
1206 if (Pos == InstantiatedFromUnnamedFieldDecl.end())
1214 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1215 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1216 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1217 "Already noted what unnamed field was instantiated from");
1219 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1224 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos
1226 if (Pos == OverriddenMethods.end())
1229 return Pos->second.begin();
1234 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos
1236 if (Pos == OverriddenMethods.end())
1239 return Pos->second.end();
1244 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos
1246 if (Pos == OverriddenMethods.end())
1249 return Pos->second.size();
1255 OverriddenMethods[Method].push_back(Overridden);
1263 if (
const CXXMethodDecl *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1275 Overridden.append(OverDecls.begin(), OverDecls.end());
1279 assert(!Import->NextLocalImport &&
"Import declaration already in the chain");
1280 assert(!Import->
isFromASTFile() &&
"Non-local import declaration");
1281 if (!FirstLocalImport) {
1282 FirstLocalImport = Import;
1283 LastLocalImport = Import;
1287 LastLocalImport->NextLocalImport = Import;
1288 LastLocalImport = Import;
1299 assert(BT &&
"Not a floating point type!");
1301 default: llvm_unreachable(
"Not a floating point type!");
1312 bool UseAlignAttrOnly =
false;
1314 Align = AlignFromAttr;
1322 if (isa<FieldDecl>(D)) {
1323 UseAlignAttrOnly = D->
hasAttr<PackedAttr>() ||
1324 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1326 UseAlignAttrOnly =
true;
1329 else if (isa<FieldDecl>(D))
1332 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1336 if (UseAlignAttrOnly) {
1339 }
else if (
const ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
1353 if (!ForAlignof && MinWidth) {
1354 if (isa<VariableArrayType>(arrayType))
1356 else if (isa<ConstantArrayType>(arrayType) &&
1357 MinWidth <= getTypeSize(cast<ConstantArrayType>(arrayType)))
1362 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
1363 if (VD->hasGlobalStorage() && !ForAlignof)
1373 if (
const FieldDecl *Field = dyn_cast<FieldDecl>(VD)) {
1387 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1388 if (LowBitOfOffset < FieldAlign)
1389 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1392 Align = std::min(Align, FieldAlign);
1404 std::pair<CharUnits, CharUnits>
1418 return sizeAndAlign;
1423 std::pair<CharUnits, CharUnits>
1426 std::pair<CharUnits, CharUnits> EltInfo =
1428 uint64_t Size = CAT->
getSize().getZExtValue();
1429 assert((Size == 0 || static_cast<uint64_t>(EltInfo.first.getQuantity()) <=
1430 (uint64_t)(-1)/Size) &&
1431 "Overflow in array type char size evaluation");
1432 uint64_t Width = EltInfo.first.getQuantity() * Size;
1433 unsigned Align = EltInfo.second.getQuantity();
1436 Width = llvm::RoundUpToAlignment(Width, Align);
1441 std::pair<CharUnits, CharUnits>
1450 std::pair<CharUnits, CharUnits>
1464 TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
1465 if (I != MemoizedTypeInfo.end())
1470 MemoizedTypeInfo[T] = TI;
1480 TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
1483 bool AlignIsRequired =
false;
1485 #define TYPE(Class, Base)
1486 #define ABSTRACT_TYPE(Class, Base)
1487 #define NON_CANONICAL_TYPE(Class, Base)
1488 #define DEPENDENT_TYPE(Class, Base) case Type::Class:
1489 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \
1491 assert(!T->isDependentType() && "should not see dependent types here"); \
1492 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr());
1493 #include "clang/AST/TypeNodes.def"
1494 llvm_unreachable(
"Should not see dependent types");
1496 case Type::FunctionNoProto:
1497 case Type::FunctionProto:
1503 case Type::IncompleteArray:
1504 case Type::VariableArray:
1509 case Type::ConstantArray: {
1513 uint64_t Size = CAT->
getSize().getZExtValue();
1514 assert((Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) &&
1515 "Overflow in array type bit size evaluation");
1516 Width = EltInfo.Width * Size;
1517 Align = EltInfo.Align;
1520 Width = llvm::RoundUpToAlignment(Width, Align);
1523 case Type::ExtVector:
1524 case Type::Vector: {
1531 if (Align & (Align-1)) {
1532 Align = llvm::NextPowerOf2(Align);
1533 Width = llvm::RoundUpToAlignment(Width, Align);
1537 if (TargetVectorAlign && TargetVectorAlign < Align)
1538 Align = TargetVectorAlign;
1543 switch (cast<BuiltinType>(T)->
getKind()) {
1544 default: llvm_unreachable(
"Unknown builtin type!");
1545 case BuiltinType::Void:
1551 case BuiltinType::Bool:
1555 case BuiltinType::Char_S:
1556 case BuiltinType::Char_U:
1557 case BuiltinType::UChar:
1558 case BuiltinType::SChar:
1562 case BuiltinType::WChar_S:
1563 case BuiltinType::WChar_U:
1567 case BuiltinType::Char16:
1571 case BuiltinType::Char32:
1575 case BuiltinType::UShort:
1576 case BuiltinType::Short:
1580 case BuiltinType::UInt:
1581 case BuiltinType::Int:
1585 case BuiltinType::ULong:
1586 case BuiltinType::Long:
1590 case BuiltinType::ULongLong:
1591 case BuiltinType::LongLong:
1595 case BuiltinType::Int128:
1596 case BuiltinType::UInt128:
1600 case BuiltinType::Half:
1604 case BuiltinType::Float:
1608 case BuiltinType::Double:
1612 case BuiltinType::LongDouble:
1616 case BuiltinType::NullPtr:
1620 case BuiltinType::ObjCId:
1621 case BuiltinType::ObjCClass:
1622 case BuiltinType::ObjCSel:
1626 case BuiltinType::OCLSampler:
1631 case BuiltinType::OCLEvent:
1632 case BuiltinType::OCLImage1d:
1633 case BuiltinType::OCLImage1dArray:
1634 case BuiltinType::OCLImage1dBuffer:
1635 case BuiltinType::OCLImage2d:
1636 case BuiltinType::OCLImage2dArray:
1637 case BuiltinType::OCLImage3d:
1644 case Type::ObjCObjectPointer:
1648 case Type::BlockPointer: {
1650 cast<BlockPointerType>(T)->getPointeeType());
1655 case Type::LValueReference:
1656 case Type::RValueReference: {
1660 cast<ReferenceType>(T)->getPointeeType());
1665 case Type::Pointer: {
1671 case Type::MemberPointer: {
1673 std::tie(Width, Align) = ABI->getMemberPointerWidthAndAlign(MPT);
1676 case Type::Complex: {
1680 Width = EltInfo.
Width * 2;
1681 Align = EltInfo.
Align;
1684 case Type::ObjCObject:
1685 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr());
1686 case Type::Adjusted:
1689 case Type::ObjCInterface: {
1692 Width =
toBits(Layout.getSize());
1693 Align =
toBits(Layout.getAlignment());
1698 const TagType *TT = cast<TagType>(T);
1706 if (
const EnumType *ET = dyn_cast<EnumType>(TT)) {
1707 const EnumDecl *ED = ET->getDecl();
1711 Info.
Align = AttrAlign;
1722 AlignIsRequired = RD->hasAttr<AlignedAttr>();
1726 case Type::SubstTemplateTypeParm:
1727 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
1728 getReplacementType().getTypePtr());
1731 const AutoType *A = cast<AutoType>(T);
1733 "cannot request the size of an undeduced or dependent auto type");
1738 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr());
1740 case Type::Typedef: {
1748 AlignIsRequired =
true;
1757 case Type::Elaborated:
1758 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
1760 case Type::Attributed:
1762 cast<AttributedType>(T)->getEquivalentType().getTypePtr());
1764 case Type::Atomic: {
1773 if (Width != 0 && Width <= Target->getMaxAtomicPromoteWidth()) {
1775 if (!llvm::isPowerOf2_64(Width))
1776 Width = llvm::NextPowerOf2(Width);
1779 Align =
static_cast<unsigned>(Width);
1785 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
1786 return TypeInfo(Width, Align, AlignIsRequired);
1792 if ((
getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 ||
1793 getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) &&
1834 unsigned ABIAlign = TI.
Align;
1842 if (Target->
getTriple().getArch() == llvm::Triple::xcore)
1847 T = CT->getElementType().getTypePtr();
1849 T = ET->getDecl()->getIntegerType().getTypePtr();
1856 return std::max(ABIAlign, (
unsigned)
getTypeSize(T));
1902 for (
const auto *I : OI->
ivars())
1908 Ivars.push_back(Iv);
1915 llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols) {
1919 for (
auto *Proto : OI->all_referenced_protocols()) {
1924 for (
const auto *Cat : OI->visible_categories())
1930 SD = SD->getSuperClass();
1932 }
else if (
const ObjCCategoryDecl *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
1933 for (
auto *Proto : OC->protocols()) {
1936 }
else if (
const ObjCProtocolDecl *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
1938 if (!Protocols.insert(
1939 const_cast<ObjCProtocolDecl *>(OP->getCanonicalDecl())).second)
1942 for (
auto *Proto : OP->protocols())
1951 count += Ext->ivar_size();
1956 count += ImplDecl->ivar_size();
1974 if (isa<GNUNullExpr>(E))
return true;
1981 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
1982 I = ObjCImpls.find(D);
1983 if (I != ObjCImpls.end())
1984 return cast<ObjCImplementationDecl>(I->second);
1989 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
1990 I = ObjCImpls.find(D);
1991 if (I != ObjCImpls.end())
1992 return cast<ObjCCategoryImplDecl>(I->second);
1999 assert(IFaceD && ImplD &&
"Passed null params");
2000 ObjCImpls[IFaceD] = ImplD;
2005 assert(CatD && ImplD &&
"Passed null params");
2006 ObjCImpls[CatD] = ImplD;
2016 return CD->getClassInterface();
2019 return IMD->getClassInterface();
2027 assert(VD &&
"Passed null params");
2028 assert(VD->
hasAttr<BlocksAttr>() &&
2029 "getBlockVarCopyInits - not __block var");
2030 llvm::DenseMap<const VarDecl*, Expr*>::iterator
2031 I = BlockVarCopyInits.find(VD);
2032 return (I != BlockVarCopyInits.end()) ? cast<Expr>(I->second) :
nullptr;
2037 assert(VD && Init &&
"Passed null params");
2038 assert(VD->
hasAttr<BlocksAttr>() &&
2039 "setBlockVarCopyInits - not __block var");
2040 BlockVarCopyInits[VD] = Init;
2044 unsigned DataSize)
const {
2049 "incorrect data size provided to CreateTypeSourceInfo!");
2066 return getObjCLayout(D,
nullptr);
2080 ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
2085 llvm::FoldingSetNodeID
ID;
2087 void *insertPos =
nullptr;
2088 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
2089 assert(eq->getQualifiers() == quals);
2098 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
2101 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
2105 ExtQualNodes.InsertNode(eq, insertPos);
2123 "Type cannot be in multiple addr spaces!");
2126 return getExtQualType(TypeNode, Quals);
2151 "Type cannot have multiple ObjCGCs!");
2154 return getExtQualType(TypeNode, Quals);
2172 return cast<FunctionType>(Result.
getTypePtr());
2188 L->DeducedReturnType(FD, ResultType);
2199 if (
auto *PT = dyn_cast<ParenType>(Orig))
2204 if (
auto *AT = dyn_cast<AttributedType>(Orig))
2234 if (TSInfo->getType() != FD->
getType())
2242 "TypeLoc size mismatch from updating exception specification");
2243 TSInfo->overrideType(Updated);
2252 llvm::FoldingSetNodeID
ID;
2255 void *InsertPos =
nullptr;
2256 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
2266 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
2267 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2270 Types.push_back(New);
2271 ComplexTypes.InsertNode(New, InsertPos);
2280 llvm::FoldingSetNodeID
ID;
2283 void *InsertPos =
nullptr;
2284 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2294 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2295 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2298 Types.push_back(New);
2299 PointerTypes.InsertNode(New, InsertPos);
2304 llvm::FoldingSetNodeID
ID;
2306 void *InsertPos =
nullptr;
2307 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2314 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2315 assert(!AT &&
"Shouldn't be in the map!");
2319 Types.push_back(AT);
2320 AdjustedTypes.InsertNode(AT, InsertPos);
2344 llvm::FoldingSetNodeID
ID;
2346 void *InsertPos =
nullptr;
2347 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2354 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2355 assert(!AT &&
"Shouldn't be in the map!");
2358 Types.push_back(AT);
2359 AdjustedTypes.InsertNode(AT, InsertPos);
2369 llvm::FoldingSetNodeID
ID;
2372 void *InsertPos =
nullptr;
2374 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2385 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2386 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2390 Types.push_back(New);
2391 BlockPointerTypes.InsertNode(New, InsertPos);
2400 "Unresolved overloaded function type");
2404 llvm::FoldingSetNodeID
ID;
2407 void *InsertPos =
nullptr;
2409 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2417 if (!SpelledAsLValue || InnerRef || !T.
isCanonical()) {
2423 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2424 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2430 Types.push_back(New);
2431 LValueReferenceTypes.InsertNode(New, InsertPos);
2441 llvm::FoldingSetNodeID
ID;
2444 void *InsertPos =
nullptr;
2446 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2460 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2461 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2466 Types.push_back(New);
2467 RValueReferenceTypes.InsertNode(New, InsertPos);
2476 llvm::FoldingSetNodeID
ID;
2479 void *InsertPos =
nullptr;
2481 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2492 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2493 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2497 Types.push_back(New);
2498 MemberPointerTypes.InsertNode(New, InsertPos);
2505 const llvm::APInt &ArySizeIn,
2507 unsigned IndexTypeQuals)
const {
2510 "Constant array of VLAs is illegal!");
2514 llvm::APInt ArySize(ArySizeIn);
2518 llvm::FoldingSetNodeID
ID;
2521 void *InsertPos =
nullptr;
2523 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
2532 ASM, IndexTypeQuals);
2537 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
2538 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2543 ConstantArrayTypes.InsertNode(New, InsertPos);
2544 Types.push_back(New);
2558 const Type *ty = split.
Ty;
2560 #define TYPE(Class, Base)
2561 #define ABSTRACT_TYPE(Class, Base)
2562 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
2563 #include "clang/AST/TypeNodes.def"
2564 llvm_unreachable(
"didn't desugar past all non-canonical types?");
2570 case Type::ExtVector:
2571 case Type::DependentSizedExtVector:
2572 case Type::ObjCObject:
2573 case Type::ObjCInterface:
2574 case Type::ObjCObjectPointer:
2577 case Type::UnresolvedUsing:
2578 case Type::TypeOfExpr:
2580 case Type::Decltype:
2581 case Type::UnaryTransform:
2582 case Type::DependentName:
2583 case Type::InjectedClassName:
2584 case Type::TemplateSpecialization:
2585 case Type::DependentTemplateSpecialization:
2586 case Type::TemplateTypeParm:
2587 case Type::SubstTemplateTypeParmPack:
2589 case Type::PackExpansion:
2590 llvm_unreachable(
"type should never be variably-modified");
2594 case Type::FunctionNoProto:
2595 case Type::FunctionProto:
2596 case Type::BlockPointer:
2597 case Type::MemberPointer:
2606 cast<PointerType>(ty)->getPointeeType()));
2609 case Type::LValueReference: {
2617 case Type::RValueReference: {
2624 case Type::Atomic: {
2630 case Type::ConstantArray: {
2640 case Type::DependentSizedArray: {
2652 case Type::IncompleteArray: {
2664 case Type::VariableArray: {
2685 unsigned IndexTypeQuals,
2695 IndexTypeQuals, Brackets);
2702 VariableArrayTypes.push_back(New);
2703 Types.push_back(New);
2713 unsigned elementTypeQuals,
2717 "Size must be type- or value-dependent!");
2727 numElements, ASM, elementTypeQuals,
2729 Types.push_back(newType);
2738 void *insertPos =
nullptr;
2739 llvm::FoldingSetNodeID
ID;
2742 ASM, elementTypeQuals, numElements);
2746 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
2752 QualType(), numElements, ASM, elementTypeQuals,
2754 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
2755 Types.push_back(canonTy);
2760 canonElementType.
Quals);
2764 if (
QualType(canonElementType.
Ty, 0) == elementType)
2772 ASM, elementTypeQuals, brackets);
2773 Types.push_back(sugaredType);
2779 unsigned elementTypeQuals)
const {
2780 llvm::FoldingSetNodeID
ID;
2783 void *insertPos =
nullptr;
2785 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
2796 ASM, elementTypeQuals);
2801 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
2802 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
2808 IncompleteArrayTypes.InsertNode(newType, insertPos);
2809 Types.push_back(newType);
2820 llvm::FoldingSetNodeID
ID;
2823 void *InsertPos =
nullptr;
2824 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
2834 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
2835 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2838 VectorType(vecType, NumElts, Canonical, VecKind);
2839 VectorTypes.InsertNode(New, InsertPos);
2840 Types.push_back(New);
2851 llvm::FoldingSetNodeID
ID;
2854 void *InsertPos =
nullptr;
2855 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
2865 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
2866 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2870 VectorTypes.InsertNode(New, InsertPos);
2871 Types.push_back(New);
2879 llvm::FoldingSetNodeID
ID;
2883 void *InsertPos =
nullptr;
2885 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
2895 if (CanonVecTy == vecType) {
2901 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
2902 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
2904 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
2913 Types.push_back(New);
2926 llvm::FoldingSetNodeID
ID;
2929 void *InsertPos =
nullptr;
2931 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
2940 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
2941 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2947 Types.push_back(New);
2948 FunctionNoProtoTypes.InsertNode(New, InsertPos);
2962 size_t NumArgs = ArgArray.size();
2966 llvm::FoldingSetNodeID
ID;
2970 void *InsertPos =
nullptr;
2972 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
2978 !EPI.HasTrailingReturn;
2979 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
2980 if (!ArgArray[i].isCanonicalAsParam())
2981 isCanonical =
false;
2988 CanonicalArgs.reserve(NumArgs);
2989 for (
unsigned i = 0; i != NumArgs; ++i)
3004 Canonical =
getFunctionType(CanResultTy, CanonicalArgs, CanonicalEPI);
3008 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3009 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3023 Size += EPI.ExceptionSpec.Exceptions.size() *
sizeof(
QualType);
3025 Size +=
sizeof(
Expr*);
3031 if (EPI.ConsumedParameters)
3032 Size += NumArgs *
sizeof(
bool);
3037 Types.push_back(FTP);
3038 FunctionProtoTypes.InsertNode(FTP, InsertPos);
3044 if (!isa<CXXRecordDecl>(D))
return false;
3046 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
3049 !isa<ClassTemplateSpecializationDecl>(RD))
3060 if (Decl->TypeForDecl) {
3061 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3063 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
3064 Decl->TypeForDecl = PrevDecl->TypeForDecl;
3065 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3069 Decl->TypeForDecl = newType;
3070 Types.push_back(newType);
3072 return QualType(Decl->TypeForDecl, 0);
3078 assert(Decl &&
"Passed null for Decl param");
3079 assert(!Decl->TypeForDecl &&
"TypeForDecl present in slow case");
3084 assert(!isa<TemplateTypeParmDecl>(Decl) &&
3085 "Template type parameter types are always available.");
3087 if (
const RecordDecl *Record = dyn_cast<RecordDecl>(Decl)) {
3088 assert(Record->isFirstDecl() &&
"struct/union has previous declaration");
3091 }
else if (
const EnumDecl *Enum = dyn_cast<EnumDecl>(Decl)) {
3092 assert(Enum->isFirstDecl() &&
"enum has previous declaration");
3095 dyn_cast<UnresolvedUsingTypenameDecl>(Decl)) {
3097 Decl->TypeForDecl = newType;
3098 Types.push_back(newType);
3100 llvm_unreachable(
"TypeDecl without a type?");
3102 return QualType(Decl->TypeForDecl, 0);
3110 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3116 Decl->TypeForDecl = newType;
3117 Types.push_back(newType);
3122 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3125 if (PrevDecl->TypeForDecl)
3126 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3129 Decl->TypeForDecl = newType;
3130 Types.push_back(newType);
3135 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3138 if (PrevDecl->TypeForDecl)
3139 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3142 Decl->TypeForDecl = newType;
3143 Types.push_back(newType);
3150 llvm::FoldingSetNodeID
id;
3153 void *insertPos =
nullptr;
3155 if (type)
return QualType(type, 0);
3161 Types.push_back(type);
3162 AttributedTypes.InsertNode(type, insertPos);
3173 &&
"replacement types must always be canonical");
3175 llvm::FoldingSetNodeID
ID;
3177 void *InsertPos =
nullptr;
3179 = SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3184 Types.push_back(SubstParm);
3185 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
3198 assert(
P.getAsType().isCanonical() &&
"Pack contains non-canonical type");
3202 llvm::FoldingSetNodeID
ID;
3204 void *InsertPos =
nullptr;
3206 = SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
3214 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
3220 Types.push_back(SubstParm);
3221 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
3231 llvm::FoldingSetNodeID
ID;
3233 void *InsertPos =
nullptr;
3235 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3245 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3246 assert(!TypeCheck &&
"Template type parameter canonical type broken");
3252 Types.push_back(TypeParm);
3253 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
3264 "No dependent template names here!");
3274 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
3284 "No dependent template names here!");
3286 unsigned NumArgs = Args.
size();
3289 ArgVec.reserve(NumArgs);
3290 for (
unsigned i = 0; i != NumArgs; ++i)
3291 ArgVec.push_back(Args[i].getArgument());
3300 for (
unsigned I = 0; I != NumArgs; ++I)
3301 if (Args[I].isPackExpansion())
3314 "No dependent template names here!");
3323 if (!Underlying.
isNull())
3329 "Caller must compute aliased type");
3330 IsTypeAlias =
false;
3340 (IsTypeAlias?
sizeof(
QualType) : 0),
3344 IsTypeAlias ? Underlying :
QualType());
3346 Types.push_back(Spec);
3353 unsigned NumArgs)
const {
3355 "No dependent template names here!");
3364 CanonArgs.reserve(NumArgs);
3365 for (
unsigned I = 0; I != NumArgs; ++I)
3370 llvm::FoldingSetNodeID
ID;
3372 CanonArgs.data(), NumArgs, *
this);
3374 void *InsertPos =
nullptr;
3376 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
3384 CanonArgs.data(), NumArgs,
3386 Types.push_back(Spec);
3387 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
3391 "Non-dependent template-id type must have a canonical type");
3399 llvm::FoldingSetNodeID
ID;
3402 void *InsertPos =
nullptr;
3403 ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
3410 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
3411 assert(!CheckT &&
"Elaborated canonical type broken");
3417 ElaboratedTypes.InsertNode(T, InsertPos);
3423 llvm::FoldingSetNodeID
ID;
3426 void *InsertPos =
nullptr;
3427 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
3434 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
3435 assert(!CheckT &&
"Paren canonical type broken");
3441 ParenTypes.InsertNode(T, InsertPos);
3455 if (CanonNNS != NNS || CanonKeyword != Keyword)
3459 llvm::FoldingSetNodeID
ID;
3462 void *InsertPos =
nullptr;
3464 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
3470 DependentNameTypes.InsertNode(T, InsertPos);
3482 for (
unsigned I = 0, E = Args.
size(); I != E; ++I)
3483 ArgCopy.push_back(Args[I].getArgument());
3497 "nested-name-specifier must be dependent");
3499 llvm::FoldingSetNodeID
ID;
3501 Name, NumArgs, Args);
3503 void *InsertPos =
nullptr;
3505 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
3514 bool AnyNonCanonArgs =
false;
3516 for (
unsigned I = 0; I != NumArgs; ++I) {
3518 if (!CanonArgs[I].structurallyEquals(Args[I]))
3519 AnyNonCanonArgs =
true;
3523 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
3529 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
3536 Name, NumArgs, Args, Canon);
3538 DependentTemplateSpecializationTypes.InsertNode(T, InsertPos);
3544 llvm::FoldingSetNodeID
ID;
3548 "Pack expansions must expand one or more parameter packs");
3549 void *InsertPos =
nullptr;
3551 = PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
3566 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
3573 PackExpansionTypes.InsertNode(T, InsertPos);
3585 unsigned NumProtocols) {
3586 if (NumProtocols == 0)
return true;
3588 if (Protocols[0]->getCanonicalDecl() != Protocols[0])
3591 for (
unsigned i = 1; i != NumProtocols; ++i)
3593 Protocols[i]->getCanonicalDecl() != Protocols[i])
3599 unsigned &NumProtocols) {
3606 for (
unsigned I = 0, N = NumProtocols; I != N; ++I)
3607 Protocols[I] = Protocols[I]->getCanonicalDecl();
3610 ProtocolsEnd = std::unique(Protocols, ProtocolsEnd);
3611 NumProtocols = ProtocolsEnd-Protocols;
3616 unsigned NumProtocols)
const {
3618 llvm::makeArrayRef(Protocols, NumProtocols),
3626 bool isKindOf)
const {
3629 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
3630 isa<ObjCInterfaceType>(baseType))
3634 llvm::FoldingSetNodeID
ID;
3636 void *InsertPos =
nullptr;
3637 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
3644 if (effectiveTypeArgs.empty()) {
3646 effectiveTypeArgs = baseObject->getTypeArgs();
3653 bool typeArgsAreCanonical = std::all_of(effectiveTypeArgs.begin(),
3654 effectiveTypeArgs.end(),
3656 return type.isCanonical();
3660 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
3664 if (!typeArgsAreCanonical) {
3665 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
3666 for (
auto typeArg : effectiveTypeArgs)
3668 canonTypeArgs = canonTypeArgsVec;
3670 canonTypeArgs = effectiveTypeArgs;
3675 if (!protocolsSorted) {
3676 canonProtocolsVec.insert(canonProtocolsVec.begin(),
3679 unsigned uniqueCount = protocols.size();
3681 canonProtocols = llvm::makeArrayRef(&canonProtocolsVec[0], uniqueCount);
3683 canonProtocols = protocols;
3687 canonProtocols, isKindOf);
3690 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
3694 size += typeArgs.size() *
sizeof(
QualType);
3702 ObjCObjectTypes.InsertNode(T, InsertPos);
3716 for (
auto *Proto : OPT->quals()) {
3737 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> InheritedProtocols;
3739 if (InheritedProtocols.empty())
3743 bool Conforms =
false;
3744 for (
auto *Proto : OPT->
quals()) {
3746 for (
auto *PI : InheritedProtocols) {
3758 for (
auto *PI : InheritedProtocols) {
3760 bool Adopts =
false;
3761 for (
auto *Proto : OPT->
quals()) {
3775 llvm::FoldingSetNodeID
ID;
3778 void *InsertPos =
nullptr;
3780 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
3789 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
3797 Types.push_back(QType);
3798 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
3806 if (Decl->TypeForDecl)
3807 return QualType(Decl->TypeForDecl, 0);
3810 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
3811 Decl->TypeForDecl = PrevDecl->TypeForDecl;
3812 return QualType(PrevDecl->TypeForDecl, 0);
3821 Decl->TypeForDecl = T;
3834 llvm::FoldingSetNodeID
ID;
3837 void *InsertPos =
nullptr;
3839 = DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
3849 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
3856 Types.push_back(toe);
3868 Types.push_back(tot);
3885 llvm::FoldingSetNodeID
ID;
3888 void *InsertPos =
nullptr;
3890 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
3894 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
3902 Types.push_back(dt);
3917 Types.push_back(Ty);
3925 bool IsDependent)
const {
3926 if (DeducedType.
isNull() && !IsDecltypeAuto && !IsDependent)
3930 void *InsertPos =
nullptr;
3931 llvm::FoldingSetNodeID
ID;
3933 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
3939 Types.push_back(AT);
3941 AutoTypes.InsertNode(AT, InsertPos);
3950 llvm::FoldingSetNodeID
ID;
3953 void *InsertPos =
nullptr;
3954 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
3964 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
3965 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3968 Types.push_back(New);
3969 AtomicTypes.InsertNode(New, InsertPos);
4062 if (isa<ArrayType>(Ty)) {
4064 }
else if (isa<FunctionType>(Ty)) {
4086 quals = splitType.
Quals;
4096 if (elementType == unqualElementType) {
4097 assert(quals.
empty());
4098 quals = splitType.
Quals;
4118 VAT->getSizeModifier(),
4119 VAT->getIndexTypeCVRQualifiers(),
4120 VAT->getBracketsRange());
4140 if (T1PtrType && T2PtrType) {
4148 if (T1MPType && T2MPType &&
4150 QualType(T2MPType->getClass(), 0))) {
4159 if (T1OPType && T2OPType) {
4218 llvm_unreachable(
"bad template name kind!");
4227 = dyn_cast<TemplateTemplateParmDecl>(Template))
4228 Template = getCanonicalTemplateTemplateParmDecl(TTP);
4235 llvm_unreachable(
"cannot canonicalize overloaded template");
4239 assert(DTN &&
"Non-dependent template names must refer to template decls.");
4240 return DTN->CanonicalTemplateName;
4260 llvm_unreachable(
"bad template name!");
4310 A != AEnd; (void)++A, ++Idx)
4313 return TemplateArgument(CanonArgs, Arg.
pack_size());
4318 llvm_unreachable(
"Unhandled template argument kind");
4374 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
4382 if (
const ArrayType *AT = dyn_cast<ArrayType>(T))
4403 if (!ATy || qs.
empty())
4416 IAT->getSizeModifier(),
4417 IAT->getIndexTypeCVRQualifiers()));
4420 = dyn_cast<DependentSizedArrayType>(ATy))
4421 return cast<ArrayType>(
4423 DSAT->getSizeExpr(),
4424 DSAT->getSizeModifier(),
4425 DSAT->getIndexTypeCVRQualifiers(),
4426 DSAT->getBracketsRange()));
4473 assert(PrettyArrayType &&
"Not an array type!");
4502 uint64_t ElementCount = 1;
4504 ElementCount *= CA->
getSize().getZExtValue();
4505 CA = dyn_cast_or_null<ConstantArrayType>(
4508 return ElementCount;
4517 assert(T->
getAs<
BuiltinType>() &&
"getFloatingRank(): not a floating type");
4519 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
4520 case BuiltinType::Half:
return HalfRank;
4521 case BuiltinType::Float:
return FloatRank;
4536 case HalfRank: llvm_unreachable(
"Complex half is not supported");
4550 llvm_unreachable(
"getFloatingRank(): illegal value for rank");
4571 unsigned ASTContext::getIntegerRank(
const Type *T)
const {
4574 switch (cast<BuiltinType>(T)->getKind()) {
4575 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
4576 case BuiltinType::Bool:
4578 case BuiltinType::Char_S:
4579 case BuiltinType::Char_U:
4580 case BuiltinType::SChar:
4581 case BuiltinType::UChar:
4583 case BuiltinType::Short:
4584 case BuiltinType::UShort:
4586 case BuiltinType::Int:
4587 case BuiltinType::UInt:
4589 case BuiltinType::Long:
4590 case BuiltinType::ULong:
4592 case BuiltinType::LongLong:
4593 case BuiltinType::ULongLong:
4595 case BuiltinType::Int128:
4596 case BuiltinType::UInt128:
4636 if (BitWidth < IntSize)
4639 if (BitWidth == IntSize)
4654 assert(!Promotable.
isNull());
4657 return ET->getDecl()->getPromotionType();
4666 if (BT->getKind() == BuiltinType::WChar_S ||
4667 BT->getKind() == BuiltinType::WChar_U ||
4668 BT->getKind() == BuiltinType::Char16 ||
4669 BT->getKind() == BuiltinType::Char32) {
4670 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
4674 for (
size_t Idx = 0; Idx < llvm::array_lengthof(PromoteTypes); ++Idx) {
4676 if (FromSize < ToSize ||
4677 (FromSize == ToSize &&
4678 FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType()))
4679 return PromoteTypes[Idx];
4681 llvm_unreachable(
"char type should fit into long long");
4688 uint64_t PromotableSize =
getIntWidth(Promotable);
4729 if (
const EnumType *ET = dyn_cast<EnumType>(LHSC))
4731 if (
const EnumType *ET = dyn_cast<EnumType>(RHSC))
4734 if (LHSC == RHSC)
return 0;
4739 unsigned LHSRank = getIntegerRank(LHSC);
4740 unsigned RHSRank = getIntegerRank(RHSC);
4742 if (LHSUnsigned == RHSUnsigned) {
4743 if (LHSRank == RHSRank)
return 0;
4744 return LHSRank > RHSRank ? 1 : -1;
4750 if (LHSRank >= RHSRank)
4760 if (RHSRank >= LHSRank)
4771 if (!CFConstantStringTypeDecl) {
4780 FieldTypes[1] =
IntTy;
4787 for (
unsigned i = 0; i < 4; ++i) {
4791 FieldTypes[i],
nullptr,
4796 CFConstantStringTypeDecl->
addDecl(Field);
4806 if (ObjCSuperType.
isNull()) {
4808 TUDecl->
addDecl(ObjCSuperTypeDecl);
4811 return ObjCSuperType;
4816 assert(Rec &&
"Invalid CFConstantStringType");
4817 CFConstantStringTypeDecl = Rec->
getDecl();
4821 if (BlockDescriptorType)
4834 static const char *
const FieldNames[] = {
4839 for (
size_t i = 0; i < 2; ++i) {
4842 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
4850 BlockDescriptorType = RD;
4856 if (BlockDescriptorExtendedType)
4871 static const char *
const FieldNames[] = {
4878 for (
size_t i = 0; i < 4; ++i) {
4881 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
4890 BlockDescriptorExtendedType = RD;
4901 if (!copyExpr && record->hasTrivialDestructor())
return false;
4929 llvm_unreachable(
"fell out of lifetime switch!");
4937 bool &HasByrefExtendedLayout)
const {
4943 HasByrefExtendedLayout =
false;
4945 HasByrefExtendedLayout =
true;
4959 if (!ObjCInstanceTypeDecl)
4960 ObjCInstanceTypeDecl =
4962 return ObjCInstanceTypeDecl;
4968 if (
const TypedefType *TT = dyn_cast<TypedefType>(T))
4970 return II->isStr(
"BOOL");
5024 for (
auto PI : Decl->
params()) {
5029 assert (sz.
isPositive() &&
"BlockExpr - Incomplete param type");
5038 ParmOffset = PtrSize;
5039 for (
auto PVDecl : Decl->
params()) {
5040 QualType PType = PVDecl->getOriginalType();
5045 if (!isa<ConstantArrayType>(AT))
5046 PType = PVDecl->getType();
5048 PType = PVDecl->getType();
5067 for (
auto PI : Decl->
params()) {
5074 "getObjCEncodingForFunctionDecl - Incomplete param type");
5081 for (
auto PVDecl : Decl->
params()) {
5082 QualType PType = PVDecl->getOriginalType();
5087 if (!isa<ConstantArrayType>(AT))
5088 PType = PVDecl->getType();
5090 PType = PVDecl->getType();
5104 bool Extended)
const {
5108 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
5120 bool Extended)
const {
5141 "getObjCEncodingForMethodDecl - Incomplete param type");
5149 ParmOffset = 2 * PtrSize;
5158 if (!isa<ConstantArrayType>(AT))
5163 PType,
S, Extended);
5174 const Decl *Container)
const {
5178 dyn_cast<ObjCCategoryImplDecl>(Container)) {
5179 for (
auto *PID : CID->property_impls())
5180 if (PID->getPropertyDecl() == PD)
5185 if (PID->getPropertyDecl() == PD)
5217 const Decl *Container,
5218 std::string&
S)
const {
5220 bool Dynamic =
false;
5228 SynthesizePID = PropertyImpDecl;
5274 if (SynthesizePID) {
5289 if (isa<TypedefType>(PointeeTy.
getTypePtr())) {
5291 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
5294 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
5307 getObjCEncodingForTypeImpl(T, S,
true,
true, Field,
5308 true ,
false,
false,
5309 false,
false,
false, NotEncodedT);
5313 std::string&
S)
const {
5317 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
5325 case BuiltinType::Void:
return 'v';
5326 case BuiltinType::Bool:
return 'B';
5327 case BuiltinType::Char_U:
5328 case BuiltinType::UChar:
return 'C';
5329 case BuiltinType::Char16:
5330 case BuiltinType::UShort:
return 'S';
5331 case BuiltinType::Char32:
5332 case BuiltinType::UInt:
return 'I';
5333 case BuiltinType::ULong:
5335 case BuiltinType::UInt128:
return 'T';
5336 case BuiltinType::ULongLong:
return 'Q';
5337 case BuiltinType::Char_S:
5338 case BuiltinType::SChar:
return 'c';
5339 case BuiltinType::Short:
return 's';
5340 case BuiltinType::WChar_S:
5341 case BuiltinType::WChar_U:
5342 case BuiltinType::Int:
return 'i';
5343 case BuiltinType::Long:
5345 case BuiltinType::LongLong:
return 'q';
5346 case BuiltinType::Int128:
return 't';
5347 case BuiltinType::Float:
return 'f';
5348 case BuiltinType::Double:
return 'd';
5349 case BuiltinType::LongDouble:
return 'D';
5350 case BuiltinType::NullPtr:
return '*';
5352 case BuiltinType::Half:
5356 case BuiltinType::ObjCId:
5357 case BuiltinType::ObjCClass:
5358 case BuiltinType::ObjCSel:
5359 llvm_unreachable(
"@encoding ObjC primitive type");
5362 case BuiltinType::OCLImage1d:
5363 case BuiltinType::OCLImage1dArray:
5364 case BuiltinType::OCLImage1dBuffer:
5365 case BuiltinType::OCLImage2d:
5366 case BuiltinType::OCLImage2dArray:
5367 case BuiltinType::OCLImage3d:
5368 case BuiltinType::OCLEvent:
5369 case BuiltinType::OCLSampler:
5370 case BuiltinType::Dependent:
5371 #define BUILTIN_TYPE(KIND, ID)
5372 #define PLACEHOLDER_TYPE(KIND, ID) \
5373 case BuiltinType::KIND:
5374 #include "clang/AST/BuiltinTypes.def"
5375 llvm_unreachable(
"invalid builtin type for @encode");
5377 llvm_unreachable(
"invalid BuiltinType::Kind value");
5394 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
5426 void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string&
S,
5427 bool ExpandPointedToStructures,
5428 bool ExpandStructures,
5431 bool EncodingProperty,
5433 bool EncodeBlockParameters,
5434 bool EncodeClassNames,
5435 bool EncodePointerToObjCTypedef,
5438 switch (CT->getTypeClass()) {
5443 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CT))
5449 case Type::Complex: {
5452 getObjCEncodingForTypeImpl(CT->
getElementType(),
S,
false,
false,
nullptr);
5456 case Type::Atomic: {
5459 getObjCEncodingForTypeImpl(AT->
getValueType(),
S,
false,
false,
nullptr);
5465 case Type::LValueReference:
5466 case Type::RValueReference: {
5468 if (isa<PointerType>(CT)) {
5479 bool isReadOnly =
false;
5489 }
else if (OutermostType) {
5502 if (StringRef(S).endswith(
"nr"))
5503 S.replace(S.end()-2, S.end(),
"rn");
5515 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
5520 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
5529 getObjCEncodingForTypeImpl(PointeeTy, S,
false, ExpandPointedToStructures,
5530 nullptr,
false,
false,
false,
false,
false,
false,
5535 case Type::ConstantArray:
5536 case Type::IncompleteArray:
5537 case Type::VariableArray: {
5538 const ArrayType *AT = cast<ArrayType>(CT);
5540 if (isa<IncompleteArrayType>(AT) && !StructField) {
5545 false, ExpandStructures, FD);
5550 S += llvm::utostr(CAT->
getSize().getZExtValue());
5553 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
5554 "Unknown array type!");
5559 false, ExpandStructures, FD,
5560 false,
false,
false,
false,
false,
false,
5567 case Type::FunctionNoProto:
5568 case Type::FunctionProto:
5572 case Type::Record: {
5573 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
5574 S += RDecl->
isUnion() ?
'(' :
'{';
5579 = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
5581 llvm::raw_string_ostream OS(S);
5583 TemplateArgs.
data(),
5584 TemplateArgs.
size(),
5585 (*this).getPrintingPolicy());
5590 if (ExpandStructures) {
5593 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
5595 for (
const auto *Field : RDecl->
fields()) {
5598 S += Field->getNameAsString();
5603 if (Field->isBitField()) {
5604 getObjCEncodingForTypeImpl(Field->getType(),
S,
false,
true,
5609 getObjCEncodingForTypeImpl(qt, S,
false,
true,
5613 false,
false,
false, NotEncodedT);
5618 S += RDecl->
isUnion() ?
')' :
'}';
5622 case Type::BlockPointer: {
5625 if (EncodeBlockParameters) {
5630 getObjCEncodingForTypeImpl(
5631 FT->
getReturnType(),
S, ExpandPointedToStructures, ExpandStructures,
5632 FD,
false , EncodingProperty,
5633 false , EncodeBlockParameters, EncodeClassNames,
false,
5639 for (
const auto &I : FPT->param_types())
5640 getObjCEncodingForTypeImpl(
5641 I, S, ExpandPointedToStructures, ExpandStructures, FD,
5642 false , EncodingProperty,
5643 false , EncodeBlockParameters, EncodeClassNames,
5644 false, NotEncodedT);
5651 case Type::ObjCObject: {
5655 S +=
"{objc_object=}";
5659 S +=
"{objc_class=}";
5664 case Type::ObjCInterface: {
5673 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
5674 const FieldDecl *Field = cast<FieldDecl>(Ivars[i]);
5676 getObjCEncodingForTypeImpl(Field->
getType(),
S,
false,
true, Field);
5678 getObjCEncodingForTypeImpl(Field->
getType(),
S,
false,
true, FD,
5679 false,
false,
false,
false,
false,
5680 EncodePointerToObjCTypedef,
5687 case Type::ObjCObjectPointer: {
5704 ExpandPointedToStructures,
5705 ExpandStructures, FD);
5706 if (FD || EncodingProperty || EncodeClassNames) {
5710 for (
const auto *I : OPT->
quals()) {
5712 S += I->getObjCRuntimeNameAsString();
5721 if (!EncodingProperty &&
5723 !EncodePointerToObjCTypedef) {
5733 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
5734 if (cast<FieldDecl>(Ivars[i]) == FD) {
5742 getObjCEncodingForTypeImpl(PointeeTy, S,
5743 false, ExpandPointedToStructures,
5745 false,
false,
false,
false,
false,
5752 (FD || EncodingProperty || EncodeClassNames)) {
5755 for (
const auto *I : OPT->
quals()) {
5757 S += I->getObjCRuntimeNameAsString();
5767 case Type::MemberPointer:
5771 case Type::ExtVector:
5784 #define ABSTRACT_TYPE(KIND, BASE)
5785 #define TYPE(KIND, BASE)
5786 #define DEPENDENT_TYPE(KIND, BASE) \
5788 #define NON_CANONICAL_TYPE(KIND, BASE) \
5790 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \
5792 #include "clang/AST/TypeNodes.def"
5793 llvm_unreachable(
"@encode for dependent type!");
5795 llvm_unreachable(
"bad type kind!");
5798 void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
5803 assert(RDecl &&
"Expected non-null RecordDecl");
5804 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
5809 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
5813 for (
const auto &BI : CXXRec->
bases()) {
5814 if (!BI.isVirtual()) {
5819 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
5820 std::make_pair(offs, base));
5826 for (
auto *Field : RDecl->
fields()) {
5828 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
5829 std::make_pair(offs, Field));
5833 if (CXXRec && includeVBases) {
5834 for (
const auto &BI : CXXRec->
vbases()) {
5840 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
5841 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
5842 std::make_pair(offs, base));
5854 uint64_t CurOffs = 0;
5856 std::multimap<uint64_t, NamedDecl *>::iterator
5857 CurLayObj = FieldOrBaseOffsets.begin();
5860 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
5864 if (recname.empty()) recname =
"?";
5876 uint64_t offs =
toBits(size);
5877 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
5878 std::make_pair(offs,
nullptr));
5881 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
5883 assert(CurOffs <= CurLayObj->first);
5884 if (CurOffs < CurLayObj->first) {
5885 uint64_t padding = CurLayObj->first - CurOffs;
5906 getObjCEncodingForStructureImpl(base, S, FD,
false,
5913 FieldDecl *field = cast<FieldDecl>(dcl);
5928 getObjCEncodingForTypeImpl(qt, S,
false,
true, FD,
5932 false,
false,
false, NotEncodedT);
5942 std::string& S)
const {
5975 if (!ObjCClassDecl) {
5980 return ObjCClassDecl;
5984 if (!ObjCProtocolClassDecl) {
5985 ObjCProtocolClassDecl
5994 return ObjCProtocolClassDecl;
6031 const size_t NumFields = 5;
6033 const char *FieldNames[NumFields];
6037 FieldNames[0] =
"__stack";
6041 FieldNames[1] =
"__gr_top";
6045 FieldNames[2] =
"__vr_top";
6048 FieldTypes[3] = Context->
IntTy;
6049 FieldNames[3] =
"__gr_offs";
6052 FieldTypes[4] = Context->
IntTy;
6053 FieldNames[4] =
"__vr_offs";
6056 for (
unsigned i = 0; i < NumFields; ++i) {
6062 FieldTypes[i],
nullptr,
6067 VaListTagDecl->
addDecl(Field);
6084 const size_t NumFields = 5;
6086 const char *FieldNames[NumFields];
6090 FieldNames[0] =
"gpr";
6094 FieldNames[1] =
"fpr";
6098 FieldNames[2] =
"reserved";
6102 FieldNames[3] =
"overflow_arg_area";
6106 FieldNames[4] =
"reg_save_area";
6109 for (
unsigned i = 0; i < NumFields; ++i) {
6114 FieldTypes[i],
nullptr,
6119 VaListTagDecl->
addDecl(Field);
6147 const size_t NumFields = 4;
6149 const char *FieldNames[NumFields];
6153 FieldNames[0] =
"gp_offset";
6157 FieldNames[1] =
"fp_offset";
6161 FieldNames[2] =
"overflow_arg_area";
6165 FieldNames[3] =
"reg_save_area";
6168 for (
unsigned i = 0; i < NumFields; ++i) {
6174 FieldTypes[i],
nullptr,
6179 VaListTagDecl->
addDecl(Field);
6256 const size_t NumFields = 4;
6258 const char *FieldNames[NumFields];
6261 FieldTypes[0] = Context->
LongTy;
6262 FieldNames[0] =
"__gpr";
6265 FieldTypes[1] = Context->
LongTy;
6266 FieldNames[1] =
"__fpr";
6270 FieldNames[2] =
"__overflow_arg_area";
6274 FieldNames[3] =
"__reg_save_area";
6277 for (
unsigned i = 0; i < NumFields; ++i) {
6283 FieldTypes[i],
nullptr,
6288 VaListTagDecl->
addDecl(Field);
6330 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
6334 if (!BuiltinVaListDecl) {
6339 return BuiltinVaListDecl;
6352 assert(ObjCConstantStringType.
isNull() &&
6353 "'NSConstantString' type already set!");
6363 unsigned size = End - Begin;
6364 assert(size > 1 &&
"set is not overloaded!");
6373 assert(isa<FunctionTemplateDecl>(D) ||
6374 (isa<UsingShadowDecl>(D) &&
6386 bool TemplateKeyword,
6388 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
6391 llvm::FoldingSetNodeID
ID;
6394 void *InsertPos =
nullptr;
6396 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
6398 QTN =
new (*
this, llvm::alignOf<QualifiedTemplateName>())
6400 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
6412 "Nested name specifier must be dependent");
6414 llvm::FoldingSetNodeID
ID;
6417 void *InsertPos =
nullptr;
6419 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
6425 if (CanonNNS == NNS) {
6426 QTN =
new (*
this, llvm::alignOf<DependentTemplateName>())
6430 QTN =
new (*
this, llvm::alignOf<DependentTemplateName>())
6433 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
6434 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
6438 DependentTemplateNames.InsertNode(QTN, InsertPos);
6448 "Nested name specifier must be dependent");
6450 llvm::FoldingSetNodeID
ID;
6453 void *InsertPos =
nullptr;
6455 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
6461 if (CanonNNS == NNS) {
6462 QTN =
new (*
this, llvm::alignOf<DependentTemplateName>())
6466 QTN =
new (*
this, llvm::alignOf<DependentTemplateName>())
6470 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
6471 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
6475 DependentTemplateNames.InsertNode(QTN, InsertPos);
6482 llvm::FoldingSetNodeID
ID;
6485 void *insertPos =
nullptr;
6487 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
6491 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
6501 llvm::FoldingSetNodeID
ID;
6504 void *InsertPos =
nullptr;
6506 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
6512 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
6536 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
6566 while (
const ArrayType *AT = dyn_cast<ArrayType>(CT))
6589 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
6590 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
6633 assert ((lhsQID && rhsOPT) &&
"ObjCQualifiedClassTypesAreCompatible");
6635 for (
auto *lhsProto : lhsQID->
quals()) {
6637 for (
auto *rhsProto : rhsOPT->quals()) {
6664 if (!rhsOPT)
return false;
6670 for (
auto *I : lhsQID->quals()) {
6674 if (!rhsID->ClassImplementsProtocol(I,
true))
6682 for (
auto *lhsProto : lhsQID->quals()) {
6688 for (
auto *rhsProto : rhsOPT->
quals()) {
6698 for (
auto *I : lhsQID->quals()) {
6702 if (rhsID->ClassImplementsProtocol(I,
true)) {
6716 assert(rhsQID &&
"One of the LHS/RHS should be id<x>");
6721 for (
auto *lhsProto : lhsOPT->quals()) {
6729 for (
auto *rhsProto : rhsQID->
quals()) {
6743 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSInheritedProtocols;
6748 if (LHSInheritedProtocols.empty() && lhsOPT->qual_empty())
6750 for (
auto *lhsProto : LHSInheritedProtocols) {
6752 for (
auto *rhsProto : rhsQID->
quals()) {
6784 auto finish = [&](
bool succeeded) ->
bool {
6824 bool BlockReturnType) {
6828 auto finish = [&](
bool succeeded) ->
bool {
6862 return finish(BlockReturnType);
6864 return finish(!BlockReturnType);
6876 return (*lhs)->getName().compare((*rhs)->getName());
6894 assert(LHS->
getInterface() &&
"LHS must have an interface base");
6895 assert(RHS->
getInterface() &&
"RHS must have an interface base");
6898 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSProtocolSet;
6901 for (
auto proto : LHS->
quals()) {
6909 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> RHSProtocolSet;
6912 for (
auto proto : RHS->
quals()) {
6920 for (
auto proto : LHSProtocolSet) {
6921 if (RHSProtocolSet.count(proto))
6922 IntersectionSet.push_back(proto);
6927 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ImpliedProtocols;
6931 if (!ImpliedProtocols.empty()) {
6932 IntersectionSet.erase(
6933 std::remove_if(IntersectionSet.begin(),
6934 IntersectionSet.end(),
6936 return ImpliedProtocols.count(proto) > 0;
6938 IntersectionSet.end());
6942 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
6952 if (lhsOPT && rhsOPT)
6958 if (lhsBlock && rhsBlock)
6964 (rhsOPT && rhsOPT->isObjCIdType() && lhsBlock))
6973 ArrayRef<QualType> lhsArgs,
6974 ArrayRef<QualType> rhsArgs,
6976 if (lhsArgs.size() != rhsArgs.size())
6980 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
6987 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
6988 rhsArgs[i].stripObjCKindOfType(ctx))) {
7016 if (!LDecl || !RDecl)
7021 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
7031 bool anyChanges =
false;
7049 if (!Protocols.empty())
7065 if (LHSSuperType.
isNull())
7075 if (KnownLHS != LHSAncestors.end()) {
7076 LHS = KnownLHS->second;
7080 bool anyChanges =
false;
7098 if (!Protocols.empty())
7113 if (RHSSuperType.
isNull())
7124 assert(LHS->
getInterface() &&
"LHS is not an interface type");
7125 assert(RHS->
getInterface() &&
"RHS is not an interface type");
7142 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> SuperClassInheritedProtocols;
7146 for (
auto *RHSPI : RHS->
quals())
7149 if (SuperClassInheritedProtocols.empty())
7152 for (
const auto *LHSProto : LHS->
quals()) {
7153 bool SuperImplementsProtocol =
false;
7154 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
7155 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
7156 SuperImplementsProtocol =
true;
7159 if (!SuperImplementsProtocol)
7189 if (!LHSOPT || !RHSOPT)
7207 bool CompareUnqualified) {
7226 bool OfBlockPointer,
7230 if (UD->
hasAttr<TransparentUnionAttr>()) {
7231 for (
const auto *I : UD->
fields()) {
7232 QualType ET = I->getType().getUnqualifiedType();
7246 bool OfBlockPointer,
7261 return mergeTypes(lhs, rhs, OfBlockPointer, Unqualified);
7265 bool OfBlockPointer,
7271 bool allLTypes =
true;
7272 bool allRTypes =
true;
7276 if (OfBlockPointer) {
7277 QualType RHS = rbase->getReturnType();
7279 bool UnqualifiedResult = Unqualified;
7280 if (!UnqualifiedResult)
7282 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
7334 if (lproto && rproto) {
7335 assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
7336 "C++ shouldn't be here");
7338 if (lproto->getNumParams() != rproto->getNumParams())
7342 if (lproto->isVariadic() != rproto->isVariadic())
7345 if (lproto->getTypeQuals() != rproto->getTypeQuals())
7348 if (LangOpts.ObjCAutoRefCount &&
7354 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
7355 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
7356 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
7358 lParamType, rParamType, OfBlockPointer, Unqualified);
7365 types.push_back(paramType);
7377 if (allLTypes)
return lhs;
7378 if (allRTypes)
return rhs;
7385 if (lproto) allRTypes =
false;
7386 if (rproto) allLTypes =
false;
7397 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
7403 paramTy = Enum->getDecl()->getIntegerType();
7413 if (allLTypes)
return lhs;
7414 if (allRTypes)
return rhs;
7421 if (allLTypes)
return lhs;
7422 if (allRTypes)
return rhs;
7428 QualType other,
bool isBlockReturnType) {
7448 bool OfBlockPointer,
7449 bool Unqualified,
bool BlockReturnType) {
7467 if (LHSCan == RHSCan)
7472 Qualifiers RQuals = RHSCan.getLocalQualifiers();
7473 if (LQuals != RQuals) {
7488 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
7509 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
7510 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
7513 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
7514 LHSClass = Type::ConstantArray;
7515 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
7516 RHSClass = Type::ConstantArray;
7519 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
7520 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
7523 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
7524 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
7527 if (LHSClass != RHSClass) {
7537 if (OfBlockPointer && !BlockReturnType) {
7549 #define TYPE(Class, Base)
7550 #define ABSTRACT_TYPE(Class, Base)
7551 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class:
7552 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class:
7553 #define DEPENDENT_TYPE(Class, Base) case Type::Class:
7554 #include "clang/AST/TypeNodes.def"
7555 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
7558 case Type::LValueReference:
7559 case Type::RValueReference:
7560 case Type::MemberPointer:
7561 llvm_unreachable(
"C++ should never be in mergeTypes");
7563 case Type::ObjCInterface:
7564 case Type::IncompleteArray:
7565 case Type::VariableArray:
7566 case Type::FunctionProto:
7567 case Type::ExtVector:
7568 llvm_unreachable(
"Types are eliminated above");
7588 case Type::BlockPointer:
7624 case Type::ConstantArray:
7671 case Type::FunctionNoProto:
7688 case Type::ObjCObject: {
7699 case Type::ObjCObjectPointer: {
7700 if (OfBlockPointer) {
7716 llvm_unreachable(
"Invalid Type::Class!");
7730 for (
unsigned i = 0, n = FromFunctionType->
getNumParams(); i != n; ++i) {
7744 if (LHSCan == RHSCan)
7746 if (RHSCan->isFunctionType()) {
7750 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
7752 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
7755 if (ResReturnType.
isNull())
7757 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
7774 Qualifiers RQuals = RHSCan.getLocalQualifiers();
7775 if (LQuals != RQuals) {
7788 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
7804 if (ResQT == LHSBaseQT)
7806 if (ResQT == RHSBaseQT)
7818 T = ET->getDecl()->getIntegerType();
7831 VTy->getNumElements(), VTy->getVectorKind());
7835 T = ETy->getDecl()->getIntegerType();
7838 assert(BTy &&
"Unexpected signed integer type");
7840 case BuiltinType::Char_S:
7841 case BuiltinType::SChar:
7843 case BuiltinType::Short:
7845 case BuiltinType::Int:
7847 case BuiltinType::Long:
7849 case BuiltinType::LongLong:
7851 case BuiltinType::Int128:
7854 llvm_unreachable(
"Unexpected signed integer type");
7878 bool AllowTypeModifiers) {
7881 bool Signed =
false, Unsigned =
false;
7882 RequiresICE =
false;
7888 default: Done =
true; --Str;
break;
7893 assert(!Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
7894 assert(!Signed &&
"Can't use 'S' modifier multiple times!");
7898 assert(!Signed &&
"Can't use both 'S' and 'U' modifiers!");
7899 assert(!Unsigned &&
"Can't use 'U' modifier multiple times!");
7903 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
7908 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
7911 llvm_unreachable(
"Unexpected integer type");
7926 default: llvm_unreachable(
"Unknown builtin type letter!");
7928 assert(HowLong == 0 && !Signed && !Unsigned &&
7929 "Bad modifiers used with 'v'!");
7933 assert(HowLong == 0 && !Signed && !Unsigned &&
7934 "Bad modifiers used with 'h'!");
7938 assert(HowLong == 0 && !Signed && !Unsigned &&
7939 "Bad modifiers used with 'f'!");
7943 assert(HowLong < 2 && !Signed && !Unsigned &&
7944 "Bad modifiers used with 'd'!");
7951 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
7960 else if (HowLong == 2)
7962 else if (HowLong == 1)
7968 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
7977 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'b'!");
7981 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'z'!");
7998 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
8010 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
8018 unsigned NumElements = strtoul(Str, &End, 10);
8019 assert(End != Str &&
"Missing vector size");
8023 RequiresICE,
false);
8024 assert(!RequiresICE &&
"Can't require vector ICE");
8034 unsigned NumElements = strtoul(Str, &End, 10);
8035 assert(End != Str &&
"Missing vector size");
8047 assert(!RequiresICE &&
"Can't require complex ICE");
8074 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'K'!");
8088 Done = !AllowTypeModifiers;
8090 switch (
char c = *Str++) {
8091 default: Done =
true; --Str;
break;
8097 unsigned AddrSpace = strtoul(Str, &End, 10);
8098 if (End != Str && AddrSpace != 0) {
8122 "Integer constant 'I' type must be an integer");
8130 unsigned *IntegerConstantArgs)
const {
8135 bool RequiresICE =
false;
8142 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
8144 while (TypeStr[0] && TypeStr[0] !=
'.') {
8151 if (RequiresICE && IntegerConstantArgs)
8152 *IntegerConstantArgs |= 1 << ArgTypes.size();
8158 ArgTypes.push_back(Ty);
8161 if (Id == Builtin::BI__GetExceptionInfo)
8164 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
8165 "'.' should only occur at end of builtin type list!");
8170 bool Variadic = (TypeStr[0] ==
'.');
8173 if (ArgTypes.empty() && Variadic)
8216 !FD->
hasAttr<DLLExportAttr>()) ||
8217 FD->
hasAttr<GNUInlineAttr>()) {
8241 if (D->
hasAttr<DLLImportAttr>()) {
8244 }
else if (D->
hasAttr<DLLExportAttr>()) {
8264 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
8270 StaticLocalLinkage =
8277 : StaticLocalLinkage;
8301 llvm_unreachable(
"Invalid Linkage!");
8310 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
8311 if (!VD->isFileVarDecl())
8316 }
else if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
8320 }
else if (isa<OMPThreadPrivateDecl>(D))
8330 if (D->
hasAttr<WeakRefAttr>())
8337 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
8339 if (!FD->doesThisDeclarationHaveABody())
8340 return FD->doesDeclarationForceExternallyVisibleDefinition();
8343 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
8349 if (
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
8370 const VarDecl *VD = cast<VarDecl>(D);
8395 bool IsCXXMethod)
const {
8398 return ABI->getDefaultMethodCallConv(IsVariadic);
8407 return ABI->isNearlyEmpty(RD);
8411 if (!VTContext.get()) {
8417 return VTContext.get();
8432 llvm_unreachable(
"Unsupported ABI");
8438 return ASTRecordLayouts.getMemorySize() +
8439 llvm::capacity_in_bytes(ObjCLayouts) +
8440 llvm::capacity_in_bytes(KeyFunctions) +
8441 llvm::capacity_in_bytes(ObjCImpls) +
8442 llvm::capacity_in_bytes(BlockVarCopyInits) +
8443 llvm::capacity_in_bytes(DeclAttrs) +
8444 llvm::capacity_in_bytes(TemplateOrInstantiation) +
8445 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
8446 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
8447 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
8448 llvm::capacity_in_bytes(OverriddenMethods) +
8449 llvm::capacity_in_bytes(Types) +
8450 llvm::capacity_in_bytes(VariableArrayTypes) +
8451 llvm::capacity_in_bytes(ClassScopeSpecializationPattern);
8459 unsigned Signed)
const {
8462 if (!QualTy && DestWidth == 128)
8483 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
8488 MangleNumbers[ND] = Number;
8492 llvm::DenseMap<const NamedDecl *, unsigned>::const_iterator I =
8493 MangleNumbers.find(ND);
8494 return I != MangleNumbers.end() ? I->second : 1;
8499 StaticLocalNumbers[VD] = Number;
8503 llvm::DenseMap<const VarDecl *, unsigned>::const_iterator I =
8504 StaticLocalNumbers.find(VD);
8505 return I != StaticLocalNumbers.end() ? I->second : 1;
8510 assert(LangOpts.CPlusPlus);
8518 return ABI->createMangleNumberingContext();
8523 return ABI->getCopyConstructorForExceptionObject(
8529 return ABI->addCopyConstructorForExceptionObject(
8535 unsigned ParmIdx,
Expr *DAE) {
8536 ABI->addDefaultArgExprForConstructor(
8537 cast<CXXConstructorDecl>(CD->
getFirstDecl()), ParmIdx, DAE);
8542 return ABI->getDefaultArgExprForConstructor(
8543 cast<CXXConstructorDecl>(CD->
getFirstDecl()), ParmIdx);
8547 ParamIndices[D] = index;
8551 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
8552 assert(I != ParamIndices.end() &&
8553 "ParmIndices lacks entry set by ParmVarDecl");
8561 "don't need to cache the computed value for this temporary");
8563 return &MaterializedTemporaryValues[E];
8565 llvm::DenseMap<const MaterializeTemporaryExpr *, APValue>::iterator I =
8566 MaterializedTemporaryValues.find(E);
8567 return I == MaterializedTemporaryValues.end() ?
nullptr : &I->second;
8572 if (!T.isOSDarwin())
8575 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
8576 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
8585 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
8606 Visitor.TraverseDecl(&TU);
8607 return Visitor.Parents;
8616 bool shouldVisitTemplateInstantiations()
const {
8619 bool shouldVisitImplicitCode()
const {
8624 bool shouldUseDataRecursionFor(clang::Stmt *S)
const {
8628 template <
typename T>
8629 bool TraverseNode(T *
Node,
bool(VisitorBase:: *traverse) (T *)) {
8632 if (ParentStack.size() > 0) {
8643 auto &NodeOrVector = (*Parents)[
Node];
8644 if (NodeOrVector.isNull()) {
8647 if (NodeOrVector.template is<ast_type_traits::DynTypedNode *>()) {
8649 NodeOrVector.template get<ast_type_traits::DynTypedNode *>();
8651 NodeOrVector = Vector;
8654 assert(NodeOrVector.template is<ASTContext::ParentVector *>());
8657 NodeOrVector.template get<ASTContext::ParentVector *>();
8662 bool Found = ParentStack.back().getMemoizationData() &&
8663 std::find(Vector->begin(), Vector->end(),
8664 ParentStack.back()) != Vector->end();
8666 Vector->push_back(ParentStack.back());
8670 bool Result = (
this ->* traverse) (Node);
8671 ParentStack.pop_back();
8675 bool TraverseDecl(Decl *DeclNode) {
8676 return TraverseNode(DeclNode, &VisitorBase::TraverseDecl);
8679 bool TraverseStmt(
Stmt *StmtNode) {
8680 return TraverseNode(StmtNode, &VisitorBase::TraverseStmt);
8691 ArrayRef<ast_type_traits::DynTypedNode>
8694 "Invariant broken: only nodes that support memoization may be "
8695 "used in the parent map.");
8703 if (I == AllParents->end()) {
8707 return llvm::makeArrayRef(N, 1);
8716 if (MethodDecl->
hasAttr<UnavailableAttr>()
8717 || MethodDecl->
hasAttr<DeprecatedAttr>())
8731 IM != EM && IF != EF; ++IM, ++IF) {
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
bool isObjCSelType() const
StringRef getObjCRuntimeNameAsString() const
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
Internal representation of canonical, dependent typeof(expr) types.
unsigned getNumElements() const
bool hasObjCGCAttr() const
unsigned getAddressSpace() const
getAddressSpace - 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
Defines the clang::ASTContext interface.
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
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
getDecl - 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)
RealType getRealTypeByWidth(unsigned BitWidth) const
Return floating point type with specified width.
void setImplicit(bool I=true)
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. Generally, this value is type-specific, but this alignment can be used for most of the types 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
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
llvm::iterator_range< pack_iterator > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
CanQualType LongDoubleComplexTy
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
Represents the dependent type named by a dependently-scoped typename using declaration, e.g. using typename Base<T>::foo; Template instantiation turns these into the underlying type.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
TemplateName getReplacement() const
void setHidden(bool Hide)
Set whether this declaration is hidden from name lookup.
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
bool isSpecificBuiltinType(unsigned K) const
isSpecificBuiltinType - Test for a particular builtin type.
CanQualType OCLImage1dBufferTy
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
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
ExtInfo withCallingConv(CallingConv cc) const
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
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.
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
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)
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.
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.
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
void Profile(llvm::FoldingSetNodeID &ID)
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
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
getObjCGCAttr - 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)
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)
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...
static QualType getFunctionTypeWithExceptionSpec(ASTContext &Context, QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, NamedDecl **Params, unsigned NumParams, SourceLocation RAngleLoc)
EnumDecl * getPreviousDecl()
CanQualType ObjCBuiltinSelTy
IntType getSizeType() const
void addDefaultArgExprForConstructor(const CXXConstructorDecl *CD, unsigned ParmIdx, Expr *DAE)
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++1y decltype(auto) type.
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.
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
QualType getPointeeType() const
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.
QualType getRecordType(const RecordDecl *Decl) const
const Expr * getInit() const
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
NamespaceDecl - Represent a C++ namespace.
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.
void Profile(llvm::FoldingSetNodeID &ID)
virtual void completeDefinition()
ObjCDeclQualifier getObjCDeclQualifier() const
bool isBooleanType() const
A container of type source information.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
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
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
void setInstantiatedFromUsingDecl(UsingDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template...
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 getVaListTagType() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
unsigned getChar32Width() const
const RawComment * getRaw() const LLVM_READONLY
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
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.
ExtProtoInfo - Extra information about a function prototype.
Declaration context for names declared as extern "C" in C++. This is neither the semantic nor lexical...
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.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
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)
bool hasAnyConsumedParams() const
void addAddressSpace(unsigned space)
void setRaw(const RawComment *RC)
unsigned getLongDoubleWidth() const
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 FunctionTypesMatchOnNSConsumedAttrs(const FunctionProtoType *FromFunctionType, const FunctionProtoType *ToFunctionType)
bool isSpecialized() const
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
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
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
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. Note that this does not always yield a canonical...
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
unsigned getNumParams() const
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class...
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
unsigned getMaxAlignment() const
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>.
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.
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.
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
QualType getAutoType(QualType DeducedType, bool IsDecltypeAuto, bool IsDependent) const
C++11 deduced auto type.
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.
CanQualType OCLImage2dArrayTy
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.
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
Missing a type from <ucontext.h>
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
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
bool isAnyPointerType() const
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl * > &Ivars) const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getBlockDescriptorType() const
void startDefinition()
Starts the definition of this tag declaration.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
unsigned getCVRQualifiers() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
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
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
unsigned getTargetDefaultAlignForAttributeAligned(void) const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
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.
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
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)
bool isNearlyEmpty(const CXXRecordDecl *RD) const
virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const
Gets the default calling convention for the given target and declaration context. ...
static bool areSortedAndUniqued(ObjCProtocolDecl *const *Protocols, unsigned NumProtocols)
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
QualType mergeObjCGCQualifiers(QualType, QualType)
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
Represents a C++ using-declaration.
static void getIntersectionOfProtocols(ASTContext &Context, const ObjCInterfaceDecl *CommonBase, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, SmallVectorImpl< ObjCProtocolDecl * > &IntersectionSet)
QualType getParenType(QualType NamedType) const
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)
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
QualType getOriginalType() const
const LangOptions & getLangOpts() const
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
void addObjCGCAttr(GC type)
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
const llvm::fltSemantics & getDoubleFormat() const
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.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
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
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
TypeOfExprType (GCC extension).
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
CanQualType PseudoObjectTy
bool isValueDependent() const
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
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
Selector getSetterName() const
bool isUnsignedIntegerType() const
void Profile(llvm::FoldingSetNodeID &ID)
std::string getNameAsString() const
Expr * IgnoreParenCasts() LLVM_READONLY
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
static bool hasAnyPackExpansions(const TemplateArgument *Args, unsigned NumArgs)
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...
uint64_t getFieldOffset(unsigned FieldNo) const
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
Def If non-NULL, and the type refers to some kind of declaration that can be completed (such as a C s...
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
bool isStaticLocal() const
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 preorder depth-first traversal on the entire Clang AST and visits each node...
Represents an ObjC class declaration.
propimpl_range property_impls() const
PropertyAttributeKind getPropertyAttributes() const
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type...
QualType getCanonicalTypeInternal() const
unsigned getWCharWidth() const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
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'.
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
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
EnumDecl * getDecl() const
QualType getTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs, QualType Canon=QualType()) const
void Profile(llvm::FoldingSetNodeID &ID)
static bool isCanonicalResultType(QualType T)
Determine whether T is canonical as the result type of a function.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getValueType() const
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
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
Qualifiers::ObjCLifetime getObjCLifetime() const
getObjCLifetime - Returns lifetime attribute of this type.
static unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
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.
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)
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
ID
Defines the set of possible language-specific address spaces.
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
QualType getPointeeType() const
unsigned getCharAlign() const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
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 isRealFloatingType() const
Floating point categories.
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.
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
DeclContext * getLexicalParent()
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
QualType getSuperClassType() const
QualType getPointeeType() const
QualType getBlockDescriptorExtendedType() const
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
IntType getIntPtrType() const
MatchFinder::MatchCallback * Callback
static std::pair< CharUnits, CharUnits > getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
bool isObjCClassType() const
SetterKind getSetterKind() const
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.
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
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)
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...
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 std::string charUnitsToString(const CharUnits &CU)
void Profile(llvm::FoldingSetNodeID &ID)
ArgKind getKind() const
Return the kind of stored template argument.
ExtProtoInfo getExtProtoInfo() const
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &O)
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
void removeFastQualifiers(unsigned mask)
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
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...
internal::Matcher< T > id(StringRef ID, const internal::BindableMatcher< T > &InnerMatcher)
If the provided matcher matches a node, binds the node to ID.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
Represents a C++ template name within the type system.
MangleNumberingContext * createMangleNumberingContext() const
const bool * ConsumedParameters
static TypedefDecl * CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context)
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
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...
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
bool isDependentType() const
bool isInstanceMethod() const
clang::ObjCRuntime ObjCRuntime
Qualifiers Quals
The local qualifiers.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isObjCQualifiedIdType() const
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.
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
bool isExternallyVisible() const
struct CXXOpName CXXOperatorName
unsigned getChar32Align() const
NamedDecl * getInstantiatedFromUsingDecl(UsingDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
DeclarationName getDeclName() const
QualType getSubstTemplateTypeParmPackType(const TemplateTypeParmType *Replaced, const TemplateArgument &ArgPack)
Retrieve a.
Implements C++ ABI-specific semantic analysis functions.
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list. Call this if you might have added duplicates into the list...
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
QualType getElementType() const
The result type of a method or function.
unsigned getWCharAlign() const
bool ObjCQualifiedClassTypesAreCompatible(QualType LHS, QualType RHS)
bool getObjCEncodingForFunctionDecl(const FunctionDecl *Decl, std::string &S)
Emit the encoded type for the function Decl into S.
RecordDecl * getDefinition() const
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)
CallingConv
CallingConv - Specifies the calling convention that a function uses.
unsigned getLongAlign() const
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
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...
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
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.
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.
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.
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
uint64_t getPointerAlign(unsigned AddrSpace) const
unsigned getMinGlobalAlign() const
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. The SourceManager can decode this to get at the full include stack...
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
const Type * getTypePtr() const
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
TypeOfType (GCC extension).
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...
static GVALinkage adjustGVALinkageForDLLAttribute(GVALinkage L, const Decl *D)
A structure for storing an already-substituted template template parameter pack.
bool isComplexType() const
bool isBuiltinType() const
isBuiltinType - returns true if the type is a builtin type.
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
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
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
Represents a static or instance method of a struct/union/class.
bool isObjCBuiltinType() const
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one...
void Profile(llvm::FoldingSetNodeID &ID)
DiagnosticsEngine & getDiagnostics() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
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...
const ConstantArrayType * getAsConstantArrayType(QualType T) const
const ObjCInterfaceDecl * getClassInterface() const
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
SplitQualType getSplitDesugaredType() const
const Type * getBaseElementTypeUnsafe() const
This declaration is only a declaration.
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. "foo:bar:") and return it as an std::string.
IntType getUIntMaxType() const
Represents one property declaration in an Objective-C interface.
bool canBindObjCObjectType(QualType To, QualType From)
unsigned getNumProtocols() const
bool isObjCQualifiedClassType() const
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
QualType getReturnType() const
bool isTypeDependent() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
bool typesAreBlockPointerCompatible(QualType, QualType)
bool isVectorType() const
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
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.
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
const BlockDecl * getBlockDecl() const
bool isDynamicClass() const
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 injected class name of a C++ class template or class template partial specialization. Used to record that a type was spelled with a bare identifier rather than as a template-id; the equivalent for non-templated classes is just RecordType.
QualType getPointeeType() const
void getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container, std::string &S) const
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
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
void setTemplateKeywordLoc(SourceLocation Loc)
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
ObjCIvarDecl * getNextIvar()
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
const char * GetTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
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. It will iterate at least once ...
static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)
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
static const Type * getElementType(const Expr *BaseExpr)
const llvm::fltSemantics & getLongDoubleFormat() const
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
QualType getCanonicalTemplateSpecializationType(TemplateName T, const TemplateArgument *Args, unsigned NumArgs) const
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type. Can only be called on array an...
not evaluated yet, for special member function
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
A qualifier set is used to build a set of qualifiers.
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false)
bool isSentinelNullExpr(const Expr *E)
The base class of all kinds of template declarations (e.g., class, function, etc.).
CanQualType DoubleComplexTy
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.
ArrayRef< ast_type_traits::DynTypedNode > getParents(const NodeT &Node)
Returns the parents of the given node.
static FloatingRank getFloatingRank(QualType T)
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
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)
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.
const ObjCInterfaceType * getInterfaceType() const
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)
CallingConv getCC() const
const Type * strip(QualType 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. If this could be a tentative definition (in C)...
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.
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.
Selector getSelector() const
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
void Profile(llvm::FoldingSetNodeID &ID)
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
virtual ~ASTMutationListener()
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
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...
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)
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
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
CanQualType ObjCBuiltinBoolTy
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration. Returns NULL if no comment is attac...
unsigned getAlignOfGlobalVar(QualType T) const
Return the alignment in bits that should be given to a global variable with type T.
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>. Pointer - pointer requires t...
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
QualType getCanonicalType() const
ObjCTypeParamList * getTypeParamList() const
CanQualType UnsignedLongTy
ObjCInterfaceDecl * getInterfaceDecl() const
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...
void Profile(llvm::FoldingSetNodeID &ID)
QualType getIntegralType() const
Retrieve the type of the integral value.
bool isObjCQualifiedIdType() const
QualType getIntegerType() const
static char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
bool isFunctionType() const
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
CanQualType ObjCBuiltinClassTy
bool isComplete() const
Returns true if this can be considered a complete type.
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)
void setBlockVarCopyInits(VarDecl *VD, Expr *Init)
Set the copy inialization expression of a block var decl.
unsigned getIntWidth() const
unsigned getLongLongWidth() const
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
bool getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, std::string &S, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
bool isStaticDataMember() const
Determines whether this is a static data member.
CharUnits getNonVirtualSize() const
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
unsigned getFieldIndex() const
QualType getPointeeType() const
TypeDecl * getFloat128StubType() const
Retrieve the declaration for a 128-bit float stub type.
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
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...
const Type * getClass() const
Reading or writing from this object requires a barrier call.
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.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
bool hasAddressSpace() const
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
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...
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
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.
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
bool isObjCObjectPointerType() const
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)
type_const_range types() const
CanQualType OCLImage1dArrayTy
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
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
CharUnits getDataSize() const
static unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
Builtin::Context & BuiltinInfo
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.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
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.
unsigned getLongWidth() const
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
QualType getParamTypeForDecl() const
Defines the clang::TargetInfo interface.
ObjCInterfaceDecl * getSuperClass() const
void setRAngleLoc(SourceLocation Loc)
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)
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
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)
Expr * getDefaultArgExprForConstructor(const CXXConstructorDecl *CD, unsigned ParmIdx)
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...
static void PrintTemplateArgumentList(raw_ostream &OS, const TemplateArgument *Args, unsigned NumArgs, const PrintingPolicy &Policy, bool SkipBrackets=false)
Print a template argument list, including the '<' and '>' enclosing the template arguments...
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.
void InitBuiltinTypes(const TargetInfo &Target)
Initialize built-in types.
llvm::DenseMap< const void *, llvm::PointerUnion< ast_type_traits::DynTypedNode *, ParentVector * > > ParentMap
Maps from a node to its parents.
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
ObjCIvarDecl * all_declared_ivar_begin()
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)
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)
bool isSignedIntegerType() const
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
isNull - 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
Missing a type from <setjmp.h>
void setType(QualType newType)
base_class_range vbases()
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.
static void SortAndUniqueProtocols(ObjCProtocolDecl **Protocols, unsigned &NumProtocols)
Declaration of a template function.
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
const RecordDecl * getParent() const
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
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>. We need this to compute the correct type...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
bool isPointerType() const
static unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
bool isMacroArgExpansion(SourceLocation Loc) const
Tests whether the given source location represents a macro argument's expansion into the function-lik...
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
QualType getDeducedType() const
Get the type deduced for this auto type, or null if it's either not been deduced or was deduced to a ...