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

34namespace {

35

36

37

38template bool isDefinitionInDependentContext(DT *D) {

39 return D->isDependentContext() && D->isThisDeclarationADefinition();

40}

41

42}

43

44

45

46

47

52

54 unsigned AbbrevToUse;

55

56 bool GeneratingReducedBMI = false;

57

58 public:

61 : Writer(Writer), Record(Context, Writer, Record),

62 Code((serialization::DeclCode)0), AbbrevToUse(0),

63 GeneratingReducedBMI(GeneratingReducedBMI) {}

64

66 if (!Code)

67 llvm::report_fatal_error(StringRef("unexpected declaration kind '") +

69 return Record.Emit(Code, AbbrevToUse);

70 }

71

73

156

157

178

179

181

182 if (!typeParams) {

184 return;

185 }

186

187 Record.push_back(typeParams->size());

188 for (auto *typeParam : *typeParams) {

189 Record.AddDeclRef(typeParam);

190 }

193 }

194

195

196

198 const Decl *D, bool IncludeLocal,

199 llvm::MapVector<ModuleFile *, const Decl *> &Firsts) {

200

201

203 if (R->isFromASTFile())

205 else if (IncludeLocal)

206 Firsts[nullptr] = R;

207 }

208 }

209

210

211

212

214 llvm::MapVector<ModuleFile *, const Decl *> Firsts;

216

217 for (const auto &F : Firsts)

218 Record.AddDeclRef(F.second);

219 }

220

221

222

223

224

228 assert((isa(D) ||

229 isa(D) || isa(D)) &&

230 "Must not be called with other decls");

231 llvm::MapVector<ModuleFile *, const Decl *> Firsts;

233

234 for (const auto &F : Firsts) {

237 PartialSpecsInMap.push_back(F.second);

238 else

239 SpecsInMap.push_back(F.second);

240 }

241 }

242

243

244 template

248 }

249

250

251 template

253 return Common->PartialSpecializations;

254 }

257 return std::nullopt;

258 }

259

260 template

262 auto *Common = D->getCommonPtr();

263

264

265

266

267 if (Writer.Chain != Record.getASTContext().getExternalSource() &&

269 D->LoadLazySpecializations();

271 }

272

273

274

276 for (auto &Entry : Common->Specializations)

280

283 for (auto *D : AllSpecs) {

286 }

287

288 Record.AddOffset(Writer.WriteSpecializationInfoLookupTable(

289 D, Specs, false));

290

291

292 if (isa(D)) {

293 assert(PartialSpecs.empty());

294 return;

295 }

296

297 Record.AddOffset(Writer.WriteSpecializationInfoLookupTable(

298 D, PartialSpecs, true));

299 }

300

301

302

306

307

308

309

310

312 return;

313

314

315

317 return;

318

321 Writer.PartialSpecializationsUpdates[cast(Template)]

323 else

324 Writer.SpecializationsUpdates[cast(Template)].push_back(

326 }

327 };

328}

329

331 if (auto *FD = dyn_cast(D)) {

332 if (FD->isInlined() || FD->isConstexpr())

333 return false;

334

335 if (FD->isDependentContext())

336 return false;

337

339 return false;

340 }

341

342 if (auto *VD = dyn_cast(D)) {

343 if (!VD->getDeclContext()->getRedeclContext()->isFileContext() ||

344 VD->isInline() || VD->isConstexpr() || isa(VD) ||

345

346

347

348 VD->hasConstantInitialization())

349 return false;

350

352 return false;

353 }

354

355 return true;

356}

357

360

361

362

363

364 if (auto *DD = dyn_cast(D)) {

365 if (auto *TInfo = DD->getTypeSourceInfo())

366 Record.AddTypeLoc(TInfo->getTypeLoc());

367 }

368

369

370

371

372 if (auto *FD = dyn_cast(D)) {

374 Record.push_back(FD->doesThisDeclarationHaveABody());

375 if (FD->doesThisDeclarationHaveABody())

376 Record.AddFunctionDefinition(FD);

377 } else

379 }

380

381

382

383

384

385 if (auto *VD = dyn_cast(D)) {

387 Record.AddVarDeclInit(VD);

388 else

390 }

391

392

393

394 if (auto *FD = dyn_cast(D)) {

395 if (FD->hasInClassInitializer()) {

396 if (Expr *Init = FD->getInClassInitializer()) {

399 } else {

401

402 }

403 }

404 }

405

406

407

408

409 if (auto *DC = dyn_cast(D))

411}

412

415

416

417

418

419

420

421

422

423

424

434 Record.push_back(DeclBits);

435

439

442

444

445

446

447

448

449

450

451

452

455 while (auto *NS = dyn_cast(DC->getRedeclContext())) {

456 if (!NS->isFromASTFile())

457 break;

458 Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());

459 if (!NS->isInlineNamespace())

460 break;

461 DC = NS->getParent();

462 }

463 }

464}

465

467 StringRef Arg = D->getArg();

468 Record.push_back(Arg.size());

471 Record.push_back(D->getCommentKind());

472 Record.AddString(Arg);

474}

475

478 StringRef Name = D->getName();

479 StringRef Value = D->getValue();

480 Record.push_back(Name.size() + 1 + Value.size());

483 Record.AddString(Name);

486}

487

489 llvm_unreachable("Translation units aren't directly serialized");

490}

491

494 Record.AddDeclarationName(D->getDeclName());

497 : 0);

498}

499

504}

505

509 Record.AddTypeSourceInfo(D->getTypeSourceInfo());

510 Record.push_back(D->isModed());

511 if (D->isModed())

512 Record.AddTypeRef(D->getUnderlyingType());

513 Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));

514}

515

528

530}

531

534 Record.AddDeclRef(D->getDescribedAliasTemplate());

536}

537

540 "You need to update the serializer after you change the "

541 "TagDeclBits");

542

546

548 TagDeclBits.addBits(llvm::to_underlying(D->getTagKind()), 3);

549 TagDeclBits.addBit(!isa(D) ? D->isCompleteDefinition() : 0);

550 TagDeclBits.addBit(D->isEmbeddedInDeclarator());

551 TagDeclBits.addBit(D->isFreeStanding());

552 TagDeclBits.addBit(D->isCompleteDefinitionRequired());

554 D->hasExtInfo() ? 1 : (D->getTypedefNameForAnonDecl() ? 2 : 0),

555 2);

556 Record.push_back(TagDeclBits);

557

558 Record.AddSourceRange(D->getBraceRange());

559

560 if (D->hasExtInfo()) {

561 Record.AddQualifierInfo(*D->getExtInfo());

562 } else if (auto *TD = D->getTypedefNameForAnonDecl()) {

563 Record.AddDeclRef(TD);

564 Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());

565 }

566}

567

570 "You need to update the serializer after you change the "

571 "EnumDeclBits");

572

574 Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());

575 if (D->getIntegerTypeSourceInfo())

576 Record.AddTypeRef(D->getIntegerType());

577 Record.AddTypeRef(D->getPromotionType());

578

580 EnumDeclBits.addBits(D->getNumPositiveBits(), 8);

581 EnumDeclBits.addBits(D->getNumNegativeBits(), 8);

582 EnumDeclBits.addBit(D->isScoped());

583 EnumDeclBits.addBit(D->isScopedUsingClassTag());

584 EnumDeclBits.addBit(D->isFixed());

585 Record.push_back(EnumDeclBits);

586

587 Record.push_back(D->getODRHash());

588

590 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());

591 Record.push_back(MemberInfo->getTemplateSpecializationKind());

592 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());

593 } else {

594 Record.AddDeclRef(nullptr);

595 }

596

