26 #include "llvm/Support/SaveAndRestore.h" 28 using namespace clang;
39 ASTReader::RecordLocation Loc;
44 unsigned AnonymousDeclNumber;
53 bool IsDeclMarkedUsed;
55 uint64_t GetCurrentCursorOffset();
57 uint64_t ReadLocalOffset() {
58 uint64_t LocalOffset = Record.
readInt();
59 assert(LocalOffset < Loc.Offset &&
"offset point after current record");
60 return LocalOffset ? Loc.Offset - LocalOffset : 0;
63 uint64_t ReadGlobalOffset() {
64 uint64_t Local = ReadLocalOffset();
84 std::string ReadString() {
89 for (
unsigned I = 0, Size = Record.
readInt(); I != Size; ++I)
90 IDs.push_back(ReadDeclID());
122 void ReadCXXDefinitionData(
struct CXXRecordDecl::DefinitionData &Data,
125 struct CXXRecordDecl::DefinitionData &&NewDD);
126 void ReadObjCDefinitionData(
struct ObjCInterfaceDecl::DefinitionData &Data);
128 struct ObjCInterfaceDecl::DefinitionData &&NewDD);
129 void ReadObjCDefinitionData(
struct ObjCProtocolDecl::DefinitionData &Data);
131 struct ObjCProtocolDecl::DefinitionData &&NewDD);
140 class RedeclarableResult {
147 : MergeWith(MergeWith), FirstID(FirstID), IsKeyDecl(IsKeyDecl) {}
153 bool isKeyDecl()
const {
return IsKeyDecl; }
157 Decl *getKnownMergeTarget()
const {
return MergeWith; }
165 class FindExistingResult {
171 unsigned AnonymousDeclNumber;
174 void operator=(FindExistingResult &&) =
delete;
178 : Reader(Reader), New(
nullptr), Existing(
nullptr), AddResult(
false),
179 AnonymousDeclNumber(0), TypedefNameForLinkage(
nullptr) {}
182 unsigned AnonymousDeclNumber,
184 : Reader(Reader), New(New), Existing(Existing), AddResult(
true),
185 AnonymousDeclNumber(AnonymousDeclNumber),
186 TypedefNameForLinkage(TypedefNameForLinkage) {}
188 FindExistingResult(FindExistingResult &&Other)
189 : Reader(Other.Reader), New(Other.New), Existing(Other.Existing),
190 AddResult(Other.AddResult),
191 AnonymousDeclNumber(Other.AnonymousDeclNumber),
192 TypedefNameForLinkage(Other.TypedefNameForLinkage) {
193 Other.AddResult =
false;
196 ~FindExistingResult();
200 void suppress() { AddResult =
false; }
202 operator NamedDecl*()
const {
return Existing; }
205 operator T*()
const {
return dyn_cast_or_null<T>(Existing); }
210 FindExistingResult findExisting(
NamedDecl *D);
214 ASTReader::RecordLocation Loc,
216 : Reader(Reader), Record(Record), Loc(Loc),
217 ThisDeclID(thisDeclID), ThisDeclLoc(ThisDeclLoc),
218 TypeIDForTypeDecl(0), NamedDeclForTagDecl(0),
219 TypedefNameForLinkage(nullptr), HasPendingBody(
false),
220 IsDeclMarkedUsed(
false) {}
222 template <
typename T>
static 231 auto *&LazySpecializations = D->getCommonPtr()->LazySpecializations;
233 if (
auto &Old = LazySpecializations) {
234 IDs.insert(IDs.end(), Old + 1, Old + 1 + Old[0]);
235 std::sort(IDs.begin(), IDs.end());
236 IDs.erase(std::unique(IDs.begin(), IDs.end()), IDs.end());
240 *Result = IDs.size();
241 std::copy(IDs.begin(), IDs.end(), Result + 1);
243 LazySpecializations = Result;
246 template <
typename DeclT>
248 static Decl *getMostRecentDeclImpl(...);
249 static Decl *getMostRecentDecl(
Decl *D);
251 template <
typename DeclT>
252 static void attachPreviousDeclImpl(
ASTReader &Reader,
255 static void attachPreviousDeclImpl(
ASTReader &Reader, ...);
259 template <
typename DeclT>
261 static void attachLatestDeclImpl(...);
262 static void attachLatestDecl(
Decl *D,
Decl *latest);
264 template <
typename DeclT>
266 static void markIncompleteDeclChainImpl(...);
278 Cat->NextClassCategory = Next;
281 void VisitDecl(
Decl *D);
295 RedeclarableResult VisitTagDecl(
TagDecl *TD);
297 RedeclarableResult VisitRecordDeclImpl(
RecordDecl *RD);
301 RedeclarableResult VisitClassTemplateSpecializationDeclImpl(
305 VisitClassTemplateSpecializationDeclImpl(D);
307 void VisitClassTemplatePartialSpecializationDecl(
309 void VisitClassScopeFunctionSpecializationDecl(
314 VisitVarTemplateSpecializationDeclImpl(D);
316 void VisitVarTemplatePartialSpecializationDecl(
332 RedeclarableResult VisitVarDeclImpl(
VarDecl *D);
363 std::pair<uint64_t, uint64_t> VisitDeclContext(
DeclContext *DC);
370 DeclID TemplatePatternID = 0);
374 RedeclarableResult &Redecl,
375 DeclID TemplatePatternID = 0);
382 DeclID DsID,
bool IsKeyDecl);
410 template<
typename DeclT>
411 class MergedRedeclIterator {
412 DeclT *Start, *Canonical, *Current;
414 MergedRedeclIterator() : Current(
nullptr) {}
415 MergedRedeclIterator(DeclT *Start)
416 : Start(Start), Canonical(
nullptr), Current(Start) {}
420 MergedRedeclIterator &operator++() {
421 if (Current->isFirstDecl()) {
423 Current = Current->getMostRecentDecl();
425 Current = Current->getPreviousDecl();
431 if (Current == Start || Current == Canonical)
436 friend bool operator!=(
const MergedRedeclIterator &A,
437 const MergedRedeclIterator &B) {
438 return A.Current != B.Current;
443 template <
typename DeclT>
444 static llvm::iterator_range<MergedRedeclIterator<DeclT>>
446 return llvm::make_range(MergedRedeclIterator<DeclT>(D),
447 MergedRedeclIterator<DeclT>());
450 uint64_t ASTDeclReader::GetCurrentCursorOffset() {
451 return Loc.F->DeclsCursor.GetCurrentBitNo() + Loc.F->GlobalBitOffset;
455 if (Record.readInt())
457 if (
auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
458 CD->NumCtorInitializers = Record.readInt();
459 if (CD->NumCtorInitializers)
460 CD->CtorInitializers = ReadGlobalOffset();
463 Reader.PendingBodies[FD] = GetCurrentCursorOffset();
464 HasPendingBody =
true;
473 IsDeclMarkedUsed =
false;
477 DeclaratorDecl::ExtInfo *Info =
478 DD->DeclInfo.get<DeclaratorDecl::ExtInfo *>();
479 Info->TInfo = GetTypeSourceInfo();
482 DD->DeclInfo = GetTypeSourceInfo();
486 if (
TypeDecl *TD = dyn_cast<TypeDecl>(D)) {
488 TD->setTypeForDecl(Reader.GetType(TypeIDForTypeDecl).getTypePtrOrNull());
492 if (NamedDeclForTagDecl)
493 cast<TagDecl>(D)->TypedefNameDeclOrQualifier =
494 cast<TypedefNameDecl>(Reader.GetDecl(NamedDeclForTagDecl));
497 ID->TypeForDecl = Reader.GetType(TypeIDForTypeDecl).getTypePtrOrNull();
498 }
else if (
FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
503 if (Record.readInt())
504 ReadFunctionDefinition(FD);
510 isa<ParmVarDecl>(D)) {
517 GlobalDeclID SemaDCIDForTemplateParmDecl = ReadDeclID();
518 GlobalDeclID LexicalDCIDForTemplateParmDecl = ReadDeclID();
519 if (!LexicalDCIDForTemplateParmDecl)
520 LexicalDCIDForTemplateParmDecl = SemaDCIDForTemplateParmDecl;
521 Reader.addPendingDeclContextInfo(D,
522 SemaDCIDForTemplateParmDecl,
523 LexicalDCIDForTemplateParmDecl);
527 DeclContext *LexicalDC = ReadDeclAs<DeclContext>();
533 D->setDeclContextsImpl(MergedSemaDC ? MergedSemaDC : SemaDC, LexicalDC,
534 Reader.getContext());
538 if (Record.readInt()) {
540 Record.readAttributes(Attrs);
543 D->setAttrsImpl(Attrs, Reader.getContext());
546 D->Used = Record.readInt();
547 IsDeclMarkedUsed |= D->Used;
552 bool ModulePrivate = Record.readInt();
566 }
else if (Reader.getContext().getLangOpts().ModulesLocalVisibility) {
574 Reader.HiddenNamesMap[Owner].push_back(D);
576 }
else if (ModulePrivate) {
585 std::string Arg = ReadString();
586 memcpy(D->getTrailingObjects<
char>(), Arg.data(), Arg.size());
587 D->getTrailingObjects<
char>()[Arg.size()] =
'\0';
593 std::string Name = ReadString();
594 memcpy(D->getTrailingObjects<
char>(), Name.data(), Name.size());
595 D->getTrailingObjects<
char>()[Name.size()] =
'\0';
597 D->ValueStart = Name.size() + 1;
598 std::string
Value = ReadString();
599 memcpy(D->getTrailingObjects<
char>() + D->ValueStart, Value.data(),
601 D->getTrailingObjects<
char>()[D->ValueStart + Value.size()] =
'\0';
605 llvm_unreachable(
"Translation units are not serialized");
611 AnonymousDeclNumber = Record.readInt();
618 TypeIDForTypeDecl = Record.getGlobalTypeID(Record.readInt());
621 ASTDeclReader::RedeclarableResult
623 RedeclarableResult Redecl = VisitRedeclarable(TD);
626 if (Record.readInt()) {
627 QualType modedT = Record.readType();
640 RedeclarableResult Redecl = VisitTypedefNameDecl(TD);
641 mergeRedeclarable(TD, Redecl);
645 RedeclarableResult Redecl = VisitTypedefNameDecl(TD);
646 if (
auto *Template = ReadDeclAs<TypeAliasTemplateDecl>())
650 mergeRedeclarable(TD, Redecl);
654 RedeclarableResult Redecl = VisitRedeclarable(TD);
659 if (!isa<CXXRecordDecl>(TD))
666 switch (Record.readInt()) {
671 ReadQualifierInfo(*Info);
672 TD->TypedefNameDeclOrQualifier = Info;
676 NamedDeclForTagDecl = ReadDeclID();
677 TypedefNameForLinkage = Record.getIdentifierInfo();
680 llvm_unreachable(
"unexpected tag info kind");
683 if (!isa<CXXRecordDecl>(TD))
684 mergeRedeclarable(TD, Redecl);
699 ED->
IsFixed = Record.readInt();
703 if (ED->IsCompleteDefinition &&
704 Reader.getContext().getLangOpts().Modules &&
705 Reader.getContext().getLangOpts().CPlusPlus) {
711 if (!D->isFromASTFile() && D->isCompleteDefinition()) {
718 Reader.MergedDeclContexts.insert(std::make_pair(ED, OldDef));
719 ED->IsCompleteDefinition =
false;
720 Reader.mergeDefinitionVisibility(OldDef, ED);
726 if (
EnumDecl *InstED = ReadDeclAs<EnumDecl>()) {
730 ED->setInstantiationOfMemberEnum(Reader.getContext(), InstED, TSK);
735 ASTDeclReader::RedeclarableResult
737 RedeclarableResult Redecl = VisitTagDecl(RD);
747 VD->
setType(Record.readType());
752 if (Record.readInt())
761 if (Record.readInt()) {
762 DeclaratorDecl::ExtInfo *Info
763 =
new (Reader.getContext()) DeclaratorDecl::ExtInfo();
764 ReadQualifierInfo(*Info);
770 RedeclarableResult Redecl = VisitRedeclarable(FD);
771 VisitDeclaratorDecl(FD);
773 ReadDeclarationNameLoc(FD->DNLoc, FD->
getDeclName());
780 FD->IsInline = Record.readInt();
781 FD->IsInlineSpecified = Record.readInt();
783 FD->IsVirtualAsWritten = Record.readInt();
784 FD->IsPure = Record.readInt();
785 FD->HasInheritedPrototype = Record.readInt();
786 FD->HasWrittenPrototype = Record.readInt();
787 FD->IsDeleted = Record.readInt();
788 FD->IsTrivial = Record.readInt();
789 FD->IsDefaulted = Record.readInt();
790 FD->IsExplicitlyDefaulted = Record.readInt();
791 FD->HasImplicitReturnZero = Record.readInt();
792 FD->IsConstexpr = Record.readInt();
793 FD->UsesSEHTry = Record.readInt();
794 FD->HasSkippedBody = Record.readInt();
795 FD->IsLateTemplateParsed = Record.readInt();
797 FD->EndRangeLoc = ReadSourceLocation();
799 FD->ODRHash = Record.readInt();
800 FD->HasODRHash =
true;
804 mergeRedeclarable(FD, Redecl);
815 FD->setInstantiationOfMemberFunction(Reader.getContext(), InstFD, TSK);
817 mergeRedeclarable(FD, Redecl);
827 Record.readTemplateArgumentList(TemplArgs,
true);
832 bool HasTemplateArgumentsAsWritten = Record.readInt();
833 if (HasTemplateArgumentsAsWritten) {
834 unsigned NumTemplateArgLocs = Record.readInt();
835 TemplArgLocs.reserve(NumTemplateArgLocs);
836 for (
unsigned i=0; i != NumTemplateArgLocs; ++i)
837 TemplArgLocs.push_back(Record.readTemplateArgumentLoc());
839 LAngleLoc = ReadSourceLocation();
840 RAngleLoc = ReadSourceLocation();
849 for (
unsigned i=0, e = TemplArgLocs.size(); i != e; ++i)
854 HasTemplateArgumentsAsWritten ? &TemplArgsInfo
857 FD->TemplateOrSpecialization = FTInfo;
868 llvm::FoldingSetNodeID
ID;
870 void *InsertPos =
nullptr;
877 assert(Reader.getContext().getLangOpts().Modules &&
878 "already deserialized this template specialization");
879 mergeRedeclarable(FD, ExistingInfo->
Function, Redecl);
887 unsigned NumTemplates = Record.readInt();
888 while (NumTemplates--)
889 TemplDecls.
addDecl(ReadDeclAs<NamedDecl>());
893 unsigned NumArgs = Record.readInt();
895 TemplArgs.
addArgument(Record.readTemplateArgumentLoc());
900 TemplDecls, TemplArgs);
908 unsigned NumParams = Record.readInt();
910 Params.reserve(NumParams);
911 for (
unsigned I = 0; I != NumParams; ++I)
912 Params.push_back(ReadDeclAs<ParmVarDecl>());
913 FD->setParams(Reader.getContext(), Params);
918 if (Record.readInt()) {
921 Reader.PendingBodies[MD] = GetCurrentCursorOffset();
922 HasPendingBody =
true;
924 MD->
setCmdDecl(ReadDeclAs<ImplicitParamDecl>());
930 MD->IsOverriding = Record.readInt();
931 MD->HasSkippedBody = Record.readInt();
933 MD->IsRedeclaration = Record.readInt();
934 MD->HasRedeclaration = Record.readInt();
935 if (MD->HasRedeclaration)
936 Reader.getContext().setObjCMethodRedeclaration(MD,
937 ReadDeclAs<ObjCMethodDecl>());
944 MD->DeclEndLoc = ReadSourceLocation();
945 unsigned NumParams = Record.readInt();
947 Params.reserve(NumParams);
948 for (
unsigned I = 0; I != NumParams; ++I)
949 Params.push_back(ReadDeclAs<ParmVarDecl>());
951 MD->SelLocsKind = Record.readInt();
952 unsigned NumStoredSelLocs = Record.readInt();
954 SelLocs.reserve(NumStoredSelLocs);
955 for (
unsigned i = 0; i != NumStoredSelLocs; ++i)
956 SelLocs.push_back(ReadSourceLocation());
958 MD->setParamsAndSelLocs(Reader.getContext(), Params, SelLocs);
962 VisitTypedefNameDecl(D);
964 D->Variance = Record.readInt();
965 D->Index = Record.readInt();
966 D->VarianceLoc = ReadSourceLocation();
967 D->ColonLoc = ReadSourceLocation();
977 unsigned numParams = Record.readInt();
982 typeParams.reserve(numParams);
983 for (
unsigned i = 0; i != numParams; ++i) {
984 auto typeParam = ReadDeclAs<ObjCTypeParamDecl>();
988 typeParams.push_back(typeParam);
995 typeParams, rAngleLoc);
998 void ASTDeclReader::ReadObjCDefinitionData(
999 struct ObjCInterfaceDecl::DefinitionData &Data) {
1001 Data.SuperClassTInfo = GetTypeSourceInfo();
1003 Data.EndLoc = ReadSourceLocation();
1004 Data.HasDesignatedInitializers = Record.readInt();
1007 unsigned NumProtocols = Record.readInt();
1009 Protocols.reserve(NumProtocols);
1010 for (
unsigned I = 0; I != NumProtocols; ++I)
1011 Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>());
1013 ProtoLocs.reserve(NumProtocols);
1014 for (
unsigned I = 0; I != NumProtocols; ++I)
1015 ProtoLocs.push_back(ReadSourceLocation());
1016 Data.ReferencedProtocols.set(Protocols.data(), NumProtocols, ProtoLocs.data(),
1017 Reader.getContext());
1020 NumProtocols = Record.readInt();
1022 Protocols.reserve(NumProtocols);
1023 for (
unsigned I = 0; I != NumProtocols; ++I)
1024 Protocols.push_back(ReadDeclAs<ObjCProtocolDecl>());
1025 Data.AllReferencedProtocols.set(Protocols.data(), NumProtocols,
1026 Reader.getContext());
1030 struct ObjCInterfaceDecl::DefinitionData &&NewDD) {
1035 RedeclarableResult Redecl = VisitRedeclarable(ID);
1036 VisitObjCContainerDecl(ID);
1037 TypeIDForTypeDecl = Record.getGlobalTypeID(Record.readInt());
1038 mergeRedeclarable(ID, Redecl);
1040 ID->TypeParamList = ReadObjCTypeParamList();
1041 if (Record.readInt()) {
1043 ID->allocateDefinitionData();
1045 ReadObjCDefinitionData(ID->data());
1047 if (Canon->Data.getPointer()) {
1050 MergeDefinitionData(Canon, std::move(ID->data()));
1051 ID->Data = Canon->Data;
1062 Reader.PendingDefinitions.insert(ID);
1065 Reader.ObjCClassesLoaded.push_back(ID);
1072 VisitFieldDecl(IVD);
1076 bool synth = Record.readInt();
1080 void ASTDeclReader::ReadObjCDefinitionData(
1081 struct ObjCProtocolDecl::DefinitionData &Data) {
1083 unsigned NumProtoRefs = Record.readInt();
1085 ProtoRefs.reserve(NumProtoRefs);
1086 for (
unsigned I = 0; I != NumProtoRefs; ++I)
1087 ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>());
1089 ProtoLocs.reserve(NumProtoRefs);
1090 for (
unsigned I = 0; I != NumProtoRefs; ++I)
1091 ProtoLocs.push_back(ReadSourceLocation());
1092 Data.ReferencedProtocols.set(ProtoRefs.data(), NumProtoRefs,
1093 ProtoLocs.data(), Reader.getContext());
1097 struct ObjCProtocolDecl::DefinitionData &&NewDD) {
1102 RedeclarableResult Redecl = VisitRedeclarable(PD);
1103 VisitObjCContainerDecl(PD);
1104 mergeRedeclarable(PD, Redecl);
1106 if (Record.readInt()) {
1108 PD->allocateDefinitionData();
1110 ReadObjCDefinitionData(PD->data());
1113 if (Canon->Data.getPointer()) {
1116 MergeDefinitionData(Canon, std::move(PD->data()));
1117 PD->Data = Canon->Data;
1124 Reader.PendingDefinitions.insert(PD);
1135 VisitObjCContainerDecl(CD);
1143 Reader.CategoriesDeserialized.insert(CD);
1145 CD->ClassInterface = ReadDeclAs<ObjCInterfaceDecl>();
1146 CD->TypeParamList = ReadObjCTypeParamList();
1147 unsigned NumProtoRefs = Record.readInt();
1149 ProtoRefs.reserve(NumProtoRefs);
1150 for (
unsigned I = 0; I != NumProtoRefs; ++I)
1151 ProtoRefs.push_back(ReadDeclAs<ObjCProtocolDecl>());
1153 ProtoLocs.reserve(NumProtoRefs);
1154 for (
unsigned I = 0; I != NumProtoRefs; ++I)
1155 ProtoLocs.push_back(ReadSourceLocation());
1157 Reader.getContext());
1161 VisitNamedDecl(CAD);
1190 VisitObjCContainerDecl(D);
1195 VisitObjCImplDecl(D);
1196 D->CategoryNameLoc = ReadSourceLocation();
1200 VisitObjCImplDecl(D);
1202 D->SuperLoc = ReadSourceLocation();
1207 D->NumIvarInitializers = Record.readInt();
1208 if (D->NumIvarInitializers)
1209 D->IvarInitializers = ReadGlobalOffset();
1216 D->PropertyIvarDecl = ReadDeclAs<ObjCIvarDecl>();
1217 D->IvarLoc = ReadSourceLocation();
1223 VisitDeclaratorDecl(FD);
1224 FD->Mutable = Record.readInt();
1226 if (
auto ISK = static_cast<FieldDecl::InitStorageKind>(Record.readInt())) {
1227 FD->InitStorage.setInt(ISK);
1228 FD->InitStorage.setPointer(ISK == FieldDecl::ISK_CapturedVLAType
1229 ? Record.readType().getAsOpaquePtr()
1230 : Record.readExpr());
1233 if (
auto *BW = Record.readExpr())
1237 if (
FieldDecl *Tmpl = ReadDeclAs<FieldDecl>())
1238 Reader.getContext().setInstantiatedFromUnnamedFieldDecl(FD, Tmpl);
1244 VisitDeclaratorDecl(PD);
1245 PD->GetterId = Record.getIdentifierInfo();
1246 PD->SetterId = Record.getIdentifierInfo();
1252 FD->ChainingSize = Record.readInt();
1253 assert(FD->ChainingSize >= 2 &&
"Anonymous chaining must be >= 2");
1254 FD->Chaining =
new (Reader.getContext())
NamedDecl*[FD->ChainingSize];
1256 for (
unsigned I = 0; I != FD->ChainingSize; ++I)
1257 FD->Chaining[I] = ReadDeclAs<NamedDecl>();
1263 RedeclarableResult Redecl = VisitRedeclarable(VD);
1264 VisitDeclaratorDecl(VD);
1269 if (!isa<ParmVarDecl>(VD)) {
1291 if (uint64_t Val = Record.readInt()) {
1292 VD->
setInit(Record.readExpr());
1296 Eval->
IsICE = Val == 3;
1304 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1306 switch ((VarKind)Record.readInt()) {
1307 case VarNotTemplate:
1310 if (!isa<ParmVarDecl>(VD) && !isa<ImplicitParamDecl>(VD) &&
1311 !isa<VarTemplateSpecializationDecl>(VD))
1312 mergeRedeclarable(VD, Redecl);
1316 VD->setDescribedVarTemplate(ReadDeclAs<VarTemplateDecl>());
1318 case StaticDataMemberSpecialization: {
1319 VarDecl *Tmpl = ReadDeclAs<VarDecl>();
1323 Reader.getContext().setInstantiatedFromStaticDataMember(VD, Tmpl, TSK,POI);
1324 mergeRedeclarable(VD, Redecl);
1338 unsigned isObjCMethodParam = Record.readInt();
1339 unsigned scopeDepth = Record.readInt();
1340 unsigned scopeIndex = Record.readInt();
1341 unsigned declQualifier = Record.readInt();
1342 if (isObjCMethodParam) {
1343 assert(scopeDepth == 0);
1351 if (Record.readInt())
1361 for (
unsigned I = 0; I != DD->NumBindings; ++I)
1362 BDs[I] = ReadDeclAs<BindingDecl>();
1367 BD->Binding = Record.readExpr();
1372 AD->
setAsmString(cast<StringLiteral>(Record.readExpr()));
1378 BD->
setBody(cast_or_null<CompoundStmt>(Record.readStmt()));
1380 unsigned NumParams = Record.readInt();
1382 Params.reserve(NumParams);
1383 for (
unsigned I = 0; I != NumParams; ++I)
1384 Params.push_back(ReadDeclAs<ParmVarDecl>());
1391 bool capturesCXXThis = Record.readInt();
1392 unsigned numCaptures = Record.readInt();
1394 captures.reserve(numCaptures);
1395 for (
unsigned i = 0; i != numCaptures; ++i) {
1397 unsigned flags = Record.readInt();
1398 bool byRef = (flags & 1);
1399 bool nested = (flags & 2);
1400 Expr *copyExpr = ((flags & 4) ? Record.readExpr() :
nullptr);
1404 BD->
setCaptures(Reader.getContext(), captures, capturesCXXThis);
1409 unsigned ContextParamPos = Record.readInt();
1412 for (
unsigned I = 0; I < CD->NumParams; ++I) {
1413 if (I != ContextParamPos)
1414 CD->
setParam(I, ReadDeclAs<ImplicitParamDecl>());
1429 D->RBraceLoc = ReadSourceLocation();
1438 RedeclarableResult Redecl = VisitRedeclarable(D);
1441 D->LocStart = ReadSourceLocation();
1442 D->RBraceLoc = ReadSourceLocation();
1449 if (Redecl.getFirstID() == ThisDeclID) {
1450 AnonNamespace = ReadDeclID();
1454 D->AnonOrFirstNamespaceAndInline.setPointer(D->
getFirstDecl());
1457 mergeRedeclarable(D, Redecl);
1459 if (AnonNamespace) {
1463 NamespaceDecl *Anon = cast<NamespaceDecl>(Reader.GetDecl(AnonNamespace));
1464 if (!Record.isModule())
1470 RedeclarableResult Redecl = VisitRedeclarable(D);
1472 D->NamespaceLoc = ReadSourceLocation();
1473 D->IdentLoc = ReadSourceLocation();
1474 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1475 D->Namespace = ReadDeclAs<NamedDecl>();
1476 mergeRedeclarable(D, Redecl);
1482 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1483 ReadDeclarationNameLoc(D->DNLoc, D->
getDeclName());
1484 D->FirstUsingShadow.setPointer(ReadDeclAs<UsingShadowDecl>());
1486 if (
NamedDecl *Pattern = ReadDeclAs<NamedDecl>())
1487 Reader.getContext().setInstantiatedFromUsingDecl(D, Pattern);
1493 D->InstantiatedFrom = ReadDeclAs<NamedDecl>();
1495 for (
unsigned I = 0; I != D->NumExpansions; ++I)
1496 Expansions[I] = ReadDeclAs<NamedDecl>();
1501 RedeclarableResult Redecl = VisitRedeclarable(D);
1504 D->UsingOrNextShadow = ReadDeclAs<NamedDecl>();
1507 Reader.getContext().setInstantiatedFromUsingShadowDecl(D, Pattern);
1508 mergeRedeclarable(D, Redecl);
1513 VisitUsingShadowDecl(D);
1514 D->NominatedBaseClassShadowDecl = ReadDeclAs<ConstructorUsingShadowDecl>();
1515 D->ConstructedBaseClassShadowDecl = ReadDeclAs<ConstructorUsingShadowDecl>();
1516 D->IsVirtual = Record.readInt();
1521 D->UsingLoc = ReadSourceLocation();
1522 D->NamespaceLoc = ReadSourceLocation();
1523 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1524 D->NominatedNamespace = ReadDeclAs<NamedDecl>();
1525 D->CommonAncestor = ReadDeclAs<DeclContext>();
1531 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1532 ReadDeclarationNameLoc(D->DNLoc, D->
getDeclName());
1533 D->EllipsisLoc = ReadSourceLocation();
1540 D->TypenameLocation = ReadSourceLocation();
1541 D->QualifierLoc = Record.readNestedNameSpecifierLoc();
1542 D->EllipsisLoc = ReadSourceLocation();
1546 void ASTDeclReader::ReadCXXDefinitionData(
1547 struct CXXRecordDecl::DefinitionData &Data,
const CXXRecordDecl *D) {
1549 Data.UserDeclaredConstructor = Record.readInt();
1550 Data.UserDeclaredSpecialMembers = Record.readInt();
1551 Data.Aggregate = Record.readInt();
1552 Data.PlainOldData = Record.readInt();
1553 Data.Empty = Record.readInt();
1554 Data.Polymorphic = Record.readInt();
1555 Data.Abstract = Record.readInt();
1556 Data.IsStandardLayout = Record.readInt();
1557 Data.HasNoNonEmptyBases = Record.readInt();
1558 Data.HasPrivateFields = Record.readInt();
1559 Data.HasProtectedFields = Record.readInt();
1560 Data.HasPublicFields = Record.readInt();
1561 Data.HasMutableFields = Record.readInt();
1562 Data.HasVariantMembers = Record.readInt();
1563 Data.HasOnlyCMembers = Record.readInt();
1564 Data.HasInClassInitializer = Record.readInt();
1565 Data.HasUninitializedReferenceMember = Record.readInt();
1566 Data.HasUninitializedFields = Record.readInt();
1567 Data.HasInheritedConstructor = Record.readInt();
1568 Data.HasInheritedAssignment = Record.readInt();
1569 Data.NeedOverloadResolutionForCopyConstructor = Record.readInt();
1570 Data.NeedOverloadResolutionForMoveConstructor = Record.readInt();
1571 Data.NeedOverloadResolutionForMoveAssignment = Record.readInt();
1572 Data.NeedOverloadResolutionForDestructor = Record.readInt();
1573 Data.DefaultedCopyConstructorIsDeleted = Record.readInt();
1574 Data.DefaultedMoveConstructorIsDeleted = Record.readInt();
1575 Data.DefaultedMoveAssignmentIsDeleted = Record.readInt();
1576 Data.DefaultedDestructorIsDeleted = Record.readInt();
1577 Data.HasTrivialSpecialMembers = Record.readInt();
1578 Data.DeclaredNonTrivialSpecialMembers = Record.readInt();
1579 Data.HasIrrelevantDestructor = Record.readInt();
1580 Data.HasConstexprNonCopyMoveConstructor = Record.readInt();
1581 Data.HasDefaultedDefaultConstructor = Record.readInt();
1582 Data.CanPassInRegisters = Record.readInt();
1583 Data.DefaultedDefaultConstructorIsConstexpr = Record.readInt();
1584 Data.HasConstexprDefaultConstructor = Record.readInt();
1585 Data.HasNonLiteralTypeFieldsOrBases = Record.readInt();
1586 Data.ComputedVisibleConversions = Record.readInt();
1587 Data.UserProvidedDefaultConstructor = Record.readInt();
1588 Data.DeclaredSpecialMembers = Record.readInt();
1589 Data.ImplicitCopyConstructorCanHaveConstParamForVBase = Record.readInt();
1590 Data.ImplicitCopyConstructorCanHaveConstParamForNonVBase = Record.readInt();
1591 Data.ImplicitCopyAssignmentHasConstParam = Record.readInt();
1592 Data.HasDeclaredCopyConstructorWithConstParam = Record.readInt();
1593 Data.HasDeclaredCopyAssignmentWithConstParam = Record.readInt();
1594 Data.ODRHash = Record.readInt();
1595 Data.HasODRHash =
true;
1597 if (Record.readInt())
1600 Data.NumBases = Record.readInt();
1602 Data.Bases = ReadGlobalOffset();
1603 Data.NumVBases = Record.readInt();
1605 Data.VBases = ReadGlobalOffset();
1607 Record.readUnresolvedSet(Data.Conversions);
1608 Record.readUnresolvedSet(Data.VisibleConversions);
1609 assert(Data.Definition &&
"Data.Definition should be already set!");
1610 Data.FirstFriend = ReadDeclID();
1612 if (Data.IsLambda) {
1614 CXXRecordDecl::LambdaDefinitionData &Lambda
1615 =
static_cast<CXXRecordDecl::LambdaDefinitionData &
>(Data);
1616 Lambda.Dependent = Record.readInt();
1617 Lambda.IsGenericLambda = Record.readInt();
1618 Lambda.CaptureDefault = Record.readInt();
1619 Lambda.NumCaptures = Record.readInt();
1620 Lambda.NumExplicitCaptures = Record.readInt();
1621 Lambda.ManglingNumber = Record.readInt();
1622 Lambda.ContextDecl = ReadDeclID();
1623 Lambda.Captures = (Capture *)Reader.getContext().Allocate(
1624 sizeof(Capture) * Lambda.NumCaptures);
1625 Capture *ToCapture = Lambda.Captures;
1626 Lambda.MethodTyInfo = GetTypeSourceInfo();
1627 for (
unsigned I = 0, N = Lambda.NumCaptures; I != N; ++I) {
1629 bool IsImplicit = Record.readInt();
1635 *ToCapture++ = Capture(Loc, IsImplicit, Kind,
nullptr,
SourceLocation());
1639 VarDecl *Var = ReadDeclAs<VarDecl>();
1641 *ToCapture++ = Capture(Loc, IsImplicit, Kind, Var, EllipsisLoc);
1648 void ASTDeclReader::MergeDefinitionData(
1649 CXXRecordDecl *D,
struct CXXRecordDecl::DefinitionData &&MergeDD) {
1650 assert(D->DefinitionData &&
1651 "merging class definition into non-definition");
1652 auto &DD = *D->DefinitionData;
1654 if (DD.Definition != MergeDD.Definition) {
1656 Reader.MergedDeclContexts.insert(std::make_pair(MergeDD.Definition,
1658 Reader.PendingDefinitions.erase(MergeDD.Definition);
1659 MergeDD.Definition->IsCompleteDefinition =
false;
1660 Reader.mergeDefinitionVisibility(DD.Definition, MergeDD.Definition);
1661 assert(Reader.Lookups.find(MergeDD.Definition) == Reader.Lookups.end() &&
1662 "already loaded pending lookups for merged definition");
1665 auto PFDI = Reader.PendingFakeDefinitionData.find(&DD);
1666 if (PFDI != Reader.PendingFakeDefinitionData.end() &&
1667 PFDI->second == ASTReader::PendingFakeDefinitionKind::Fake) {
1670 assert(!DD.IsLambda && !MergeDD.IsLambda &&
"faked up lambda definition?");
1671 PFDI->second = ASTReader::PendingFakeDefinitionKind::FakeLoaded;
1675 auto *Def = DD.Definition;
1676 DD = std::move(MergeDD);
1677 DD.Definition = Def;
1682 bool DetectedOdrViolation =
false;
1683 #define OR_FIELD(Field) DD.Field |= MergeDD.Field; 1684 #define MATCH_FIELD(Field) \ 1685 DetectedOdrViolation |= DD.Field != MergeDD.Field; \ 1707 MATCH_FIELD(NeedOverloadResolutionForCopyConstructor)
1708 MATCH_FIELD(NeedOverloadResolutionForMoveConstructor)
1709 MATCH_FIELD(NeedOverloadResolutionForMoveAssignment)
1716 OR_FIELD(DeclaredNonTrivialSpecialMembers)
1718 OR_FIELD(HasConstexprNonCopyMoveConstructor)
1719 OR_FIELD(HasDefaultedDefaultConstructor)
1721 MATCH_FIELD(DefaultedDefaultConstructorIsConstexpr)
1722 OR_FIELD(HasConstexprDefaultConstructor)
1727 MATCH_FIELD(ImplicitCopyConstructorCanHaveConstParamForVBase)
1728 MATCH_FIELD(ImplicitCopyConstructorCanHaveConstParamForNonVBase)
1730 OR_FIELD(HasDeclaredCopyConstructorWithConstParam)
1731 OR_FIELD(HasDeclaredCopyAssignmentWithConstParam)
1736 if (DD.NumBases != MergeDD.NumBases || DD.NumVBases != MergeDD.NumVBases)
1737 DetectedOdrViolation =
true;
1743 if (MergeDD.ComputedVisibleConversions && !DD.ComputedVisibleConversions) {
1744 DD.VisibleConversions = std::move(MergeDD.VisibleConversions);
1745 DD.ComputedVisibleConversions =
true;
1757 DetectedOdrViolation =
true;
1760 if (DetectedOdrViolation)
1761 Reader.PendingOdrMergeFailures[DD.Definition].push_back(
1762 {MergeDD.Definition, &MergeDD});
1766 struct CXXRecordDecl::DefinitionData *DD;
1771 bool IsLambda = Record.readInt();
1773 DD =
new (
C) CXXRecordDecl::LambdaDefinitionData(D,
nullptr,
false,
false,
1776 DD =
new (
C)
struct CXXRecordDecl::DefinitionData(D);
1778 ReadCXXDefinitionData(*DD, D);
1784 if (Canon->DefinitionData) {
1785 MergeDefinitionData(Canon, std::move(*DD));
1786 D->DefinitionData = Canon->DefinitionData;
1791 D->IsCompleteDefinition =
true;
1792 D->DefinitionData = DD;
1797 if (Update || Canon != D) {
1798 Canon->DefinitionData = D->DefinitionData;
1799 Reader.PendingDefinitions.insert(D);
1803 ASTDeclReader::RedeclarableResult
1805 RedeclarableResult Redecl = VisitRecordDeclImpl(D);
1810 CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
1812 switch ((CXXRecKind)Record.readInt()) {
1813 case CXXRecNotTemplate:
1815 if (!isa<ClassTemplateSpecializationDecl>(D))
1816 mergeRedeclarable(D, Redecl);
1818 case CXXRecTemplate: {
1821 D->TemplateOrInstantiation = Template;
1829 TypeIDForTypeDecl = 0;
1833 case CXXRecMemberSpecialization: {
1840 D->TemplateOrInstantiation = MSI;
1841 mergeRedeclarable(D, Redecl);
1846 bool WasDefinition = Record.readInt();
1848 ReadCXXRecordDefinition(D,
false);
1855 if (WasDefinition) {
1856 DeclID KeyFn = ReadDeclID();
1857 if (KeyFn && D->IsCompleteDefinition)
1861 C.KeyFunctions[D] = KeyFn;
1868 VisitFunctionDecl(D);
1873 VisitFunctionDecl(D);
1875 unsigned NumOverridenMethods = Record.readInt();
1877 while (NumOverridenMethods--) {
1886 Record.skipInts(NumOverridenMethods);
1894 auto *Shadow = ReadDeclAs<ConstructorUsingShadowDecl>();
1895 auto *Ctor = ReadDeclAs<CXXConstructorDecl>();
1900 VisitCXXMethodDecl(D);
1904 VisitCXXMethodDecl(D);
1906 if (
auto *OperatorDelete = ReadDeclAs<FunctionDecl>()) {
1908 auto *ThisArg = Record.readExpr();
1910 if (!Canon->OperatorDelete) {
1911 Canon->OperatorDelete = OperatorDelete;
1912 Canon->OperatorDeleteThisArg = ThisArg;
1918 VisitCXXMethodDecl(D);
1923 D->ImportedAndComplete.setPointer(readModule());
1924 D->ImportedAndComplete.setInt(Record.readInt());
1926 for (
unsigned I = 0, N = Record.back(); I != N; ++I)
1927 StoredLocs[I] = ReadSourceLocation();
1938 if (Record.readInt())
1939 D->Friend = ReadDeclAs<NamedDecl>();
1941 D->Friend = GetTypeSourceInfo();
1942 for (
unsigned i = 0; i != D->NumTPLists; ++i)
1944 Record.readTemplateParameterList();
1945 D->NextFriend = ReadDeclID();
1946 D->UnsupportedFriend = (Record.readInt() != 0);
1947 D->FriendLoc = ReadSourceLocation();
1952 unsigned NumParams = Record.readInt();
1953 D->NumParams = NumParams;
1955 for (
unsigned i = 0; i != NumParams; ++i)
1956 D->Params[i] = Record.readTemplateParameterList();
1957 if (Record.readInt())
1958 D->Friend = ReadDeclAs<NamedDecl>();
1960 D->Friend = GetTypeSourceInfo();
1961 D->FriendLoc = ReadSourceLocation();
1967 DeclID PatternID = ReadDeclID();
1968 NamedDecl *TemplatedDecl = cast_or_null<NamedDecl>(Reader.GetDecl(PatternID));
1971 D->
init(TemplatedDecl, TemplateParams);
1976 ASTDeclReader::RedeclarableResult
1978 RedeclarableResult Redecl = VisitRedeclarable(D);
1985 Reader.PendingDefinitions.insert(CanonD);
1991 if (ThisDeclID == Redecl.getFirstID()) {
1993 = ReadDeclAs<RedeclarableTemplateDecl>()) {
1994 assert(RTD->getKind() == D->
getKind() &&
1995 "InstantiatedFromMemberTemplate kind mismatch");
1997 if (Record.readInt())
2002 DeclID PatternID = VisitTemplateDecl(D);
2005 mergeRedeclarable(D, Redecl, PatternID);
2016 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2018 if (ThisDeclID == Redecl.getFirstID()) {
2022 ReadDeclIDList(SpecIDs);
2030 Reader.getContext().getInjectedClassNameType(
2036 llvm_unreachable(
"BuiltinTemplates are not serialized");
2043 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2045 if (ThisDeclID == Redecl.getFirstID()) {
2049 ReadDeclIDList(SpecIDs);
2054 ASTDeclReader::RedeclarableResult
2057 RedeclarableResult Redecl = VisitCXXRecordDeclImpl(D);
2060 if (
Decl *InstD = ReadDecl()) {
2062 D->SpecializedTemplate = CTD;
2065 Record.readTemplateArgumentList(TemplArgs);
2068 ClassTemplateSpecializationDecl::SpecializedPartialSpecialization *PS
2070 SpecializedPartialSpecialization();
2071 PS->PartialSpecialization
2072 = cast<ClassTemplatePartialSpecializationDecl>(InstD);
2073 PS->TemplateArgs = ArgList;
2074 D->SpecializedTemplate = PS;
2079 Record.readTemplateArgumentList(TemplArgs,
true);
2081 D->PointOfInstantiation = ReadSourceLocation();
2084 bool writtenAsCanonicalDecl = Record.readInt();
2085 if (writtenAsCanonicalDecl) {
2091 dyn_cast<ClassTemplatePartialSpecializationDecl>(D)) {
2093 .GetOrInsertNode(Partial);
2099 if (CanonSpec != D) {
2100 mergeRedeclarable<TagDecl>(D, CanonSpec, Redecl);
2104 if (
auto *DDD = D->DefinitionData) {
2105 if (CanonSpec->DefinitionData)
2106 MergeDefinitionData(CanonSpec, std::move(*DDD));
2108 CanonSpec->DefinitionData = D->DefinitionData;
2110 D->DefinitionData = CanonSpec->DefinitionData;
2117 ClassTemplateSpecializationDecl::ExplicitSpecializationInfo *ExplicitInfo
2118 =
new (
C) ClassTemplateSpecializationDecl::ExplicitSpecializationInfo;
2119 ExplicitInfo->TypeAsWritten = TyInfo;
2120 ExplicitInfo->ExternLoc = ReadSourceLocation();
2121 ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation();
2122 D->ExplicitInfo = ExplicitInfo;
2130 RedeclarableResult Redecl = VisitClassTemplateSpecializationDeclImpl(D);
2132 D->TemplateParams = Record.readTemplateParameterList();
2133 D->ArgsAsWritten = Record.readASTTemplateArgumentListInfo();
2136 if (ThisDeclID == Redecl.getFirstID()) {
2137 D->InstantiatedFromMember.setPointer(
2138 ReadDeclAs<ClassTemplatePartialSpecializationDecl>());
2139 D->InstantiatedFromMember.setInt(Record.readInt());
2146 D->Specialization = ReadDeclAs<CXXMethodDecl>();
2150 RedeclarableResult Redecl = VisitRedeclarableTemplateDecl(D);
2152 if (ThisDeclID == Redecl.getFirstID()) {
2155 ReadDeclIDList(SpecIDs);
2165 ASTDeclReader::RedeclarableResult
2168 RedeclarableResult Redecl = VisitVarDeclImpl(D);
2171 if (
Decl *InstD = ReadDecl()) {
2173 D->SpecializedTemplate = VTD;
2176 Record.readTemplateArgumentList(TemplArgs);
2179 VarTemplateSpecializationDecl::SpecializedPartialSpecialization *PS =
2181 VarTemplateSpecializationDecl::SpecializedPartialSpecialization();
2182 PS->PartialSpecialization =
2183 cast<VarTemplatePartialSpecializationDecl>(InstD);
2184 PS->TemplateArgs = ArgList;
2185 D->SpecializedTemplate = PS;
2191 VarTemplateSpecializationDecl::ExplicitSpecializationInfo *ExplicitInfo =
2192 new (
C) VarTemplateSpecializationDecl::ExplicitSpecializationInfo;
2193 ExplicitInfo->TypeAsWritten = TyInfo;
2194 ExplicitInfo->ExternLoc = ReadSourceLocation();
2195 ExplicitInfo->TemplateKeywordLoc = ReadSourceLocation();
2196 D->ExplicitInfo = ExplicitInfo;
2200 Record.readTemplateArgumentList(TemplArgs,
true);
2202 D->PointOfInstantiation = ReadSourceLocation();
2204 D->IsCompleteDefinition = Record.readInt();
2206 bool writtenAsCanonicalDecl = Record.readInt();
2207 if (writtenAsCanonicalDecl) {
2212 dyn_cast<VarTemplatePartialSpecializationDecl>(D)) {
2214 .GetOrInsertNode(Partial);
2231 RedeclarableResult Redecl = VisitVarTemplateSpecializationDeclImpl(D);
2233 D->TemplateParams = Record.readTemplateParameterList();
2234 D->ArgsAsWritten = Record.readASTTemplateArgumentListInfo();
2237 if (ThisDeclID == Redecl.getFirstID()) {
2238 D->InstantiatedFromMember.setPointer(
2239 ReadDeclAs<VarTemplatePartialSpecializationDecl>());
2240 D->InstantiatedFromMember.setInt(Record.readInt());
2249 if (Record.readInt())
2254 VisitDeclaratorDecl(D);
2259 auto TypesAndInfos =
2260 D->getTrailingObjects<std::pair<QualType, TypeSourceInfo *>>();
2262 new (&TypesAndInfos[I].first)
QualType(Record.readType());
2263 TypesAndInfos[I].second = GetTypeSourceInfo();
2267 D->ParameterPack = Record.readInt();
2268 if (Record.readInt())
2274 VisitTemplateDecl(D);
2283 Data[I] = Record.readTemplateParameterList();
2286 D->ParameterPack = Record.readInt();
2287 if (Record.readInt())
2289 Record.readTemplateArgumentLoc());
2294 VisitRedeclarableTemplateDecl(D);
2299 D->AssertExprAndFailed.setPointer(Record.readExpr());
2300 D->AssertExprAndFailed.setInt(Record.readInt());
2301 D->Message = cast_or_null<StringLiteral>(Record.readExpr());
2302 D->RParenLoc = ReadSourceLocation();
2309 std::pair<uint64_t, uint64_t>
2311 uint64_t LexicalOffset = ReadLocalOffset();
2312 uint64_t VisibleOffset = ReadLocalOffset();
2313 return std::make_pair(LexicalOffset, VisibleOffset);
2316 template <
typename T>
2317 ASTDeclReader::RedeclarableResult
2319 DeclID FirstDeclID = ReadDeclID();
2320 Decl *MergeWith =
nullptr;
2322 bool IsKeyDecl = ThisDeclID == FirstDeclID;
2323 bool IsFirstLocalDecl =
false;
2325 uint64_t RedeclOffset = 0;
2329 if (FirstDeclID == 0) {
2330 FirstDeclID = ThisDeclID;
2332 IsFirstLocalDecl =
true;
2333 }
else if (
unsigned N = Record.readInt()) {
2337 IsFirstLocalDecl =
true;
2344 for (
unsigned I = 0; I != N - 1; ++I)
2345 MergeWith = ReadDecl();
2347 RedeclOffset = ReadLocalOffset();
2354 T *FirstDecl = cast_or_null<T>(Reader.GetDecl(FirstDeclID));
2355 if (FirstDecl != D) {
2361 D->
First = FirstDecl->getCanonicalDecl();
2364 T *DAsT =
static_cast<T*
>(D);
2370 if (IsFirstLocalDecl)
2371 Reader.PendingDeclChains.push_back(std::make_pair(DAsT, RedeclOffset));
2373 return RedeclarableResult(MergeWith, FirstDeclID, IsKeyDecl);
2378 template<
typename T>
2380 RedeclarableResult &Redecl,
2381 DeclID TemplatePatternID) {
2383 if (!Reader.getContext().getLangOpts().Modules)
2390 T *D =
static_cast<T*
>(DBase);
2392 if (
auto *Existing = Redecl.getKnownMergeTarget())
2394 mergeRedeclarable(D, cast<T>(Existing), Redecl, TemplatePatternID);
2395 else if (FindExistingResult ExistingRes = findExisting(D))
2396 if (
T *Existing = ExistingRes)
2397 mergeRedeclarable(D, Existing, Redecl, TemplatePatternID);
2405 llvm_unreachable(
"bad assert_cast");
2412 DeclID DsID,
bool IsKeyDecl) {
2415 RedeclarableResult Result( ExistingPattern,
2416 DPattern->getCanonicalDecl()->getGlobalID(),
2419 if (
auto *DClass = dyn_cast<CXXRecordDecl>(DPattern)) {
2422 auto *ExistingClass =
2424 if (
auto *DDD = DClass->DefinitionData) {
2425 if (ExistingClass->DefinitionData) {
2426 MergeDefinitionData(ExistingClass, std::move(*DDD));
2428 ExistingClass->DefinitionData = DClass->DefinitionData;
2431 Reader.PendingDefinitions.insert(DClass);
2434 DClass->DefinitionData = ExistingClass->DefinitionData;
2436 return mergeRedeclarable(DClass, cast<TagDecl>(ExistingPattern),
2439 if (
auto *DFunction = dyn_cast<FunctionDecl>(DPattern))
2440 return mergeRedeclarable(DFunction, cast<FunctionDecl>(ExistingPattern),
2442 if (
auto *DVar = dyn_cast<VarDecl>(DPattern))
2443 return mergeRedeclarable(DVar, cast<VarDecl>(ExistingPattern), Result);
2444 if (
auto *DAlias = dyn_cast<TypeAliasDecl>(DPattern))
2445 return mergeRedeclarable(DAlias, cast<TypedefNameDecl>(ExistingPattern),
2447 llvm_unreachable(
"merged an unknown kind of redeclarable template");
2452 template<
typename T>
2454 RedeclarableResult &Redecl,
2455 DeclID TemplatePatternID) {
2456 T *D =
static_cast<T*
>(DBase);
2457 T *ExistingCanon = Existing->getCanonicalDecl();
2458 T *DCanon = D->getCanonicalDecl();
2459 if (ExistingCanon != DCanon) {
2460 assert(DCanon->getGlobalID() == Redecl.getFirstID() &&
2461 "already merged this declaration");
2467 D->First = ExistingCanon;
2468 ExistingCanon->Used |= D->Used;
2474 if (
auto *Namespace = dyn_cast<NamespaceDecl>(D))
2475 Namespace->AnonOrFirstNamespaceAndInline.setPointer(
2476 assert_cast<NamespaceDecl*>(ExistingCanon));
2479 if (
auto *DTemplate = dyn_cast<RedeclarableTemplateDecl>(D))
2480 mergeTemplatePattern(
2481 DTemplate, assert_cast<RedeclarableTemplateDecl*>(ExistingCanon),
2482 TemplatePatternID, Redecl.isKeyDecl());
2485 if (Redecl.isKeyDecl())
2486 Reader.KeyDecls[ExistingCanon].push_back(Redecl.getFirstID());
2494 template<
typename T>
2497 if (!Reader.getContext().getLangOpts().Modules)
2503 if (!Reader.getContext().getLangOpts().CPlusPlus)
2506 if (FindExistingResult ExistingRes = findExisting(static_cast<T*>(D)))
2507 if (
T *Existing = ExistingRes)
2508 Reader.getContext().setPrimaryMergedDecl(static_cast<T *>(D),
2509 Existing->getCanonicalDecl());
2516 Vars.reserve(NumVars);
2517 for (
unsigned i = 0; i != NumVars; ++i) {
2518 Vars.push_back(Record.readExpr());
2530 D->PrevDeclInScope = ReadDeclID();
2543 for (
unsigned i = 0, e = Record.
readInt(); i != e; ++i) {
2544 Attr *New =
nullptr;
2549 #include "clang/Serialization/AttrPCHRead.inc" 2551 assert(New &&
"Unable to decode attribute?");
2552 Attrs.push_back(New);
2566 inline void ASTReader::LoadedDecl(
unsigned Index,
Decl *D) {
2567 assert(!DeclsLoaded[Index] &&
"Decl loaded twice?");
2568 DeclsLoaded[Index] = D;
2584 if (isa<ImportDecl>(D) || isa<VarDecl>(D)) {
2591 if (isa<FileScopeAsmDecl>(D) ||
2592 isa<ObjCProtocolDecl>(D) ||
2593 isa<ObjCImplDecl>(D) ||
2594 isa<ImportDecl>(D) ||
2595 isa<PragmaCommentDecl>(D) ||
2596 isa<PragmaDetectMismatchDecl>(D))
2598 if (isa<OMPThreadPrivateDecl>(D) || isa<OMPDeclareReductionDecl>(D))
2600 if (
VarDecl *Var = dyn_cast<VarDecl>(D))
2601 return Var->isFileVarDecl() &&
2604 return Func->doesThisDeclarationHaveABody() || HasBody;
2614 ASTReader::RecordLocation
2616 GlobalDeclMapType::iterator I = GlobalDeclMap.find(
ID);
2617 assert(I != GlobalDeclMap.end() &&
"Corrupted global declaration map");
2621 Loc = TranslateSourceLocation(*M, DOffs.
getLocation());
2622 return RecordLocation(M, DOffs.
BitOffset);
2625 ASTReader::RecordLocation ASTReader::getLocalBitOffset(uint64_t GlobalOffset) {
2627 = GlobalBitOffsetsMap.find(GlobalOffset);
2629 assert(I != GlobalBitOffsetsMap.
end() &&
"Corrupted global bit offsets map");
2630 return RecordLocation(I->second, GlobalOffset - I->second->GlobalBitOffset);
2633 uint64_t ASTReader::getGlobalBitOffset(
ModuleFile &M, uint32_t LocalOffset) {
2655 TX->getASTContext().hasSameType(TX->getType(), TY->
getType());
2662 TY->getTemplateParameters());
2669 return NAS->getNamespace();
2677 if (!NSY || NSX->getCanonicalDecl() != NSY->getCanonicalDecl())
2719 for (
unsigned I = 0, N = X->
size(); I != N; ++I)
2737 AEnableIfs.push_back(EIA);
2741 BEnableIfs.push_back(EIA);
2745 if (AEnableIfs.empty() && BEnableIfs.empty())
2748 if (AEnableIfs.size() != BEnableIfs.size())
2751 llvm::FoldingSetNodeID Cand1ID, Cand2ID;
2752 for (
unsigned I = 0, E = AEnableIfs.size(); I != E; ++I) {
2756 AEnableIfs[I]->getCond()->Profile(Cand1ID, A->
getASTContext(),
true);
2757 BEnableIfs[I]->getCond()->Profile(Cand2ID, B->
getASTContext(),
true);
2758 if (Cand1ID != Cand2ID)
2782 TypedefY->getUnderlyingType());
2789 if (isa<ObjCInterfaceDecl>(X) || isa<ObjCProtocolDecl>(
X))
2792 if (isa<ClassTemplateSpecializationDecl>(X)) {
2799 if (
TagDecl *TagX = dyn_cast<TagDecl>(X)) {
2800 TagDecl *TagY = cast<TagDecl>(Y);
2801 return (TagX->getTagKind() == TagY->
getTagKind()) ||
2815 if (CtorX->getInheritedConstructor() &&
2816 !
isSameEntity(CtorX->getInheritedConstructor().getConstructor(),
2828 if (C.
getLangOpts().CPlusPlus17 && XFPT && YFPT &&
2841 if (
VarDecl *VarX = dyn_cast<VarDecl>(X)) {
2842 VarDecl *VarY = cast<VarDecl>(Y);
2855 if (!VarXTy || !VarYTy)
2864 if (
NamespaceDecl *NamespaceX = dyn_cast<NamespaceDecl>(X)) {
2871 if (
TemplateDecl *TemplateX = dyn_cast<TemplateDecl>(X)) {
2880 if (
FieldDecl *FDX = dyn_cast<FieldDecl>(X)) {
2887 if (
auto *IFDX = dyn_cast<IndirectFieldDecl>(X)) {
2888 auto *IFDY = cast<IndirectFieldDecl>(Y);
2889 return IFDX->getAnonField()->getCanonicalDecl() ==
2890 IFDY->getAnonField()->getCanonicalDecl();
2894 if (isa<EnumConstantDecl>(X))
2906 if (
auto *UX = dyn_cast<UsingDecl>(X)) {
2907 auto *UY = cast<UsingDecl>(Y);
2909 UX->hasTypename() == UY->hasTypename() &&
2910 UX->isAccessDeclaration() == UY->isAccessDeclaration();
2912 if (
auto *UX = dyn_cast<UnresolvedUsingValueDecl>(X)) {
2913 auto *UY = cast<UnresolvedUsingValueDecl>(Y);
2915 UX->isAccessDeclaration() == UY->isAccessDeclaration();
2917 if (
auto *UX = dyn_cast<UnresolvedUsingTypenameDecl>(X))
2920 cast<UnresolvedUsingTypenameDecl>(Y)->getQualifier());
2923 if (
auto *NAX = dyn_cast<NamespaceAliasDecl>(X)) {
2924 auto *NAY = cast<NamespaceAliasDecl>(Y);
2925 return NAX->getNamespace()->Equals(NAY->getNamespace());
2936 return ND->getOriginalNamespace();
2940 auto *DD = RD->DefinitionData;
2942 DD = RD->getCanonicalDecl()->DefinitionData;
2949 DD =
new (Reader.
getContext())
struct CXXRecordDecl::DefinitionData(RD);
2950 RD->IsCompleteDefinition =
true;
2951 RD->DefinitionData = DD;
2952 RD->getCanonicalDecl()->DefinitionData = DD;
2955 Reader.PendingFakeDefinitionData.insert(
2956 std::make_pair(DD, ASTReader::PendingFakeDefinitionKind::Fake));
2959 return DD->Definition;
2962 if (
EnumDecl *ED = dyn_cast<EnumDecl>(DC))
2963 return ED->getASTContext().getLangOpts().CPlusPlus? ED->getDefinition()
2968 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2974 ASTDeclReader::FindExistingResult::~FindExistingResult() {
2977 if (TypedefNameForLinkage) {
2979 Reader.ImportedTypedefNamesForLinkage.insert(
2980 std::make_pair(std::make_pair(DC, TypedefNameForLinkage), New));
2984 if (!AddResult || Existing)
2990 setAnonymousDeclForMerging(Reader, New->getLexicalDeclContext(),
2991 AnonymousDeclNumber, New);
2997 }
else if (
DeclContext *MergeDC = getPrimaryContextForMerging(Reader, DC)) {
3000 MergeDC->makeDeclVisibleInContextImpl(New,
true);
3008 bool IsTypedefNameForLinkage) {
3009 if (!IsTypedefNameForLinkage)
3018 if (
auto *TND = dyn_cast<TypedefNameDecl>(Found))
3019 return TND->getAnonDeclWithTypedefName(
true);
3029 if (
auto *Merged = Reader.MergedDeclContexts.lookup(DC))
3033 auto &
Previous = Reader.AnonymousDeclarationsForMerging[DC];
3039 if (!cast<Decl>(DC)->isFromASTFile()) {
3051 void ASTDeclReader::setAnonymousDeclForMerging(
ASTReader &Reader,
3054 if (
auto *Merged = Reader.MergedDeclContexts.lookup(DC))
3057 auto &
Previous = Reader.AnonymousDeclarationsForMerging[DC];
3064 ASTDeclReader::FindExistingResult ASTDeclReader::findExisting(
NamedDecl *D) {
3071 FindExistingResult Result(Reader, D,
nullptr,
3072 AnonymousDeclNumber, TypedefNameForLinkage);
3078 if (TypedefNameForLinkage) {
3079 auto It = Reader.ImportedTypedefNamesForLinkage.find(
3080 std::make_pair(DC, TypedefNameForLinkage));
3081 if (It != Reader.ImportedTypedefNamesForLinkage.end())
3083 return FindExistingResult(Reader, D, It->second, AnonymousDeclNumber,
3084 TypedefNameForLinkage);
3092 if (
auto *Existing = getAnonymousDeclForMerging(
3095 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3096 TypedefNameForLinkage);
3103 class UpToDateIdentifierRAII {
3109 : II(II), WasOutToDate(
false)
3118 ~UpToDateIdentifierRAII() {
3125 IEnd = IdResolver.
end();
3129 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3130 TypedefNameForLinkage);
3132 }
else if (
DeclContext *MergeDC = getPrimaryContextForMerging(Reader, DC)) {
3137 return FindExistingResult(Reader, D, Existing, AnonymousDeclNumber,
3138 TypedefNameForLinkage);
3142 return FindExistingResult(Reader);
3151 if (MergedDCIt != Reader.MergedDeclContexts.end() &&
3153 Reader.PendingOdrMergeChecks.push_back(D);
3155 return FindExistingResult(Reader, D,
nullptr,
3156 AnonymousDeclNumber, TypedefNameForLinkage);
3159 template<
typename DeclT>
3164 llvm_unreachable(
"getMostRecentDecl on non-redeclarable declaration");
3171 #define ABSTRACT_DECL(TYPE) 3172 #define DECL(TYPE, BASE) \ 3174 return getMostRecentDeclImpl(cast<TYPE##Decl>(D)); 3175 #include "clang/AST/DeclNodes.inc" 3177 llvm_unreachable(
"unknown decl kind");
3180 Decl *ASTReader::getMostRecentExistingDecl(
Decl *D) {
3184 template<
typename DeclT>
3188 D->
RedeclLink.setPrevious(cast<DeclT>(Previous));
3228 if (PrevFD->IsInline != FD->IsInline) {
3244 FD->IsInline =
true;
3251 if (FPT && PrevFPT) {
3253 bool WasUnresolved =
3255 if (IsUnresolved != WasUnresolved)
3256 Reader.PendingExceptionSpecUpdates.insert(
3257 std::make_pair(Canon, IsUnresolved ? PrevFD : FD));
3263 llvm_unreachable(
"attachPreviousDecl on non-redeclarable declaration");
3268 template <
typename ParmDecl>
3271 auto *To = cast<ParmDecl>(ToD);
3272 if (!From->hasDefaultArgument())
3274 To->setInheritedDefaultArgument(Context, From);
3283 assert(FromTP->size() == ToTP->size() &&
"merged mismatched templates?");
3285 for (
unsigned I = 0, N = FromTP->size(); I != N; ++I) {
3286 NamedDecl *FromParam = FromTP->getParam(N - I - 1);
3289 NamedDecl *ToParam = ToTP->getParam(N - I - 1);
3291 if (
auto *FTTP = dyn_cast<TemplateTypeParmDecl>(FromParam)) {
3294 }
else if (
auto *FNTTP = dyn_cast<NonTypeTemplateParmDecl>(FromParam)) {
3299 Context, cast<TemplateTemplateParmDecl>(FromParam), ToParam))
3307 assert(D && Previous);
3310 #define ABSTRACT_DECL(TYPE) 3311 #define DECL(TYPE, BASE) \ 3313 attachPreviousDeclImpl(Reader, cast<TYPE##Decl>(D), Previous, Canon); \ 3315 #include "clang/AST/DeclNodes.inc" 3334 template<
typename DeclT>
3336 D->
RedeclLink.setLatest(cast<DeclT>(Latest));
3339 llvm_unreachable(
"attachLatestDecl on non-redeclarable declaration");
3343 assert(D && Latest);
3346 #define ABSTRACT_DECL(TYPE) 3347 #define DECL(TYPE, BASE) \ 3349 attachLatestDeclImpl(cast<TYPE##Decl>(D), Latest); \ 3351 #include "clang/AST/DeclNodes.inc" 3355 template<
typename DeclT>
3360 llvm_unreachable(
"markIncompleteDeclChain on non-redeclarable declaration");
3363 void ASTReader::markIncompleteDeclChain(
Decl *D) {
3365 #define ABSTRACT_DECL(TYPE) 3366 #define DECL(TYPE, BASE) \ 3368 ASTDeclReader::markIncompleteDeclChainImpl(cast<TYPE##Decl>(D)); \ 3370 #include "clang/AST/DeclNodes.inc" 3378 RecordLocation Loc = DeclCursorForID(ID, DeclLoc);
3379 llvm::BitstreamCursor &DeclsCursor = Loc.F->DeclsCursor;
3384 ReadingKindTracker ReadingKind(Read_Decl, *
this);
3387 Deserializing ADecl(
this);
3389 DeclsCursor.JumpToBit(Loc.Offset);
3392 unsigned Code = DeclsCursor.ReadCode();
3399 llvm_unreachable(
"Record cannot be de-serialized with ReadDeclRecord");
3598 Error(
"attempt to read a C++ base-specifier record as a declaration");
3601 Error(
"attempt to read a C++ ctor initializer record as a declaration");
3632 assert(D &&
"Unknown declaration reading AST file");
3633 LoadedDecl(Index, D);
3644 if (Offsets.first &&
3645 ReadLexicalDeclContextStorage(*Loc.F, DeclsCursor, Offsets.first, DC))
3647 if (Offsets.second &&
3648 ReadVisibleDeclContextStorage(*Loc.F, DeclsCursor, Offsets.second, ID))
3654 PendingUpdateRecords.push_back(
3655 PendingUpdateRecord(ID, D,
true));
3661 if (Class->isThisDeclarationADefinition() ||
3662 PendingDefinitions.count(Class))
3663 loadObjCCategories(ID, Class);
3669 PotentiallyInterestingDecls.push_back(
3675 void ASTReader::PassInterestingDeclsToConsumer() {
3678 if (PassingDeclsToConsumer)
3688 for (
auto ID : EagerlyDeserializedDecls)
3690 EagerlyDeserializedDecls.clear();
3692 while (!PotentiallyInterestingDecls.empty()) {
3693 InterestingDecl D = PotentiallyInterestingDecls.front();
3694 PotentiallyInterestingDecls.pop_front();
3696 PassInterestingDeclToConsumer(D.getDecl());
3700 void ASTReader::loadDeclUpdateRecords(PendingUpdateRecord &Record) {
3706 ProcessingUpdatesRAIIObj ProcessingUpdates(*
this);
3707 DeclUpdateOffsetsMap::iterator UpdI = DeclUpdateOffsets.find(ID);
3711 if (UpdI != DeclUpdateOffsets.end()) {
3712 auto UpdateOffsets = std::move(UpdI->second);
3713 DeclUpdateOffsets.erase(UpdI);
3719 bool WasInteresting =
3721 for (
auto &FileAndOffset : UpdateOffsets) {
3723 uint64_t
Offset = FileAndOffset.second;
3726 Cursor.JumpToBit(Offset);
3727 unsigned Code = Cursor.ReadCode();
3729 unsigned RecCode = Record.
readRecord(Cursor, Code);
3731 assert(RecCode ==
DECL_UPDATES &&
"Expected DECL_UPDATES record!");
3733 ASTDeclReader Reader(*
this, Record, RecordLocation(F, Offset), ID,
3735 Reader.
UpdateDecl(D, PendingLazySpecializationIDs);
3739 if (!WasInteresting &&
3741 PotentiallyInterestingDecls.push_back(
3743 WasInteresting =
true;
3748 assert((PendingLazySpecializationIDs.empty() || isa<ClassTemplateDecl>(D) ||
3749 isa<FunctionTemplateDecl>(D) || isa<VarTemplateDecl>(D)) &&
3750 "Must not have pending specializations");
3751 if (
auto *CTD = dyn_cast<ClassTemplateDecl>(D))
3753 else if (
auto *FTD = dyn_cast<FunctionTemplateDecl>(D))
3755 else if (
auto *VTD = dyn_cast<VarTemplateDecl>(D))
3757 PendingLazySpecializationIDs.clear();
3760 auto I = PendingVisibleUpdates.find(ID);
3761 if (I != PendingVisibleUpdates.end()) {
3762 auto VisibleUpdates = std::move(I->second);
3763 PendingVisibleUpdates.erase(I);
3765 auto *DC = cast<DeclContext>(D)->getPrimaryContext();
3766 for (
const PendingVisibleUpdate &
Update : VisibleUpdates)
3767 Lookups[DC].Table.add(
3774 void ASTReader::loadPendingDeclChain(
Decl *FirstLocal, uint64_t LocalOffset) {
3777 if (FirstLocal != CanonDecl) {
3780 *
this, FirstLocal, PrevMostRecent ? PrevMostRecent : CanonDecl,
3790 ModuleFile *M = getOwningModuleFile(FirstLocal);
3791 assert(M &&
"imported decl from no module file");
3795 Cursor.JumpToBit(LocalOffset);
3798 unsigned Code = Cursor.ReadCode();
3799 unsigned RecCode = Cursor.readRecord(Code, Record);
3805 Decl *MostRecent = FirstLocal;
3806 for (
unsigned I = 0, N = Record.size(); I != N; ++I) {
3807 auto *D = GetLocalDecl(*M, Record[N - I - 1]);
3817 class ObjCCategoriesVisitor {
3820 llvm::SmallPtrSetImpl<ObjCCategoryDecl *> &Deserialized;
3822 llvm::DenseMap<DeclarationName, ObjCCategoryDecl *> NameCategoryMap;
3824 unsigned PreviousGeneration;
3828 if (!Deserialized.erase(Cat))
3851 }
else if (!Existing) {
3866 ObjCCategoriesVisitor(
ASTReader &Reader,
3868 llvm::SmallPtrSetImpl<ObjCCategoryDecl *> &Deserialized,
3870 unsigned PreviousGeneration)
3871 : Reader(Reader), Interface(Interface), Deserialized(Deserialized),
3872 Tail(
nullptr), InterfaceID(InterfaceID),
3873 PreviousGeneration(PreviousGeneration)
3917 for (
unsigned I = 0; I != N; ++I)
3918 add(cast_or_null<ObjCCategoryDecl>(
3927 unsigned PreviousGeneration) {
3928 ObjCCategoriesVisitor Visitor(*
this, D, CategoriesDeserialized,
ID,
3929 PreviousGeneration);
3930 ModuleMgr.visit(Visitor);
3933 template<
typename DeclT,
typename Fn>
3940 auto *MostRecent = D->getMostRecentDecl();
3942 for (
auto *Redecl = MostRecent; Redecl && !Found;
3943 Redecl = Redecl->getPreviousDecl())
3944 Found = (Redecl == D);
3948 for (
auto *Redecl = MostRecent; Redecl != D;
3949 Redecl = Redecl->getPreviousDecl())
3956 while (Record.getIdx() < Record.size()) {
3959 auto *RD = cast<CXXRecordDecl>(D);
3962 Decl *MD = Record.readDecl();
3963 assert(MD &&
"couldn't read decl from update record");
3966 RD->addedMember(MD);
3972 PendingLazySpecializationIDs.push_back(ReadDeclID());
3981 if (!Record.isModule()) {
3985 cast<NamespaceDecl>(D)->setAnonymousNamespace(Anon);
3991 VarDecl *VD = cast<VarDecl>(D);
3994 uint64_t Val = Record.readInt();
3996 VD->
setInit(Record.readExpr());
4000 Eval->
IsICE = Val == 3;
4009 dyn_cast<VarTemplateSpecializationDecl>(D)) {
4010 VTSD->setPointOfInstantiation(POI);
4011 }
else if (
auto *VD = dyn_cast<VarDecl>(D)) {
4012 VD->getMemberSpecializationInfo()->setPointOfInstantiation(POI);
4014 auto *FD = cast<FunctionDecl>(D);
4015 if (
auto *FTSInfo = FD->TemplateOrSpecialization
4017 FTSInfo->setPointOfInstantiation(POI);
4020 ->setPointOfInstantiation(POI);
4026 auto Param = cast<ParmVarDecl>(D);
4031 auto DefaultArg = Record.readExpr();
4035 if (Param->hasUninstantiatedDefaultArg())
4036 Param->setDefaultArg(DefaultArg);
4041 auto FD = cast<FieldDecl>(D);
4042 auto DefaultInit = Record.readExpr();
4046 if (FD->hasInClassInitializer() && !FD->getInClassInitializer()) {
4048 FD->setInClassInitializer(DefaultInit);
4052 FD->removeInClassInitializer();
4059 if (Reader.PendingBodies[FD]) {
4065 if (Record.readInt()) {
4074 ReadFunctionDefinition(FD);
4075 assert(Record.getIdx() == Record.size() &&
"lazy body must be last");
4080 auto *RD = cast<CXXRecordDecl>(D);
4081 auto *OldDD = RD->getCanonicalDecl()->DefinitionData;
4082 bool HadRealDefinition =
4083 OldDD && (OldDD->Definition != RD ||
4084 !Reader.PendingFakeDefinitionData.count(OldDD));
4085 ReadCXXRecordDefinition(RD,
true);
4088 uint64_t LexicalOffset = ReadLocalOffset();
4089 if (!HadRealDefinition && LexicalOffset) {
4090 Record.readLexicalDeclContextStorage(LexicalOffset, RD);
4091 Reader.PendingFakeDefinitionData.erase(OldDD);
4097 RD->getMemberSpecializationInfo()) {
4098 MSInfo->setTemplateSpecializationKind(TSK);
4099 MSInfo->setPointOfInstantiation(POI);
4102 cast<ClassTemplateSpecializationDecl>(RD);
4106 if (Record.readInt()) {
4108 ReadDeclAs<ClassTemplatePartialSpecializationDecl>();
4110 Record.readTemplateArgumentList(TemplArgs);
4123 RD->setLocation(ReadSourceLocation());
4124 RD->setLocStart(ReadSourceLocation());
4125 RD->setBraceRange(ReadSourceRange());
4127 if (Record.readInt()) {
4129 Record.readAttributes(Attrs);
4141 auto *Del = ReadDeclAs<FunctionDecl>();
4143 auto *ThisArg = Record.readExpr();
4145 if (!First->OperatorDelete) {
4146 First->OperatorDelete = Del;
4147 First->OperatorDeleteThisArg = ThisArg;
4155 Record.readExceptionSpec(ExceptionStorage, ESI);
4158 auto *FD = cast<FunctionDecl>(D);
4164 FPT->getReturnType(), FPT->getParamTypes(),
4165 FPT->getExtProtoInfo().withExceptionSpec(ESI)));
4169 Reader.PendingExceptionSpecUpdates.insert(
4170 std::make_pair(FD->getCanonicalDecl(), FD));
4177 QualType DeducedResultType = Record.readType();
4205 ReadSourceRange()));
4210 auto *Exported = cast<NamedDecl>(D);
4211 if (
auto *TD = dyn_cast<TagDecl>(Exported))
4212 Exported = TD->getDefinition();
4217 Reader.PendingMergedDefinitionsToDeduplicate.insert(
4218 cast<NamedDecl>(Exported));
4222 Reader.HiddenNamesMap[Owner].push_back(Exported);
4225 Exported->setVisibleDespiteOwningModule();
4233 Record.readAttributes(Attrs);
4234 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.
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
void VisitClassScopeFunctionSpecializationDecl(ClassScopeFunctionSpecializationDecl *D)
static const Decl * getCanonicalDecl(const Decl *D)
void setImplicit(bool I=true)
An instance of this class is created to represent a function declaration or definition.
void 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 VisitObjCIvarDecl(ObjCIvarDecl *D)
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
static void setNextObjCCategory(ObjCCategoryDecl *Cat, ObjCCategoryDecl *Next)
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
RedeclarableResult VisitClassTemplateSpecializationDeclImpl(ClassTemplateSpecializationDecl *D)
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
void setEmbeddedInDeclarator(bool isInDeclarator)
No linkage, which means that the entity is unique and can only be referred to from within its scope...
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)
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
void setParam(unsigned i, ImplicitParamDecl *P)
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
An OMPDeclareReductionDecl record.
void VisitEnumConstantDecl(EnumConstantDecl *ECD)
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.
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.
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.
NamespaceDecl - 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.
VarDecl - An instance of this class is created to represent a variable declaration or definition...
void VisitNamedDecl(NamedDecl *ND)
Declaration of a redeclarable template.
An OMPCapturedExprDecl record.
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.
bool isParameterPack() const
Whether this declaration is a parameter pack.
unsigned IsExplicitSpecified
A TemplateTemplateParmDecl record.
ParmVarDecl - Represents a parameter to a function.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
A ObjCInterfaceDecl record.
void setHasExternalVisibleStorage(bool ES=true)
State whether this DeclContext has external storage for declarations visible in this context...
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'.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
static void attachPreviousDeclImpl(ASTReader &Reader, Redeclarable< DeclT > *D, Decl *Previous, Decl *Canon)
Types, declared with 'struct foo', typedefs, etc.
A CXXConstructorDecl record for an inherited constructor.
RecordDecl - Represents a struct/union/class.
Description of a constructor that was inherited from a base class.
DeclarationName getDeclName() const
getDeclName - 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 ...
bool isInline() const
Returns true if this is an inline namespace declaration.
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.
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
void setBlockMissingReturnType(bool val)
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
void setLocStart(SourceLocation L)
static CXXRecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
void setVisibleDespiteOwningModule()
Set that this declaration is globally visible, even if it came from a module that is not visible...
RedeclarableResult VisitVarTemplateSpecializationDeclImpl(VarTemplateSpecializationDecl *D)
TODO: Unify with ClassTemplateSpecializationDecl version? May require unifying ClassTemplate(Partial)...
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.
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
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.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
unsigned FromASTFile
Whether this declaration was loaded from an AST file.
void Profile(llvm::FoldingSetNodeID &ID)
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
void setNumPositiveBits(unsigned Num)
Represents an access specifier followed by colon ':'.
void setReturnType(QualType T)
Declaration of a function specialization at template class scope.
static StaticAssertDecl * CreateDeserialized(ASTContext &C, unsigned ID)
TypeSourceInfo * getTypeSourceInfo()
Reads a declarator info from the given record, advancing Idx.
void VisitLabelDecl(LabelDecl *LD)
for(const auto &A :T->param_types())
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.
Common * getCommonPtr() const
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)
TagKind getTagKind() const
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)
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.
TypeDecl - 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)
void setInstantiationOf(ClassTemplatePartialSpecializationDecl *PartialSpec, const TemplateArgumentList *TemplateArgs)
Note that this class template specialization is actually an instantiation of the given class template...
CXXRecordDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static FileScopeAsmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitCXXMethodDecl(CXXMethodDecl *D)
static TypeAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
A ClassTemplateSpecializationDecl record.
Represents an Objective-C protocol declaration.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
void setNumNegativeBits(unsigned Num)
static bool isSameEntity(NamedDecl *X, NamedDecl *Y)
Determine whether the two declarations refer to the same entity.
static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI)
This represents the body of a CapturedStmt, and serves as its DeclContext.
Represents an ObjC class declaration.
Represents a linkage specification.
static ParmVarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D)
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
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)
typename Representation::iterator iterator
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x 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)
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
void setIvarRBraceLoc(SourceLocation Loc)
A StaticAssertDecl record.
llvm::FoldingSetVector< ClassTemplatePartialSpecializationDecl > PartialSpecializations
The class template partial specializations for this class template.
A VarTemplateSpecializationDecl record.
void VisitUsingPackDecl(UsingPackDecl *D)
void VisitUsingShadowDecl(UsingShadowDecl *D)
void VisitVarTemplatePartialSpecializationDecl(VarTemplatePartialSpecializationDecl *D)
TODO: Unify with ClassTemplatePartialSpecializationDecl version? May require unifying ClassTemplate(P...
void setNextIvar(ObjCIvarDecl *ivar)
void setSynthesize(bool synth)
void VisitFriendDecl(FriendDecl *D)
An ObjCTypeParamDecl record.
A record containing CXXBaseSpecifiers.
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...
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Expr - This represents one expression.
A ObjCCategoryImplDecl record.
void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *GD)
void setBitWidth(Expr *Width)
setBitWidth - Set the bit-field width for this member.
llvm::FoldingSetVector< VarTemplatePartialSpecializationDecl > PartialSpecializations
The variable template partial specializations for this variable template.
static LinkageSpecDecl * CreateDeserialized(ASTContext &C, unsigned ID)
A ObjCPropertyImplDecl record.
const FunctionProtoType * T
Declaration of a template type parameter.
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
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.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
A namespace alias, stored as a NamespaceAliasDecl*.
static void attachPreviousDecl(ASTReader &Reader, Decl *D, Decl *Previous, Decl *Canon)
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...
static NamespaceAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static CXXConstructorDecl * CreateDeserialized(ASTContext &C, unsigned ID, bool InheritsConstructor)
bool isFunctionOrMethod() const
StorageClass
Storage classes.
static bool isConsumerInterestedIn(ASTContext &Ctx, Decl *D, bool HasBody)
Determine whether the consumer will be interested in seeing this declaration (via HandleTopLevelDecl)...
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
IsScopedUsingClassTag - If this tag declaration is a scoped enum, then this is true if the scoped enu...
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.
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.
QualifierInfo - A struct with extended info about a syntactic name qualifier, to be used for the case...
void setColonLoc(SourceLocation CLoc)
Sets the location of the colon.
An UnresolvedUsingValueDecl record.
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)
bool isParameterPack() const
Returns whether this is a parameter pack.
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)
TagDecl - Represents the declaration of a struct/union/class/enum.
ASTContext & getASTContext() const LLVM_READONLY
static DecompositionDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumBindings)
void setReferenced(bool R=true)
LabelDecl - Represents the declaration of a label.
void mergeTemplatePattern(RedeclarableTemplateDecl *D, RedeclarableTemplateDecl *Existing, DeclID DsID, bool IsKeyDecl)
Merge together the pattern declarations from two template declarations.
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
Represents a dependent using declaration which was not marked with typename.
void setPosition(unsigned P)
void VisitObjCImplDecl(ObjCImplDecl *D)
Represents a static or instance method of a struct/union/class.
void setHasFlexibleArrayMember(bool V)
EnumDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void VisitBindingDecl(BindingDecl *BD)
A TemplateTypeParmDecl record.
void demoteThisDefinitionToDeclaration()
This is a definition which should be demoted to a declaration.
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
Common * getCommonPtr() 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 setPointOfInstantiation(SourceLocation Loc)
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.
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.
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
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.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
CXXConstructorDecl * getConstructor() const
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.
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
A ClassTemplatePartialSpecializationDecl record.
void setUsingLoc(SourceLocation L)
Set the source location of the 'using' keyword.
DeclCode
Record codes for each kind of declaration.
const Expr * getInit() const
unsigned IsScoped
IsScoped - True if this tag declaration is a scoped enumeration.
A decomposition declaration.
RedeclarableResult VisitCXXRecordDeclImpl(CXXRecordDecl *D)
void setIvarList(ObjCIvarDecl *ivar)
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
static VarTemplatePartialSpecializationDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Represents a dependent using declaration which was marked with typename.
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
DeclarationName - The name of a declaration.
Represents the declaration of an Objective-C type parameter.
void VisitObjCMethodDecl(ObjCMethodDecl *D)
void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
Specifies that this function declaration is actually a dependent function template specialization...
A LinkageSpecDecl record.
RedeclarableResult VisitRecordDeclImpl(RecordDecl *RD)
static NonTypeTemplateParmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ParmVarDeclBitfields ParmVarDeclBits
static ObjCCategoryDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
EnumDecl - Represents an enum.
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
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.
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 UpdateDecl(Decl *D, llvm::SmallVectorImpl< serialization::DeclID > &)
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)
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)
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
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)
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)
llvm::FoldingSetVector< VarTemplateSpecializationDecl > Specializations
The variable template specializations for this variable template, including explicit specializations ...
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
void VisitIndirectFieldDecl(IndirectFieldDecl *FD)
unsigned varlist_size() const
VarDeclBitfields VarDeclBits
static UsingPackDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumExpansions)
llvm::FoldingSetVector< ClassTemplateSpecializationDecl > Specializations
The class template specializations for this class template, including explicit specializations and in...
virtual CommonBase * newCommon(ASTContext &C) const =0
TranslationUnitDecl - The top declaration context.
static ObjCInterfaceDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
void ReadAttributes(ASTRecordReader &Record, AttrVec &Attrs)
Reads attributes from the current stream position.
void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D)
Common * getCommonPtr() const
A FunctionTemplateDecl record.
std::pair< uint64_t, uint64_t > VisitDeclContext(DeclContext *DC)
static ObjCPropertyImplDecl * CreateDeserialized(ASTContext &C, unsigned ID)
ModuleFile * getOwningModuleFile(const Decl *D)
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
A TypeAliasTemplateDecl record.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
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.
NamedDecl - This represents a decl with 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 setCmdDecl(ImplicitParamDecl *CD)
This represents '#pragma omp threadprivate ...' directive.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Declaration of a template function.
iterator - Iterate over the decls of a specified declaration name.
void setTargetDecl(NamedDecl *ND)
Sets the underlying declaration which has been brought into the local scope.
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
Source range/offset of a preprocessed entity.
Attr - This represents one attribute.
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...
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.