clang: lib/Serialization/ASTWriterDecl.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
24#include "llvm/Bitstream/BitstreamWriter.h"
25#include "llvm/Support/ErrorHandling.h"
26#include
27using namespace clang;
28using namespace serialization;
29
30
31
32
33
38
40 unsigned AbbrevToUse;
41
42 bool GeneratingReducedBMI = false;
43
44 public:
47 : Writer(Writer), Record(Context, Writer, Record),
48 Code((serialization::DeclCode)0), AbbrevToUse(0),
49 GeneratingReducedBMI(GeneratingReducedBMI) {}
50
52 if (!Code)
53 llvm::report_fatal_error(StringRef("unexpected declaration kind '") +
55 return Record.Emit(Code, AbbrevToUse);
56 }
57
59
141
142
163
164
166
167 if (!typeParams) {
169 return;
170 }
171
172 Record.push_back(typeParams->size());
173 for (auto *typeParam : *typeParams) {
174 Record.AddDeclRef(typeParam);
175 }
178 }
179
180
181
183 const Decl *D, bool IncludeLocal,
184 llvm::MapVector<ModuleFile *, const Decl *> &Firsts) {
185
186
188 if (R->isFromASTFile())
190 else if (IncludeLocal)
191 Firsts[nullptr] = R;
192 }
193 }
194
195
196
197
199 llvm::MapVector<ModuleFile *, const Decl *> Firsts;
201
202 for (const auto &F : Firsts)
203 Record.AddDeclRef(F.second);
204 }
205
206
207
208
209
213 assert((isa(D) ||
215 "Must not be called with other decls");
216 llvm::MapVector<ModuleFile *, const Decl *> Firsts;
218
219 for (const auto &F : Firsts) {
222 PartialSpecsInMap.push_back(F.second);
223 else
224 SpecsInMap.push_back(F.second);
225 }
226 }
227
228
229 template
233 }
234
235
236 template
238 return Common->PartialSpecializations;
239 }
242 return std::nullopt;
243 }
244
245 template
247 auto *Common = D->getCommonPtr();
248
249
250
251
252 if (Writer.Chain != Record.getASTContext().getExternalSource() &&
254 D->LoadLazySpecializations();
256 }
257
258
259
261 for (auto &Entry : Common->Specializations)
265
268 for (auto *D : AllSpecs) {
271 }
272
273 Record.AddOffset(Writer.WriteSpecializationInfoLookupTable(
274 D, Specs, false));
275
276
277 if (isa(D)) {
278 assert(PartialSpecs.empty());
279 return;
280 }
281
282 Record.AddOffset(Writer.WriteSpecializationInfoLookupTable(
283 D, PartialSpecs, true));
284 }
285
286
287
291
292
293
294
295
297 return;
298
299
300
302 return;
303
306 Writer.PartialSpecializationsUpdates[cast(Template)]
308 else
309 Writer.SpecializationsUpdates[cast(Template)].push_back(
311 }
312 };
313}
314
316 if (auto *FD = dyn_cast(D)) {
317 if (FD->isInlined() || FD->isConstexpr())
318 return false;
319
320 if (FD->isDependentContext())
321 return false;
322
324 return false;
325 }
326
327 if (auto *VD = dyn_cast(D)) {
328 if (!VD->getDeclContext()->getRedeclContext()->isFileContext() ||
329 VD->isInline() || VD->isConstexpr() || isa(VD) ||
330
331
332
333 VD->hasConstantInitialization())
334 return false;
335
337 return false;
338 }
339
340 return true;
341}
342
345
346
347
348
349 if (auto *DD = dyn_cast(D)) {
350 if (auto *TInfo = DD->getTypeSourceInfo())
351 Record.AddTypeLoc(TInfo->getTypeLoc());
352 }
353
354
355
356
357 if (auto *FD = dyn_cast(D)) {
359 Record.push_back(FD->doesThisDeclarationHaveABody());
360 if (FD->doesThisDeclarationHaveABody())
361 Record.AddFunctionDefinition(FD);
362 } else
364 }
365
366
367
368
369
370 if (auto *VD = dyn_cast(D)) {
372 Record.AddVarDeclInit(VD);
373 else
375 }
376
377
378
379 if (auto *FD = dyn_cast(D)) {
380 if (FD->hasInClassInitializer()) {
381 if (Expr *Init = FD->getInClassInitializer()) {
384 } else {
386
387 }
388 }
389 }
390
391
392
393
394 if (auto *DC = dyn_cast(D))
396}
397
400
401
402
403
404
405
406
407
408
409
419 Record.push_back(DeclBits);
420
424
427
429
430
431
432
433
434
435
436
437
440 while (auto *NS = dyn_cast(DC->getRedeclContext())) {
441 if (!NS->isFromASTFile())
442 break;
443 Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
444 if (!NS->isInlineNamespace())
445 break;
446 DC = NS->getParent();
447 }
448 }
449}
450
452 StringRef Arg = D->getArg();
453 Record.push_back(Arg.size());
456 Record.push_back(D->getCommentKind());
457 Record.AddString(Arg);
459}
460
463 StringRef Name = D->getName();
464 StringRef Value = D->getValue();
465 Record.push_back(Name.size() + 1 + Value.size());
468 Record.AddString(Name);
471}
472
474 llvm_unreachable("Translation units aren't directly serialized");
475}
476
479 Record.AddDeclarationName(D->getDeclName());
482 : 0);
483}
484
489}
490
494 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
495 Record.push_back(D->isModed());
496 if (D->isModed())
497 Record.AddTypeRef(D->getUnderlyingType());
498 Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
499}
500
513
515}
516
519 Record.AddDeclRef(D->getDescribedAliasTemplate());
521}
522
525 "You need to update the serializer after you change the "
526 "TagDeclBits");
527
531
533 TagDeclBits.addBits(llvm::to_underlying(D->getTagKind()), 3);
534 TagDeclBits.addBit(!isa(D) ? D->isCompleteDefinition() : 0);
535 TagDeclBits.addBit(D->isEmbeddedInDeclarator());
536 TagDeclBits.addBit(D->isFreeStanding());
537 TagDeclBits.addBit(D->isCompleteDefinitionRequired());
539 D->hasExtInfo() ? 1 : (D->getTypedefNameForAnonDecl() ? 2 : 0),
540 2);
541 Record.push_back(TagDeclBits);
542
543 Record.AddSourceRange(D->getBraceRange());
544
545 if (D->hasExtInfo()) {
546 Record.AddQualifierInfo(*D->getExtInfo());
547 } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
548 Record.AddDeclRef(TD);
549 Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
550 }
551}
552
555 "You need to update the serializer after you change the "
556 "EnumDeclBits");
557
559 Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
560 if (->getIntegerTypeSourceInfo())
561 Record.AddTypeRef(D->getIntegerType());
562 Record.AddTypeRef(D->getPromotionType());
563
565 EnumDeclBits.addBits(D->getNumPositiveBits(), 8);
566 EnumDeclBits.addBits(D->getNumNegativeBits(), 8);
567 EnumDeclBits.addBit(D->isScoped());
568 EnumDeclBits.addBit(D->isScopedUsingClassTag());
569 EnumDeclBits.addBit(D->isFixed());
570 Record.push_back(EnumDeclBits);
571
572 Record.push_back(D->getODRHash());
573
575 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
576 Record.push_back(MemberInfo->getTemplateSpecializationKind());
577 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
578 } else {
579 Record.AddDeclRef(nullptr);
580 }
581
584 ->getTypedefNameForAnonDecl() &&
588 ->getIntegerTypeSourceInfo() &&
->getMemberSpecializationInfo() &&
592
594}
595
598 "You need to update the serializer after you change the "
599 "RecordDeclBits");
600
602
604 RecordDeclBits.addBit(D->hasFlexibleArrayMember());
605 RecordDeclBits.addBit(D->isAnonymousStructOrUnion());
606 RecordDeclBits.addBit(D->hasObjectMember());
607 RecordDeclBits.addBit(D->hasVolatileMember());
608 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveDefaultInitialize());
609 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveCopy());
610 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveDestroy());
611 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveDefaultInitializeCUnion());
612 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveDestructCUnion());
613 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveCopyCUnion());
614 RecordDeclBits.addBit(D->hasUninitializedExplicitInitFields());
615 RecordDeclBits.addBit(D->isParamDestroyedInCallee());
616 RecordDeclBits.addBits(llvm::to_underlying(D->getArgPassingRestrictions()), 2);
617 Record.push_back(RecordDeclBits);
618
619
620
621 if (!isa(D))
622 Record.push_back(D->getODRHash());
623
626 ->getTypedefNameForAnonDecl() &&
633
635}
636
639 Record.AddTypeRef(D->getType());
640}
641
644 Record.push_back(D->getInitExpr()? 1 : 0);
645 if (D->getInitExpr())
646 Record.AddStmt(D->getInitExpr());
647 Record.AddAPSInt(D->getInitVal());
648
650}
651
654 Record.AddSourceLocation(D->getInnerLocStart());
655 Record.push_back(D->hasExtInfo());
656 if (D->hasExtInfo()) {
657 DeclaratorDecl::ExtInfo *Info = D->getExtInfo();
658 Record.AddQualifierInfo(*Info);
659 Record.AddStmt(Info->TrailingRequiresClause);
660 }
661
662 Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()
664}
665
668 "You need to update the serializer after you change the "
669 "FunctionDeclBits");
670
672
673 Record.push_back(D->getTemplatedKind());
674 switch (D->getTemplatedKind()) {
676 break;
678 Record.AddDeclRef(D->getInstantiatedFromDecl());
679 break;
681 Record.AddDeclRef(D->getDescribedFunctionTemplate());
682 break;
688 break;
689 }
692 FTSInfo = D->getTemplateSpecializationInfo();
693
695
698
699
701
702
705 Record.AddASTTemplateArgumentListInfo(
707
709
713 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
714 Record.push_back(MemberInfo->getTemplateSpecializationKind());
715 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
716 } else {
718 }
719
721
722
724 }
725 break;
726 }
729 DFTSInfo = D->getDependentSpecializationInfo();
730
731
734 Record.AddDeclRef(FTD);
735
736
739 Record.AddASTTemplateArgumentListInfo(
741 break;
742 }
743 }
744
746 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
748
749
750
751
753
754 FunctionDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), 3);
755 FunctionDeclBits.addBits((uint32_t)D->getStorageClass(), 3);
756 FunctionDeclBits.addBit(D->isInlineSpecified());
757 FunctionDeclBits.addBit(D->isInlined());
758 FunctionDeclBits.addBit(D->hasSkippedBody());
759 FunctionDeclBits.addBit(D->isVirtualAsWritten());
760 FunctionDeclBits.addBit(D->isPureVirtual());
761 FunctionDeclBits.addBit(D->hasInheritedPrototype());
762 FunctionDeclBits.addBit(D->hasWrittenPrototype());
763 FunctionDeclBits.addBit(D->isDeletedBit());
764 FunctionDeclBits.addBit(D->isTrivial());
765 FunctionDeclBits.addBit(D->isTrivialForCall());
766 FunctionDeclBits.addBit(D->isDefaulted());
767 FunctionDeclBits.addBit(D->isExplicitlyDefaulted());
768 FunctionDeclBits.addBit(D->isIneligibleOrNotSelected());
769 FunctionDeclBits.addBits((uint64_t)(D->getConstexprKind()), 2);
770 FunctionDeclBits.addBit(D->hasImplicitReturnZero());
771 FunctionDeclBits.addBit(D->isMultiVersion());
772 FunctionDeclBits.addBit(D->isLateTemplateParsed());
773 FunctionDeclBits.addBit(D->FriendConstraintRefersToEnclosingTemplate());
774 FunctionDeclBits.addBit(D->usesSEHTry());
775 Record.push_back(FunctionDeclBits);
776
778 if (D->isExplicitlyDefaulted())
779 Record.AddSourceLocation(D->getDefaultLoc());
780
781 Record.push_back(D->getODRHash());
782
783 if (D->isDefaulted() || D->isDeletedAsWritten()) {
784 if (auto *FDI = D->getDefalutedOrDeletedInfo()) {
785
786
787 StringLiteral *DeletedMessage = FDI->getDeletedMessage();
788 Record.push_back(1 | (DeletedMessage ? 2 : 0));
789 if (DeletedMessage)
790 Record.AddStmt(DeletedMessage);
791
792 Record.push_back(FDI->getUnqualifiedLookups().size());
794 Record.AddDeclRef(P.getDecl());
795 Record.push_back(P.getAccess());
796 }
797 } else {
799 }
800 }
801
803
804
805
806 if (auto *RD = dyn_cast(D->getLexicalParent()))
807 if (RD->isDependentContext() && RD->isThisDeclarationADefinition()) {
808 Writer.RelatedDeclsMap[Writer.GetDeclRef(RD)].push_back(
810 }
811 }
812
813 Record.push_back(D->param_size());
814 for (auto *P : D->parameters())
817}
818
821 uint64_t Kind = static_cast<uint64_t>(ES.getKind());
822 Kind = Kind << 1 | static_cast(ES.getExpr());
823 Record.push_back(Kind);
826 }
827}
828
831 Record.AddDeclRef(D->Ctor);
833 Record.push_back(static_cast<unsigned char>(D->getDeductionCandidateKind()));
835}
836
839 "You need to update the serializer after you change the "
840 "ObjCMethodDeclBits");
841
843
844
845 bool HasBodyStuff = D->getBody() != nullptr;
846 Record.push_back(HasBodyStuff);
847 if (HasBodyStuff) {
849 }
850 Record.AddDeclRef(D->getSelfDecl());
851 Record.AddDeclRef(D->getCmdDecl());
852 Record.push_back(D->isInstanceMethod());
853 Record.push_back(D->isVariadic());
854 Record.push_back(D->isPropertyAccessor());
855 Record.push_back(D->isSynthesizedAccessorStub());
856 Record.push_back(D->isDefined());
857 Record.push_back(D->isOverriding());
858 Record.push_back(D->hasSkippedBody());
859
860 Record.push_back(D->isRedeclaration());
861 Record.push_back(D->hasRedeclaration());
862 if (D->hasRedeclaration()) {
863 assert(Record.getASTContext().getObjCMethodRedeclaration(D));
864 Record.AddDeclRef(Record.getASTContext().getObjCMethodRedeclaration(D));
865 }
866
867
868 Record.push_back(llvm::to_underlying(D->getImplementationControl()));
869
870 Record.push_back(D->getObjCDeclQualifier());
871 Record.push_back(D->hasRelatedResultType());
872 Record.AddTypeRef(D->getReturnType());
873 Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
875 Record.push_back(D->param_size());
876 for (const auto *P : D->parameters())
878
879 Record.push_back(D->getSelLocsKind());
880 unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
882 Record.push_back(NumStoredSelLocs);
883 for (unsigned i = 0; i != NumStoredSelLocs; ++i)
884 Record.AddSourceLocation(SelLocs[i]);
885
887}
888
891 Record.push_back(D->Variance);
892 Record.push_back(D->Index);
893 Record.AddSourceLocation(D->VarianceLoc);
894 Record.AddSourceLocation(D->ColonLoc);
895
897}
898
901 "You need to update the serializer after you change the "
902 "ObjCContainerDeclBits");
903
905 Record.AddSourceLocation(D->getAtStartLoc());
906 Record.AddSourceRange(D->getAtEndRange());
907
908}
909
915
916 Record.push_back(D->isThisDeclarationADefinition());
917 if (D->isThisDeclarationADefinition()) {
918
919 ObjCInterfaceDecl::DefinitionData &Data = D->data();
920
921 Record.AddTypeSourceInfo(D->getSuperClassTInfo());
922 Record.AddSourceLocation(D->getEndOfDefinitionLoc());
923 Record.push_back(Data.HasDesignatedInitializers);
924 Record.push_back(D->getODRHash());
925
926
927 Record.push_back(Data.ReferencedProtocols.size());
928 for (const auto *P : D->protocols())
930 for (const auto &PL : D->protocol_locs())
931 Record.AddSourceLocation(PL);
932
933
934 Record.push_back(Data.AllReferencedProtocols.size());
936 P = Data.AllReferencedProtocols.begin(),
937 PEnd = Data.AllReferencedProtocols.end();
940
941
943
944 Writer.ObjCClassesWithCategories.insert(D);
945
946
947 for (; Cat; Cat = Cat->getNextClassCategoryRaw())
949 }
950 }
951
953}
954
957
958 Record.push_back(D->getAccessControl());
959 Record.push_back(D->getSynthesize());
960
968 ->getBitWidth() &&
969 ->hasExtInfo() &&
970 D->getDeclName())
972
974}
975
979
980 Record.push_back(D->isThisDeclarationADefinition());
981 if (D->isThisDeclarationADefinition()) {
982 Record.push_back(D->protocol_size());
983 for (const auto *I : D->protocols())
984 Record.AddDeclRef(I);
985 for (const auto &PL : D->protocol_locs())
986 Record.AddSourceLocation(PL);
987 Record.push_back(D->getODRHash());
988 }
989
991}
992
996}
997
1000 Record.AddSourceLocation(D->getCategoryNameLoc());
1001 Record.AddSourceLocation(D->getIvarLBraceLoc());
1002 Record.AddSourceLocation(D->getIvarRBraceLoc());
1003 Record.AddDeclRef(D->getClassInterface());
1005 Record.push_back(D->protocol_size());
1006 for (const auto *I : D->protocols())
1007 Record.AddDeclRef(I);
1008 for (const auto &PL : D->protocol_locs())
1009 Record.AddSourceLocation(PL);
1011}
1012
1015 Record.AddDeclRef(D->getClassInterface());
1017}
1018
1021 Record.AddSourceLocation(D->getAtLoc());
1022 Record.AddSourceLocation(D->getLParenLoc());
1023 Record.AddTypeRef(D->getType());
1024 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
1025
1026 Record.push_back((unsigned)D->getPropertyAttributes());
1027 Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
1028
1029 Record.push_back((unsigned)D->getPropertyImplementation());
1030 Record.AddDeclarationName(D->getGetterName());
1031 Record.AddSourceLocation(D->getGetterNameLoc());
1032 Record.AddDeclarationName(D->getSetterName());
1033 Record.AddSourceLocation(D->getSetterNameLoc());
1034 Record.AddDeclRef(D->getGetterMethodDecl());
1035 Record.AddDeclRef(D->getSetterMethodDecl());
1036 Record.AddDeclRef(D->getPropertyIvarDecl());
1038}
1039
1042 Record.AddDeclRef(D->getClassInterface());
1043
1044}
1045
1048 Record.AddSourceLocation(D->getCategoryNameLoc());
1050}
1051
1054 Record.AddDeclRef(D->getSuperClass());
1055 Record.AddSourceLocation(D->getSuperClassLoc());
1056 Record.AddSourceLocation(D->getIvarLBraceLoc());
1057 Record.AddSourceLocation(D->getIvarRBraceLoc());
1058 Record.push_back(D->hasNonZeroConstructors());
1059 Record.push_back(D->hasDestructors());
1060 Record.push_back(D->NumIvarInitializers);
1061 if (D->NumIvarInitializers)
1062 Record.AddCXXCtorInitializers(
1065}
1066
1070 Record.AddDeclRef(D->getPropertyDecl());
1071 Record.AddDeclRef(D->getPropertyIvarDecl());
1072 Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
1073 Record.AddDeclRef(D->getGetterMethodDecl());
1074 Record.AddDeclRef(D->getSetterMethodDecl());
1075 Record.AddStmt(D->getGetterCXXConstructor());
1076 Record.AddStmt(D->getSetterCXXAssignment());
1078}
1079
1082 Record.push_back(D->isMutable());
1083
1084 Record.push_back((D->StorageKind << 1) | D->BitField);
1085 if (D->StorageKind == FieldDecl::ISK_CapturedVLAType)
1086 Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
1087 else if (D->BitField)
1088 Record.AddStmt(D->getBitWidth());
1089
1090 if (->getDeclName() || D->isPlaceholderVar(Writer.getLangOpts()))
1092 Record.getASTContext().getInstantiatedFromUnnamedFieldDecl(D));
1093
1102 ->getBitWidth() &&
1103 ->hasInClassInitializer() &&
1104 ->hasCapturedVLAType() &&
1105 ->hasExtInfo() &&
1108 D->getDeclName())
1110
1112}
1113
1116 Record.AddIdentifierRef(D->getGetterId());
1117 Record.AddIdentifierRef(D->getSetterId());
1119}
1120
1129}
1130
1134 Record.AddAPValue(D->getValue());
1136}
1137
1140 Record.AddAPValue(D->getValue());
1142}
1143
1146 Record.push_back(D->getChainingSize());
1147
1148 for (const auto *P : D->chain())
1151}
1152
1156
1157
1158
1159
1161 VarDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()),
1162 3);
1163
1164 bool ModulesCodegen = false;
1165 if (Writer.WritingModule && D->getStorageDuration() == SD_Static &&
1166 ->getDescribedVarTemplate()) {
1167
1168
1169
1170
1173 Writer.getLangOpts().BuildingPCHWithObjectFile)) &&
1174 Record.getASTContext().GetGVALinkageForVariable(D) >=
1176 }
1177 VarDeclBits.addBit(ModulesCodegen);
1178
1179 VarDeclBits.addBits(D->getStorageClass(), 3);
1180 VarDeclBits.addBits(D->getTSCSpec(), 2);
1181 VarDeclBits.addBits(D->getInitStyle(), 2);
1182 VarDeclBits.addBit(D->isARCPseudoStrong());
1183
1184 bool HasDeducedType = false;
1185 if (!isa(D)) {
1186 VarDeclBits.addBit(D->isThisDeclarationADemotedDefinition());
1187 VarDeclBits.addBit(D->isExceptionVariable());
1188 VarDeclBits.addBit(D->isNRVOVariable());
1189 VarDeclBits.addBit(D->isCXXForRangeDecl());
1190
1191 VarDeclBits.addBit(D->isInline());
1192 VarDeclBits.addBit(D->isInlineSpecified());
1193 VarDeclBits.addBit(D->isConstexpr());
1194 VarDeclBits.addBit(D->isInitCapture());
1195 VarDeclBits.addBit(D->isPreviousDeclInSameBlockScope());
1196
1197 VarDeclBits.addBit(D->isEscapingByref());
1198 HasDeducedType = D->getType()->getContainedDeducedType();
1199 VarDeclBits.addBit(HasDeducedType);
1200
1201 if (const auto *IPD = dyn_cast(D))
1202 VarDeclBits.addBits(llvm::to_underlying(IPD->getParameterKind()),
1203 3);
1204 else
1205 VarDeclBits.addBits(0, 3);
1206
1207 VarDeclBits.addBit(D->isObjCForDecl());
1208 }
1209
1210 Record.push_back(VarDeclBits);
1211
1212 if (ModulesCodegen)
1213 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);
1214
1218 if (Init.getCopyExpr())
1220 }
1221
1222 enum {
1223 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1224 };
1225 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1226 Record.push_back(VarTemplate);
1227 Record.AddDeclRef(TemplD);
1229 = D->getMemberSpecializationInfo()) {
1230 Record.push_back(StaticDataMemberSpecialization);
1231 Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1232 Record.push_back(SpecInfo->getTemplateSpecializationKind());
1233 Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1234 } else {
1235 Record.push_back(VarNotTemplate);
1236 }
1237
1243 D->getKind() == Decl::Var && ->isInline() &&
->isConstexpr() &&
1244 ->isInitCapture() &&
->isPreviousDeclInSameBlockScope() &&
1245 ->isEscapingByref() && !HasDeducedType &&
1246 D->getStorageDuration() != SD_Static && ->getDescribedVarTemplate() &&
1247 ->getMemberSpecializationInfo() &&
->isObjCForDecl() &&
1248 !isa(D) && ->isEscapingByref())
1250
1252}
1253
1257}
1258
1261
1262
1263
1264
1265 Record.push_back(D->getFunctionScopeIndex());
1266
1268 ParmVarDeclBits.addBit(D->isObjCMethodParameter());
1269 ParmVarDeclBits.addBits(D->getFunctionScopeDepth(), 7);
1270
1271 ParmVarDeclBits.addBits(D->getObjCDeclQualifier(), 7);
1272 ParmVarDeclBits.addBit(D->isKNRPromoted());
1273 ParmVarDeclBits.addBit(D->hasInheritedDefaultArg());
1274 ParmVarDeclBits.addBit(D->hasUninstantiatedDefaultArg());
1275 ParmVarDeclBits.addBit(D->getExplicitObjectParamThisLoc().isValid());
1276 Record.push_back(ParmVarDeclBits);
1277
1278 if (D->hasUninstantiatedDefaultArg())
1279 Record.AddStmt(D->getUninstantiatedDefaultArg());
1280 if (D->getExplicitObjectParamThisLoc().isValid())
1281 Record.AddSourceLocation(D->getExplicitObjectParamThisLoc());
1283
1284
1285
1286
1288 ->hasExtInfo() && D->getStorageClass() == 0 &&
->isInvalidDecl() &&
1290 D->getInitStyle() == VarDecl::CInit &&
1291 D->getInit() == nullptr)
1293
1294
1295
1296 assert(->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1297 assert(->isThisDeclarationADemotedDefinition()
1298 && "PARM_VAR_DECL can't be demoted definition.");
1299 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1300 assert(->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1301 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1302 assert(->isStaticDataMember() &&
1303 "PARM_VAR_DECL can't be static data member");
1304}
1305
1307
1308 Record.push_back(D->bindings().size());
1309
1311 for (auto *B : D->bindings())
1312 Record.AddDeclRef(B);
1314}
1315
1318 Record.AddStmt(D->getBinding());
1320}
1321
1324 Record.AddStmt(D->getAsmString());
1325 Record.AddSourceLocation(D->getRParenLoc());
1327}
1328
1331 Record.AddStmt(D->getStmt());
1333}
1334
1338}
1339
1343 Record.AddDeclRef(D->getExtendingDecl());
1344 Record.AddStmt(D->getTemporaryExpr());
1345 Record.push_back(static_cast<bool>(D->getValue()));
1346 if (D->getValue())
1347 Record.AddAPValue(*D->getValue());
1348 Record.push_back(D->getManglingNumber());
1350}
1354 Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1355 Record.push_back(D->param_size());
1358 Record.push_back(D->isVariadic());
1359 Record.push_back(D->blockMissingReturnType());
1360 Record.push_back(D->isConversionFromLambda());
1361 Record.push_back(D->doesNotEscape());
1362 Record.push_back(D->canAvoidCopyToHeap());
1363 Record.push_back(D->capturesCXXThis());
1364 Record.push_back(D->getNumCaptures());
1365 for (const auto &capture : D->captures()) {
1366 Record.AddDeclRef(capture.getVariable());
1367
1368 unsigned flags = 0;
1369 if (capture.isByRef()) flags |= 1;
1370 if (capture.isNested()) flags |= 2;
1371 if (capture.hasCopyExpr()) flags |= 4;
1372 Record.push_back(flags);
1373
1374 if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1375 }
1376
1378}
1379
1385
1386 for (unsigned I = 0; I < CD->getNumParams(); ++I)
1389}
1390
1393 "You need to update the serializer after you change the"
1394 "LinkageSpecDeclBits");
1395
1397 Record.push_back(llvm::to_underlying(D->getLanguage()));
1398 Record.AddSourceLocation(D->getExternLoc());
1399 Record.AddSourceLocation(D->getRBraceLoc());
1401}
1402
1405 Record.AddSourceLocation(D->getRBraceLoc());
1407}
1408
1413}
1414
1415
1419
1421 NamespaceDeclBits.addBit(D->isInline());
1422 NamespaceDeclBits.addBit(D->isNested());
1423 Record.push_back(NamespaceDeclBits);
1424
1426 Record.AddSourceLocation(D->getRBraceLoc());
1427
1429 Record.AddDeclRef(D->getAnonymousNamespace());
1431
1432 if (Writer.hasChain() && D->isAnonymousNamespace() &&
1434
1435
1436
1437
1439 D->getParent()->getRedeclContext()->getPrimaryContext());
1440 if (Parent->isFromASTFile() || isa(Parent)) {
1441 Writer.DeclUpdates[Parent].push_back(
1443 }
1444 }
1445}
1446
1450 Record.AddSourceLocation(D->getNamespaceLoc());
1451 Record.AddSourceLocation(D->getTargetNameLoc());
1452 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1453 Record.AddDeclRef(D->getNamespace());
1455}
1456
1459 Record.AddSourceLocation(D->getUsingLoc());
1460 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1461 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1462 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1463 Record.push_back(D->hasTypename());
1464 Record.AddDeclRef(Record.getASTContext().getInstantiatedFromUsingDecl(D));
1466}
1467
1470 Record.AddSourceLocation(D->getUsingLoc());
1471 Record.AddSourceLocation(D->getEnumLoc());
1472 Record.AddTypeSourceInfo(D->getEnumType());
1473 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1474 Record.AddDeclRef(Record.getASTContext().getInstantiatedFromUsingEnumDecl(D));
1476}
1477
1479 Record.push_back(D->NumExpansions);
1481 Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
1482 for (auto *E : D->expansions())
1485}
1486
1490 Record.AddDeclRef(D->getTargetDecl());
1492 Record.AddDeclRef(D->UsingOrNextShadow);
1494 Record.getASTContext().getInstantiatedFromUsingShadowDecl(D));
1495
1501
1503}
1504
1508 Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1509 Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1510 Record.push_back(D->IsVirtual);
1512}
1513
1516 Record.AddSourceLocation(D->getUsingLoc());
1517 Record.AddSourceLocation(D->getNamespaceKeyLocation());
1518 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1519 Record.AddDeclRef(D->getNominatedNamespace());
1520 Record.AddDeclRef(dyn_cast(D->getCommonAncestor()));
1522}
1523
1526 Record.AddSourceLocation(D->getUsingLoc());
1527 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1528 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1529 Record.AddSourceLocation(D->getEllipsisLoc());
1531}
1532
1536 Record.AddSourceLocation(D->getTypenameLoc());
1537 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1538 Record.AddSourceLocation(D->getEllipsisLoc());
1540}
1541
1546}
1547
1550
1551 enum {
1552 CXXRecNotTemplate = 0,
1553 CXXRecTemplate,
1554 CXXRecMemberSpecialization,
1555 CXXLambda
1556 };
1558 Record.push_back(CXXRecTemplate);
1559 Record.AddDeclRef(TemplD);
1561 = D->getMemberSpecializationInfo()) {
1562 Record.push_back(CXXRecMemberSpecialization);
1563 Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1564 Record.push_back(MSInfo->getTemplateSpecializationKind());
1565 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1566 } else if (D->isLambda()) {
1567
1568 Record.push_back(CXXLambda);
1569 if (auto *Context = D->getLambdaContextDecl()) {
1570 Record.AddDeclRef(Context);
1571 Record.push_back(D->getLambdaIndexInContext());
1572 } else {
1573 Record.push_back(0);
1574 }
1575
1576 if (auto FD = llvm::dyn_cast_or_null(D->getDeclContext());
1577 FD && FD->isCanonicalDecl()) {
1578 Writer.RelatedDeclsMap[Writer.GetDeclRef(FD)].push_back(
1580 }
1581 } else {
1582 Record.push_back(CXXRecNotTemplate);
1583 }
1584
1585 Record.push_back(D->isThisDeclarationADefinition());
1586 if (D->isThisDeclarationADefinition())
1587 Record.AddCXXDefinitionData(D);
1588
1590 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);
1591
1592
1593
1594
1595
1596
1597 if (D->isCompleteDefinition())
1598 Record.AddDeclRef(Record.getASTContext().getCurrentKeyFunction(D));
1599
1601}
1602
1606 Record.push_back(D->size_overridden_methods());
1607 for (const CXXMethodDecl *MD : D->overridden_methods())
1608 Record.AddDeclRef(MD);
1609 } else {
1610
1611 Record.push_back(0);
1612 }
1613
1618 ->hasExtInfo() &&
->isExplicitlyDefaulted()) {
1624 else if (D->getTemplatedKind() ==
1627 D->getTemplateSpecializationInfo();
1628
1635 }
1636 } else if (D->getTemplatedKind() ==
1639 D->getDependentSpecializationInfo();
1642 }
1643 }
1644
1646}
1647
1650 "You need to update the serializer after you change the "
1651 "CXXConstructorDeclBits");
1652
1653 Record.push_back(D->getTrailingAllocKind());
1655 if (auto Inherited = D->getInheritedConstructor()) {
1656 Record.AddDeclRef(Inherited.getShadowDecl());
1657 Record.AddDeclRef(Inherited.getConstructor());
1658 }
1659
1662}
1663
1666
1667 Record.AddDeclRef(D->getOperatorDelete());
1668 if (D->getOperatorDelete())
1669 Record.AddStmt(D->getOperatorDeleteThisArg());
1670
1672}
1673
1678}
1679
1682 Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1684 Record.push_back(!IdentifierLocs.empty());
1685 if (IdentifierLocs.empty()) {
1687 Record.push_back(1);
1688 } else {
1689 for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1690 Record.AddSourceLocation(IdentifierLocs[I]);
1691 Record.push_back(IdentifierLocs.size());
1692 }
1693
1694
1696}
1697
1700 Record.AddSourceLocation(D->getColonLoc());
1702}
1703
1705
1706
1707 Record.push_back(D->NumTPLists);
1709 bool hasFriendDecl = isa<NamedDecl *>(D->Friend);
1710 Record.push_back(hasFriendDecl);
1711 if (hasFriendDecl)
1712 Record.AddDeclRef(D->getFriendDecl());
1713 else
1714 Record.AddTypeSourceInfo(D->getFriendType());
1715 for (unsigned i = 0; i < D->NumTPLists; ++i)
1716 Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1717 Record.AddDeclRef(D->getNextFriend());
1718 Record.push_back(D->UnsupportedFriend);
1719 Record.AddSourceLocation(D->FriendLoc);
1720 Record.AddSourceLocation(D->EllipsisLoc);
1722}
1723
1726 Record.push_back(D->getNumTemplateParameters());
1727 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1728 Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1729 Record.push_back(D->getFriendDecl() != nullptr);
1730 if (D->getFriendDecl())
1731 Record.AddDeclRef(D->getFriendDecl());
1732 else
1733 Record.AddTypeSourceInfo(D->getFriendType());
1734 Record.AddSourceLocation(D->getFriendLoc());
1736}
1737
1740
1741 Record.AddTemplateParameterList(D->getTemplateParameters());
1742 Record.AddDeclRef(D->getTemplatedDecl());
1743}
1744
1747 Record.AddStmt(D->getConstraintExpr());
1749}
1750
1753 Record.push_back(D->getTemplateArguments().size());
1756 Record.AddTemplateArgument(Arg);
1758}
1759
1762}
1763
1766
1767
1768
1770
1771 Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());
1772 if (D->getInstantiatedFromMemberTemplate())
1773 Record.push_back(D->isMemberSpecialization());
1774 }
1775
1778}
1779
1782
1785
1786
1787
1789 auto Name =
1790 Record.getASTContext().DeclarationNames.getCXXDeductionGuideName(D);
1792 Writer.GetDeclRef(DG->getCanonicalDecl());
1793 }
1794
1796}
1797
1801
1803
1806 = D->getSpecializedTemplateOrPartial();
1808 Record.AddDeclRef(InstFromD);
1809 } else {
1810 Record.AddDeclRef(cast<ClassTemplatePartialSpecializationDecl *>(InstFrom));
1811 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1812 }
1813
1814 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1815 Record.AddSourceLocation(D->getPointOfInstantiation());
1816 Record.push_back(D->getSpecializationKind());
1818
1820
1822 }
1823
1824 bool ExplicitInstantiation =
1825 D->getTemplateSpecializationKind() ==
1828 Record.push_back(ExplicitInstantiation);
1829 if (ExplicitInstantiation) {
1830 Record.AddSourceLocation(D->getExternKeywordLoc());
1831 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1832 }
1833
1835 D->getTemplateArgsAsWritten();
1836 Record.push_back(!!ArgsWritten);
1837 if (ArgsWritten)
1838 Record.AddASTTemplateArgumentListInfo(ArgsWritten);
1839
1840
1841
1842
1843
1844
1846 auto Name =
1847 Record.getASTContext().DeclarationNames.getCXXDeductionGuideName(
1848 D->getSpecializedTemplate());
1850 Writer.GetDeclRef(DG->getCanonicalDecl());
1851 }
1852
1854}
1855
1858 Record.AddTemplateParameterList(D->getTemplateParameters());
1859
1861
1862
1864 Record.AddDeclRef(D->getInstantiatedFromMember());
1865 Record.push_back(D->isMemberSpecialization());
1866 }
1867
1869}
1870
1873
1877}
1878
1882
1883 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1884 InstFrom = D->getSpecializedTemplateOrPartial();
1886 Record.AddDeclRef(InstFromD);
1887 } else {
1888 Record.AddDeclRef(cast<VarTemplatePartialSpecializationDecl *>(InstFrom));
1889 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1890 }
1891
1892 bool ExplicitInstantiation =
1893 D->getTemplateSpecializationKind() ==
1896 Record.push_back(ExplicitInstantiation);
1897 if (ExplicitInstantiation) {
1898 Record.AddSourceLocation(D->getExternKeywordLoc());
1899 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1900 }
1901
1903 D->getTemplateArgsAsWritten();
1904 Record.push_back(!!ArgsWritten);
1905 if (ArgsWritten)
1906 Record.AddASTTemplateArgumentListInfo(ArgsWritten);
1907
1908 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1909 Record.AddSourceLocation(D->getPointOfInstantiation());
1910 Record.push_back(D->getSpecializationKind());
1911 Record.push_back(D->IsCompleteDefinition);
1912
1914
1916
1918
1920 }
1921
1923}
1924
1927 Record.AddTemplateParameterList(D->getTemplateParameters());
1928
1930
1931
1933 Record.AddDeclRef(D->getInstantiatedFromMember());
1934 Record.push_back(D->isMemberSpecialization());
1935 }
1936
1938}
1939
1942
1946}
1947
1949 Record.push_back(D->hasTypeConstraint());
1951
1952 Record.push_back(D->wasDeclaredWithTypename());
1953
1955 if (D->hasTypeConstraint())
1956 Record.push_back(TC != nullptr);
1957 if (TC) {
1959 Record.push_back(CR != nullptr);
1960 if (CR)
1961 Record.AddConceptReference(CR);
1963 Record.push_back(D->isExpandedParameterPack());
1964 if (D->isExpandedParameterPack())
1965 Record.push_back(D->getNumExpansionParameters());
1966 }
1967
1968 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1969 ->defaultArgumentWasInherited();
1970 Record.push_back(OwnsDefaultArg);
1971 if (OwnsDefaultArg)
1972 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
1973
1974 if (->hasTypeConstraint() && !OwnsDefaultArg &&
1980
1982}
1983
1985
1986
1987
1990 if (D->isExpandedParameterPack())
1991 Record.push_back(D->getNumExpansionTypes());
1992
1994
1995 Record.push_back(D->getDepth());
1996 Record.push_back(D->getPosition());
1999
2000 if (D->isExpandedParameterPack()) {
2001 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
2002 Record.AddTypeRef(D->getExpansionType(I));
2003 Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
2004 }
2005
2007 } else {
2008
2010 bool OwnsDefaultArg = D->hasDefaultArgument() &&
2011 ->defaultArgumentWasInherited();
2012 Record.push_back(OwnsDefaultArg);
2013 if (OwnsDefaultArg)
2014 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
2016 }
2017}
2018
2020
2021
2022
2023 if (D->isExpandedParameterPack())
2024 Record.push_back(D->getNumExpansionTemplateParameters());
2025
2027 Record.push_back(D->wasDeclaredWithTypename());
2028
2029 Record.push_back(D->getDepth());
2030 Record.push_back(D->getPosition());
2031
2032 if (D->isExpandedParameterPack()) {
2033 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
2034 I != N; ++I)
2035 Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
2037 } else {
2038
2040 bool OwnsDefaultArg = D->hasDefaultArgument() &&
2041 ->defaultArgumentWasInherited();
2042 Record.push_back(OwnsDefaultArg);
2043 if (OwnsDefaultArg)
2044 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
2046 }
2047}
2048
2052}
2053
2056 Record.AddStmt(D->getAssertExpr());
2057 Record.push_back(D->isFailed());
2058 Record.AddStmt(D->getMessage());
2059 Record.AddSourceLocation(D->getRParenLoc());
2061}
2062
2063
2066 "You need to update the serializer after you change the "
2067 "DeclContextBits");
2068
2069 uint64_t LexicalOffset = 0;
2070 uint64_t VisibleOffset = 0;
2071 uint64_t ModuleLocalOffset = 0;
2072 uint64_t TULocalOffset = 0;
2073
2075 cast(DC)->isFromExplicitGlobalModule()) {
2076
2077
2078
2079 Writer.DelayedNamespace.push_back(cast(DC));
2080 } else {
2081 LexicalOffset =
2082 Writer.WriteDeclContextLexicalBlock(Record.getASTContext(), DC);
2083 Writer.WriteDeclContextVisibleBlock(Record.getASTContext(), DC,
2084 VisibleOffset, ModuleLocalOffset,
2085 TULocalOffset);
2086 }
2087
2088 Record.AddOffset(LexicalOffset);
2089 Record.AddOffset(VisibleOffset);
2090 Record.AddOffset(ModuleLocalOffset);
2091 Record.AddOffset(TULocalOffset);
2092}
2093
2095 assert(IsLocalDecl(D) && "expected a local declaration");
2096
2099 return Canon;
2100
2101 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
2102 if (CacheEntry)
2103 return CacheEntry;
2104
2107 D = Redecl;
2108 return CacheEntry = D;
2109}
2110
2111template
2113 T *First = D->getFirstDecl();
2114 T *MostRecent = First->getMostRecentDecl();
2115 T *DAsT = static_cast<T *>(D);
2116 if (MostRecent != First) {
2118 "Not considered redeclarable?");
2119
2121
2122
2123
2125 if (DAsT == FirstLocal) {
2126
2127
2128
2129 unsigned I = Record.size();
2130 Record.push_back(0);
2131 if (Writer.Chain)
2133
2135
2136
2137
2142 if (!Prev->isFromASTFile())
2144
2145
2146
2147 if (LocalRedecls.empty())
2148 Record.push_back(0);
2149 else
2151 } else {
2152 Record.push_back(0);
2153 Record.AddDeclRef(FirstLocal);
2154 }
2155
2156
2157
2158
2159
2160
2161
2163 (void)Writer.GetDeclRef(MostRecent);
2164 } else {
2165
2166 Record.push_back(0);
2167 }
2168}
2169
2173 Record.push_back(D->isCBuffer());
2174 Record.AddSourceLocation(D->getLocStart());
2175 Record.AddSourceLocation(D->getLBraceLoc());
2176 Record.AddSourceLocation(D->getRBraceLoc());
2177
2179}
2180
2182 Record.writeOMPChildren(D->Data);
2185}
2186
2188 Record.writeOMPChildren(D->Data);
2191}
2192
2194 Record.writeOMPChildren(D->Data);
2197}
2198
2201 "You need to update the serializer after you change the "
2202 "NumOMPDeclareReductionDeclBits");
2203
2206 Record.AddStmt(D->getCombinerIn());
2207 Record.AddStmt(D->getCombinerOut());
2208 Record.AddStmt(D->getCombiner());
2209 Record.AddStmt(D->getInitOrig());
2210 Record.AddStmt(D->getInitPriv());
2211 Record.AddStmt(D->getInitializer());
2212 Record.push_back(llvm::to_underlying(D->getInitializerKind()));
2213 Record.AddDeclRef(D->getPrevDeclInScope());
2215}
2216
2218 Record.writeOMPChildren(D->Data);
2220 Record.AddDeclarationName(D->getVarName());
2221 Record.AddDeclRef(D->getPrevDeclInScope());
2223}
2224
2228}
2229
2230
2231
2232
2233
2234namespace {
2235template <FunctionDecl::TemplatedKind Kind>
2236std::shared_ptrllvm::BitCodeAbbrev
2238 using namespace llvm;
2239
2240 auto Abv = std::make_shared();
2241 Abv->Add(BitCodeAbbrevOp(Code));
2242
2243 Abv->Add(BitCodeAbbrevOp(0));
2244 Abv->Add(BitCodeAbbrevOp(Kind));
2246
2248
2249 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2251
2252 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2254 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2255 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2256 3));
2257 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2258 } else if constexpr (Kind ==
2260 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2261 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2262 3));
2263 Abv->Add(BitCodeAbbrevOp(1));
2265 Abv->Add(
2266 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2267 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2268 Abv->Add(BitCodeAbbrevOp(0));
2269 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2270 Abv->Add(BitCodeAbbrevOp(0));
2271 Abv->Add(
2272 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2275
2276 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2277 Abv->Add(BitCodeAbbrevOp(0));
2278 } else {
2279 llvm_unreachable("Unknown templated kind?");
2280 }
2281
2282 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2283 8));
2284
2285
2286
2287
2288
2289
2290
2291 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2292 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2293
2295 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2296 Abv->Add(BitCodeAbbrevOp(0));
2297
2298 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2299
2300 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2301 Abv->Add(BitCodeAbbrevOp(0));
2302 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2303
2304 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11));
2305 Abv->Add(BitCodeAbbrevOp(
2306 BitCodeAbbrevOp::Fixed,
2307 28));
2308
2309
2310
2311
2312
2313
2314 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2315 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2316
2317
2318
2319
2320
2321
2322
2323
2324 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2325 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2326 return Abv;
2327}
2328
2329template <FunctionDecl::TemplatedKind Kind>
2330std::shared_ptrllvm::BitCodeAbbrev getCXXMethodAbbrev() {
2332}
2333}
2334
2335void ASTWriter::WriteDeclAbbrevs() {
2336 using namespace llvm;
2337
2338 std::shared_ptr Abv;
2339
2340
2341 Abv = std::make_shared();
2343
2344 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2345 7));
2346
2347
2348
2349
2350
2351
2352 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2353 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2354
2355 Abv->Add(BitCodeAbbrevOp(0));
2356 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2357 Abv->Add(BitCodeAbbrevOp(0));
2358
2359 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2360
2361 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2362 Abv->Add(BitCodeAbbrevOp(0));
2363 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2364
2365 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2366 Abv->Add(BitCodeAbbrevOp(0));
2367
2368 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2369 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2370 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
2371
2372
2373 Abv = std::make_shared();
2375
2376 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2377 12));
2378
2379
2380
2381 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2382 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2383
2384 Abv->Add(BitCodeAbbrevOp(0));
2385 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2386 Abv->Add(BitCodeAbbrevOp(0));
2387
2388 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2389
2390 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2391 Abv->Add(BitCodeAbbrevOp(0));
2392 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2393
2394 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2395 Abv->Add(BitCodeAbbrevOp(0));
2396
2397 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2398 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2399
2400 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2401 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2402 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2403
2404
2405 Abv = std::make_shared();
2407
2408 Abv->Add(BitCodeAbbrevOp(0));
2409
2410 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2411 7));
2412
2413
2414
2415
2416
2417
2418 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2419 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2420
2421 Abv->Add(BitCodeAbbrevOp(0));
2422 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2423 Abv->Add(BitCodeAbbrevOp(0));
2424
2425 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2426 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2427
2428 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2429 Abv->Add(BitCodeAbbrevOp(
2430 BitCodeAbbrevOp::Fixed,
2431 9));
2432
2433
2434 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2435 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2436
2437 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2438 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2439 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2440 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 20));
2441 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
2442 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2443
2444 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2445 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2446 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2447 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2448 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2449
2450
2451 Abv = std::make_shared();
2453
2454 Abv->Add(BitCodeAbbrevOp(0));
2455
2456 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2457 7));
2458
2459
2460
2461
2462
2463
2464 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2465 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2466
2467 Abv->Add(BitCodeAbbrevOp(0));
2468 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2469 Abv->Add(BitCodeAbbrevOp(0));
2470
2471 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2472 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2473
2474 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2475 Abv->Add(BitCodeAbbrevOp(
2476 BitCodeAbbrevOp::Fixed,
2477 9));
2478
2479
2480 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2481 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2482
2483 Abv->Add(BitCodeAbbrevOp(
2484 BitCodeAbbrevOp::Fixed,
2485 13));
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));
2496
2497
2498 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2499 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2500 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2501 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2502 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2503
2504
2505 Abv = std::make_shared();
2507
2508 Abv->Add(BitCodeAbbrevOp(0));
2509
2510 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2511 8));
2512
2513
2514
2515
2516 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2517 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2518
2519 Abv->Add(BitCodeAbbrevOp(0));
2520 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2521 Abv->Add(BitCodeAbbrevOp(0));
2522
2523 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2524
2525 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2526 Abv->Add(BitCodeAbbrevOp(0));
2527 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2528
2529 Abv->Add(
2530 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2531 12));
2532
2533 Abv->Add(BitCodeAbbrevOp(0));
2534
2535 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2536 Abv->Add(BitCodeAbbrevOp(
2537 BitCodeAbbrevOp::Fixed,
2538 19));
2539
2540
2541
2542 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2543 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2544 DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2545
2546
2547 Abv = std::make_shared();
2549
2550 Abv->Add(BitCodeAbbrevOp(0));
2551
2552 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2553 7));
2554
2555
2556
2557
2558 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2559 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2560
2561 Abv->Add(BitCodeAbbrevOp(0));
2562 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2563 Abv->Add(BitCodeAbbrevOp(0));
2564
2565 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2566 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2567
2568 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2569 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2570 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2571
2572
2573 Abv = std::make_shared();
2575
2576 Abv->Add(BitCodeAbbrevOp(0));
2577
2578 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2579 12));
2580
2581
2582
2583 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2584 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2585
2586 Abv->Add(BitCodeAbbrevOp(0));
2587 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2588 Abv->Add(BitCodeAbbrevOp(0));
2589
2590 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2591
2592 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2593 Abv->Add(BitCodeAbbrevOp(0));
2594 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2595
2596 Abv->Add(BitCodeAbbrevOp(
2597 BitCodeAbbrevOp::Fixed,
2598 21));
2599
2600
2601
2602
2603
2604
2605 Abv->Add(BitCodeAbbrevOp(0));
2606
2607 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2608 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2609 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2610
2611
2612 DeclCXXMethodAbbrev =
2613 Stream.EmitAbbrev(getCXXMethodAbbrevFunctionDecl::TK\_NonTemplate());
2614 DeclTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2615 getCXXMethodAbbrevFunctionDecl::TK\_FunctionTemplate());
2616 DeclDependentNonTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2617 getCXXMethodAbbrevFunctionDecl::TK\_DependentNonTemplate());
2618 DeclMemberSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2619 getCXXMethodAbbrevFunctionDecl::TK\_MemberSpecialization());
2620 DeclTemplateSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2621 getCXXMethodAbbrevFunctionDecl::TK\_FunctionTemplateSpecialization());
2622 DeclDependentSpecializationCXXMethodAbbrev = Stream.EmitAbbrev(
2623 getCXXMethodAbbrev<
2625
2626
2627 Abv = std::make_shared();
2629 Abv->Add(BitCodeAbbrevOp(0));
2630
2631 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2632 7));
2633
2634
2635
2636
2637 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2638 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2639
2640 Abv->Add(BitCodeAbbrevOp(0));
2641 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2642 Abv->Add(BitCodeAbbrevOp(0));
2643
2644 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2645 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2646
2647 Abv->Add(
2648 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2649 Abv->Add(BitCodeAbbrevOp(0));
2650 DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));
2651
2652
2653 Abv = std::make_shared();
2655
2656 Abv->Add(BitCodeAbbrevOp(0));
2657
2658 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2659 12));
2660
2661
2662
2663 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2664 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2665
2666 Abv->Add(BitCodeAbbrevOp(0));
2667 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2668 Abv->Add(BitCodeAbbrevOp(0));
2669
2670 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2671 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11));
2672 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2673 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR,
2674 6));
2675 DeclUsingShadowAbbrev = Stream.EmitAbbrev(std::move(Abv));
2676
2677
2678 Abv = std::make_shared();
2680
2681
2682
2683 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
2684 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2685
2686
2687
2688
2689 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2690 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2691 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2692 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2693
2694
2695 Abv = std::make_shared();
2697
2698
2699
2700 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2701 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2702
2703 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2704 Abv->Add(BitCodeAbbrevOp(32));
2705 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2706 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2707
2708
2709 Abv = std::make_shared();
2711
2712
2713
2714 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2715 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2716
2717 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2718 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2719 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3));
2720 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2721
2722
2723 Abv = std::make_shared();
2725
2726
2727
2728 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2729 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2730
2731 Abv->Add(BitCodeAbbrevOp(0));
2732
2733 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 9));
2734
2735 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2736
2737
2738 Abv = std::make_shared();
2740
2741
2742
2743
2744 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2745 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2746
2747 Abv->Add(
2748 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2749 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2750 BinaryOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2751
2752
2753 Abv = std::make_shared();
2755
2756
2757
2758
2759 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2760 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2761
2762
2763 Abv->Add(
2764 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2765 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2766
2767 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2768 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2769 CompoundAssignOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2770
2771
2772 Abv = std::make_shared();
2774
2775
2776
2777 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2778 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2779
2780 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2781 Abv->Add(BitCodeAbbrevOp(0));
2782 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2783 CallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2784
2785
2786 Abv = std::make_shared();
2788
2789
2790
2791 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2792 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2793
2794 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2795 Abv->Add(BitCodeAbbrevOp(0));
2796 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2797
2798 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2799 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2800 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2801 CXXOperatorCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2802
2803
2804 Abv = std::make_shared();
2806
2807
2808
2809 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2810 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2811
2812 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2813 Abv->Add(BitCodeAbbrevOp(0));
2814 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2815
2816 CXXMemberCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2817
2818
2819 Abv = std::make_shared();
2821
2822
2823 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2824 Abv->Add(BitCodeAbbrevOp(0));
2825 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2826 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2827 CompoundStmtAbbrev = Stream.EmitAbbrev(std::move(Abv));
2828
2829 Abv = std::make_shared();
2831 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2832 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2833
2834 Abv = std::make_shared();
2836 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2837 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2838
2839 Abv = std::make_shared();
2841 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2842 DeclModuleLocalVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2843
2844 Abv = std::make_shared();
2846 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2847 DeclTULocalLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2848
2849 Abv = std::make_shared();
2851 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2852 DeclSpecializationsAbbrev = Stream.EmitAbbrev(std::move(Abv));
2853
2854 Abv = std::make_shared();
2856 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2857 DeclPartialSpecializationsAbbrev = Stream.EmitAbbrev(std::move(Abv));
2858}
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2873 Module *WritingModule) {
2874
2875
2876
2877 if (WritingModule && WritingModule->isNamedModule()) {
2878
2879
2880
2881
2882 if (isa<PragmaCommentDecl, PragmaDetectMismatchDecl>(D))
2883 return true;
2884 return false;
2885 }
2886
2887
2888
2889
2890
2891
2892 if (isa<FileScopeAsmDecl, TopLevelStmtDecl, ObjCImplDecl>(D))
2893 return true;
2894
2896
2897
2898 return false;
2899 }
2900
2902}
2903
2904void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2906 "serializing");
2907
2908
2910 assert(->isFromASTFile() && "should not be emitting imported decl");
2913 IDR = NextDeclID++;
2914
2915 ID = IDR;
2916
2917 assert(ID >= FirstDeclID && "invalid decl ID");
2918
2921
2922
2923 W.Visit(D);
2924
2925
2927
2928
2932
2933 unsigned Index = ID.getRawValue() - FirstDeclID.getRawValue();
2934 if (DeclOffsets.size() == Index)
2935 DeclOffsets.emplace_back(RawLoc, Offset, DeclTypesBlockStartOffset);
2936 else if (DeclOffsets.size() < Index) {
2937
2938 DeclOffsets.resize(Index+1);
2939 DeclOffsets[Index].setRawLoc(RawLoc);
2940 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);
2941 } else {
2942 llvm_unreachable("declarations should be emitted in ID order");
2943 }
2944
2947 associateDeclWithFile(D, ID);
2948
2949
2950
2952 AddDeclRef(D, EagerlyDeserializedDecls);
2953}
2954
2956
2958
2960 bool ModulesCodegen = false;
2962 std::optional Linkage;
2963 if (Writer->WritingModule &&
2965
2966
2967
2968
2969 Linkage = getASTContext().GetGVALinkageForFunction(FD);
2971 }
2972 if (Writer->getLangOpts().ModulesCodegen ||
2973 (FD->hasAttr() &&
2974 Writer->getLangOpts().BuildingPCHWithObjectFile)) {
2975
2976
2977
2978 if (!FD->hasAttr()) {
2980 Linkage = getASTContext().GetGVALinkageForFunction(FD);
2981 ModulesCodegen =
2983 }
2984 }
2985 }
2986 Record->push_back(ModulesCodegen);
2987 if (ModulesCodegen)
2988 Writer->AddDeclRef(FD, Writer->ModularCodegenDecls);
2989 if (auto *CD = dyn_cast(FD)) {
2990 Record->push_back(CD->getNumCtorInitializers());
2991 if (CD->getNumCtorInitializers())
2993 }
2995}
static void addExplicitSpecifier(ExplicitSpecifier ES, ASTRecordWriter &Record)
static bool isRequiredDecl(const Decl *D, ASTContext &Context, Module *WritingModule)
isRequiredDecl - Check if this is a "required" Decl, which must be seen by consumers of the AST.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
llvm::MachO::Record Record
This file defines OpenMP AST classes for clauses.
Defines the SourceManager interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
SourceManager & getSourceManager()
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
MutableArrayRef< FunctionTemplateSpecializationInfo > getPartialSpecializations(FunctionTemplateDecl::Common *)
void VisitBindingDecl(BindingDecl *D)
void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
void VisitEmptyDecl(EmptyDecl *D)
void VisitCXXMethodDecl(CXXMethodDecl *D)
void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D)
void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
void VisitOMPRequiresDecl(OMPRequiresDecl *D)
void VisitNamedDecl(NamedDecl *D)
void CollectFirstDeclFromEachModule(const Decl *D, bool IncludeLocal, llvm::MapVector< ModuleFile *, const Decl * > &Firsts)
Collect the first declaration from each module file that provides a declaration of D.
RedeclarableTemplateDecl::SpecEntryTraits< EntryType >::DeclType * getSpecializationDecl(EntryType &T)
Get the specialization decl from an entry in the specialization list.
void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D)
void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D)
void VisitNamespaceDecl(NamespaceDecl *D)
void VisitOMPAllocateDecl(OMPAllocateDecl *D)
void VisitExportDecl(ExportDecl *D)
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
void VisitParmVarDecl(ParmVarDecl *D)
void VisitRedeclarable(Redeclarable< T > *D)
void VisitFriendDecl(FriendDecl *D)
void VisitDeclaratorDecl(DeclaratorDecl *D)
void VisitTemplateParamObjectDecl(TemplateParamObjectDecl *D)
void VisitConceptDecl(ConceptDecl *D)
void AddFirstSpecializationDeclFromEachModule(const Decl *D, llvm::SmallVectorImpl< const Decl * > &SpecsInMap, llvm::SmallVectorImpl< const Decl * > &PartialSpecsInMap)
Add to the record the first template specialization from each module file that provides a declaration...
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
void VisitBlockDecl(BlockDecl *D)
void VisitLabelDecl(LabelDecl *LD)
void VisitTemplateDecl(TemplateDecl *D)
void VisitImplicitConceptSpecializationDecl(ImplicitConceptSpecializationDecl *D)
void VisitCXXDestructorDecl(CXXDestructorDecl *D)
void VisitFieldDecl(FieldDecl *D)
void VisitRequiresExprBodyDecl(RequiresExprBodyDecl *D)
void VisitObjCContainerDecl(ObjCContainerDecl *D)
void RegisterTemplateSpecialization(const Decl *Template, const Decl *Specialization)
Ensure that this template specialization is associated with the specified template on reload.
void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
void VisitVarTemplatePartialSpecializationDecl(VarTemplatePartialSpecializationDecl *D)
void VisitUnnamedGlobalConstantDecl(UnnamedGlobalConstantDecl *D)
void VisitCXXConversionDecl(CXXConversionDecl *D)
void VisitUsingShadowDecl(UsingShadowDecl *D)
void VisitValueDecl(ValueDecl *D)
void VisitIndirectFieldDecl(IndirectFieldDecl *D)
void VisitImplicitParamDecl(ImplicitParamDecl *D)
decltype(T::PartialSpecializations) & getPartialSpecializations(T *Common)
Get the list of partial specializations from a template's common ptr.
void VisitObjCProtocolDecl(ObjCProtocolDecl *D)
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
void VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
void VisitObjCCategoryDecl(ObjCCategoryDecl *D)
void VisitTopLevelStmtDecl(TopLevelStmtDecl *D)
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
void VisitAccessSpecDecl(AccessSpecDecl *D)
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context, ASTWriter::RecordDataImpl &Record, bool GeneratingReducedBMI)
void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
void VisitLifetimeExtendedTemporaryDecl(LifetimeExtendedTemporaryDecl *D)
void VisitMSPropertyDecl(MSPropertyDecl *D)
void VisitUsingEnumDecl(UsingEnumDecl *D)
void VisitTypeDecl(TypeDecl *D)
void VisitClassTemplatePartialSpecializationDecl(ClassTemplatePartialSpecializationDecl *D)
void VisitEnumConstantDecl(EnumConstantDecl *D)
void VisitObjCIvarDecl(ObjCIvarDecl *D)
void VisitCapturedDecl(CapturedDecl *D)
void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D)
void VisitPragmaCommentDecl(PragmaCommentDecl *D)
void VisitRecordDecl(RecordDecl *D)
void VisitUnresolvedUsingIfExistsDecl(UnresolvedUsingIfExistsDecl *D)
void VisitTypedefDecl(TypedefDecl *D)
void VisitMSGuidDecl(MSGuidDecl *D)
void VisitTypedefNameDecl(TypedefNameDecl *D)
void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
void VisitUsingDecl(UsingDecl *D)
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
void AddTemplateSpecializations(DeclTy *D)
void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D)
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
void VisitFriendTemplateDecl(FriendTemplateDecl *D)
void VisitObjCMethodDecl(ObjCMethodDecl *D)
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
void VisitVarTemplateDecl(VarTemplateDecl *D)
void VisitHLSLBufferDecl(HLSLBufferDecl *D)
void VisitObjCImplDecl(ObjCImplDecl *D)
void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D)
void VisitVarDecl(VarDecl *D)
void VisitImportDecl(ImportDecl *D)
void VisitCXXRecordDecl(CXXRecordDecl *D)
void VisitCXXConstructorDecl(CXXConstructorDecl *D)
void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D)
void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
void VisitFileScopeAsmDecl(FileScopeAsmDecl *D)
void VisitClassTemplateDecl(ClassTemplateDecl *D)
void VisitFunctionDecl(FunctionDecl *D)
void VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
void VisitEnumDecl(EnumDecl *D)
void VisitTranslationUnitDecl(TranslationUnitDecl *D)
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
void VisitStaticAssertDecl(StaticAssertDecl *D)
void VisitDeclContext(DeclContext *DC)
Emit the DeclContext part of a declaration context decl.
void AddObjCTypeParamList(ObjCTypeParamList *typeParams)
Add an Objective-C type parameter list to the given record.
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal)
Add to the record the first declaration from each module file that provides a declaration of D.
void VisitUsingPackDecl(UsingPackDecl *D)
void VisitDecompositionDecl(DecompositionDecl *D)
void VisitTagDecl(TagDecl *D)
void VisitTypeAliasDecl(TypeAliasDecl *D)
void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D)
ModuleFile * getOwningModuleFile(const Decl *D) const
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
bool haveUnloadedSpecializations(const Decl *D) const
If we have any unloaded specialization for D.
An object for streaming information to a record.
void AddFunctionDefinition(const FunctionDecl *FD)
Add a definition for the given function to the queue of statements to emit.
uint64_t Emit(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, followed by its substatements, and return its offset.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
void AddCXXCtorInitializers(ArrayRef< CXXCtorInitializer * > CtorInits)
Emit a CXXCtorInitializer array.
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
Writes an AST file containing the contents of a translation unit.
unsigned getDeclParmVarAbbrev() const
unsigned getDeclTemplateTypeParmAbbrev() const
bool isWritingStdCXXNamedModules() const
unsigned getDeclObjCIvarAbbrev() const
unsigned getDeclTypedefAbbrev() const
unsigned getDeclUsingShadowAbbrev() const
bool isGeneratingReducedBMI() const
unsigned getDeclVarAbbrev() const
unsigned getDeclEnumAbbrev() const
bool IsLocalDecl(const Decl *D)
Is this a local declaration (that is, one that will be written to our AST file)? This is the case for...
void ClearSwitchCaseIDs()
LocalDeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its local ID to the module file been writing.
unsigned getDeclCXXMethodAbbrev(FunctionDecl::TemplatedKind Kind) const
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
SourceLocationEncoding::RawLocEncoding getRawSourceLocationEncoding(SourceLocation Loc, LocSeq *Seq=nullptr)
Return the raw encodings for source locations.
SmallVector< uint64_t, 64 > RecordData
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
unsigned getDeclFieldAbbrev() const
const LangOptions & getLangOpts() const
unsigned getDeclRecordAbbrev() const
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
Represents an access specifier followed by colon ':'.
A binding in a decomposition declaration.
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
void addBits(uint32_t Value, uint32_t BitsWidth)
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Represents a C++ constructor within a class.
Represents a C++ conversion function within a class.
Represents a C++ deduction guide declaration.
Represents a C++ destructor within a class.
Represents a static or instance method of a struct/union/class.
Represents a C++ struct/union/class.
static bool classofKind(Kind K)
Represents the body of a CapturedStmt, and serves as its DeclContext.
unsigned getNumParams() const
unsigned getContextParamPosition() const
ImplicitParamDecl * getParam(unsigned i) const
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Declaration of a C++20 concept.
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
A POD class for pairing a NamedDecl* with an access specifier.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
@ NumOMPDeclareReductionDeclBits
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
@ NumObjCContainerDeclBits
@ NumCXXConstructorDeclBits
DeclID getRawValue() const
A simple visitor class that helps create declaration visitors.
Decl - This represents one declaration (or definition), e.g.
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
SourceLocation getEndLoc() const LLVM_READONLY
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
bool isInNamedModule() const
Whether this declaration comes from a named module.
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
ModuleOwnershipKind getModuleOwnershipKind() const
Get the kind of module ownership for this declaration.
bool isParameterPack() const
Whether this declaration is a parameter pack.
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
bool isReferenced() const
Whether any declaration of this entity was referenced.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
bool isInvalidDecl() const
unsigned getIdentifierNamespace() const
SourceLocation getLocation() const
const char * getDeclKindName() const
bool isTopLevelDeclInObjCContainer() const
Whether this declaration is a top-level declaration (function, global variable, etc....
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
DeclContext * getDeclContext()
AccessSpecifier getAccess() const
SourceLocation getBeginLoc() const LLVM_READONLY
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Represents a ValueDecl that came out of a declarator.
A decomposition declaration.
Provides information about a dependent function-template specialization declaration.
ArrayRef< FunctionTemplateDecl * > getCandidates() const
Returns the candidates for the primary function template.
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Represents an empty-declaration.
An instance of this object exists for each enum constant that is defined.
Store information needed for an explicit specifier.
ExplicitSpecKind getKind() const
const Expr * getExpr() const
Represents a standard C++ module export declaration.
This represents one expression.
Represents a member of a struct/union/class.
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Declaration of a friend template.
Represents a function declaration or definition.
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
@ TK_MemberSpecialization
@ TK_DependentNonTemplate
@ TK_FunctionTemplateSpecialization
@ TK_DependentFunctionTemplateSpecialization
Declaration of a template function.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a field injected from an anonymous union/struct into the parent scope.
Represents the declaration of a label.
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Represents a linkage specification.
An instance of this class represents the declaration of a property member.
Provides information a specialization of a member of a class template, which may be a member function...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Describes a module or submodule.
bool isInterfaceOrPartition() const
bool isNamedModule() const
Does this Module is a named module of a standard named module?
This represents a decl that may have a name.
Represents a C++ namespace alias.
Represent a C++ namespace.
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
This represents '#pragma omp allocate ...' directive.
Pseudo declaration for capturing expressions.
This represents '#pragma omp declare mapper ...' directive.
This represents '#pragma omp declare reduction ...' directive.
This represents '#pragma omp requires...' directive.
This represents '#pragma omp threadprivate ...' directive.
Represents a field declaration created by an @defs(...).
static bool classofKind(Kind K)
ObjCCategoryDecl - Represents a category declaration.
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
ObjCCompatibleAliasDecl - Represents alias of a class.
ObjCContainerDecl - Represents a container for method declarations.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Represents an ObjC class declaration.
ObjCIvarDecl - Represents an ObjC instance variable.
static bool classofKind(Kind K)
ObjCMethodDecl - Represents an instance or class method declaration.
Represents one property declaration in an Objective-C interface.
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Represents an Objective-C protocol declaration.
Represents the declaration of an Objective-C type parameter.
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
unsigned size() const
Determine the number of type parameters in this list.
SourceLocation getRAngleLoc() const
SourceLocation getLAngleLoc() const
Represents a parameter to a function.
Represents a #pragma detect_mismatch line.
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
A (possibly-)qualified type.
Represents a struct/union/class.
Declaration of a redeclarable template.
Provides common interface for the Decls that can be redeclared.
Represents the body of a requires-expression.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
Represents a C++11 static_assert declaration.
StringLiteral - This represents a string literal expression, e.g.
Represents the declaration of a struct/union/class/enum.
unsigned size() const
Retrieve the number of template arguments in this template argument list.
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Represents a template argument.
@ Type
The template argument is a type.
ArgKind getKind() const
Return the kind of stored template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
A template parameter object.
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
A declaration that models statements at global scope.
The top declaration context.
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
ConceptReference * getConceptReference() const
Represents a declaration of a type.
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Base class for declarations which introduce a typedef-name.
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Represents a dependent using declaration which was marked with typename.
Represents a dependent using declaration which was not marked with typename.
Represents a C++ using-declaration.
Represents C++ using-directive.
Represents a C++ using-enum-declaration.
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
@ CInit
C-style initialization with assignment.
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
DeclCode
Record codes for each kind of declaration.
@ DECL_EMPTY
An EmptyDecl record.
@ DECL_CAPTURED
A CapturedDecl record.
@ DECL_CXX_RECORD
A CXXRecordDecl record.
@ DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION
A VarTemplatePartialSpecializationDecl record.
@ DECL_OMP_ALLOCATE
An OMPAllocateDcl record.
@ DECL_MS_PROPERTY
A MSPropertyDecl record.
@ DECL_OMP_DECLARE_MAPPER
An OMPDeclareMapperDecl record.
@ DECL_TOP_LEVEL_STMT_DECL
A TopLevelStmtDecl record.
@ DECL_REQUIRES_EXPR_BODY
A RequiresExprBodyDecl record.
@ DECL_STATIC_ASSERT
A StaticAssertDecl record.
@ DECL_INDIRECTFIELD
A IndirectFieldDecl record.
@ DECL_TEMPLATE_TEMPLATE_PARM
A TemplateTemplateParmDecl record.
@ DECL_IMPORT
An ImportDecl recording a module import.
@ DECL_UNNAMED_GLOBAL_CONSTANT
A UnnamedGlobalConstantDecl record.
@ DECL_ACCESS_SPEC
An AccessSpecDecl record.
@ DECL_OBJC_TYPE_PARAM
An ObjCTypeParamDecl record.
@ DECL_OBJC_CATEGORY_IMPL
A ObjCCategoryImplDecl record.
@ DECL_ENUM_CONSTANT
An EnumConstantDecl record.
@ DECL_PARM_VAR
A ParmVarDecl record.
@ DECL_TYPEDEF
A TypedefDecl record.
@ DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack.
@ DECL_HLSL_BUFFER
A HLSLBufferDecl record.
@ DECL_NAMESPACE_ALIAS
A NamespaceAliasDecl record.
@ DECL_TYPEALIAS
A TypeAliasDecl record.
@ DECL_FUNCTION_TEMPLATE
A FunctionTemplateDecl record.
@ DECL_MS_GUID
A MSGuidDecl record.
@ DECL_UNRESOLVED_USING_TYPENAME
An UnresolvedUsingTypenameDecl record.
@ DECL_CLASS_TEMPLATE_SPECIALIZATION
A ClassTemplateSpecializationDecl record.
@ DECL_FILE_SCOPE_ASM
A FileScopeAsmDecl record.
@ DECL_PARTIAL_SPECIALIZATIONS
@ DECL_CXX_CONSTRUCTOR
A CXXConstructorDecl record.
@ DECL_CXX_CONVERSION
A CXXConversionDecl record.
@ DECL_FIELD
A FieldDecl record.
@ DECL_LINKAGE_SPEC
A LinkageSpecDecl record.
@ DECL_CONTEXT_TU_LOCAL_VISIBLE
A record that stores the set of declarations that are only visible to the TU.
@ DECL_NAMESPACE
A NamespaceDecl record.
@ DECL_NON_TYPE_TEMPLATE_PARM
A NonTypeTemplateParmDecl record.
@ DECL_USING_PACK
A UsingPackDecl record.
@ DECL_FUNCTION
A FunctionDecl record.
@ DECL_USING_DIRECTIVE
A UsingDirecitveDecl record.
@ DECL_RECORD
A RecordDecl record.
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
@ DECL_BLOCK
A BlockDecl record.
@ DECL_UNRESOLVED_USING_VALUE
An UnresolvedUsingValueDecl record.
@ DECL_TYPE_ALIAS_TEMPLATE
A TypeAliasTemplateDecl record.
@ DECL_OBJC_CATEGORY
A ObjCCategoryDecl record.
@ DECL_VAR
A VarDecl record.
@ DECL_UNRESOLVED_USING_IF_EXISTS
An UnresolvedUsingIfExistsDecl record.
@ DECL_USING
A UsingDecl record.
@ DECL_OBJC_PROTOCOL
A ObjCProtocolDecl record.
@ DECL_TEMPLATE_TYPE_PARM
A TemplateTypeParmDecl record.
@ DECL_VAR_TEMPLATE_SPECIALIZATION
A VarTemplateSpecializationDecl record.
@ DECL_OBJC_IMPLEMENTATION
A ObjCImplementationDecl record.
@ DECL_LABEL
A LabelDecl record.
@ DECL_OBJC_COMPATIBLE_ALIAS
A ObjCCompatibleAliasDecl record.
@ DECL_CONSTRUCTOR_USING_SHADOW
A ConstructorUsingShadowDecl record.
@ DECL_USING_ENUM
A UsingEnumDecl record.
@ DECL_FRIEND_TEMPLATE
A FriendTemplateDecl record.
@ DECL_PRAGMA_DETECT_MISMATCH
A PragmaDetectMismatchDecl record.
@ DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack.
@ DECL_OBJC_AT_DEFS_FIELD
A ObjCAtDefsFieldDecl record.
@ DECL_IMPLICIT_PARAM
An ImplicitParamDecl record.
@ DECL_FRIEND
A FriendDecl record.
@ DECL_CXX_METHOD
A CXXMethodDecl record.
@ DECL_EXPORT
An ExportDecl record.
@ DECL_BINDING
A BindingDecl record.
@ DECL_PRAGMA_COMMENT
A PragmaCommentDecl record.
@ DECL_ENUM
An EnumDecl record.
@ DECL_CONTEXT_MODULE_LOCAL_VISIBLE
A record containing the set of declarations that are only visible from DeclContext in the same module...
@ DECL_DECOMPOSITION
A DecompositionDecl record.
@ DECL_OMP_DECLARE_REDUCTION
An OMPDeclareReductionDecl record.
@ DECL_OMP_THREADPRIVATE
An OMPThreadPrivateDecl record.
@ DECL_OBJC_METHOD
A ObjCMethodDecl record.
@ DECL_CXX_DESTRUCTOR
A CXXDestructorDecl record.
@ DECL_OMP_CAPTUREDEXPR
An OMPCapturedExprDecl record.
@ DECL_CLASS_TEMPLATE
A ClassTemplateDecl record.
@ DECL_USING_SHADOW
A UsingShadowDecl record.
@ DECL_CONCEPT
A ConceptDecl record.
@ DECL_CXX_DEDUCTION_GUIDE
A CXXDeductionGuideDecl record.
@ DECL_OMP_REQUIRES
An OMPRequiresDecl record.
@ DECL_OBJC_IVAR
A ObjCIvarDecl record.
@ DECL_OBJC_PROPERTY
A ObjCPropertyDecl record.
@ DECL_TEMPLATE_PARAM_OBJECT
A TemplateParamObjectDecl record.
@ DECL_OBJC_INTERFACE
A ObjCInterfaceDecl record.
@ DECL_VAR_TEMPLATE
A VarTemplateDecl record.
@ DECL_LIFETIME_EXTENDED_TEMPORARY
An LifetimeExtendedTemporaryDecl record.
@ DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION
A ClassTemplatePartialSpecializationDecl record.
@ DECL_IMPLICIT_CONCEPT_SPECIALIZATION
An ImplicitConceptSpecializationDecl record.
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
@ DECL_OBJC_PROPERTY_IMPL
A ObjCPropertyImplDecl record.
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
@ STMT_COMPOUND
A CompoundStmt record.
@ EXPR_CALL
A CallExpr record.
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
@ EXPR_DECL_REF
A DeclRefExpr record.
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
bool isPartOfPerModuleInitializer(const Decl *D)
Determine whether the given declaration will be included in the per-module initializer if it needs to...
@ UPD_CXX_ADDED_ANONYMOUS_NAMESPACE
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
@ GVA_AvailableExternally
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
@ SD_Static
Static storage duration.
bool CanElideDeclDef(const Decl *D)
If we can elide the definition of.
const FunctionProtoType * T
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
Diagnostic wrappers for TextAPI types for error reporting.
Represents an explicit template argument list in C++, e.g., the "" in "sort".
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Data that is common to all of the declarations of a given function template.
Parts of a decomposed MSGuidDecl.
uint16_t Part2
...-89ab-...
uint32_t Part1
{01234567-...
uint16_t Part3
...-cdef-...
uint8_t Part4And5[8]
...-0123-456789abcdef}
static DeclType * getDecl(EntryType *D)