599 D->getTypedefNameForAnonDecl() &&

603 D->getIntegerTypeSourceInfo() && D->getMemberSpecializationInfo() &&

607

609}

610

613 "You need to update the serializer after you change the "

614 "RecordDeclBits");

615

617

619 RecordDeclBits.addBit(D->hasFlexibleArrayMember());

620 RecordDeclBits.addBit(D->isAnonymousStructOrUnion());

621 RecordDeclBits.addBit(D->hasObjectMember());

622 RecordDeclBits.addBit(D->hasVolatileMember());

623 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveDefaultInitialize());

624 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveCopy());

625 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveDestroy());

626 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveDefaultInitializeCUnion());

627 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveDestructCUnion());

628 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveCopyCUnion());

629 RecordDeclBits.addBit(D->hasUninitializedExplicitInitFields());

630 RecordDeclBits.addBit(D->isParamDestroyedInCallee());

631 RecordDeclBits.addBits(llvm::to_underlying(D->getArgPassingRestrictions()), 2);

632 Record.push_back(RecordDeclBits);

633

634

635

636 if (!isa(D))

637 Record.push_back(D->getODRHash());

638

641 D->getTypedefNameForAnonDecl() &&

648

650}

651

654 Record.AddTypeRef(D->getType());

655}

656

659 Record.push_back(D->getInitExpr()? 1 : 0);

660 if (D->getInitExpr())

661 Record.AddStmt(D->getInitExpr());

662 Record.AddAPSInt(D->getInitVal());

663

665}

666

669 Record.AddSourceLocation(D->getInnerLocStart());

670 Record.push_back(D->hasExtInfo());

671 if (D->hasExtInfo()) {

672 DeclaratorDecl::ExtInfo *Info = D->getExtInfo();

673 Record.AddQualifierInfo(*Info);

674 Record.AddStmt(Info->TrailingRequiresClause);

675 }

676

677 Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()

679}

680

683 "You need to update the serializer after you change the "

684 "FunctionDeclBits");

685

687

688 Record.push_back(D->getTemplatedKind());

689 switch (D->getTemplatedKind()) {

691 break;

693 Record.AddDeclRef(D->getInstantiatedFromDecl());

694 break;

696 Record.AddDeclRef(D->getDescribedFunctionTemplate());

697 break;

703 break;

704 }

707 FTSInfo = D->getTemplateSpecializationInfo();

708

710

713

714

716

717

720 Record.AddASTTemplateArgumentListInfo(

722

724

728 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());

729 Record.push_back(MemberInfo->getTemplateSpecializationKind());

730 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());

731 } else {

733 }

734

736

737

739 }

740 break;

741 }

744 DFTSInfo = D->getDependentSpecializationInfo();

745

746

749 Record.AddDeclRef(FTD);

750

751

754 Record.AddASTTemplateArgumentListInfo(

756 break;

757 }

758 }

759

761 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());

763

764

765

766

768

769 FunctionDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), 3);

770 FunctionDeclBits.addBits((uint32_t)D->getStorageClass(), 3);

771 FunctionDeclBits.addBit(D->isInlineSpecified());

772 FunctionDeclBits.addBit(D->isInlined());

773 FunctionDeclBits.addBit(D->hasSkippedBody());

774 FunctionDeclBits.addBit(D->isVirtualAsWritten());

775 FunctionDeclBits.addBit(D->isPureVirtual());

776 FunctionDeclBits.addBit(D->hasInheritedPrototype());

777 FunctionDeclBits.addBit(D->hasWrittenPrototype());

778 FunctionDeclBits.addBit(D->isDeletedBit());

779 FunctionDeclBits.addBit(D->isTrivial());

780 FunctionDeclBits.addBit(D->isTrivialForCall());

781 FunctionDeclBits.addBit(D->isDefaulted());

782 FunctionDeclBits.addBit(D->isExplicitlyDefaulted());

783 FunctionDeclBits.addBit(D->isIneligibleOrNotSelected());

784 FunctionDeclBits.addBits((uint64_t)(D->getConstexprKind()), 2);

785 FunctionDeclBits.addBit(D->hasImplicitReturnZero());

786 FunctionDeclBits.addBit(D->isMultiVersion());

787 FunctionDeclBits.addBit(D->isLateTemplateParsed());

788 FunctionDeclBits.addBit(D->FriendConstraintRefersToEnclosingTemplate());

789 FunctionDeclBits.addBit(D->usesSEHTry());

790 Record.push_back(FunctionDeclBits);

791

793 if (D->isExplicitlyDefaulted())

794 Record.AddSourceLocation(D->getDefaultLoc());

795

796 Record.push_back(D->getODRHash());

797

798 if (D->isDefaulted() || D->isDeletedAsWritten()) {

799 if (auto *FDI = D->getDefalutedOrDeletedInfo()) {

800

801

802 StringLiteral *DeletedMessage = FDI->getDeletedMessage();

803 Record.push_back(1 | (DeletedMessage ? 2 : 0));

804 if (DeletedMessage)

805 Record.AddStmt(DeletedMessage);

806

807 Record.push_back(FDI->getUnqualifiedLookups().size());

809 Record.AddDeclRef(P.getDecl());

810 Record.push_back(P.getAccess());

811 }

812 } else {

814 }

815 }

816

818

819

820

821 if (auto *RD = dyn_cast(D->getLexicalParent());

822 RD && isDefinitionInDependentContext(RD)) {

823 Writer.RelatedDeclsMap[Writer.GetDeclRef(RD)].push_back(

825 }

826 }

827

828 Record.push_back(D->param_size());

829 for (auto *P : D->parameters())

832}

833

836 uint64_t Kind = static_cast<uint64_t>(ES.getKind());

837 Kind = Kind << 1 | static_cast(ES.getExpr());

838 Record.push_back(Kind);

841 }

842}

843

846 Record.AddDeclRef(D->Ctor);

848 Record.push_back(static_cast<unsigned char>(D->getDeductionCandidateKind()));

850}

851

854 "You need to update the serializer after you change the "

855 "ObjCMethodDeclBits");

856

858

859

860 bool HasBodyStuff = D->getBody() != nullptr;

861 Record.push_back(HasBodyStuff);

862 if (HasBodyStuff) {

864 }

865 Record.AddDeclRef(D->getSelfDecl());

866 Record.AddDeclRef(D->getCmdDecl());

867 Record.push_back(D->isInstanceMethod());

868 Record.push_back(D->isVariadic());

869 Record.push_back(D->isPropertyAccessor());

870 Record.push_back(D->isSynthesizedAccessorStub());

871 Record.push_back(D->isDefined());

872 Record.push_back(D->isOverriding());

873 Record.push_back(D->hasSkippedBody());

874

875 Record.push_back(D->isRedeclaration());

876 Record.push_back(D->hasRedeclaration());

877 if (D->hasRedeclaration()) {

878 assert(Record.getASTContext().getObjCMethodRedeclaration(D));

879 Record.AddDeclRef(Record.getASTContext().getObjCMethodRedeclaration(D));

880 }

881

882

883 Record.push_back(llvm::to_underlying(D->getImplementationControl()));

884

885 Record.push_back(D->getObjCDeclQualifier());

886 Record.push_back(D->hasRelatedResultType());

887 Record.AddTypeRef(D->getReturnType());

888 Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());

890 Record.push_back(D->param_size());

891 for (const auto *P : D->parameters())

893

894 Record.push_back(D->getSelLocsKind());

895 unsigned NumStoredSelLocs = D->getNumStoredSelLocs();

897 Record.push_back(NumStoredSelLocs);

898 for (unsigned i = 0; i != NumStoredSelLocs; ++i)

