62 #include "llvm/ADT/APInt.h" 63 #include "llvm/ADT/APSInt.h" 64 #include "llvm/ADT/ArrayRef.h" 65 #include "llvm/ADT/DenseMap.h" 66 #include "llvm/ADT/DenseSet.h" 67 #include "llvm/ADT/FoldingSet.h" 68 #include "llvm/ADT/None.h" 69 #include "llvm/ADT/Optional.h" 70 #include "llvm/ADT/PointerUnion.h" 71 #include "llvm/ADT/STLExtras.h" 72 #include "llvm/ADT/SmallPtrSet.h" 73 #include "llvm/ADT/SmallVector.h" 74 #include "llvm/ADT/StringExtras.h" 75 #include "llvm/ADT/StringRef.h" 76 #include "llvm/ADT/Triple.h" 77 #include "llvm/Support/Capacity.h" 78 #include "llvm/Support/Casting.h" 79 #include "llvm/Support/Compiler.h" 80 #include "llvm/Support/ErrorHandling.h" 81 #include "llvm/Support/MathExtras.h" 82 #include "llvm/Support/raw_ostream.h" 94 using namespace clang;
119 assert(std::is_sorted(RawComments.begin(), RawComments.end(),
133 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
138 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
139 if (VD->isStaticDataMember() &&
150 dyn_cast<ClassTemplateSpecializationDecl>(D)) {
157 if (
const EnumDecl *ED = dyn_cast<EnumDecl>(D)) {
161 if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
164 if (TD->isEmbeddedInDeclarator() && !TD->isCompleteDefinition())
168 if (isa<ParmVarDecl>(D))
173 if (isa<TemplateTypeParmDecl>(D) ||
174 isa<NonTypeTemplateParmDecl>(D) ||
175 isa<TemplateTemplateParmDecl>(D))
181 if (RawComments.empty())
191 if (isa<ObjCMethodDecl>(D) || isa<ObjCContainerDecl>(D) ||
192 isa<ObjCPropertyDecl>(D) ||
193 isa<RedeclarableTemplateDecl>(D) ||
194 isa<ClassTemplateSpecializationDecl>(D))
199 if (isa<TypedefDecl>(D)) {
204 }
else if (
const TagDecl *TD = dyn_cast<TagDecl>(D)) {
211 TD->isCompleteDefinition())
233 bool Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
234 if (!Found && RawComments.size() >= 2) {
236 Found = Compare(*MaybeBeforeDecl, &CommentAtDeclLoc);
240 Comment = MaybeBeforeDecl + 1;
241 assert(Comment == std::lower_bound(RawComments.begin(), RawComments.end(),
242 &CommentAtDeclLoc, Compare));
245 Comment = std::lower_bound(RawComments.begin(), RawComments.end(),
246 &CommentAtDeclLoc, Compare);
252 std::pair<FileID, unsigned> DeclLocDecomp = SourceMgr.
getDecomposedLoc(DeclLoc);
255 if (Comment != RawComments.end() &&
256 (*Comment)->isDocumentation() && (*Comment)->isTrailingComment() &&
257 (isa<FieldDecl>(D) || isa<EnumConstantDecl>(D) || isa<VarDecl>(D) ||
258 isa<ObjCMethodDecl>(D) || isa<ObjCPropertyDecl>(D))) {
259 std::pair<FileID, unsigned> CommentBeginDecomp
263 if (DeclLocDecomp.first == CommentBeginDecomp.first &&
264 SourceMgr.
getLineNumber(DeclLocDecomp.first, DeclLocDecomp.second)
266 CommentBeginDecomp.second)) {
273 if (Comment == RawComments.begin())
278 if (!(*Comment)->isDocumentation() || (*Comment)->isTrailingComment())
282 std::pair<FileID, unsigned> CommentEndDecomp
287 if (DeclLocDecomp.first != CommentEndDecomp.first)
291 bool Invalid =
false;
292 const char *Buffer = SourceMgr.
getBufferData(DeclLocDecomp.first,
298 StringRef
Text(Buffer + CommentEndDecomp.second,
299 DeclLocDecomp.second - CommentEndDecomp.second);
303 if (Text.find_first_of(
";{}#@") != StringRef::npos)
313 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
333 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
336 if (VD->isStaticDataMember())
350 dyn_cast<ClassTemplateSpecializationDecl>(CRD)) {
356 return PU.is<ClassTemplateDecl*>() ?
357 static_cast<const Decl*>(PU.get<ClassTemplateDecl *>()) :
358 static_cast<const Decl*>(
364 CRD->getMemberSpecializationInfo())
365 return Info->getInstantiatedFrom();
369 if (
const EnumDecl *ED = dyn_cast<EnumDecl>(D)) {
382 const Decl **OriginalDecl)
const {
387 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
401 const Decl *OriginalDeclForRC =
nullptr;
403 llvm::DenseMap<const Decl *, RawCommentAndCacheFlags>::iterator Pos =
414 OriginalDeclForRC = I;
434 *OriginalDecl = OriginalDeclForRC;
454 if (
const ObjCImplDecl *IMD = dyn_cast<ObjCImplDecl>(DC)) {
463 Redeclared.push_back(RedeclaredMethod);
469 const Decl *D)
const {
473 ThisDeclInfo->
fill();
485 return RC ? RC->
parse(*
this,
nullptr, D) :
nullptr;
496 llvm::DenseMap<const Decl *, comments::FullComment *>::iterator Pos =
500 if (Canonical != D) {
508 const Decl *OriginalDecl;
512 if (isa<ObjCMethodDecl>(D) || isa<FunctionDecl>(D)) {
522 for (
unsigned i = 0, e = Overridden.size(); i < e; i++)
529 QualType QT = TD->getUnderlyingType();
531 if (
const Decl *TD = TT->getDecl())
536 while (IC->getSuperClass()) {
537 IC = IC->getSuperClass();
547 else if (
const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
548 if (!(RD = RD->getDefinition()))
551 for (
const auto &I : RD->bases()) {
552 if (I.isVirtual() || (I.getAccessSpecifier() !=
AS_public))
558 if (!(NonVirtualBase= NonVirtualBase->getDefinition()))
566 for (
const auto &I : RD->vbases()) {
573 if (!(VirtualBase= VirtualBase->getDefinition()))
587 if (D != OriginalDecl)
596 ASTContext::CanonicalTemplateTemplateParm::Profile(llvm::FoldingSetNodeID &
ID,
603 ID.AddInteger(Params->
size());
605 PEnd = Params->
end();
609 ID.AddBoolean(TTP->isParameterPack());
615 ID.AddBoolean(NTTP->isParameterPack());
616 ID.AddPointer(NTTP->getType().getCanonicalType().getAsOpaquePtr());
617 if (NTTP->isExpandedParameterPack()) {
619 ID.AddInteger(NTTP->getNumExpansionTypes());
620 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
625 ID.AddBoolean(
false);
636 ASTContext::getCanonicalTemplateTemplateParmDecl(
639 llvm::FoldingSetNodeID
ID;
640 CanonicalTemplateTemplateParm::Profile(ID, TTP);
641 void *InsertPos =
nullptr;
642 CanonicalTemplateTemplateParm *Canonical
643 = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
645 return Canonical->getParam();
650 CanonParams.reserve(Params->
size());
652 PEnd = Params->
end();
655 CanonParams.push_back(
663 = dyn_cast<NonTypeTemplateParmDecl>(*
P)) {
667 if (NTTP->isExpandedParameterPack()) {
670 for (
unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
672 ExpandedTInfos.push_back(
680 NTTP->getPosition(),
nullptr,
690 NTTP->getPosition(),
nullptr,
692 NTTP->isParameterPack(),
695 CanonParams.push_back(Param);
698 CanonParams.push_back(getCanonicalTemplateTemplateParmDecl(
699 cast<TemplateTemplateParmDecl>(*
P)));
703 "Unexpected requires-clause on template template-parameter");
704 Expr *
const CanonRequiresClause =
nullptr;
716 CanonRequiresClause));
719 Canonical = CanonTemplateTemplateParms.FindNodeOrInsertPos(ID, InsertPos);
720 assert(!Canonical &&
"Shouldn't be in the map!");
724 Canonical =
new (*this) CanonicalTemplateTemplateParm(CanonTTP);
725 CanonTemplateTemplateParms.InsertNode(Canonical, InsertPos);
730 if (!LangOpts.CPlusPlus)
return nullptr;
745 llvm_unreachable(
"Invalid CXXABI type!");
750 if (LOpts.FakeAddressSpaceMap) {
753 static const unsigned FakeAddrSpaceMap[] = {
764 return &FakeAddrSpaceMap;
772 switch (LangOpts.getAddressSpaceMapMangling()) {
780 llvm_unreachable(
"getAddressSpaceMapMangling() doesn't cover anything.");
786 : FunctionProtoTypes(this_()), TemplateSpecializationTypes(this_()),
787 DependentTemplateSpecializationTypes(this_()),
788 SubstTemplateTemplateParmPacks(this_()), SourceMgr(SM), LangOpts(LOpts),
791 LangOpts.XRayNeverInstrumentFiles, SM)),
794 CommentCommandTraits(BumpAlloc, LOpts.CommentOpts), LastSDM(nullptr, 0) {
799 ReleaseParentMapEntries();
803 ReleaseDeclContextMaps();
806 for (
auto &Pair : Deallocations)
807 (Pair.first)(Pair.second);
813 I = ObjCLayouts.begin(), E = ObjCLayouts.end(); I != E; )
818 for (llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*>::iterator
819 I = ASTRecordLayouts.begin(), E = ASTRecordLayouts.end(); I != E; ) {
825 for (llvm::DenseMap<const Decl*, AttrVec*>::iterator A = DeclAttrs.begin(),
826 AEnd = DeclAttrs.end();
828 A->second->~AttrVec();
830 for (std::pair<const MaterializeTemporaryExpr *, APValue *> &MTVPair :
831 MaterializedTemporaryValues)
832 MTVPair.second->~APValue();
834 for (
const auto &
Value : ModuleInitializers)
835 Value.second->~PerModuleInitializers();
838 void ASTContext::ReleaseParentMapEntries() {
839 if (!PointerParents)
return;
840 for (
const auto &Entry : *PointerParents) {
847 for (
const auto &Entry : *OtherParents) {
857 Deallocations.push_back({Callback, Data});
866 llvm::errs() <<
"\n*** AST Context Stats:\n";
867 llvm::errs() <<
" " << Types.size() <<
" types total.\n";
869 unsigned counts[] = {
870 #define TYPE(Name, Parent) 0, 871 #define ABSTRACT_TYPE(Name, Parent) 872 #include "clang/AST/TypeNodes.def" 876 for (
unsigned i = 0, e = Types.size(); i != e; ++i) {
882 unsigned TotalBytes = 0;
883 #define TYPE(Name, Parent) \ 885 llvm::errs() << " " << counts[Idx] << " " << #Name \ 887 TotalBytes += counts[Idx] * sizeof(Name##Type); \ 889 #define ABSTRACT_TYPE(Name, Parent) 890 #include "clang/AST/TypeNodes.def" 892 llvm::errs() <<
"Total bytes = " << TotalBytes <<
"\n";
897 <<
" implicit default constructors created\n";
900 <<
" implicit copy constructors created\n";
904 <<
" implicit move constructors created\n";
907 <<
" implicit copy assignment operators created\n";
911 <<
" implicit move assignment operators created\n";
914 <<
" implicit destructors created\n";
917 llvm::errs() <<
"\n";
921 BumpAlloc.PrintStats();
925 bool NotifyListeners) {
931 MergedDefModules[ND].push_back(M);
937 auto It = MergedDefModules.find(ND);
938 if (It == MergedDefModules.end())
941 auto &Merged = It->second;
944 if (!Found.insert(M).second)
946 Merged.erase(std::remove(Merged.begin(), Merged.end(),
nullptr), Merged.end());
949 void ASTContext::PerModuleInitializers::resolve(
ASTContext &Ctx) {
950 if (LazyInitializers.empty())
954 assert(Source &&
"lazy initializers but no external source");
956 auto LazyInits = std::move(LazyInitializers);
957 LazyInitializers.clear();
959 for (
auto ID : LazyInits)
960 Initializers.push_back(Source->GetExternalDecl(
ID));
962 assert(LazyInitializers.empty() &&
963 "GetExternalDecl for lazy module initializer added more inits");
969 if (
auto *
ID = dyn_cast<ImportDecl>(D)) {
970 auto It = ModuleInitializers.find(
ID->getImportedModule());
973 if (It == ModuleInitializers.end())
977 auto &Imported = *It->second;
978 if (Imported.Initializers.size() + Imported.LazyInitializers.size() == 1) {
979 Imported.resolve(*
this);
980 auto *OnlyDecl = Imported.Initializers.front();
981 if (isa<ImportDecl>(OnlyDecl))
986 auto *&
Inits = ModuleInitializers[M];
988 Inits =
new (*this) PerModuleInitializers;
989 Inits->Initializers.push_back(D);
993 auto *&
Inits = ModuleInitializers[M];
995 Inits =
new (*this) PerModuleInitializers;
996 Inits->LazyInitializers.insert(
Inits->LazyInitializers.end(),
997 IDs.begin(), IDs.end());
1001 auto It = ModuleInitializers.find(M);
1002 if (It == ModuleInitializers.end())
1005 auto *
Inits = It->second;
1006 Inits->resolve(*
this);
1007 return Inits->Initializers;
1011 if (!ExternCContext)
1014 return ExternCContext;
1021 BuiltinTemplate->setImplicit();
1022 TUDecl->
addDecl(BuiltinTemplate);
1024 return BuiltinTemplate;
1029 if (!MakeIntegerSeqDecl)
1032 return MakeIntegerSeqDecl;
1037 if (!TypePackElementDecl)
1040 return TypePackElementDecl;
1054 NewDecl->addAttr(TypeVisibilityAttr::CreateImplicit(
1060 StringRef Name)
const {
1084 Types.push_back(Ty);
1089 assert((!this->Target || this->Target == &Target) &&
1090 "Incorrect target reinitialization");
1093 this->Target = &Target;
1094 this->AuxTarget = AuxTarget;
1096 ABI.reset(createCXXABI(Target));
1101 InitBuiltinType(
VoidTy, BuiltinType::Void);
1104 InitBuiltinType(
BoolTy, BuiltinType::Bool);
1106 if (LangOpts.CharIsSigned)
1107 InitBuiltinType(
CharTy, BuiltinType::Char_S);
1109 InitBuiltinType(
CharTy, BuiltinType::Char_U);
1112 InitBuiltinType(
ShortTy, BuiltinType::Short);
1113 InitBuiltinType(
IntTy, BuiltinType::Int);
1114 InitBuiltinType(
LongTy, BuiltinType::Long);
1115 InitBuiltinType(
LongLongTy, BuiltinType::LongLong);
1125 InitBuiltinType(
FloatTy, BuiltinType::Float);
1126 InitBuiltinType(
DoubleTy, BuiltinType::Double);
1127 InitBuiltinType(
LongDoubleTy, BuiltinType::LongDouble);
1130 InitBuiltinType(
Float128Ty, BuiltinType::Float128);
1133 InitBuiltinType(
Float16Ty, BuiltinType::Float16);
1136 InitBuiltinType(
Int128Ty, BuiltinType::Int128);
1141 InitBuiltinType(
WCharTy, BuiltinType::WChar_S);
1143 InitBuiltinType(
WCharTy, BuiltinType::WChar_U);
1144 if (LangOpts.CPlusPlus && LangOpts.WChar)
1148 WideCharTy = getFromTargetType(Target.getWCharType());
1151 WIntTy = getFromTargetType(Target.getWIntType());
1153 if (LangOpts.CPlusPlus)
1154 InitBuiltinType(
Char16Ty, BuiltinType::Char16);
1156 Char16Ty = getFromTargetType(Target.getChar16Type());
1158 if (LangOpts.CPlusPlus)
1159 InitBuiltinType(
Char32Ty, BuiltinType::Char32);
1161 Char32Ty = getFromTargetType(Target.getChar32Type());
1168 InitBuiltinType(
DependentTy, BuiltinType::Dependent);
1171 InitBuiltinType(
OverloadTy, BuiltinType::Overload);
1180 InitBuiltinType(
UnknownAnyTy, BuiltinType::UnknownAny);
1186 InitBuiltinType(
BuiltinFnTy, BuiltinType::BuiltinFn);
1189 if (LangOpts.OpenMP)
1203 if (LangOpts.OpenCL) {
1204 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1205 InitBuiltinType(SingletonId, BuiltinType::Id); 1206 #include "clang/Basic/OpenCLImageTypes.def" 1208 InitBuiltinType(
OCLSamplerTy, BuiltinType::OCLSampler);
1209 InitBuiltinType(
OCLEventTy, BuiltinType::OCLEvent);
1211 InitBuiltinType(
OCLQueueTy, BuiltinType::OCLQueue);
1219 ObjCConstantStringType =
QualType();
1224 if (LangOpts.OpenCLVersion >= 200) {
1234 InitBuiltinType(
NullPtrTy, BuiltinType::NullPtr);
1237 InitBuiltinType(
HalfTy, BuiltinType::Half);
1259 llvm::DenseMap<const Decl*, AttrVec*>::iterator Pos = DeclAttrs.find(D);
1260 if (Pos != DeclAttrs.end()) {
1261 Pos->second->~AttrVec();
1262 DeclAttrs.erase(Pos);
1276 llvm::DenseMap<const VarDecl *, TemplateOrSpecializationInfo>::iterator Pos =
1277 TemplateOrInstantiation.find(Var);
1278 if (Pos == TemplateOrInstantiation.end())
1291 Tmpl, TSK, PointOfInstantiation));
1297 assert(!TemplateOrInstantiation[Inst] &&
1298 "Already noted what the variable was instantiated from");
1299 TemplateOrInstantiation[Inst] = TSI;
1304 assert(FD &&
"Specialization is 0");
1305 llvm::DenseMap<const FunctionDecl*, FunctionDecl *>::const_iterator Pos
1306 = ClassScopeSpecializationPattern.find(FD);
1307 if (Pos == ClassScopeSpecializationPattern.end())
1315 assert(FD &&
"Specialization is 0");
1316 assert(Pattern &&
"Class scope specialization pattern is 0");
1317 ClassScopeSpecializationPattern[FD] = Pattern;
1322 auto Pos = InstantiatedFromUsingDecl.find(UUD);
1323 if (Pos == InstantiatedFromUsingDecl.end())
1331 assert((isa<UsingDecl>(Pattern) ||
1332 isa<UnresolvedUsingValueDecl>(Pattern) ||
1333 isa<UnresolvedUsingTypenameDecl>(Pattern)) &&
1334 "pattern decl is not a using decl");
1335 assert((isa<UsingDecl>(Inst) ||
1336 isa<UnresolvedUsingValueDecl>(Inst) ||
1337 isa<UnresolvedUsingTypenameDecl>(Inst)) &&
1338 "instantiation did not produce a using decl");
1339 assert(!InstantiatedFromUsingDecl[Inst] &&
"pattern already exists");
1340 InstantiatedFromUsingDecl[Inst] = Pattern;
1345 llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>::const_iterator Pos
1346 = InstantiatedFromUsingShadowDecl.find(Inst);
1347 if (Pos == InstantiatedFromUsingShadowDecl.end())
1356 assert(!InstantiatedFromUsingShadowDecl[Inst] &&
"pattern already exists");
1357 InstantiatedFromUsingShadowDecl[Inst] = Pattern;
1361 llvm::DenseMap<FieldDecl *, FieldDecl *>::iterator Pos
1362 = InstantiatedFromUnnamedFieldDecl.find(Field);
1363 if (Pos == InstantiatedFromUnnamedFieldDecl.end())
1371 assert(!Inst->
getDeclName() &&
"Instantiated field decl is not unnamed");
1372 assert(!Tmpl->
getDeclName() &&
"Template field decl is not unnamed");
1373 assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
1374 "Already noted what unnamed field was instantiated from");
1376 InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
1392 return Range.end() - Range.begin();
1397 llvm::DenseMap<const CXXMethodDecl *, CXXMethodVector>::const_iterator Pos =
1399 if (Pos == OverriddenMethods.end())
1407 OverriddenMethods[Method].push_back(Overridden);
1415 if (
const CXXMethodDecl *CXXMethod = dyn_cast<CXXMethodDecl>(D)) {
1427 Overridden.append(OverDecls.begin(), OverDecls.end());
1431 assert(!Import->NextLocalImport &&
"Import declaration already in the chain");
1432 assert(!Import->
isFromASTFile() &&
"Non-local import declaration");
1433 if (!FirstLocalImport) {
1434 FirstLocalImport = Import;
1435 LastLocalImport = Import;
1439 LastLocalImport->NextLocalImport = Import;
1440 LastLocalImport = Import;
1451 assert(BT &&
"Not a floating point type!");
1453 default: llvm_unreachable(
"Not a floating point type!");
1454 case BuiltinType::Float16:
1455 case BuiltinType::Half:
1467 bool UseAlignAttrOnly =
false;
1469 Align = AlignFromAttr;
1477 if (isa<FieldDecl>(D)) {
1478 UseAlignAttrOnly = D->
hasAttr<PackedAttr>() ||
1479 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1481 UseAlignAttrOnly =
true;
1484 else if (isa<FieldDecl>(D))
1487 cast<FieldDecl>(D)->getParent()->hasAttr<PackedAttr>();
1491 if (UseAlignAttrOnly) {
1493 }
else if (
const ValueDecl *VD = dyn_cast<ValueDecl>(D)) {
1503 Align = getTypeInfoImpl(T.
getTypePtr()).Align;
1504 else if (!BaseT->isIncompleteType()) {
1509 if (!ForAlignof && MinWidth) {
1512 else if (isa<ConstantArrayType>(
arrayType) &&
1513 MinWidth <= getTypeSize(cast<ConstantArrayType>(
arrayType)))
1518 if (BaseT.getQualifiers().hasUnaligned())
1520 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
1521 if (VD->hasGlobalStorage() && !ForAlignof)
1531 if (
const FieldDecl *Field = dyn_cast<FieldDecl>(VD)) {
1545 uint64_t LowBitOfOffset = Offset & (~Offset + 1);
1546 if (LowBitOfOffset < FieldAlign)
1547 FieldAlign =
static_cast<unsigned>(LowBitOfOffset);
1550 Align =
std::min(Align, FieldAlign);
1562 std::pair<CharUnits, CharUnits>
1576 return sizeAndAlign;
1581 std::pair<CharUnits, CharUnits>
1584 std::pair<CharUnits, CharUnits> EltInfo =
1586 uint64_t Size = CAT->
getSize().getZExtValue();
1587 assert((Size == 0 || static_cast<uint64_t>(EltInfo.first.getQuantity()) <=
1588 (uint64_t)(-1)/Size) &&
1589 "Overflow in array type char size evaluation");
1590 uint64_t Width = EltInfo.first.getQuantity() * Size;
1591 unsigned Align = EltInfo.second.getQuantity();
1594 Width = llvm::alignTo(Width, Align);
1599 std::pair<CharUnits, CharUnits>
1608 std::pair<CharUnits, CharUnits>
1624 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1635 if (
unsigned Align = TT->getDecl()->getMaxAlignment())
1640 return TT->getDecl()->getMaxAlignment();
1646 TypeInfoMap::iterator I = MemoizedTypeInfo.find(T);
1647 if (I != MemoizedTypeInfo.end())
1652 MemoizedTypeInfo[
T] = TI;
1662 TypeInfo ASTContext::getTypeInfoImpl(
const Type *T)
const {
1665 bool AlignIsRequired =
false;
1668 #define TYPE(Class, Base) 1669 #define ABSTRACT_TYPE(Class, Base) 1670 #define NON_CANONICAL_TYPE(Class, Base) 1671 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 1672 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) \ 1674 assert(!T->isDependentType() && "should not see dependent types here"); \ 1675 return getTypeInfo(cast<Class##Type>(T)->desugar().getTypePtr()); 1676 #include "clang/AST/TypeNodes.def" 1677 llvm_unreachable(
"Should not see dependent types");
1679 case Type::FunctionNoProto:
1680 case Type::FunctionProto:
1686 case Type::IncompleteArray:
1687 case Type::VariableArray:
1689 Align =
getTypeAlign(cast<ArrayType>(T)->getElementType());
1692 case Type::ConstantArray: {
1696 uint64_t Size = CAT->
getSize().getZExtValue();
1697 assert((Size == 0 || EltInfo.Width <= (uint64_t)(-1) / Size) &&
1698 "Overflow in array type bit size evaluation");
1699 Width = EltInfo.Width * Size;
1700 Align = EltInfo.Align;
1703 Width = llvm::alignTo(Width, Align);
1706 case Type::ExtVector:
1707 case Type::Vector: {
1714 if (Align & (Align-1)) {
1715 Align = llvm::NextPowerOf2(Align);
1716 Width = llvm::alignTo(Width, Align);
1720 if (TargetVectorAlign && TargetVectorAlign < Align)
1721 Align = TargetVectorAlign;
1726 switch (cast<BuiltinType>(T)->
getKind()) {
1727 default: llvm_unreachable(
"Unknown builtin type!");
1728 case BuiltinType::Void:
1733 case BuiltinType::Bool:
1737 case BuiltinType::Char_S:
1738 case BuiltinType::Char_U:
1739 case BuiltinType::UChar:
1740 case BuiltinType::SChar:
1744 case BuiltinType::WChar_S:
1745 case BuiltinType::WChar_U:
1749 case BuiltinType::Char16:
1753 case BuiltinType::Char32:
1757 case BuiltinType::UShort:
1758 case BuiltinType::Short:
1762 case BuiltinType::UInt:
1763 case BuiltinType::Int:
1767 case BuiltinType::ULong:
1768 case BuiltinType::Long:
1772 case BuiltinType::ULongLong:
1773 case BuiltinType::LongLong:
1777 case BuiltinType::Int128:
1778 case BuiltinType::UInt128:
1782 case BuiltinType::Float16:
1783 case BuiltinType::Half:
1787 case BuiltinType::Float:
1791 case BuiltinType::Double:
1795 case BuiltinType::LongDouble:
1799 case BuiltinType::Float128:
1803 case BuiltinType::NullPtr:
1807 case BuiltinType::ObjCId:
1808 case BuiltinType::ObjCClass:
1809 case BuiltinType::ObjCSel:
1813 case BuiltinType::OCLSampler:
1814 case BuiltinType::OCLEvent:
1815 case BuiltinType::OCLClkEvent:
1816 case BuiltinType::OCLQueue:
1817 case BuiltinType::OCLReserveID:
1818 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1819 case BuiltinType::Id: 1820 #include "clang/Basic/OpenCLImageTypes.def" 1828 case Type::ObjCObjectPointer:
1832 case Type::BlockPointer:
1837 case Type::LValueReference:
1838 case Type::RValueReference:
1850 case Type::MemberPointer: {
1857 case Type::Complex: {
1861 Width = EltInfo.
Width * 2;
1862 Align = EltInfo.
Align;
1865 case Type::ObjCObject:
1866 return getTypeInfo(cast<ObjCObjectType>(T)->getBaseType().getTypePtr());
1867 case Type::Adjusted:
1870 case Type::ObjCInterface: {
1873 Width =
toBits(Layout.getSize());
1874 Align =
toBits(Layout.getAlignment());
1879 const TagType *TT = cast<TagType>(
T);
1887 if (
const EnumType *ET = dyn_cast<EnumType>(TT)) {
1888 const EnumDecl *ED = ET->getDecl();
1892 Info.
Align = AttrAlign;
1903 AlignIsRequired = RD->hasAttr<AlignedAttr>();
1907 case Type::SubstTemplateTypeParm:
1908 return getTypeInfo(cast<SubstTemplateTypeParmType>(T)->
1909 getReplacementType().getTypePtr());
1912 case Type::DeducedTemplateSpecialization: {
1915 "cannot request the size of an undeduced or dependent auto type");
1920 return getTypeInfo(cast<ParenType>(T)->getInnerType().getTypePtr());
1922 case Type::ObjCTypeParam:
1923 return getTypeInfo(cast<ObjCTypeParamType>(T)->desugar().getTypePtr());
1925 case Type::Typedef: {
1933 AlignIsRequired =
true;
1942 case Type::Elaborated:
1943 return getTypeInfo(cast<ElaboratedType>(T)->getNamedType().getTypePtr());
1945 case Type::Attributed:
1947 cast<AttributedType>(T)->getEquivalentType().getTypePtr());
1949 case Type::Atomic: {
1958 if (Width != 0 && Width <= Target->getMaxAtomicPromoteWidth()) {
1960 if (!llvm::isPowerOf2_64(Width))
1961 Width = llvm::NextPowerOf2(Width);
1964 Align =
static_cast<unsigned>(Width);
1975 assert(llvm::isPowerOf2_32(Align) &&
"Alignment must be power of 2");
1976 return TypeInfo(Width, Align, AlignIsRequired);
1982 if ((
getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64 ||
1983 getTargetInfo().getTriple().getArch() == llvm::Triple::ppc64le) &&
2024 unsigned ABIAlign = TI.
Align;
2037 T = CT->getElementType().getTypePtr();
2039 T = ET->getDecl()->getIntegerType().getTypePtr();
2091 for (
const auto *I : OI->
ivars())
2097 Ivars.push_back(Iv);
2104 llvm::SmallPtrSet<ObjCProtocolDecl*, 8> &Protocols) {
2108 for (
auto *Proto : OI->all_referenced_protocols()) {
2113 for (
const auto *Cat : OI->visible_categories())
2119 SD = SD->getSuperClass();
2121 }
else if (
const ObjCCategoryDecl *OC = dyn_cast<ObjCCategoryDecl>(CDecl)) {
2122 for (
auto *Proto : OC->protocols()) {
2125 }
else if (
const ObjCProtocolDecl *OP = dyn_cast<ObjCProtocolDecl>(CDecl)) {
2127 if (!Protocols.insert(
2128 const_cast<ObjCProtocolDecl *>(OP->getCanonicalDecl())).second)
2131 for (
auto *Proto : OP->protocols())
2138 assert(RD->
isUnion() &&
"Must be union type");
2141 for (
const auto *Field : RD->
fields()) {
2145 if (FieldSize != UnionSize)
2157 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD))
2158 return ClassDecl->isEmpty();
2166 assert(!RD->
isUnion() &&
"Must be struct/class type");
2169 int64_t CurOffsetInBits = 0;
2170 if (
const auto *ClassDecl = dyn_cast<CXXRecordDecl>(RD)) {
2171 if (ClassDecl->isDynamicClass())
2175 for (
const auto Base : ClassDecl->bases()) {
2183 Bases.emplace_back(
Base.getType(), Size.getValue());
2188 Bases.begin(), Bases.end(), [&](
const std::pair<QualType, int64_t> &L,
2189 const std::pair<QualType, int64_t> &R) {
2190 return Layout.getBaseClassOffset(L.first->getAsCXXRecordDecl()) <
2191 Layout.getBaseClassOffset(R.first->getAsCXXRecordDecl());
2194 for (
const auto Base : Bases) {
2195 int64_t BaseOffset = Context.
toBits(
2196 Layout.getBaseClassOffset(
Base.first->getAsCXXRecordDecl()));
2197 int64_t BaseSize =
Base.second;
2198 if (BaseOffset != CurOffsetInBits)
2200 CurOffsetInBits = BaseOffset + BaseSize;
2204 for (
const auto *Field : RD->
fields()) {
2205 if (!Field->getType()->isReferenceType() &&
2209 int64_t FieldSizeInBits =
2211 if (Field->isBitField()) {
2212 int64_t BitfieldSize = Field->getBitWidthValue(Context);
2214 if (BitfieldSize > FieldSizeInBits)
2216 FieldSizeInBits = BitfieldSize;
2221 if (FieldOffsetInBits != CurOffsetInBits)
2224 CurOffsetInBits = FieldSizeInBits + FieldOffsetInBits;
2227 return CurOffsetInBits;
2248 assert(!Ty.
isNull() &&
"Null QualType sent to unique object rep check");
2268 return !ABI->getMemberPointerInfo(MPT).HasPadding;
2283 return StructSize &&
2284 StructSize.getValue() ==
static_cast<int64_t
>(
getTypeSize(Ty));
2305 count += Ext->ivar_size();
2310 count += ImplDecl->ivar_size();
2328 if (isa<GNUNullExpr>(E))
return true;
2336 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2337 I = ObjCImpls.find(D);
2338 if (I != ObjCImpls.end())
2339 return cast<ObjCImplementationDecl>(I->second);
2346 llvm::DenseMap<ObjCContainerDecl*, ObjCImplDecl*>::iterator
2347 I = ObjCImpls.find(D);
2348 if (I != ObjCImpls.end())
2349 return cast<ObjCCategoryImplDecl>(I->second);
2356 assert(IFaceD && ImplD &&
"Passed null params");
2357 ObjCImpls[IFaceD] = ImplD;
2363 assert(CatD && ImplD &&
"Passed null params");
2364 ObjCImpls[CatD] = ImplD;
2369 return ObjCMethodRedecls.lookup(MD);
2375 ObjCMethodRedecls[MD] = Redecl;
2385 return CD->getClassInterface();
2388 return IMD->getClassInterface();
2396 assert(VD &&
"Passed null params");
2397 assert(VD->
hasAttr<BlocksAttr>() &&
2398 "getBlockVarCopyInits - not __block var");
2399 llvm::DenseMap<const VarDecl*, Expr*>::iterator
2400 I = BlockVarCopyInits.find(VD);
2401 return (I != BlockVarCopyInits.end()) ? cast<Expr>(I->second) :
nullptr;
2406 assert(VD && Init &&
"Passed null params");
2407 assert(VD->
hasAttr<BlocksAttr>() &&
2408 "setBlockVarCopyInits - not __block var");
2409 BlockVarCopyInits[VD] = Init;
2413 unsigned DataSize)
const {
2418 "incorrect data size provided to CreateTypeSourceInfo!");
2435 return getObjCLayout(D,
nullptr);
2449 ASTContext::getExtQualType(
const Type *baseType,
Qualifiers quals)
const {
2454 llvm::FoldingSetNodeID
ID;
2456 void *insertPos =
nullptr;
2457 if (
ExtQuals *eq = ExtQualNodes.FindNodeOrInsertPos(ID, insertPos)) {
2458 assert(eq->getQualifiers() == quals);
2467 canon = getExtQualType(canonSplit.
Ty, canonSplit.
Quals);
2470 (void) ExtQualNodes.FindNodeOrInsertPos(ID, insertPos);
2474 ExtQualNodes.InsertNode(eq, insertPos);
2479 LangAS AddressSpace)
const {
2492 "Type cannot be in multiple addr spaces!");
2495 return getExtQualType(TypeNode, Quals);
2514 return getExtQualType(TypeNode, Quals);
2541 "Type cannot have multiple ObjCGCs!");
2544 return getExtQualType(TypeNode, Quals);
2562 return cast<FunctionType>(Result.
getTypePtr());
2578 L->DeducedReturnType(FD, ResultType);
2589 if (
auto *PT = dyn_cast<ParenType>(Orig))
2594 if (
auto *AT = dyn_cast<AttributedType>(Orig))
2632 if (TSInfo->getType() != FD->
getType())
2640 "TypeLoc size mismatch from updating exception specification");
2641 TSInfo->overrideType(Updated);
2650 llvm::FoldingSetNodeID
ID;
2653 void *InsertPos =
nullptr;
2654 if (
ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
2664 ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
2665 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2668 Types.push_back(New);
2669 ComplexTypes.InsertNode(New, InsertPos);
2678 llvm::FoldingSetNodeID
ID;
2681 void *InsertPos =
nullptr;
2682 if (
PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2692 PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2693 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2696 Types.push_back(New);
2697 PointerTypes.InsertNode(New, InsertPos);
2702 llvm::FoldingSetNodeID
ID;
2704 void *InsertPos =
nullptr;
2705 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2712 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2713 assert(!AT &&
"Shouldn't be in the map!");
2717 Types.push_back(AT);
2718 AdjustedTypes.InsertNode(AT, InsertPos);
2742 llvm::FoldingSetNodeID
ID;
2744 void *InsertPos =
nullptr;
2745 AdjustedType *AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2752 AT = AdjustedTypes.FindNodeOrInsertPos(ID, InsertPos);
2753 assert(!AT &&
"Shouldn't be in the map!");
2756 Types.push_back(AT);
2757 AdjustedTypes.InsertNode(AT, InsertPos);
2767 llvm::FoldingSetNodeID
ID;
2770 void *InsertPos =
nullptr;
2772 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2783 BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2784 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2788 Types.push_back(New);
2789 BlockPointerTypes.InsertNode(New, InsertPos);
2798 "Unresolved overloaded function type");
2802 llvm::FoldingSetNodeID
ID;
2805 void *InsertPos =
nullptr;
2807 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2815 if (!SpelledAsLValue || InnerRef || !T.
isCanonical()) {
2821 LValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2822 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2828 Types.push_back(New);
2829 LValueReferenceTypes.InsertNode(New, InsertPos);
2839 llvm::FoldingSetNodeID
ID;
2842 void *InsertPos =
nullptr;
2844 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos))
2858 RValueReferenceTypes.FindNodeOrInsertPos(ID, InsertPos);
2859 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2864 Types.push_back(New);
2865 RValueReferenceTypes.InsertNode(New, InsertPos);
2874 llvm::FoldingSetNodeID
ID;
2877 void *InsertPos =
nullptr;
2879 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
2890 MemberPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
2891 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2895 Types.push_back(New);
2896 MemberPointerTypes.InsertNode(New, InsertPos);
2903 const llvm::APInt &ArySizeIn,
2905 unsigned IndexTypeQuals)
const {
2908 "Constant array of VLAs is illegal!");
2912 llvm::APInt ArySize(ArySizeIn);
2915 llvm::FoldingSetNodeID
ID;
2918 void *InsertPos =
nullptr;
2920 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
2929 ASM, IndexTypeQuals);
2934 ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
2935 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
2940 ConstantArrayTypes.InsertNode(New, InsertPos);
2941 Types.push_back(New);
2955 const Type *ty = split.
Ty;
2957 #define TYPE(Class, Base) 2958 #define ABSTRACT_TYPE(Class, Base) 2959 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 2960 #include "clang/AST/TypeNodes.def" 2961 llvm_unreachable(
"didn't desugar past all non-canonical types?");
2967 case Type::ExtVector:
2968 case Type::DependentSizedExtVector:
2969 case Type::DependentAddressSpace:
2970 case Type::ObjCObject:
2971 case Type::ObjCInterface:
2972 case Type::ObjCObjectPointer:
2975 case Type::UnresolvedUsing:
2976 case Type::TypeOfExpr:
2978 case Type::Decltype:
2979 case Type::UnaryTransform:
2980 case Type::DependentName:
2981 case Type::InjectedClassName:
2982 case Type::TemplateSpecialization:
2983 case Type::DependentTemplateSpecialization:
2984 case Type::TemplateTypeParm:
2985 case Type::SubstTemplateTypeParmPack:
2987 case Type::DeducedTemplateSpecialization:
2988 case Type::PackExpansion:
2989 llvm_unreachable(
"type should never be variably-modified");
2993 case Type::FunctionNoProto:
2994 case Type::FunctionProto:
2995 case Type::BlockPointer:
2996 case Type::MemberPointer:
3006 cast<PointerType>(ty)->getPointeeType()));
3009 case Type::LValueReference: {
3017 case Type::RValueReference: {
3024 case Type::Atomic: {
3030 case Type::ConstantArray: {
3040 case Type::DependentSizedArray: {
3052 case Type::IncompleteArray: {
3064 case Type::VariableArray: {
3085 unsigned IndexTypeQuals,
3095 IndexTypeQuals, Brackets);
3102 VariableArrayTypes.push_back(New);
3103 Types.push_back(New);
3113 unsigned elementTypeQuals,
3117 "Size must be type- or value-dependent!");
3127 numElements, ASM, elementTypeQuals,
3129 Types.push_back(newType);
3138 void *insertPos =
nullptr;
3139 llvm::FoldingSetNodeID
ID;
3142 ASM, elementTypeQuals, numElements);
3146 DependentSizedArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3152 QualType(), numElements, ASM, elementTypeQuals,
3154 DependentSizedArrayTypes.InsertNode(canonTy, insertPos);
3155 Types.push_back(canonTy);
3160 canonElementType.
Quals);
3164 if (
QualType(canonElementType.
Ty, 0) == elementType &&
3173 ASM, elementTypeQuals, brackets);
3174 Types.push_back(sugaredType);
3180 unsigned elementTypeQuals)
const {
3181 llvm::FoldingSetNodeID
ID;
3184 void *insertPos =
nullptr;
3186 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos))
3197 ASM, elementTypeQuals);
3202 IncompleteArrayTypes.FindNodeOrInsertPos(ID, insertPos);
3203 assert(!existing &&
"Shouldn't be in the map!"); (void) existing;
3209 IncompleteArrayTypes.InsertNode(newType, insertPos);
3210 Types.push_back(newType);
3221 llvm::FoldingSetNodeID
ID;
3224 void *InsertPos =
nullptr;
3225 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3235 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3236 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3239 VectorType(vecType, NumElts, Canonical, VecKind);
3240 VectorTypes.InsertNode(New, InsertPos);
3241 Types.push_back(New);
3252 llvm::FoldingSetNodeID
ID;
3255 void *InsertPos =
nullptr;
3256 if (
VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
3266 VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3267 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3271 VectorTypes.InsertNode(New, InsertPos);
3272 Types.push_back(New);
3280 llvm::FoldingSetNodeID
ID;
3284 void *InsertPos =
nullptr;
3286 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3296 if (CanonVecTy == vecType) {
3302 = DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
3303 assert(!CanonCheck &&
"Dependent-sized ext_vector canonical type broken");
3305 DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
3314 Types.push_back(New);
3319 Expr *AddrSpaceExpr,
3325 void *insertPos =
nullptr;
3326 llvm::FoldingSetNodeID
ID;
3331 DependentAddressSpaceTypes.FindNodeOrInsertPos(ID, insertPos);
3336 QualType(), AddrSpaceExpr, AttrLoc);
3337 DependentAddressSpaceTypes.InsertNode(canonTy, insertPos);
3338 Types.push_back(canonTy);
3341 if (canonPointeeType == PointeeType &&
3348 AddrSpaceExpr, AttrLoc);
3349 Types.push_back(sugaredType);
3366 llvm::FoldingSetNodeID
ID;
3369 void *InsertPos =
nullptr;
3371 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
3381 FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3382 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3387 Types.push_back(New);
3388 FunctionNoProtoTypes.InsertNode(New, InsertPos);
3404 return CanResultType;
3411 if (!NoexceptInType)
3423 bool AnyPackExpansions =
false;
3428 AnyPackExpansions =
true;
3430 return AnyPackExpansions;
3441 QualType ASTContext::getFunctionTypeInternal(
3444 size_t NumArgs = ArgArray.size();
3448 llvm::FoldingSetNodeID
ID;
3453 bool Unique =
false;
3455 void *InsertPos =
nullptr;
3457 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos)) {
3466 EPI.ExceptionSpec.NoexceptExpr == FPT->getNoexceptExpr())
3477 bool IsCanonicalExceptionSpec =
3481 bool isCanonical = !Unique && IsCanonicalExceptionSpec &&
3483 for (
unsigned i = 0; i != NumArgs && isCanonical; ++i)
3484 if (!ArgArray[i].isCanonicalAsParam())
3485 isCanonical =
false;
3487 if (OnlyWantCanonical)
3488 assert(isCanonical &&
3489 "given non-canonical parameters constructing canonical type");
3494 if (!isCanonical && Canonical.isNull()) {
3496 CanonicalArgs.reserve(NumArgs);
3497 for (
unsigned i = 0; i != NumArgs; ++i)
3504 if (IsCanonicalExceptionSpec) {
3506 }
else if (NoexceptInType) {
3507 switch (EPI.ExceptionSpec.Type) {
3519 bool AnyPacks =
false;
3520 for (
QualType ET : EPI.ExceptionSpec.Exceptions) {
3539 llvm::APSInt
Value(1);
3541 if (!E || !E->isIntegerConstantExpr(Value, *
this,
nullptr,
3560 getFunctionTypeInternal(CanResultTy, CanonicalArgs, CanonicalEPI,
true);
3564 FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
3565 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
3580 Size += EPI.ExceptionSpec.Exceptions.size() *
sizeof(
QualType);
3582 Size +=
sizeof(
Expr*);
3595 if (EPI.ExtParameterInfos) {
3602 Types.push_back(FTP);
3604 FunctionProtoTypes.InsertNode(FTP, InsertPos);
3609 llvm::FoldingSetNodeID
ID;
3612 void *InsertPos =
nullptr;
3613 if (
PipeType *PT = PipeTypes.FindNodeOrInsertPos(ID, InsertPos))
3623 PipeType *NewIP = PipeTypes.FindNodeOrInsertPos(ID, InsertPos);
3624 assert(!NewIP &&
"Shouldn't be in the map!");
3628 Types.push_back(New);
3629 PipeTypes.InsertNode(New, InsertPos);
3634 return getPipeType(T,
true);
3638 return getPipeType(T,
false);
3643 if (!isa<CXXRecordDecl>(D))
return false;
3645 if (isa<ClassTemplatePartialSpecializationDecl>(RD))
3648 !isa<ClassTemplateSpecializationDecl>(RD))
3659 if (Decl->TypeForDecl) {
3660 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3662 assert(PrevDecl->TypeForDecl &&
"previous declaration has no type");
3663 Decl->TypeForDecl = PrevDecl->TypeForDecl;
3664 assert(isa<InjectedClassNameType>(Decl->TypeForDecl));
3668 Decl->TypeForDecl = newType;
3669 Types.push_back(newType);
3671 return QualType(Decl->TypeForDecl, 0);
3677 assert(Decl &&
"Passed null for Decl param");
3678 assert(!Decl->TypeForDecl &&
"TypeForDecl present in slow case");
3683 assert(!isa<TemplateTypeParmDecl>(Decl) &&
3684 "Template type parameter types are always available.");
3686 if (
const RecordDecl *Record = dyn_cast<RecordDecl>(Decl)) {
3687 assert(Record->isFirstDecl() &&
"struct/union has previous declaration");
3690 }
else if (
const EnumDecl *Enum = dyn_cast<EnumDecl>(Decl)) {
3691 assert(Enum->isFirstDecl() &&
"enum has previous declaration");
3694 dyn_cast<UnresolvedUsingTypenameDecl>(Decl)) {
3696 Decl->TypeForDecl = newType;
3697 Types.push_back(newType);
3699 llvm_unreachable(
"TypeDecl without a type?");
3701 return QualType(Decl->TypeForDecl, 0);
3709 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3715 Decl->TypeForDecl = newType;
3716 Types.push_back(newType);
3721 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3724 if (PrevDecl->TypeForDecl)
3725 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3728 Decl->TypeForDecl = newType;
3729 Types.push_back(newType);
3734 if (Decl->TypeForDecl)
return QualType(Decl->TypeForDecl, 0);
3737 if (PrevDecl->TypeForDecl)
3738 return QualType(Decl->TypeForDecl = PrevDecl->TypeForDecl, 0);
3741 Decl->TypeForDecl = newType;
3742 Types.push_back(newType);
3749 llvm::FoldingSetNodeID
id;
3752 void *insertPos =
nullptr;
3754 if (type)
return QualType(type, 0);
3760 Types.push_back(type);
3761 AttributedTypes.InsertNode(type, insertPos);
3771 &&
"replacement types must always be canonical");
3773 llvm::FoldingSetNodeID
ID;
3775 void *InsertPos =
nullptr;
3777 = SubstTemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3782 Types.push_back(SubstParm);
3783 SubstTemplateTypeParmTypes.InsertNode(SubstParm, InsertPos);
3796 assert(
P.getAsType().isCanonical() &&
"Pack contains non-canonical type");
3800 llvm::FoldingSetNodeID
ID;
3802 void *InsertPos =
nullptr;
3804 = SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos))
3812 SubstTemplateTypeParmPackTypes.FindNodeOrInsertPos(ID, InsertPos);
3818 Types.push_back(SubstParm);
3819 SubstTemplateTypeParmPackTypes.InsertNode(SubstParm, InsertPos);
3829 llvm::FoldingSetNodeID
ID;
3831 void *InsertPos =
nullptr;
3833 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3843 = TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
3844 assert(!TypeCheck &&
"Template type parameter canonical type broken");
3850 Types.push_back(TypeParm);
3851 TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
3862 "No dependent template names here!");
3872 for (
unsigned i = 0, e = TL.
getNumArgs(); i != e; ++i)
3882 "No dependent template names here!");
3885 ArgVec.reserve(Args.
size());
3887 ArgVec.push_back(Arg.getArgument());
3895 if (Arg.isPackExpansion())
3907 "No dependent template names here!");
3916 if (!Underlying.
isNull())
3922 "Caller must compute aliased type");
3923 IsTypeAlias =
false;
3932 (IsTypeAlias?
sizeof(
QualType) : 0),
3936 IsTypeAlias ? Underlying :
QualType());
3938 Types.push_back(Spec);
3945 "No dependent template names here!");
3954 unsigned NumArgs = Args.size();
3955 CanonArgs.reserve(NumArgs);
3961 llvm::FoldingSetNodeID
ID;
3965 void *InsertPos =
nullptr;
3967 = TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
3977 Types.push_back(Spec);
3978 TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
3982 "Non-dependent template-id type must have a canonical type");
3990 llvm::FoldingSetNodeID
ID;
3993 void *InsertPos =
nullptr;
3994 ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4001 ElaboratedType *CheckT = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
4002 assert(!CheckT &&
"Elaborated canonical type broken");
4008 ElaboratedTypes.InsertNode(T, InsertPos);
4014 llvm::FoldingSetNodeID
ID;
4017 void *InsertPos =
nullptr;
4018 ParenType *T = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4025 ParenType *CheckT = ParenTypes.FindNodeOrInsertPos(ID, InsertPos);
4026 assert(!CheckT &&
"Paren canonical type broken");
4032 ParenTypes.InsertNode(T, InsertPos);
4042 if (CanonNNS != NNS)
4046 llvm::FoldingSetNodeID
ID;
4049 void *InsertPos =
nullptr;
4051 = DependentNameTypes.FindNodeOrInsertPos(ID, InsertPos);
4057 DependentNameTypes.InsertNode(T, InsertPos);
4069 for (
unsigned I = 0, E = Args.
size(); I != E; ++I)
4070 ArgCopy.push_back(Args[I].getArgument());
4081 "nested-name-specifier must be dependent");
4083 llvm::FoldingSetNodeID
ID;
4087 void *InsertPos =
nullptr;
4089 = DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4098 bool AnyNonCanonArgs =
false;
4099 unsigned NumArgs = Args.size();
4101 for (
unsigned I = 0; I != NumArgs; ++I) {
4103 if (!CanonArgs[I].structurallyEquals(Args[I]))
4104 AnyNonCanonArgs =
true;
4108 if (AnyNonCanonArgs || CanonNNS != NNS || CanonKeyword != Keyword) {
4114 DependentTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
4123 DependentTemplateSpecializationTypes.InsertNode(T, InsertPos);
4129 if (
auto *TTP = dyn_cast<TemplateTypeParmDecl>(Param)) {
4135 }
else if (
auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(Param)) {
4138 NTTP->getType().getNonLValueExprType(*
this),
4141 if (NTTP->isParameterPack())
4146 auto *TTP = cast<TemplateTemplateParmDecl>(Param);
4162 Args.reserve(Args.size() + Params->
size());
4170 llvm::FoldingSetNodeID
ID;
4174 "Pack expansions must expand one or more parameter packs");
4175 void *InsertPos =
nullptr;
4177 = PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4192 PackExpansionTypes.FindNodeOrInsertPos(ID, InsertPos);
4199 PackExpansionTypes.InsertNode(T, InsertPos);
4211 if (Protocols.empty())
return true;
4216 for (
unsigned i = 1; i != Protocols.size(); ++i)
4218 Protocols[i]->getCanonicalDecl() != Protocols[i])
4226 llvm::array_pod_sort(Protocols.begin(), Protocols.end(),
CmpProtocolNames);
4230 P =
P->getCanonicalDecl();
4233 auto ProtocolsEnd = std::unique(Protocols.begin(), Protocols.end());
4234 Protocols.erase(ProtocolsEnd, Protocols.end());
4239 unsigned NumProtocols)
const {
4241 llvm::makeArrayRef(Protocols, NumProtocols),
4249 bool isKindOf)
const {
4252 if (typeArgs.empty() && protocols.empty() && !isKindOf &&
4253 isa<ObjCInterfaceType>(baseType))
4257 llvm::FoldingSetNodeID
ID;
4259 void *InsertPos =
nullptr;
4260 if (
ObjCObjectType *QT = ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos))
4267 if (effectiveTypeArgs.empty()) {
4269 effectiveTypeArgs = baseObject->getTypeArgs();
4276 bool typeArgsAreCanonical = std::all_of(effectiveTypeArgs.begin(),
4277 effectiveTypeArgs.end(),
4279 return type.isCanonical();
4282 if (!typeArgsAreCanonical || !protocolsSorted || !baseType.
isCanonical()) {
4286 if (!typeArgsAreCanonical) {
4287 canonTypeArgsVec.reserve(effectiveTypeArgs.size());
4288 for (
auto typeArg : effectiveTypeArgs)
4290 canonTypeArgs = canonTypeArgsVec;
4292 canonTypeArgs = effectiveTypeArgs;
4297 if (!protocolsSorted) {
4298 canonProtocolsVec.append(protocols.begin(), protocols.end());
4300 canonProtocols = canonProtocolsVec;
4302 canonProtocols = protocols;
4306 canonProtocols, isKindOf);
4309 ObjCObjectTypes.FindNodeOrInsertPos(ID, InsertPos);
4313 size += typeArgs.size() *
sizeof(
QualType);
4321 ObjCObjectTypes.InsertNode(T, InsertPos);
4331 bool allowOnPointerType)
const {
4335 dyn_cast<ObjCTypeParamType>(type.
getTypePtr())) {
4340 if (allowOnPointerType) {
4342 dyn_cast<ObjCObjectPointerType>(type.
getTypePtr())) {
4348 protocolsVec.append(protocols.begin(), protocols.end());
4365 objT->getTypeArgsAsWritten(),
4367 objT->isKindOfTypeAsWritten());
4405 llvm::FoldingSetNodeID
ID;
4407 void *InsertPos =
nullptr;
4409 ObjCTypeParamTypes.FindNodeOrInsertPos(ID, InsertPos))
4412 if (Canonical.
isNull()) {
4415 if (!protocols.empty()) {
4420 assert(!hasError &&
"Error when apply protocol qualifier to bound type");
4430 Types.push_back(newType);
4431 ObjCTypeParamTypes.InsertNode(newType, InsertPos);
4445 for (
auto *Proto : OPT->quals()) {
4466 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> InheritedProtocols;
4468 if (InheritedProtocols.empty())
4472 bool Conforms =
false;
4473 for (
auto *Proto : OPT->
quals()) {
4475 for (
auto *PI : InheritedProtocols) {
4487 for (
auto *PI : InheritedProtocols) {
4489 bool Adopts =
false;
4490 for (
auto *Proto : OPT->
quals()) {
4504 llvm::FoldingSetNodeID
ID;
4507 void *InsertPos =
nullptr;
4509 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
4518 ObjCObjectPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
4526 Types.push_back(QType);
4527 ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
4535 if (Decl->TypeForDecl)
4536 return QualType(Decl->TypeForDecl, 0);
4539 assert(PrevDecl->TypeForDecl &&
"previous decl has no TypeForDecl");
4540 Decl->TypeForDecl = PrevDecl->TypeForDecl;
4541 return QualType(PrevDecl->TypeForDecl, 0);
4550 Decl->TypeForDecl =
T;
4563 llvm::FoldingSetNodeID
ID;
4566 void *InsertPos =
nullptr;
4568 = DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
4578 DependentTypeOfExprTypes.InsertNode(Canon, InsertPos);
4585 Types.push_back(toe);
4597 Types.push_back(tot);
4613 llvm::FoldingSetNodeID
ID;
4616 void *InsertPos =
nullptr;
4618 = DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
4622 DependentDecltypeTypes.InsertNode(Canon, InsertPos);
4630 Types.push_back(dt);
4644 llvm::FoldingSetNodeID
ID;
4647 void *InsertPos =
nullptr;
4649 = DependentUnaryTransformTypes.FindNodeOrInsertPos(ID, InsertPos);
4656 DependentUnaryTransformTypes.InsertNode(Canon, InsertPos);
4664 UnderlyingType, Kind,
4667 Types.push_back(ut);
4675 bool IsDependent)
const {
4680 void *InsertPos =
nullptr;
4681 llvm::FoldingSetNodeID
ID;
4683 if (
AutoType *AT = AutoTypes.FindNodeOrInsertPos(ID, InsertPos))
4689 Types.push_back(AT);
4691 AutoTypes.InsertNode(AT, InsertPos);
4701 void *InsertPos =
nullptr;
4702 llvm::FoldingSetNodeID
ID;
4706 DeducedTemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos))
4711 Types.push_back(DTST);
4713 DeducedTemplateSpecializationTypes.InsertNode(DTST, InsertPos);
4722 llvm::FoldingSetNodeID
ID;
4725 void *InsertPos =
nullptr;
4726 if (
AtomicType *AT = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos))
4736 AtomicType *NewIP = AtomicTypes.FindNodeOrInsertPos(ID, InsertPos);
4737 assert(!NewIP &&
"Shouldn't be in the map!"); (void)NewIP;
4740 Types.push_back(New);
4741 AtomicTypes.InsertNode(New, InsertPos);
4847 if (isa<ArrayType>(Ty)) {
4849 }
else if (isa<FunctionType>(Ty)) {
4871 quals = splitType.
Quals;
4881 if (elementType == unqualElementType) {
4882 assert(quals.
empty());
4883 quals = splitType.
Quals;
4893 CAT->getSizeModifier(), 0);
4903 VAT->getSizeModifier(),
4904 VAT->getIndexTypeCVRQualifiers(),
4905 VAT->getBracketsRange());
4910 DSAT->getSizeModifier(), 0,
4925 if (T1PtrType && T2PtrType) {
4933 if (T1MPType && T2MPType &&
4935 QualType(T2MPType->getClass(), 0))) {
4944 if (T1OPType && T2OPType) {
5003 llvm_unreachable(
"bad template name kind!");
5012 = dyn_cast<TemplateTemplateParmDecl>(Template))
5013 Template = getCanonicalTemplateTemplateParmDecl(TTP);
5020 llvm_unreachable(
"cannot canonicalize overloaded template");
5024 assert(DTN &&
"Non-dependent template names must refer to template decls.");
5025 return DTN->CanonicalTemplateName;
5045 llvm_unreachable(
"bad template name!");
5095 A != AEnd; (void)++A, ++Idx)
5098 return TemplateArgument(llvm::makeArrayRef(CanonArgs, Arg.
pack_size()));
5103 llvm_unreachable(
"Unhandled template argument kind");
5159 llvm_unreachable(
"Invalid NestedNameSpecifier::Kind!");
5166 if (
const ArrayType *AT = dyn_cast<ArrayType>(T))
5187 if (!ATy || qs.
empty())
5196 CAT->getSizeModifier(),
5197 CAT->getIndexTypeCVRQualifiers()));
5200 IAT->getSizeModifier(),
5201 IAT->getIndexTypeCVRQualifiers()));
5204 = dyn_cast<DependentSizedArrayType>(ATy))
5205 return cast<ArrayType>(
5207 DSAT->getSizeExpr(),
5208 DSAT->getSizeModifier(),
5209 DSAT->getIndexTypeCVRQualifiers(),
5210 DSAT->getBracketsRange()));
5257 assert(PrettyArrayType &&
"Not an array type!");
5294 uint64_t ElementCount = 1;
5296 ElementCount *= CA->
getSize().getZExtValue();
5297 CA = dyn_cast_or_null<ConstantArrayType>(
5300 return ElementCount;
5309 assert(T->
getAs<
BuiltinType>() &&
"getFloatingRank(): not a floating type");
5311 default: llvm_unreachable(
"getFloatingRank(): not a floating type");
5313 case BuiltinType::Half:
return HalfRank;
5314 case BuiltinType::Float:
return FloatRank;
5331 case HalfRank: llvm_unreachable(
"Complex half is not supported");
5348 llvm_unreachable(
"getFloatingRank(): illegal value for rank");
5369 unsigned ASTContext::getIntegerRank(
const Type *T)
const {
5372 switch (cast<BuiltinType>(T)->getKind()) {
5373 default: llvm_unreachable(
"getIntegerRank(): not a built-in integer");
5374 case BuiltinType::Bool:
5376 case BuiltinType::Char_S:
5377 case BuiltinType::Char_U:
5378 case BuiltinType::SChar:
5379 case BuiltinType::UChar:
5381 case BuiltinType::Short:
5382 case BuiltinType::UShort:
5384 case BuiltinType::Int:
5385 case BuiltinType::UInt:
5387 case BuiltinType::Long:
5388 case BuiltinType::ULong:
5390 case BuiltinType::LongLong:
5391 case BuiltinType::ULongLong:
5393 case BuiltinType::Int128:
5394 case BuiltinType::UInt128:
5434 if (BitWidth < IntSize)
5437 if (BitWidth == IntSize)
5452 assert(!Promotable.
isNull());
5455 return ET->getDecl()->getPromotionType();
5464 if (BT->getKind() == BuiltinType::WChar_S ||
5465 BT->getKind() == BuiltinType::WChar_U ||
5466 BT->getKind() == BuiltinType::Char16 ||
5467 BT->getKind() == BuiltinType::Char32) {
5468 bool FromIsSigned = BT->getKind() == BuiltinType::WChar_S;
5472 for (
size_t Idx = 0; Idx < llvm::array_lengthof(PromoteTypes); ++Idx) {
5474 if (FromSize < ToSize ||
5475 (FromSize == ToSize &&
5476 FromIsSigned == PromoteTypes[Idx]->isSignedIntegerType()))
5477 return PromoteTypes[Idx];
5479 llvm_unreachable(
"char type should fit into long long");
5486 uint64_t PromotableSize =
getIntWidth(Promotable);
5527 if (
const EnumType *ET = dyn_cast<EnumType>(LHSC))
5529 if (
const EnumType *ET = dyn_cast<EnumType>(RHSC))
5532 if (LHSC == RHSC)
return 0;
5537 unsigned LHSRank = getIntegerRank(LHSC);
5538 unsigned RHSRank = getIntegerRank(RHSC);
5540 if (LHSUnsigned == RHSUnsigned) {
5541 if (LHSRank == RHSRank)
return 0;
5542 return LHSRank > RHSRank ? 1 : -1;
5548 if (LHSRank >= RHSRank)
5558 if (RHSRank >= LHSRank)
5568 if (!CFConstantStringTypeDecl) {
5569 assert(!CFConstantStringTagDecl &&
5570 "tag and typedef should be initialized together");
5575 const char *FieldNames[4];
5579 FieldNames[0] =
"isa";
5581 FieldTypes[1] =
IntTy;
5582 FieldNames[1] =
"flags";
5585 FieldNames[2] =
"str";
5588 FieldNames[3] =
"length";
5591 for (
unsigned i = 0; i < 4; ++i) {
5596 FieldTypes[i],
nullptr,
5601 CFConstantStringTagDecl->
addDecl(Field);
5608 CFConstantStringTypeDecl =
5612 return CFConstantStringTypeDecl;
5616 if (!CFConstantStringTagDecl)
5618 return CFConstantStringTagDecl;
5627 if (ObjCSuperType.
isNull()) {
5629 TUDecl->
addDecl(ObjCSuperTypeDecl);
5632 return ObjCSuperType;
5637 assert(TD &&
"Invalid CFConstantStringType");
5638 CFConstantStringTypeDecl = cast<TypedefDecl>(TD->
getDecl());
5641 assert(TagType &&
"Invalid CFConstantStringType");
5642 CFConstantStringTagDecl = TagType->getDecl();
5646 if (BlockDescriptorType)
5659 static const char *
const FieldNames[] = {
5664 for (
size_t i = 0; i < 2; ++i) {
5667 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
5675 BlockDescriptorType = RD;
5681 if (BlockDescriptorExtendedType)
5696 static const char *
const FieldNames[] = {
5703 for (
size_t i = 0; i < 4; ++i) {
5706 &
Idents.
get(FieldNames[i]), FieldTypes[i],
nullptr,
5715 BlockDescriptorExtendedType = RD;
5723 if (isa<PipeType>(T))
5729 switch (BT->getKind()) {
5730 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 5731 case BuiltinType::Id: \ 5732 return TargetInfo::OCLTK_Image; 5733 #include "clang/Basic/OpenCLImageTypes.def" 5735 case BuiltinType::OCLClkEvent:
5738 case BuiltinType::OCLEvent:
5741 case BuiltinType::OCLQueue:
5744 case BuiltinType::OCLReserveID:
5747 case BuiltinType::OCLSampler:
5766 if (!copyExpr && record->hasTrivialDestructor())
return false;
5792 llvm_unreachable(
"fell out of lifetime switch!");
5800 bool &HasByrefExtendedLayout)
const {
5805 HasByrefExtendedLayout =
false;
5807 HasByrefExtendedLayout =
true;
5821 if (!ObjCInstanceTypeDecl)
5822 ObjCInstanceTypeDecl =
5824 return ObjCInstanceTypeDecl;
5830 if (
const TypedefType *TT = dyn_cast<TypedefType>(T))
5832 return II->isStr(
"BOOL");
5868 if (First->isInlineSpecified() || !First->isStaticDataMember())
5874 if (D->getLexicalDeclContext()->isFileContext() &&
5875 !D->isInlineSpecified() && (D->isConstexpr() || First->isConstexpr()))
5912 assert(sz.
isPositive() &&
"BlockExpr - Incomplete param type");
5921 ParmOffset = PtrSize;
5923 QualType PType = PVDecl->getOriginalType();
5928 if (!isa<ConstantArrayType>(AT))
5929 PType = PVDecl->getType();
5931 PType = PVDecl->getType();
5958 "getObjCEncodingForFunctionDecl - Incomplete param type");
5966 QualType PType = PVDecl->getOriginalType();
5971 if (!isa<ConstantArrayType>(AT))
5972 PType = PVDecl->getType();
5974 PType = PVDecl->getType();
5988 bool Extended)
const {
5992 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
6003 bool Extended)
const {
6024 "getObjCEncodingForMethodDecl - Incomplete param type");
6032 ParmOffset = 2 * PtrSize;
6041 if (!isa<ConstantArrayType>(AT))
6046 PType, S, Extended);
6057 const Decl *Container)
const {
6061 dyn_cast<ObjCCategoryImplDecl>(Container)) {
6062 for (
auto *PID : CID->property_impls())
6063 if (PID->getPropertyDecl() == PD)
6068 if (PID->getPropertyDecl() == PD)
6101 const Decl *Container)
const {
6103 bool Dynamic =
false;
6111 SynthesizePID = PropertyImpDecl;
6115 std::string S =
"T";
6157 if (SynthesizePID) {
6172 if (isa<TypedefType>(PointeeTy.
getTypePtr())) {
6174 if (BT->getKind() == BuiltinType::ULong &&
getIntWidth(PointeeTy) == 32)
6177 if (BT->getKind() == BuiltinType::Long &&
getIntWidth(PointeeTy) == 32)
6190 getObjCEncodingForTypeImpl(T, S,
true,
true, Field,
6191 true ,
false,
false,
6192 false,
false,
false, NotEncodedT);
6196 std::string& S)
const {
6200 getObjCEncodingForTypeImpl(T, S,
true,
true,
nullptr,
6208 case BuiltinType::Void:
return 'v';
6209 case BuiltinType::Bool:
return 'B';
6210 case BuiltinType::Char_U:
6211 case BuiltinType::UChar:
return 'C';
6212 case BuiltinType::Char16:
6213 case BuiltinType::UShort:
return 'S';
6214 case BuiltinType::Char32:
6215 case BuiltinType::UInt:
return 'I';
6216 case BuiltinType::ULong:
6218 case BuiltinType::UInt128:
return 'T';
6219 case BuiltinType::ULongLong:
return 'Q';
6220 case BuiltinType::Char_S:
6221 case BuiltinType::SChar:
return 'c';
6222 case BuiltinType::Short:
return 's';
6223 case BuiltinType::WChar_S:
6224 case BuiltinType::WChar_U:
6225 case BuiltinType::Int:
return 'i';
6226 case BuiltinType::Long:
6228 case BuiltinType::LongLong:
return 'q';
6229 case BuiltinType::Int128:
return 't';
6230 case BuiltinType::Float:
return 'f';
6231 case BuiltinType::Double:
return 'd';
6232 case BuiltinType::LongDouble:
return 'D';
6233 case BuiltinType::NullPtr:
return '*';
6235 case BuiltinType::Float16:
6236 case BuiltinType::Float128:
6237 case BuiltinType::Half:
6241 case BuiltinType::ObjCId:
6242 case BuiltinType::ObjCClass:
6243 case BuiltinType::ObjCSel:
6244 llvm_unreachable(
"@encoding ObjC primitive type");
6247 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 6248 case BuiltinType::Id: 6249 #include "clang/Basic/OpenCLImageTypes.def" 6250 case BuiltinType::OCLEvent:
6251 case BuiltinType::OCLClkEvent:
6252 case BuiltinType::OCLQueue:
6253 case BuiltinType::OCLReserveID:
6254 case BuiltinType::OCLSampler:
6255 case BuiltinType::Dependent:
6256 #define BUILTIN_TYPE(KIND, ID) 6257 #define PLACEHOLDER_TYPE(KIND, ID) \ 6258 case BuiltinType::KIND: 6259 #include "clang/AST/BuiltinTypes.def" 6260 llvm_unreachable(
"invalid builtin type for @encode");
6262 llvm_unreachable(
"invalid BuiltinType::Kind value");
6279 assert(FD->
isBitField() &&
"not a bitfield - getObjCEncodingForTypeImpl");
6299 if (
const auto *IVD = dyn_cast<ObjCIvarDecl>(FD)) {
6308 S += llvm::utostr(Offset);
6321 void ASTContext::getObjCEncodingForTypeImpl(
QualType T, std::string& S,
6322 bool ExpandPointedToStructures,
6323 bool ExpandStructures,
6326 bool EncodingProperty,
6328 bool EncodeBlockParameters,
6329 bool EncodeClassNames,
6330 bool EncodePointerToObjCTypedef,
6333 switch (CT->getTypeClass()) {
6338 if (
const BuiltinType *BT = dyn_cast<BuiltinType>(CT))
6344 case Type::Complex: {
6347 getObjCEncodingForTypeImpl(CT->
getElementType(), S,
false,
false,
nullptr);
6351 case Type::Atomic: {
6354 getObjCEncodingForTypeImpl(AT->
getValueType(), S,
false,
false,
nullptr);
6360 case Type::LValueReference:
6361 case Type::RValueReference: {
6363 if (isa<PointerType>(CT)) {
6374 bool isReadOnly =
false;
6384 }
else if (OutermostType) {
6397 if (StringRef(S).endswith(
"nr"))
6398 S.replace(S.end()-2, S.end(),
"rn");
6410 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_class")) {
6415 if (RTy->getDecl()->getIdentifier() == &
Idents.
get(
"objc_object")) {
6424 getObjCEncodingForTypeImpl(PointeeTy, S,
false, ExpandPointedToStructures,
6425 nullptr,
false,
false,
false,
false,
false,
false,
6430 case Type::ConstantArray:
6431 case Type::IncompleteArray:
6432 case Type::VariableArray: {
6433 const ArrayType *AT = cast<ArrayType>(CT);
6435 if (isa<IncompleteArrayType>(AT) && !StructField) {
6440 false, ExpandStructures, FD);
6445 S += llvm::utostr(CAT->getSize().getZExtValue());
6448 assert((isa<VariableArrayType>(AT) || isa<IncompleteArrayType>(AT)) &&
6449 "Unknown array type!");
6454 false, ExpandStructures, FD,
6455 false,
false,
false,
false,
false,
false,
6462 case Type::FunctionNoProto:
6463 case Type::FunctionProto:
6467 case Type::Record: {
6468 RecordDecl *RDecl = cast<RecordType>(CT)->getDecl();
6469 S += RDecl->
isUnion() ?
'(' :
'{';
6474 = dyn_cast<ClassTemplateSpecializationDecl>(RDecl)) {
6476 llvm::raw_string_ostream OS(S);
6483 if (ExpandStructures) {
6486 getObjCEncodingForStructureImpl(RDecl, S, FD,
true, NotEncodedT);
6488 for (
const auto *Field : RDecl->
fields()) {
6491 S += Field->getNameAsString();
6496 if (Field->isBitField()) {
6497 getObjCEncodingForTypeImpl(Field->getType(), S,
false,
true,
6502 getObjCEncodingForTypeImpl(qt, S,
false,
true,
6506 false,
false,
false, NotEncodedT);
6511 S += RDecl->
isUnion() ?
')' :
'}';
6515 case Type::BlockPointer: {
6518 if (EncodeBlockParameters) {
6523 getObjCEncodingForTypeImpl(
6524 FT->
getReturnType(), S, ExpandPointedToStructures, ExpandStructures,
6525 FD,
false , EncodingProperty,
6526 false , EncodeBlockParameters, EncodeClassNames,
false,
6532 for (
const auto &I : FPT->param_types())
6533 getObjCEncodingForTypeImpl(
6534 I, S, ExpandPointedToStructures, ExpandStructures, FD,
6535 false , EncodingProperty,
6536 false , EncodeBlockParameters, EncodeClassNames,
6537 false, NotEncodedT);
6544 case Type::ObjCObject: {
6548 S +=
"{objc_object=}";
6552 S +=
"{objc_class=}";
6559 case Type::ObjCInterface: {
6565 if (ExpandStructures) {
6569 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
6570 const FieldDecl *Field = cast<FieldDecl>(Ivars[i]);
6572 getObjCEncodingForTypeImpl(Field->
getType(), S,
false,
true, Field);
6574 getObjCEncodingForTypeImpl(Field->
getType(), S,
false,
true, FD,
6575 false,
false,
false,
false,
false,
6576 EncodePointerToObjCTypedef,
6584 case Type::ObjCObjectPointer: {
6601 ExpandPointedToStructures,
6602 ExpandStructures, FD);
6603 if (FD || EncodingProperty || EncodeClassNames) {
6607 for (
const auto *I : OPT->
quals()) {
6609 S += I->getObjCRuntimeNameAsString();
6618 if (!EncodingProperty &&
6620 !EncodePointerToObjCTypedef) {
6630 for (
unsigned i = 0, e = Ivars.size(); i != e; ++i) {
6631 if (cast<FieldDecl>(Ivars[i]) == FD) {
6639 getObjCEncodingForTypeImpl(PointeeTy, S,
6640 false, ExpandPointedToStructures,
6642 false,
false,
false,
false,
false,
6649 (FD || EncodingProperty || EncodeClassNames)) {
6652 for (
const auto *I : OPT->
quals()) {
6654 S += I->getObjCRuntimeNameAsString();
6664 case Type::MemberPointer:
6668 case Type::ExtVector:
6677 case Type::DeducedTemplateSpecialization:
6681 #define ABSTRACT_TYPE(KIND, BASE) 6682 #define TYPE(KIND, BASE) 6683 #define DEPENDENT_TYPE(KIND, BASE) \ 6685 #define NON_CANONICAL_TYPE(KIND, BASE) \ 6687 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(KIND, BASE) \ 6689 #include "clang/AST/TypeNodes.def" 6690 llvm_unreachable(
"@encode for dependent type!");
6692 llvm_unreachable(
"bad type kind!");
6695 void ASTContext::getObjCEncodingForStructureImpl(
RecordDecl *RDecl,
6700 assert(RDecl &&
"Expected non-null RecordDecl");
6701 assert(!RDecl->
isUnion() &&
"Should not be called for unions");
6706 std::multimap<uint64_t, NamedDecl *> FieldOrBaseOffsets;
6710 for (
const auto &BI : CXXRec->
bases()) {
6711 if (!BI.isVirtual()) {
6716 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6717 std::make_pair(offs, base));
6723 for (
auto *Field : RDecl->
fields()) {
6725 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6726 std::make_pair(offs, Field));
6730 if (CXXRec && includeVBases) {
6731 for (
const auto &BI : CXXRec->
vbases()) {
6737 FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
6738 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
6739 std::make_pair(offs, base));
6751 uint64_t CurOffs = 0;
6753 std::multimap<uint64_t, NamedDecl *>::iterator
6754 CurLayObj = FieldOrBaseOffsets.begin();
6757 (CurLayObj == FieldOrBaseOffsets.end() || CurLayObj->first != 0)) {
6761 if (recname.empty()) recname =
"?";
6773 uint64_t offs =
toBits(size);
6774 FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
6775 std::make_pair(offs,
nullptr));
6778 for (; CurLayObj != FieldOrBaseOffsets.end(); ++CurLayObj) {
6780 assert(CurOffs <= CurLayObj->first);
6781 if (CurOffs < CurLayObj->first) {
6782 uint64_t padding = CurLayObj->first - CurOffs;
6803 getObjCEncodingForStructureImpl(base, S, FD,
false,
6805 assert(!base->isEmpty());
6810 FieldDecl *field = cast<FieldDecl>(dcl);
6825 getObjCEncodingForTypeImpl(qt, S,
false,
true, FD,
6829 false,
false,
false, NotEncodedT);
6839 std::string& S)
const {
6872 if (!ObjCClassDecl) {
6877 return ObjCClassDecl;
6881 if (!ObjCProtocolClassDecl) {
6882 ObjCProtocolClassDecl
6891 return ObjCProtocolClassDecl;
6937 const size_t NumFields = 5;
6939 const char *FieldNames[NumFields];
6943 FieldNames[0] =
"__stack";
6947 FieldNames[1] =
"__gr_top";
6951 FieldNames[2] =
"__vr_top";
6954 FieldTypes[3] = Context->
IntTy;
6955 FieldNames[3] =
"__gr_offs";
6958 FieldTypes[4] = Context->
IntTy;
6959 FieldNames[4] =
"__vr_offs";
6962 for (
unsigned i = 0; i < NumFields; ++i) {
6968 FieldTypes[i],
nullptr,
6973 VaListTagDecl->
addDecl(Field);
6990 const size_t NumFields = 5;
6992 const char *FieldNames[NumFields];
6996 FieldNames[0] =
"gpr";
7000 FieldNames[1] =
"fpr";
7004 FieldNames[2] =
"reserved";
7008 FieldNames[3] =
"overflow_arg_area";
7012 FieldNames[4] =
"reg_save_area";
7015 for (
unsigned i = 0; i < NumFields; ++i) {
7020 FieldTypes[i],
nullptr,
7025 VaListTagDecl->
addDecl(Field);
7053 const size_t NumFields = 4;
7055 const char *FieldNames[NumFields];
7059 FieldNames[0] =
"gp_offset";
7063 FieldNames[1] =
"fp_offset";
7067 FieldNames[2] =
"overflow_arg_area";
7071 FieldNames[3] =
"reg_save_area";
7074 for (
unsigned i = 0; i < NumFields; ++i) {
7080 FieldTypes[i],
nullptr,
7085 VaListTagDecl->
addDecl(Field);
7156 const size_t NumFields = 4;
7158 const char *FieldNames[NumFields];
7161 FieldTypes[0] = Context->
LongTy;
7162 FieldNames[0] =
"__gpr";
7165 FieldTypes[1] = Context->
LongTy;
7166 FieldNames[1] =
"__fpr";
7170 FieldNames[2] =
"__overflow_arg_area";
7174 FieldNames[3] =
"__reg_save_area";
7177 for (
unsigned i = 0; i < NumFields; ++i) {
7183 FieldTypes[i],
nullptr,
7188 VaListTagDecl->
addDecl(Field);
7225 llvm_unreachable(
"Unhandled __builtin_va_list type kind");
7229 if (!BuiltinVaListDecl) {
7234 return BuiltinVaListDecl;
7247 if (!BuiltinMSVaListDecl)
7250 return BuiltinMSVaListDecl;
7254 assert(ObjCConstantStringType.
isNull() &&
7255 "'NSConstantString' type already set!");
7265 unsigned size = End -
Begin;
7266 assert(size > 1 &&
"set is not overloaded!");
7275 assert(isa<FunctionTemplateDecl>(D) ||
7276 (isa<UsingShadowDecl>(D) &&
7288 bool TemplateKeyword,
7290 assert(NNS &&
"Missing nested-name-specifier in qualified template name");
7293 llvm::FoldingSetNodeID
ID;
7296 void *InsertPos =
nullptr;
7298 QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7302 QualifiedTemplateNames.InsertNode(QTN, InsertPos);
7314 "Nested name specifier must be dependent");
7316 llvm::FoldingSetNodeID
ID;
7319 void *InsertPos =
nullptr;
7321 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7327 if (CanonNNS == NNS) {
7335 DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7336 assert(!CheckQTN &&
"Dependent type name canonicalization broken");
7340 DependentTemplateNames.InsertNode(QTN, InsertPos);
7350 "Nested name specifier must be dependent");
7352 llvm::FoldingSetNodeID
ID;
7355 void *InsertPos =
nullptr;
7357 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7363 if (CanonNNS == NNS) {
7372 = DependentTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
7373 assert(!CheckQTN &&
"Dependent template name canonicalization broken");
7377 DependentTemplateNames.InsertNode(QTN, InsertPos);
7384 llvm::FoldingSetNodeID
ID;
7387 void *insertPos =
nullptr;
7389 = SubstTemplateTemplateParms.FindNodeOrInsertPos(ID, insertPos);
7393 SubstTemplateTemplateParms.InsertNode(subst, insertPos);
7403 llvm::FoldingSetNodeID
ID;
7406 void *InsertPos =
nullptr;
7408 = SubstTemplateTemplateParmPacks.FindNodeOrInsertPos(ID, InsertPos);
7414 SubstTemplateTemplateParmPacks.InsertNode(Subst, InsertPos);
7438 llvm_unreachable(
"Unhandled TargetInfo::IntType value");
7468 while (
const ArrayType *AT = dyn_cast<ArrayType>(CT))
7469 CT = AT->getElementType();
7491 assert(FirstVec->
isVectorType() &&
"FirstVec should be a vector type");
7492 assert(SecondVec->
isVectorType() &&
"SecondVec should be a vector type");
7535 assert((lhsQID && rhsOPT) &&
"ObjCQualifiedClassTypesAreCompatible");
7537 for (
auto *lhsProto : lhsQID->
quals()) {
7539 for (
auto *rhsProto : rhsOPT->quals()) {
7566 if (!rhsOPT)
return false;
7572 for (
auto *I : lhsQID->quals()) {
7576 if (!rhsID->ClassImplementsProtocol(I,
true))
7584 for (
auto *lhsProto : lhsQID->quals()) {
7590 for (
auto *rhsProto : rhsOPT->
quals()) {
7600 for (
auto *I : lhsQID->quals()) {
7604 if (rhsID->ClassImplementsProtocol(I,
true)) {
7618 assert(rhsQID &&
"One of the LHS/RHS should be id<x>");
7623 for (
auto *lhsProto : lhsOPT->quals()) {
7631 for (
auto *rhsProto : rhsQID->
quals()) {
7645 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSInheritedProtocols;
7650 if (LHSInheritedProtocols.empty() && lhsOPT->qual_empty())
7652 for (
auto *lhsProto : LHSInheritedProtocols) {
7654 for (
auto *rhsProto : rhsQID->
quals()) {
7685 auto finish = [&](
bool succeeded) ->
bool {
7725 bool BlockReturnType) {
7729 auto finish = [&](
bool succeeded) ->
bool {
7763 return finish(BlockReturnType);
7765 return finish(!BlockReturnType);
7777 return (*lhs)->getName().compare((*rhs)->getName());
7794 assert(LHS->
getInterface() &&
"LHS must have an interface base");
7795 assert(RHS->
getInterface() &&
"RHS must have an interface base");
7798 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> LHSProtocolSet;
7801 for (
auto proto : LHS->
quals()) {
7809 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> RHSProtocolSet;
7812 for (
auto proto : RHS->
quals()) {
7820 for (
auto proto : LHSProtocolSet) {
7821 if (RHSProtocolSet.count(proto))
7822 IntersectionSet.push_back(proto);
7827 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> ImpliedProtocols;
7831 if (!ImpliedProtocols.empty()) {
7832 IntersectionSet.erase(
7833 std::remove_if(IntersectionSet.begin(),
7834 IntersectionSet.end(),
7836 return ImpliedProtocols.count(proto) > 0;
7838 IntersectionSet.end());
7842 llvm::array_pod_sort(IntersectionSet.begin(), IntersectionSet.end(),
7852 if (lhsOPT && rhsOPT)
7858 if (lhsBlock && rhsBlock)
7864 (rhsOPT && rhsOPT->isObjCIdType() && lhsBlock))
7876 if (lhsArgs.size() != rhsArgs.size())
7880 for (
unsigned i = 0, n = lhsArgs.size(); i != n; ++i) {
7887 !ctx.
hasSameType(lhsArgs[i].stripObjCKindOfType(ctx),
7888 rhsArgs[i].stripObjCKindOfType(ctx))) {
7916 if (!LDecl || !RDecl)
7926 llvm::SmallDenseMap<const ObjCInterfaceDecl *, const ObjCObjectType *, 4>
7936 bool anyChanges =
false;
7954 if (!Protocols.empty())
7972 if (LHSSuperType.
isNull())
7982 if (KnownLHS != LHSAncestors.end()) {
7983 LHS = KnownLHS->second;
7987 bool anyChanges =
false;
8005 if (!Protocols.empty())
8022 if (RHSSuperType.
isNull())
8033 assert(LHS->
getInterface() &&
"LHS is not an interface type");
8034 assert(RHS->
getInterface() &&
"RHS is not an interface type");
8051 llvm::SmallPtrSet<ObjCProtocolDecl *, 8> SuperClassInheritedProtocols;
8055 for (
auto *RHSPI : RHS->
quals())
8058 if (SuperClassInheritedProtocols.empty())
8061 for (
const auto *LHSProto : LHS->
quals()) {
8062 bool SuperImplementsProtocol =
false;
8063 for (
auto *SuperClassProto : SuperClassInheritedProtocols)
8064 if (SuperClassProto->lookupProtocolNamed(LHSProto->getIdentifier())) {
8065 SuperImplementsProtocol =
true;
8068 if (!SuperImplementsProtocol)
8098 if (!LHSOPT || !RHSOPT)
8116 bool CompareUnqualified) {
8135 bool OfBlockPointer,
8139 if (UD->
hasAttr<TransparentUnionAttr>()) {
8140 for (
const auto *I : UD->
fields()) {
8141 QualType ET = I->getType().getUnqualifiedType();
8155 bool OfBlockPointer,
8170 return mergeTypes(lhs, rhs, OfBlockPointer, Unqualified);
8174 bool OfBlockPointer,
8180 bool allLTypes =
true;
8181 bool allRTypes =
true;
8185 if (OfBlockPointer) {
8186 QualType RHS = rbase->getReturnType();
8188 bool UnqualifiedResult = Unqualified;
8189 if (!UnqualifiedResult)
8191 retType =
mergeTypes(LHS, RHS,
true, UnqualifiedResult,
true);
8245 if (lproto && rproto) {
8246 assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
8247 "C++ shouldn't be here");
8249 if (lproto->getNumParams() != rproto->getNumParams())
8253 if (lproto->isVariadic() != rproto->isVariadic())
8256 if (lproto->getTypeQuals() != rproto->getTypeQuals())
8260 bool canUseLeft, canUseRight;
8272 for (
unsigned i = 0, n = lproto->getNumParams(); i < n; i++) {
8273 QualType lParamType = lproto->getParamType(i).getUnqualifiedType();
8274 QualType rParamType = rproto->getParamType(i).getUnqualifiedType();
8276 lParamType, rParamType, OfBlockPointer, Unqualified);
8283 types.push_back(paramType);
8295 if (allLTypes)
return lhs;
8296 if (allRTypes)
return rhs;
8301 newParamInfos.empty() ? nullptr : newParamInfos.data();
8305 if (lproto) allRTypes =
false;
8306 if (rproto) allLTypes =
false;
8317 for (
unsigned i = 0, n = proto->
getNumParams(); i < n; ++i) {
8323 paramTy = Enum->getDecl()->getIntegerType();
8333 if (allLTypes)
return lhs;
8334 if (allRTypes)
return rhs;
8341 if (allLTypes)
return lhs;
8342 if (allRTypes)
return rhs;
8348 QualType other,
bool isBlockReturnType) {
8368 bool OfBlockPointer,
8369 bool Unqualified,
bool BlockReturnType) {
8387 if (LHSCan == RHSCan)
8392 Qualifiers RQuals = RHSCan.getLocalQualifiers();
8393 if (LQuals != RQuals) {
8409 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
8430 if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
8431 if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
8434 if (LHSClass == Type::VariableArray || LHSClass == Type::IncompleteArray)
8435 LHSClass = Type::ConstantArray;
8436 if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
8437 RHSClass = Type::ConstantArray;
8440 if (LHSClass == Type::ObjCInterface) LHSClass = Type::ObjCObject;
8441 if (RHSClass == Type::ObjCInterface) RHSClass = Type::ObjCObject;
8444 if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
8445 if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
8448 if (LHSClass != RHSClass) {
8458 if (OfBlockPointer && !BlockReturnType) {
8470 #define TYPE(Class, Base) 8471 #define ABSTRACT_TYPE(Class, Base) 8472 #define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base) case Type::Class: 8473 #define NON_CANONICAL_TYPE(Class, Base) case Type::Class: 8474 #define DEPENDENT_TYPE(Class, Base) case Type::Class: 8475 #include "clang/AST/TypeNodes.def" 8476 llvm_unreachable(
"Non-canonical and dependent types shouldn't get here");
8479 case Type::DeducedTemplateSpecialization:
8480 case Type::LValueReference:
8481 case Type::RValueReference:
8482 case Type::MemberPointer:
8483 llvm_unreachable(
"C++ should never be in mergeTypes");
8485 case Type::ObjCInterface:
8486 case Type::IncompleteArray:
8487 case Type::VariableArray:
8488 case Type::FunctionProto:
8489 case Type::ExtVector:
8490 llvm_unreachable(
"Types are eliminated above");
8510 case Type::BlockPointer:
8535 if (ResultType.isNull())
return QualType();
8560 case Type::ConstantArray:
8607 case Type::FunctionNoProto:
8624 case Type::ObjCObject: {
8635 case Type::ObjCObjectPointer:
8636 if (OfBlockPointer) {
8650 assert(LHS != RHS &&
8651 "Equivalent pipe types should have already been handled!");
8655 llvm_unreachable(
"Invalid Type::Class!");
8660 bool &CanUseFirst,
bool &CanUseSecond,
8662 assert(NewParamInfos.empty() &&
"param info list not empty");
8663 CanUseFirst = CanUseSecond =
true;
8669 if (!FirstHasInfo && !SecondHasInfo)
8672 bool NeedParamInfo =
false;
8676 for (
size_t I = 0; I < E; ++I) {
8687 bool FirstNoEscape = FirstParam.
isNoEscape();
8688 bool SecondNoEscape = SecondParam.
isNoEscape();
8689 bool IsNoEscape = FirstNoEscape && SecondNoEscape;
8691 if (NewParamInfos.back().getOpaqueValue())
8692 NeedParamInfo =
true;
8693 if (FirstNoEscape != IsNoEscape)
8694 CanUseFirst =
false;
8695 if (SecondNoEscape != IsNoEscape)
8696 CanUseSecond =
false;
8700 NewParamInfos.clear();
8706 ObjCLayouts[CD] =
nullptr;
8716 if (LHSCan == RHSCan)
8718 if (RHSCan->isFunctionType()) {
8722 cast<FunctionType>(RHSCan.getTypePtr())->getReturnType();
8724 cast<FunctionType>(LHSCan.
getTypePtr())->getReturnType();
8727 if (ResReturnType.
isNull())
8729 if (ResReturnType == NewReturnType || ResReturnType == OldReturnType) {
8746 Qualifiers RQuals = RHSCan.getLocalQualifiers();
8747 if (LQuals != RQuals) {
8760 assert((GC_L != GC_R) &&
"unequal qualifier sets had only equal elements");
8776 if (ResQT == LHSBaseQT)
8778 if (ResQT == RHSBaseQT)
8790 T = ET->getDecl()->getIntegerType();
8803 VTy->getNumElements(), VTy->getVectorKind());
8807 T = ETy->getDecl()->getIntegerType();
8810 assert(BTy &&
"Unexpected signed integer type");
8812 case BuiltinType::Char_S:
8813 case BuiltinType::SChar:
8815 case BuiltinType::Short:
8817 case BuiltinType::Int:
8819 case BuiltinType::Long:
8821 case BuiltinType::LongLong:
8823 case BuiltinType::Int128:
8826 llvm_unreachable(
"Unexpected signed integer type");
8850 bool AllowTypeModifiers) {
8853 bool Signed =
false, Unsigned =
false;
8854 RequiresICE =
false;
8859 bool IsSpecialLong =
false;
8863 default: Done =
true; --Str;
break;
8868 assert(!Unsigned &&
"Can't use both 'S' and 'U' modifiers!");
8869 assert(!Signed &&
"Can't use 'S' modifier multiple times!");
8873 assert(!Signed &&
"Can't use both 'S' and 'U' modifiers!");
8874 assert(!Unsigned &&
"Can't use 'U' modifier multiple times!");
8878 assert(!IsSpecialLong &&
"Can't use 'L' with 'W' or 'N' modifiers");
8879 assert(HowLong <= 2 &&
"Can't have LLLL modifier");
8884 assert(!IsSpecialLong &&
"Can't use two 'N' or 'W' modifiers!");
8885 assert(HowLong == 0 &&
"Can't use both 'L' and 'N' modifiers!");
8887 IsSpecialLong =
true;
8894 assert(!IsSpecialLong &&
"Can't use two 'N' or 'W' modifiers!");
8895 assert(HowLong == 0 &&
"Can't use both 'L' and 'W' modifiers!");
8897 IsSpecialLong =
true;
8901 llvm_unreachable(
"Unexpected integer type");
8917 default: llvm_unreachable(
"Unknown builtin type letter!");
8919 assert(HowLong == 0 && !Signed && !Unsigned &&
8920 "Bad modifiers used with 'v'!");
8924 assert(HowLong == 0 && !Signed && !Unsigned &&
8925 "Bad modifiers used with 'h'!");
8929 assert(HowLong == 0 && !Signed && !Unsigned &&
8930 "Bad modifiers used with 'f'!");
8934 assert(HowLong < 2 && !Signed && !Unsigned &&
8935 "Bad modifiers used with 'd'!");
8942 assert(HowLong == 0 &&
"Bad modifiers used with 's'!");
8951 else if (HowLong == 2)
8953 else if (HowLong == 1)
8959 assert(HowLong == 0 &&
"Bad modifiers used with 'c'!");
8968 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'b'!");
8972 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'z'!");
8976 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'w'!");
8993 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9005 assert(!Type.
isNull() &&
"builtin va list type not initialized!");
9013 unsigned NumElements = strtoul(Str, &End, 10);
9014 assert(End != Str &&
"Missing vector size");
9018 RequiresICE,
false);
9019 assert(!RequiresICE &&
"Can't require vector ICE");
9029 unsigned NumElements = strtoul(Str, &End, 10);
9030 assert(End != Str &&
"Missing vector size");
9042 assert(!RequiresICE &&
"Can't require complex ICE");
9068 assert(HowLong == 0 && !Signed && !Unsigned &&
"Bad modifiers for 'K'!");
9082 Done = !AllowTypeModifiers;
9084 switch (
char c = *Str++) {
9085 default: Done =
true; --Str;
break;
9091 unsigned AddrSpace = strtoul(Str, &End, 10);
9092 if (End != Str && AddrSpace != 0) {
9117 "Integer constant 'I' type must be an integer");
9125 unsigned *IntegerConstantArgs)
const {
9130 bool RequiresICE =
false;
9137 assert(!RequiresICE &&
"Result of intrinsic cannot be required to be an ICE");
9139 while (TypeStr[0] && TypeStr[0] !=
'.') {
9146 if (RequiresICE && IntegerConstantArgs)
9147 *IntegerConstantArgs |= 1 << ArgTypes.size();
9153 ArgTypes.push_back(Ty);
9156 if (Id == Builtin::BI__GetExceptionInfo)
9159 assert((TypeStr[0] !=
'.' || TypeStr[1] == 0) &&
9160 "'.' should only occur at end of builtin type list!");
9165 bool Variadic = (TypeStr[0] ==
'.');
9168 if (ArgTypes.empty() && Variadic && !
getLangOpts().CPlusPlus)
9188 if (
auto *MD = dyn_cast<CXXMethodDecl>(FD))
9189 if (!MD->isUserProvided())
9221 !FD->
hasAttr<DLLExportAttr>()) ||
9222 FD->
hasAttr<GNUInlineAttr>()) {
9247 if (D->
hasAttr<DLLImportAttr>()) {
9250 }
else if (D->
hasAttr<DLLExportAttr>()) {
9254 D->
hasAttr<CUDAGlobalAttr>()) {
9301 while (LexicalContext && !isa<FunctionDecl>(LexicalContext))
9306 if (!LexicalContext)
9311 auto StaticLocalLinkage =
9323 return StaticLocalLinkage;
9350 return StrongLinkage;
9368 llvm_unreachable(
"Invalid Linkage!");
9378 if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
9379 if (!VD->isFileVarDecl())
9384 if (VD->getDescribedVarTemplate() ||
9385 isa<VarTemplatePartialSpecializationDecl>(VD))
9387 }
else if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
9391 }
else if (isa<PragmaCommentDecl>(D))
9393 else if (isa<OMPThreadPrivateDecl>(D) ||
9394 D->
hasAttr<OMPDeclareTargetDeclAttr>())
9396 else if (isa<PragmaDetectMismatchDecl>(D))
9398 else if (isa<OMPThreadPrivateDecl>(D))
9400 else if (isa<OMPDeclareReductionDecl>(D))
9402 else if (isa<ImportDecl>(D))
9412 if (D->
hasAttr<WeakRefAttr>())
9419 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
9421 if (!FD->doesThisDeclarationHaveABody())
9422 return FD->doesDeclarationForceExternallyVisibleDefinition();
9425 if (FD->
hasAttr<ConstructorAttr>() || FD->
hasAttr<DestructorAttr>())
9431 if (
const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
9449 const VarDecl *VD = cast<VarDecl>(D);
9477 if (
auto *DD = dyn_cast<DecompositionDecl>(VD))
9478 for (
auto *BD : DD->bindings())
9479 if (
auto *BindingVD = BD->getHoldingVar())
9487 bool IsCXXMethod)
const {
9490 return ABI->getDefaultMethodCallConv(IsVariadic);
9492 switch (LangOpts.getDefaultCallingConv()) {
9521 return ABI->isNearlyEmpty(RD);
9525 if (!VTContext.get()) {
9531 return VTContext.get();
9548 llvm_unreachable(
"Unsupported ABI");
9554 return ASTRecordLayouts.getMemorySize() +
9555 llvm::capacity_in_bytes(ObjCLayouts) +
9556 llvm::capacity_in_bytes(KeyFunctions) +
9557 llvm::capacity_in_bytes(ObjCImpls) +
9558 llvm::capacity_in_bytes(BlockVarCopyInits) +
9559 llvm::capacity_in_bytes(DeclAttrs) +
9560 llvm::capacity_in_bytes(TemplateOrInstantiation) +
9561 llvm::capacity_in_bytes(InstantiatedFromUsingDecl) +
9562 llvm::capacity_in_bytes(InstantiatedFromUsingShadowDecl) +
9563 llvm::capacity_in_bytes(InstantiatedFromUnnamedFieldDecl) +
9564 llvm::capacity_in_bytes(OverriddenMethods) +
9565 llvm::capacity_in_bytes(Types) +
9566 llvm::capacity_in_bytes(VariableArrayTypes) +
9567 llvm::capacity_in_bytes(ClassScopeSpecializationPattern);
9575 unsigned Signed)
const {
9578 if (!QualTy && DestWidth == 128)
9601 llvm_unreachable(
"Unhandled TargetInfo::RealType value");
9606 MangleNumbers[ND] = Number;
9610 auto I = MangleNumbers.find(ND);
9611 return I != MangleNumbers.end() ? I->second : 1;
9616 StaticLocalNumbers[VD] = Number;
9620 auto I = StaticLocalNumbers.find(VD);
9621 return I != StaticLocalNumbers.end() ? I->second : 1;
9626 assert(LangOpts.CPlusPlus);
9627 std::unique_ptr<MangleNumberingContext> &MCtx = MangleNumberingContexts[DC];
9633 std::unique_ptr<MangleNumberingContext>
9635 return ABI->createMangleNumberingContext();
9640 return ABI->getCopyConstructorForExceptionObject(
9646 return ABI->addCopyConstructorForExceptionObject(
9653 return ABI->addTypedefNameForUnnamedTagDecl(TD, DD);
9658 return ABI->getTypedefNameForUnnamedTagDecl(TD);
9663 return ABI->addDeclaratorForUnnamedTagDecl(TD, DD);
9667 return ABI->getDeclaratorForUnnamedTagDecl(TD);
9671 ParamIndices[D] = index;
9675 ParameterIndexTable::const_iterator I = ParamIndices.find(D);
9676 assert(I != ParamIndices.end() &&
9677 "ParmIndices lacks entry set by ParmVarDecl");
9685 "don't need to cache the computed value for this temporary");
9687 APValue *&MTVI = MaterializedTemporaryValues[E];
9693 return MaterializedTemporaryValues.lookup(E);
9698 if (!T.isOSDarwin())
9701 if (!(T.isiOS() && T.isOSVersionLT(7)) &&
9702 !(T.isMacOSX() && T.isOSVersionLT(10, 9)))
9711 return (Size != Align ||
toBits(sizeChars) > MaxInlineWidthInBits);
9715 ASTContext::ParentMapPointers::mapped_type U) {
9716 if (
const auto *D = U.dyn_cast<
const Decl *>())
9718 if (
const auto *S = U.dyn_cast<
const Stmt *>())
9727 template <
typename T>
9758 ParentMapASTVisitor Visitor(
new ASTContext::ParentMapPointers,
9760 Visitor.TraverseDecl(&TU);
9761 return std::make_pair(Visitor.Parents, Visitor.OtherParents);
9769 ParentMapASTVisitor(ASTContext::ParentMapPointers *Parents,
9771 : Parents(Parents), OtherParents(OtherParents) {}
9773 bool shouldVisitTemplateInstantiations()
const {
9777 bool shouldVisitImplicitCode()
const {
9781 template <
typename T,
typename MapNodeTy,
typename BaseTraverseFn,
9783 bool TraverseNode(T Node, MapNodeTy MapNode,
9784 BaseTraverseFn BaseTraverse,
MapTy *Parents) {
9787 if (ParentStack.size() > 0) {
9798 auto &NodeOrVector = (*Parents)[MapNode];
9799 if (NodeOrVector.isNull()) {
9800 if (
const auto *D = ParentStack.back().get<Decl>())
9802 else if (
const auto *S = ParentStack.back().get<
Stmt>())
9808 if (!NodeOrVector.template is<ASTContext::ParentVector *>()) {
9813 NodeOrVector = Vector;
9817 NodeOrVector.template get<ASTContext::ParentVector *>();
9823 std::find(Vector->begin(), Vector->end(),
9824 ParentStack.back()) != Vector->end();
9826 Vector->push_back(ParentStack.back());
9829 ParentStack.push_back(createDynTypedNode(Node));
9830 bool Result = BaseTraverse();
9831 ParentStack.pop_back();
9835 bool TraverseDecl(Decl *DeclNode) {
9836 return TraverseNode(DeclNode, DeclNode,
9837 [&] {
return VisitorBase::TraverseDecl(DeclNode); },
9841 bool TraverseStmt(
Stmt *StmtNode) {
9842 return TraverseNode(StmtNode, StmtNode,
9843 [&] {
return VisitorBase::TraverseStmt(StmtNode); },
9847 bool TraverseTypeLoc(
TypeLoc TypeLocNode) {
9848 return TraverseNode(
9850 [&] {
return VisitorBase::TraverseTypeLoc(TypeLocNode); },
9855 return TraverseNode(
9858 return VisitorBase::TraverseNestedNameSpecifierLoc(NNSLocNode);
9863 ASTContext::ParentMapPointers *Parents;
9870 template <
typename NodeTy,
typename MapTy>
9873 auto I = Map.find(Node);
9874 if (I == Map.end()) {
9877 if (
auto *V = I->second.template dyn_cast<ASTContext::ParentVector *>()) {
9878 return llvm::makeArrayRef(*V);
9885 if (!PointerParents) {
9889 PointerParents.reset(Maps.first);
9890 OtherParents.reset(Maps.second);
9901 if (MethodDecl->
hasAttr<UnavailableAttr>()
9902 || MethodDecl->
hasAttr<DeprecatedAttr>())
9916 IM != EM && IF != EF; ++IM, ++IF) {
9942 return (*AddrSpaceMap)[(unsigned)AS];
RecordDecl * buildImplicitRecord(StringRef Name, RecordDecl::TagKind TK=TTK_Struct) const
Create a new implicit TU-level CXXRecordDecl or RecordDecl declaration.
static CanQual< Type > CreateUnsafe(QualType Other)
Builds a canonical type from a QualType.
static TypedefDecl * CreateAArch64ABIBuiltinVaListDecl(const ASTContext *Context)
Internal representation of canonical, dependent typeof(expr) types.
QualType getDecltypeType(Expr *e, QualType UnderlyingType) const
C++11 decltype.
MemberSpecializationInfo * getInstantiatedFromStaticDataMember(const VarDecl *Var)
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
void setExternalSource(IntrusiveRefCntPtr< ExternalASTSource > Source)
Attach an external AST source to the AST context.
static NamespaceDecl * Create(ASTContext &C, DeclContext *DC, bool Inline, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, NamespaceDecl *PrevDecl)
static bool canAssignObjCObjectTypes(ASTContext &ctx, QualType lhs, QualType rhs)
Determine whether the first type is a subtype of the second.
TypedefDecl * getObjCInstanceTypeDecl()
Retrieve the typedef declaration corresponding to the Objective-C "instancetype" type.
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
const ObjCInterfaceType * getInterfaceType() const
If this pointer points to an Objective C @interface type, gets the type for that interface.
static void EncodeBitField(const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Defines the clang::ASTContext interface.
QualType getAddrSpaceQualType(QualType T, LangAS AddressSpace) const
Return the uniqued reference to the type for an address space qualified type with the specified type ...
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
const BlockDecl * getBlockDecl() const
bool hasDefinition() const
Determine whether this class has been defined.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
The generic AArch64 ABI is also a modified version of the Itanium ABI, but it has fewer divergences t...
static ast_type_traits::DynTypedNode getSingleDynTypedNodeFromParentMap(ASTContext::ParentMapPointers::mapped_type U)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
ASTMutationListener * Listener
IntType getInt64Type() const
unsigned getHalfWidth() const
getHalfWidth/Align/Format - Return the size/align/format of 'half'.
QualType withConst() const
Retrieves a version of this type with const applied.
const Type * Ty
The locally-unqualified type.
static bool isTypeTypedefedAsBOOL(QualType T)
static unsigned getFullDataSizeForType(QualType Ty)
Returns the size of type source info data block for the given type.
QualType getObjCObjectType(QualType Base, ObjCProtocolDecl *const *Protocols, unsigned NumProtocols) const
Legacy interface: cannot provide type arguments or __kindof.
QualType getVariableArrayDecayedType(QualType Ty) const
Returns a vla type where known sizes are replaced with [*].
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
static const Decl * getCanonicalDecl(const Decl *D)
void setImplicit(bool I=true)
An instance of this class is created to represent a function declaration or definition.
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...
AttrVec & getDeclAttrs(const Decl *D)
Retrieve the attributes for the given declaration.
unsigned getFloatWidth() const
getFloatWidth/Align/Format - Return the size/align/format of 'float'.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
CXXABI * CreateMicrosoftCXXABI(ASTContext &Ctx)
bool isObjCQualifiedIdType() const
True if this is equivalent to 'id.
SplitQualType split() const
no exception specification
QualType getObjCIdType() const
Represents the Objective-CC id type.
QualType getAdjustedParameterType(QualType T) const
Perform adjustment on the parameter type of a function.
Holds information about both target-independent and target-specific builtins, allowing easy queries b...
TypedefDecl * getCFConstantStringDecl() const
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
PointerType - C99 6.7.5.1 - Pointer Declarators.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
CanQualType LongDoubleComplexTy
void * getAsVoidPointer() const
Retrieve the template name as a void pointer.
QualType mergeFunctionTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
QualType getPointeeType() const
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
A (possibly-)qualified type.
The iOS 64-bit ABI is follows ARM's published 64-bit ABI more closely, but we don't guarantee to foll...
int getIntegerTypeOrder(QualType LHS, QualType RHS) const
Return the highest ranked integer type, see C99 6.3.1.8p1.
bool isBlockPointerType() const
QualType areCommonBaseCompatible(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isMemberPointerType() const
unsigned param_size() const
ASTContext(LangOptions &LOpts, SourceManager &SM, IdentifierTable &idents, SelectorTable &sels, Builtin::Context &builtins)
QualType getBuiltinVaListType() const
Retrieve the type of the __builtin_va_list type.
unsigned getBoolWidth() const
Return the size of '_Bool' and C++ 'bool' for this target, in bits.
unsigned getLongWidth() const
getLongWidth/Align - Return the size of 'signed long' and 'unsigned long' for this target...
InlineVariableDefinitionKind
static unsigned NumImplicitMoveAssignmentOperatorsDeclared
The number of implicitly-declared move assignment operators for which declarations were built...
ObjCIvarDecl * getPropertyIvarDecl() const
static MicrosoftMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
void Profile(llvm::FoldingSetNodeID &ID) const
QualType getPointerDiffType() const
Return the unique type for "ptrdiff_t" (C99 7.17) defined in <stddef.h>.
static unsigned NumImplicitDefaultConstructors
The number of implicitly-declared default constructors.
unsigned getMaxVectorAlign() const
Return the maximum vector alignment supported for the given target.
const ASTRecordLayout & getASTRecordLayout(const RecordDecl *D) const
Get or compute information about the layout of the specified record (struct/union/class) D...
AutoTypeKeyword
Which keyword(s) were used to create an AutoType.
Stmt - This represents one statement.
void setLAngleLoc(SourceLocation Loc)
virtual void DeducedReturnType(const FunctionDecl *FD, QualType ReturnType)
A function's return type has been deduced.
std::string getObjCEncodingForFunctionDecl(const FunctionDecl *Decl) const
Emit the encoded type for the function Decl into S.
FunctionType - C99 6.7.5.3 - Function Declarators.
unsigned getLargeArrayAlign() const
bool CommentsLoaded
True if comments are already loaded from ExternalASTSource.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
void Profile(llvm::FoldingSetNodeID &ID)
unsigned getFloat128Align() const
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
bool hasExtParameterInfos() const
Is there any interesting extra information for any of the parameters of this function type...
__builtin_va_list as defined by the PNaCl ABI: http://www.chromium.org/nativeclient/pnacl/bitcode-abi...
CharUnits getBaseClassOffset(const CXXRecordDecl *Base) const
getBaseClassOffset - Get the offset, in chars, for the given base class.
bool isRealFloatingType() const
Floating point categories.
unsigned overridden_methods_size(const CXXMethodDecl *Method) const
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
C Language Family Type Representation.
unsigned getLongAlign() const
Defines the SourceManager interface.
void Profile(llvm::FoldingSetNodeID &ID)
CharUnits getAlignOfGlobalVarInChars(QualType T) const
Return the alignment in characters that should be given to a global variable with type T...
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
static unsigned NumImplicitMoveAssignmentOperators
The number of implicitly-declared move assignment operators.
const AstTypeMatcher< TagType > tagType
Matches tag types (record and enum types).
Represents a qualified type name for which the type name is dependent.
static TypedefDecl * CreateSystemZBuiltinVaListDecl(const ASTContext *Context)
The template argument is an expression, and we've not resolved it to one of the other forms yet...
void Profile(llvm::FoldingSetNodeID &ID)
bool isRecordType() const
unsigned getTypeAlignIfKnown(QualType T) const
Return the ABI-specified alignment of a type, in bits, or 0 if the type is incomplete and we cannot d...
CanQualType FloatComplexTy
static TemplateTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation L, unsigned D, unsigned P, bool ParameterPack, IdentifierInfo *Id, TemplateParameterList *Params)
const ASTRecordLayout & getASTObjCImplementationLayout(const ObjCImplementationDecl *D) const
Get or compute information about the layout of the specified Objective-C implementation.
RawCommentList Comments
All comments in this translation unit.
const T * get() const
Retrieve the stored node as type T.
static int CmpProtocolNames(ObjCProtocolDecl *const *LHS, ObjCProtocolDecl *const *RHS)
CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
QualType getEnumType(const EnumDecl *Decl) const
QualType getLValueReferenceType(QualType T, bool SpelledAsLValue=true) const
Return the uniqued reference to the type for an lvalue reference to the specified type...
const Type * getTypeForDecl() const
Decl - This represents one declaration (or definition), e.g.
static QualType getFunctionTypeWithExceptionSpec(ASTContext &Context, QualType Orig, const FunctionProtoType::ExceptionSpecInfo &ESI)
Get a function type and produce the equivalent function type with the specified exception specificati...
TagDecl * getDecl() const
EnumDecl * getPreviousDecl()
CanQualType ObjCBuiltinSelTy
bool isDiscardableGVALinkage(GVALinkage L)
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
QualType getDeducedTemplateSpecializationType(TemplateName Template, QualType DeducedType, bool IsDependent) const
C++17 deduced class template specialization type.
CanQualType getCanonicalFunctionResultType(QualType ResultType) const
Adjust the given function result type.
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type.
unsigned getFieldIndex() const
getFieldIndex - Returns the index of this field within its record, as appropriate for passing to ASTR...
A class providing a concrete implementation of ObjCObjectType, so as to not increase the footprint of...
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Ctx)
unsigned getDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameters of this class.
Defines types useful for describing an Objective-C runtime.
CanQualType ARCUnbridgedCastTy
const RecordDecl * getParent() const
getParent - Returns the parent of this field declaration, which is the struct in which this field is ...
QualType getBlockPointerType(QualType T) const
Return the uniqued reference to the type for a block of the specified type.
The base class of the type hierarchy.
void setParameterIndex(const ParmVarDecl *D, unsigned index)
Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
QualType getsigjmp_bufType() const
Retrieve the C sigjmp_buf type.
static bool areSortedAndUniqued(ArrayRef< ObjCProtocolDecl *> Protocols)
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
DiagnosticsEngine & getDiagnostics() const
virtual LangAS getOpenCLTypeAddrSpace(OpenCLTypeKind TK) const
Get address space for OpenCL type.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
QualType getCorrespondingUnsignedType(QualType T) const
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
CharUnits getObjCEncodingTypeSize(QualType T) const
Return the size of type T for Objective-C encoding purpose, in characters.
void Profile(llvm::FoldingSetNodeID &ID)
NamespaceDecl - Represent a C++ namespace.
const ObjCObjectPointerType * getAsObjCInterfacePointerType() const
static ExprValueKind getValueKindForType(QualType T)
getValueKindForType - Given a formal return or parameter type, give its value kind.
void Profile(llvm::FoldingSetNodeID &ID)
virtual void completeDefinition()
completeDefinition - Notes that the definition of this type is now complete.
bool isZero() const
isZero - Test whether the quantity equals zero.
QualType withConst() const
const TargetInfo & getTargetInfo() const
A container of type source information.
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
llvm::DenseMap< Stmt *, Stmt * > MapTy
CharUnits getAlignment() const
getAlignment - Get the record alignment in characters.
static void addRedeclaredMethods(const ObjCMethodDecl *ObjCMethod, SmallVectorImpl< const NamedDecl *> &Redeclared)
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
__builtin_va_list as defined by the x86-64 ABI: http://refspecs.linuxbase.org/elf/x86_64-abi-0.21.pdf
const Expr * getRequiresClause() const
Get the constraint-expression from the associated requires-clause (if any)
QualType getAtomicType(QualType T) const
Return the uniqued reference to the atomic type for the specified type.
param_const_iterator param_end() const
unsigned getCharWidth() const
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
const DeclContext * getParentFunctionOrMethod() const
If this decl is defined inside a function/method/block it returns the corresponding DeclContext...
A template template parameter that has been substituted for some other template name.
ExtParameterInfo withIsNoEscape(bool NoEscape) const
QualType getElementType() const
unsigned getLargeArrayMinWidth() const
const RecordType * getAsUnionType() const
NOTE: getAs*ArrayType are methods on ASTContext.
StringRef getBufferData(FileID FID, bool *Invalid=nullptr) const
Return a StringRef to the source buffer data for the specified FileID.
unsigned getTypeAlign(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in bits.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
void Profile(llvm::FoldingSetNodeID &ID, ASTContext &Context)
An identifier, stored as an IdentifierInfo*.
bool isUnsignedIntegerType() const
Return true if this is an integer type that is unsigned, according to C99 6.2.5p6 [which returns true...
unsigned getDepth() const
Get the nesting depth of the template parameter.
static const Type * getIntegerTypeForEnum(const EnumType *ET)
CanQualType getCanonicalParamType(QualType T) const
Return the canonical parameter type corresponding to the specific potentially non-canonical one...
const RawComment * getRaw() const LLVM_READONLY
VarDecl - An instance of this class is created to represent a variable declaration or definition...
QualType getCFConstantStringType() const
Return the C structure type used to represent constant CFStrings.
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
void removeObjCLifetime()
QualType getReturnType() const
LangAS getLangASFromTargetAS(unsigned TargetAS)
void initialize(ASTContext &Context, SourceLocation Loc) const
Initializes this to state that every location in this type is the given location. ...
RecordDecl * getPreviousDecl()
llvm::SmallVector< ast_type_traits::DynTypedNode, 2 > ParentVector
Contains parents of a node.
unsigned getNumParams() const
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
NamedDecl *const * const_iterator
Iterates through the template parameters in this list.
const T * getAs() const
Member-template getAs<specific type>'.
void setClassScopeSpecializationPattern(FunctionDecl *FD, FunctionDecl *Pattern)
virtual void CompleteRedeclChain(const Decl *D)
Gives the external AST source an opportunity to complete the redeclaration chain for a declaration...
MangleContext * createMangleContext()
unsigned getCharAlign() const
Represents an empty template argument, e.g., one that has not been deduced.
Extra information about a function prototype.
unsigned getWCharAlign() const
Declaration context for names declared as extern "C" in C++.
const llvm::fltSemantics & getHalfFormat() const
LangAS
Defines the address space values used by the address space qualifier of QualType. ...
Represents a C++17 deduced template specialization type.
__builtin_va_list as defined by the AArch64 ABI http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055a/IHI0055A_aapcs64.pdf
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
ObjCMethodDecl - Represents an instance or class method declaration.
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
ObjCImplementationDecl * getObjCImplementation(ObjCInterfaceDecl *D)
Get the implementation of the ObjCInterfaceDecl D, or nullptr if none exists.
A namespace, stored as a NamespaceDecl*.
QualType getMemberPointerType(QualType T, const Type *Cls) const
Return the uniqued reference to the type for a member pointer to the specified type in the specified ...
bool ClassImplementsProtocol(ObjCProtocolDecl *lProto, bool lookupCategory, bool RHSIsQualifiedID=false)
ClassImplementsProtocol - Checks that 'lProto' protocol has been implemented in IDecl class...
void setRaw(const RawComment *RC)
bool isInvalidDecl() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
Describes how types, statements, expressions, and declarations should be printed. ...
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
protocol_range protocols() const
Decl * getVaListTagDecl() const
Retrieve the C type declaration corresponding to the predefined __va_list_tag type used to help defin...
ParmVarDecl - Represents a parameter to a function.
Represents the result of substituting a type for a template type parameter.
void Profile(llvm::FoldingSetNodeID &ID)
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Defines the clang::Expr interface and subclasses for C++ expressions.
QualType getIntegralType() const
Retrieve the type of the integral value.
static TypedefDecl * CreatePNaClABIBuiltinVaListDecl(const ASTContext *Context)
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
The collection of all-type qualifiers we support.
FieldDecl * getSourceBitField()
If this expression refers to a bit-field, retrieve the declaration of that bit-field.
static void getIntersectionOfProtocols(ASTContext &Context, const ObjCInterfaceDecl *CommonBase, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, SmallVectorImpl< ObjCProtocolDecl *> &IntersectionSet)
getIntersectionOfProtocols - This routine finds the intersection of set of protocols inherited from t...
void Profile(llvm::FoldingSetNodeID &ID)
Qualifiers getQualifiers() const
Retrieve all qualifiers.
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
Base wrapper for a particular "section" of type source info.
RecordDecl - Represents a struct/union/class.
unsigned getLongDoubleAlign() const
TemplateArgument getCanonicalTemplateArgument(const TemplateArgument &Arg) const
Retrieve the "canonical" template argument.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
uint64_t getPointerWidth(unsigned AddrSpace) const
Return the width of pointers on this target, for the specified address space.
RecordDecl * getCFConstantStringTagDecl() const
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
QualType getSubstTemplateTypeParmType(const TemplateTypeParmType *Replaced, QualType Replacement) const
Retrieve a substitution-result type.
TypedefDecl * getObjCIdDecl() const
Retrieve the typedef corresponding to the predefined id type in Objective-C.
FunctionType::ExtInfo ExtInfo
bool isComplete() const
Returns true if this can be considered a complete type.
One of these records is kept for each identifier that is lexed.
Represents a class template specialization, which refers to a class template with a given set of temp...
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool isObjCQualifiedClass() const
This table allows us to fully hide how we implement multi-keyword caching.
unsigned getIntAlign() const
unsigned getRegParm() const
IntType getUnsignedPtrDiffType(unsigned AddrSpace) const
Represents a class type in Objective C.
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
QualType getPointeeType() const
void setManglingNumber(const NamedDecl *ND, unsigned Number)
CXXRecordDecl * getPreviousDecl()
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
static unsigned NumImplicitMoveConstructorsDeclared
The number of implicitly-declared move constructors for which declarations were built.
A C++ nested-name-specifier augmented with source location information.
Represents a dependent template name that cannot be resolved prior to template instantiation.
QualType getObjCSuperType() const
Returns the C struct type for objc_super.
ArrayRef< QualType > getParamTypes() const
ArrayRef< ExtParameterInfo > getExtParameterInfos() const
const ParmVarDecl *const * param_const_iterator
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
void setObjCConstantStringInterface(ObjCInterfaceDecl *Decl)
void setArgLocInfo(unsigned i, TemplateArgumentLocInfo AI)
void setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst, FieldDecl *Tmpl)
Missing a type from <ucontext.h>
static bool isCanonicalExceptionSpecification(const FunctionProtoType::ExceptionSpecInfo &ESI, bool NoexceptInType)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
RecordDecl * getDefinition() const
getDefinition - Returns the RecordDecl that actually defines this struct/union/class.
unsigned getChar32Width() const
getChar32Width/Align - Return the size of 'char32_t' for this target, in bits.
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
bool isSpelledAsLValue() const
field_range fields() const
static GVALinkage adjustGVALinkageForAttributes(const ASTContext &Context, const Decl *D, GVALinkage L)
QualType getDependentNameType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, QualType Canon=QualType()) const
std::unique_ptr< MangleNumberingContext > createMangleNumberingContext() const
SetterKind getSetterKind() const
getSetterKind - Return the method used for doing assignment in the property setter.
bool isObjCIdType() const
The generic Mips ABI is a modified version of the Itanium ABI.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
bool isCanonicalUnqualified() const
Determines if this type would be canonical if it had no further qualification.
DynTypedNodeList getParents(const NodeT &Node)
Returns the parents of the given node.
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, QualType NamedType) const
unsigned getStaticLocalNumber(const VarDecl *VD) const
const char * getTypeString(unsigned ID) const
Get the type descriptor string for the specified builtin.
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectPointerType * getAsObjCQualifiedIdType() const
void addLazyModuleInitializers(Module *M, ArrayRef< uint32_t > IDs)
void setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern)
Remember that the using decl Inst is an instantiation of the using decl Pattern of a class template...
void startDefinition()
Starts the definition of this tag declaration.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
The iterator over UnresolvedSets.
Represents the result of substituting a set of types for a template type parameter pack...
IntType getSizeType() const
Container for either a single DynTypedNode or for an ArrayRef to DynTypedNode.
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
std::string getObjCEncodingForBlock(const BlockExpr *blockExpr) const
Return the encoded type for this block declaration.
bool isSpecificBuiltinType(unsigned K) const
Test for a particular builtin type.
static CharUnits Zero()
Zero - Construct a CharUnits quantity of zero.
qual_iterator qual_begin() const
bool isObjCSelType() const
RawComment * getRawCommentForDeclNoCache(const Decl *D) const
Return the documentation comment attached to a given declaration, without looking into cache...
CharUnits getVBaseClassOffset(const CXXRecordDecl *VBase) const
getVBaseClassOffset - Get the offset, in chars, for the given base class.
uint64_t lookupFieldBitOffset(const ObjCInterfaceDecl *OID, const ObjCImplementationDecl *ID, const ObjCIvarDecl *Ivar) const
Get the offset of an ObjCIvarDecl in bits.
static TypedefDecl * CreatePowerABIBuiltinVaListDecl(const ASTContext *Context)
CanQualType OCLReserveIDTy
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getUnsignedPointerDiffType() const
Return the unique unsigned counterpart of "ptrdiff_t" integer type.
const ASTRecordLayout & getASTObjCInterfaceLayout(const ObjCInterfaceDecl *D) const
Get or compute information about the layout of the specified Objective-C interface.
TemplateName getReplacement() const
void Profile(llvm::FoldingSetNodeID &ID)
static TypedefDecl * CreateCharPtrNamedVaListDecl(const ASTContext *Context, StringRef Name)
bool isIntegralOrEnumerationType() const
Determine whether this type is an integral or enumeration type.
QualType getParamTypeForDecl() const
Describes a module or submodule.
bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl)
ObjCObjectAdoptsQTypeProtocols - Checks that protocols in IC's protocol list adopt all protocols in Q...
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
static bool hasAnyPackExpansions(ArrayRef< TemplateArgument > Args)
const ObjCObjectPointerType * stripObjCKindOfTypeAndQuals(const ASTContext &ctx) const
Strip off the Objective-C "kindof" type and (with it) any protocol qualifiers.
bool ProtocolCompatibleWithProtocol(ObjCProtocolDecl *lProto, ObjCProtocolDecl *rProto) const
ProtocolCompatibleWithProtocol - return 'true' if 'lProto' is in the inheritance hierarchy of 'rProto...
TypeSourceInfo * getTemplateSpecializationTypeInfo(TemplateName T, SourceLocation TLoc, const TemplateArgumentListInfo &Args, QualType Canon=QualType()) const
ArrayRef< ParmVarDecl * > parameters() const
bool getProducesResult() const
QualType mergeObjCGCQualifiers(QualType, QualType)
mergeObjCGCQualifiers - This routine merges ObjC's GC attribute of 'LHS' and 'RHS' attributes and ret...
static bool isTypeSigned(IntType T)
Returns true if the type is signed; false otherwise.
void Profile(llvm::FoldingSetNodeID &ID)
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
An rvalue reference type, per C++11 [dcl.ref].
bool isBitField() const
Determines whether this field is a bitfield.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
qual_iterator qual_end() const
A qualified template name, where the qualification is kept to describe the source code as written...
unsigned getAlignOfGlobalVar(QualType T) const
Return the alignment in bits that should be given to a global variable with type T.
static bool unionHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD)
static ObjCInterfaceDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation atLoc, IdentifierInfo *Id, ObjCTypeParamList *typeParamList, ObjCInterfaceDecl *PrevDecl, SourceLocation ClassLoc=SourceLocation(), bool isInternal=false)
const LangASMap & getAddressSpaceMap() const
bool UnwrapSimilarPointerTypes(QualType &T1, QualType &T2)
UnwrapSimilarPointerTypes - If T1 and T2 are pointer types that may be similar (C++ 4...
static int compareObjCProtocolsByName(ObjCProtocolDecl *const *lhs, ObjCProtocolDecl *const *rhs)
Comparison routine for Objective-C protocols to be used with llvm::array_pod_sort.
static llvm::Optional< int64_t > structHasUniqueObjectRepresentations(const ASTContext &Context, const RecordDecl *RD)
ObjCContainerDecl - Represents a container for method declarations.
static ItaniumMangleContext * create(ASTContext &Context, DiagnosticsEngine &Diags)
QualType getOriginalType() const
void addObjCGCAttr(GC type)
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
CharUnits - This is an opaque type for sizes expressed in character units.
Microsoft throw(...) extension.
A convenient class for passing around template argument information.
ArrayRef< QualType > getTypeArgs() const
Retrieve the type arguments of this object type (semantically).
QualType getVolatileType(QualType T) const
Return the uniqued reference to the type for a volatile qualified type.
Qualifiers::GC getObjCGCAttrKind(QualType Ty) const
Return one of the GCNone, Weak or Strong Objective-C garbage collection attributes.
bool isTriviallyCopyableType(const ASTContext &Context) const
Return true if this is a trivially copyable type (C++0x [basic.types]p9)
The Microsoft ABI is the ABI used by Microsoft Visual Studio (and compatible compilers).
TypedefDecl * getObjCSelDecl() const
Retrieve the typedef corresponding to the predefined 'SEL' type in Objective-C.
bool hasAddressSpace() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Keeps track of the mangled names of lambda expressions and block literals within a particular context...
const ArrayType * getAsArrayTypeUnsafe() const
A variant of getAs<> for array types which silently discards qualifiers from the outermost type...
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
PropertyAttributeKind getPropertyAttributes() const
unsigned toTargetAddressSpace(LangAS AS)
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
Concrete class used by the front-end to report problems and issues.
Represents a typeof (or typeof) expression (a GCC extension).
const clang::PrintingPolicy & getPrintingPolicy() const
static const Decl * adjustDeclToTemplate(const Decl *D)
If we have a 'templated' declaration for a template, adjust 'D' to refer to the actual template...
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
static TemplateTypeParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation KeyLoc, SourceLocation NameLoc, unsigned D, unsigned P, IdentifierInfo *Id, bool Typename, bool ParameterPack)
TypeDecl - Represents a declaration of a type.
CanQualType PseudoObjectTy
LangAS getAddressSpace() const
QualType getExceptionObjectType(QualType T) const
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
const Type * getClass() const
CXXMethodVector::const_iterator overridden_cxx_method_iterator
bool isReadOnly() const
isReadOnly - Return true iff the property has a setter.
unsigned getShortWidth() const
Return the size of 'signed short' and 'unsigned short' for this target, in bits.
void Profile(llvm::FoldingSetNodeID &ID)
void getObjCEncodingForPropertyType(QualType T, std::string &S) const
Emit the Objective-C property type encoding for the given type T into S.
CharUnits getDeclAlign(const Decl *D, bool ForAlignof=false) const
Return a conservative estimate of the alignment of the specified decl D.
Expr * IgnoreParenCasts() LLVM_READONLY
IgnoreParenCasts - Ignore parentheses and casts.
static bool isAddrSpaceMapManglingEnabled(const TargetInfo &TI, const LangOptions &LangOpts)
Expr * getSizeExpr() const
static TemplateArgument CreatePackCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument pack by copying the given set of template arguments.
unsigned getChar16Align() const
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
unsigned getBitWidthValue(const ASTContext &Ctx) const
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
void getOverriddenMethods(SmallVectorImpl< const ObjCMethodDecl *> &Overridden) const
Return overridden methods for the given Method.
overridden_cxx_method_iterator overridden_methods_end(const CXXMethodDecl *Method) const
unsigned getIndex() const
Get the index of the template parameter within its parameter list.
void eraseDeclAttrs(const Decl *D)
Erase the attributes corresponding to the given declaration.
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
Defines the Linkage enumeration and various utility functions.
DiagnosticsEngine & getDiagnostics() const
unsigned LangASMap[(unsigned) LangAS::FirstTargetAddressSpace]
The type of a lookup table which maps from language-specific address spaces to target-specific ones...
Represents an Objective-C protocol declaration.
static unsigned NumImplicitDefaultConstructorsDeclared
The number of implicitly-declared default constructors for which declarations were built...
TemplateTemplateParmDecl * getParameter() const
QualType mergeTransparentUnionType(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeTransparentUnionType - if T is a transparent union type and a member of T is compatible with Sub...
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
ASTNodeKind getNodeKind() const
bool isAlignmentRequired(const Type *T) const
Determine if the alignment the type has was required using an alignment attribute.
CXXABI * CreateItaniumCXXABI(ASTContext &Ctx)
Creates an instance of a C++ ABI class.
void * getAsOpaquePtr() const
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated.
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
A class that does preorder or postorder depth-first traversal on the entire Clang AST and visits each...
Represents an ObjC class declaration.
const Type * getUnqualifiedDesugaredType() const
Return the specified type with any "sugar" removed from the type, removing any typedefs, typeofs, etc., as well as any qualifiers.
QualType getReturnType() const
unsigned getLongLongAlign() const
ObjCInterfaceDecl * getInterface() const
Gets the interface declaration for this object type, if the base type really is an interface...
bool isKindOfType() const
Whether this is a "__kindof" type.
const T * getTypePtr() const
Retrieve the underlying type pointer, which refers to a canonical type.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SplitQualType getSplitDesugaredType() const
unsigned getNumArgs() const
The iOS ABI is a partial implementation of the ARM ABI.
IntrusiveRefCntPtr< ExternalASTSource > ExternalSource
CanQualType UnsignedCharTy
Expr * getSizeExpr() const
bool getNoCallerSavedRegs() const
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
unsigned getNumProtocols() const
Return the number of qualifying protocols in this type, or 0 if there are none.
llvm::iterator_range< overridden_cxx_method_iterator > overridden_method_range
static char getObjCEncodingForPrimitiveKind(const ASTContext *C, BuiltinType::Kind kind)
std::string getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl, bool Extended=false) const
Emit the encoded type for the method declaration Decl into S.
Represents an extended vector type where either the type or size is dependent.
This object can be modified without requiring retains or releases.
void Profile(llvm::FoldingSetNodeID &ID)
static bool isCanonicalResultType(QualType T)
Determine whether T is canonical as the result type of a function.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
CanQualType Float128ComplexTy
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Expr * getAddrSpaceExpr() const
Provides definitions for the various language-specific address spaces.
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getBlockDescriptorExtendedType() const
Gets the struct used to keep track of the extended descriptor for pointer to blocks.
QualType getBaseType() const
Gets the base type of this object type.
unsigned getTargetDefaultAlignForAttributeAligned() const
Return the default alignment for attribute((aligned)) on this target, to be used if no alignment valu...
QualType getUnaryTransformType(QualType BaseType, QualType UnderlyingType, UnaryTransformType::UTTKind UKind) const
Unary type transforms.
unsigned getMinGlobalAlign() const
getMinGlobalAlign - Return the minimum alignment of a global variable, unless its alignment is explic...
void Profile(llvm::FoldingSetNodeID &ID)
bool isPromotableIntegerType() const
More type predicates useful for type checking/promotion.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
bool isFileVarDecl() const
isFileVarDecl - Returns true for file scoped variable declaration.
The generic ARM ABI is a modified version of the Itanium ABI proposed by ARM for use on ARM-based pla...
bool isDynamicClass() const
QualType getDependentAddressSpaceType(QualType PointeeType, Expr *AddrSpaceExpr, SourceLocation AttrLoc) const
QualType applyObjCProtocolQualifiers(QualType type, ArrayRef< ObjCProtocolDecl *> protocols, bool &hasError, bool allowOnPointerType=false) const
Apply Objective-C protocol qualifiers to the given type.
const llvm::fltSemantics & getDoubleFormat() const
bool isComplexType() const
isComplexType() does not include complex integers (a GCC extension).
static unsigned NumImplicitCopyConstructors
The number of implicitly-declared copy constructors.
Represents a ValueDecl that came out of a declarator.
A dependent template name that has not been resolved to a template (or set of templates).
DeclarationNameTable DeclarationNames
comments::FullComment * cloneFullComment(comments::FullComment *FC, const Decl *D) const
TypedefDecl * getBuiltinMSVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_ms_va_list type...
ArraySizeModifier
Capture whether this is a normal array (e.g.
bool hasQualifiers() const
Determine whether this type has any qualifiers.
QuantityType getQuantity() const
getQuantity - Get the raw integer representation of this quantity.
QualType getAutoRRefDeductType() const
C++11 deduction pattern for 'auto &&' type.
void setCFConstantStringType(QualType T)
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
void Profile(llvm::FoldingSetNodeID &ID)
void DeepCollectObjCIvars(const ObjCInterfaceDecl *OI, bool leafClass, SmallVectorImpl< const ObjCIvarDecl *> &Ivars) const
DeepCollectObjCIvars - This routine first collects all declared, but not synthesized, ivars in super class and then collects all ivars, including those synthesized for current class.
bool ObjCMethodsAreEqual(const ObjCMethodDecl *MethodDecl, const ObjCMethodDecl *MethodImp)
QualType getPromotedIntegerType(QualType PromotableType) const
Return the type that PromotableType will promote to: C99 6.3.1.1p2, assuming that PromotableType is a...
ASTRecordLayout - This class contains layout information for one RecordDecl, which is a struct/union/...
const llvm::fltSemantics & getLongDoubleFormat() const
typedef void* __builtin_va_list;
bool HasSideEffects(const ASTContext &Ctx, bool IncludePossibleEffects=true) const
HasSideEffects - This routine returns true for all those expressions which have any effect other than...
bool hasPointerIdentity() const
Check if the given ASTNodeKind identifies a type that offers pointer identity.
Exposes information about the current target.
Represents an array type in C++ whose size is a value-dependent expression.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting...
CommentOptions CommentOpts
Options for parsing comments.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isNoReturn(unsigned ID) const
Return true if we know this builtin never returns.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
QualType getElementType() const
bool isGNUFamily() const
Is this runtime basically of the GNU family of runtimes?
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.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
Defines the clang::LangOptions interface.
QualType getPointeeType() const
IntType getSignedSizeType() const
void setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst, UsingShadowDecl *Pattern)
known_extensions_range known_extensions() const
The "typename" keyword precedes the qualified type name, e.g., typename T::type.
bool isPositive() const
isPositive - Test whether the quantity is greater than zero.
Selector getSetterName() const
QualType getucontext_tType() const
Retrieve the C ucontext_t type.
void addTypedefNameForUnnamedTagDecl(TagDecl *TD, TypedefNameDecl *TND)
static const LangASMap * getAddressSpaceMap(const TargetInfo &T, const LangOptions &LOpts)
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
unsigned getAsOpaqueValue() const
void ResetObjCLayout(const ObjCContainerDecl *CD)
static Kind getNullabilityAttrKind(NullabilityKind kind)
Retrieve the attribute kind corresponding to the given nullability kind.
const FunctionProtoType * T
static std::pair< CharUnits, CharUnits > getConstantArrayInfoInChars(const ASTContext &Context, const ConstantArrayType *CAT)
getConstantArrayInfoInChars - Performing the computation in CharUnits instead of in bits prevents ove...
unsigned getIntWidth() const
getIntWidth/Align - Return the size of 'signed int' and 'unsigned int' for this target, in bits.
QualType getCanonicalTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args) const
Declaration of a template type parameter.
Internal representation of canonical, dependent decltype(expr) types.
TypedefDecl * buildImplicitTypedef(QualType T, StringRef Name) const
Create a new implicit TU-level typedef declaration.
Implements an efficient mapping from strings to IdentifierInfo nodes.
bool getHasRegParm() const
bool isObjCBuiltinType() const
const T * castAs() const
Member-template castAs<specific type>.
std::string getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
getObjCEncodingForPropertyDecl - Return the encoded type for this method declaration.
void setObjCMethodRedeclaration(const ObjCMethodDecl *MD, const ObjCMethodDecl *Redecl)
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
bool isNearlyEmpty(const CXXRecordDecl *RD) const
bool isObjCRetainableType() const
QualType getTypeOfExprType(Expr *e) const
GCC extension.
void Profile(llvm::FoldingSetNodeID &ID)
BlockExpr - Adaptor class for mixing a BlockDecl with expressions.
Qualifiers::GC getObjCGCAttr() const
Returns gc attribute of this type.
QualType getParenType(QualType NamedType) const
CanQualType OMPArraySectionTy
static TypedefDecl * CreateX86_64ABIBuiltinVaListDecl(const ASTContext *Context)
static unsigned NumImplicitMoveConstructors
The number of implicitly-declared move constructors.
static TypedefDecl * CreateMSVaListDecl(const ASTContext *Context)
bool hasUniqueObjectRepresentations(QualType Ty) const
Return true if the specified type has unique object representations according to (C++17 [meta...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
QualType getTagDeclType(const TagDecl *Decl) const
Return the unique reference to the type for the specified TagDecl (struct/union/class/enum) decl...
static std::string charUnitsToString(const CharUnits &CU)
void Profile(llvm::FoldingSetNodeID &ID)
bool isNullPtrType() const
unsigned getFastQualifiers() const
ExtProtoInfo withExceptionSpec(const ExceptionSpecInfo &O)
ObjCLifetime getObjCLifetime() const
void removeFastQualifiers(unsigned mask)
CharUnits getTypeAlignInChars(QualType T) const
Return the ABI-specified alignment of a (complete) type T, in characters.
bool isObjCClassType() const
void Profile(llvm::FoldingSetNodeID &ID)
DeclContext * getDeclContext()
A structure for storing the information associated with a substituted template template parameter...
bool isObjCIdType() const
True if this is equivalent to the 'id' type, i.e.
ObjCInterfaceDecl * getSuperClass() const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
void Profile(llvm::FoldingSetNodeID &ID)
static CharUnits fromQuantity(QuantityType Quantity)
fromQuantity - Construct a CharUnits quantity from a raw integer type.
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
internal::Matcher< T > id(StringRef ID, const internal::BindableMatcher< T > &InnerMatcher)
If the provided matcher matches a node, binds the node to ID.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
TypedefDecl * getInt128Decl() const
Retrieve the declaration for the 128-bit signed integer type.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack...
Represents a C++ template name within the type system.
Represents the type decltype(expr) (C++11).
static TypedefDecl * CreateAAPCSABIBuiltinVaListDecl(const ASTContext *Context)
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
QualType getFILEType() const
Retrieve the C FILE type.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
Defines the clang::TypeLoc interface and its subclasses.
A namespace alias, stored as a NamespaceAliasDecl*.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
const AstTypeMatcher< ArrayType > arrayType
Matches all kinds of arrays.
void setObjCImplementation(ObjCInterfaceDecl *IFaceD, ObjCImplementationDecl *ImplD)
Set the implementation of ObjCInterfaceDecl.
virtual void RedefinedHiddenDefinition(const NamedDecl *D, Module *M)
A definition has been made visible by being redefined locally.
CanQualType UnsignedInt128Ty
Specifies that a value-dependent expression of integral or dependent type should be considered a null...
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists...
overridden_method_range overridden_methods(const CXXMethodDecl *Method) const
clang::ObjCRuntime ObjCRuntime
propimpl_range property_impls() const
QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return the unique reference to the type for a constant array of the specified element type...
Qualifiers Quals
The local qualifiers.
unsigned getMaxAlignment() const
getMaxAlignment - return the maximum alignment specified by attributes on this decl, 0 if there are none.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
void setAddressSpace(LangAS space)
unsigned getShortAlign() const
Return the alignment of 'signed short' and 'unsigned short' for this target.
QualType getRecordType(const RecordDecl *Decl) const
QualType getObjCInterfaceType(const ObjCInterfaceDecl *Decl, ObjCInterfaceDecl *PrevDecl=nullptr) const
getObjCInterfaceType - Return the unique reference to the type for the specified ObjC interface decl...
bool isInstanceMethod() const
QualType getBlockDescriptorType() const
Gets the struct used to keep track of the descriptor for pointer to blocks.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
Represents a GCC generic vector type.
ArraySizeModifier getSizeModifier() const
struct CXXOpName CXXOperatorName
An lvalue reference type, per C++11 [dcl.ref].
TypedefDecl * getBuiltinVaListDecl() const
Retrieve the C type declaration corresponding to the predefined __builtin_va_list type...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
void addDeclaratorForUnnamedTagDecl(TagDecl *TD, DeclaratorDecl *DD)
QualType getSubstTemplateTypeParmPackType(const TemplateTypeParmType *Replaced, const TemplateArgument &ArgPack)
Retrieve a.
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Common base class for placeholders for types that get replaced by placeholder type deduction: C++11 a...
Implements C++ ABI-specific semantic analysis functions.
const Type * getBaseElementTypeUnsafe() const
Get the base element type of this type, potentially discarding type qualifiers.
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
void deduplicateMergedDefinitonsFor(NamedDecl *ND)
Clean up the merged definition list.
void CollectInheritedProtocols(const Decl *CDecl, llvm::SmallPtrSet< ObjCProtocolDecl *, 8 > &Protocols)
CollectInheritedProtocols - Collect all protocols in current class and those inherited by it...
unsigned getDoubleAlign() const
Selector getSelector() const
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
bool ObjCQualifiedClassTypesAreCompatible(QualType LHS, QualType RHS)
ObjCQualifiedClassTypesAreCompatible - compare Class<pr,...> and Class<pr1, ...>. ...
bool isNull() const
Return true if this QualType doesn't point to a type yet.
A type, stored as a Type*.
QualType getDependentSizedExtVectorType(QualType VectorType, Expr *SizeExpr, SourceLocation AttrLoc) const
bool useAddressSpaceMapMangling() const
Specify if mangling based on address space map should be used or not for language specific address sp...
IntType getUIntMaxType() const
void setOriginalDecl(const Decl *Orig)
unsigned getDoubleWidth() const
getDoubleWidth/Align/Format - Return the size/align/format of 'double'.
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
CallingConv
CallingConv - Specifies the calling convention that a function uses.
LangAS getOpenCLTypeAddrSpace(const Type *T) const
Get address space for OpenCL type.
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
static CXXRecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, CXXRecordDecl *PrevDecl=nullptr, bool DelayTypeCreation=false)
QualType getObjCGCQualType(QualType T, Qualifiers::GC gcAttr) const
Return the uniqued reference to the type for an Objective-C gc-qualified type.
virtual bool allowsLargerPreferedTypeAlignment() const
Whether target allows to overalign ABI-specified preferred alignment.
ExtInfo withNoReturn(bool noReturn) const
std::pair< CharUnits, CharUnits > getTypeInfoDataSizeInChars(QualType T) const
WatchOS is a modernisation of the iOS ABI, which roughly means it's the iOS64 ABI ported to 32-bits...
bool isVoidPointerType() const
bool isConstQualified() const
Determine whether this type is const-qualified.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
QualType getAutoType(QualType DeducedType, AutoTypeKeyword Keyword, bool IsDependent) const
C++11 deduced auto type.
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
unsigned getWCharWidth() const
getWCharWidth/Align - Return the size of 'wchar_t' for this target, in bits.
RecordDecl * getDecl() const
QualType getPackExpansionType(QualType Pattern, Optional< unsigned > NumExpansions)
CanQualType getUIntMaxType() const
Return the unique type for "uintmax_t" (C99 7.18.1.5), defined in <stdint.h>.
Abstract interface for external sources of AST nodes.
uint64_t getFieldOffset(unsigned FieldNo) const
getFieldOffset - Get the offset of the given field index, in bits.
SourceLocation getLocStart() const LLVM_READONLY
QualType getWideCharType() const
Return the type of wide characters.
IntType getPtrDiffType(unsigned AddrSpace) const
A template template parameter pack that has been substituted for a template template argument pack...
There is no lifetime qualification on this type.
static unsigned NumImplicitDestructorsDeclared
The number of implicitly-declared destructors for which declarations were built.
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
std::string getAsString() const
Derive the full selector name (e.g.
is AltiVec 'vector Pixel'
This declaration does not have an attached comment, and we have searched the redeclaration chain...
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
SelectorTable & Selectors
Assigning into this object requires the old value to be released and the new value to be retained...
bool QIdProtocolsAdoptObjCObjectProtocols(QualType QT, ObjCInterfaceDecl *IDecl)
QIdProtocolsAdoptObjCObjectProtocols - Checks that protocols in QT's qualified-id protocol list adopt...
QualType getCanonicalType() const
bool isBuiltinType() const
Helper methods to distinguish type categories.
not a target-specific vector type
llvm::PointerUnion< VarTemplateDecl *, MemberSpecializationInfo * > TemplateOrSpecializationInfo
A type synonym for the TemplateOrInstantiation mapping.
ExceptionSpecificationType Type
The kind of exception specification this is.
Expr * getBlockVarCopyInits(const VarDecl *VD)
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
ExtParameterInfo getExtParameterInfo(unsigned I) const
bool isSpecialized() const
Determine whether this object type is "specialized", meaning that it has type arguments.
ExtProtoInfo getExtProtoInfo() const
static GVALinkage basicGVALinkageForFunction(const ASTContext &Context, const FunctionDecl *FD)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
QualType getSignatureParameterType(QualType T) const
Retrieve the parameter type as adjusted for use in the signature of a function, decaying array and fu...
const ExtParameterInfo * ExtParameterInfos
unsigned getMaxAtomicInlineWidth() const
Return the maximum width lock-free atomic operation which can be inlined given the supported features...
void AddDeallocation(void(*Callback)(void *), void *Data)
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
NullPointerConstantKind isNullPointerConstant(ASTContext &Ctx, NullPointerConstantValueDependence NPC) const
isNullPointerConstant - C99 6.3.2.3p3 - Test if this reduces down to a Null pointer constant...
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
TypedefDecl * getUInt128Decl() const
Retrieve the declaration for the 128-bit unsigned integer type.
Sugar for parentheses used when specifying types.
QualType getReturnType() const
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
bool hasSameTemplateName(TemplateName X, TemplateName Y)
Determine whether the given template names refer to the same template.
LangAS getAddressSpace() const
Return the address space of this type.
QualType getUIntPtrType() const
Return a type compatible with "uintptr_t" (C99 7.18.1.4), as defined by the target.
unsigned getOpenMPDefaultSimdAlign(QualType T) const
Get default simd alignment of the specified complete type in bits.
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
bool isObjCQualifiedClassType() const
True if this is equivalent to 'Class.
This names the __make_integer_seq BuiltinTemplateDecl.
unsigned getManglingNumber(const NamedDecl *ND) const
A structure for storing an already-substituted template template parameter pack.
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
static unsigned NumImplicitCopyAssignmentOperatorsDeclared
The number of implicitly-declared copy assignment operators for which declarations were built...
Kind getKind() const LLVM_READONLY
TagDecl - Represents the declaration of a struct/union/class/enum.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
size_t getSideTableAllocatedMemory() const
Return the total memory used for various side tables.
unsigned getChar16Width() const
getChar16Width/Align - Return the size of 'char16_t' for this target, in bits.
unsigned getLongLongWidth() const
getLongLongWidth/Align - Return the size of 'signed long long' and 'unsigned long long' for this targ...
CallingConv getCC() const
void Profile(llvm::FoldingSetNodeID &ID)
QualType getElementType() const
QualType getObjCSelType() const
Retrieve the type that corresponds to the predefined Objective-C 'SEL' type.
ObjCInterfaceDecl * getObjCProtocolDecl() const
Retrieve the Objective-C class declaration corresponding to the predefined Protocol class...
QualType getWritePipeType(QualType T) const
Return a write_only pipe type for the specified type.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getBaseElementType(const ArrayType *VAT) const
Return the innermost element type of an array type.
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Represents a static or instance method of a struct/union/class.
TypedefNameDecl * getTypedefNameForUnnamedTagDecl(const TagDecl *TD)
const ConstantArrayType * getAsConstantArrayType(QualType T) const
IntType getIntMaxType() const
bool hasExceptionSpec() const
Return whether this function has any kind of exception spec.
QualType getExtVectorType(QualType VectorType, unsigned NumElts) const
Return the unique reference to an extended vector type of the specified element type and size...
DeclarationNameInfo getNameForTemplate(TemplateName Name, SourceLocation NameLoc) const
Weak for now, might become strong later in this TU.
void Profile(llvm::FoldingSetNodeID &ID)
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
unsigned getLineNumber(FileID FID, unsigned FilePos, bool *Invalid=nullptr) const
Given a SourceLocation, return the spelling line number for the position indicated.
unsigned getFloat128Width() const
getFloat128Width/Align/Format - Return the size/align/format of '__float128'.
This file defines OpenMP nodes for declarative directives.
overridden_cxx_method_iterator overridden_methods_begin(const CXXMethodDecl *Method) const
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
ObjCCategoryDecl - Represents a category declaration.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
BuiltinTemplateKind
Kinds of BuiltinTemplateDecl.
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
unsigned getHalfAlign() const
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
CanQualType getSignedSizeType() const
Return the unique signed counterpart of the integer type corresponding to size_t. ...
QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, ArrayRef< ObjCProtocolDecl *> protocols, QualType Canonical=QualType()) const
bool isObjCObjectPointerType() const
bool isAnyPointerType() const
This declaration is only a declaration.
is AltiVec 'vector bool ...'
virtual BuiltinVaListKind getBuiltinVaListKind() const =0
Returns the kind of __builtin_va_list type that should be used with this target.
SplitQualType getSplitUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
Represents one property declaration in an Objective-C interface.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
__builtin_va_list as defined by the Power ABI: https://www.power.org /resources/downloads/Power-Arch-...
bool canBindObjCObjectType(QualType To, QualType From)
DestructionKind isDestructedType() const
Returns a nonzero value if objects of this type require non-trivial work to clean up after...
We have found a comment attached to this particular declaration.
The generic Itanium ABI is the standard ABI of most open-source and Unix-like platforms.
void getOverriddenMethods(const NamedDecl *Method, SmallVectorImpl< const NamedDecl *> &Overridden) const
Return C++ or ObjC overridden methods for the given Method.
void InitBuiltinTypes(const TargetInfo &Target, const TargetInfo *AuxTarget=nullptr)
Initialize built-in types.
bool isSuperClassOf(const ObjCInterfaceDecl *I) const
isSuperClassOf - Return true if this class is the specified class or is a super class of the specifie...
Qualifiers getIndexTypeQualifiers() const
TypeClass getTypeClass() const
QualType getAttributedType(AttributedType::Kind attrKind, QualType modifiedType, QualType equivalentType)
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
bool typesAreBlockPointerCompatible(QualType, QualType)
CharUnits getDataSize() const
getDataSize() - Get the record data size, which is the record size without tail padding, in characters.
QualType getSuperClassType() const
Retrieve the type of the superclass of this object type.
ObjCDeclQualifier getObjCDeclQualifier() const
bool isTargetAddressSpace(LangAS AS)
EnumDecl * getDecl() const
bool isVectorType() const
ObjCPropertyImplDecl * getObjCPropertyImplDeclForPropertyDecl(const ObjCPropertyDecl *PD, const Decl *Container) const
FunctionDecl * getClassScopeSpecializationPattern(const FunctionDecl *FD)
Assigning into this object requires a lifetime extension.
SourceRange getBracketsRange() const
unsigned getPreferredTypeAlign(const Type *T) const
Return the "preferred" alignment of the specified type T for the current target, in bits...
ObjCImplementationDecl * getImplementation() const
llvm::DenseMap< const Decl *, RawCommentAndCacheFlags > RedeclComments
Mapping from declarations to comments attached to any redeclaration.
static DynTypedNode create(const T &Node)
Creates a DynTypedNode from Node.
comments::FullComment * getCommentForDecl(const Decl *D, const Preprocessor *PP) const
Return parsed documentation comment attached to a given declaration.
bool hasFlexibleArrayMember() const
unsigned getLongDoubleWidth() const
getLongDoubleWidth/Align/Format - Return the size/align/format of 'long double'.
bool hasSameUnqualifiedType(QualType T1, QualType T2) const
Determine whether the given types are equivalent after cvr-qualifiers have been removed.
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
__builtin_va_list as defined by ARM AAPCS ABI http://infocenter.arm.com
void Profile(llvm::FoldingSetNodeID &ID)
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.
QualType getArrayDecayedType(QualType T) const
Return the properly qualified result of decaying the specified array type to a pointer.
The WebAssembly ABI is a modified version of the Itanium ABI.
The injected class name of a C++ class template or class template partial specialization.
const llvm::fltSemantics & getFloatTypeSemantics(QualType T) const
Return the APFloat 'semantics' for the specified scalar floating point type.
Represents a pack expansion of types.
std::pair< CharUnits, CharUnits > getTypeInfoInChars(const Type *T) const
static QualType mergeEnumWithInteger(ASTContext &Context, const EnumType *ET, QualType other, bool isBlockReturnType)
Given that we have an enum type and a non-enum type, try to merge them.
ArrayRef< TemplateArgument > pack_elements() const
Iterator range referencing all of the elements of a template argument pack.
ast_type_traits::DynTypedNode DynTypedNode
Defines various enumerations that describe declaration and type specifiers.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
void setTemplateKeywordLoc(SourceLocation Loc)
void * Allocate(size_t Size, unsigned Align=8) const
ObjCDeclQualifier getObjCDeclQualifier() const
ArrayRef< Decl * > getModuleInitializers(Module *M)
Get the initializations to perform when importing a module, if any.
const llvm::fltSemantics & getFloat128Format() const
CanQualType UnsignedShortTy
ObjCIvarDecl * getNextIvar()
CallingConv getDefaultCallingConvention(bool IsVariadic, bool IsCXXMethod) const
Retrieves the default calling convention for the current target.
QualType getTypedefType(const TypedefNameDecl *Decl, QualType Canon=QualType()) const
Return the unique reference to the type for the specified typedef-name decl.
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
bool propertyTypesAreCompatible(QualType, QualType)
Represents a template argument.
static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)
DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the pointer over the consume...
QualType getTemplateSpecializationType(TemplateName T, ArrayRef< TemplateArgument > Args, QualType Canon=QualType()) const
Represents a type which was implicitly adjusted by the semantic engine for arbitrary reasons...
IntType
===-— Target Data Type Query Methods ----------------------------—===//
QualType withRestrict() const
Represents a template name that was expressed as a qualified name.
TagTypeKind
The kind of a tag type.
RealType getRealTypeByWidth(unsigned BitWidth) const
Return floating point type with specified width.
QualType getDecayedType(QualType T) const
Return the uniqued reference to the decayed version of the given type.
QualType getTypeOfType(QualType t) const
getTypeOfType - Unlike many "get<Type>" functions, we don't unique TypeOfType nodes.
const ObjCInterfaceDecl * getClassInterface() const
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
CanQualType ObjCBuiltinIdTy
void getLegacyIntegralTypeEncoding(QualType &t) const
getLegacyIntegralTypeEncoding - Another legacy compatibility encoding: 32-bit longs are encoded as 'l...
Dataflow Directional Tag Classes.
int getFloatingTypeOrder(QualType LHS, QualType RHS) const
Compare the rank of the two specified floating point types, ignoring the domain of the type (i...
void getInjectedTemplateArgs(const TemplateParameterList *Params, SmallVectorImpl< TemplateArgument > &Args)
Get a template argument list with one argument per template parameter in a template parameter list...
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
CharUnits getSize() const
getSize - Get the record size in characters.
ExtInfo getExtInfo() const
TargetInfo::OpenCLTypeKind getOpenCLTypeKind(const Type *T) const
Map an AST Type to an OpenCLTypeKind enum value.
not evaluated yet, for special member function
static NonTypeTemplateParmDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, unsigned D, unsigned P, IdentifierInfo *Id, QualType T, bool ParameterPack, TypeSourceInfo *TInfo)
A qualifier set is used to build a set of qualifiers.
QualType mergeTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false, bool BlockReturnType=false)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isSentinelNullExpr(const Expr *E)
The base class of all kinds of template declarations (e.g., class, function, etc.).
CanQualType DoubleComplexTy
static GVALinkage adjustGVALinkageForExternalDefinitionKind(const ASTContext &Ctx, const Decl *D, GVALinkage L)
Adjust the GVALinkage for a declaration based on what an external AST source knows about whether ther...
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
void addCopyConstructorForExceptionObject(CXXRecordDecl *RD, CXXConstructorDecl *CD)
typedef char* __builtin_va_list;
static FloatingRank getFloatingRank(QualType T)
getFloatingRank - Return a relative rank for floating point types.
static BuiltinTemplateDecl * Create(const ASTContext &C, DeclContext *DC, DeclarationName Name, BuiltinTemplateKind BTK)
The template argument is a pack expansion of a template name that was provided for a template templat...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
bool isObjCClassType() const
True if this is equivalent to the 'Class' type, i.e.
static bool areCompatVectorTypes(const VectorType *LHS, const VectorType *RHS)
areCompatVectorTypes - Return true if the two specified vector types are compatible.
QualType getUnderlyingType() const
CanQualType UnsignedLongLongTy
bool isDependent() const
Whether this nested name specifier refers to a dependent type or not.
const Expr * getInit() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
NamespaceDecl * getOriginalNamespace()
Get the original (first) namespace declaration.
bool hasLocalQualifiers() const
Determine whether this particular QualType instance has any qualifiers, without looking through any t...
This template specialization was instantiated from a template due to an explicit instantiation declar...
QualType getProcessIDType() const
Return the unique type for "pid_t" defined in <sys/types.h>.
Represents a dependent using declaration which was marked with typename.
bool isMSStaticDataMemberInlineDefinition(const VarDecl *VD) const
Returns true if this is an inline-initialized static data member which is treated as a definition for...
void Profile(llvm::FoldingSetNodeID &ID)
DeclarationName - The name of a declaration.
VectorKind getVectorKind() const
Represents the declaration of an Objective-C type parameter.
bool isBooleanType() const
const Type * strip(QualType type)
Collect any qualifiers on the given type and return an unqualified type.
const CXXRecordDecl * getBaseSharingVBPtr() const
Represents a C++11 pack expansion that produces a sequence of expressions.
QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const
Return a K&R style C function type like 'int()'.
static ASTContext::DynTypedNodeList getDynNodeFromMap(const NodeTy &Node, const MapTy &Map)
void Profile(llvm::FoldingSetNodeID &ID)
MangleNumberingContext & getManglingNumberContext(const DeclContext *DC)
Retrieve the context for computing mangling numbers in the given DeclContext.
void Profile(llvm::FoldingSetNodeID &ID)
const ObjCObjectType * getObjectType() const
Gets the type pointed to by this ObjC pointer.
bool isKindOfType() const
Whether this ia a "__kindof" type (semantically).
EnumDecl - Represents an enum.
FunctionType::ExtInfo getFunctionExtInfo(const Type &t)
void Profile(llvm::FoldingSetNodeID &ID)
A pointer to member type per C++ 8.3.3 - Pointers to members.
const FunctionType * adjustFunctionType(const FunctionType *Fn, FunctionType::ExtInfo EInfo)
Change the ExtInfo on a function type.
virtual ~ASTMutationListener()
This names the __type_pack_element BuiltinTemplateDecl.
bool canAssignObjCInterfacesInBlockPointer(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, bool BlockReturnType)
canAssignObjCInterfacesInBlockPointer - This routine is specifically written for providing type-safet...
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool hasObjCLifetime() const
QualType AutoRRefDeductTy
llvm::ArrayRef< TemplateArgumentLoc > arguments() const
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
A type that was preceded by the 'template' keyword, stored as a Type*.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
virtual bool hasFeature(StringRef Feature) const
Determine whether the given target has the given feature.
bool areComparableObjCPointerTypes(QualType LHS, QualType RHS)
QualType getUnsignedWCharType() const
Return the type of "unsigned wchar_t".
void Profile(llvm::FoldingSetNodeID &ID)
static unsigned NumImplicitCopyAssignmentOperators
The number of implicitly-declared copy assignment operators.
void addConsistentQualifiers(Qualifiers qs)
Add the qualifiers from the given set to this set, given that they don't conflict.
bool isObjCUnqualifiedIdOrClass() const
GVALinkage GetGVALinkageForVariable(const VarDecl *VD)
A dynamically typed AST node container.
const Decl * getOriginalDecl() const LLVM_READONLY
virtual IntType getIntTypeByWidth(unsigned BitWidth, bool IsSigned) const
Return integer type with specified width.
Represents a pointer to an Objective C object.
CanQualType ObjCBuiltinBoolTy
unsigned getIntWidth(QualType T) const
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
QualType getDependentSizedArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a dependently-sized array of the specified element type...
CharUnits getOffsetOfBaseWithVBPtr(const CXXRecordDecl *RD) const
Loading virtual member pointers using the virtual inheritance model always results in an adjustment u...
virtual ExtKind hasExternalDefinitions(const Decl *D)
bool isIncompleteArrayType() const
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
StringRef getObjCRuntimeNameAsString() const
Produce a name to be used for class's metadata.
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
BuiltinTemplateDecl * getTypePackElementDecl() const
unsigned getIndexTypeCVRQualifiers() const
bool isMacroArgExpansion(SourceLocation Loc, SourceLocation *StartLoc=nullptr) const
Tests whether the given source location represents a macro argument's expansion into the function-lik...
bool isObjCQualifiedId() const
bool isConstantSizeType() const
Return true if this is not a variable sized type, according to the rules of C99 6.7.5p3.
ObjCInterfaceDecl * getInterfaceDecl() const
If this pointer points to an Objective @interface type, gets the declaration for that interface...
comments::FullComment * getLocalCommentForDeclUncached(const Decl *D) const
Return parsed documentation comment attached to a given declaration.
QualType getCanonicalTypeInternal() const
bool isIntegerType() const
isIntegerType() does not include complex integers (a GCC extension).
This template specialization was declared or defined by an explicit specialization (C++ [temp...
CanQualType UnsignedLongTy
bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec)
Return true if the given vector types are of the same unqualified type or if they are equivalent to t...
void Profile(llvm::FoldingSetNodeID &ID)
const llvm::APInt & getSize() const
uint64_t getCharWidth() const
Return the size of the character type, in bits.
QualType getFloatingTypeOfSizeWithinDomain(QualType typeSize, QualType typeDomain) const
Return a real floating point or a complex type (based on typeDomain/typeSize).
void getObjCEncodingForType(QualType T, std::string &S, const FieldDecl *Field=nullptr, QualType *NotEncodedT=nullptr) const
Emit the Objective-CC type encoding for the given type T into S.
bool isFunctionType() const
bool hasNonFastQualifiers() const
Return true if the set contains any qualifiers which require an ExtQuals node to be allocated...
bool isAddressSpaceSupersetOf(Qualifiers other) const
Returns true if this address space is a superset of the other one.
unsigned getBoolAlign() const
Return the alignment of '_Bool' and C++ 'bool' for this target.
bool isStaticLocal() const
isStaticLocal - Returns true if a variable with function scope is a static local variable.
bool isObjCQualifiedIdType() const
static char ObjCEncodingForEnumType(const ASTContext *C, const EnumType *ET)
static GVALinkage basicGVALinkageForVariable(const ASTContext &Context, const VarDecl *VD)
TypeSourceInfo * getTypeSourceInfo() const
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required...
ExtVectorType - Extended vector type.
CanQualType ObjCBuiltinClassTy
DeclaratorDecl * getDeclaratorForUnnamedTagDecl(const TagDecl *TD)
param_const_iterator param_begin() const
Base for LValueReferenceType and RValueReferenceType.
SourceRange getBracketsRange() const
virtual uint64_t getMaxPointerWidth() const
Return the maximum width of pointers on this target.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
CanQualType BoundMemberTy
static TypedefDecl * CreateCharPtrBuiltinVaListDecl(const ASTContext *Context)
QualType getAutoDeductType() const
C++11 deduction pattern for 'auto' type.
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
llvm::DenseMap< const Decl *, comments::FullComment * > ParsedComments
Mapping from declarations to parsed comments attached to any redeclaration.
The template argument is a type.
void addDecl(Decl *D)
Add the declaration D into this context.
bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT)
canAssignObjCInterfaces - Return true if the two interface types are compatible for assignment from R...
TemplateArgument getInjectedTemplateArg(NamedDecl *ParamDecl)
void setBlockVarCopyInits(VarDecl *VD, Expr *Init)
Set the copy inialization expression of a block var decl.
Optional< NullabilityKind > getNullability(const ASTContext &context) const
Determine the nullability of the given type.
The template argument is actually a parameter pack.
void getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT, std::string &S) const
Put the string version of the type qualifiers QT into S.
BuiltinVaListKind
The different kinds of __builtin_va_list types defined by the target implementation.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
uint64_t getTypeSize(QualType T) const
Return the size of the specified (complete) type T, in bits.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
virtual CallingConv getDefaultCallingConv(CallingConvMethodType MT) const
Gets the default calling convention for the given target and declaration context. ...
bool isObjCObjectType() const
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
bool hasObjCGCAttr() const
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
ASTMutationListener * getASTMutationListener() const
Retrieve a pointer to the AST mutation listener associated with this AST context, if any...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
A template argument list.
uint64_t getFieldOffset(const ValueDecl *FD) const
Get the offset of a FieldDecl or IndirectFieldDecl, in bits.
BuiltinTemplateDecl * buildBuiltinTemplateDecl(BuiltinTemplateKind BTK, const IdentifierInfo *II) const
static TypedefDecl * CreateVaListDecl(const ASTContext *Context, TargetInfo::BuiltinVaListKind Kind)
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void mergeDefinitionIntoModule(NamedDecl *ND, Module *M, bool NotifyListeners=true)
Note that the definition ND has been merged into module M, and should be visible whenever M is visibl...
bool isNoThrow(unsigned ID) const
Return true if we know this builtin never throws an exception.
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
TypedefNameDecl * getDecl() const
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
pack_iterator pack_end() const
Iterator referencing one past the last argument of a template argument pack.
unsigned getFloatAlign() const
CharUnits toCharUnitsFromBits(int64_t BitSize) const
Convert a size in bits to a size in characters.
Reading or writing from this object requires a barrier call.
ExternCContextDecl * getExternCContextDecl() const
Expr * NoexceptExpr
Noexcept expression, if this is EST_ComputedNoexcept.
ArgKind getKind() const
Return the kind of stored template argument.
An attributed type is a type to which a type attribute has been applied.
const ObjCPropertyDecl * findPropertyDecl(bool CheckOverrides=true) const
Returns the property associated with this method's selector.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
QualType getParamType(unsigned i) const
QualType getTemplateTypeParmType(unsigned Depth, unsigned Index, bool ParameterPack, TemplateTypeParmDecl *ParmDecl=nullptr) const
Retrieve the template type parameter type for a template parameter or parameter pack with the given d...
Represents a type parameter type in Objective C.
bool typesAreCompatible(QualType T1, QualType T2, bool CompareUnqualified=false)
Compatibility predicates used to check assignment expressions.
int64_t toBits(CharUnits CharSize) const
Convert a size in characters to a size in bits.
TranslationUnitDecl * getTranslationUnitDecl() const
Defines the clang::SourceLocation class and associated facilities.
void Profile(llvm::FoldingSetNodeID &ID)
QualType getUnqualifiedType() const
Retrieve the unqualified variant of the given type, removing as little sugar as possible.
bool hasUnaligned() const
bool mergeExtParameterInfo(const FunctionProtoType *FirstFnType, const FunctionProtoType *SecondFnType, bool &CanUseFirst, bool &CanUseSecond, SmallVectorImpl< FunctionProtoType::ExtParameterInfo > &NewParamInfos)
This function merges the ExtParameterInfo lists of two functions.
llvm::DenseMap< const void *, llvm::PointerUnion4< const Decl *, const Stmt *, ast_type_traits::DynTypedNode *, ParentVector * > > ParentMapPointers
Maps from a node to its parents.
void addModuleInitializer(Module *M, Decl *Init)
Add a declaration to the list of declarations that are initialized for a module.
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
bool hasSignedIntegerRepresentation() const
Determine whether this type has an signed integer representation of some sort, e.g., it is an signed integer type or a vector.
Represents a C++ struct/union/class.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
IdentifierInfo * getTypePackElementName() const
Represents a template specialization type whose template cannot be resolved, e.g. ...
const llvm::fltSemantics & getFloatFormat() const
QualType getRValueReferenceType(QualType T) const
Return the uniqued reference to the type for an rvalue reference to the specified type...
TypeInfo getTypeInfo(const Type *T) const
Get the size and alignment of the specified complete type in bits.
The template argument is a template name that was provided for a template template parameter...
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
Represents a C array with an unspecified size.
VTableContextBase * getVTableContext()
TemplateName getCanonicalTemplateName(TemplateName Name) const
Retrieves the "canonical" template name that refers to a given template.
Missing a type from <stdio.h>
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
static TranslationUnitDecl * Create(ASTContext &C)
static void SortAndUniqueProtocols(SmallVectorImpl< ObjCProtocolDecl *> &Protocols)
IdentifierInfo * getMakeIntegerSeqName() const
const ObjCInterfaceDecl * getObjContainingInterface(const NamedDecl *ND) const
Returns the Objective-C interface that ND belongs to if it is an Objective-C method/property/ivar etc...
Qualifiers getQualifiers() const
Retrieve the set of qualifiers applied to this type.
ObjCIvarDecl - Represents an ObjC instance variable.
static int compare(DeclarationName LHS, DeclarationName RHS)
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
Provides information a specialization of a member of a class template, which may be a member function...
QualType removeAddrSpaceQualType(QualType T) const
Remove any existing address space on the type and returns the type with qualifiers intact (or that's ...
A structure for storing the information associated with an overloaded template name.
void getObjCEncodingForMethodParameter(Decl::ObjCDeclQualifier QT, QualType T, std::string &S, bool Extended) const
getObjCEncodingForMethodParameter - Return the encoded type for a single method parameter or return t...
We searched for a comment attached to the particular declaration, but didn't find any...
static unsigned NumImplicitCopyConstructorsDeclared
The number of implicitly-declared copy constructors for which declarations were built.
Builtin::Context & BuiltinInfo
Weak definition of inline variable.
CharUnits getNonVirtualSize() const
getNonVirtualSize - Get the non-virtual size (in chars) of an object, which is the size of the object...
void Profile(llvm::FoldingSetNodeID &ID)
Declaration of a class template.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
This class is used for builtin types like 'int'.
TypedefDecl * getObjCClassDecl() const
Retrieve the typedef declaration corresponding to the predefined Objective-C 'Class' type...
QualType GetBuiltinType(unsigned ID, GetBuiltinTypeError &Error, unsigned *IntegerConstantArgs=nullptr) const
Return the type for the specified builtin.
param_const_iterator sel_param_end() const
QualType getInjectedClassNameType(CXXRecordDecl *Decl, QualType TST) const
getInjectedClassNameType - Return the unique reference to the injected class name type for the specif...
uint64_t getPointerAlign(unsigned AddrSpace) const
static TypedefDecl * CreateVoidPtrBuiltinVaListDecl(const ASTContext *Context)
Defines the clang::TargetInfo interface.
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U)
Determine whether two function types are the same, ignoring exception specifications in cases where t...
unsigned getSimdDefaultAlign() const
Return default simd alignment for the given target.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
unsigned CountNonClassIvars(const ObjCInterfaceDecl *OI) const
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
void setRAngleLoc(SourceLocation Loc)
unsigned getCVRQualifiers() const
Qualifiers::ObjCLifetime getInnerObjCOwnership(QualType T) const
Recurses in pointer/array types until it finds an Objective-C retainable type and returns its ownersh...
SourceLocation getLAngleLoc() const
void adjustExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI, bool AsWritten=false)
Change the exception specification on a function once it is delay-parsed, instantiated, or computed.
const VariableArrayType * getAsVariableArrayType(QualType T) const
static bool sameObjCTypeArgs(ASTContext &ctx, const ObjCInterfaceDecl *iface, ArrayRef< QualType > lhsArgs, ArrayRef< QualType > rhsArgs, bool stripKindOf)
QualType getjmp_bufType() const
Retrieve the C jmp_buf type.
static Decl::Kind getKind(const Decl *D)
QualType getSignedWCharType() const
Return the type of "signed wchar_t".
unsigned getNumElements() const
IntType getIntPtrType() const
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
static bool NeedsInjectedClassNameType(const RecordDecl *D)
TranslationUnitDecl - The top declaration context.
uint64_t getTargetNullPointerValue(QualType QT) const
Get target-dependent integer value for null pointer which is used for constant folding.
QualType getRealTypeForBitwidth(unsigned DestWidth) const
getRealTypeForBitwidth - sets floating point QualTy according to specified bitwidth.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
QualType getAsType() const
Retrieve the type for a type template argument.
A reference to a declared variable, function, enum, etc.
QualType getIntPtrType() const
Return a type compatible with "intptr_t" (C99 7.18.1.4), as defined by the target.
Represents an extended address space qualifier where the input address space value is dependent...
Represents a type template specialization; the template must be a class template, a type alias templa...
ArrayRef< ParmVarDecl * > parameters() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
GVALinkage
A more specific kind of linkage than enum Linkage.
A lazy value (of type T) that is within an AST node of type Owner, where the value might change in la...
bool isPointerType() const
llvm::DenseMap< ast_type_traits::DynTypedNode, llvm::PointerUnion4< const Decl *, const Stmt *, ast_type_traits::DynTypedNode *, ParentVector * > > ParentMapOtherNodes
Parent map for nodes without pointer identity.
QualType mergeFunctionParameterTypes(QualType, QualType, bool OfBlockPointer=false, bool Unqualified=false)
mergeFunctionParameterTypes - merge two types which appear as function parameter types ...
void addAddressSpace(LangAS space)
CharUnits getTypeSizeInChars(QualType T) const
Return the size of the specified (complete) type T, in characters.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
QualType getDependentTemplateSpecializationType(ElaboratedTypeKeyword Keyword, NestedNameSpecifier *NNS, const IdentifierInfo *Name, const TemplateArgumentListInfo &Args) const
bool isStaticDataMember() const
Determines whether this is a static data member.
We can encode up to four bits in the low bits of a type pointer, but there are many more type qualifi...
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
A set of overloaded template declarations.
unsigned getChar32Align() const
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
ObjCIvarDecl * all_declared_ivar_begin()
all_declared_ivar_begin - return first ivar declared in this class, its extensions and its implementa...
QualType getObjCObjectPointerType(QualType OIT) const
Return a ObjCObjectPointerType type for the given ObjCObjectType.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
void setAccess(AccessSpecifier AS)
Represents a C array with a specified size that is not an integer-constant-expression.
void setTemplateNameLoc(SourceLocation Loc)
void addOverriddenMethod(const CXXMethodDecl *Method, const CXXMethodDecl *Overridden)
Note that the given C++ Method overrides the given Overridden method.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
const CXXConstructorDecl * getCopyConstructorForExceptionObject(CXXRecordDecl *RD)
No keyword precedes the qualified type name.
QualType getVariableArrayType(QualType EltTy, Expr *NumElts, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals, SourceRange Brackets) const
Return a non-unique reference to the type for a variable array of the specified element type...
bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS, bool ForCompare)
ObjCQualifiedIdTypesAreCompatible - We know that one of lhs/rhs is an ObjCQualifiedIDType.
bool isInline() const
Whether this variable is (C++1z) inline.
void Profile(llvm::FoldingSetNodeID &ID)
CanQualType getIntMaxType() const
Return the unique type for "intmax_t" (C99 7.18.1.5), defined in <stdint.h>.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
unsigned getTargetAddressSpace(QualType T) const
bool isPropertyAccessor() const
Selector getGetterName() const
void Profile(llvm::FoldingSetNodeID &ID, const ASTContext &Context)
static bool isObjCNSObjectType(QualType Ty)
Return true if this is an NSObject object with its NSObject attribute set.
SourceLocation getRAngleLoc() const
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
void addedLocalImportDecl(ImportDecl *Import)
Notify the AST context that a new import declaration has been parsed or implicitly created within thi...
virtual uint64_t getNullPointerValue(LangAS AddrSpace) const
Get integer value for null pointer.
The global specifier '::'. There is no stored value.
static bool isStructEmpty(QualType Ty)
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Missing a type from <setjmp.h>
void setType(QualType newType)
void removeAddressSpace()
IntType getProcessIDType() const
QualType getReadPipeType(QualType T) const
Return a read_only pipe type for the specified type.
const LangOptions & getLangOpts() const
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
bool AtomicUsesUnsupportedLibcall(const AtomicExpr *E) const
base_class_range vbases()
Represents the canonical version of C arrays with a specified constant size.
This class handles loading and caching of source files into memory.
The parameter is invariant: must match exactly.
ExceptionSpecInfo ExceptionSpec
QualType isPromotableBitField(Expr *E) const
Whether this is a promotable bitfield reference according to C99 6.3.1.1p2, bullet 2 (and GCC extensi...
Defines enum values for all the target-independent builtin functions.
QualType getAdjustedType(QualType Orig, QualType New) const
Return the uniqued reference to a type adjusted from the original type to a new type.
Declaration of a template function.
const void * getMemoizationData() const
Returns a pointer that identifies the stored AST node.
A class which abstracts out some details necessary for making a call.
QualType getUnqualifiedArrayType(QualType T, Qualifiers &Quals)
Return this type as a completely-unqualified array type, capturing the qualifiers in Quals...
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
bool BlockRequiresCopying(QualType Ty, const VarDecl *D)
Returns true iff we need copy/dispose helpers for the given type.
InlineVariableDefinitionKind getInlineVariableDefinitionKind(const VarDecl *VD) const
Determine whether a definition of this inline variable should be treated as a weak or strong definiti...
SourceLocation getLocation() const
QualType getPointeeType() const
const RawComment * getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl=nullptr) const
Return the documentation comment attached to a given declaration.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
bool isExternallyVisible() const
APValue * getMaterializedTemporaryValue(const MaterializeTemporaryExpr *E, bool MayCreate)
Get the storage for the constant value of a materialized temporary of static storage duration...
A single template declaration.
void Profile(llvm::FoldingSetNodeID &ID)
CanQualType OCLClkEventTy
bool getByrefLifetime(QualType Ty, Qualifiers::ObjCLifetime &Lifetime, bool &HasByrefExtendedLayout) const
Returns true, if given type has a known lifetime.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
QualType getComplexType(QualType T) const
Return the uniqued reference to the type for a complex number with the specified element type...
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth, signed/unsigned.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
CanQualType UnsignedIntTy
QualType getIncompleteArrayType(QualType EltTy, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const
Return a unique reference to the type for an incomplete array of the specified element type...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Qualifiers::ObjCLifetime getObjCLifetime() const
Returns lifetime attribute of this type.
static unsigned NumImplicitDestructors
The number of implicitly-declared destructors.
BuiltinTemplateDecl * getMakeIntegerSeqDecl() const
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.