26 #include "llvm/Support/SaveAndRestore.h"
28 using namespace clang;
29 using namespace clang::serialization;
39 ASTReader::RecordLocation Loc;
44 unsigned AnonymousDeclNumber;
53 bool IsDeclMarkedUsed;
55 uint64_t GetCurrentCursorOffset();
57 uint64_t ReadLocalOffset() {
58 uint64_t LocalOffset = Record.readInt();
59 assert(LocalOffset < Loc.Offset &&
"offset point after current record");
60 return LocalOffset ? Loc.Offset - LocalOffset : 0;
63 uint64_t ReadGlobalOffset() {
64 uint64_t Local = ReadLocalOffset();
65 return Local ? Record.getGlobalBitOffset(Local) : 0;
69 return Record.readSourceLocation();
73 return Record.readSourceRange();
77 return Record.getTypeSourceInfo();
81 return Record.readDeclID();
84 std::string ReadString() {
85 return Record.readString();
89 for (
unsigned I = 0, Size = Record.readInt();
I != Size; ++
I)
90 IDs.push_back(ReadDeclID());
94 return Record.readDecl();
99 return Record.readDeclAs<T>();
103 Record.readQualifierInfo(Info);
107 Record.readDeclarationNameLoc(DNLoc, Name);
111 if (Record.getIdx() == Record.size())
114 return Record.getGlobalSubmoduleID(Record.readInt());
118 return Record.getSubmodule(readSubmoduleID());
122 void ReadCXXDefinitionData(
struct CXXRecordDecl::DefinitionData &Data,
125 struct CXXRecordDecl::DefinitionData &&NewDD);
126 void ReadObjCDefinitionData(
struct ObjCInterfaceDecl::DefinitionData &Data);
128 struct ObjCInterfaceDecl::DefinitionData &&NewDD);
129 void ReadObjCDefinitionData(
struct ObjCProtocolDecl::DefinitionData &Data);
131 struct ObjCProtocolDecl::DefinitionData &&NewDD);
140 class RedeclarableResult {
147 : MergeWith(MergeWith), FirstID(FirstID), IsKeyDecl(IsKeyDecl) {}
153 bool isKeyDecl()
const {
return IsKeyDecl; }
157 Decl *getKnownMergeTarget()
const {
return MergeWith; }
165 class FindExistingResult {
171 unsigned AnonymousDeclNumber;
174 void operator=(FindExistingResult &&) =
delete;
178 : Reader(Reader), New(
nullptr), Existing(
nullptr), AddResult(
false),
179 AnonymousDeclNumber(0), TypedefNameForLinkage(
nullptr) {}
182 unsigned AnonymousDeclNumber,
184 : Reader(Reader), New(New), Existing(Existing), AddResult(
true),
185 AnonymousDeclNumber(AnonymousDeclNumber),
186 TypedefNameForLinkage(TypedefNameForLinkage) {}
188 FindExistingResult(FindExistingResult &&Other)
189 : Reader(Other.Reader), New(Other.New), Existing(Other.Existing),
190 AddResult(Other.AddResult),
191 AnonymousDeclNumber(Other.AnonymousDeclNumber),
192 TypedefNameForLinkage(Other.TypedefNameForLinkage) {
193 Other.AddResult =
false;
196 ~FindExistingResult();
200 void suppress() { AddResult =
false; }
202 operator NamedDecl*()
const {
return Existing; }
205 operator T*()
const {
return dyn_cast_or_null<T>(Existing); }
210 FindExistingResult findExisting(
NamedDecl *D);
214 ASTReader::RecordLocation Loc,
216 : Reader(Reader), Record(Record), Loc(Loc),
217 ThisDeclID(thisDeclID), ThisDeclLoc(ThisDeclLoc),
218 TypeIDForTypeDecl(0), NamedDeclForTagDecl(0),
219 TypedefNameForLinkage(nullptr), HasPendingBody(
false),
220 IsDeclMarkedUsed(
false) {}
222 template <
typename T>
static
231 auto *&LazySpecializations = D->getCommonPtr()->LazySpecializations;
233 if (
auto &Old = LazySpecializations) {
234 IDs.insert(IDs.end(), Old + 1, Old + 1 + Old[0]);
235 std::sort(IDs.begin(), IDs.end());
236 IDs.erase(std::unique(IDs.begin(), IDs.end()), IDs.end());
241 std::copy(IDs.begin(), IDs.end(),
Result + 1);
243 LazySpecializations =
Result;
246 template <
typename DeclT>
248 static Decl *getMostRecentDeclImpl(...);
249 static Decl *getMostRecentDecl(
Decl *D);
251 template <
typename DeclT>
252 static void attachPreviousDeclImpl(
ASTReader &Reader,
255 static void attachPreviousDeclImpl(
ASTReader &Reader, ...);
259 template <
typename DeclT>
261 static void attachLatestDeclImpl(...);
262 static void attachLatestDecl(
Decl *D,
Decl *latest);
264 template <
typename DeclT>
266 static void markIncompleteDeclChainImpl(...);
278 Cat->NextClassCategory =
Next;
281 void VisitDecl(
Decl *D);
295 RedeclarableResult VisitTagDecl(
TagDecl *TD);
297 RedeclarableResult VisitRecordDeclImpl(
RecordDecl *RD);
301 RedeclarableResult VisitClassTemplateSpecializationDeclImpl(
305 VisitClassTemplateSpecializationDeclImpl(D);
307 void VisitClassTemplatePartialSpecializationDecl(
309 void VisitClassScopeFunctionSpecializationDecl(
314 VisitVarTemplateSpecializationDeclImpl(D);
316 void VisitVarTemplatePartialSpecializationDecl(
332 RedeclarableResult VisitVarDeclImpl(
VarDecl *D);
363 std::pair<uint64_t, uint64_t> VisitDeclContext(
DeclContext *DC);
370 DeclID TemplatePatternID = 0);
374 RedeclarableResult &Redecl,
375 DeclID TemplatePatternID = 0);
382 DeclID DsID,
bool IsKeyDecl);
410 template<
typename DeclT>
411 class MergedRedeclIterator {
412 DeclT *Start, *Canonical, *
Current;
414 MergedRedeclIterator() :
Current(nullptr) {}
415 MergedRedeclIterator(DeclT *Start)
416 : Start(Start), Canonical(nullptr),
Current(Start) {}
420 MergedRedeclIterator &operator++() {
436 friend bool operator!=(
const MergedRedeclIterator &A,
437 const MergedRedeclIterator &B) {
438 return A.Current != B.Current;
443 template <
typename DeclT>
444 static llvm::iterator_range<MergedRedeclIterator<DeclT>>
446 return llvm::make_range(MergedRedeclIterator<DeclT>(D),
447 MergedRedeclIterator<DeclT>());
450 uint64_t ASTDeclReader::GetCurrentCursorOffset() {
451 return Loc.F->DeclsCursor.GetCurrentBitNo() + Loc.F->GlobalBitOffset;
455 if (Record.readInt())
457 if (
auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
458 CD->NumCtorInitializers = Record.readInt();
459 if (CD->NumCtorInitializers)
460 CD->CtorInitializers = ReadGlobalOffset();
463 Reader.PendingBodies[FD] = GetCurrentCursorOffset();
464 HasPendingBody =
true;
473 IsDeclMarkedUsed =
false;
477 DeclaratorDecl::ExtInfo *Info =
478 DD->DeclInfo.get<DeclaratorDecl::ExtInfo *>();
479 Info->TInfo = GetTypeSourceInfo();
482 DD->DeclInfo = GetTypeSourceInfo();
486 if (
TypeDecl *TD = dyn_cast<TypeDecl>(D)) {
488 TD->setTypeForDecl(Reader.GetType(TypeIDForTypeDecl).getTypePtrOrNull());
492 if (NamedDeclForTagDecl)
493 cast<TagDecl>(D)->TypedefNameDeclOrQualifier =
494 cast<TypedefNameDecl>(Reader.GetDecl(NamedDeclForTagDecl));
497 ID->TypeForDecl = Reader.GetType(TypeIDForTypeDecl).getTypePtrOrNull();
498 }
else if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
503 if (Record.readInt())
504 ReadFunctionDefinition(FD);
510 isa<ParmVarDecl>(D)) {
517 GlobalDeclID SemaDCIDForTemplateParmDecl = ReadDeclID();
518 GlobalDeclID LexicalDCIDForTemplateParmDecl = ReadDeclID();
519 if (!LexicalDCIDForTemplateParmDecl)
520 LexicalDCIDForTemplateParmDecl = SemaDCIDForTemplateParmDecl;
521 Reader.addPendingDeclContextInfo(D,
522 SemaDCIDForTemplateParmDecl,
523 LexicalDCIDForTemplateParmDecl);
527 DeclContext *LexicalDC = ReadDeclAs<DeclContext>();
533 D->setDeclContextsImpl(MergedSemaDC ? MergedSemaDC : SemaDC, LexicalDC,
534 Reader.getContext());
538 if (Record.readInt()) {
540 Record.readAttributes(Attrs);
543 D->setAttrsImpl(Attrs, Reader.getContext());
546 D->Used = Record.readInt();
547 IsDeclMarkedUsed |= D->Used;
552 bool ModulePrivate = Record.readInt();
566 }
else if (Reader.getContext().getLangOpts().ModulesLocalVisibility) {
574 Reader.HiddenNamesMap[Owner].push_back(D);
576 }
else if (ModulePrivate) {
585 std::string Arg = ReadString();
586 memcpy(D->getTrailingObjects<
char>(), Arg.data(), Arg.size());
587 D->getTrailingObjects<
char>()[Arg.size()] =
'\0';
593 std::string
Name = ReadString();
594 memcpy(D->getTrailingObjects<
char>(), Name.data(), Name.size());
595 D->getTrailingObjects<
char>()[Name.size()] =
'\0';
597 D->ValueStart = Name.size() + 1;
598 std::string
Value = ReadString();
599 memcpy(D->getTrailingObjects<
char>() + D->ValueStart, Value.data(),
601 D->getTrailingObjects<
char>()[D->ValueStart + Value.size()] =
'\0';
605 llvm_unreachable(
"Translation units are not serialized");
611 AnonymousDeclNumber = Record.readInt();
618 TypeIDForTypeDecl = Record.getGlobalTypeID(Record.readInt());
621 ASTDeclReader::RedeclarableResult
623 RedeclarableResult Redecl = VisitRedeclarable(TD);
626 if (Record.readInt()) {
627 QualType modedT = Record.readType();
640 RedeclarableResult Redecl = VisitTypedefNameDecl(TD);
641 mergeRedeclarable(TD, Redecl);
645 RedeclarableResult Redecl = VisitTypedefNameDecl(TD);
646 if (
auto *Template = ReadDeclAs<TypeAliasTemplateDecl>())
650 mergeRedeclarable(TD, Redecl);
654 RedeclarableResult Redecl = VisitRedeclarable(TD);
659 if (!isa<CXXRecordDecl>(TD))
666 switch (Record.readInt()) {
671 ReadQualifierInfo(*Info);
672 TD->TypedefNameDeclOrQualifier = Info;
676 NamedDeclForTagDecl = ReadDeclID();
677 TypedefNameForLinkage = Record.getIdentifierInfo();
680 llvm_unreachable(
"unexpected tag info kind");
683 if (!isa<CXXRecordDecl>(TD))
684 mergeRedeclarable(TD, Redecl);
699 ED->
IsFixed = Record.readInt();
703 if (ED->IsCompleteDefinition &&
704 Reader.getContext().getLangOpts().Modules &&
705 Reader.getContext().getLangOpts().CPlusPlus) {
711 if (!D->isFromASTFile() && D->isCompleteDefinition()) {
718 Reader.MergedDeclContexts.insert(std::make_pair(ED, OldDef));
719 ED->IsCompleteDefinition =
false;
720 Reader.mergeDefinitionVisibility(OldDef, ED);
726 if (
EnumDecl *InstED = ReadDeclAs<EnumDecl>()) {
730 ED->setInstantiationOfMemberEnum(Reader.getContext(), InstED, TSK);
735 ASTDeclReader::RedeclarableResult
737 RedeclarableResult Redecl = VisitTagDecl(RD);
747 VD->
setType(Record.readType());
752 if (Record.readInt())
761 if (Record.readInt()) {
762 DeclaratorDecl::ExtInfo *Info
763 =
new (Reader.getContext()) DeclaratorDecl::ExtInfo();
764 ReadQualifierInfo(*Info);
770 RedeclarableResult Redecl = VisitRedeclarable(FD);
771 VisitDeclaratorDecl(FD);
773 ReadDeclarationNameLoc(FD->DNLoc, FD->
getDeclName());
780 FD->IsInline = Record.readInt();
781 FD->IsInlineSpecified = Record.readInt();
783 FD->IsVirtualAsWritten = Record.readInt();
784 FD->IsPure = Record.readInt();
785 FD->HasInheritedPrototype = Record.readInt();
786 FD->HasWrittenPrototype = Record.readInt();
787 FD->IsDeleted = Record.readInt();
788 FD->IsTrivial = Record.readInt();
789 FD->IsDefaulted = Record.readInt();
790 FD->IsExplicitlyDefaulted = Record.readInt();
791 FD->HasImplicitReturnZero = Record.readInt();
792 FD->IsConstexpr = Record.readInt();
793 FD->UsesSEHTry = Record.readInt();
794 FD->HasSkippedBody = Record.readInt();
795 FD->IsLateTemplateParsed = Record.readInt();
797 FD->EndRangeLoc = ReadSourceLocation();
801 mergeRedeclarable(FD, Redecl);
812 FD->setInstantiationOfMemberFunction(Reader.getContext(), InstFD, TSK);
814 mergeRedeclarable(FD, Redecl);
824 Record.readTemplateArgumentList(TemplArgs,
true);
829 bool HasTemplateArgumentsAsWritten = Record.readInt();
830 if (HasTemplateArgumentsAsWritten) {
831 unsigned NumTemplateArgLocs = Record.readInt();
832 TemplArgLocs.reserve(NumTemplateArgLocs);
833 for (
unsigned i=0; i != NumTemplateArgLocs; ++i)
834 TemplArgLocs.push_back(Record.readTemplateArgumentLoc());
836 LAngleLoc = ReadSourceLocation();
837 RAngleLoc = ReadSourceLocation();
846 for (
unsigned i=0, e = TemplArgLocs.size(); i != e; ++i)
851 HasTemplateArgumentsAsWritten ? &TemplArgsInfo
854 FD->TemplateOrSpecialization = FTInfo;
865 llvm::FoldingSetNodeID
ID;
867 void *InsertPos =
nullptr;
874 assert(Reader.getContext().getLangOpts().Modules &&
875 "already deserialized this template specialization");
876 mergeRedeclarable(FD, ExistingInfo->
Function, Redecl);
884 unsigned NumTemplates = Record.readInt();
885 while (NumTemplates--)
886 TemplDecls.
addDecl(ReadDeclAs<NamedDecl>());
890 unsigned NumArgs = Record.readInt();
892 TemplArgs.
addArgument(Record.readTemplateArgumentLoc());
897 TemplDecls, TemplArgs);
905 unsigned NumParams = Record.readInt();
907 Params.reserve(NumParams);
908 for (
unsigned I = 0;
I != NumParams; ++
I)
909 Params.push_back(ReadDeclAs<ParmVarDecl>());
910 FD->setParams(Reader.getContext(), Params);
915 if (Record.readInt()) {
918 Reader.PendingBodies[MD] = GetCurrentCursorOffset();
919 HasPendingBody =
true;
921 MD->
setCmdDecl(ReadDeclAs<ImplicitParamDecl>());
927 MD->IsOverriding = Record.readInt();
928 MD->HasSkippedBody = Record.readInt();
930 MD->IsRedeclaration = Record.readInt();
931 MD->HasRedeclaration = Record.readInt();
932 if (MD->HasRedeclaration)
933 Reader.getContext().setObjCMethodRedeclaration(MD,
934 ReadDeclAs<ObjCMethodDecl>());
941 MD->DeclEndLoc = ReadSourceLocation();
942 unsigned NumParams = Record.readInt();
944 Params.reserve(NumParams);
945 for (
unsigned I = 0;
I != NumParams; ++
I)
946 Params.push_back(ReadDeclAs<ParmVarDecl>());
948 MD->SelLocsKind = Record.readInt();
949 unsigned NumStoredSelLocs = Record.readInt();
951 SelLocs.reserve(NumStoredSelLocs);
952 for (
unsigned i = 0; i != NumStoredSelLocs; ++i)
953 SelLocs.push_back(ReadSourceLocation());
955 MD->setParamsAndSelLocs(Reader.getContext(), Params, SelLocs);
959 VisitTypedefNameDecl(D);
961 D->Variance = Record.readInt();
962 D->Index = Record.readInt();
963 D->VarianceLoc = ReadSourceLocation();
964 D->ColonLoc = ReadSourceLocation();
974 unsigned numParams = Record.readInt();
979 typeParams.reserve(numParams);
980 for (
unsigned i = 0; i != numParams; ++i) {
981 auto typeParam = ReadDeclAs<ObjCTypeParamDecl>();
985 typeParams.push_back(typeParam);
992 typeParams, rAngleLoc);
995 void ASTDeclReader::ReadObjCDefinitionData(
996 struct ObjCInterfaceDecl::DefinitionData &Data) {
998 Data.SuperClassTInfo = GetTypeSourceInfo();
1000 Data.EndLoc = ReadSourceLocation();
1001 Data.HasDesignatedInitializers = Record.readInt();
1004 unsigned NumProtocols = Record.readInt();
1006 Protocols.reserve(NumProtocols);
1007 for (
unsigned I = 0;
I != NumProtocols; ++
I)
1008 Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>());
1010 ProtoLocs.reserve(NumProtocols);
1011 for (
unsigned I = 0;
I != NumProtocols; ++
I)
1012 ProtoLocs.push_back(ReadSourceLocation());
1013 Data.ReferencedProtocols.set(Protocols.data(), NumProtocols, ProtoLocs.data(),
1014 Reader.getContext());
1017 NumProtocols = Record.readInt();
1019 Protocols.reserve(NumProtocols);
1020 for (
unsigned I = 0;
I != NumProtocols; ++
I)
1021 Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>());
1022 Data.AllReferencedProtocols.set(Protocols.data(), NumProtocols,
1023 Reader.getContext());
1027 struct ObjCInterfaceDecl::DefinitionData &&NewDD) {
1032 RedeclarableResult Redecl = VisitRedeclarable(ID);
1033 VisitObjCContainerDecl(ID);
1034 TypeIDForTypeDecl = Record.getGlobalTypeID(Record.readInt());
1035 mergeRedeclarable(ID, Redecl);
1037 ID->TypeParamList = ReadObjCTypeParamList();
1038 if (Record.readInt()) {
1040 ID->allocateDefinitionData();
1042 ReadObjCDefinitionData(ID->data());
1044 if (Canon->Data.getPointer()) {
1047 MergeDefinitionData(Canon, std::move(ID->data()));
1048 ID->Data = Canon->Data;
1059 Reader.PendingDefinitions.insert(ID);
1062 Reader.ObjCClassesLoaded.push_back(ID);
1069 VisitFieldDecl(IVD);
1073 bool synth = Record.readInt();
1077 void ASTDeclReader::ReadObjCDefinitionData(
1078 struct ObjCProtocolDecl::DefinitionData &Data) {
1080 unsigned NumProtoRefs = Record.readInt();
1082 ProtoRefs.reserve(NumProtoRefs);
1083 for (
unsigned I = 0;
I != NumProtoRefs; ++
I)
1084 ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>());
1086 ProtoLocs.reserve(NumProtoRefs);
1087 for (
unsigned I = 0;
I != NumProtoRefs; ++
I)
1088 ProtoLocs.push_back(ReadSourceLocation());
1089 Data.ReferencedProtocols.set(ProtoRefs.data(), NumProtoRefs,
1090 ProtoLocs.data(), Reader.getContext());
1094 struct ObjCProtocolDecl::DefinitionData &&NewDD) {
1099 RedeclarableResult Redecl = VisitRedeclarable(PD);
1100 VisitObjCContainerDecl(PD);
1101 mergeRedeclarable(PD, Redecl);
1103 if (Record.readInt()) {
1105 PD->allocateDefinitionData();
1107 ReadObjCDefinitionData(PD->data());
1110 if (Canon->Data.getPointer()) {
1113 MergeDefinitionData(Canon, std::move(PD->data()));
1114 PD->Data = Canon->Data;
1121 Reader.PendingDefinitions.insert(PD);
1132 VisitObjCContainerDecl(CD);
1140 Reader.CategoriesDeserialized.insert(CD);
1142 CD->ClassInterface = ReadDeclAs<ObjCInterfaceDecl>();
1143 CD->TypeParamList = ReadObjCTypeParamList();
1144 unsigned NumProtoRefs = Record.readInt();
1146 ProtoRefs.reserve(NumProtoRefs);
1147 for (
unsigned I = 0;
I != NumProtoRefs; ++
I)
1148 ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>());
1150 ProtoLocs.reserve(NumProtoRefs);
1151 for (
unsigned I = 0;
I != NumProtoRefs; ++
I)
1152 ProtoLocs.push_back(ReadSourceLocation());
1154 Reader.getContext());
1158 VisitNamedDecl(CAD);
1187 VisitObjCContainerDecl(D);
1192 VisitObjCImplDecl(D);
1193 D->CategoryNameLoc = ReadSourceLocation();
1197 VisitObjCImplDecl(D);
1199 D->SuperLoc = ReadSourceLocation();
1204 D->NumIvarInitializers = Record.readInt();
1205 if (D->NumIvarInitializers)
1206 D->IvarInitializers = ReadGlobalOffset();
1213 D->PropertyIvarDecl = ReadDeclAs<ObjCIvarDecl>();
1214 D->IvarLoc = ReadSourceLocation();
1220 VisitDeclaratorDecl(FD);
1221 FD->Mutable = Record.readInt();
1222 if (
int BitWidthOrInitializer = Record.readInt()) {
1223 FD->InitStorage.setInt(
1224 static_cast<FieldDecl::InitStorageKind>(BitWidthOrInitializer - 1));
1225 if (FD->InitStorage.getInt() == FieldDecl::ISK_CapturedVLAType) {
1227 FD->InitStorage.setPointer(Record.readType().getAsOpaquePtr());
1229 FD->InitStorage.setPointer(Record.readExpr());
1233 if (
FieldDecl *Tmpl = ReadDeclAs<FieldDecl>())
1234 Reader.getContext().setInstantiatedFromUnnamedFieldDecl(FD, Tmpl);
1240 VisitDeclaratorDecl(PD);
1241 PD->GetterId = Record.getIdentifierInfo();
1242 PD->SetterId = Record.getIdentifierInfo();
1248 FD->ChainingSize = Record.readInt();
1249 assert(FD->ChainingSize >= 2 &&
"Anonymous chaining must be >= 2");
1250 FD->Chaining =
new (Reader.getContext())
NamedDecl*[FD->ChainingSize];
1252 for (
unsigned I = 0;
I != FD->ChainingSize; ++
I)
1253 FD->Chaining[
I] = ReadDeclAs<NamedDecl>();
1259 RedeclarableResult Redecl = VisitRedeclarable(VD);
1260 VisitDeclaratorDecl(VD);
1265 if (!isa<ParmVarDecl>(VD)) {
1287 if (uint64_t Val = Record.readInt()) {
1288 VD->
setInit(Record.readExpr());
1292 Eval->
IsICE = Val == 3;
1297 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1299 switch ((VarKind)Record.readInt()) {
1300 case VarNotTemplate:
1303 if (!isa<ParmVarDecl>(VD) && !isa<ImplicitParamDecl>(VD) &&
1304 !isa<VarTemplateSpecializationDecl>(VD))
1305 mergeRedeclarable(VD, Redecl);
1311 case StaticDataMemberSpecialization: {
1312 VarDecl *Tmpl = ReadDeclAs<VarDecl>();
1316 Reader.getContext().setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
1317 mergeRedeclarable(VD, Redecl);
1331 unsigned isObjCMethodParam = Record.readInt();
1332 unsigned scopeDepth = Record.readInt();
1333 unsigned scopeIndex = Record.readInt();
1334 unsigned declQualifier = Record.readInt();
1335 if (isObjCMethodParam) {
1336 assert(scopeDepth == 0);
1344 if (Record.readInt())
1354 for (
unsigned I = 0;
I != DD->NumBindings; ++
I)
1355 BDs[
I] = ReadDeclAs<BindingDecl>();
1360 BD->Binding = Record.readExpr();
1365 AD->
setAsmString(cast<StringLiteral>(Record.readExpr()));
1371 BD->
setBody(cast_or_null<CompoundStmt>(Record.readStmt()));
1373 unsigned NumParams = Record.readInt();
1375 Params.reserve(NumParams);
1376 for (
unsigned I = 0;
I != NumParams; ++
I)
1377 Params.push_back(ReadDeclAs<ParmVarDecl>());
1384 bool capturesCXXThis = Record.readInt();
1385 unsigned numCaptures = Record.readInt();
1387 captures.reserve(numCaptures);
1388 for (
unsigned i = 0; i != numCaptures; ++i) {
1390 unsigned flags = Record.readInt();
1391 bool byRef = (flags & 1);
1392 bool nested = (flags & 2);
1393 Expr *copyExpr = ((flags & 4) ? Record.readExpr() :
nullptr);
1397 BD->
setCaptures(Reader.getContext(), captures, capturesCXXThis);
1402 unsigned ContextParamPos = Record.readInt();
1405 for (
unsigned I = 0;
I < CD->NumParams; ++
I) {
1406 if (
I != ContextParamPos)
1407 CD->
setParam(
I, ReadDeclAs<ImplicitParamDecl>());
1422 D->RBraceLoc = ReadSourceLocation();
1431 RedeclarableResult Redecl = VisitRedeclarable(D);
1434 D->LocStart = ReadSourceLocation();
1435 D->RBraceLoc = ReadSourceLocation();
1442 if (Redecl.getFirstID() == ThisDeclID) {
1443 AnonNamespace = ReadDeclID();
1447 D->AnonOrFirstNamespaceAndInline.setPointer(D->
getFirstDecl());
1450 mergeRedeclarable(D, Redecl);
1452 if (AnonNamespace) {
1456 NamespaceDecl *Anon = cast<NamespaceDecl>(Reader.GetDecl(AnonNamespace));
1457 if (!Record.isModule())
1463 RedeclarableResult Redecl = VisitRedeclarable(D);
1465 D->NamespaceLoc = ReadSourceLocation();
1466 D->IdentLoc = ReadSourceLocation();
1467 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1468 D->Namespace = ReadDeclAs<NamedDecl>();
1469 mergeRedeclarable(D, Redecl);
1475 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1476 ReadDeclarationNameLoc(D->DNLoc, D->
getDeclName());
1477 D->FirstUsingShadow.setPointer(ReadDeclAs<UsingShadowDecl>());
1479 if (
NamedDecl *Pattern = ReadDeclAs<NamedDecl>())
1480 Reader.getContext().setInstantiatedFromUsingDecl(D, Pattern);
1486 D->InstantiatedFrom = ReadDeclAs<NamedDecl>();
1488 for (
unsigned I = 0;
I != D->NumExpansions; ++
I)
1489 Expansions[
I] = ReadDeclAs<NamedDecl>();
1494 RedeclarableResult Redecl = VisitRedeclarable(D);
1497 D->UsingOrNextShadow = ReadDeclAs<NamedDecl>();
1500 Reader.getContext().setInstantiatedFromUsingShadowDecl(D, Pattern);
1501 mergeRedeclarable(D, Redecl);
1506 VisitUsingShadowDecl(D);
1507 D->NominatedBaseClassShadowDecl = ReadDeclAs<ConstructorUsingShadowDecl>();
1508 D->ConstructedBaseClassShadowDecl = ReadDeclAs<ConstructorUsingShadowDecl>();
1509 D->IsVirtual = Record.readInt();
1514 D->UsingLoc = ReadSourceLocation();
1515 D->NamespaceLoc = ReadSourceLocation();
1516 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1517 D->NominatedNamespace = ReadDeclAs<NamedDecl>();
1518 D->CommonAncestor = ReadDeclAs<DeclContext>();
1524 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1525 ReadDeclarationNameLoc(D->DNLoc, D->
getDeclName());
1526 D->EllipsisLoc = ReadSourceLocation();
1533 D->TypenameLocation = ReadSourceLocation();
1534 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1535 D->EllipsisLoc = ReadSourceLocation();
1539 void ASTDeclReader::ReadCXXDefinitionData(
1540 struct CXXRecordDecl::DefinitionData &Data,
const CXXRecordDecl *D) {
1542 Data.UserDeclaredConstructor = Record.readInt();
1543 Data.UserDeclaredSpecialMembers = Record.readInt();
1544 Data.Aggregate = Record.readInt();
1545 Data.PlainOldData = Record.readInt();
1546 Data.Empty = Record.readInt();
1547 Data.Polymorphic = Record.readInt();
1548 Data.Abstract = Record.readInt();
1549 Data.IsStandardLayout = Record.readInt();
1550 Data.HasNoNonEmptyBases = Record.readInt();
1551 Data.HasPrivateFields = Record.readInt();
1552 Data.HasProtectedFields = Record.readInt();
1553 Data.HasPublicFields = Record.readInt();
1554 Data.HasMutableFields = Record.readInt();
1555 Data.HasVariantMembers = Record.readInt();
1556 Data.HasOnlyCMembers = Record.readInt();
1557 Data.HasInClassInitializer = Record.readInt();
1558 Data.HasUninitializedReferenceMember = Record.readInt();
1559 Data.HasUninitializedFields = Record.readInt();
1560 Data.HasInheritedConstructor = Record.readInt();
1561 Data.HasInheritedAssignment = Record.readInt();
1562 Data.NeedOverloadResolutionForCopyConstructor = Record.readInt();
1563 Data.NeedOverloadResolutionForMoveConstructor = Record.readInt();
1564 Data.NeedOverloadResolutionForMoveAssignment = Record.readInt();
1565 Data.NeedOverloadResolutionForDestructor = Record.readInt();
1566 Data.DefaultedCopyConstructorIsDeleted = Record.readInt();
1567 Data.DefaultedMoveConstructorIsDeleted = Record.readInt();
1568 Data.DefaultedMoveAssignmentIsDeleted = Record.readInt();
1569 Data.DefaultedDestructorIsDeleted = Record.readInt();
1570 Data.HasTrivialSpecialMembers = Record.readInt();
1571 Data.DeclaredNonTrivialSpecialMembers = Record.readInt();
1572 Data.HasIrrelevantDestructor = Record.readInt();
1573 Data.HasConstexprNonCopyMoveConstructor = Record.readInt();
1574 Data.HasDefaultedDefaultConstructor = Record.readInt();
1575 Data.CanPassInRegisters = Record.readInt();
1576 Data.DefaultedDefaultConstructorIsConstexpr = Record.readInt();
1577 Data.HasConstexprDefaultConstructor = Record.readInt();
1578 Data.HasNonLiteralTypeFieldsOrBases = Record.readInt();
1579 Data.ComputedVisibleConversions = Record.readInt();
1580 Data.UserProvidedDefaultConstructor = Record.readInt();
1581 Data.DeclaredSpecialMembers = Record.readInt();
1582 Data.ImplicitCopyConstructorCanHaveConstParamForVBase = Record.readInt();
1583 Data.ImplicitCopyConstructorCanHaveConstParamForNonVBase = Record.readInt();
1584 Data.ImplicitCopyAssignmentHasConstParam = Record.readInt();
1585 Data.HasDeclaredCopyConstructorWithConstParam = Record.readInt();
1586 Data.HasDeclaredCopyAssignmentWithConstParam = Record.readInt();
1587 Data.ODRHash = Record.readInt();
1588 Data.HasODRHash =
true;
1590 if (Record.readInt()) {
1596 Data.NumBases = Record.readInt();
1598 Data.Bases = ReadGlobalOffset();
1599 Data.NumVBases = Record.readInt();
1601 Data.VBases = ReadGlobalOffset();
1603 Record.readUnresolvedSet(Data.Conversions);
1604 Record.readUnresolvedSet(Data.VisibleConversions);
1605 assert(Data.Definition &&
"Data.Definition should be already set!");
1606 Data.FirstFriend = ReadDeclID();
1608 if (Data.IsLambda) {
1610 CXXRecordDecl::LambdaDefinitionData &Lambda
1611 =
static_cast<CXXRecordDecl::LambdaDefinitionData &
>(Data);
1612 Lambda.Dependent = Record.readInt();
1613 Lambda.IsGenericLambda = Record.readInt();
1614 Lambda.CaptureDefault = Record.readInt();
1615 Lambda.NumCaptures = Record.readInt();
1616 Lambda.NumExplicitCaptures = Record.readInt();
1617 Lambda.ManglingNumber = Record.readInt();
1618 Lambda.ContextDecl = ReadDeclID();
1619 Lambda.Captures = (Capture *)Reader.getContext().Allocate(
1620 sizeof(Capture) * Lambda.NumCaptures);
1621 Capture *ToCapture = Lambda.Captures;
1622 Lambda.MethodTyInfo = GetTypeSourceInfo();
1623 for (
unsigned I = 0, N = Lambda.NumCaptures;
I != N; ++
I) {
1625 bool IsImplicit = Record.readInt();
1631 *ToCapture++ = Capture(Loc, IsImplicit, Kind,
nullptr,
SourceLocation());
1635 VarDecl *Var = ReadDeclAs<VarDecl>();
1637 *ToCapture++ = Capture(Loc, IsImplicit, Kind, Var, EllipsisLoc);
1644 void ASTDeclReader::MergeDefinitionData(
1645 CXXRecordDecl *D,
struct CXXRecordDecl::DefinitionData &&MergeDD) {
1646 assert(D->DefinitionData &&
1647 "merging class definition into non-definition");
1648 auto &DD = *D->DefinitionData;
1650 if (DD.Definition != MergeDD.Definition) {
1652 Reader.MergedDeclContexts.insert(std::make_pair(MergeDD.Definition,
1654 Reader.PendingDefinitions.erase(MergeDD.Definition);
1655 MergeDD.Definition->IsCompleteDefinition =
false;
1656 Reader.mergeDefinitionVisibility(DD.Definition, MergeDD.Definition);
1657 assert(Reader.Lookups.find(MergeDD.Definition) == Reader.Lookups.end() &&
1658 "already loaded pending lookups for merged definition");
1661 auto PFDI = Reader.PendingFakeDefinitionData.find(&DD);
1662 if (PFDI != Reader.PendingFakeDefinitionData.end() &&
1666 assert(!DD.IsLambda && !MergeDD.IsLambda &&
"faked up lambda definition?");
1671 auto *Def = DD.Definition;
1672 DD = std::move(MergeDD);
1673 DD.Definition = Def;
1678 bool DetectedOdrViolation =
false;
1679 #define OR_FIELD(Field) DD.Field |= MergeDD.Field;
1680 #define MATCH_FIELD(Field) \
1681 DetectedOdrViolation |= DD.Field != MergeDD.Field; \
1703 MATCH_FIELD(NeedOverloadResolutionForCopyConstructor)
1704 MATCH_FIELD(NeedOverloadResolutionForMoveConstructor)
1705 MATCH_FIELD(NeedOverloadResolutionForMoveAssignment)
1712 OR_FIELD(DeclaredNonTrivialSpecialMembers)
1714 OR_FIELD(HasConstexprNonCopyMoveConstructor)
1715 OR_FIELD(HasDefaultedDefaultConstructor)
1717 MATCH_FIELD(DefaultedDefaultConstructorIsConstexpr)
1718 OR_FIELD(HasConstexprDefaultConstructor)
1723 MATCH_FIELD(ImplicitCopyConstructorCanHaveConstParamForVBase)
1724 MATCH_FIELD(ImplicitCopyConstructorCanHaveConstParamForNonVBase)
1726 OR_FIELD(HasDeclaredCopyConstructorWithConstParam)
1727 OR_FIELD(HasDeclaredCopyAssignmentWithConstParam)
1732 if (DD.NumBases != MergeDD.NumBases || DD.NumVBases != MergeDD.NumVBases)
1733 DetectedOdrViolation =
true;
1739 if (MergeDD.ComputedVisibleConversions && !DD.ComputedVisibleConversions) {
1740 DD.VisibleConversions = std::move(MergeDD.VisibleConversions);
1741 DD.ComputedVisibleConversions =
true;
1753 DetectedOdrViolation =
true;
1756 if (DetectedOdrViolation)
1757 Reader.PendingOdrMergeFailures[DD.Definition].push_back(MergeDD.Definition);
1760 void ASTDeclReader::ReadCXXRecordDefinition(
CXXRecordDecl *D,
bool Update) {
1761 struct CXXRecordDecl::DefinitionData *DD;
1766 bool IsLambda = Record.readInt();
1768 DD =
new (
C) CXXRecordDecl::LambdaDefinitionData(D,
nullptr,
false,
false,
1771 DD =
new (
C)
struct CXXRecordDecl::DefinitionData(D);
1773 ReadCXXDefinitionData(*DD, D);
1779 if (Canon->DefinitionData) {
1780 MergeDefinitionData(Canon, std::move(*DD));
1781 D->DefinitionData = Canon->DefinitionData;
1786 D->IsCompleteDefinition =
true;
1787 D->DefinitionData = DD;
1792 if (Update || Canon != D) {
1793 Canon->DefinitionData = D->DefinitionData;
1794 Reader.PendingDefinitions.insert(D);
1798 ASTDeclReader::RedeclarableResult
1800 RedeclarableResult Redecl = VisitRecordDeclImpl(D);
1805 CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
1807 switch ((CXXRecKind)Record.readInt()) {
1808 case CXXRecNotTemplate:
1810 if (!isa<ClassTemplateSpecializationDecl>(D))
1811 mergeRedeclarable(D, Redecl);
1813 case CXXRecTemplate: {
1816 D->TemplateOrInstantiation = Template;
1824 TypeIDForTypeDecl = 0;
1828 case CXXRecMemberSpecialization: {
1835 D->TemplateOrInstantiation = MSI;
1836 mergeRedeclarable(D, Redecl);
1841 bool WasDefinition = Record.readInt();
1843 ReadCXXRecordDefinition(D,
false);
1850 if (WasDefinition) {
1851 DeclID KeyFn = ReadDeclID();
1852 if (KeyFn && D->IsCompleteDefinition)
1856 C.KeyFunctions[D] = KeyFn;
1863 VisitFunctionDecl(D);
1867 VisitFunctionDecl(D);
1869 unsigned NumOverridenMethods = Record.readInt();
1871 while (NumOverridenMethods--) {
1880 Record.skipInts(NumOverridenMethods);
1888 auto *Shadow = ReadDeclAs<ConstructorUsingShadowDecl>();
1889 auto *Ctor = ReadDeclAs<CXXConstructorDecl>();
1894 VisitCXXMethodDecl(D);
1898 VisitCXXMethodDecl(D);
1900 if (
auto *OperatorDelete = ReadDeclAs<FunctionDecl>()) {
1903 if (!Canon->OperatorDelete)
1904 Canon->OperatorDelete = OperatorDelete;
1909 VisitCXXMethodDecl(D);
1914 D->ImportedAndComplete.setPointer(readModule());
1915 D->ImportedAndComplete.setInt(Record.readInt());
1917 for (
unsigned I = 0, N = Record.back();
I != N; ++
I)
1918 StoredLocs[
I] = ReadSourceLocation();
1929 if (Record.readInt())
1930 D->Friend = ReadDeclAs<NamedDecl>();
1932 D->Friend = GetTypeSourceInfo();
1933 for (
unsigned i = 0; i != D->NumTPLists; ++i)
1935 Record.readTemplateParameterList();
1936 D->NextFriend = ReadDeclID();
1937 D->UnsupportedFriend = (Record.readInt() != 0);
1938 D->FriendLoc = ReadSourceLocation();
1943 unsigned NumParams = Record.readInt();
1944 D->NumParams = NumParams;
1946 for (
unsigned i = 0; i != NumParams; ++i)
1947 D->Params[i] = Record.readTemplateParameterList();
1948 if (Record.readInt())
1949 D->Friend = ReadDeclAs<NamedDecl>();
1951 D->Friend = GetTypeSourceInfo();
1952 D->FriendLoc = ReadSourceLocation();
1958 DeclID PatternID = ReadDeclID();
1959 NamedDecl *TemplatedDecl = cast_or_null<NamedDecl>(Reader.GetDecl(PatternID));
1962 D->
init(TemplatedDecl, TemplateParams);
1967 ASTDeclReader::RedeclarableResult
1969 RedeclarableResult Redecl = VisitRedeclarable(D);
1976 Reader.PendingDefinitions.insert(CanonD);
1982 if (ThisDeclID == Redecl.getFirstID()) {
1984 = ReadDeclAs<RedeclarableTemplateDecl>()) {
1985 assert(RTD->getKind() == D->
getKind() &&
1986 "InstantiatedFromMemberTemplate kind mismatch");
1988 if (Record.readInt())
1993 DeclID PatternID = VisitTemplateDecl(D);
1996 mergeRedeclarable(D, Redecl, PatternID);
2007 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2009 if (ThisDeclID == Redecl.getFirstID()) {
2013 ReadDeclIDList(SpecIDs);
2021 Reader.getContext().getInjectedClassNameType(
2027 llvm_unreachable(
"BuiltinTemplates are not serialized");
2034 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2036 if (ThisDeclID == Redecl.getFirstID()) {
2040 ReadDeclIDList(SpecIDs);
2045 ASTDeclReader::RedeclarableResult
2048 RedeclarableResult Redecl = VisitCXXRecordDeclImpl(D);
2051 if (
Decl *InstD = ReadDecl()) {
2053 D->SpecializedTemplate = CTD;
2056 Record.readTemplateArgumentList(TemplArgs);
2059 ClassTemplateSpecializationDecl::SpecializedPartialSpecialization *PS
2061 SpecializedPartialSpecialization();
2062 PS->PartialSpecialization
2063 = cast<ClassTemplatePartialSpecializationDecl>(InstD);
2064 PS->TemplateArgs = ArgList;
2065 D->SpecializedTemplate = PS;
2070 Record.readTemplateArgumentList(TemplArgs,
true);
2072 D->PointOfInstantiation = ReadSourceLocation();
2075 bool writtenAsCanonicalDecl = Record.readInt();
2076 if (writtenAsCanonicalDecl) {
2082 dyn_cast<ClassTemplatePartialSpecializationDecl>(D)) {
2084 .GetOrInsertNode(Partial);
2090 if (CanonSpec != D) {
2091 mergeRedeclarable<TagDecl>(D, CanonSpec, Redecl);
2095 if (
auto *DDD = D->DefinitionData) {
2096 if (CanonSpec->DefinitionData)
2097 MergeDefinitionData(CanonSpec, std::move(*DDD));
2099 CanonSpec->DefinitionData = D->DefinitionData;
2101 D->DefinitionData = CanonSpec->DefinitionData;
2108 ClassTemplateSpecializationDecl::ExplicitSpecializationInfo *ExplicitInfo
2109 =
new (
C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
2110 ExplicitInfo->TypeAsWritten = TyInfo;
2111 ExplicitInfo->ExternLoc = ReadSourceLocation();
2112 ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation();
2113 D->ExplicitInfo = ExplicitInfo;
2121 RedeclarableResult Redecl = VisitClassTemplateSpecializationDeclImpl(D);
2123 D->TemplateParams = Record.readTemplateParameterList();
2124 D->ArgsAsWritten = Record.readASTTemplateArgumentListInfo();
2127 if (ThisDeclID == Redecl.getFirstID()) {
2128 D->InstantiatedFromMember.setPointer(
2129 ReadDeclAs<ClassTemplatePartialSpecializationDecl>());
2130 D->InstantiatedFromMember.setInt(Record.readInt());
2137 D->Specialization = ReadDeclAs<CXXMethodDecl>();
2141 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2143 if (ThisDeclID == Redecl.getFirstID()) {
2146 ReadDeclIDList(SpecIDs);
2156 ASTDeclReader::RedeclarableResult
2159 RedeclarableResult Redecl = VisitVarDeclImpl(D);
2162 if (
Decl *InstD = ReadDecl()) {
2164 D->SpecializedTemplate = VTD;
2167 Record.readTemplateArgumentList(TemplArgs);
2170 VarTemplateSpecializationDecl::SpecializedPartialSpecialization *PS =
2172 VarTemplateSpecializationDecl::SpecializedPartialSpecialization();
2173 PS->PartialSpecialization =
2174 cast<VarTemplatePartialSpecializationDecl>(InstD);
2175 PS->TemplateArgs = ArgList;
2176 D->SpecializedTemplate = PS;
2182 VarTemplateSpecializationDecl::ExplicitSpecializationInfo *ExplicitInfo =
2183 new (
C) VarTemplateSpecializationDecl::ExplicitSpecializationInfo;
2184 ExplicitInfo->TypeAsWritten = TyInfo;
2185 ExplicitInfo->ExternLoc = ReadSourceLocation();
2186 ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation();
2187 D->ExplicitInfo = ExplicitInfo;
2191 Record.readTemplateArgumentList(TemplArgs,
true);
2193 D->PointOfInstantiation = ReadSourceLocation();
2196 bool writtenAsCanonicalDecl = Record.readInt();
2197 if (writtenAsCanonicalDecl) {
2202 dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
2204 .GetOrInsertNode(Partial);
2221 RedeclarableResult Redecl = VisitVarTemplateSpecializationDeclImpl(D);
2223 D->TemplateParams = Record.readTemplateParameterList();
2224 D->ArgsAsWritten = Record.readASTTemplateArgumentListInfo();
2227 if (ThisDeclID == Redecl.getFirstID()) {
2228 D->InstantiatedFromMember.setPointer(
2229 ReadDeclAs<VarTemplatePartialSpecializationDecl>());
2230 D->InstantiatedFromMember.setInt(Record.readInt());
2239 if (Record.readInt())
2244 VisitDeclaratorDecl(D);
2249 auto TypesAndInfos =
2250 D->getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
2252 new (&TypesAndInfos[
I].first)
QualType(Record.readType());
2253 TypesAndInfos[
I].second = GetTypeSourceInfo();
2257 D->ParameterPack = Record.readInt();
2258 if (Record.readInt())
2264 VisitTemplateDecl(D);
2273 Data[
I] = Record.readTemplateParameterList();
2276 D->ParameterPack = Record.readInt();
2277 if (Record.readInt())
2279 Record.readTemplateArgumentLoc());
2284 VisitRedeclarableTemplateDecl(D);
2289 D->AssertExprAndFailed.setPointer(Record.readExpr());
2290 D->AssertExprAndFailed.setInt(Record.readInt());
2291 D->Message = cast_or_null<StringLiteral>(Record.readExpr());
2292 D->RParenLoc = ReadSourceLocation();
2299 std::pair<uint64_t, uint64_t>
2301 uint64_t LexicalOffset = ReadLocalOffset();
2302 uint64_t VisibleOffset = ReadLocalOffset();
2303 return std::make_pair(LexicalOffset, VisibleOffset);
2306 template <
typename T>
2307 ASTDeclReader::RedeclarableResult
2309 DeclID FirstDeclID = ReadDeclID();
2310 Decl *MergeWith =
nullptr;
2312 bool IsKeyDecl = ThisDeclID == FirstDeclID;
2313 bool IsFirstLocalDecl =
false;
2315 uint64_t RedeclOffset = 0;
2319 if (FirstDeclID == 0) {
2320 FirstDeclID = ThisDeclID;
2322 IsFirstLocalDecl =
true;
2323 }
else if (
unsigned N = Record.readInt()) {
2327 IsFirstLocalDecl =
true;
2334 for (
unsigned I = 0;
I != N - 1; ++
I)
2335 MergeWith = ReadDecl();
2337 RedeclOffset = ReadLocalOffset();
2344 T *FirstDecl = cast_or_null<T>(Reader.GetDecl(FirstDeclID));
2345 if (FirstDecl != D) {
2351 D->
First = FirstDecl->getCanonicalDecl();
2354 T *DAsT =
static_cast<T*
>(D);
2360 if (IsFirstLocalDecl)
2361 Reader.PendingDeclChains.push_back(std::make_pair(DAsT, RedeclOffset));
2363 return RedeclarableResult(MergeWith, FirstDeclID, IsKeyDecl);
2368 template<
typename T>
2370 RedeclarableResult &Redecl,
2371 DeclID TemplatePatternID) {
2373 if (!Reader.getContext().getLangOpts().Modules)
2380 T *D =
static_cast<T*
>(DBase);
2382 if (
auto *Existing = Redecl.getKnownMergeTarget())
2384 mergeRedeclarable(D, cast<T>(Existing), Redecl, TemplatePatternID);
2385 else if (FindExistingResult ExistingRes = findExisting(D))
2386 if (T *Existing = ExistingRes)
2387 mergeRedeclarable(D, Existing, Redecl, TemplatePatternID);
2395 llvm_unreachable(
"bad assert_cast");
2402 DeclID DsID,
bool IsKeyDecl) {
2405 RedeclarableResult
Result( ExistingPattern,
2406 DPattern->getCanonicalDecl()->getGlobalID(),
2409 if (
auto *DClass = dyn_cast<CXXRecordDecl>(DPattern)) {
2412 auto *ExistingClass =
2414 if (
auto *DDD = DClass->DefinitionData) {
2415 if (ExistingClass->DefinitionData) {
2416 MergeDefinitionData(ExistingClass, std::move(*DDD));
2418 ExistingClass->DefinitionData = DClass->DefinitionData;
2421 Reader.PendingDefinitions.insert(DClass);
2424 DClass->DefinitionData = ExistingClass->DefinitionData;
2426 return mergeRedeclarable(DClass, cast<TagDecl>(ExistingPattern),
2429 if (
auto *DFunction = dyn_cast<FunctionDecl>(DPattern))
2430 return mergeRedeclarable(DFunction, cast<FunctionDecl>(ExistingPattern),
2432 if (
auto *DVar = dyn_cast<VarDecl>(DPattern))
2433 return mergeRedeclarable(DVar, cast<VarDecl>(ExistingPattern),
Result);
2434 if (
auto *DAlias = dyn_cast<TypeAliasDecl>(DPattern))
2435 return mergeRedeclarable(DAlias, cast<TypedefNameDecl>(ExistingPattern),
2437 llvm_unreachable(
"merged an unknown kind of redeclarable template");
2442 template<
typename T>
2444 RedeclarableResult &Redecl,
2445 DeclID TemplatePatternID) {
2446 T *D =
static_cast<T*
>(DBase);
2449 if (ExistingCanon != DCanon) {
2450 assert(DCanon->getGlobalID() == Redecl.getFirstID() &&
2451 "already merged this declaration");
2457 D->First = ExistingCanon;
2458 ExistingCanon->Used |= D->Used;
2464 if (
auto *Namespace = dyn_cast<NamespaceDecl>(D))
2465 Namespace->AnonOrFirstNamespaceAndInline.setPointer(
2466 assert_cast<NamespaceDecl*>(ExistingCanon));
2469 if (
auto *DTemplate = dyn_cast<RedeclarableTemplateDecl>(D))
2470 mergeTemplatePattern(
2471 DTemplate, assert_cast<RedeclarableTemplateDecl*>(ExistingCanon),
2472 TemplatePatternID, Redecl.isKeyDecl());
2475 if (Redecl.isKeyDecl())
2476 Reader.KeyDecls[ExistingCanon].push_back(Redecl.getFirstID());
2484 template<
typename T>
2487 if (!Reader.getContext().getLangOpts().Modules)
2493 if (!Reader.getContext().getLangOpts().CPlusPlus)
2496 if (FindExistingResult ExistingRes = findExisting(static_cast<T*>(D)))
2497 if (T *Existing = ExistingRes)
2498 Reader.getContext().setPrimaryMergedDecl(static_cast<T *>(D),
2499 Existing->getCanonicalDecl());
2506 Vars.reserve(NumVars);
2507 for (
unsigned i = 0; i != NumVars; ++i) {
2508 Vars.push_back(Record.readExpr());
2518 D->PrevDeclInScope = ReadDeclID();
2531 for (
unsigned i = 0, e = Record.
readInt(); i != e; ++i) {
2532 Attr *New =
nullptr;
2537 #include "clang/Serialization/AttrPCHRead.inc"
2539 assert(New &&
"Unable to decode attribute?");
2540 Attrs.push_back(New);
2554 inline void ASTReader::LoadedDecl(
unsigned Index,
Decl *D) {
2555 assert(!DeclsLoaded[Index] &&
"Decl loaded twice?");
2556 DeclsLoaded[Index] = D;
2576 if (isa<FileScopeAsmDecl>(D) ||
2577 isa<ObjCProtocolDecl>(D) ||
2578 isa<ObjCImplDecl>(D) ||
2579 isa<ImportDecl>(D) ||
2580 isa<PragmaCommentDecl>(D) ||
2581 isa<PragmaDetectMismatchDecl>(D))
2583 if (isa<OMPThreadPrivateDecl>(D) || isa<OMPDeclareReductionDecl>(D))
2585 if (
VarDecl *Var = dyn_cast<VarDecl>(D))
2586 return Var->isFileVarDecl() &&
2589 return Func->doesThisDeclarationHaveABody() || HasBody;
2599 ASTReader::RecordLocation
2601 GlobalDeclMapType::iterator
I = GlobalDeclMap.find(ID);
2602 assert(I != GlobalDeclMap.end() &&
"Corrupted global declaration map");
2606 Loc = TranslateSourceLocation(*M, DOffs.
getLocation());
2607 return RecordLocation(M, DOffs.
BitOffset);
2610 ASTReader::RecordLocation ASTReader::getLocalBitOffset(uint64_t GlobalOffset) {
2612 = GlobalBitOffsetsMap.find(GlobalOffset);
2614 assert(I != GlobalBitOffsetsMap.
end() &&
"Corrupted global bit offsets map");
2615 return RecordLocation(I->second, GlobalOffset - I->second->GlobalBitOffset);
2618 uint64_t ASTReader::getGlobalBitOffset(
ModuleFile &M, uint32_t LocalOffset) {
2640 TX->getASTContext().hasSameType(TX->getType(), TY->
getType());
2647 TY->getTemplateParameters());
2654 return NAS->getNamespace();
2662 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
2704 for (
unsigned I = 0, N = X->
size(); I != N; ++
I)
2722 AEnableIfs.push_back(EIA);
2726 BEnableIfs.push_back(EIA);
2730 if (AEnableIfs.empty() && BEnableIfs.empty())
2733 if (AEnableIfs.size() != BEnableIfs.size())
2736 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
2737 for (
unsigned I = 0,
E = AEnableIfs.size(); I !=
E; ++
I) {
2741 AEnableIfs[
I]->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
2742 BEnableIfs[
I]->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
2743 if (Cand1ID != Cand2ID)
2767 TypedefY->getUnderlyingType());
2774 if (isa<ObjCInterfaceDecl>(X) || isa<ObjCProtocolDecl>(
X))
2777 if (isa<ClassTemplateSpecializationDecl>(X)) {
2784 if (
TagDecl *TagX = dyn_cast<TagDecl>(X)) {
2785 TagDecl *TagY = cast<TagDecl>(Y);
2786 return (TagX->getTagKind() == TagY->
getTagKind()) ||
2800 if (CtorX->getInheritedConstructor() &&
2801 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
2813 if (C.
getLangOpts().CPlusPlus1z && XFPT && YFPT &&
2826 if (
VarDecl *VarX = dyn_cast<VarDecl>(X)) {
2827 VarDecl *VarY = cast<VarDecl>(Y);
2840 if (!VarXTy || !VarYTy)
2849 if (
NamespaceDecl *NamespaceX = dyn_cast<NamespaceDecl>(X)) {
2856 if (
TemplateDecl *TemplateX = dyn_cast<TemplateDecl>(X)) {
2865 if (
FieldDecl *FDX = dyn_cast<FieldDecl>(X)) {
2872 if (
auto *IFDX = dyn_cast<IndirectFieldDecl>(X)) {
2873 auto *IFDY = cast<IndirectFieldDecl>(Y);
2874 return IFDX->getAnonField()->getCanonicalDecl() ==
2875 IFDY->getAnonField()->getCanonicalDecl();
2879 if (isa<EnumConstantDecl>(X))
2891 if (
auto *UX = dyn_cast<UsingDecl>(X)) {
2892 auto *UY = cast<UsingDecl>(Y);
2894 UX->hasTypename() == UY->hasTypename() &&
2895 UX->isAccessDeclaration() == UY->isAccessDeclaration();
2897 if (
auto *UX = dyn_cast<UnresolvedUsingValueDecl>(X)) {
2898 auto *UY = cast<UnresolvedUsingValueDecl>(Y);
2900 UX->isAccessDeclaration() == UY->isAccessDeclaration();
2902 if (
auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(X))
2905 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
2908 if (
auto *NAX = dyn_cast<NamespaceAliasDecl>(X)) {
2909 auto *NAY = cast<NamespaceAliasDecl>(Y);
2910 return NAX->getNamespace()->Equals(NAY->getNamespace());
2921 return ND->getOriginalNamespace();
2925 auto *DD = RD->DefinitionData;
2927 DD = RD->getCanonicalDecl()->DefinitionData;
2934 DD =
new (Reader.
getContext())
struct CXXRecordDecl::DefinitionData(RD);
2935 RD->IsCompleteDefinition =
true;
2936 RD->DefinitionData = DD;
2937 RD->getCanonicalDecl()->DefinitionData = DD;
2940 Reader.PendingFakeDefinitionData.insert(
2944 return DD->Definition;
2947 if (
EnumDecl *ED = dyn_cast<EnumDecl>(DC))
2948 return ED->getASTContext().getLangOpts().CPlusPlus? ED->getDefinition()
2953 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2959 ASTDeclReader::FindExistingResult::~FindExistingResult() {
2962 if (TypedefNameForLinkage) {
2964 Reader.ImportedTypedefNamesForLinkage.insert(
2965 std::make_pair(std::make_pair(DC, TypedefNameForLinkage), New));
2969 if (!AddResult || Existing)
2975 setAnonymousDeclForMerging(Reader, New->getLexicalDeclContext(),
2976 AnonymousDeclNumber, New);
2982 }
else if (
DeclContext *MergeDC = getPrimaryContextForMerging(Reader, DC)) {
2985 MergeDC->makeDeclVisibleInContextImpl(New,
true);
2993 bool IsTypedefNameForLinkage) {
2994 if (!IsTypedefNameForLinkage)
3003 if (
auto *TND = dyn_cast<TypedefNameDecl>(Found))
3004 return TND->getAnonDeclWithTypedefName(
true);
3014 if (
auto *Merged = Reader.MergedDeclContexts.lookup(DC))
3018 auto &
Previous = Reader.AnonymousDeclarationsForMerging[DC];
3024 if (!cast<Decl>(DC)->isFromASTFile()) {
3036 void ASTDeclReader::setAnonymousDeclForMerging(
ASTReader &Reader,
3039 if (
auto *Merged = Reader.MergedDeclContexts.lookup(DC))
3042 auto &
Previous = Reader.AnonymousDeclarationsForMerging[DC];
3049 ASTDeclReader::FindExistingResult ASTDeclReader::findExisting(
NamedDecl *D) {
3056 FindExistingResult
Result(Reader, D,
nullptr,
3057 AnonymousDeclNumber, TypedefNameForLinkage);
3063 if (TypedefNameForLinkage) {
3064 auto It = Reader.ImportedTypedefNamesForLinkage.find(
3065 std::make_pair(DC, TypedefNameForLinkage));
3066 if (It != Reader.ImportedTypedefNamesForLinkage.end())
3068 return FindExistingResult(Reader, D, It->second, AnonymousDeclNumber,
3069 TypedefNameForLinkage);
3077 if (
auto *Existing = getAnonymousDeclForMerging(
3080 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3081 TypedefNameForLinkage);
3088 class UpToDateIdentifierRAII {
3094 : II(II), WasOutToDate(
false)
3103 ~UpToDateIdentifierRAII() {
3110 IEnd = IdResolver.
end();
3114 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3115 TypedefNameForLinkage);
3117 }
else if (
DeclContext *MergeDC = getPrimaryContextForMerging(Reader, DC)) {
3122 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3123 TypedefNameForLinkage);
3127 return FindExistingResult(Reader);
3136 if (MergedDCIt != Reader.MergedDeclContexts.end() &&
3138 Reader.PendingOdrMergeChecks.push_back(D);
3140 return FindExistingResult(Reader, D,
nullptr,
3141 AnonymousDeclNumber, TypedefNameForLinkage);
3144 template<
typename DeclT>
3149 llvm_unreachable(
"getMostRecentDecl on non-redeclarable declaration");
3156 #define ABSTRACT_DECL(TYPE)
3157 #define DECL(TYPE, BASE) \
3159 return getMostRecentDeclImpl(cast<TYPE##Decl>(D));
3160 #include "clang/AST/DeclNodes.inc"
3162 llvm_unreachable(
"unknown decl kind");
3165 Decl *ASTReader::getMostRecentExistingDecl(
Decl *D) {
3169 template<
typename DeclT>
3173 D->
RedeclLink.setPrevious(cast<DeclT>(Previous));
3213 if (PrevFD->IsInline != FD->IsInline) {
3229 FD->IsInline =
true;
3236 if (FPT && PrevFPT) {
3238 bool WasUnresolved =
3240 if (IsUnresolved != WasUnresolved)
3241 Reader.PendingExceptionSpecUpdates.insert(
3242 std::make_pair(Canon, IsUnresolved ? PrevFD : FD));
3248 llvm_unreachable(
"attachPreviousDecl on non-redeclarable declaration");
3253 template <
typename ParmDecl>
3256 auto *To = cast<ParmDecl>(ToD);
3257 if (!From->hasDefaultArgument())
3259 To->setInheritedDefaultArgument(Context, From);
3268 assert(FromTP->size() == ToTP->size() &&
"merged mismatched templates?");
3270 for (
unsigned I = 0, N = FromTP->size(); I != N; ++
I) {
3271 NamedDecl *FromParam = FromTP->getParam(N - I - 1);
3274 NamedDecl *ToParam = ToTP->getParam(N - I - 1);
3276 if (
auto *FTTP = dyn_cast<TemplateTypeParmDecl>(FromParam)) {
3279 }
else if (
auto *FNTTP = dyn_cast<NonTypeTemplateParmDecl>(FromParam)) {
3284 Context, cast<TemplateTemplateParmDecl>(FromParam), ToParam))
3292 assert(D && Previous);
3295 #define ABSTRACT_DECL(TYPE)
3296 #define DECL(TYPE, BASE) \
3298 attachPreviousDeclImpl(Reader, cast<TYPE##Decl>(D), Previous, Canon); \
3300 #include "clang/AST/DeclNodes.inc"
3319 template<
typename DeclT>
3321 D->
RedeclLink.setLatest(cast<DeclT>(Latest));
3324 llvm_unreachable(
"attachLatestDecl on non-redeclarable declaration");
3328 assert(D && Latest);
3331 #define ABSTRACT_DECL(TYPE)
3332 #define DECL(TYPE, BASE) \
3334 attachLatestDeclImpl(cast<TYPE##Decl>(D), Latest); \
3336 #include "clang/AST/DeclNodes.inc"
3340 template<
typename DeclT>
3345 llvm_unreachable(
"markIncompleteDeclChain on non-redeclarable declaration");
3348 void ASTReader::markIncompleteDeclChain(
Decl *D) {
3350 #define ABSTRACT_DECL(TYPE)
3351 #define DECL(TYPE, BASE) \
3353 ASTDeclReader::markIncompleteDeclChainImpl(cast<TYPE##Decl>(D)); \
3355 #include "clang/AST/DeclNodes.inc"
3363 RecordLocation Loc = DeclCursorForID(ID, DeclLoc);
3364 llvm::BitstreamCursor &DeclsCursor = Loc.F->DeclsCursor;
3369 ReadingKindTracker ReadingKind(Read_Decl, *
this);
3372 Deserializing ADecl(
this);
3374 DeclsCursor.JumpToBit(Loc.Offset);
3377 unsigned Code = DeclsCursor.ReadCode();
3381 switch ((
DeclCode)Record.readRecord(DeclsCursor, Code)) {
3384 llvm_unreachable(
"Record cannot be de-serialized with ReadDeclRecord");
3583 Error(
"attempt to read a C++ base-specifier record as a declaration");
3586 Error(
"attempt to read a C++ ctor initializer record as a declaration");
3617 assert(D &&
"Unknown declaration reading AST file");
3618 LoadedDecl(Index, D);
3628 std::pair<uint64_t, uint64_t> Offsets = Reader.VisitDeclContext(DC);
3629 if (Offsets.first &&
3630 ReadLexicalDeclContextStorage(*Loc.F, DeclsCursor, Offsets.first, DC))
3632 if (Offsets.second &&
3633 ReadVisibleDeclContextStorage(*Loc.F, DeclsCursor, Offsets.second, ID))
3636 assert(Record.getIdx() == Record.size());
3639 PendingUpdateRecords.push_back(
3640 PendingUpdateRecord(ID, D,
true));
3646 if (
Class->isThisDeclarationADefinition() ||
3647 PendingDefinitions.count(Class))
3648 loadObjCCategories(ID, Class);
3654 PotentiallyInterestingDecls.push_back(
3655 InterestingDecl(D, Reader.hasPendingBody()));
3660 void ASTReader::PassInterestingDeclsToConsumer() {
3663 if (PassingDeclsToConsumer)
3673 for (
auto ID : EagerlyDeserializedDecls)
3675 EagerlyDeserializedDecls.clear();
3677 while (!PotentiallyInterestingDecls.empty()) {
3678 InterestingDecl D = PotentiallyInterestingDecls.front();
3679 PotentiallyInterestingDecls.pop_front();
3681 PassInterestingDeclToConsumer(D.getDecl());
3685 void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord &Record) {
3691 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
3692 DeclUpdateOffsetsMap::iterator UpdI = DeclUpdateOffsets.find(ID);
3696 if (UpdI != DeclUpdateOffsets.end()) {
3697 auto UpdateOffsets = std::move(UpdI->second);
3698 DeclUpdateOffsets.erase(UpdI);
3704 bool WasInteresting =
3706 for (
auto &FileAndOffset : UpdateOffsets) {
3708 uint64_t
Offset = FileAndOffset.second;
3711 Cursor.JumpToBit(Offset);
3712 unsigned Code = Cursor.ReadCode();
3714 unsigned RecCode = Record.readRecord(Cursor, Code);
3716 assert(RecCode ==
DECL_UPDATES &&
"Expected DECL_UPDATES record!");
3718 ASTDeclReader Reader(*
this, Record, RecordLocation(F, Offset), ID,
3720 Reader.UpdateDecl(D, PendingLazySpecializationIDs);
3724 if (!WasInteresting &&
3726 PotentiallyInterestingDecls.push_back(
3727 InterestingDecl(D, Reader.hasPendingBody()));
3728 WasInteresting =
true;
3733 assert((PendingLazySpecializationIDs.empty() || isa<ClassTemplateDecl>(D) ||
3734 isa<FunctionTemplateDecl>(D) || isa<VarTemplateDecl>(D)) &&
3735 "Must not have pending specializations");
3736 if (
auto *CTD = dyn_cast<ClassTemplateDecl>(D))
3738 else if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
3740 else if (
auto *VTD = dyn_cast<VarTemplateDecl>(D))
3742 PendingLazySpecializationIDs.clear();
3745 auto I = PendingVisibleUpdates.
find(ID);
3746 if (I != PendingVisibleUpdates.
end()) {
3747 auto VisibleUpdates = std::move(I->second);
3748 PendingVisibleUpdates.erase(I);
3750 auto *DC = cast<DeclContext>(D)->getPrimaryContext();
3751 for (
const PendingVisibleUpdate &Update : VisibleUpdates)
3752 Lookups[DC].Table.add(
3753 Update.Mod, Update.Data,
3759 void ASTReader::loadPendingDeclChain(
Decl *FirstLocal, uint64_t LocalOffset) {
3762 if (FirstLocal != CanonDecl) {
3765 *
this, FirstLocal, PrevMostRecent ? PrevMostRecent : CanonDecl,
3775 ModuleFile *M = getOwningModuleFile(FirstLocal);
3776 assert(M &&
"imported decl from no module file");
3780 Cursor.JumpToBit(LocalOffset);
3783 unsigned Code = Cursor.ReadCode();
3784 unsigned RecCode = Cursor.readRecord(Code, Record);
3790 Decl *MostRecent = FirstLocal;
3791 for (
unsigned I = 0, N = Record.size(); I != N; ++
I) {
3792 auto *D = GetLocalDecl(*M, Record[N - I - 1]);
3802 class ObjCCategoriesVisitor {
3805 llvm::SmallPtrSetImpl<ObjCCategoryDecl *> &Deserialized;
3807 llvm::DenseMap<DeclarationName, ObjCCategoryDecl *> NameCategoryMap;
3809 unsigned PreviousGeneration;
3813 if (!Deserialized.erase(Cat))
3834 << Interface->getDeclName() << Cat->
getDeclName();
3836 }
else if (!Existing) {
3846 Interface->setCategoryListRaw(Cat);
3851 ObjCCategoriesVisitor(
ASTReader &Reader,
3853 llvm::SmallPtrSetImpl<ObjCCategoryDecl *> &Deserialized,
3855 unsigned PreviousGeneration)
3856 : Reader(Reader), Interface(Interface), Deserialized(Deserialized),
3857 Tail(nullptr), InterfaceID(InterfaceID),
3858 PreviousGeneration(PreviousGeneration)
3899 unsigned Offset = Result->
Offset;
3902 for (
unsigned I = 0; I != N; ++
I)
3903 add(cast_or_null<ObjCCategoryDecl>(
3912 unsigned PreviousGeneration) {
3913 ObjCCategoriesVisitor Visitor(*
this, D, CategoriesDeserialized, ID,
3914 PreviousGeneration);
3915 ModuleMgr.visit(Visitor);
3918 template<
typename DeclT,
typename Fn>
3927 for (
auto *Redecl = MostRecent; Redecl && !Found;
3929 Found = (Redecl == D);
3933 for (
auto *Redecl = MostRecent; Redecl != D;
3941 while (Record.getIdx() < Record.size()) {
3944 auto *RD = cast<CXXRecordDecl>(D);
3947 Decl *MD = Record.readDecl();
3948 assert(MD &&
"couldn't read decl from update record");
3951 RD->addedMember(MD);
3957 PendingLazySpecializationIDs.push_back(ReadDeclID());
3966 if (!Record.isModule()) {
3970 cast<NamespaceDecl>(D)->setAnonymousNamespace(Anon);
3976 VarDecl *VD = cast<VarDecl>(D);
3978 ReadSourceLocation());
3979 uint64_t Val = Record.readInt();
3981 VD->
setInit(Record.readExpr());
3985 Eval->
IsICE = Val == 3;
3992 auto Param = cast<ParmVarDecl>(D);
3997 auto DefaultArg = Record.readExpr();
4001 if (Param->hasUninstantiatedDefaultArg())
4002 Param->setDefaultArg(DefaultArg);
4007 auto FD = cast<FieldDecl>(D);
4008 auto DefaultInit = Record.readExpr();
4012 if (FD->hasInClassInitializer() && !FD->getInClassInitializer()) {
4014 FD->setInClassInitializer(DefaultInit);
4018 FD->removeInClassInitializer();
4025 if (Reader.PendingBodies[FD]) {
4031 if (Record.readInt()) {
4040 ReadFunctionDefinition(FD);
4041 assert(Record.getIdx() == Record.size() &&
"lazy body must be last");
4046 auto *RD = cast<CXXRecordDecl>(D);
4047 auto *OldDD = RD->getCanonicalDecl()->DefinitionData;
4048 bool HadRealDefinition =
4049 OldDD && (OldDD->Definition != RD ||
4050 !Reader.PendingFakeDefinitionData.count(OldDD));
4051 ReadCXXRecordDefinition(RD,
true);
4054 uint64_t LexicalOffset = ReadLocalOffset();
4055 if (!HadRealDefinition && LexicalOffset) {
4056 Record.readLexicalDeclContextStorage(LexicalOffset, RD);
4057 Reader.PendingFakeDefinitionData.erase(OldDD);
4063 RD->getMemberSpecializationInfo()) {
4064 MSInfo->setTemplateSpecializationKind(TSK);
4065 MSInfo->setPointOfInstantiation(POI);
4068 cast<ClassTemplateSpecializationDecl>(RD);
4072 if (Record.readInt()) {
4074 ReadDeclAs<ClassTemplatePartialSpecializationDecl>();
4076 Record.readTemplateArgumentList(TemplArgs);
4089 RD->setLocation(ReadSourceLocation());
4090 RD->setLocStart(ReadSourceLocation());
4091 RD->setBraceRange(ReadSourceRange());
4093 if (Record.readInt()) {
4095 Record.readAttributes(Attrs);
4107 auto *Del = ReadDeclAs<FunctionDecl>();
4110 if (!First->OperatorDelete)
4111 First->OperatorDelete = Del;
4118 Record.readExceptionSpec(ExceptionStorage, ESI);
4121 auto *FD = cast<FunctionDecl>(D);
4127 FPT->getReturnType(), FPT->getParamTypes(),
4128 FPT->getExtProtoInfo().withExceptionSpec(ESI)));
4132 Reader.PendingExceptionSpecUpdates.insert(
4133 std::make_pair(FD->getCanonicalDecl(), FD));
4140 QualType DeducedResultType = Record.readType();
4168 ReadSourceRange()));
4173 auto *Exported = cast<NamedDecl>(D);
4174 if (
auto *TD = dyn_cast<TagDecl>(Exported))
4175 Exported = TD->getDefinition();
4180 Reader.PendingMergedDefinitionsToDeduplicate.insert(
4181 cast<NamedDecl>(Exported));
4185 Reader.HiddenNamesMap[Owner].push_back(Exported);
4188 Exported->setVisibleDespiteOwningModule();
4196 Record.readAttributes(Attrs);
4197 assert(Attrs.size() == 1);
const uint64_t & readInt()
Returns the current value in this record, and advances to the next value.
RedeclarableResult VisitTypedefNameDecl(TypedefNameDecl *TD)
void VisitTypeDecl(TypeDecl *TD)
void setCategoryNameLoc(SourceLocation Loc)
A FriendTemplateDecl record.
Defines the clang::ASTContext interface.
A NonTypeTemplateParmDecl record.
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
Decl * GetLocalDecl(ModuleFile &F, uint32_t LocalID)
Reads a declaration with the given local ID in the given module.
bool hasPendingBody() const
Determine whether this declaration has a pending body.
void VisitClassScopeFunctionSpecializationDecl(ClassScopeFunctionSpecializationDecl *D)
static const Decl * getCanonicalDecl(const Decl *D)
void setImplicit(bool I=true)
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
bool isTemplateParameter() const
isTemplateParameter - Determines whether this declaration is a template parameter.
void VisitVarDecl(VarDecl *VD)
#define MATCH_FIELD(Field)
void setAnonymousStructOrUnion(bool Anon)
A class which contains all the information about a particular captured value.
static ImportDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumLocations)
Create a new, deserialized module import declaration.
void VisitImportDecl(ImportDecl *D)
A (possibly-)qualified type.
void mergeMergeable(Mergeable< T > *D)
Attempts to merge the given declaration (D) with another declaration of the same entity, for the case where the entity is not actually redeclarable.
static ObjCIvarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
FunctionDecl * Function
The function template specialization that this structure describes.
void setDefaultArgument(TypeSourceInfo *DefArg)
Set the default argument for this template parameter.
void VisitUsingDecl(UsingDecl *D)
static UnresolvedUsingValueDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static VarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setLParenLoc(SourceLocation L)
bool tryAddTopLevelDecl(NamedDecl *D, DeclarationName Name)
Try to add the given declaration to the top level scope, if it (or a redeclaration of it) hasn't alre...
void VisitFieldDecl(FieldDecl *FD)
void VisitImplicitParamDecl(ImplicitParamDecl *PD)
This declaration has an owning module, but is only visible to lookups that occur within that module...
An OMPThreadPrivateDecl record.
void VisitObjCIvarDecl(ObjCIvarDecl *D)
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
bool isParameterPack() const
Returns whether this is a parameter pack.
static void setNextObjCCategory(ObjCCategoryDecl *Cat, ObjCCategoryDecl *Next)
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
RedeclarableResult VisitClassTemplateSpecializationDeclImpl(ClassTemplateSpecializationDecl *D)
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
void setEmbeddedInDeclarator(bool isInDeclarator)
No linkage, which means that the entity is unique and can only be referred to from within its scope...
unsigned Generation
The generation of which this module file is a part.
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
void setParam(unsigned i, ImplicitParamDecl *P)
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
An OMPDeclareReductionDecl record.
void VisitEnumConstantDecl(EnumConstantDecl *ECD)
for(unsigned I=0, E=TL.getNumArgs();I!=E;++I)
static void attachLatestDeclImpl(Redeclarable< DeclT > *D, Decl *Latest)
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
Decl - This represents one declaration (or definition), e.g.
static NamedDecl * getDeclForMerging(NamedDecl *Found, bool IsTypedefNameForLinkage)
Find the declaration that should be merged into, given the declaration found by name lookup...
A VarTemplatePartialSpecializationDecl record.
void setDefaultArgument(const ASTContext &C, const TemplateArgumentLoc &DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
Defines the C++ template declaration subclasses.
static Decl * getMostRecentDecl(Decl *D)
unsigned getODRHash() const
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
void VisitCXXDestructorDecl(CXXDestructorDecl *D)
void VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
A record that stores the set of declarations that are lexically stored within a given DeclContext...
void VisitObjCCategoryDecl(ObjCCategoryDecl *D)
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
Represents an empty-declaration.
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
unsigned LocalNumObjCCategoriesInMap
The number of redeclaration info entries in ObjCCategoriesMap.
Class that performs name lookup into a DeclContext stored in an AST file.
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Declaration of a variable template.
const Expr * getInit() const
NamespaceDecl - Represent a C++ namespace.
A ObjCPropertyDecl record.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
void setPropertyImplementation(PropertyControl pc)
static bool hasSameOverloadableAttrs(const FunctionDecl *A, const FunctionDecl *B)
Determine whether the attributes we can overload on are identical for A and B.
NamedDecl * getParam(unsigned Idx)
static FriendDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned FriendTypeNumTPLists)
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
A container of type source information.
uint64_t GlobalBitOffset
The global bit offset (or base) of this module.
void setPropertyAccessor(bool isAccessor)
static void inheritDefaultTemplateArguments(ASTContext &Context, TemplateDecl *From, TemplateDecl *To)
ASTDeclReader(ASTReader &Reader, ASTRecordReader &Record, ASTReader::RecordLocation Loc, DeclID thisDeclID, SourceLocation ThisDeclLoc)
Describes the capture of a variable or of this, or of a C++1y init-capture.
Represents a C++ constructor within a class.
static CapturedDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumParams)
A ClassTemplateDecl record.
void VisitStaticAssertDecl(StaticAssertDecl *D)
A PragmaDetectMismatchDecl record.
An UnresolvedUsingTypenameDecl record.
An identifier, stored as an IdentifierInfo*.
void setNothrow(bool Nothrow=true)
void setRAngleLoc(SourceLocation Loc)
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
void VisitNamedDecl(NamedDecl *ND)
Declaration of a redeclarable template.
An OMPCapturedExprDecl record.
A UsingShadowDecl record.
const unsigned int NUM_PREDEF_DECL_IDS
The number of declaration IDs that are predefined.
The "__interface" keyword.
Represents a variable template specialization, which refers to a variable template with a given set o...
ObjCMethodDecl - Represents an instance or class method declaration.
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack...
A namespace, stored as a NamespaceDecl*.
void VisitClassTemplateDecl(ClassTemplateDecl *D)
void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)
Stores a list of template parameters for a TemplateDecl and its derived classes.
void setSelfDecl(ImplicitParamDecl *SD)
void VisitTypeAliasDecl(TypeAliasDecl *TD)
unsigned IsExplicitSpecified
A TemplateTemplateParmDecl record.
ParmVarDecl - Represents a parameter to a function.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
A ObjCInterfaceDecl record.
void setHasExternalVisibleStorage(bool ES=true)
State whether this DeclContext has external storage for declarations visible in this context...
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
RedeclarableResult VisitTagDecl(TagDecl *TD)
EvaluatedStmt * ensureEvaluatedStmt() const
Convert the initializer for this declaration to the elaborated EvaluatedStmt form, which contains extra information on the evaluated value of the initializer.
iterator begin(DeclarationName Name)
begin - Returns an iterator for decls with the name 'Name'.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
static void attachPreviousDeclImpl(ASTReader &Reader, Redeclarable< DeclT > *D, Decl *Previous, Decl *Canon)
Types, declared with 'struct foo', typedefs, etc.
A CXXConstructorDecl record for an inherited constructor.
RecordDecl - Represents a struct/union/class.
Description of a constructor that was inherited from a base class.
Provides common interface for the Decls that can be redeclared.
ObjCProtocolDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C protocol.
Represents a class template specialization, which refers to a class template with a given set of temp...
One of these records is kept for each identifier that is lexed.
void setIntegerType(QualType T)
Set the underlying integer type.
void VisitBuiltinTemplateDecl(BuiltinTemplateDecl *D)
void mergeRedeclarable(Redeclarable< T > *D, RedeclarableResult &Redecl, DeclID TemplatePatternID=0)
Attempts to merge the given declaration (D) with another declaration of the same entity.
static OMPThreadPrivateDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned N)
void setManglingNumber(const NamedDecl *ND, unsigned Number)
void setCompleteDefinition(bool V)
void setUninstantiatedDefaultArg(Expr *arg)
static IndirectFieldDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
The results of name lookup within a DeclContext.
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
void VisitFriendTemplateDecl(FriendTemplateDecl *D)
void setLanguage(LanguageIDs L)
Set the language specified by this linkage specification.
Common * getCommonPtr() const
LambdaCaptureKind
The different capture forms in a lambda introducer.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
void setBlockMissingReturnType(bool val)
void setLocStart(SourceLocation L)
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
RedeclarableResult VisitVarTemplateSpecializationDeclImpl(VarTemplateSpecializationDecl *D)
TODO: Unify with ClassTemplateSpecializationDecl version? May require unifying ClassTemplate(Partial)...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D)
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Helper class that saves the current stream position and then restores it when destroyed.
bool isTranslationUnit() const
TagKind getTagKind() const
static NamespaceDecl * getNamespace(const NestedNameSpecifier *X)
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
void setOwningModuleID(unsigned ID)
Set the owning module ID.
void setStaticLocalNumber(const VarDecl *VD, unsigned Number)
void VisitFileScopeAsmDecl(FileScopeAsmDecl *AD)
This declaration is definitely a definition.
unsigned FromASTFile
Whether this declaration was loaded from an AST file.
void Profile(llvm::FoldingSetNodeID &ID)
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
void setNumPositiveBits(unsigned Num)
Represents an access specifier followed by colon ':'.
void setReturnType(QualType T)
Declaration of a function specialization at template class scope.
static StaticAssertDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitLabelDecl(LabelDecl *LD)
static NamespaceDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setDeclImplementation(ImplementationControl ic)
Describes a module or submodule.
void setDefaultArgument(Expr *DefArg)
Set the default argument for this template parameter, and whether that default argument was inherited...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
A IndirectFieldDecl record.
static OMPCapturedExprDecl * CreateDeserialized(ASTContext &C, unsigned ID)
iterator end()
end - Returns an iterator that has 'finished'.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Represents a C++ using-declaration.
void setUsingLoc(SourceLocation L)
Set the source location of the 'using' keyword.
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
static llvm::iterator_range< MergedRedeclIterator< DeclT > > merged_redecls(DeclT *D)
ObjCContainerDecl - Represents a container for method declarations.
void setAccessControl(AccessControl ac)
const LangOptions & getLangOpts() const
static void attachLatestDecl(Decl *D, Decl *latest)
< Capturing the *this object by copy
bool isInline() const
Returns true if this is an inline namespace declaration.
RedeclarableResult VisitVarDeclImpl(VarDecl *D)
DeclLink RedeclLink
Points to the next redeclaration in the chain.
An AccessSpecDecl record.
void setAtLoc(SourceLocation L)
A convenient class for passing around template argument information.
void setDepth(unsigned D)
A ConstructorUsingShadowDecl record.
A UsingDirecitveDecl record.
void ReadFunctionDefinition(FunctionDecl *FD)
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
void VisitCXXRecordDecl(CXXRecordDecl *D)
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
static ClassTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setSuperClass(ObjCInterfaceDecl *superCls)
A DecompositionDecl record.
TypeDecl - Represents a declaration of a type.
void setHasObjectMember(bool val)
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl * > typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D)
void VisitMSPropertyDecl(MSPropertyDecl *FD)
static ObjCCategoryImplDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
ASTContext & getContext()
Retrieve the AST context that this AST reader supplements.
DeclID VisitTemplateDecl(TemplateDecl *D)
SourceRange readSourceRange()
Read a source range, advancing Idx.
void setClassInterface(ObjCInterfaceDecl *D)
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this class template specialization is actually an instantiation of the given class template...
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static FileScopeAsmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitCXXMethodDecl(CXXMethodDecl *D)
static TypeAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
A ClassTemplateSpecializationDecl record.
Represents an Objective-C protocol declaration.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
void setNumNegativeBits(unsigned Num)
static bool isSameEntity(NamedDecl *X, NamedDecl *Y)
Determine whether the two declarations refer to the same entity.
static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI)
This represents the body of a CapturedStmt, and serves as its DeclContext.
Represents an ObjC class declaration.
Represents a linkage specification.
static ParmVarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D)
detail::InMemoryDirectory::const_iterator I
A binding in a decomposition declaration.
void setInitVal(const llvm::APSInt &V)
known_categories_range known_categories() const
QualType getCanonicalTypeInternal() const
void setInitExpr(Expr *E)
void setLocStart(SourceLocation L)
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
void setGetterCXXConstructor(Expr *getterCXXConstructor)
CXXConstructorDecl * getConstructor() const
void setInline(bool Inline)
Set whether this is an inline namespace declaration.
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack...
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
llvm::FoldingSetVector< FunctionTemplateSpecializationInfo > Specializations
The function template specializations for this function template, including explicit specializations ...
void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType)
Change the result type of a function type once it is deduced.
void setVariadic(bool isVar)
static TemplateTypeParmDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
Represents a prototype with parameter type info, e.g.
RedeclarableResult VisitRedeclarable(Redeclarable< T > *D)
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
void setHasDestructors(bool val)
void VisitObjCContainerDecl(ObjCContainerDecl *D)
static ObjCCompatibleAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
CXXDestructorDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a ValueDecl that came out of a declarator.
A CXXDeductionGuideDecl record.
void VisitParmVarDecl(ParmVarDecl *PD)
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information.
void setIvarRBraceLoc(SourceLocation Loc)
A StaticAssertDecl record.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations
The class template partial specializations for this class template.
A VarTemplateSpecializationDecl record.
void VisitUsingPackDecl(UsingPackDecl *D)
void VisitUsingShadowDecl(UsingShadowDecl *D)
void VisitVarTemplatePartialSpecializationDecl(VarTemplatePartialSpecializationDecl *D)
TODO: Unify with ClassTemplatePartialSpecializationDecl version? May require unifying ClassTemplate(P...
void setNextIvar(ObjCIvarDecl *ivar)
void setSynthesize(bool synth)
void VisitFriendDecl(FriendDecl *D)
An ObjCTypeParamDecl record.
A record containing CXXBaseSpecifiers.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
void setType(QualType T, TypeSourceInfo *TSI)
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
A ObjCCategoryImplDecl record.
void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *GD)
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations
The variable template partial specializations for this variable template.
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
A ObjCPropertyImplDecl record.
Declaration of a template type parameter.
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
Represents a C++ destructor within a class.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
TranslationUnitDecl * getTranslationUnitDecl() const
A CXXConstructorDecl record.
void VisitTypedefDecl(TypedefDecl *TD)
void setContextParam(unsigned i, ImplicitParamDecl *P)
void setAtEndRange(SourceRange atEnd)
void setRBraceLoc(SourceLocation L)
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
static DeclLink PreviousDeclLink(decl_type *D)
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
DeclContext * getDeclContext()
A record containing CXXCtorInitializers.
A VarTemplateDecl record.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
void setMemberSpecialization()
Note that this member template is a specialization.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
void setDefined(bool isDefined)
void setCompleteDefinitionRequired(bool V=true)
RedeclarableResult VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D)
Information about a module that has been loaded by the ASTReader.
A namespace alias, stored as a NamespaceAliasDecl*.
static void attachPreviousDecl(ASTReader &Reader, Decl *D, Decl *Previous, Decl *Canon)
A CXXDestructorDecl record.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
SmallVector< uint64_t, 1 > ObjCCategories
The Objective-C category lists for categories known to this module.
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack...
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, bool InheritsConstructor)
StorageClass
Storage classes.
static bool isConsumerInterestedIn(ASTContext &Ctx, Decl *D, bool HasBody)
Determine whether the consumer will be interested in seeing this declaration (via HandleTopLevelDecl)...
bool isFunctionOrMethod() const
This declaration has an owning module, and is visible when that module is imported.
A NamespaceAliasDecl record.
void setTypename(bool TN)
Sets whether the using declaration has 'typename'.
Declaration of an alias template.
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
unsigned IsScopedUsingClassTag
IsScopedUsingClassTag - If this tag declaration is a scoped enum, then this is true if the scoped enu...
void setModedTypeSourceInfo(TypeSourceInfo *unmodedTSI, QualType modedTy)
void setLocation(SourceLocation L)
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
An ImplicitParamDecl record.
void setIvarRBraceLoc(SourceLocation Loc)
void VisitDecompositionDecl(DecompositionDecl *DD)
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Represents a C++ deduction guide declaration.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
Represents a C++ conversion function within a class.
static UsingDirectiveDecl * CreateDeserialized(ASTContext &C, unsigned ID)
An EnumConstantDecl record.
static ObjCTypeParamDecl * CreateDeserialized(ASTContext &ctx, unsigned ID)
A type, stored as a Type*.
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
An ImportDecl recording a module import.
A ObjCCategoryDecl record.
void setDeclContext(DeclContext *DC)
setDeclContext - Set both the semantic and lexical DeclContext to DC.
static ObjCMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static void AddLazySpecializations(T *D, SmallVectorImpl< serialization::DeclID > &IDs)
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
void VisitObjCProtocolDecl(ObjCProtocolDecl *D)
A FileScopeAsmDecl record.
A ObjCCompatibleAliasDecl record.
void VisitPragmaCommentDecl(PragmaCommentDecl *D)
void mergeDefinitionVisibility(NamedDecl *Def, NamedDecl *MergedDef)
Note that MergedDef is a redefinition of the canonical definition Def, so Def should be visible whene...
static TypeAliasTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty alias template node.
void setIsVariadic(bool value)
static bool isSameQualifier(const NestedNameSpecifier *X, const NestedNameSpecifier *Y)
void VisitCXXConstructorDecl(CXXConstructorDecl *D)
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
static PragmaDetectMismatchDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NameValueSize)
Represents a C++ Modules TS module export declaration.
QualifierInfo - A struct with extended info about a syntactic name qualifier, to be used for the case...
void setColonLoc(SourceLocation CLoc)
Sets the location of the colon.
An UnresolvedUsingValueDecl record.
Representation::iterator iterator
void VisitDeclaratorDecl(DeclaratorDecl *DD)
static ObjCProtocolDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static EnumConstantDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static UsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
void setIsConversionFromLambda(bool val)
static void markIncompleteDeclChainImpl(Redeclarable< DeclT > *D)
static CXXDestructorDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Encodes a location in the source.
static EmptyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setTopLevelDeclInObjCContainer(bool V=true)
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
static TemplateTemplateParmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setModuleOwnershipKind(ModuleOwnershipKind MOK)
Set whether this declaration is hidden from name lookup.
This represents '#pragma omp declare reduction ...' directive.
A record that stores the set of declarations that are visible from a given DeclContext.
Pseudo declaration for capturing expressions.
void setIvarLBraceLoc(SourceLocation Loc)
void setBraceRange(SourceRange R)
void setAtStartLoc(SourceLocation Loc)
void VisitEmptyDecl(EmptyDecl *D)
void setAnonymousNamespace(NamespaceDecl *D)
NameVisibilityKind NameVisibility
The visibility of names within this particular module.
void setFreeStanding(bool isFreeStanding=true)
void setObjCDeclQualifier(ObjCDeclQualifier QV)
TagDecl - Represents the declaration of a struct/union/class/enum.
ASTContext & getASTContext() const LLVM_READONLY
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
void setReferenced(bool R=true)
LabelDecl - Represents the declaration of a label.
void mergeTemplatePattern(RedeclarableTemplateDecl *D, RedeclarableTemplateDecl *Existing, DeclID DsID, bool IsKeyDecl)
Merge together the pattern declarations from two template declarations.
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
Represents a dependent using declaration which was not marked with typename.
void setPosition(unsigned P)
void VisitObjCImplDecl(ObjCImplDecl *D)
bool isDeclIDFromModule(serialization::GlobalDeclID ID, ModuleFile &M) const
Returns true if global DeclID ID originated from module M.
Represents a static or instance method of a struct/union/class.
void setHasFlexibleArrayMember(bool V)
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void VisitBindingDecl(BindingDecl *BD)
A TemplateTypeParmDecl record.
void demoteThisDefinitionToDeclaration()
This is a definition which should be demoted to a declaration.
Data that is common to all of the declarations of a given function template.
ObjCCategoryDecl - Represents a category declaration.
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
void addDecl(NamedDecl *D)
void setDeclName(DeclarationName N)
Set the name of this declaration.
void setCachedLinkage(Linkage L) const
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Describes the categories of an Objective-C class.
void init(NamedDecl *templatedDecl, TemplateParameterList *templateParams)
Initialize the underlying templated declaration and template parameters.
void setPointOfInstantiation(SourceLocation Loc)
void setTagKind(TagKind TK)
CommonBase * Common
Pointer to the common data shared by all declarations of this template.
static FunctionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents one property declaration in an Objective-C interface.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
A simple visitor class that helps create declaration visitors.
const unsigned int DECL_UPDATES
Record of updates for a declaration that was modified after being deserialized.
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
void VisitRecordDecl(RecordDecl *RD)
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
static T assert_cast(T t)
"Cast" to type T, asserting if we don't have an implicit conversion.
static VarTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty variable template node.
Represents a C++11 static_assert declaration.
uint32_t BitOffset
Offset in the AST file.
void setLAngleLoc(SourceLocation Loc)
void VisitExportDecl(ExportDecl *D)
void addArgument(const TemplateArgumentLoc &Loc)
unsigned varlist_size() const
File is a PCH file treated as the actual main file.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
void VisitValueDecl(ValueDecl *VD)
A ObjCProtocolDecl record.
void setDeclaredWithTypename(bool withTypename)
Set whether this template type parameter was declared with the 'typename' or 'class' keyword...
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
void setSetterCXXAssignment(Expr *setterCXXAssignment)
void VisitEnumDecl(EnumDecl *ED)
static TypedefDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Base class for declarations which introduce a typedef-name.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T-> getSizeExpr()))
void setPropertyDecl(ObjCPropertyDecl *Prop)
A CXXConversionDecl record.
TagTypeKind
The kind of a tag type.
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
ObjCTypeParamList * ReadObjCTypeParamList()
void VisitCXXConversionDecl(CXXConversionDecl *D)
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
void setBody(CompoundStmt *B)
void setImplicitlyInline()
Flag that this function is implicitly inline.
static CXXConversionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
llvm::BitstreamCursor DeclsCursor
DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block.
static ClassScopeFunctionSpecializationDecl * CreateDeserialized(ASTContext &Context, unsigned ID)
static bool isSameTemplateParameterList(const TemplateParameterList *X, const TemplateParameterList *Y)
Determine whether two template parameter lists are similar enough that they may be used in declaratio...
void setHasVolatileMember(bool val)
void setGetterName(Selector Sel, SourceLocation Loc=SourceLocation())
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
static ClassTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty class template node.
The base class of all kinds of template declarations (e.g., class, function, etc.).
void VisitFunctionDecl(FunctionDecl *FD)
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Reads an AST files chain containing the contents of a translation unit.
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
A ClassTemplatePartialSpecializationDecl record.
void setUsingLoc(SourceLocation L)
Set the source location of the 'using' keyword.
DeclCode
Record codes for each kind of declaration.
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
unsigned IsScoped
IsScoped - True if this tag declaration is a scoped enumeration.
A decomposition declaration.
RedeclarableResult VisitCXXRecordDeclImpl(CXXRecordDecl *D)
void setIvarList(ObjCIvarDecl *ivar)
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
static VarTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a dependent using declaration which was marked with typename.
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
DeclarationName - The name of a declaration.
Represents the declaration of an Objective-C type parameter.
void VisitObjCMethodDecl(ObjCMethodDecl *D)
void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
Specifies that this function declaration is actually a dependent function template specialization...
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
A LinkageSpecDecl record.
RedeclarableResult VisitRecordDeclImpl(RecordDecl *RD)
static NonTypeTemplateParmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ParmVarDeclBitfields ParmVarDeclBits
static ObjCCategoryDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
EnumDecl - Represents an enum.
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
detail::InMemoryDirectory::const_iterator E
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
static void forAllLaterRedecls(DeclT *D, Fn F)
void setExternLoc(SourceLocation L)
static bool inheritDefaultTemplateArgument(ASTContext &Context, ParmDecl *From, Decl *ToD)
Inherit the default template argument from From to To.
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
A type that was preceded by the 'template' keyword, stored as a Type*.
static FriendTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static LabelDecl * CreateDeserialized(ASTContext &C, unsigned ID)
All of the names in this module are visible.
void setLocalExternDecl()
Changes the namespace of this declaration to reflect that it's a function-local extern declaration...
Capturing variable-length array type.
A PragmaCommentDecl record.
IdentifierResolver & getIdResolver()
Get the identifier resolver used for name lookup / updates in the translation unit scope...
static ObjCAtDefsFieldDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Common * getCommonPtr() const
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
static ExportDecl * CreateDeserialized(ASTContext &C, unsigned ID)
NonParmVarDeclBitfields NonParmVarDeclBits
void UpdateDecl(Decl *D, llvm::SmallVectorImpl< serialization::DeclID > &)
const T * getAs() const
Member-template getAs<specific type>'.
void setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
void setHasNonZeroConstructors(bool val)
static ClassTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
LanguageIDs
Represents the language in a linkage specification.
static ImplicitParamDecl * CreateDeserialized(ASTContext &C, unsigned ID)
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
static RecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
void setCombiner(Expr *E)
Set combiner expression for the declare reduction construct.
void setInitializer(Expr *E)
Set initializer expression for the declare reduction construct.
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
RedeclarableTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
static EnumDecl * CreateDeserialized(ASTContext &C, unsigned ID)
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
void VisitNamespaceDecl(NamespaceDecl *D)
static FunctionTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty function template node.
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
void setSetterName(Selector Sel, SourceLocation Loc=SourceLocation())
Capturing the *this object by reference.
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
void markUsed(ASTContext &C)
Mark the declaration used, in the sense of odr-use.
void setInnerLocStart(SourceLocation L)
void setObjCMethodScopeInfo(unsigned parameterIndex)
void setSignatureAsWritten(TypeSourceInfo *Sig)
void setPromotionType(QualType T)
Set the promotion type.
static bool isSameTemplateParameter(const NamedDecl *X, const NamedDecl *Y)
Determine whether two template parameters are similar enough that they may be used in declarations of...
unsigned IsFixed
IsFixed - True if this is an enumeration with fixed underlying type.
void setAsmString(StringLiteral *Asm)
static VarTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setRParenLoc(SourceLocation L)
A template argument list.
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...
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
static FieldDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
void VisitCapturedDecl(CapturedDecl *CD)
Represents a field declaration created by an @defs(...).
static Decl * getMostRecentDeclImpl(Redeclarable< DeclT > *D)
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Represents a C++ struct/union/class.
static OMPDeclareReductionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create deserialized declare reduction node.
static ObjCImplementationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
void setDescribedVarTemplate(VarTemplateDecl *Template)
void setInstanceMethod(bool isInst)
void SetRelatedResultType(bool RRT=true)
Note whether this method has a related result type.
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
void setClassInterface(ObjCInterfaceDecl *IFace)
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
ObjCIvarDecl - Represents an ObjC instance variable.
bool operator!=(CanQual< T > x, CanQual< U > y)
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
Provides information a specialization of a member of a class template, which may be a member function...
A ObjCImplementationDecl record.
void setOutOfDate(bool OOD)
Set whether the information for this identifier is out of date with respect to the external source...
void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
void setReturnTypeSourceInfo(TypeSourceInfo *TInfo)
A ObjCAtDefsFieldDecl record.
Declaration of a class template.
void setIvarLBraceLoc(SourceLocation Loc)
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
void VisitAccessSpecDecl(AccessSpecDecl *D)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
void setPropertyAttributes(PropertyAttributeKind PRVal)
static BlockDecl * CreateDeserialized(ASTContext &C, unsigned ID)
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
void VisitClassTemplatePartialSpecializationDecl(ClassTemplatePartialSpecializationDecl *D)
bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U)
Determine whether two function types are the same, ignoring exception specifications in cases where t...
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
An object for streaming information from a record.
void VisitBlockDecl(BlockDecl *BD)
llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations
The variable template specializations for this variable template, including explicit specializations ...
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
void VisitIndirectFieldDecl(IndirectFieldDecl *FD)
bool isIncompleteArrayType() const
Common * getCommonPtr() const
VarDeclBitfields VarDeclBits
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations
The class template specializations for this class template, including explicit specializations and in...
virtual CommonBase * newCommon(ASTContext &C) const =0
TranslationUnitDecl - The top declaration context.
static ObjCInterfaceDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
void ReadAttributes(ASTRecordReader &Record, AttrVec &Attrs)
Reads attributes from the current stream position.
void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D)
QualType getElementType() const
SourceLocation getLocation() const
A FunctionTemplateDecl record.
std::pair< uint64_t, uint64_t > VisitDeclContext(DeclContext *DC)
static ObjCPropertyImplDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ModuleFile * getOwningModuleFile(const Decl *D)
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
A TypeAliasTemplateDecl record.
An instance of this class represents the declaration of a property member.
void setAtLoc(SourceLocation Loc)
void VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
uint32_t TypeID
An ID number that refers to a type in an AST file.
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
void setCaptures(ASTContext &Context, ArrayRef< Capture > Captures, bool CapturesCXXThis)
bool isParameterPack() const
Whether this declaration is a parameter pack.
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
void setIntegerTypeSourceInfo(TypeSourceInfo *TInfo)
Set the underlying integer type source info.
NamedDecl - This represents a decl with a name.
void VisitVarTemplateDecl(VarTemplateDecl *D)
TODO: Unify with ClassTemplateDecl version? May require unifying ClassTemplateDecl and VarTemplateDec...
void setTypeSourceInfo(TypeSourceInfo *newType)
void setAccess(AccessSpecifier AS)
void numberAnonymousDeclsWithin(const DeclContext *DC, Fn Visit)
Visit each declaration within DC that needs an anonymous declaration number and call Visit with the d...
Represents a C++ namespace alias.
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
static UsingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
serialization::DeclID mapGlobalIDToModuleFileGlobalID(ModuleFile &M, serialization::DeclID GlobalID)
Map a global declaration ID into the declaration ID used to refer to this declaration within the give...
Declaration of a friend template.
Represents C++ using-directive.
Represents a #pragma detect_mismatch line.
static ObjCPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
The global specifier '::'. There is no stored value.
DiagnosticBuilder Diag(unsigned DiagID) const
Report a diagnostic.
void VisitTranslationUnitDecl(TranslationUnitDecl *TU)
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setType(QualType newType)
void setCmdDecl(ImplicitParamDecl *CD)
This represents '#pragma omp threadprivate ...' directive.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Declaration of a template function.
iterator - Iterate over the decls of a specified declaration name.
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
Source range/offset of a preprocessed entity.
Attr - This represents one attribute.
const serialization::ObjCCategoriesInfo * ObjCCategoriesMap
Array of category list location information within this module file, sorted by the definition ID...
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into...
ObjCCompatibleAliasDecl - Represents alias of a class.
Structure used to store a statement, the constant value to which it was evaluated (if any)...
void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D)
TemplatedKind
The kind of templated function a FunctionDecl can be.