899 Record.AddSourceLocation(SelLocs[i]);

900

902}

903

906 Record.push_back(D->Variance);

907 Record.push_back(D->Index);

908 Record.AddSourceLocation(D->VarianceLoc);

909 Record.AddSourceLocation(D->ColonLoc);

910

912}

913

916 "You need to update the serializer after you change the "

917 "ObjCContainerDeclBits");

918

920 Record.AddSourceLocation(D->getAtStartLoc());

921 Record.AddSourceRange(D->getAtEndRange());

922

923}

924

930

931 Record.push_back(D->isThisDeclarationADefinition());

932 if (D->isThisDeclarationADefinition()) {

933

934 ObjCInterfaceDecl::DefinitionData &Data = D->data();

935

936 Record.AddTypeSourceInfo(D->getSuperClassTInfo());

937 Record.AddSourceLocation(D->getEndOfDefinitionLoc());

938 Record.push_back(Data.HasDesignatedInitializers);

939 Record.push_back(D->getODRHash());

940

941

942 Record.push_back(Data.ReferencedProtocols.size());

943 for (const auto *P : D->protocols())

945 for (const auto &PL : D->protocol_locs())

946 Record.AddSourceLocation(PL);

947

948

949 Record.push_back(Data.AllReferencedProtocols.size());

951 P = Data.AllReferencedProtocols.begin(),

952 PEnd = Data.AllReferencedProtocols.end();

953 P != PEnd; ++P)

955

956

958

959 Writer.ObjCClassesWithCategories.insert(D);

960

961

962 for (; Cat; Cat = Cat->getNextClassCategoryRaw())

964 }

965 }

966

968}

969

972

973 Record.push_back(D->getAccessControl());

974 Record.push_back(D->getSynthesize());

975

983 D->getBitWidth() &&

984 D->hasExtInfo() &&

985 D->getDeclName())

987

989}

990

994

995 Record.push_back(D->isThisDeclarationADefinition());

996 if (D->isThisDeclarationADefinition()) {

997 Record.push_back(D->protocol_size());

998 for (const auto *I : D->protocols())

999 Record.AddDeclRef(I);

1000 for (const auto &PL : D->protocol_locs())

1001 Record.AddSourceLocation(PL);

1002 Record.push_back(D->getODRHash());

1003 }

1004

1006}

1007

1011}

1012

1015 Record.AddSourceLocation(D->getCategoryNameLoc());

1016 Record.AddSourceLocation(D->getIvarLBraceLoc());

1017 Record.AddSourceLocation(D->getIvarRBraceLoc());

1018 Record.AddDeclRef(D->getClassInterface());

1020 Record.push_back(D->protocol_size());

1021 for (const auto *I : D->protocols())

1022 Record.AddDeclRef(I);

1023 for (const auto &PL : D->protocol_locs())

1024 Record.AddSourceLocation(PL);

1026}

1027

1030 Record.AddDeclRef(D->getClassInterface());

1032}

1033

1036 Record.AddSourceLocation(D->getAtLoc());

1037 Record.AddSourceLocation(D->getLParenLoc());

1038 Record.AddTypeRef(D->getType());

1039 Record.AddTypeSourceInfo(D->getTypeSourceInfo());

1040

1041 Record.push_back((unsigned)D->getPropertyAttributes());

1042 Record.push_back((unsigned)D->getPropertyAttributesAsWritten());

1043

1044 Record.push_back((unsigned)D->getPropertyImplementation());

1045 Record.AddDeclarationName(D->getGetterName());

1046 Record.AddSourceLocation(D->getGetterNameLoc());

1047 Record.AddDeclarationName(D->getSetterName());

1048 Record.AddSourceLocation(D->getSetterNameLoc());

1049 Record.AddDeclRef(D->getGetterMethodDecl());

1050 Record.AddDeclRef(D->getSetterMethodDecl());

1051 Record.AddDeclRef(D->getPropertyIvarDecl());

1053}

1054

1057 Record.AddDeclRef(D->getClassInterface());

1058

1059}

1060

1063 Record.AddSourceLocation(D->getCategoryNameLoc());

1065}

1066

1069 Record.AddDeclRef(D->getSuperClass());

1070 Record.AddSourceLocation(D->getSuperClassLoc());

1071 Record.AddSourceLocation(D->getIvarLBraceLoc());

1072 Record.AddSourceLocation(D->getIvarRBraceLoc());

1073 Record.push_back(D->hasNonZeroConstructors());

1074 Record.push_back(D->hasDestructors());

1075 Record.push_back(D->NumIvarInitializers);

1076 if (D->NumIvarInitializers)

1077 Record.AddCXXCtorInitializers(

1080}

1081

1085 Record.AddDeclRef(D->getPropertyDecl());

1086 Record.AddDeclRef(D->getPropertyIvarDecl());

1087 Record.AddSourceLocation(D->getPropertyIvarDeclLoc());

1088 Record.AddDeclRef(D->getGetterMethodDecl());

1089 Record.AddDeclRef(D->getSetterMethodDecl());

1090 Record.AddStmt(D->getGetterCXXConstructor());

1091 Record.AddStmt(D->getSetterCXXAssignment());

1093}

1094

1097 Record.push_back(D->isMutable());

1098

1099 Record.push_back((D->StorageKind << 1) | D->BitField);

1100 if (D->StorageKind == FieldDecl::ISK_CapturedVLAType)

1101 Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));

1102 else if (D->BitField)

1103 Record.AddStmt(D->getBitWidth());

1104

1105 if (D->getDeclName() || D->isPlaceholderVar(Writer.getLangOpts()))

1107 Record.getASTContext().getInstantiatedFromUnnamedFieldDecl(D));

1108

1117 D->getBitWidth() &&

1118 D->hasInClassInitializer() &&

1119 D->hasCapturedVLAType() &&

1120 D->hasExtInfo() &&

1123 D->getDeclName())

1125

1127}

1128

1131 Record.AddIdentifierRef(D->getGetterId());

1132 Record.AddIdentifierRef(D->getSetterId());

1134}

1135

1144}

1145

1149 Record.AddAPValue(D->getValue());

1151}

1152

1155 Record.AddAPValue(D->getValue());

1157}

1158

1161 Record.push_back(D->getChainingSize());

1162

1163 for (const auto *P : D->chain())

1166}

1167

1171

1172

1173

1174

1176 VarDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()),

1177 3);

1178

1179 bool ModulesCodegen = false;

1180 if (Writer.WritingModule && D->getStorageDuration() == SD_Static &&

1181 D->getDescribedVarTemplate()) {

1182

1183

1184

1185

1187 (D->hasAttr() &&

1188 Writer.getLangOpts().BuildingPCHWithObjectFile)) &&

1189 Record.getASTContext().GetGVALinkageForVariable(D) >=

1191 }

1192 VarDeclBits.addBit(ModulesCodegen);

1193

1194 VarDeclBits.addBits(D->getStorageClass(), 3);

1195 VarDeclBits.addBits(D->getTSCSpec(), 2);

1196 VarDeclBits.addBits(D->getInitStyle(), 2);

1197 VarDeclBits.addBit(D->isARCPseudoStrong());

1198

1199 bool HasDeducedType = false;

