55 #include "llvm/ADT/DenseMap.h" 56 #include "llvm/ADT/FoldingSet.h" 57 #include "llvm/ADT/STLExtras.h" 58 #include "llvm/ADT/SmallPtrSet.h" 59 #include "llvm/ADT/SmallVector.h" 60 #include "llvm/ADT/iterator_range.h" 61 #include "llvm/Bitcode/BitstreamReader.h" 62 #include "llvm/Support/Casting.h" 63 #include "llvm/Support/ErrorHandling.h" 64 #include "llvm/Support/SaveAndRestore.h" 72 using namespace clang;
73 using namespace serialization;
84 ASTReader::RecordLocation Loc;
91 unsigned AnonymousDeclNumber;
95 bool HasPendingBody =
false;
100 bool IsDeclMarkedUsed =
false;
102 uint64_t GetCurrentCursorOffset();
104 uint64_t ReadLocalOffset() {
105 uint64_t LocalOffset = Record.
readInt();
106 assert(LocalOffset < Loc.Offset &&
"offset point after current record");
107 return LocalOffset ? Loc.Offset - LocalOffset : 0;
110 uint64_t ReadGlobalOffset() {
111 uint64_t Local = ReadLocalOffset();
131 std::string ReadString() {
136 for (
unsigned I = 0, Size = Record.
readInt(); I != Size; ++I)
137 IDs.push_back(ReadDeclID());
169 void ReadCXXDefinitionData(
struct CXXRecordDecl::DefinitionData &Data,
172 struct CXXRecordDecl::DefinitionData &&NewDD);
173 void ReadObjCDefinitionData(
struct ObjCInterfaceDecl::DefinitionData &Data);
175 struct ObjCInterfaceDecl::DefinitionData &&NewDD);
176 void ReadObjCDefinitionData(
struct ObjCProtocolDecl::DefinitionData &Data);
178 struct ObjCProtocolDecl::DefinitionData &&NewDD);
189 class RedeclarableResult {
196 : MergeWith(MergeWith), FirstID(FirstID), IsKeyDecl(IsKeyDecl) {}
202 bool isKeyDecl()
const {
return IsKeyDecl; }
206 Decl *getKnownMergeTarget()
const {
return MergeWith; }
214 class FindExistingResult {
218 bool AddResult =
false;
219 unsigned AnonymousDeclNumber = 0;
223 FindExistingResult(
ASTReader &Reader) : Reader(Reader) {}
226 unsigned AnonymousDeclNumber,
228 : Reader(Reader), New(New), Existing(Existing), AddResult(
true),
229 AnonymousDeclNumber(AnonymousDeclNumber),
230 TypedefNameForLinkage(TypedefNameForLinkage) {}
232 FindExistingResult(FindExistingResult &&Other)
233 : Reader(Other.Reader), New(Other.New), Existing(Other.Existing),
234 AddResult(Other.AddResult),
235 AnonymousDeclNumber(Other.AnonymousDeclNumber),
236 TypedefNameForLinkage(Other.TypedefNameForLinkage) {
237 Other.AddResult =
false;
240 FindExistingResult &operator=(FindExistingResult &&) =
delete;
241 ~FindExistingResult();
245 void suppress() { AddResult =
false; }
247 operator NamedDecl*()
const {
return Existing; }
250 operator T*()
const {
return dyn_cast_or_null<T>(Existing); }
255 FindExistingResult findExisting(
NamedDecl *D);
259 ASTReader::RecordLocation Loc,
261 : Reader(Reader), Record(Record), Loc(Loc), ThisDeclID(thisDeclID),
262 ThisDeclLoc(ThisDeclLoc) {}
264 template <
typename T>
static 273 auto *&LazySpecializations = D->getCommonPtr()->LazySpecializations;
275 if (
auto &Old = LazySpecializations) {
276 IDs.insert(IDs.end(), Old + 1, Old + 1 + Old[0]);
277 llvm::sort(IDs.begin(), IDs.end());
278 IDs.erase(std::unique(IDs.begin(), IDs.end()), IDs.end());
282 *Result = IDs.size();
283 std::copy(IDs.begin(), IDs.end(), Result + 1);
285 LazySpecializations = Result;
288 template <
typename DeclT>
290 static Decl *getMostRecentDeclImpl(...);
291 static Decl *getMostRecentDecl(
Decl *D);
293 template <
typename DeclT>
294 static void attachPreviousDeclImpl(
ASTReader &Reader,
297 static void attachPreviousDeclImpl(
ASTReader &Reader, ...);
301 template <
typename DeclT>
303 static void attachLatestDeclImpl(...);
304 static void attachLatestDecl(
Decl *D,
Decl *latest);
306 template <
typename DeclT>
308 static void markIncompleteDeclChainImpl(...);
320 Cat->NextClassCategory = Next;
323 void VisitDecl(
Decl *D);
337 RedeclarableResult VisitTagDecl(
TagDecl *TD);
339 RedeclarableResult VisitRecordDeclImpl(
RecordDecl *RD);
343 RedeclarableResult VisitClassTemplateSpecializationDeclImpl(
348 VisitClassTemplateSpecializationDeclImpl(D);
351 void VisitClassTemplatePartialSpecializationDecl(
353 void VisitClassScopeFunctionSpecializationDecl(
359 VisitVarTemplateSpecializationDeclImpl(D);
362 void VisitVarTemplatePartialSpecializationDecl(
378 RedeclarableResult VisitVarDeclImpl(
VarDecl *D);
409 std::pair<uint64_t, uint64_t> VisitDeclContext(
DeclContext *DC);
416 DeclID TemplatePatternID = 0);
420 RedeclarableResult &Redecl,
421 DeclID TemplatePatternID = 0);
428 DeclID DsID,
bool IsKeyDecl);
458 template<
typename DeclT>
459 class MergedRedeclIterator {
461 DeclT *Canonical =
nullptr;
462 DeclT *Current =
nullptr;
465 MergedRedeclIterator() =
default;
466 MergedRedeclIterator(DeclT *Start) : Start(Start), Current(Start) {}
470 MergedRedeclIterator &operator++() {
471 if (Current->isFirstDecl()) {
473 Current = Current->getMostRecentDecl();
475 Current = Current->getPreviousDecl();
481 if (Current == Start || Current == Canonical)
486 friend bool operator!=(
const MergedRedeclIterator &A,
487 const MergedRedeclIterator &B) {
488 return A.Current != B.Current;
494 template <
typename DeclT>
495 static llvm::iterator_range<MergedRedeclIterator<DeclT>>
497 return llvm::make_range(MergedRedeclIterator<DeclT>(D),
498 MergedRedeclIterator<DeclT>());
501 uint64_t ASTDeclReader::GetCurrentCursorOffset() {
502 return Loc.F->DeclsCursor.GetCurrentBitNo() + Loc.F->GlobalBitOffset;
506 if (Record.readInt())
508 if (
auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
509 CD->NumCtorInitializers = Record.readInt();
510 if (CD->NumCtorInitializers)
511 CD->CtorInitializers = ReadGlobalOffset();
514 Reader.PendingBodies[FD] = GetCurrentCursorOffset();
515 HasPendingBody =
true;
524 IsDeclMarkedUsed =
false;
526 if (
auto *DD = dyn_cast<DeclaratorDecl>(D)) {
527 if (
auto *TInfo = DD->getTypeSourceInfo())
528 Record.readTypeLoc(TInfo->getTypeLoc());
531 if (
auto *TD = dyn_cast<TypeDecl>(D)) {
533 TD->setTypeForDecl(Reader.GetType(DeferredTypeID).getTypePtrOrNull());
537 if (NamedDeclForTagDecl)
538 cast<TagDecl>(D)->TypedefNameDeclOrQualifier =
539 cast<TypedefNameDecl>(Reader.GetDecl(NamedDeclForTagDecl));
540 }
else if (
auto *
ID = dyn_cast<ObjCInterfaceDecl>(D)) {
542 ID->TypeForDecl = Reader.GetType(DeferredTypeID).getTypePtrOrNull();
543 }
else if (
auto *FD = dyn_cast<FunctionDecl>(D)) {
545 FD->setType(Reader.GetType(DeferredTypeID));
551 if (Record.readInt())
552 ReadFunctionDefinition(FD);
558 isa<ParmVarDecl>(D)) {
565 GlobalDeclID SemaDCIDForTemplateParmDecl = ReadDeclID();
566 GlobalDeclID LexicalDCIDForTemplateParmDecl = ReadDeclID();
567 if (!LexicalDCIDForTemplateParmDecl)
568 LexicalDCIDForTemplateParmDecl = SemaDCIDForTemplateParmDecl;
569 Reader.addPendingDeclContextInfo(D,
570 SemaDCIDForTemplateParmDecl,
571 LexicalDCIDForTemplateParmDecl);
574 auto *SemaDC = ReadDeclAs<DeclContext>();
575 auto *LexicalDC = ReadDeclAs<DeclContext>();
581 D->setDeclContextsImpl(MergedSemaDC ? MergedSemaDC : SemaDC, LexicalDC,
582 Reader.getContext());
586 if (Record.readInt()) {
588 Record.readAttributes(Attrs);
591 D->setAttrsImpl(Attrs, Reader.getContext());
594 D->Used = Record.readInt();
595 IsDeclMarkedUsed |= D->Used;
600 bool ModulePrivate = Record.readInt();
614 }
else if (Reader.getContext().getLangOpts().ModulesLocalVisibility) {
622 Reader.HiddenNamesMap[Owner].push_back(D);
624 }
else if (ModulePrivate) {
633 std::string Arg = ReadString();
634 memcpy(D->getTrailingObjects<
char>(), Arg.data(), Arg.size());
635 D->getTrailingObjects<
char>()[Arg.size()] =
'\0';
641 std::string Name = ReadString();
642 memcpy(D->getTrailingObjects<
char>(), Name.data(), Name.size());
643 D->getTrailingObjects<
char>()[Name.size()] =
'\0';
645 D->ValueStart = Name.size() + 1;
646 std::string
Value = ReadString();
647 memcpy(D->getTrailingObjects<
char>() + D->ValueStart, Value.data(),
649 D->getTrailingObjects<
char>()[D->ValueStart + Value.size()] =
'\0';
653 llvm_unreachable(
"Translation units are not serialized");
659 AnonymousDeclNumber = Record.readInt();
666 DeferredTypeID = Record.getGlobalTypeID(Record.readInt());
669 ASTDeclReader::RedeclarableResult
671 RedeclarableResult Redecl = VisitRedeclarable(TD);
674 if (Record.readInt()) {
675 QualType modedT = Record.readType();
688 RedeclarableResult Redecl = VisitTypedefNameDecl(TD);
689 mergeRedeclarable(TD, Redecl);
693 RedeclarableResult Redecl = VisitTypedefNameDecl(TD);
694 if (
auto *Template = ReadDeclAs<TypeAliasTemplateDecl>())
698 mergeRedeclarable(TD, Redecl);
702 RedeclarableResult Redecl = VisitRedeclarable(TD);
707 if (!isa<CXXRecordDecl>(TD))
714 switch (Record.readInt()) {
719 ReadQualifierInfo(*Info);
720 TD->TypedefNameDeclOrQualifier = Info;
724 NamedDeclForTagDecl = ReadDeclID();
725 TypedefNameForLinkage = Record.getIdentifierInfo();
728 llvm_unreachable(
"unexpected tag info kind");
731 if (!isa<CXXRecordDecl>(TD))
732 mergeRedeclarable(TD, Redecl);
747 ED->
IsFixed = Record.readInt();
749 ED->HasODRHash =
true;
750 ED->ODRHash = Record.readInt();
754 if (ED->IsCompleteDefinition &&
755 Reader.getContext().getLangOpts().Modules &&
756 Reader.getContext().getLangOpts().CPlusPlus) {
762 if (!D->isFromASTFile() && D->isCompleteDefinition()) {
769 Reader.MergedDeclContexts.insert(std::make_pair(ED, OldDef));
770 ED->IsCompleteDefinition =
false;
771 Reader.mergeDefinitionVisibility(OldDef, ED);
773 Reader.PendingEnumOdrMergeFailures[OldDef].push_back(ED);
779 if (
auto *InstED = ReadDeclAs<EnumDecl>()) {
782 ED->setInstantiationOfMemberEnum(Reader.getContext(), InstED, TSK);
787 ASTDeclReader::RedeclarableResult
789 RedeclarableResult Redecl = VisitTagDecl(RD);
807 if (isa<FunctionDecl>(VD))
808 DeferredTypeID = Record.getGlobalTypeID(Record.readInt());
810 VD->
setType(Record.readType());
815 if (Record.readInt())
824 if (Record.readInt()) {
825 auto *Info =
new (Reader.getContext()) DeclaratorDecl::ExtInfo();
826 ReadQualifierInfo(*Info);
829 QualType TSIType = Record.readType();
831 TSIType.
isNull() ? nullptr
832 : Reader.getContext().CreateTypeSourceInfo(TSIType));
836 RedeclarableResult Redecl = VisitRedeclarable(FD);
837 VisitDeclaratorDecl(FD);
848 FD->
setType(Reader.GetType(DeferredTypeID));
852 ReadDeclarationNameLoc(FD->DNLoc, FD->
getDeclName());
859 FD->IsInline = Record.readInt();
860 FD->IsInlineSpecified = Record.readInt();
862 FD->IsVirtualAsWritten = Record.readInt();
863 FD->IsPure = Record.readInt();
864 FD->HasInheritedPrototype = Record.readInt();
865 FD->HasWrittenPrototype = Record.readInt();
866 FD->IsDeleted = Record.readInt();
867 FD->IsTrivial = Record.readInt();
868 FD->IsTrivialForCall = Record.readInt();
869 FD->IsDefaulted = Record.readInt();
870 FD->IsExplicitlyDefaulted = Record.readInt();
871 FD->HasImplicitReturnZero = Record.readInt();
872 FD->IsConstexpr = Record.readInt();
873 FD->UsesSEHTry = Record.readInt();
874 FD->HasSkippedBody = Record.readInt();
875 FD->IsMultiVersion = Record.readInt();
876 FD->IsLateTemplateParsed = Record.readInt();
878 FD->EndRangeLoc = ReadSourceLocation();
880 FD->ODRHash = Record.readInt();
881 FD->HasODRHash =
true;
885 mergeRedeclarable(FD, Redecl);
892 auto *InstFD = ReadDeclAs<FunctionDecl>();
895 FD->setInstantiationOfMemberFunction(Reader.getContext(), InstFD, TSK);
897 mergeRedeclarable(FD, Redecl);
901 auto *Template = ReadDeclAs<FunctionTemplateDecl>();
906 Record.readTemplateArgumentList(TemplArgs,
true);
911 bool HasTemplateArgumentsAsWritten = Record.readInt();
912 if (HasTemplateArgumentsAsWritten) {
913 unsigned NumTemplateArgLocs = Record.readInt();
914 TemplArgLocs.reserve(NumTemplateArgLocs);
915 for (
unsigned i = 0; i != NumTemplateArgLocs; ++i)
916 TemplArgLocs.push_back(Record.readTemplateArgumentLoc());
918 LAngleLoc = ReadSourceLocation();
919 RAngleLoc = ReadSourceLocation();
928 for (
unsigned i = 0, e = TemplArgLocs.size(); i != e; ++i)
933 HasTemplateArgumentsAsWritten ? &TemplArgsInfo
936 FD->TemplateOrSpecialization = FTInfo;
941 auto *CanonTemplate = ReadDeclAs<FunctionTemplateDecl>();
947 llvm::FoldingSetNodeID
ID;
949 void *InsertPos =
nullptr;
956 assert(Reader.getContext().getLangOpts().Modules &&
957 "already deserialized this template specialization");
958 mergeRedeclarable(FD, ExistingInfo->
Function, Redecl);
966 unsigned NumTemplates = Record.readInt();
967 while (NumTemplates--)
968 TemplDecls.
addDecl(ReadDeclAs<NamedDecl>());
972 unsigned NumArgs = Record.readInt();
974 TemplArgs.
addArgument(Record.readTemplateArgumentLoc());
979 TemplDecls, TemplArgs);
987 unsigned NumParams = Record.readInt();
989 Params.reserve(NumParams);
990 for (
unsigned I = 0; I != NumParams; ++I)
991 Params.push_back(ReadDeclAs<ParmVarDecl>());
992 FD->setParams(Reader.getContext(), Params);
997 if (Record.readInt()) {
1000 Reader.PendingBodies[MD] = GetCurrentCursorOffset();
1001 HasPendingBody =
true;
1003 MD->
setCmdDecl(ReadDeclAs<ImplicitParamDecl>());
1009 MD->IsOverriding = Record.readInt();
1010 MD->HasSkippedBody = Record.readInt();
1012 MD->IsRedeclaration = Record.readInt();
1013 MD->HasRedeclaration = Record.readInt();
1014 if (MD->HasRedeclaration)
1015 Reader.getContext().setObjCMethodRedeclaration(MD,
1016 ReadDeclAs<ObjCMethodDecl>());
1023 MD->DeclEndLoc = ReadSourceLocation();
1024 unsigned NumParams = Record.readInt();
1026 Params.reserve(NumParams);
1027 for (
unsigned I = 0; I != NumParams; ++I)
1028 Params.push_back(ReadDeclAs<ParmVarDecl>());
1030 MD->SelLocsKind = Record.readInt();
1031 unsigned NumStoredSelLocs = Record.readInt();
1033 SelLocs.reserve(NumStoredSelLocs);
1034 for (
unsigned i = 0; i != NumStoredSelLocs; ++i)
1035 SelLocs.push_back(ReadSourceLocation());
1037 MD->setParamsAndSelLocs(Reader.getContext(), Params, SelLocs);
1041 VisitTypedefNameDecl(D);
1043 D->Variance = Record.readInt();
1044 D->Index = Record.readInt();
1045 D->VarianceLoc = ReadSourceLocation();
1046 D->ColonLoc = ReadSourceLocation();
1056 unsigned numParams = Record.readInt();
1061 typeParams.reserve(numParams);
1062 for (
unsigned i = 0; i != numParams; ++i) {
1063 auto *typeParam = ReadDeclAs<ObjCTypeParamDecl>();
1067 typeParams.push_back(typeParam);
1074 typeParams, rAngleLoc);
1077 void ASTDeclReader::ReadObjCDefinitionData(
1078 struct ObjCInterfaceDecl::DefinitionData &Data) {
1080 Data.SuperClassTInfo = GetTypeSourceInfo();
1082 Data.EndLoc = ReadSourceLocation();
1083 Data.HasDesignatedInitializers = Record.readInt();
1086 unsigned NumProtocols = Record.readInt();
1088 Protocols.reserve(NumProtocols);
1089 for (
unsigned I = 0; I != NumProtocols; ++I)
1090 Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>());
1092 ProtoLocs.reserve(NumProtocols);
1093 for (
unsigned I = 0; I != NumProtocols; ++I)
1094 ProtoLocs.push_back(ReadSourceLocation());
1095 Data.ReferencedProtocols.set(Protocols.data(), NumProtocols, ProtoLocs.data(),
1096 Reader.getContext());
1099 NumProtocols = Record.readInt();
1101 Protocols.reserve(NumProtocols);
1102 for (
unsigned I = 0; I != NumProtocols; ++I)
1103 Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>());
1104 Data.AllReferencedProtocols.set(Protocols.data(), NumProtocols,
1105 Reader.getContext());
1109 struct ObjCInterfaceDecl::DefinitionData &&NewDD) {
1114 RedeclarableResult Redecl = VisitRedeclarable(ID);
1115 VisitObjCContainerDecl(ID);
1116 DeferredTypeID = Record.getGlobalTypeID(Record.readInt());
1117 mergeRedeclarable(ID, Redecl);
1119 ID->TypeParamList = ReadObjCTypeParamList();
1120 if (Record.readInt()) {
1122 ID->allocateDefinitionData();
1124 ReadObjCDefinitionData(ID->data());
1126 if (Canon->Data.getPointer()) {
1129 MergeDefinitionData(Canon, std::move(ID->data()));
1130 ID->Data = Canon->Data;
1141 Reader.PendingDefinitions.insert(ID);
1144 Reader.ObjCClassesLoaded.push_back(ID);
1151 VisitFieldDecl(IVD);
1155 bool synth = Record.readInt();
1159 void ASTDeclReader::ReadObjCDefinitionData(
1160 struct ObjCProtocolDecl::DefinitionData &Data) {
1161 unsigned NumProtoRefs = Record.readInt();
1163 ProtoRefs.reserve(NumProtoRefs);
1164 for (
unsigned I = 0; I != NumProtoRefs; ++I)
1165 ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>());
1167 ProtoLocs.reserve(NumProtoRefs);
1168 for (
unsigned I = 0; I != NumProtoRefs; ++I)
1169 ProtoLocs.push_back(ReadSourceLocation());
1170 Data.ReferencedProtocols.set(ProtoRefs.data(), NumProtoRefs,
1171 ProtoLocs.data(), Reader.getContext());
1175 struct ObjCProtocolDecl::DefinitionData &&NewDD) {
1180 RedeclarableResult Redecl = VisitRedeclarable(PD);
1181 VisitObjCContainerDecl(PD);
1182 mergeRedeclarable(PD, Redecl);
1184 if (Record.readInt()) {
1186 PD->allocateDefinitionData();
1188 ReadObjCDefinitionData(PD->data());
1191 if (Canon->Data.getPointer()) {
1194 MergeDefinitionData(Canon, std::move(PD->data()));
1195 PD->Data = Canon->Data;
1202 Reader.PendingDefinitions.insert(PD);
1213 VisitObjCContainerDecl(CD);
1221 Reader.CategoriesDeserialized.insert(CD);
1223 CD->ClassInterface = ReadDeclAs<ObjCInterfaceDecl>();
1224 CD->TypeParamList = ReadObjCTypeParamList();
1225 unsigned NumProtoRefs = Record.readInt();
1227 ProtoRefs.reserve(NumProtoRefs);
1228 for (
unsigned I = 0; I != NumProtoRefs; ++I)
1229 ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>());
1231 ProtoLocs.reserve(NumProtoRefs);
1232 for (
unsigned I = 0; I != NumProtoRefs; ++I)
1233 ProtoLocs.push_back(ReadSourceLocation());
1235 Reader.getContext());
1241 Reader.getContext());
1245 VisitNamedDecl(CAD);
1274 VisitObjCContainerDecl(D);
1279 VisitObjCImplDecl(D);
1280 D->CategoryNameLoc = ReadSourceLocation();
1284 VisitObjCImplDecl(D);
1286 D->SuperLoc = ReadSourceLocation();
1291 D->NumIvarInitializers = Record.readInt();
1292 if (D->NumIvarInitializers)
1293 D->IvarInitializers = ReadGlobalOffset();
1300 D->PropertyIvarDecl = ReadDeclAs<ObjCIvarDecl>();
1301 D->IvarLoc = ReadSourceLocation();
1307 VisitDeclaratorDecl(FD);
1308 FD->Mutable = Record.readInt();
1310 if (
auto ISK = static_cast<FieldDecl::InitStorageKind>(Record.readInt())) {
1311 FD->InitStorage.setInt(ISK);
1312 FD->InitStorage.setPointer(ISK == FieldDecl::ISK_CapturedVLAType
1313 ? Record.readType().getAsOpaquePtr()
1314 : Record.readExpr());
1317 if (
auto *BW = Record.readExpr())
1321 if (
auto *Tmpl = ReadDeclAs<FieldDecl>())
1322 Reader.getContext().setInstantiatedFromUnnamedFieldDecl(FD, Tmpl);
1328 VisitDeclaratorDecl(PD);
1329 PD->GetterId = Record.getIdentifierInfo();
1330 PD->SetterId = Record.getIdentifierInfo();
1336 FD->ChainingSize = Record.readInt();
1337 assert(FD->ChainingSize >= 2 &&
"Anonymous chaining must be >= 2");
1338 FD->Chaining =
new (Reader.getContext())
NamedDecl*[FD->ChainingSize];
1340 for (
unsigned I = 0; I != FD->ChainingSize; ++I)
1341 FD->Chaining[I] = ReadDeclAs<NamedDecl>();
1347 RedeclarableResult Redecl = VisitRedeclarable(VD);
1348 VisitDeclaratorDecl(VD);
1353 if (!isa<ParmVarDecl>(VD)) {
1368 auto VarLinkage =
Linkage(Record.readInt());
1376 if (uint64_t Val = Record.readInt()) {
1377 VD->
setInit(Record.readExpr());
1381 Eval->
IsICE = Val == 3;
1389 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1391 switch ((VarKind)Record.readInt()) {
1392 case VarNotTemplate:
1395 if (!isa<ParmVarDecl>(VD) && !isa<ImplicitParamDecl>(VD) &&
1396 !isa<VarTemplateSpecializationDecl>(VD))
1397 mergeRedeclarable(VD, Redecl);
1401 VD->setDescribedVarTemplate(ReadDeclAs<VarTemplateDecl>());
1403 case StaticDataMemberSpecialization: {
1404 auto *Tmpl = ReadDeclAs<VarDecl>();
1407 Reader.getContext().setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
1408 mergeRedeclarable(VD, Redecl);
1422 unsigned isObjCMethodParam = Record.readInt();
1423 unsigned scopeDepth = Record.readInt();
1424 unsigned scopeIndex = Record.readInt();
1425 unsigned declQualifier = Record.readInt();
1426 if (isObjCMethodParam) {
1427 assert(scopeDepth == 0);
1435 if (Record.readInt())
1444 auto **BDs = DD->getTrailingObjects<
BindingDecl *>();
1445 for (
unsigned I = 0; I != DD->NumBindings; ++I)
1446 BDs[I] = ReadDeclAs<BindingDecl>();
1451 BD->Binding = Record.readExpr();
1456 AD->
setAsmString(cast<StringLiteral>(Record.readExpr()));
1462 BD->
setBody(cast_or_null<CompoundStmt>(Record.readStmt()));
1464 unsigned NumParams = Record.readInt();
1466 Params.reserve(NumParams);
1467 for (
unsigned I = 0; I != NumParams; ++I)
1468 Params.push_back(ReadDeclAs<ParmVarDecl>());
1475 bool capturesCXXThis = Record.readInt();
1476 unsigned numCaptures = Record.readInt();
1478 captures.reserve(numCaptures);
1479 for (
unsigned i = 0; i != numCaptures; ++i) {
1480 auto *
decl = ReadDeclAs<VarDecl>();
1481 unsigned flags = Record.readInt();
1482 bool byRef = (flags & 1);
1483 bool nested = (flags & 2);
1484 Expr *copyExpr = ((flags & 4) ? Record.readExpr() :
nullptr);
1488 BD->
setCaptures(Reader.getContext(), captures, capturesCXXThis);
1493 unsigned ContextParamPos = Record.readInt();
1496 for (
unsigned I = 0; I < CD->NumParams; ++I) {
1497 if (I != ContextParamPos)
1498 CD->
setParam(I, ReadDeclAs<ImplicitParamDecl>());
1513 D->RBraceLoc = ReadSourceLocation();
1522 RedeclarableResult Redecl = VisitRedeclarable(D);
1525 D->LocStart = ReadSourceLocation();
1526 D->RBraceLoc = ReadSourceLocation();
1533 if (Redecl.getFirstID() == ThisDeclID) {
1534 AnonNamespace = ReadDeclID();
1538 D->AnonOrFirstNamespaceAndInline.setPointer(D->
getFirstDecl());
1541 mergeRedeclarable(D, Redecl);
1543 if (AnonNamespace) {
1547 auto *Anon = cast<NamespaceDecl>(Reader.GetDecl(AnonNamespace));
1548 if (!Record.isModule())
1554 RedeclarableResult Redecl = VisitRedeclarable(D);
1556 D->NamespaceLoc = ReadSourceLocation();
1557 D->IdentLoc = ReadSourceLocation();
1558 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1559 D->Namespace = ReadDeclAs<NamedDecl>();
1560 mergeRedeclarable(D, Redecl);
1566 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1567 ReadDeclarationNameLoc(D->DNLoc, D->
getDeclName());
1568 D->FirstUsingShadow.setPointer(ReadDeclAs<UsingShadowDecl>());
1570 if (
auto *Pattern = ReadDeclAs<NamedDecl>())
1571 Reader.getContext().setInstantiatedFromUsingDecl(D, Pattern);
1577 D->InstantiatedFrom = ReadDeclAs<NamedDecl>();
1578 auto **Expansions = D->getTrailingObjects<
NamedDecl *>();
1579 for (
unsigned I = 0; I != D->NumExpansions; ++I)
1580 Expansions[I] = ReadDeclAs<NamedDecl>();
1585 RedeclarableResult Redecl = VisitRedeclarable(D);
1587 D->Underlying = ReadDeclAs<NamedDecl>();
1589 D->UsingOrNextShadow = ReadDeclAs<NamedDecl>();
1590 auto *Pattern = ReadDeclAs<UsingShadowDecl>();
1592 Reader.getContext().setInstantiatedFromUsingShadowDecl(D, Pattern);
1593 mergeRedeclarable(D, Redecl);
1598 VisitUsingShadowDecl(D);
1599 D->NominatedBaseClassShadowDecl = ReadDeclAs<ConstructorUsingShadowDecl>();
1600 D->ConstructedBaseClassShadowDecl = ReadDeclAs<ConstructorUsingShadowDecl>();
1601 D->IsVirtual = Record.readInt();
1606 D->UsingLoc = ReadSourceLocation();
1607 D->NamespaceLoc = ReadSourceLocation();
1608 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1609 D->NominatedNamespace = ReadDeclAs<NamedDecl>();
1610 D->CommonAncestor = ReadDeclAs<DeclContext>();
1616 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1617 ReadDeclarationNameLoc(D->DNLoc, D->
getDeclName());
1618 D->EllipsisLoc = ReadSourceLocation();
1625 D->TypenameLocation = ReadSourceLocation();
1626 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1627 D->EllipsisLoc = ReadSourceLocation();
1631 void ASTDeclReader::ReadCXXDefinitionData(
1632 struct CXXRecordDecl::DefinitionData &Data,
const CXXRecordDecl *D) {
1634 Data.UserDeclaredConstructor = Record.readInt();
1635 Data.UserDeclaredSpecialMembers = Record.readInt();
1636 Data.Aggregate = Record.readInt();
1637 Data.PlainOldData = Record.readInt();
1638 Data.Empty = Record.readInt();
1639 Data.Polymorphic = Record.readInt();
1640 Data.Abstract = Record.readInt();
1641 Data.IsStandardLayout = Record.readInt();
1642 Data.IsCXX11StandardLayout = Record.readInt();
1643 Data.HasBasesWithFields = Record.readInt();
1644 Data.HasBasesWithNonStaticDataMembers = Record.readInt();
1645 Data.HasPrivateFields = Record.readInt();
1646 Data.HasProtectedFields = Record.readInt();
1647 Data.HasPublicFields = Record.readInt();
1648 Data.HasMutableFields = Record.readInt();
1649 Data.HasVariantMembers = Record.readInt();
1650 Data.HasOnlyCMembers = Record.readInt();
1651 Data.HasInClassInitializer = Record.readInt();
1652 Data.HasUninitializedReferenceMember = Record.readInt();
1653 Data.HasUninitializedFields = Record.readInt();
1654 Data.HasInheritedConstructor = Record.readInt();
1655 Data.HasInheritedAssignment = Record.readInt();
1656 Data.NeedOverloadResolutionForCopyConstructor = Record.readInt();
1657 Data.NeedOverloadResolutionForMoveConstructor = Record.readInt();
1658 Data.NeedOverloadResolutionForMoveAssignment = Record.readInt();
1659 Data.NeedOverloadResolutionForDestructor = Record.readInt();
1660 Data.DefaultedCopyConstructorIsDeleted = Record.readInt();
1661 Data.DefaultedMoveConstructorIsDeleted = Record.readInt();
1662 Data.DefaultedMoveAssignmentIsDeleted = Record.readInt();
1663 Data.DefaultedDestructorIsDeleted = Record.readInt();
1664 Data.HasTrivialSpecialMembers = Record.readInt();
1665 Data.HasTrivialSpecialMembersForCall = Record.readInt();
1666 Data.DeclaredNonTrivialSpecialMembers = Record.readInt();
1667 Data.DeclaredNonTrivialSpecialMembersForCall = Record.readInt();
1668 Data.HasIrrelevantDestructor = Record.readInt();
1669 Data.HasConstexprNonCopyMoveConstructor = Record.readInt();
1670 Data.HasDefaultedDefaultConstructor = Record.readInt();
1671 Data.DefaultedDefaultConstructorIsConstexpr = Record.readInt();
1672 Data.HasConstexprDefaultConstructor = Record.readInt();
1673 Data.HasNonLiteralTypeFieldsOrBases = Record.readInt();
1674 Data.ComputedVisibleConversions = Record.readInt();
1675 Data.UserProvidedDefaultConstructor = Record.readInt();
1676 Data.DeclaredSpecialMembers = Record.readInt();
1677 Data.ImplicitCopyConstructorCanHaveConstParamForVBase = Record.readInt();
1678 Data.ImplicitCopyConstructorCanHaveConstParamForNonVBase = Record.readInt();
1679 Data.ImplicitCopyAssignmentHasConstParam = Record.readInt();
1680 Data.HasDeclaredCopyConstructorWithConstParam = Record.readInt();
1681 Data.HasDeclaredCopyAssignmentWithConstParam = Record.readInt();
1682 Data.ODRHash = Record.readInt();
1683 Data.HasODRHash =
true;
1685 if (Record.readInt())
1688 Data.NumBases = Record.readInt();
1690 Data.Bases = ReadGlobalOffset();
1691 Data.NumVBases = Record.readInt();
1693 Data.VBases = ReadGlobalOffset();
1695 Record.readUnresolvedSet(Data.Conversions);
1696 Record.readUnresolvedSet(Data.VisibleConversions);
1697 assert(Data.Definition &&
"Data.Definition should be already set!");
1698 Data.FirstFriend = ReadDeclID();
1700 if (Data.IsLambda) {
1703 auto &Lambda =
static_cast<CXXRecordDecl::LambdaDefinitionData &
>(Data);
1704 Lambda.Dependent = Record.readInt();
1705 Lambda.IsGenericLambda = Record.readInt();
1706 Lambda.CaptureDefault = Record.readInt();
1707 Lambda.NumCaptures = Record.readInt();
1708 Lambda.NumExplicitCaptures = Record.readInt();
1709 Lambda.ManglingNumber = Record.readInt();
1710 Lambda.ContextDecl = ReadDeclID();
1711 Lambda.Captures = (
Capture *)Reader.getContext().Allocate(
1712 sizeof(
Capture) * Lambda.NumCaptures);
1713 Capture *ToCapture = Lambda.Captures;
1714 Lambda.MethodTyInfo = GetTypeSourceInfo();
1715 for (
unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
1717 bool IsImplicit = Record.readInt();
1727 auto *Var = ReadDeclAs<VarDecl>();
1729 *ToCapture++ =
Capture(Loc, IsImplicit,
Kind, Var, EllipsisLoc);
1736 void ASTDeclReader::MergeDefinitionData(
1737 CXXRecordDecl *D,
struct CXXRecordDecl::DefinitionData &&MergeDD) {
1738 assert(D->DefinitionData &&
1739 "merging class definition into non-definition");
1740 auto &DD = *D->DefinitionData;
1742 if (DD.Definition != MergeDD.Definition) {
1744 Reader.MergedDeclContexts.insert(std::make_pair(MergeDD.Definition,
1746 Reader.PendingDefinitions.erase(MergeDD.Definition);
1747 MergeDD.Definition->IsCompleteDefinition =
false;
1748 Reader.mergeDefinitionVisibility(DD.Definition, MergeDD.Definition);
1749 assert(Reader.Lookups.find(MergeDD.Definition) == Reader.Lookups.end() &&
1750 "already loaded pending lookups for merged definition");
1753 auto PFDI = Reader.PendingFakeDefinitionData.find(&DD);
1754 if (PFDI != Reader.PendingFakeDefinitionData.end() &&
1755 PFDI->second == ASTReader::PendingFakeDefinitionKind::Fake) {
1758 assert(!DD.IsLambda && !MergeDD.IsLambda &&
"faked up lambda definition?");
1759 PFDI->second = ASTReader::PendingFakeDefinitionKind::FakeLoaded;
1763 auto *Def = DD.Definition;
1764 DD = std::move(MergeDD);
1765 DD.Definition = Def;
1770 bool DetectedOdrViolation =
false;
1771 #define OR_FIELD(Field) DD.Field |= MergeDD.Field; 1772 #define MATCH_FIELD(Field) \ 1773 DetectedOdrViolation |= DD.Field != MergeDD.Field; \ 1797 MATCH_FIELD(NeedOverloadResolutionForCopyConstructor)
1798 MATCH_FIELD(NeedOverloadResolutionForMoveConstructor)
1799 MATCH_FIELD(NeedOverloadResolutionForMoveAssignment)
1806 OR_FIELD(HasTrivialSpecialMembersForCall)
1807 OR_FIELD(DeclaredNonTrivialSpecialMembers)
1808 OR_FIELD(DeclaredNonTrivialSpecialMembersForCall)
1810 OR_FIELD(HasConstexprNonCopyMoveConstructor)
1811 OR_FIELD(HasDefaultedDefaultConstructor)
1812 MATCH_FIELD(DefaultedDefaultConstructorIsConstexpr)
1813 OR_FIELD(HasConstexprDefaultConstructor)
1818 MATCH_FIELD(ImplicitCopyConstructorCanHaveConstParamForVBase)
1819 MATCH_FIELD(ImplicitCopyConstructorCanHaveConstParamForNonVBase)
1821 OR_FIELD(HasDeclaredCopyConstructorWithConstParam)
1822 OR_FIELD(HasDeclaredCopyAssignmentWithConstParam)
1827 if (DD.NumBases != MergeDD.NumBases || DD.NumVBases != MergeDD.NumVBases)
1828 DetectedOdrViolation =
true;
1834 if (MergeDD.ComputedVisibleConversions && !DD.ComputedVisibleConversions) {
1835 DD.VisibleConversions = std::move(MergeDD.VisibleConversions);
1836 DD.ComputedVisibleConversions =
true;
1848 DetectedOdrViolation =
true;
1851 if (DetectedOdrViolation)
1852 Reader.PendingOdrMergeFailures[DD.Definition].push_back(
1853 {MergeDD.Definition, &MergeDD});
1857 struct CXXRecordDecl::DefinitionData *DD;
1862 bool IsLambda = Record.readInt();
1864 DD =
new (
C) CXXRecordDecl::LambdaDefinitionData(D,
nullptr,
false,
false,
1867 DD =
new (
C)
struct CXXRecordDecl::DefinitionData(D);
1873 if (!Canon->DefinitionData)
1874 Canon->DefinitionData = DD;
1875 D->DefinitionData = Canon->DefinitionData;
1876 ReadCXXDefinitionData(*DD, D);
1881 if (Canon->DefinitionData != DD) {
1882 MergeDefinitionData(Canon, std::move(*DD));
1887 D->IsCompleteDefinition =
true;
1892 if (Update || Canon != D)
1893 Reader.PendingDefinitions.insert(D);
1896 ASTDeclReader::RedeclarableResult
1898 RedeclarableResult Redecl = VisitRecordDeclImpl(D);
1903 CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
1905 switch ((CXXRecKind)Record.readInt()) {
1906 case CXXRecNotTemplate:
1908 if (!isa<ClassTemplateSpecializationDecl>(D))
1909 mergeRedeclarable(D, Redecl);
1911 case CXXRecTemplate: {
1913 auto *Template = ReadDeclAs<ClassTemplateDecl>();
1914 D->TemplateOrInstantiation = Template;
1915 if (!Template->getTemplatedDecl()) {
1926 case CXXRecMemberSpecialization: {
1927 auto *RD = ReadDeclAs<CXXRecordDecl>();
1932 D->TemplateOrInstantiation = MSI;
1933 mergeRedeclarable(D, Redecl);
1938 bool WasDefinition = Record.readInt();
1940 ReadCXXRecordDefinition(D,
false);
1947 if (WasDefinition) {
1948 DeclID KeyFn = ReadDeclID();
1949 if (KeyFn && D->IsCompleteDefinition)
1953 C.KeyFunctions[D] = KeyFn;
1960 VisitFunctionDecl(D);
1965 VisitFunctionDecl(D);
1967 unsigned NumOverridenMethods = Record.readInt();
1969 while (NumOverridenMethods--) {
1972 if (
auto *MD = ReadDeclAs<CXXMethodDecl>())
1978 Record.skipInts(NumOverridenMethods);
1986 auto *Shadow = ReadDeclAs<ConstructorUsingShadowDecl>();
1987 auto *Ctor = ReadDeclAs<CXXConstructorDecl>();
1992 VisitCXXMethodDecl(D);
1996 VisitCXXMethodDecl(D);
1998 if (
auto *OperatorDelete = ReadDeclAs<FunctionDecl>()) {
2000 auto *ThisArg = Record.readExpr();
2002 if (!Canon->OperatorDelete) {
2003 Canon->OperatorDelete = OperatorDelete;
2004 Canon->OperatorDeleteThisArg = ThisArg;
2010 VisitCXXMethodDecl(D);
2015 D->ImportedAndComplete.setPointer(readModule());
2016 D->ImportedAndComplete.setInt(Record.readInt());
2018 for (
unsigned I = 0, N = Record.back(); I != N; ++I)
2019 StoredLocs[I] = ReadSourceLocation();
2030 if (Record.readInt())
2031 D->Friend = ReadDeclAs<NamedDecl>();
2033 D->Friend = GetTypeSourceInfo();
2034 for (
unsigned i = 0; i != D->NumTPLists; ++i)
2036 Record.readTemplateParameterList();
2037 D->NextFriend = ReadDeclID();
2038 D->UnsupportedFriend = (Record.readInt() != 0);
2039 D->FriendLoc = ReadSourceLocation();
2044 unsigned NumParams = Record.readInt();
2045 D->NumParams = NumParams;
2047 for (
unsigned i = 0; i != NumParams; ++i)
2048 D->Params[i] = Record.readTemplateParameterList();
2049 if (Record.readInt())
2050 D->Friend = ReadDeclAs<NamedDecl>();
2052 D->Friend = GetTypeSourceInfo();
2053 D->FriendLoc = ReadSourceLocation();
2059 DeclID PatternID = ReadDeclID();
2060 auto *TemplatedDecl = cast_or_null<NamedDecl>(Reader.GetDecl(PatternID));
2063 D->
init(TemplatedDecl, TemplateParams);
2068 ASTDeclReader::RedeclarableResult
2070 RedeclarableResult Redecl = VisitRedeclarable(D);
2077 Reader.PendingDefinitions.insert(CanonD);
2083 if (ThisDeclID == Redecl.getFirstID()) {
2084 if (
auto *RTD = ReadDeclAs<RedeclarableTemplateDecl>()) {
2085 assert(RTD->getKind() == D->
getKind() &&
2086 "InstantiatedFromMemberTemplate kind mismatch");
2088 if (Record.readInt())
2093 DeclID PatternID = VisitTemplateDecl(D);
2096 mergeRedeclarable(D, Redecl, PatternID);
2107 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2109 if (ThisDeclID == Redecl.getFirstID()) {
2113 ReadDeclIDList(SpecIDs);
2121 Reader.getContext().getInjectedClassNameType(
2127 llvm_unreachable(
"BuiltinTemplates are not serialized");
2134 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2136 if (ThisDeclID == Redecl.getFirstID()) {
2140 ReadDeclIDList(SpecIDs);
2145 ASTDeclReader::RedeclarableResult
2148 RedeclarableResult Redecl = VisitCXXRecordDeclImpl(D);
2151 if (
Decl *InstD = ReadDecl()) {
2152 if (
auto *CTD = dyn_cast<ClassTemplateDecl>(InstD)) {
2153 D->SpecializedTemplate = CTD;
2156 Record.readTemplateArgumentList(TemplArgs);
2161 SpecializedPartialSpecialization();
2162 PS->PartialSpecialization
2163 = cast<ClassTemplatePartialSpecializationDecl>(InstD);
2164 PS->TemplateArgs = ArgList;
2165 D->SpecializedTemplate = PS;
2170 Record.readTemplateArgumentList(TemplArgs,
true);
2172 D->PointOfInstantiation = ReadSourceLocation();
2175 bool writtenAsCanonicalDecl = Record.readInt();
2176 if (writtenAsCanonicalDecl) {
2177 auto *CanonPattern = ReadDeclAs<ClassTemplateDecl>();
2181 if (
auto *Partial = dyn_cast<ClassTemplatePartialSpecializationDecl>(D)) {
2182 CanonSpec = CanonPattern->getCommonPtr()->PartialSpecializations
2183 .GetOrInsertNode(Partial);
2186 CanonPattern->getCommonPtr()->Specializations.GetOrInsertNode(D);
2189 if (CanonSpec != D) {
2190 mergeRedeclarable<TagDecl>(D, CanonSpec, Redecl);
2194 if (
auto *DDD = D->DefinitionData) {
2195 if (CanonSpec->DefinitionData)
2196 MergeDefinitionData(CanonSpec, std::move(*DDD));
2198 CanonSpec->DefinitionData = D->DefinitionData;
2200 D->DefinitionData = CanonSpec->DefinitionData;
2207 auto *ExplicitInfo =
2208 new (
C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
2209 ExplicitInfo->TypeAsWritten = TyInfo;
2210 ExplicitInfo->ExternLoc = ReadSourceLocation();
2211 ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation();
2212 D->ExplicitInfo = ExplicitInfo;
2220 RedeclarableResult Redecl = VisitClassTemplateSpecializationDeclImpl(D);
2222 D->TemplateParams = Record.readTemplateParameterList();
2223 D->ArgsAsWritten = Record.readASTTemplateArgumentListInfo();
2226 if (ThisDeclID == Redecl.getFirstID()) {
2227 D->InstantiatedFromMember.setPointer(
2228 ReadDeclAs<ClassTemplatePartialSpecializationDecl>());
2229 D->InstantiatedFromMember.setInt(Record.readInt());
2236 D->Specialization = ReadDeclAs<CXXMethodDecl>();
2240 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2242 if (ThisDeclID == Redecl.getFirstID()) {
2245 ReadDeclIDList(SpecIDs);
2255 ASTDeclReader::RedeclarableResult
2258 RedeclarableResult Redecl = VisitVarDeclImpl(D);
2261 if (
Decl *InstD = ReadDecl()) {
2262 if (
auto *VTD = dyn_cast<VarTemplateDecl>(InstD)) {
2263 D->SpecializedTemplate = VTD;
2266 Record.readTemplateArgumentList(TemplArgs);
2271 VarTemplateSpecializationDecl::SpecializedPartialSpecialization();
2272 PS->PartialSpecialization =
2273 cast<VarTemplatePartialSpecializationDecl>(InstD);
2274 PS->TemplateArgs = ArgList;
2275 D->SpecializedTemplate = PS;
2281 auto *ExplicitInfo =
2282 new (
C) VarTemplateSpecializationDecl::ExplicitSpecializationInfo;
2283 ExplicitInfo->TypeAsWritten = TyInfo;
2284 ExplicitInfo->ExternLoc = ReadSourceLocation();
2285 ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation();
2286 D->ExplicitInfo = ExplicitInfo;
2290 Record.readTemplateArgumentList(TemplArgs,
true);
2292 D->PointOfInstantiation = ReadSourceLocation();
2294 D->IsCompleteDefinition = Record.readInt();
2296 bool writtenAsCanonicalDecl = Record.readInt();
2297 if (writtenAsCanonicalDecl) {
2298 auto *CanonPattern = ReadDeclAs<VarTemplateDecl>();
2301 if (
auto *Partial = dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
2302 CanonPattern->getCommonPtr()->PartialSpecializations
2303 .GetOrInsertNode(Partial);
2305 CanonPattern->getCommonPtr()->Specializations.GetOrInsertNode(D);
2320 RedeclarableResult Redecl = VisitVarTemplateSpecializationDeclImpl(D);
2322 D->TemplateParams = Record.readTemplateParameterList();
2323 D->ArgsAsWritten = Record.readASTTemplateArgumentListInfo();
2326 if (ThisDeclID == Redecl.getFirstID()) {
2327 D->InstantiatedFromMember.setPointer(
2328 ReadDeclAs<VarTemplatePartialSpecializationDecl>());
2329 D->InstantiatedFromMember.setInt(Record.readInt());
2338 if (Record.readInt())
2343 VisitDeclaratorDecl(D);
2348 auto TypesAndInfos =
2349 D->getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
2351 new (&TypesAndInfos[I].first)
QualType(Record.readType());
2352 TypesAndInfos[I].second = GetTypeSourceInfo();
2356 D->ParameterPack = Record.readInt();
2357 if (Record.readInt())
2363 VisitTemplateDecl(D);
2371 Data[I] = Record.readTemplateParameterList();
2374 D->ParameterPack = Record.readInt();
2375 if (Record.readInt())
2377 Record.readTemplateArgumentLoc());
2382 VisitRedeclarableTemplateDecl(D);
2387 D->AssertExprAndFailed.setPointer(Record.readExpr());
2388 D->AssertExprAndFailed.setInt(Record.readInt());
2389 D->Message = cast_or_null<StringLiteral>(Record.readExpr());
2390 D->RParenLoc = ReadSourceLocation();
2397 std::pair<uint64_t, uint64_t>
2399 uint64_t LexicalOffset = ReadLocalOffset();
2400 uint64_t VisibleOffset = ReadLocalOffset();
2401 return std::make_pair(LexicalOffset, VisibleOffset);
2404 template <
typename T>
2405 ASTDeclReader::RedeclarableResult
2407 DeclID FirstDeclID = ReadDeclID();
2408 Decl *MergeWith =
nullptr;
2410 bool IsKeyDecl = ThisDeclID == FirstDeclID;
2411 bool IsFirstLocalDecl =
false;
2413 uint64_t RedeclOffset = 0;
2417 if (FirstDeclID == 0) {
2418 FirstDeclID = ThisDeclID;
2420 IsFirstLocalDecl =
true;
2421 }
else if (
unsigned N = Record.readInt()) {
2425 IsFirstLocalDecl =
true;
2432 for (
unsigned I = 0; I != N - 1; ++I)
2433 MergeWith = ReadDecl();
2435 RedeclOffset = ReadLocalOffset();
2442 auto *FirstDecl = cast_or_null<T>(Reader.GetDecl(FirstDeclID));
2443 if (FirstDecl != D) {
2449 D->
First = FirstDecl->getCanonicalDecl();
2452 auto *DAsT =
static_cast<T *
>(D);
2458 if (IsFirstLocalDecl)
2459 Reader.PendingDeclChains.push_back(std::make_pair(DAsT, RedeclOffset));
2461 return RedeclarableResult(MergeWith, FirstDeclID, IsKeyDecl);
2466 template<
typename T>
2468 RedeclarableResult &Redecl,
2469 DeclID TemplatePatternID) {
2471 if (!Reader.getContext().getLangOpts().Modules)
2478 auto *D =
static_cast<T *
>(DBase);
2480 if (
auto *Existing = Redecl.getKnownMergeTarget())
2482 mergeRedeclarable(D, cast<T>(Existing), Redecl, TemplatePatternID);
2483 else if (FindExistingResult ExistingRes = findExisting(D))
2484 if (T *Existing = ExistingRes)
2485 mergeRedeclarable(D, Existing, Redecl, TemplatePatternID);
2493 llvm_unreachable(
"bad assert_cast");
2500 DeclID DsID,
bool IsKeyDecl) {
2503 RedeclarableResult Result( ExistingPattern,
2504 DPattern->getCanonicalDecl()->getGlobalID(),
2507 if (
auto *DClass = dyn_cast<CXXRecordDecl>(DPattern)) {
2510 auto *ExistingClass =
2512 if (
auto *DDD = DClass->DefinitionData) {
2513 if (ExistingClass->DefinitionData) {
2514 MergeDefinitionData(ExistingClass, std::move(*DDD));
2516 ExistingClass->DefinitionData = DClass->DefinitionData;
2519 Reader.PendingDefinitions.insert(DClass);
2522 DClass->DefinitionData = ExistingClass->DefinitionData;
2524 return mergeRedeclarable(DClass, cast<TagDecl>(ExistingPattern),
2527 if (
auto *DFunction = dyn_cast<FunctionDecl>(DPattern))
2528 return mergeRedeclarable(DFunction, cast<FunctionDecl>(ExistingPattern),
2530 if (
auto *DVar = dyn_cast<VarDecl>(DPattern))
2531 return mergeRedeclarable(DVar, cast<VarDecl>(ExistingPattern), Result);
2532 if (
auto *DAlias = dyn_cast<TypeAliasDecl>(DPattern))
2533 return mergeRedeclarable(DAlias, cast<TypedefNameDecl>(ExistingPattern),
2535 llvm_unreachable(
"merged an unknown kind of redeclarable template");
2540 template<
typename T>
2542 RedeclarableResult &Redecl,
2543 DeclID TemplatePatternID) {
2544 auto *D =
static_cast<T *
>(DBase);
2547 if (ExistingCanon != DCanon) {
2548 assert(DCanon->getGlobalID() == Redecl.getFirstID() &&
2549 "already merged this declaration");
2555 D->
First = ExistingCanon;
2556 ExistingCanon->Used |= D->Used;
2562 if (
auto *Namespace = dyn_cast<NamespaceDecl>(D))
2563 Namespace->AnonOrFirstNamespaceAndInline.setPointer(
2564 assert_cast<NamespaceDecl*>(ExistingCanon));
2567 if (
auto *DTemplate = dyn_cast<RedeclarableTemplateDecl>(D))
2568 mergeTemplatePattern(
2569 DTemplate, assert_cast<RedeclarableTemplateDecl*>(ExistingCanon),
2570 TemplatePatternID, Redecl.isKeyDecl());
2573 if (Redecl.isKeyDecl())
2574 Reader.KeyDecls[ExistingCanon].push_back(Redecl.getFirstID());
2587 if (isa<EnumConstantDecl>(ND))
2596 template<
typename T>
2599 if (!Reader.getContext().getLangOpts().Modules)
2606 if (!Reader.getContext().getLangOpts().CPlusPlus &&
2610 if (FindExistingResult ExistingRes = findExisting(static_cast<T*>(D)))
2611 if (T *Existing = ExistingRes)
2612 Reader.getContext().setPrimaryMergedDecl(static_cast<T *>(D),
2613 Existing->getCanonicalDecl());
2620 Vars.reserve(NumVars);
2621 for (
unsigned i = 0; i != NumVars; ++i) {
2622 Vars.push_back(Record.readExpr());
2634 D->PrevDeclInScope = ReadDeclID();
2647 for (
unsigned i = 0, e = Record.
readInt(); i != e; ++i) {
2648 Attr *New =
nullptr;
2653 #include "clang/Serialization/AttrPCHRead.inc" 2655 assert(New &&
"Unable to decode attribute?");
2656 Attrs.push_back(New);
2670 inline void ASTReader::LoadedDecl(
unsigned Index,
Decl *D) {
2671 assert(!DeclsLoaded[Index] &&
"Decl loaded twice?");
2672 DeclsLoaded[Index] = D;
2687 if (isa<ImportDecl>(D) || isa<VarDecl>(D)) {
2694 if (isa<FileScopeAsmDecl>(D) ||
2695 isa<ObjCProtocolDecl>(D) ||
2696 isa<ObjCImplDecl>(D) ||
2697 isa<ImportDecl>(D) ||
2698 isa<PragmaCommentDecl>(D) ||
2699 isa<PragmaDetectMismatchDecl>(D))
2701 if (isa<OMPThreadPrivateDecl>(D) || isa<OMPDeclareReductionDecl>(D))
2703 if (
const auto *Var = dyn_cast<VarDecl>(D))
2704 return Var->isFileVarDecl() &&
2706 if (
const auto *Func = dyn_cast<FunctionDecl>(D))
2707 return Func->doesThisDeclarationHaveABody() || HasBody;
2717 ASTReader::RecordLocation
2719 GlobalDeclMapType::iterator I = GlobalDeclMap.find(
ID);
2720 assert(I != GlobalDeclMap.end() &&
"Corrupted global declaration map");
2724 Loc = TranslateSourceLocation(*M, DOffs.
getLocation());
2725 return RecordLocation(M, DOffs.
BitOffset);
2728 ASTReader::RecordLocation ASTReader::getLocalBitOffset(uint64_t GlobalOffset) {
2729 auto I = GlobalBitOffsetsMap.find(GlobalOffset);
2731 assert(I != GlobalBitOffsetsMap.end() &&
"Corrupted global bit offsets map");
2732 return RecordLocation(I->second, GlobalOffset - I->second->GlobalBitOffset);
2735 uint64_t ASTReader::getGlobalBitOffset(
ModuleFile &M, uint32_t LocalOffset) {
2749 if (
const auto *TX = dyn_cast<TemplateTypeParmDecl>(X)) {
2750 const auto *TY = cast<TemplateTypeParmDecl>(Y);
2751 return TX->isParameterPack() == TY->isParameterPack();
2754 if (
const auto *TX = dyn_cast<NonTypeTemplateParmDecl>(X)) {
2755 const auto *TY = cast<NonTypeTemplateParmDecl>(Y);
2756 return TX->isParameterPack() == TY->isParameterPack() &&
2757 TX->getASTContext().hasSameType(TX->getType(), TY->getType());
2760 const auto *TX = cast<TemplateTemplateParmDecl>(
X);
2761 const auto *TY = cast<TemplateTemplateParmDecl>(Y);
2762 return TX->isParameterPack() == TY->isParameterPack() &&
2764 TY->getTemplateParameters());
2771 return NAS->getNamespace();
2779 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
2821 for (
unsigned I = 0, N = X->
size(); I != N; ++I)
2839 AEnableIfs.push_back(EIA);
2843 BEnableIfs.push_back(EIA);
2847 if (AEnableIfs.empty() && BEnableIfs.empty())
2850 if (AEnableIfs.size() != BEnableIfs.size())
2853 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
2854 for (
unsigned I = 0, E = AEnableIfs.size(); I != E; ++I) {
2858 AEnableIfs[I]->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
2859 BEnableIfs[I]->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
2860 if (Cand1ID != Cand2ID)
2885 if (
const auto *TypedefX = dyn_cast<TypedefNameDecl>(X))
2886 if (
const auto *TypedefY = dyn_cast<TypedefNameDecl>(Y))
2888 TypedefY->getUnderlyingType());
2895 if (isa<ObjCInterfaceDecl>(X) || isa<ObjCProtocolDecl>(
X))
2898 if (isa<ClassTemplateSpecializationDecl>(X)) {
2905 if (
const auto *TagX = dyn_cast<TagDecl>(X)) {
2906 const auto *TagY = cast<TagDecl>(Y);
2907 return (TagX->getTagKind() == TagY->getTagKind()) ||
2917 if (
const auto *FuncX = dyn_cast<FunctionDecl>(X)) {
2918 const auto *FuncY = cast<FunctionDecl>(Y);
2919 if (
const auto *CtorX = dyn_cast<CXXConstructorDecl>(X)) {
2920 const auto *CtorY = cast<CXXConstructorDecl>(Y);
2921 if (CtorX->getInheritedConstructor() &&
2922 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
2923 CtorY->getInheritedConstructor().getConstructor()))
2927 if (FuncX->isMultiVersion() != FuncY->isMultiVersion())
2932 if (FuncX->isMultiVersion()) {
2933 const auto *TAX = FuncX->getAttr<TargetAttr>();
2934 const auto *TAY = FuncY->getAttr<TargetAttr>();
2935 assert(TAX && TAY &&
"Multiversion Function without target attribute");
2937 if (TAX->getFeaturesStr() != TAY->getFeaturesStr())
2947 FD = FD->getCanonicalDecl();
2948 return FD->getTypeSourceInfo() ? FD->getTypeSourceInfo()->getType()
2951 QualType XT = GetTypeAsWritten(FuncX), YT = GetTypeAsWritten(FuncY);
2958 if (C.
getLangOpts().CPlusPlus17 && XFPT && YFPT &&
2965 return FuncX->getLinkageInternal() == FuncY->getLinkageInternal() &&
2970 if (
const auto *VarX = dyn_cast<VarDecl>(X)) {
2971 const auto *VarY = cast<VarDecl>(Y);
2972 if (VarX->getLinkageInternal() == VarY->getLinkageInternal()) {
2974 if (C.
hasSameType(VarX->getType(), VarY->getType()))
2984 if (!VarXTy || !VarYTy)
2993 if (
const auto *NamespaceX = dyn_cast<NamespaceDecl>(X)) {
2994 const auto *NamespaceY = cast<NamespaceDecl>(Y);
2995 return NamespaceX->isInline() == NamespaceY->isInline();
3000 if (
const auto *TemplateX = dyn_cast<TemplateDecl>(X)) {
3001 const auto *TemplateY = cast<TemplateDecl>(Y);
3003 TemplateY->getTemplatedDecl()) &&
3005 TemplateY->getTemplateParameters());
3009 if (
const auto *FDX = dyn_cast<FieldDecl>(X)) {
3010 const auto *FDY = cast<FieldDecl>(Y);
3016 if (
const auto *IFDX = dyn_cast<IndirectFieldDecl>(X)) {
3017 const auto *IFDY = cast<IndirectFieldDecl>(Y);
3018 return IFDX->getAnonField()->getCanonicalDecl() ==
3019 IFDY->getAnonField()->getCanonicalDecl();
3023 if (isa<EnumConstantDecl>(X))
3028 if (
const auto *USX = dyn_cast<UsingShadowDecl>(X)) {
3029 const auto *USY = cast<UsingShadowDecl>(Y);
3030 return USX->getTargetDecl() == USY->getTargetDecl();
3035 if (
const auto *UX = dyn_cast<UsingDecl>(X)) {
3036 const auto *UY = cast<UsingDecl>(Y);
3038 UX->hasTypename() == UY->hasTypename() &&
3039 UX->isAccessDeclaration() == UY->isAccessDeclaration();
3041 if (
const auto *UX = dyn_cast<UnresolvedUsingValueDecl>(X)) {
3042 const auto *UY = cast<UnresolvedUsingValueDecl>(Y);
3044 UX->isAccessDeclaration() == UY->isAccessDeclaration();
3046 if (
const auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(X))
3049 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
3052 if (
const auto *NAX = dyn_cast<NamespaceAliasDecl>(X)) {
3053 const auto *NAY = cast<NamespaceAliasDecl>(Y);
3054 return NAX->getNamespace()->Equals(NAY->getNamespace());
3064 if (
auto *ND = dyn_cast<NamespaceDecl>(DC))
3065 return ND->getOriginalNamespace();
3067 if (
auto *RD = dyn_cast<CXXRecordDecl>(DC)) {
3069 auto *DD = RD->DefinitionData;
3071 DD = RD->getCanonicalDecl()->DefinitionData;
3078 DD =
new (Reader.
getContext())
struct CXXRecordDecl::DefinitionData(RD);
3079 RD->IsCompleteDefinition =
true;
3080 RD->DefinitionData = DD;
3081 RD->getCanonicalDecl()->DefinitionData = DD;
3084 Reader.PendingFakeDefinitionData.insert(
3085 std::make_pair(DD, ASTReader::PendingFakeDefinitionKind::Fake));
3088 return DD->Definition;
3091 if (
auto *ED = dyn_cast<EnumDecl>(DC))
3092 return ED->getASTContext().getLangOpts().CPlusPlus? ED->getDefinition()
3097 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
3103 ASTDeclReader::FindExistingResult::~FindExistingResult() {
3106 if (TypedefNameForLinkage) {
3108 Reader.ImportedTypedefNamesForLinkage.insert(
3109 std::make_pair(std::make_pair(DC, TypedefNameForLinkage), New));
3113 if (!AddResult || Existing)
3119 setAnonymousDeclForMerging(Reader, New->getLexicalDeclContext(),
3120 AnonymousDeclNumber, New);
3126 }
else if (
DeclContext *MergeDC = getPrimaryContextForMerging(Reader, DC)) {
3129 MergeDC->makeDeclVisibleInContextImpl(New,
true);
3137 bool IsTypedefNameForLinkage) {
3138 if (!IsTypedefNameForLinkage)
3147 if (
auto *TND = dyn_cast<TypedefNameDecl>(Found))
3148 return TND->getAnonDeclWithTypedefName(
true);
3157 ASTDeclReader::getPrimaryDCForAnonymousDecl(
DeclContext *LexicalDC) {
3159 if (
auto *RD = dyn_cast<CXXRecordDecl>(LexicalDC)) {
3160 auto *DD = RD->getCanonicalDecl()->DefinitionData;
3161 return DD ? DD->Definition :
nullptr;
3168 if (
auto *FD = dyn_cast<FunctionDecl>(D))
3169 if (FD->isThisDeclarationADefinition())
3171 if (
auto *MD = dyn_cast<ObjCMethodDecl>(D))
3172 if (MD->isThisDeclarationADefinition())
3188 auto &
Previous = Reader.AnonymousDeclarationsForMerging[CanonDC];
3194 auto *PrimaryDC = getPrimaryDCForAnonymousDecl(DC);
3195 if (PrimaryDC && !cast<Decl>(PrimaryDC)->isFromASTFile()) {
3207 void ASTDeclReader::setAnonymousDeclForMerging(
ASTReader &Reader,
3212 auto &
Previous = Reader.AnonymousDeclarationsForMerging[CanonDC];
3219 ASTDeclReader::FindExistingResult ASTDeclReader::findExisting(
NamedDecl *D) {
3226 FindExistingResult Result(Reader, D,
nullptr,
3227 AnonymousDeclNumber, TypedefNameForLinkage);
3233 if (TypedefNameForLinkage) {
3234 auto It = Reader.ImportedTypedefNamesForLinkage.find(
3235 std::make_pair(DC, TypedefNameForLinkage));
3236 if (It != Reader.ImportedTypedefNamesForLinkage.end())
3238 return FindExistingResult(Reader, D, It->second, AnonymousDeclNumber,
3239 TypedefNameForLinkage);
3247 if (
auto *Existing = getAnonymousDeclForMerging(
3250 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3251 TypedefNameForLinkage);
3258 class UpToDateIdentifierRAII {
3260 bool WasOutToDate =
false;
3271 ~UpToDateIdentifierRAII() {
3278 IEnd = IdResolver.
end();
3282 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3283 TypedefNameForLinkage);
3285 }
else if (
DeclContext *MergeDC = getPrimaryContextForMerging(Reader, DC)) {
3290 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3291 TypedefNameForLinkage);
3295 return FindExistingResult(Reader);
3304 if (MergedDCIt != Reader.MergedDeclContexts.end() &&
3306 Reader.PendingOdrMergeChecks.push_back(D);
3308 return FindExistingResult(Reader, D,
nullptr,
3309 AnonymousDeclNumber, TypedefNameForLinkage);
3312 template<
typename DeclT>
3318 llvm_unreachable(
"getMostRecentDecl on non-redeclarable declaration");
3325 #define ABSTRACT_DECL(TYPE) 3326 #define DECL(TYPE, BASE) \ 3328 return getMostRecentDeclImpl(cast<TYPE##Decl>(D)); 3329 #include "clang/AST/DeclNodes.inc" 3331 llvm_unreachable(
"unknown decl kind");
3334 Decl *ASTReader::getMostRecentExistingDecl(
Decl *D) {
3338 template<
typename DeclT>
3342 D->
RedeclLink.setPrevious(cast<DeclT>(Previous));
3352 auto *VD =
static_cast<VarDecl *
>(D);
3353 auto *PrevVD = cast<VarDecl>(
Previous);
3364 VD->demoteThisDefinitionToDeclaration();
3376 auto *PrevFD = cast<FunctionDecl>(
Previous);
3379 FD->First = PrevFD->First;
3383 if (PrevFD->IsInline != FD->IsInline) {
3399 FD->IsInline =
true;
3406 if (FPT && PrevFPT) {
3408 bool WasUnresolved =
3410 if (IsUnresolved != WasUnresolved)
3411 Reader.PendingExceptionSpecUpdates.insert(
3412 std::make_pair(Canon, IsUnresolved ? PrevFD : FD));
3419 llvm_unreachable(
"attachPreviousDecl on non-redeclarable declaration");
3424 template <
typename ParmDecl>
3427 auto *To = cast<ParmDecl>(ToD);
3428 if (!From->hasDefaultArgument())
3430 To->setInheritedDefaultArgument(Context, From);
3439 assert(FromTP->size() == ToTP->size() &&
"merged mismatched templates?");
3441 for (
unsigned I = 0, N = FromTP->size(); I != N; ++I) {
3442 NamedDecl *FromParam = FromTP->getParam(I);
3445 if (
auto *FTTP = dyn_cast<TemplateTypeParmDecl>(FromParam))
3447 else if (
auto *FNTTP = dyn_cast<NonTypeTemplateParmDecl>(FromParam))
3451 Context, cast<TemplateTemplateParmDecl>(FromParam), ToParam);
3457 assert(D && Previous);
3460 #define ABSTRACT_DECL(TYPE) 3461 #define DECL(TYPE, BASE) \ 3463 attachPreviousDeclImpl(Reader, cast<TYPE##Decl>(D), Previous, Canon); \ 3465 #include "clang/AST/DeclNodes.inc" 3479 if (
auto *TD = dyn_cast<TemplateDecl>(D))
3484 template<
typename DeclT>
3486 D->
RedeclLink.setLatest(cast<DeclT>(Latest));
3490 llvm_unreachable(
"attachLatestDecl on non-redeclarable declaration");
3494 assert(D && Latest);
3497 #define ABSTRACT_DECL(TYPE) 3498 #define DECL(TYPE, BASE) \ 3500 attachLatestDeclImpl(cast<TYPE##Decl>(D), Latest); \ 3502 #include "clang/AST/DeclNodes.inc" 3506 template<
typename DeclT>
3512 llvm_unreachable(
"markIncompleteDeclChain on non-redeclarable declaration");
3515 void ASTReader::markIncompleteDeclChain(
Decl *D) {
3517 #define ABSTRACT_DECL(TYPE) 3518 #define DECL(TYPE, BASE) \ 3520 ASTDeclReader::markIncompleteDeclChainImpl(cast<TYPE##Decl>(D)); \ 3522 #include "clang/AST/DeclNodes.inc" 3530 RecordLocation Loc = DeclCursorForID(ID, DeclLoc);
3531 llvm::BitstreamCursor &DeclsCursor = Loc.F->DeclsCursor;
3536 ReadingKindTracker ReadingKind(Read_Decl, *
this);
3539 Deserializing ADecl(
this);
3541 DeclsCursor.JumpToBit(Loc.Offset);
3544 unsigned Code = DeclsCursor.ReadCode();
3551 llvm_unreachable(
"Record cannot be de-serialized with ReadDeclRecord");
3750 Error(
"attempt to read a C++ base-specifier record as a declaration");
3753 Error(
"attempt to read a C++ ctor initializer record as a declaration");
3784 assert(D &&
"Unknown declaration reading AST file");
3785 LoadedDecl(Index, D);
3794 if (
auto *DC = dyn_cast<DeclContext>(D)) {
3796 if (Offsets.first &&
3797 ReadLexicalDeclContextStorage(*Loc.F, DeclsCursor, Offsets.first, DC))
3799 if (Offsets.second &&
3800 ReadVisibleDeclContextStorage(*Loc.F, DeclsCursor, Offsets.second, ID))
3806 PendingUpdateRecords.push_back(
3807 PendingUpdateRecord(ID, D,
true));
3810 if (
auto *Class = dyn_cast<ObjCInterfaceDecl>(D))
3813 if (Class->isThisDeclarationADefinition() ||
3814 PendingDefinitions.count(Class))
3815 loadObjCCategories(ID, Class);
3821 PotentiallyInterestingDecls.push_back(
3827 void ASTReader::PassInterestingDeclsToConsumer() {
3830 if (PassingDeclsToConsumer)
3840 for (
auto ID : EagerlyDeserializedDecls)
3842 EagerlyDeserializedDecls.clear();
3844 while (!PotentiallyInterestingDecls.empty()) {
3845 InterestingDecl D = PotentiallyInterestingDecls.front();
3846 PotentiallyInterestingDecls.pop_front();
3848 PassInterestingDeclToConsumer(D.getDecl());
3852 void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord &Record) {
3858 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
3859 DeclUpdateOffsetsMap::iterator UpdI = DeclUpdateOffsets.find(ID);
3863 if (UpdI != DeclUpdateOffsets.end()) {
3864 auto UpdateOffsets = std::move(UpdI->second);
3865 DeclUpdateOffsets.erase(UpdI);
3871 bool WasInteresting =
3873 for (
auto &FileAndOffset : UpdateOffsets) {
3875 uint64_t
Offset = FileAndOffset.second;
3878 Cursor.JumpToBit(Offset);
3879 unsigned Code = Cursor.ReadCode();
3881 unsigned RecCode = Record.
readRecord(Cursor, Code);
3883 assert(RecCode ==
DECL_UPDATES &&
"Expected DECL_UPDATES record!");
3885 ASTDeclReader Reader(*
this, Record, RecordLocation(F, Offset), ID,
3887 Reader.
UpdateDecl(D, PendingLazySpecializationIDs);
3891 if (!WasInteresting &&
3893 PotentiallyInterestingDecls.push_back(
3895 WasInteresting =
true;
3900 assert((PendingLazySpecializationIDs.empty() || isa<ClassTemplateDecl>(D) ||
3901 isa<FunctionTemplateDecl>(D) || isa<VarTemplateDecl>(D)) &&
3902 "Must not have pending specializations");
3903 if (
auto *CTD = dyn_cast<ClassTemplateDecl>(D))
3905 else if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
3907 else if (
auto *VTD = dyn_cast<VarTemplateDecl>(D))
3909 PendingLazySpecializationIDs.clear();
3912 auto I = PendingVisibleUpdates.find(ID);
3913 if (I != PendingVisibleUpdates.end()) {
3914 auto VisibleUpdates = std::move(I->second);
3915 PendingVisibleUpdates.erase(I);
3917 auto *DC = cast<DeclContext>(D)->getPrimaryContext();
3918 for (
const auto &
Update : VisibleUpdates)
3919 Lookups[DC].Table.add(
3926 void ASTReader::loadPendingDeclChain(
Decl *FirstLocal, uint64_t LocalOffset) {
3929 if (FirstLocal != CanonDecl) {
3932 *
this, FirstLocal, PrevMostRecent ? PrevMostRecent : CanonDecl,
3942 ModuleFile *M = getOwningModuleFile(FirstLocal);
3943 assert(M &&
"imported decl from no module file");
3947 Cursor.JumpToBit(LocalOffset);
3950 unsigned Code = Cursor.ReadCode();
3951 unsigned RecCode = Cursor.readRecord(Code, Record);
3957 Decl *MostRecent = FirstLocal;
3958 for (
unsigned I = 0, N = Record.size(); I != N; ++I) {
3959 auto *D = GetLocalDecl(*M, Record[N - I - 1]);
3970 class ObjCCategoriesVisitor {
3973 llvm::SmallPtrSetImpl<ObjCCategoryDecl *> &Deserialized;
3975 llvm::DenseMap<DeclarationName, ObjCCategoryDecl *> NameCategoryMap;
3977 unsigned PreviousGeneration;
3981 if (!Deserialized.erase(Cat))
4004 }
else if (!Existing) {
4019 ObjCCategoriesVisitor(
ASTReader &Reader,
4021 llvm::SmallPtrSetImpl<ObjCCategoryDecl *> &Deserialized,
4023 unsigned PreviousGeneration)
4024 : Reader(Reader), Interface(Interface), Deserialized(Deserialized),
4025 InterfaceID(InterfaceID), PreviousGeneration(PreviousGeneration) {
4068 for (
unsigned I = 0; I != N; ++I)
4069 add(cast_or_null<ObjCCategoryDecl>(
4079 unsigned PreviousGeneration) {
4080 ObjCCategoriesVisitor Visitor(*
this, D, CategoriesDeserialized,
ID,
4081 PreviousGeneration);
4082 ModuleMgr.visit(Visitor);
4085 template<
typename DeclT,
typename Fn>
4092 auto *MostRecent = D->getMostRecentDecl();
4094 for (
auto *Redecl = MostRecent; Redecl && !Found;
4095 Redecl = Redecl->getPreviousDecl())
4096 Found = (Redecl == D);
4100 for (
auto *Redecl = MostRecent; Redecl != D;
4101 Redecl = Redecl->getPreviousDecl())
4108 while (Record.getIdx() < Record.size()) {
4111 auto *RD = cast<CXXRecordDecl>(D);
4114 Decl *MD = Record.readDecl();
4115 assert(MD &&
"couldn't read decl from update record");
4118 RD->addedMember(MD);
4124 PendingLazySpecializationIDs.push_back(ReadDeclID());
4128 auto *Anon = ReadDeclAs<NamespaceDecl>();
4133 if (!Record.isModule()) {
4134 if (
auto *TU = dyn_cast<TranslationUnitDecl>(D))
4135 TU->setAnonymousNamespace(Anon);
4137 cast<NamespaceDecl>(D)->setAnonymousNamespace(Anon);
4143 auto *VD = cast<VarDecl>(D);
4144 VD->NonParmVarDeclBits.IsInline = Record.readInt();
4145 VD->NonParmVarDeclBits.IsInlineSpecified = Record.readInt();
4146 uint64_t Val = Record.readInt();
4147 if (Val && !VD->getInit()) {
4148 VD->setInit(Record.readExpr());
4152 Eval->
IsICE = Val == 3;
4160 if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(D)) {
4161 VTSD->setPointOfInstantiation(POI);
4162 }
else if (
auto *VD = dyn_cast<VarDecl>(D)) {
4163 VD->getMemberSpecializationInfo()->setPointOfInstantiation(POI);
4165 auto *FD = cast<FunctionDecl>(D);
4166 if (
auto *FTSInfo = FD->TemplateOrSpecialization
4168 FTSInfo->setPointOfInstantiation(POI);
4171 ->setPointOfInstantiation(POI);
4177 auto *Param = cast<ParmVarDecl>(D);
4182 auto *DefaultArg = Record.readExpr();
4186 if (Param->hasUninstantiatedDefaultArg())
4187 Param->setDefaultArg(DefaultArg);
4192 auto *FD = cast<FieldDecl>(D);
4193 auto *DefaultInit = Record.readExpr();
4197 if (FD->hasInClassInitializer() && !FD->getInClassInitializer()) {
4199 FD->setInClassInitializer(DefaultInit);
4203 FD->removeInClassInitializer();
4209 auto *FD = cast<FunctionDecl>(D);
4210 if (Reader.PendingBodies[FD]) {
4216 if (Record.readInt()) {
4224 FD->setInnerLocStart(ReadSourceLocation());
4225 ReadFunctionDefinition(FD);
4226 assert(Record.getIdx() == Record.size() &&
"lazy body must be last");
4231 auto *RD = cast<CXXRecordDecl>(D);
4232 auto *OldDD = RD->getCanonicalDecl()->DefinitionData;
4233 bool HadRealDefinition =
4234 OldDD && (OldDD->Definition != RD ||
4235 !Reader.PendingFakeDefinitionData.count(OldDD));
4236 RD->setParamDestroyedInCallee(Record.readInt());
4237 RD->setArgPassingRestrictions(
4239 ReadCXXRecordDefinition(RD,
true);
4242 uint64_t LexicalOffset = ReadLocalOffset();
4243 if (!HadRealDefinition && LexicalOffset) {
4244 Record.readLexicalDeclContextStorage(LexicalOffset, RD);
4245 Reader.PendingFakeDefinitionData.erase(OldDD);
4251 RD->getMemberSpecializationInfo()) {
4252 MSInfo->setTemplateSpecializationKind(TSK);
4253 MSInfo->setPointOfInstantiation(POI);
4255 auto *Spec = cast<ClassTemplateSpecializationDecl>(RD);
4256 Spec->setTemplateSpecializationKind(TSK);
4257 Spec->setPointOfInstantiation(POI);
4259 if (Record.readInt()) {
4261 ReadDeclAs<ClassTemplatePartialSpecializationDecl>();
4263 Record.readTemplateArgumentList(TemplArgs);
4269 if (!Spec->getSpecializedTemplateOrPartial()
4271 Spec->setInstantiationOf(PartialSpec, TemplArgList);
4276 RD->setLocation(ReadSourceLocation());
4277 RD->setLocStart(ReadSourceLocation());
4278 RD->setBraceRange(ReadSourceRange());
4280 if (Record.readInt()) {
4282 Record.readAttributes(Attrs);
4294 auto *Del = ReadDeclAs<FunctionDecl>();
4296 auto *ThisArg = Record.readExpr();
4298 if (!First->OperatorDelete) {
4299 First->OperatorDelete = Del;
4300 First->OperatorDeleteThisArg = ThisArg;
4308 Record.readExceptionSpec(ExceptionStorage, ESI);
4311 auto *FD = cast<FunctionDecl>(D);
4317 FPT->getReturnType(), FPT->getParamTypes(),
4318 FPT->getExtProtoInfo().withExceptionSpec(ESI)));
4322 Reader.PendingExceptionSpecUpdates.insert(
4323 std::make_pair(FD->getCanonicalDecl(), FD));
4330 QualType DeducedResultType = Record.readType();
4333 auto *FD = cast<FunctionDecl>(Redecl);
4357 ReadSourceRange()));
4362 auto *Exported = cast<NamedDecl>(D);
4363 if (
auto *TD = dyn_cast<TagDecl>(Exported))
4364 Exported = TD->getDefinition();
4369 Reader.PendingMergedDefinitionsToDeduplicate.insert(
4370 cast<NamedDecl>(Exported));
4374 Reader.HiddenNamesMap[Owner].push_back(Exported);
4377 Exported->setVisibleDespiteOwningModule();
4385 Record.readAttributes(Attrs);
4386 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.
SourceLocation readSourceLocation()
Read a source location, advancing Idx.
void VisitClassScopeFunctionSpecializationDecl(ClassScopeFunctionSpecializationDecl *D)
static const Decl * getCanonicalDecl(const Decl *D)
void setImplicit(bool I=true)
Represents a function declaration or definition.
void setNonTrivialToPrimitiveDestroy(bool V)
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.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))
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 setNonTrivialToPrimitiveDefaultInitialize(bool V)
void VisitObjCIvarDecl(ObjCIvarDecl *D)
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
FunctionType - C99 6.7.5.3 - Function Declarators.
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)
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...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
unsigned Generation
The generation of which this module file is a part.
static AccessSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents the declaration of a typedef-name via the 'typedef' type specifier.
C Language Family Type Representation.
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)
static void attachLatestDeclImpl(Redeclarable< DeclT > *D, Decl *Latest)
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
Defines the clang::Module class, which describes a module in the source code.
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 setArgPassingRestrictions(ArgPassingKind Kind)
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
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.
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
static Decl * getMostRecentDecl(Decl *D)
known_categories_range known_categories() const
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)
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
Represents an empty-declaration.
bool isOutOfDate() const
Determine whether the information for this identifier is out of date with respect to the external sou...
void setParams(ArrayRef< ParmVarDecl *> NewParamInfo)
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.
Represent a C++ namespace.
A ObjCPropertyDecl record.
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 readQualifierInfo(QualifierInfo &Info)
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.
This is a module that was defined by a module map and built out of header files.
static CapturedDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumParams)
QualType getElementType() const
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.
Represents a variable declaration or definition.
void VisitNamedDecl(NamedDecl *ND)
Declaration of a redeclarable template.
An OMPCapturedExprDecl record.
const T * getAs() const
Member-template getAs<specific type>'.
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)
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getODRHash() const
void setSelfDecl(ImplicitParamDecl *SD)
void VisitTypeAliasDecl(TypeAliasDecl *TD)
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
unsigned IsExplicitSpecified
A TemplateTemplateParmDecl record.
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...
Module * getSubmodule(serialization::SubmoduleID GlobalID)
Retrieve the submodule that corresponds to a global submodule ID.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
RedeclarableResult VisitTagDecl(TagDecl *TD)
iterator begin(DeclarationName Name)
begin - Returns an iterator for decls with the name 'Name'.
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.
Represents a struct/union/class.
Description of a constructor that was inherited from a base class.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
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.
T * readDeclAs()
Reads a declaration from the given position in the record, advancing Idx.
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.
LambdaCaptureKind
The different capture forms in a lambda introducer.
Represents a member of a struct/union/class.
void setBlockMissingReturnType(bool val)
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
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...
ArgPassingKind
Enum that represents the different ways arguments are passed to and returned from function calls...
RedeclarableResult VisitVarTemplateSpecializationDeclImpl(VarTemplateSpecializationDecl *D)
TODO: Unify with ClassTemplateSpecializationDecl version? May require unifying ClassTemplate(Partial)...
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.
static NamespaceDecl * getNamespace(const NestedNameSpecifier *X)
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)
Defines the clang::attr::Kind enum.
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)
TypeSourceInfo * getTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
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...
A IndirectFieldDecl record.
size_t size() const
The length of this 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.
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
static llvm::iterator_range< MergedRedeclIterator< DeclT > > merged_redecls(DeclT *D)
ObjCContainerDecl - Represents a container for method declarations.
void setAccessControl(AccessControl ac)
static void attachLatestDecl(Decl *D, Decl *latest)
< Capturing the *this object by copy
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)
void setParamDestroyedInCallee(bool V)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
A ConstructorUsingShadowDecl record.
A UsingDirecitveDecl record.
void ReadFunctionDefinition(FunctionDecl *FD)
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
static UnresolvedUsingTypenameDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitCXXRecordDecl(CXXRecordDecl *D)
static ClassTemplateSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setSuperClass(ObjCInterfaceDecl *superCls)
A DecompositionDecl record.
Represents a declaration of a type.
void setHasObjectMember(bool val)
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.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
DeclID VisitTemplateDecl(TemplateDecl *D)
SourceRange readSourceRange()
Read a source range, advancing Idx.
void setClassInterface(ObjCInterfaceDecl *D)
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
static FileScopeAsmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitCXXMethodDecl(CXXMethodDecl *D)
void UpdateDecl(Decl *D, SmallVectorImpl< serialization::DeclID > &)
Defines the Linkage enumeration and various utility functions.
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)
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)
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
A binding in a decomposition declaration.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
void setInitVal(const llvm::APSInt &V)
void setInitExpr(Expr *E)
void setCachedLinkage(Linkage L) const
void setLocStart(SourceLocation L)
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
void setGetterCXXConstructor(Expr *getterCXXConstructor)
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
void setInline(bool Inline)
Set whether this is an inline namespace declaration.
static CXXDeductionGuideDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
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)
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Represents a prototype with parameter type info, e.g.
RedeclarableResult VisitRedeclarable(Redeclarable< T > *D)
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)
void setIvarRBraceLoc(SourceLocation Loc)
A StaticAssertDecl record.
for(unsigned I=0, E=TL.getNumArgs();I !=E;++I)
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.
DiagnosticBuilder Diag(unsigned DiagID) const
Report a diagnostic.
void setType(QualType T, TypeSourceInfo *TSI)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Expr - This represents one expression.
A ObjCCategoryImplDecl record.
Defines the clang::LangOptions interface.
void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *GD)
void setBitWidth(Expr *Width)
Set the bit-field width for this member.
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
A ObjCPropertyImplDecl record.
Declaration of a template type parameter.
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
const T * castAs() const
Member-template castAs<specific type>.
Represents a C++ destructor within a class.
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
void setInvalidDecl(bool Invalid=true)
setInvalidDecl - Indicates the Decl had a semantic error.
A CXXConstructorDecl record.
void VisitTypedefDecl(TypedefDecl *TD)
Module * getImportedOwningModule() const
Get the imported owning module, if this decl is from an imported (non-local) module.
void setContextParam(unsigned i, ImplicitParamDecl *P)
void setAtEndRange(SourceRange atEnd)
void setRBraceLoc(SourceLocation L)
static DeclLink PreviousDeclLink(decl_type *D)
DeclContext * getDeclContext()
A record containing CXXCtorInitializers.
A VarTemplateDecl record.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl *> typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
void setMemberSpecialization()
Note that this member template is a specialization.
Decl * readDecl()
Reads a declaration from the given position in a record in the given module, advancing Idx...
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
bool isTemplateParameter() const
isTemplateParameter - Determines whether this declaration is a template parameter.
void setDefined(bool isDefined)
bool isTemplateParameterPack() const
isTemplateParameter - Determines whether this declaration is a template parameter pack...
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)
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
const uint64_t & back() const
The last element in this record.
A CXXDestructorDecl record.
SmallVector< uint64_t, 1 > ObjCCategories
The Objective-C category lists for categories known to this module.
unsigned IsCopyDeductionCandidate
[C++17] Only used by CXXDeductionGuideDecl.
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack...
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, bool InheritsConstructor)
bool isFunctionOrMethod() const
StorageClass
Storage classes.
void mergeClassExtensionProtocolList(ObjCProtocolDecl *const *List, unsigned Num, ASTContext &C)
mergeClassExtensionProtocolList - Merge class extension's protocol list into the protocol list for th...
static bool isConsumerInterestedIn(ASTContext &Ctx, Decl *D, bool HasBody)
Determine whether the consumer will be interested in seeing this declaration (via HandleTopLevelDecl)...
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.
unsigned IsScopedUsingClassTag
If this tag declaration is a scoped enum, then this is true if the scoped enum was declared using the...
void setModedTypeSourceInfo(TypeSourceInfo *unmodedTSI, QualType modedTy)
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
QualType getFunctionType(QualType ResultTy, ArrayRef< QualType > Args, const FunctionProtoType::ExtProtoInfo &EPI) const
Return a normal function type with a typed argument list.
void setLocation(SourceLocation L)
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)
Represents a C++ deduction guide declaration.
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)
std::string readString()
Read a string, advancing Idx.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
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)
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.
unsigned readRecord(llvm::BitstreamCursor &Cursor, unsigned AbbrevID)
Reads a record with id AbbrevID from Cursor, resetting the internal state.
void setIsVariadic(bool value)
static bool isSameQualifier(const NestedNameSpecifier *X, const NestedNameSpecifier *Y)
void VisitCXXConstructorDecl(CXXConstructorDecl *D)
static PragmaDetectMismatchDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NameValueSize)
uint32_t SubmoduleID
An ID number that refers to a submodule in a module file.
Represents a C++ Modules TS module export declaration.
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
void setColonLoc(SourceLocation CLoc)
Sets the location of the colon.
An UnresolvedUsingValueDecl record.
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)
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)
Represents the declaration of a struct/union/class/enum.
ASTContext & getASTContext() const LLVM_READONLY
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
Defines several types used to describe C++ lambda expressions that are shared between the parser and ...
void setReferenced(bool R=true)
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)
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.
This file defines OpenMP nodes for declarative directives.
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Data that is common to all of the declarations of a given function template.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
ObjCCategoryDecl - Represents a category declaration.
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
void readDeclarationNameLoc(DeclarationNameLoc &DNLoc, DeclarationName Name)
void addDecl(NamedDecl *D)
void setDeclName(DeclarationName N)
Set the name of this declaration.
static MSPropertyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
SourceLocation getLocation() const
static ConstructorUsingShadowDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Describes the categories of an Objective-C class.
bool isDeclIDFromModule(serialization::GlobalDeclID ID, ModuleFile &M) const
Returns true if global DeclID ID originated from module M.
void init(NamedDecl *templatedDecl, TemplateParameterList *templateParams)
Initialize the underlying templated declaration and template parameters.
void setTagKind(TagKind TK)
unsigned getIdx() const
The current position in this record.
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.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
uint32_t TypeID
An ID number that refers to a type in an AST file.
void setInitializer(Expr *E, InitKind IK)
Set initializer expression for the declare reduction construct.
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)
void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
void VisitRecordDecl(RecordDecl *RD)
static T assert_cast(T t)
"Cast" to type T, asserting if we don't have an implicit conversion.
serialization::SubmoduleID getGlobalSubmoduleID(unsigned LocalID)
Retrieve the global submodule ID its local ID number.
static VarTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Create an empty variable template node.
Represents a C++11 static_assert declaration.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
uint32_t BitOffset
Offset in the AST file.
void setLAngleLoc(SourceLocation Loc)
void VisitExportDecl(ExportDecl *D)
void addArgument(const TemplateArgumentLoc &Loc)
File is a PCH file treated as the actual main file.
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
serialization::DeclID readDeclID()
Reads a declaration ID from the given position in this record.
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...
bool hasPendingBody() const
Determine whether this declaration has a pending body.
Defines various enumerations that describe declaration and type specifiers.
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.
void setPropertyDecl(ObjCPropertyDecl *Prop)
A CXXConversionDecl record.
TagTypeKind
The kind of a tag type.
ObjCTypeParamList * ReadObjCTypeParamList()
Dataflow Directional Tag Classes.
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)
Reads an AST files chain containing the contents of a translation unit.
Represents a field injected from an anonymous union/struct into the parent scope. ...
A ClassTemplatePartialSpecializationDecl record.
void setUsingLoc(SourceLocation L)
Set the source location of the 'using' keyword.
DeclCode
Record codes for each kind of declaration.
unsigned 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...
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)
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
static bool allowODRLikeMergeInC(NamedDecl *ND)
ODR-like semantics for C/ObjC allow us to merge tag types and a structural check in Sema guarantees t...
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*.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
static FriendTemplateDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static LabelDecl * CreateDeserialized(ASTContext &C, unsigned ID)
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
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.
SmallVector< uint64_t, 64 > RecordData
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...
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
bool isIncompleteArrayType() const
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 setInstantiatedFromMemberTemplate(RedeclarableTemplateDecl *TD)
QualType getCanonicalTypeInternal() const
void setHasNonZeroConstructors(bool val)
static ClassTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
LanguageIDs
Represents the language in a linkage specification.
uint64_t getGlobalBitOffset(uint32_t LocalOffset)
Get the global offset corresponding to a local offset.
static ImplicitParamDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static RecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
void setCombiner(Expr *E)
Set combiner expression for the declare reduction construct.
static CXXMethodDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setTypeSourceInfo(TypeSourceInfo *TI)
TypeSourceInfo * getTypeSourceInfo() const
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 ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
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 setCategoryListRaw(ObjCCategoryDecl *category)
Set the raw pointer to the start of the category/extension list.
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)
bool IsClassExtension() const
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
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
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(...).
TranslationUnitDecl * getTranslationUnitDecl() const
static Decl * getMostRecentDeclImpl(Redeclarable< DeclT > *D)
Defines the clang::SourceLocation class and associated facilities.
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 setInstanceMethod(bool isInst)
void SetRelatedResultType(bool RRT=true)
Note whether this method has a related result type.
void setClassInterface(ObjCInterfaceDecl *IFace)
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)
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...
An object for streaming information from a record.
void VisitBlockDecl(BlockDecl *BD)
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
void VisitIndirectFieldDecl(IndirectFieldDecl *FD)
unsigned varlist_size() const
VarDeclBitfields VarDeclBits
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
virtual CommonBase * newCommon(ASTContext &C) const =0
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)
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)
bool isUnresolvedExceptionSpec(ExceptionSpecificationType ESpecType)
void setCaptures(ASTContext &Context, ArrayRef< Capture > Captures, bool CapturesCXXThis)
A trivial tuple used to represent a source range.
void setIntegerTypeSourceInfo(TypeSourceInfo *TInfo)
Set the underlying integer type source info.
This represents a decl that may have a name.
void VisitVarTemplateDecl(VarTemplateDecl *D)
TODO: Unify with ClassTemplateDecl version? May require unifying ClassTemplateDecl and VarTemplateDec...
bool isTranslationUnit() const
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.
void VisitTranslationUnitDecl(TranslationUnitDecl *TU)
static BindingDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setType(QualType newType)
const LangOptions & getLangOpts() const
void setNonTrivialToPrimitiveCopy(bool V)
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 setPropertyIvarDecl(ObjCIvarDecl *Ivar)
Source range/offset of a preprocessed entity.
Attr - This represents one attribute.
SourceLocation getLocation() const
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...
QualType getType() const
Return the type wrapped by this type source info.
Defines the LambdaCapture class.
ObjCCompatibleAliasDecl - Represents alias of a class.
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.
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
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.