1200 if (!isa(D)) {

1201 VarDeclBits.addBit(D->isThisDeclarationADemotedDefinition());

1202 VarDeclBits.addBit(D->isExceptionVariable());

1203 VarDeclBits.addBit(D->isNRVOVariable());

1204 VarDeclBits.addBit(D->isCXXForRangeDecl());

1205

1206 VarDeclBits.addBit(D->isInline());

1207 VarDeclBits.addBit(D->isInlineSpecified());

1208 VarDeclBits.addBit(D->isConstexpr());

1209 VarDeclBits.addBit(D->isInitCapture());

1210 VarDeclBits.addBit(D->isPreviousDeclInSameBlockScope());

1211

1212 VarDeclBits.addBit(D->isEscapingByref());

1213 HasDeducedType = D->getType()->getContainedDeducedType();

1214 VarDeclBits.addBit(HasDeducedType);

1215

1216 if (const auto *IPD = dyn_cast(D))

1217 VarDeclBits.addBits(llvm::to_underlying(IPD->getParameterKind()),

1218 3);

1219 else

1220 VarDeclBits.addBits(0, 3);

1221

1222 VarDeclBits.addBit(D->isObjCForDecl());

1223 }

1224

1225 Record.push_back(VarDeclBits);

1226

1227 if (ModulesCodegen)

1228 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);

1229

1230 if (D->hasAttr()) {

1233 if (Init.getCopyExpr())

1235 }

1236

1237 enum {

1238 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization

1239 };

1240 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {

1241 Record.push_back(VarTemplate);

1242 Record.AddDeclRef(TemplD);

1244 = D->getMemberSpecializationInfo()) {

1245 Record.push_back(StaticDataMemberSpecialization);

1246 Record.AddDeclRef(SpecInfo->getInstantiatedFrom());

1247 Record.push_back(SpecInfo->getTemplateSpecializationKind());

1248 Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());

1249 } else {

1250 Record.push_back(VarNotTemplate);

1251 }

1252

1258 D->getKind() == Decl::Var && D->isInline() && D->isConstexpr() &&

1259 D->isInitCapture() && D->isPreviousDeclInSameBlockScope() &&

1260 D->isEscapingByref() && !HasDeducedType &&

1261 D->getStorageDuration() != SD_Static && D->getDescribedVarTemplate() &&

1262 D->getMemberSpecializationInfo() && D->isObjCForDecl() &&

1263 !isa(D) && D->isEscapingByref())

1265

1267}

1268

1272}

1273

1276

1277

1278

1279

1280 Record.push_back(D->getFunctionScopeIndex());

1281

1283 ParmVarDeclBits.addBit(D->isObjCMethodParameter());

1284 ParmVarDeclBits.addBits(D->getFunctionScopeDepth(), 7);

1285

1286 ParmVarDeclBits.addBits(D->getObjCDeclQualifier(), 7);

1287 ParmVarDeclBits.addBit(D->isKNRPromoted());

1288 ParmVarDeclBits.addBit(D->hasInheritedDefaultArg());

1289 ParmVarDeclBits.addBit(D->hasUninstantiatedDefaultArg());

1290 ParmVarDeclBits.addBit(D->getExplicitObjectParamThisLoc().isValid());

1291 Record.push_back(ParmVarDeclBits);

1292

1293 if (D->hasUninstantiatedDefaultArg())

1294 Record.AddStmt(D->getUninstantiatedDefaultArg());

1295 if (D->getExplicitObjectParamThisLoc().isValid())

1296 Record.AddSourceLocation(D->getExplicitObjectParamThisLoc());

1298

1299

1300

1301

1303 D->hasExtInfo() && D->getStorageClass() == 0 && D->isInvalidDecl() &&

1305 D->getInitStyle() == VarDecl::CInit &&

1306 D->getInit() == nullptr)

1308

1309

1310

1311 assert(D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");

1312 assert(D->isThisDeclarationADemotedDefinition()

1313 && "PARM_VAR_DECL can't be demoted definition.");

1314 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");

1315 assert(D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");

1316 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");

1317 assert(D->isStaticDataMember() &&

1318 "PARM_VAR_DECL can't be static data member");

1319}

1320

1322

1323 Record.push_back(D->bindings().size());

1324

1326 for (auto *B : D->bindings())

1327 Record.AddDeclRef(B);

1329}

1330

1333 Record.AddStmt(D->getBinding());

1335}

1336

1339 Record.AddStmt(D->getAsmString());

1340 Record.AddSourceLocation(D->getRParenLoc());

1342}

1343

1346 Record.AddStmt(D->getStmt());

1348}

1349

1353}

1354

1358 Record.AddDeclRef(D->getExtendingDecl());

1359 Record.AddStmt(D->getTemporaryExpr());

1360 Record.push_back(static_cast<bool>(D->getValue()));

1361 if (D->getValue())

1362 Record.AddAPValue(*D->getValue());

1363 Record.push_back(D->getManglingNumber());

1365}

1369 Record.AddTypeSourceInfo(D->getSignatureAsWritten());

1370 Record.push_back(D->param_size());

1373 Record.push_back(D->isVariadic());

1374 Record.push_back(D->blockMissingReturnType());

1375 Record.push_back(D->isConversionFromLambda());

1376 Record.push_back(D->doesNotEscape());

1377 Record.push_back(D->canAvoidCopyToHeap());

1378 Record.push_back(D->capturesCXXThis());

1379 Record.push_back(D->getNumCaptures());

1380 for (const auto &capture : D->captures()) {

1381 Record.AddDeclRef(capture.getVariable());

1382

1383 unsigned flags = 0;

1384 if (capture.isByRef()) flags |= 1;

1385 if (capture.isNested()) flags |= 2;

1386 if (capture.hasCopyExpr()) flags |= 4;

1387 Record.push_back(flags);

1388

1389 if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());

1390 }

1391

1393}

1394

1396 Record.push_back(D->getNumParams());

1398 for (unsigned I = 0; I < D->getNumParams(); ++I)

1399 Record.AddDeclRef(D->getParam(I));

1400 Record.push_back(D->isNothrow() ? 1 : 0);

1403}

1404

1410

1411 for (unsigned I = 0; I < CD->getNumParams(); ++I)

1414}

1415

1418 "You need to update the serializer after you change the"

1419 "LinkageSpecDeclBits");

1420

1422 Record.push_back(llvm::to_underlying(D->getLanguage()));

1423 Record.AddSourceLocation(D->getExternLoc());

1424 Record.AddSourceLocation(D->getRBraceLoc());

1426}

1427

1430 Record.AddSourceLocation(D->getRBraceLoc());

1432}

1433

1438}

1439

1440

1444

1446 NamespaceDeclBits.addBit(D->isInline());

1447 NamespaceDeclBits.addBit(D->isNested());

1448 Record.push_back(NamespaceDeclBits);

1449

1451 Record.AddSourceLocation(D->getRBraceLoc());

1452

1454 Record.AddDeclRef(D->getAnonymousNamespace());

1456

1457 if (Writer.hasChain() && D->isAnonymousNamespace() &&

1459

1460

1461

1462

1464 D->getParent()->getRedeclContext()->getPrimaryContext());

1465 if (Parent->isFromASTFile() || isa(Parent)) {

1466 Writer.DeclUpdates[Parent].push_back(

1468 }

1469 }

1470}

1471

1475 Record.AddSourceLocation(D->getNamespaceLoc());

1476 Record.AddSourceLocation(D->getTargetNameLoc());

1477 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());

1478 Record.AddDeclRef(D->getNamespace());

1480}

1481

1484 Record.AddSourceLocation(D->getUsingLoc());

1485 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());

1486 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());

1487 Record.AddDeclRef(D->FirstUsingShadow.getPointer());

1488 Record.push_back(D->hasTypename());

1489 Record.AddDeclRef(Record.getASTContext().getInstantiatedFromUsingDecl(D));

1491}

1492

1495 Record.AddSourceLocation(D->getUsingLoc());

1496 Record.AddSourceLocation(D->getEnumLoc());

1497 Record.AddTypeSourceInfo(D->getEnumType());

1498 Record.AddDeclRef(D->FirstUsingShadow.getPointer());

1499 Record.AddDeclRef(Record.getASTContext().getInstantiatedFromUsingEnumDecl(D));

1501}

1502

1504 Record.push_back(D->NumExpansions);

1506 Record.AddDeclRef(D->getInstantiatedFromUsingDecl());

1507 for (auto *E : D->expansions())

1510}

1511

1515 Record.AddDeclRef(D->getTargetDecl());

1517 Record.AddDeclRef(D->UsingOrNextShadow);

1519 Record.getASTContext().getInstantiatedFromUsingShadowDecl(D));

1520

1526

1528}

1529

1533 Record.AddDeclRef(D->NominatedBaseClassShadowDecl);

1534 Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);

1535 Record.push_back(D->IsVirtual);

1537}

1538

1541 Record.AddSourceLocation(D->getUsingLoc());

1542 Record.AddSourceLocation(D->getNamespaceKeyLocation());

1543 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());

1544 Record.AddDeclRef(D->getNominatedNamespace());

1545 Record.AddDeclRef(dyn_cast(D->getCommonAncestor()));

1547}

1548

1551 Record.AddSourceLocation(D->getUsingLoc());

1552 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());

1553 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());

1554 Record.AddSourceLocation(D->getEllipsisLoc());

1556}

1557

1561 Record.AddSourceLocation(D->getTypenameLoc());

1562 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());

1563 Record.AddSourceLocation(D->getEllipsisLoc());

1565}

1566

1571}

1572

1575

1576 enum {

1577 CXXRecNotTemplate = 0,

1578 CXXRecTemplate,

1579 CXXRecMemberSpecialization,

1580 CXXLambda

1581 };

1583 Record.push_back(CXXRecTemplate);

1584 Record.AddDeclRef(TemplD);

1586 = D->getMemberSpecializationInfo()) {

1587 Record.push_back(CXXRecMemberSpecialization);

1588 Record.AddDeclRef(MSInfo->getInstantiatedFrom());

1589 Record.push_back(MSInfo->getTemplateSpecializationKind());

1590 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());

1591 } else if (D->isLambda()) {

1592

1593 Record.push_back(CXXLambda);

1594 if (auto *Context = D->getLambdaContextDecl()) {

1595 Record.AddDeclRef(Context);

1596 Record.push_back(D->getLambdaIndexInContext());

1597 } else {

1598 Record.push_back(0);

1599 }

1600

1601

1602 if (auto *FD = llvm::dyn_cast_or_null(D->getDeclContext());

1603 FD && isDefinitionInDependentContext(FD)) {

1604 Writer.RelatedDeclsMap[Writer.GetDeclRef(FD)].push_back(

1606 }

1607 } else {

1608 Record.push_back(CXXRecNotTemplate);

1609 }

1610

1611 Record.push_back(D->isThisDeclarationADefinition());

1612 if (D->isThisDeclarationADefinition())

1613 Record.AddCXXDefinitionData(D);

1614

1616 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);

1617

1618

1619

1620

1621

1622

1623 if (D->isCompleteDefinition())

1624 Record.AddDeclRef(Record.getASTContext().getCurrentKeyFunction(D));

1625

1627}

1628

1632 Record.push_back(D->size_overridden_methods());

1633 for (const CXXMethodDecl *MD : D->overridden_methods())

1634 Record.AddDeclRef(MD);

1635 } else {

1636

1637 Record.push_back(0);

1638 }

1639

1644 D->hasExtInfo() && D->isExplicitlyDefaulted()) {

1650 else if (D->getTemplatedKind() ==

1653 D->getTemplateSpecializationInfo();

1654

1661 }

1662 } else if (D->getTemplatedKind() ==

1665 D->getDependentSpecializationInfo();

1668 }

1669 }

1670

1672}

1673

1676 "You need to update the serializer after you change the "

1677 "CXXConstructorDeclBits");

1678

1679 Record.push_back(D->getTrailingAllocKind());

1681 if (auto Inherited = D->getInheritedConstructor()) {

1682 Record.AddDeclRef(Inherited.getShadowDecl());

1683 Record.AddDeclRef(Inherited.getConstructor());

1684 }

1685

1688}

1689

1692

1693 Record.AddDeclRef(D->getOperatorDelete());

1694 if (D->getOperatorDelete())

1695 Record.AddStmt(D->getOperatorDeleteThisArg());

1696

1698}

1699

1704}

1705

1708 Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));

1710 Record.push_back(!IdentifierLocs.empty());

1711 if (IdentifierLocs.empty()) {

1713 Record.push_back(1);

1714 } else {

1715 for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)

1716 Record.AddSourceLocation(IdentifierLocs[I]);

1717 Record.push_back(IdentifierLocs.size());

1718 }

1719

1720

1722}

1723

1726 Record.AddSourceLocation(D->getColonLoc());

1728}

1729

1731

1732

1733 Record.push_back(D->NumTPLists);

1735 bool hasFriendDecl = isa<NamedDecl *>(D->Friend);

1736 Record.push_back(hasFriendDecl);

1737 if (hasFriendDecl)

1738 Record.AddDeclRef(D->getFriendDecl());

1739 else

1740 Record.AddTypeSourceInfo(D->getFriendType());

1741 for (unsigned i = 0; i < D->NumTPLists; ++i)

1742 Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));

1743 Record.AddDeclRef(D->getNextFriend());

1744 Record.push_back(D->UnsupportedFriend);

1745 Record.AddSourceLocation(D->FriendLoc);

1746 Record.AddSourceLocation(D->EllipsisLoc);

1748}

1749

1752 Record.push_back(D->getNumTemplateParameters());

1753 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)

1754 Record.AddTemplateParameterList(D->getTemplateParameterList(i));

1755 Record.push_back(D->getFriendDecl() != nullptr);

1756 if (D->getFriendDecl())

1757 Record.AddDeclRef(D->getFriendDecl());

1758 else

1759 Record.AddTypeSourceInfo(D->getFriendType());

1760 Record.AddSourceLocation(D->getFriendLoc());

1762}

1763

1766

1767 Record.AddTemplateParameterList(D->getTemplateParameters());

1768 Record.AddDeclRef(D->getTemplatedDecl());

1769}

1770

1773 Record.AddStmt(D->getConstraintExpr());

1775}

1776

1779 Record.push_back(D->getTemplateArguments().size());

1782 Record.AddTemplateArgument(Arg);

1784}

1785

1788}

1789

1792

1793

1794

1796

1797 Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());

1798 if (D->getInstantiatedFromMemberTemplate())

1799 Record.push_back(D->isMemberSpecialization());

1800 }

1801

1804}

1805

1808

1811

1812

1813

1815 auto Name =

1816 Record.getASTContext().DeclarationNames.getCXXDeductionGuideName(D);

1818 Writer.GetDeclRef(DG->getCanonicalDecl());

1819 }

1820

1822}

1823

1827

1829

1832 = D->getSpecializedTemplateOrPartial();

1834 Record.AddDeclRef(InstFromD);

1835 } else {

1836 Record.AddDeclRef(cast<ClassTemplatePartialSpecializationDecl *>(InstFrom));

1837 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());

1838 }

1839

1840 Record.AddTemplateArgumentList(&D->getTemplateArgs());

1841 Record.AddSourceLocation(D->getPointOfInstantiation());

1842 Record.push_back(D->getSpecializationKind());

1844

1846

1848 }

1849

1850 bool ExplicitInstantiation =

1851 D->getTemplateSpecializationKind() ==

1854 Record.push_back(ExplicitInstantiation);

1855 if (ExplicitInstantiation) {

1856 Record.AddSourceLocation(D->getExternKeywordLoc());

1857 Record.AddSourceLocation(D->getTemplateKeywordLoc());

1858 }

1859

1861 D->getTemplateArgsAsWritten();

1862 Record.push_back(!!ArgsWritten);

1863 if (ArgsWritten)

1864 Record.AddASTTemplateArgumentListInfo(ArgsWritten);

1865

1866

1867

1868

1869

1870

1872 auto Name =

1873 Record.getASTContext().DeclarationNames.getCXXDeductionGuideName(

1874 D->getSpecializedTemplate());

1876 Writer.GetDeclRef(DG->getCanonicalDecl());

1877 }

1878

1880}

1881

1884 Record.AddTemplateParameterList(D->getTemplateParameters());

1885

1887

1888

1890 Record.AddDeclRef(D->getInstantiatedFromMember());

1891 Record.push_back(D->isMemberSpecialization());

1892 }

1893

1895}

1896

1899

1903}

1904

1908

1909 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>

1910 InstFrom = D->getSpecializedTemplateOrPartial();

1912 Record.AddDeclRef(InstFromD);

1913 } else {

1914 Record.AddDeclRef(cast<VarTemplatePartialSpecializationDecl *>(InstFrom));

1915 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());

1916 }

1917

1918 bool ExplicitInstantiation =

1919 D->getTemplateSpecializationKind() ==

1922 Record.push_back(ExplicitInstantiation);

1923 if (ExplicitInstantiation) {

1924 Record.AddSourceLocation(D->getExternKeywordLoc());

1925 Record.AddSourceLocation(D->getTemplateKeywordLoc());

1926 }

1927

1929 D->getTemplateArgsAsWritten();

1930 Record.push_back(!!ArgsWritten);

1931 if (ArgsWritten)

1932 Record.AddASTTemplateArgumentListInfo(ArgsWritten);

1933

1934 Record.AddTemplateArgumentList(&D->getTemplateArgs());

1935 Record.AddSourceLocation(D->getPointOfInstantiation());

1936 Record.push_back(D->getSpecializationKind());

1937 Record.push_back(D->IsCompleteDefinition);

1938

1940

1942

1944

1946 }

1947

1949}

1950

1953 Record.AddTemplateParameterList(D->getTemplateParameters());

1954

1956

1957

1959 Record.AddDeclRef(D->getInstantiatedFromMember());

1960 Record.push_back(D->isMemberSpecialization());

1961 }

1962

1964}

1965

1968

1972}

1973

1975 Record.push_back(D->hasTypeConstraint());

1977

1978 Record.push_back(D->wasDeclaredWithTypename());

1979

1981 if (D->hasTypeConstraint())

1982 Record.push_back(TC != nullptr);

1983 if (TC) {

1985 Record.push_back(CR != nullptr);

1986 if (CR)

1987 Record.AddConceptReference(CR);

1989 Record.push_back(D->isExpandedParameterPack());

1990 if (D->isExpandedParameterPack())

1991 Record.push_back(D->getNumExpansionParameters());

1992 }

1993

1994 bool OwnsDefaultArg = D->hasDefaultArgument() &&

1995 D->defaultArgumentWasInherited();

1996 Record.push_back(OwnsDefaultArg);

1997 if (OwnsDefaultArg)

1998 Record.AddTemplateArgumentLoc(D->getDefaultArgument());

1999

2000 if (D->hasTypeConstraint() && !OwnsDefaultArg &&

2006

2008}

2009

2011

2012

2013

2016 if (D->isExpandedParameterPack())

2017 Record.push_back(D->getNumExpansionTypes());

2018

2020

2021 Record.push_back(D->getDepth());

2022 Record.push_back(D->getPosition());

2025

2026 if (D->isExpandedParameterPack()) {

2027 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {

2028 Record.AddTypeRef(D->getExpansionType(I));

2029 Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));

2030 }

2031

2033 } else {

2034

2036 bool OwnsDefaultArg = D->hasDefaultArgument() &&

2037 D->defaultArgumentWasInherited();

2038 Record.push_back(OwnsDefaultArg);

2039 if (OwnsDefaultArg)

2040 Record.AddTemplateArgumentLoc(D->getDefaultArgument());

2042 }

2043}

2044

2046

2047

2048

2049 if (D->isExpandedParameterPack())

2050 Record.push_back(D->getNumExpansionTemplateParameters());

2051

2053 Record.push_back(D->wasDeclaredWithTypename());

2054

2055 Record.push_back(D->getDepth());

2056 Record.push_back(D->getPosition());

2057

2058 if (D->isExpandedParameterPack()) {

2059 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();

2060 I != N; ++I)

2061 Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));

2063 } else {

2064

2066 bool OwnsDefaultArg = D->hasDefaultArgument() &&

2067 D->defaultArgumentWasInherited();

2068 Record.push_back(OwnsDefaultArg);

2069 if (OwnsDefaultArg)

2070 Record.AddTemplateArgumentLoc(D->getDefaultArgument());

2072 }

2073}

2074

2078}

2079

2082 Record.AddStmt(D->getAssertExpr());

2083 Record.push_back(D->isFailed());

2084 Record.AddStmt(D->getMessage());

2085 Record.AddSourceLocation(D->getRParenLoc());

2087}

2088

2089

2092 "You need to update the serializer after you change the "

2093 "DeclContextBits");

2094

2095 uint64_t LexicalOffset = 0;

2096 uint64_t VisibleOffset = 0;

2097 uint64_t ModuleLocalOffset = 0;

2098 uint64_t TULocalOffset = 0;

2099

2101 cast(DC)->isFromExplicitGlobalModule()) {

2102

2103

2104

2105 Writer.DelayedNamespace.push_back(cast(DC));

2106 } else {

2107 LexicalOffset =

2108 Writer.WriteDeclContextLexicalBlock(Record.getASTContext(), DC);

2109 Writer.WriteDeclContextVisibleBlock(Record.getASTContext(), DC,

2110 VisibleOffset, ModuleLocalOffset,

2111 TULocalOffset);

2112 }

2113

2114 Record.AddOffset(LexicalOffset);

2115 Record.AddOffset(VisibleOffset);

2116 Record.AddOffset(ModuleLocalOffset);

2117 Record.AddOffset(TULocalOffset);

2118}

2119

2121 assert(IsLocalDecl(D) && "expected a local declaration");

2122

2125 return Canon;

2126

2127 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];

2128 if (CacheEntry)

2129 return CacheEntry;

2130

2133 D = Redecl;

2134 return CacheEntry = D;

2135}

2136

2137template

2139 T *First = D->getFirstDecl();

2140 T *MostRecent = First->getMostRecentDecl();

2141 T *DAsT = static_cast<T *>(D);

2142 if (MostRecent != First) {

2144 "Not considered redeclarable?");

2145

2147

2148

2149

2151 if (DAsT == FirstLocal) {

2152

2153

2154

2155 unsigned I = Record.size();

2156 Record.push_back(0);

2157 if (Writer.Chain)

2159

2161

2162

2163

2168 if (!Prev->isFromASTFile())

2170

2171

2172

2173 if (LocalRedecls.empty())

2174 Record.push_back(0);

2175 else

2177 } else {

2178 Record.push_back(0);

2179 Record.AddDeclRef(FirstLocal);

2180 }

2181

2182

2183

2184

2185

2186

2187

2189 (void)Writer.GetDeclRef(MostRecent);

2190 } else {

2191

2192 Record.push_back(0);

2193 }

2194}

2195

2199 Record.push_back(D->isCBuffer());

2200 Record.AddSourceLocation(D->getLocStart());

2201 Record.AddSourceLocation(D->getLBraceLoc());

2202 Record.AddSourceLocation(D->getRBraceLoc());

2203

2205}

2206

2208 Record.writeOMPChildren(D->Data);

2211}

2212

2214 Record.writeOMPChildren(D->Data);

2217}

2218

2220 Record.writeOMPChildren(D->Data);

2223}

2224

2227 "You need to update the serializer after you change the "

2228 "NumOMPDeclareReductionDeclBits");

2229

2232 Record.AddStmt(D->getCombinerIn());

2233 Record.AddStmt(D->getCombinerOut());

2234 Record.AddStmt(D->getCombiner());

2235 Record.AddStmt(D->getInitOrig());

2236 Record.AddStmt(D->getInitPriv());

2237 Record.AddStmt(D->getInitializer());

2238 Record.push_back(llvm::to_underlying(D->getInitializerKind()));

2239 Record.AddDeclRef(D->getPrevDeclInScope());

2241}

2242

2244 Record.writeOMPChildren(D->Data);

2246 Record.AddDeclarationName(D->getVarName());

2247 Record.AddDeclRef(D->getPrevDeclInScope());

2249}

2250

2254}

2255

2256

2257

2258

2259

2260namespace {

2261template <FunctionDecl::TemplatedKind Kind>

2262std::shared_ptrllvm::BitCodeAbbrev

2264 using namespace llvm;

2265

2266 auto Abv = std::make_shared();

2267 Abv->Add(BitCodeAbbrevOp(Code));

2268

2269 Abv->Add(BitCodeAbbrevOp(0));

2270 Abv->Add(BitCodeAbbrevOp(Kind));

2272

2274

2275 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2277

2278 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2280 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2281 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2282 3));

2283 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2284 } else if constexpr (Kind ==

2286 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2287 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2288 3));

2289 Abv->Add(BitCodeAbbrevOp(1));

2291 Abv->Add(

2292 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2293 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));

2294 Abv->Add(BitCodeAbbrevOp(0));

2295 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2296 Abv->Add(BitCodeAbbrevOp(0));

2297 Abv->Add(

2298 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2301

2302 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));

2303 Abv->Add(BitCodeAbbrevOp(0));

2304 } else {

2305 llvm_unreachable("Unknown templated kind?");

2306 }

2307

2308 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2309 8));

2310

2311

2312

2313

2314

2315

2316

2317 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2318 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2319

2321 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2322 Abv->Add(BitCodeAbbrevOp(0));

2323

2324 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2325

2326 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2327 Abv->Add(BitCodeAbbrevOp(0));

2328 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2329

2330 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11));

2331 Abv->Add(BitCodeAbbrevOp(

2332 BitCodeAbbrevOp::Fixed,

2333 28));

2334

2335

2336

2337

2338

2339

2340 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2341 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));

2342

2343

2344

2345

2346

2347

2348

2349

2350 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));

2351 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2352 return Abv;

2353}

2354

2355template <FunctionDecl::TemplatedKind Kind>

2356std::shared_ptrllvm::BitCodeAbbrev getCXXMethodAbbrev() {

2358}

2359}

2360

2361void ASTWriter::WriteDeclAbbrevs() {

2362 using namespace llvm;

2363

2364 std::shared_ptr Abv;

2365

2366

2367 Abv = std::make_shared();

2369

2370 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2371 7));

2372

2373

2374

2375

2376

2377

2378 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2379 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2380

2381 Abv->Add(BitCodeAbbrevOp(0));

2382 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2383 Abv->Add(BitCodeAbbrevOp(0));

2384

2385 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2386

2387 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2388 Abv->Add(BitCodeAbbrevOp(0));

2389 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2390

2391 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));

2392 Abv->Add(BitCodeAbbrevOp(0));

2393

2394 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));

2395 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2396 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));

2397

2398

2399 Abv = std::make_shared();

2401

2402 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2403 12));

2404

2405

2406

2407 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2408 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2409

2410 Abv->Add(BitCodeAbbrevOp(0));

2411 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2412 Abv->Add(BitCodeAbbrevOp(0));

2413

2414 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2415

2416 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2417 Abv->Add(BitCodeAbbrevOp(0));

2418 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2419

2420 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));

2421 Abv->Add(BitCodeAbbrevOp(0));

2422

2423 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2424 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2425

2426 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));

2427 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2428 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));

2429

2430

2431 Abv = std::make_shared();

2433

2434 Abv->Add(BitCodeAbbrevOp(0));

2435

2436 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2437 7));

2438

2439

2440

2441

2442

2443

2444 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2445 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2446

2447 Abv->Add(BitCodeAbbrevOp(0));

2448 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2449 Abv->Add(BitCodeAbbrevOp(0));

2450

2451 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2452 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2453

2454 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2455 Abv->Add(BitCodeAbbrevOp(

2456 BitCodeAbbrevOp::Fixed,

2457 9));

2458

2459

2460 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2461 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2462

2463 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2464 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2465 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2466 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 20));

2467 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));

2468 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2469

2470 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2471 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2472 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2473 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2474 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));

2475

2476

2477 Abv = std::make_shared();

2479

2480 Abv->Add(BitCodeAbbrevOp(0));

2481

2482 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2483 7));

2484

2485

2486

2487

2488

2489

2490 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2491 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2492

2493 Abv->Add(BitCodeAbbrevOp(0));

2494 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2495 Abv->Add(BitCodeAbbrevOp(0));

2496

2497 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2498 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2499

2500 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2501 Abv->Add(BitCodeAbbrevOp(

2502 BitCodeAbbrevOp::Fixed,

2503 9));

2504

2505

2506 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2507 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2508

2509 Abv->Add(BitCodeAbbrevOp(

2510 BitCodeAbbrevOp::Fixed,

2511 13));

2512

2513

2514

2515

2516

2517

2518

2519

2520

2521 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));

2522

2523

2524 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2525 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2526 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2527 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2528 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));

2529

2530

2531 Abv = std::make_shared();

2533

2534 Abv->Add(BitCodeAbbrevOp(0));

2535

2536 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2537 8));

2538

2539

2540

2541

2542 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2543 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2544

2545 Abv->Add(BitCodeAbbrevOp(0));

2546 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2547 Abv->Add(BitCodeAbbrevOp(0));

2548

2549 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2550

2551 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2552 Abv->Add(BitCodeAbbrevOp(0));

2553 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2554

2555 Abv->Add(

2556 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2557 12));

2558

2559 Abv->Add(BitCodeAbbrevOp(0));

2560

2561 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2562 Abv->Add(BitCodeAbbrevOp(

2563 BitCodeAbbrevOp::Fixed,

2564 19));

2565

2566

2567

2568 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));

2569 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2570 DeclParmVarAbbrev = 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 7));

2580

2581

2582

2583

2584 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2585 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2586

2587 Abv->Add(BitCodeAbbrevOp(0));

2588 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2589 Abv->Add(BitCodeAbbrevOp(0));

2590

2591 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2592 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2593

2594 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));

2595 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2596 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));

2597

2598

2599 Abv = std::make_shared();

2601

2602 Abv->Add(BitCodeAbbrevOp(0));

2603

2604 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2605 12));

2606

2607

2608

2609 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2610 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2611

2612 Abv->Add(BitCodeAbbrevOp(0));

2613 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2614 Abv->Add(BitCodeAbbrevOp(0));

2615

2616 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2617

2618 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2619 Abv->Add(BitCodeAbbrevOp(0));

2620 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2621

2622 Abv->Add(BitCodeAbbrevOp(

2623 BitCodeAbbrevOp::Fixed,

2624 21));

2625

2626

2627

2628

2629

2630

2631 Abv->Add(BitCodeAbbrevOp(0));

2632

2633 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));

2634 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2635 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));

2636

2637

2638 DeclCXXMethodAbbrev =

2639 Stream.EmitAbbrev(getCXXMethodAbbrevFunctionDecl::TK\_NonTemplate());

2640 DeclTemplateCXXMethodAbbrev = Stream.EmitAbbrev(

2641 getCXXMethodAbbrevFunctionDecl::TK\_FunctionTemplate());

2642 DeclDependentNonTemplateCXXMethodAbbrev = Stream.EmitAbbrev(

2643 getCXXMethodAbbrevFunctionDecl::TK\_DependentNonTemplate());

2644 DeclMemberSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(

2645 getCXXMethodAbbrevFunctionDecl::TK\_MemberSpecialization());

2646 DeclTemplateSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(

2647 getCXXMethodAbbrevFunctionDecl::TK\_FunctionTemplateSpecialization());

2648 DeclDependentSpecializationCXXMethodAbbrev = Stream.EmitAbbrev(

2649 getCXXMethodAbbrev<

2651

2652

2653 Abv = std::make_shared();

2655 Abv->Add(BitCodeAbbrevOp(0));

2656

2657 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2658 7));

2659

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::VBR, 6));

2672

2673 Abv->Add(

2674 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));

2675 Abv->Add(BitCodeAbbrevOp(0));

2676 DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));

2677

2678

2679 Abv = std::make_shared();

2681

2682 Abv->Add(BitCodeAbbrevOp(0));

2683

2684 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,

2685 12));

2686

2687

2688

2689 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2690 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2691

2692 Abv->Add(BitCodeAbbrevOp(0));

2693 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2694 Abv->Add(BitCodeAbbrevOp(0));

2695

2696 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2697 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11));

2698 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2699 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR,

2700 6));

2701 DeclUsingShadowAbbrev = Stream.EmitAbbrev(std::move(Abv));

2702

2703

2704 Abv = std::make_shared();

2706

2707

2708

2709 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));

2710 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2711

2712

2713

2714

2715 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));

2716 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2717 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2718 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));

2719

2720

2721 Abv = std::make_shared();

2723

2724

2725

2726 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));

2727 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2728

2729 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2730 Abv->Add(BitCodeAbbrevOp(32));

2731 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2732 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));

2733

2734

2735 Abv = std::make_shared();

2737

2738

2739

2740 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));

2741 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2742

2743 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2744 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2745 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3));

2746 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));

2747

2748

2749 Abv = std::make_shared();

2751

2752

2753

2754 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));

2755 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2756

2757 Abv->Add(BitCodeAbbrevOp(0));

2758

2759 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 9));

2760

2761 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));

2762

2763

2764 Abv = std::make_shared();

2766

2767

2768

2769

2770 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));

2771 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2772

2773 Abv->Add(

2774 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2775 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2776 BinaryOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));

2777

2778

2779 Abv = std::make_shared();

2781

2782

2783

2784

2785 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));

2786 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2787

2788

2789 Abv->Add(

2790 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2791 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2792

2793 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2794 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2795 CompoundAssignOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));

2796

2797

2798 Abv = std::make_shared();

2800

2801

2802

2803 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));

2804 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2805

2806 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2807 Abv->Add(BitCodeAbbrevOp(0));

2808 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2809 CallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));

2810

2811

2812 Abv = std::make_shared();

2814

2815

2816

2817 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));

2818 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2819

2820 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2821 Abv->Add(BitCodeAbbrevOp(0));

2822 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2823

2824 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2825 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2826 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2827 CXXOperatorCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));

2828

2829

2830 Abv = std::make_shared();

2832

2833

2834

2835 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));

2836 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2837

2838 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2839 Abv->Add(BitCodeAbbrevOp(0));

2840 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2841

2842 CXXMemberCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));

2843

2844

2845 Abv = std::make_shared();

2847

2848

2849 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2850 Abv->Add(BitCodeAbbrevOp(0));

2851 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2852 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));

2853 CompoundStmtAbbrev = Stream.EmitAbbrev(std::move(Abv));

2854

2855 Abv = std::make_shared();

2857 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));

2858 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));

2859

2860 Abv = std::make_shared();

2862 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));

2863 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));

2864

2865 Abv = std::make_shared();

2867 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));

2868 DeclModuleLocalVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));

2869

2870 Abv = std::make_shared();

2872 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));

2873 DeclTULocalLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));

2874

2875 Abv = std::make_shared();

2877 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));

2878 DeclSpecializationsAbbrev = Stream.EmitAbbrev(std::move(Abv));

2879

2880 Abv = std::make_shared();

2882 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));

2883 DeclPartialSpecializationsAbbrev = Stream.EmitAbbrev(std::move(Abv));

2884}

2885

2886

2887

2888

2889

2890

2891

2892

2893

2894

2895

2896

2897

2899 Module *WritingModule) {

2900

2901

2902

2903 if (WritingModule && WritingModule->isNamedModule()) {

2904

2905

2906

2907

2908 if (isa<PragmaCommentDecl, PragmaDetectMismatchDecl>(D))

2909 return true;

2910 return false;

2911 }

2912

2913

2914

2915

2916

2917

2918 if (isa<FileScopeAsmDecl, TopLevelStmtDecl, ObjCImplDecl>(D))

2919 return true;

2920

2922

2923

2924 return false;

2925 }

2926

2928}

2929

2930void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {

2932 "serializing");

2933

2934

2936 assert(D->isFromASTFile() && "should not be emitting imported decl");

2939 IDR = NextDeclID++;

2940

2941 ID = IDR;

2942

2943 assert(ID >= FirstDeclID && "invalid decl ID");

2944

2947

2948

2949 W.Visit(D);

2950

2951

2953

2954

2958

2959 unsigned Index = ID.getRawValue() - FirstDeclID.getRawValue();

2960 if (DeclOffsets.size() == Index)

2961 DeclOffsets.emplace_back(RawLoc, Offset, DeclTypesBlockStartOffset);

2962 else if (DeclOffsets.size() < Index) {

2963

2964 DeclOffsets.resize(Index+1);

2965 DeclOffsets[Index].setRawLoc(RawLoc);

2966 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);

2967 } else {

2968 llvm_unreachable("declarations should be emitted in ID order");

2969 }

2970

2973 associateDeclWithFile(D, ID);

2974

2975

2976

2978 AddDeclRef(D, EagerlyDeserializedDecls);

2979}

2980

2982

2984

2986 bool ModulesCodegen = false;

2988 std::optional Linkage;

2989 if (Writer->WritingModule &&

2991

2992

2993

2994

2995 Linkage = getASTContext().GetGVALinkageForFunction(FD);

2997 }

2998 if (Writer->getLangOpts().ModulesCodegen ||

2999 (FD->hasAttr() &&

3000 Writer->getLangOpts().BuildingPCHWithObjectFile)) {

3001

3002

3003

3004 if (!FD->hasAttr()) {

3006 Linkage = getASTContext().GetGVALinkageForFunction(FD);

3007 ModulesCodegen =

3009 }

3010 }

3011 }

3012 Record->push_back(ModulesCodegen);

3013 if (ModulesCodegen)

3014 Writer->AddDeclRef(FD, Writer->ModularCodegenDecls);

3015 if (auto *CD = dyn_cast(FD)) {

3016 Record->push_back(CD->getNumCtorInitializers());

3017 if (CD->getNumCtorInitializers())

3019 }

3021}

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 VisitOutlinedFunctionDecl(OutlinedFunctionDecl *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 partial function definition.

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_OUTLINEDFUNCTION

A OutlinedFunctionDecl record.

@ 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)