clang 23.0.0git
ASTWriterDecl.cpp
Go to the documentation of this file.
1//===--- ASTWriterDecl.cpp - Declaration Serialization --------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file implements serialization for Declarations.
10//
11//===----------------------------------------------------------------------===//
12
13#include "ASTCommon.h"
14#include "clang/AST/Attr.h"
15#include "clang/AST/DeclCXX.h"
18#include "clang/AST/Expr.h"
24#include "llvm/Bitstream/BitstreamWriter.h"
25#include "llvm/Support/ErrorHandling.h"
26using namespace clang;
27using namespace serialization;
28
29//===----------------------------------------------------------------------===//
30// Utility functions
31//===----------------------------------------------------------------------===//
32
33namespace {
34
35// Helper function that returns true if the decl passed in the argument is
36// a defintion in dependent contxt.
37template <typename DT> bool isDefinitionInDependentContext(DT *D) {
38 return D->isDependentContext() && D->isThisDeclarationADefinition();
39}
40
41} // namespace
42
43//===----------------------------------------------------------------------===//
44// Declaration serialization
45//===----------------------------------------------------------------------===//
46
47namespace clang {
48 class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {
49 ASTWriter &Writer;
50 ASTRecordWriter Record;
51
53 unsigned AbbrevToUse;
54
55 bool GeneratingReducedBMI = false;
56
57 public:
59 ASTWriter::RecordDataImpl &Record, bool GeneratingReducedBMI)
60 : Writer(Writer), Record(Context, Writer, Record),
61 Code((serialization::DeclCode)0), AbbrevToUse(0),
62 GeneratingReducedBMI(GeneratingReducedBMI) {}
63
64 uint64_t Emit(Decl *D) {
65 if (!Code)
66 llvm::report_fatal_error(StringRef("unexpected declaration kind '") +
67 D->getDeclKindName() + "'");
68 return Record.Emit(Code, AbbrevToUse);
69 }
70
71 void Visit(Decl *D);
72
73 void VisitDecl(Decl *D);
78 void VisitLabelDecl(LabelDecl *LD);
82 void VisitTypeDecl(TypeDecl *D);
88 void VisitTagDecl(TagDecl *D);
89 void VisitEnumDecl(EnumDecl *D);
100 void VisitValueDecl(ValueDecl *D);
110 void VisitFieldDecl(FieldDecl *D);
116 void VisitVarDecl(VarDecl *D);
133 void VisitUsingDecl(UsingDecl *D);
147 void VisitBlockDecl(BlockDecl *D);
150 void VisitEmptyDecl(EmptyDecl *D);
153 template <typename T> void VisitRedeclarable(Redeclarable<T> *D);
155
156 // FIXME: Put in the same order is DeclNodes.td?
177
180
181 /// Add an Objective-C type parameter list to the given record.
183 // Empty type parameter list.
184 if (!typeParams) {
185 Record.push_back(0);
186 return;
187 }
188
189 Record.push_back(typeParams->size());
190 for (auto *typeParam : *typeParams) {
191 Record.AddDeclRef(typeParam);
192 }
193 Record.AddSourceLocation(typeParams->getLAngleLoc());
194 Record.AddSourceLocation(typeParams->getRAngleLoc());
195 }
196
197 /// Add to the record the first declaration from each module file that
198 /// provides a declaration of D. The intent is to provide a sufficient
199 /// set such that reloading this set will load all current redeclarations.
200 void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
201 auto Firsts = Writer.CollectFirstDeclFromEachModule(D, IncludeLocal);
202 for (const auto &[_, First] : Firsts)
203 Record.AddDeclRef(First);
204 }
205
206 template <typename T> bool shouldSkipWritingSpecializations(T *Spec) {
207 // Now we will only avoid writing specializations if we're generating
208 // reduced BMI.
209 if (!GeneratingReducedBMI)
210 return false;
211
214
216 if (auto *CTSD = dyn_cast<ClassTemplateSpecializationDecl>(Spec))
217 Args = CTSD->getTemplateArgs().asArray();
218 else if (auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(Spec))
219 Args = VTSD->getTemplateArgs().asArray();
220 else
221 Args = cast<FunctionDecl>(Spec)
222 ->getTemplateSpecializationArgs()
223 ->asArray();
224
225 // If there is any template argument is TULocal, we can avoid writing the
226 // specialization since the consumers of reduced BMI won't get the
227 // specialization anyway.
228 for (const TemplateArgument &TA : Args) {
229 switch (TA.getKind()) {
231 Linkage L = TA.getAsType()->getLinkage();
232 if (!isExternallyVisible(L))
233 return true;
234 break;
235 }
237 if (!TA.getAsDecl()->isExternallyVisible())
238 return true;
239 break;
240 default:
241 break;
242 }
243 }
244
245 return false;
246 }
247
248 /// Add to the record the first template specialization from each module
249 /// file that provides a declaration of D. We store the DeclId and an
250 /// ODRHash of the template arguments of D which should provide enough
251 /// information to load D only if the template instantiator needs it.
253 const Decl *D, llvm::SmallVectorImpl<const Decl *> &SpecsInMap,
254 llvm::SmallVectorImpl<const Decl *> &PartialSpecsInMap) {
257 "Must not be called with other decls");
258 auto Firsts =
259 Writer.CollectFirstDeclFromEachModule(D, /*IncludeLocal=*/true);
260 for (const auto &[_, First] : Firsts) {
262 continue;
263
266 PartialSpecsInMap.push_back(First);
267 else
268 SpecsInMap.push_back(First);
269 }
270 }
271
272 /// Get the specialization decl from an entry in the specialization list.
273 template <typename EntryType>
278
279 /// Get the list of partial specializations from a template's common ptr.
280 template<typename T>
281 decltype(T::PartialSpecializations) &getPartialSpecializations(T *Common) {
282 return Common->PartialSpecializations;
283 }
288
289 template<typename DeclTy>
291 auto *Common = D->getCommonPtr();
292
293 // If we have any lazy specializations, and the external AST source is
294 // our chained AST reader, we can just write out the DeclIDs. Otherwise,
295 // we need to resolve them to actual declarations.
296 if (Writer.Chain != Record.getASTContext().getExternalSource() &&
297 Writer.Chain && Writer.Chain->haveUnloadedSpecializations(D)) {
298 D->LoadLazySpecializations();
299 assert(!Writer.Chain->haveUnloadedSpecializations(D));
300 }
301
302 // AddFirstSpecializationDeclFromEachModule might trigger deserialization,
303 // invalidating *Specializations iterators.
305 for (auto &Entry : Common->Specializations)
306 AllSpecs.push_back(getSpecializationDecl(Entry));
307 for (auto &Entry : getPartialSpecializations(Common))
308 AllSpecs.push_back(getSpecializationDecl(Entry));
309
312 for (auto *D : AllSpecs) {
313 assert(D->isCanonicalDecl() && "non-canonical decl in set");
314 AddFirstSpecializationDeclFromEachModule(D, Specs, PartialSpecs);
315 }
316
317 Record.AddOffset(Writer.WriteSpecializationInfoLookupTable(
318 D, Specs, /*IsPartial=*/false));
319
320 // Function Template Decl doesn't have partial decls.
322 assert(PartialSpecs.empty());
323 return;
324 }
325
326 Record.AddOffset(Writer.WriteSpecializationInfoLookupTable(
327 D, PartialSpecs, /*IsPartial=*/true));
328 }
329
330 /// Ensure that this template specialization is associated with the specified
331 /// template on reload.
333 const Decl *Specialization) {
334 Template = Template->getCanonicalDecl();
335
336 // If the canonical template is local, we'll write out this specialization
337 // when we emit it.
338 // FIXME: We can do the same thing if there is any local declaration of
339 // the template, to avoid emitting an update record.
340 if (!Template->isFromASTFile())
341 return;
342
343 // We only need to associate the first local declaration of the
344 // specialization. The other declarations will get pulled in by it.
345 if (Writer.getFirstLocalDecl(Specialization) != Specialization)
346 return;
347
350 Writer.PartialSpecializationsUpdates[cast<NamedDecl>(Template)]
351 .push_back(cast<NamedDecl>(Specialization));
352 else
353 Writer.SpecializationsUpdates[cast<NamedDecl>(Template)].push_back(
355 }
356 };
357}
358
359// When building a C++20 module interface unit or a partition unit, a
360// strong definition in the module interface is provided by the
361// compilation of that unit, not by its users. (Inline variables are still
362// emitted in module users.)
363static bool shouldVarGenerateHereOnly(const VarDecl *VD) {
364 if (VD->getStorageDuration() != SD_Static &&
366 return false;
367
368 if (VD->getDescribedVarTemplate())
369 return false;
370
371 Module *M = VD->getOwningModule();
372 if (!M)
373 return false;
374
375 M = M->getTopLevelModule();
376 ASTContext &Ctx = VD->getASTContext();
377 if (!M->isInterfaceOrPartition() &&
378 (!VD->hasAttr<DLLExportAttr>() ||
379 !Ctx.getLangOpts().BuildingPCHWithObjectFile))
380 return false;
381
383}
384
386 if (FD->isDependentContext())
387 return false;
388
389 ASTContext &Ctx = FD->getASTContext();
390 auto Linkage = Ctx.GetGVALinkageForFunction(FD);
391 if (Ctx.getLangOpts().ModulesCodegen ||
392 (FD->hasAttr<DLLExportAttr>() &&
393 Ctx.getLangOpts().BuildingPCHWithObjectFile))
394 // Under -fmodules-codegen, codegen is performed for all non-internal,
395 // non-always_inline functions, unless they are available elsewhere.
396 if (!FD->hasAttr<AlwaysInlineAttr>() && Linkage != GVA_Internal &&
398 return true;
399
400 Module *M = FD->getOwningModule();
401 if (!M)
402 return false;
403
404 M = M->getTopLevelModule();
405 if (M->isInterfaceOrPartition())
407 return true;
408
409 return false;
410}
411
413 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
414 if (FD->isInlined() || FD->isConstexpr() || FD->isConsteval())
415 return false;
416
417 // If the function should be generated somewhere else, we shouldn't elide
418 // it.
420 return false;
421 }
422
423 if (auto *VD = dyn_cast<VarDecl>(D)) {
424 if (VD->getDeclContext()->isDependentContext())
425 return false;
426
427 // Constant initialized variable may not affect the ABI, but they
428 // may be used in constant evaluation in the frontend, so we have
429 // to remain them.
430 if (VD->hasConstantInitialization() || VD->isConstexpr())
431 return false;
432
433 // If the variable should be generated somewhere else, we shouldn't elide
434 // it.
436 return false;
437 }
438
439 return true;
440}
441
444
445 // Source locations require array (variable-length) abbreviations. The
446 // abbreviation infrastructure requires that arrays are encoded last, so
447 // we handle it here in the case of those classes derived from DeclaratorDecl
448 if (auto *DD = dyn_cast<DeclaratorDecl>(D)) {
449 if (auto *TInfo = DD->getTypeSourceInfo())
450 Record.AddTypeLoc(TInfo->getTypeLoc());
451 }
452
453 // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
454 // have been written. We want it last because we will not read it back when
455 // retrieving it from the AST, we'll just lazily set the offset.
456 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
457 if (!GeneratingReducedBMI || !CanElideDeclDef(FD)) {
458 Record.push_back(FD->doesThisDeclarationHaveABody());
459 if (FD->doesThisDeclarationHaveABody())
460 Record.AddFunctionDefinition(FD);
461 } else
462 Record.push_back(0);
463 }
464
465 // Similar to FunctionDecls, handle VarDecl's initializer here and write it
466 // after all other Stmts/Exprs. We will not read the initializer until after
467 // we have finished recursive deserialization, because it can recursively
468 // refer back to the variable.
469 if (auto *VD = dyn_cast<VarDecl>(D)) {
470 if (!GeneratingReducedBMI || !CanElideDeclDef(VD))
471 Record.AddVarDeclInit(VD);
472 else
473 Record.push_back(0);
474 }
475
476 // And similarly for FieldDecls. We already serialized whether there is a
477 // default member initializer.
478 if (auto *FD = dyn_cast<FieldDecl>(D)) {
479 if (FD->hasInClassInitializer()) {
480 if (Expr *Init = FD->getInClassInitializer()) {
481 Record.push_back(1);
482 Record.AddStmt(Init);
483 } else {
484 Record.push_back(0);
485 // Initializer has not been instantiated yet.
486 }
487 }
488 }
489
490 // If this declaration is also a DeclContext, write blocks for the
491 // declarations that lexically stored inside its context and those
492 // declarations that are visible from its context.
493 if (auto *DC = dyn_cast<DeclContext>(D))
495}
496
498 BitsPacker DeclBits;
499
500 // The order matters here. It will be better to put the bit with higher
501 // probability to be 0 in the end of the bits.
502 //
503 // Since we're using VBR6 format to store it.
504 // It will be pretty effient if all the higher bits are 0.
505 // For example, if we need to pack 8 bits into a value and the stored value
506 // is 0xf0, the actual stored value will be 0b000111'110000, which takes 12
507 // bits actually. However, if we changed the order to be 0x0f, then we can
508 // store it as 0b001111, which takes 6 bits only now.
509 DeclBits.addBits((uint64_t)D->getModuleOwnershipKind(), /*BitWidth=*/3);
510 DeclBits.addBit(D->isThisDeclarationReferenced());
511 // If we're writing a BMI for a named module unit, we can treat all decls as in
512 // the BMI as used. Otherwise, the consumer need to mark it as used again, this
513 // simply waste time.
514 DeclBits.addBit(Writer.isWritingStdCXXNamedModules() ? true : D->isUsed(false));
515 DeclBits.addBits(D->getAccess(), /*BitWidth=*/2);
516 DeclBits.addBit(D->isImplicit());
517 DeclBits.addBit(D->getDeclContext() != D->getLexicalDeclContext());
518 DeclBits.addBit(D->hasAttrs());
520 DeclBits.addBit(D->isInvalidDecl());
521 Record.push_back(DeclBits);
522
523 Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
524 if (D->getDeclContext() != D->getLexicalDeclContext())
525 Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
526
527 if (D->hasAttrs())
528 Record.AddAttributes(D->getAttrs());
529
530 Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
531
532 // If this declaration injected a name into a context different from its
533 // lexical context, and that context is an imported namespace, we need to
534 // update its visible declarations to include this name.
535 //
536 // This happens when we instantiate a class with a friend declaration or a
537 // function with a local extern declaration, for instance.
538 //
539 // FIXME: Can we handle this in AddedVisibleDecl instead?
540 if (D->isOutOfLine()) {
541 auto *DC = D->getDeclContext();
542 while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
543 if (!NS->isFromASTFile())
544 break;
545 Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
546 if (!NS->isInlineNamespace())
547 break;
548 DC = NS->getParent();
549 }
550 }
551}
552
554 StringRef Arg = D->getArg();
555 Record.push_back(Arg.size());
556 VisitDecl(D);
557 Record.AddSourceLocation(D->getBeginLoc());
558 Record.push_back(D->getCommentKind());
559 Record.AddString(Arg);
561}
562
565 StringRef Name = D->getName();
566 StringRef Value = D->getValue();
567 Record.push_back(Name.size() + 1 + Value.size());
568 VisitDecl(D);
569 Record.AddSourceLocation(D->getBeginLoc());
570 Record.AddString(Name);
571 Record.AddString(Value);
573}
574
576 llvm_unreachable("Translation units aren't directly serialized");
577}
578
580 VisitDecl(D);
581 Record.AddDeclarationName(D->getDeclName());
582 Record.push_back(needsAnonymousDeclarationNumber(D)
583 ? Writer.getAnonymousDeclarationNumber(D)
584 : 0);
585}
586
589 Record.AddSourceLocation(D->getBeginLoc());
591 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
592}
593
596 VisitTypeDecl(D);
597 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
598 Record.push_back(D->isModed());
599 if (D->isModed())
600 Record.AddTypeRef(D->getUnderlyingType());
601 Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
602}
603
606 if (D->getDeclContext() == D->getLexicalDeclContext() &&
607 !D->hasAttrs() &&
608 !D->isImplicit() &&
609 D->getFirstDecl() == D->getMostRecentDecl() &&
610 !D->isInvalidDecl() &&
612 !D->isModulePrivate() &&
615 AbbrevToUse = Writer.getDeclTypedefAbbrev();
616
618}
619
625
627 static_assert(DeclContext::NumTagDeclBits == 23,
628 "You need to update the serializer after you change the "
629 "TagDeclBits");
630
632 VisitTypeDecl(D);
633 Record.push_back(D->getIdentifierNamespace());
634
635 BitsPacker TagDeclBits;
636 TagDeclBits.addBits(llvm::to_underlying(D->getTagKind()), /*BitWidth=*/3);
637 TagDeclBits.addBit(!isa<CXXRecordDecl>(D) ? D->isCompleteDefinition() : 0);
638 TagDeclBits.addBit(D->isEmbeddedInDeclarator());
639 TagDeclBits.addBit(D->isFreeStanding());
640 TagDeclBits.addBit(D->isCompleteDefinitionRequired());
641 TagDeclBits.addBits(
642 D->hasExtInfo() ? 1 : (D->getTypedefNameForAnonDecl() ? 2 : 0),
643 /*BitWidth=*/2);
644 Record.push_back(TagDeclBits);
645
646 Record.AddSourceRange(D->getBraceRange());
647
648 if (D->hasExtInfo()) {
649 Record.AddQualifierInfo(*D->getExtInfo());
650 } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
651 Record.AddDeclRef(TD);
652 Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
653 }
654}
655
657 static_assert(DeclContext::NumEnumDeclBits == 43,
658 "You need to update the serializer after you change the "
659 "EnumDeclBits");
660
661 VisitTagDecl(D);
662 Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
663 if (!D->getIntegerTypeSourceInfo())
664 Record.AddTypeRef(D->getIntegerType());
665 Record.AddTypeRef(D->getPromotionType());
666
667 BitsPacker EnumDeclBits;
668 EnumDeclBits.addBits(D->getNumPositiveBits(), /*BitWidth=*/8);
669 EnumDeclBits.addBits(D->getNumNegativeBits(), /*BitWidth=*/8);
670 EnumDeclBits.addBit(D->isScoped());
671 EnumDeclBits.addBit(D->isScopedUsingClassTag());
672 EnumDeclBits.addBit(D->isFixed());
673 Record.push_back(EnumDeclBits);
674
675 Record.push_back(D->getODRHash());
676
678 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
679 Record.push_back(MemberInfo->getTemplateSpecializationKind());
680 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
681 } else {
682 Record.AddDeclRef(nullptr);
683 }
684
685 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
686 !D->isInvalidDecl() && !D->isImplicit() && !D->hasExtInfo() &&
688 D->getFirstDecl() == D->getMostRecentDecl() &&
694 AbbrevToUse = Writer.getDeclEnumAbbrev();
695
697}
698
700 static_assert(DeclContext::NumRecordDeclBits == 64,
701 "You need to update the serializer after you change the "
702 "RecordDeclBits");
703
704 VisitTagDecl(D);
705
706 BitsPacker RecordDeclBits;
707 RecordDeclBits.addBit(D->hasFlexibleArrayMember());
708 RecordDeclBits.addBit(D->isAnonymousStructOrUnion());
709 RecordDeclBits.addBit(D->hasObjectMember());
710 RecordDeclBits.addBit(D->hasVolatileMember());
712 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveCopy());
713 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveDestroy());
716 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveCopyCUnion());
717 RecordDeclBits.addBit(D->hasUninitializedExplicitInitFields());
718 RecordDeclBits.addBit(D->isParamDestroyedInCallee());
719 RecordDeclBits.addBits(llvm::to_underlying(D->getArgPassingRestrictions()), 2);
720 Record.push_back(RecordDeclBits);
721
722 // Only compute this for C/Objective-C, in C++ this is computed as part
723 // of CXXRecordDecl.
724 if (!isa<CXXRecordDecl>(D))
725 Record.push_back(D->getODRHash());
726
727 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
728 !D->isImplicit() && !D->isInvalidDecl() && !D->hasExtInfo() &&
730 D->getFirstDecl() == D->getMostRecentDecl() &&
735 AbbrevToUse = Writer.getDeclRecordAbbrev();
736
738}
739
742 Record.AddTypeRef(D->getType());
743}
744
747 Record.push_back(D->getInitExpr()? 1 : 0);
748 if (D->getInitExpr())
749 Record.AddStmt(D->getInitExpr());
750 Record.AddAPSInt(D->getInitVal());
751
753}
754
757 Record.AddSourceLocation(D->getInnerLocStart());
758 Record.push_back(D->hasExtInfo());
759 if (D->hasExtInfo()) {
760 DeclaratorDecl::ExtInfo *Info = D->getExtInfo();
761 Record.AddQualifierInfo(*Info);
762 Record.AddStmt(
763 const_cast<Expr *>(Info->TrailingRequiresClause.ConstraintExpr));
764 Record.writeUnsignedOrNone(Info->TrailingRequiresClause.ArgPackSubstIndex);
765 }
766 // The location information is deferred until the end of the record.
767 Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()
768 : QualType());
769}
770
772 static_assert(DeclContext::NumFunctionDeclBits == 45,
773 "You need to update the serializer after you change the "
774 "FunctionDeclBits");
775
777
778 Record.push_back(D->getTemplatedKind());
779 switch (D->getTemplatedKind()) {
781 break;
783 Record.AddDeclRef(D->getInstantiatedFromDecl());
784 break;
786 Record.AddDeclRef(D->getDescribedFunctionTemplate());
787 break;
790 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
791 Record.push_back(MemberInfo->getTemplateSpecializationKind());
792 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
793 break;
794 }
797 FTSInfo = D->getTemplateSpecializationInfo();
798
800
801 Record.AddDeclRef(FTSInfo->getTemplate());
802 Record.push_back(FTSInfo->getTemplateSpecializationKind());
803
804 // Template arguments.
805 Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
806
807 // Template args as written.
808 Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
809 if (FTSInfo->TemplateArgumentsAsWritten)
810 Record.AddASTTemplateArgumentListInfo(
812
813 Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
814
815 if (MemberSpecializationInfo *MemberInfo =
816 FTSInfo->getMemberSpecializationInfo()) {
817 Record.push_back(1);
818 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
819 Record.push_back(MemberInfo->getTemplateSpecializationKind());
820 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
821 } else {
822 Record.push_back(0);
823 }
824
825 if (D->isCanonicalDecl()) {
826 // Write the template that contains the specializations set. We will
827 // add a FunctionTemplateSpecializationInfo to it when reading.
828 Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
829 }
830 break;
831 }
834 DFTSInfo = D->getDependentSpecializationInfo();
835
836 // Candidates.
837 Record.push_back(DFTSInfo->getCandidates().size());
838 for (FunctionTemplateDecl *FTD : DFTSInfo->getCandidates())
839 Record.AddDeclRef(FTD);
840
841 // Templates args.
842 Record.push_back(DFTSInfo->TemplateArgumentsAsWritten != nullptr);
843 if (DFTSInfo->TemplateArgumentsAsWritten)
844 Record.AddASTTemplateArgumentListInfo(
846 break;
847 }
848 }
849
851 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
852 Record.push_back(D->getIdentifierNamespace());
853
854 // The order matters here. It will be better to put the bit with higher
855 // probability to be 0 in the end of the bits. See the comments in VisitDecl
856 // for details.
857 BitsPacker FunctionDeclBits;
858 // FIXME: stable encoding
859 FunctionDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), 3);
860 FunctionDeclBits.addBits((uint32_t)D->getStorageClass(), /*BitWidth=*/3);
861 FunctionDeclBits.addBit(D->isInlineSpecified());
862 FunctionDeclBits.addBit(D->isInlined());
863 FunctionDeclBits.addBit(D->hasSkippedBody());
864 FunctionDeclBits.addBit(D->isVirtualAsWritten());
865 FunctionDeclBits.addBit(D->isPureVirtual());
866 FunctionDeclBits.addBit(D->hasInheritedPrototype());
867 FunctionDeclBits.addBit(D->hasWrittenPrototype());
868 FunctionDeclBits.addBit(D->isDeletedBit());
869 FunctionDeclBits.addBit(D->isTrivial());
870 FunctionDeclBits.addBit(D->isTrivialForCall());
871 FunctionDeclBits.addBit(D->isDefaulted());
872 FunctionDeclBits.addBit(D->isExplicitlyDefaulted());
873 FunctionDeclBits.addBit(D->isIneligibleOrNotSelected());
874 FunctionDeclBits.addBits((uint64_t)(D->getConstexprKind()), /*BitWidth=*/2);
875 FunctionDeclBits.addBit(D->hasImplicitReturnZero());
876 FunctionDeclBits.addBit(D->isMultiVersion());
877 FunctionDeclBits.addBit(D->isLateTemplateParsed());
878 FunctionDeclBits.addBit(D->isInstantiatedFromMemberTemplate());
880 FunctionDeclBits.addBit(D->usesSEHTry());
881 FunctionDeclBits.addBit(D->isDestroyingOperatorDelete());
882 FunctionDeclBits.addBit(D->isTypeAwareOperatorNewOrDelete());
883 Record.push_back(FunctionDeclBits);
884
885 Record.AddSourceLocation(D->getEndLoc());
886 if (D->isExplicitlyDefaulted())
887 Record.AddSourceLocation(D->getDefaultLoc());
888
889 Record.push_back(D->getODRHash());
890
891 if (D->isDefaulted() || D->isDeletedAsWritten()) {
892 if (auto *FDI = D->getDefaultedOrDeletedInfo()) {
893 // Store both that there is an DefaultedOrDeletedInfo and whether it
894 // contains a DeletedMessage.
895 StringLiteral *DeletedMessage = FDI->getDeletedMessage();
896 Record.push_back(1 | (DeletedMessage ? 2 : 0));
897 if (DeletedMessage)
898 Record.AddStmt(DeletedMessage);
899
900 Record.push_back(FDI->getUnqualifiedLookups().size());
901 for (DeclAccessPair P : FDI->getUnqualifiedLookups()) {
902 Record.AddDeclRef(P.getDecl());
903 Record.push_back(P.getAccess());
904 }
905 } else {
906 Record.push_back(0);
907 }
908 }
909
910 if (D->getFriendObjectKind()) {
911 // For a friend function defined inline within a class template, we have to
912 // force the definition to be the one inside the definition of the template
913 // class. Remember this relation to deserialize them together.
914 if (auto *RD = dyn_cast<CXXRecordDecl>(D->getLexicalParent());
915 RD && isDefinitionInDependentContext(RD)) {
916 Writer.RelatedDeclsMap[Writer.GetDeclRef(RD)].push_back(
917 Writer.GetDeclRef(D));
918 }
919 }
920
921 Record.push_back(D->param_size());
922 for (auto *P : D->parameters())
923 Record.AddDeclRef(P);
925}
926
929 uint64_t Kind = static_cast<uint64_t>(ES.getKind());
930 Kind = Kind << 1 | static_cast<bool>(ES.getExpr());
931 Record.push_back(Kind);
932 if (ES.getExpr()) {
933 Record.AddStmt(ES.getExpr());
934 }
935}
936
939 Record.AddDeclRef(D->Ctor);
941 Record.push_back(static_cast<unsigned char>(D->getDeductionCandidateKind()));
942 Record.AddDeclRef(D->getSourceDeductionGuide());
943 Record.push_back(
944 static_cast<unsigned char>(D->getSourceDeductionGuideKind()));
946}
947
949 static_assert(DeclContext::NumObjCMethodDeclBits == 37,
950 "You need to update the serializer after you change the "
951 "ObjCMethodDeclBits");
952
954 // FIXME: convert to LazyStmtPtr?
955 // Unlike C/C++, method bodies will never be in header files.
956 bool HasBodyStuff = D->getBody() != nullptr;
957 Record.push_back(HasBodyStuff);
958 if (HasBodyStuff) {
959 Record.AddStmt(D->getBody());
960 }
961 Record.AddDeclRef(D->getSelfDecl());
962 Record.AddDeclRef(D->getCmdDecl());
963 Record.push_back(D->isInstanceMethod());
964 Record.push_back(D->isVariadic());
965 Record.push_back(D->isPropertyAccessor());
966 Record.push_back(D->isSynthesizedAccessorStub());
967 Record.push_back(D->isDefined());
968 Record.push_back(D->isOverriding());
969 Record.push_back(D->hasSkippedBody());
970
971 Record.push_back(D->isRedeclaration());
972 Record.push_back(D->hasRedeclaration());
973 if (D->hasRedeclaration()) {
974 assert(Record.getASTContext().getObjCMethodRedeclaration(D));
975 Record.AddDeclRef(Record.getASTContext().getObjCMethodRedeclaration(D));
976 }
977
978 // FIXME: stable encoding for @required/@optional
979 Record.push_back(llvm::to_underlying(D->getImplementationControl()));
980 // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
981 Record.push_back(D->getObjCDeclQualifier());
982 Record.push_back(D->hasRelatedResultType());
983 Record.AddTypeRef(D->getReturnType());
984 Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
985 Record.AddSourceLocation(D->getEndLoc());
986 Record.push_back(D->param_size());
987 for (const auto *P : D->parameters())
988 Record.AddDeclRef(P);
989
990 Record.push_back(D->getSelLocsKind());
991 unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
992 SourceLocation *SelLocs = D->getStoredSelLocs();
993 Record.push_back(NumStoredSelLocs);
994 for (unsigned i = 0; i != NumStoredSelLocs; ++i)
995 Record.AddSourceLocation(SelLocs[i]);
996
998}
999
1002 Record.push_back(D->Variance);
1003 Record.push_back(D->Index);
1004 Record.AddSourceLocation(D->VarianceLoc);
1005 Record.AddSourceLocation(D->ColonLoc);
1006
1008}
1009
1011 static_assert(DeclContext::NumObjCContainerDeclBits == 64,
1012 "You need to update the serializer after you change the "
1013 "ObjCContainerDeclBits");
1014
1015 VisitNamedDecl(D);
1016 Record.AddSourceLocation(D->getAtStartLoc());
1017 Record.AddSourceRange(D->getAtEndRange());
1018 // Abstract class (no need to define a stable serialization::DECL code).
1019}
1020
1024 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
1025 AddObjCTypeParamList(D->TypeParamList);
1026
1027 Record.push_back(D->isThisDeclarationADefinition());
1029 // Write the DefinitionData
1030 ObjCInterfaceDecl::DefinitionData &Data = D->data();
1031
1032 Record.AddTypeSourceInfo(D->getSuperClassTInfo());
1033 Record.AddSourceLocation(D->getEndOfDefinitionLoc());
1034 Record.push_back(Data.HasDesignatedInitializers);
1035 Record.push_back(D->getODRHash());
1036
1037 // Write out the protocols that are directly referenced by the @interface.
1038 Record.push_back(Data.ReferencedProtocols.size());
1039 for (const auto *P : D->protocols())
1040 Record.AddDeclRef(P);
1041 for (const auto &PL : D->protocol_locs())
1042 Record.AddSourceLocation(PL);
1043
1044 // Write out the protocols that are transitively referenced.
1045 Record.push_back(Data.AllReferencedProtocols.size());
1047 P = Data.AllReferencedProtocols.begin(),
1048 PEnd = Data.AllReferencedProtocols.end();
1049 P != PEnd; ++P)
1050 Record.AddDeclRef(*P);
1051
1052
1053 if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
1054 // Ensure that we write out the set of categories for this class.
1055 Writer.ObjCClassesWithCategories.insert(D);
1056
1057 // Make sure that the categories get serialized.
1058 for (; Cat; Cat = Cat->getNextClassCategoryRaw())
1059 (void)Writer.GetDeclRef(Cat);
1060 }
1061 }
1062
1064}
1065
1067 VisitFieldDecl(D);
1068 // FIXME: stable encoding for @public/@private/@protected/@package
1069 Record.push_back(D->getAccessControl());
1070 Record.push_back(D->getSynthesize());
1071
1072 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1073 !D->hasAttrs() &&
1074 !D->isImplicit() &&
1075 !D->isUsed(false) &&
1076 !D->isInvalidDecl() &&
1077 !D->isReferenced() &&
1078 !D->isModulePrivate() &&
1079 !D->getBitWidth() &&
1080 !D->hasExtInfo() &&
1081 D->getDeclName())
1082 AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
1083
1085}
1086
1090
1091 Record.push_back(D->isThisDeclarationADefinition());
1093 Record.push_back(D->protocol_size());
1094 for (const auto *I : D->protocols())
1095 Record.AddDeclRef(I);
1096 for (const auto &PL : D->protocol_locs())
1097 Record.AddSourceLocation(PL);
1098 Record.push_back(D->getODRHash());
1099 }
1100
1102}
1103
1108
1111 Record.AddSourceLocation(D->getCategoryNameLoc());
1112 Record.AddSourceLocation(D->getIvarLBraceLoc());
1113 Record.AddSourceLocation(D->getIvarRBraceLoc());
1114 Record.AddDeclRef(D->getClassInterface());
1115 AddObjCTypeParamList(D->TypeParamList);
1116 Record.push_back(D->protocol_size());
1117 for (const auto *I : D->protocols())
1118 Record.AddDeclRef(I);
1119 for (const auto &PL : D->protocol_locs())
1120 Record.AddSourceLocation(PL);
1122}
1123
1129
1131 VisitNamedDecl(D);
1132 Record.AddSourceLocation(D->getAtLoc());
1133 Record.AddSourceLocation(D->getLParenLoc());
1134 Record.AddTypeRef(D->getType());
1135 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
1136 // FIXME: stable encoding
1137 Record.push_back((unsigned)D->getPropertyAttributes());
1138 Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
1139 // FIXME: stable encoding
1140 Record.push_back((unsigned)D->getPropertyImplementation());
1141 Record.AddDeclarationName(D->getGetterName());
1142 Record.AddSourceLocation(D->getGetterNameLoc());
1143 Record.AddDeclarationName(D->getSetterName());
1144 Record.AddSourceLocation(D->getSetterNameLoc());
1145 Record.AddDeclRef(D->getGetterMethodDecl());
1146 Record.AddDeclRef(D->getSetterMethodDecl());
1147 Record.AddDeclRef(D->getPropertyIvarDecl());
1149}
1150
1153 Record.AddDeclRef(D->getClassInterface());
1154 // Abstract class (no need to define a stable serialization::DECL code).
1155}
1156
1162
1165 Record.AddDeclRef(D->getSuperClass());
1166 Record.AddSourceLocation(D->getSuperClassLoc());
1167 Record.AddSourceLocation(D->getIvarLBraceLoc());
1168 Record.AddSourceLocation(D->getIvarRBraceLoc());
1169 Record.push_back(D->hasNonZeroConstructors());
1170 Record.push_back(D->hasDestructors());
1171 Record.push_back(D->NumIvarInitializers);
1172 if (D->NumIvarInitializers)
1173 Record.AddCXXCtorInitializers(
1174 llvm::ArrayRef(D->init_begin(), D->init_end()));
1176}
1177
1179 VisitDecl(D);
1180 Record.AddSourceLocation(D->getBeginLoc());
1181 Record.AddDeclRef(D->getPropertyDecl());
1182 Record.AddDeclRef(D->getPropertyIvarDecl());
1183 Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
1184 Record.AddDeclRef(D->getGetterMethodDecl());
1185 Record.AddDeclRef(D->getSetterMethodDecl());
1186 Record.AddStmt(D->getGetterCXXConstructor());
1187 Record.AddStmt(D->getSetterCXXAssignment());
1189}
1190
1193 Record.push_back(D->isMutable());
1194
1195 Record.push_back((D->StorageKind << 1) | D->BitField);
1196 if (D->StorageKind == FieldDecl::ISK_CapturedVLAType)
1197 Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
1198 else if (D->BitField)
1199 Record.AddStmt(D->getBitWidth());
1200
1201 if (!D->getDeclName() || D->isPlaceholderVar(Writer.getLangOpts()))
1202 Record.AddDeclRef(
1203 Record.getASTContext().getInstantiatedFromUnnamedFieldDecl(D));
1204
1205 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1206 !D->hasAttrs() &&
1207 !D->isImplicit() &&
1208 !D->isUsed(false) &&
1209 !D->isInvalidDecl() &&
1210 !D->isReferenced() &&
1212 !D->isModulePrivate() &&
1213 !D->getBitWidth() &&
1214 !D->hasInClassInitializer() &&
1215 !D->hasCapturedVLAType() &&
1216 !D->hasExtInfo() &&
1219 D->getDeclName())
1220 AbbrevToUse = Writer.getDeclFieldAbbrev();
1221
1223}
1224
1227 Record.AddIdentifierRef(D->getGetterId());
1228 Record.AddIdentifierRef(D->getSetterId());
1230}
1231
1233 VisitValueDecl(D);
1234 MSGuidDecl::Parts Parts = D->getParts();
1235 Record.push_back(Parts.Part1);
1236 Record.push_back(Parts.Part2);
1237 Record.push_back(Parts.Part3);
1238 Record.append(std::begin(Parts.Part4And5), std::end(Parts.Part4And5));
1240}
1241
1248
1254
1256 VisitValueDecl(D);
1257 Record.push_back(D->getChainingSize());
1258
1259 for (const auto *P : D->chain())
1260 Record.AddDeclRef(P);
1262}
1263
1267
1268 // The order matters here. It will be better to put the bit with higher
1269 // probability to be 0 in the end of the bits. See the comments in VisitDecl
1270 // for details.
1271 BitsPacker VarDeclBits;
1272 VarDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()),
1273 /*BitWidth=*/3);
1274
1275 bool ModulesCodegen = shouldVarGenerateHereOnly(D);
1276 VarDeclBits.addBit(ModulesCodegen);
1277
1278 VarDeclBits.addBits(D->getStorageClass(), /*BitWidth=*/3);
1279 VarDeclBits.addBits(D->getTSCSpec(), /*BitWidth=*/2);
1280 VarDeclBits.addBits(D->getInitStyle(), /*BitWidth=*/2);
1281 VarDeclBits.addBit(D->isARCPseudoStrong());
1282
1283 bool HasDeducedType = false;
1284 if (!isa<ParmVarDecl>(D)) {
1286 VarDeclBits.addBit(D->isExceptionVariable());
1287 VarDeclBits.addBit(D->isNRVOVariable());
1288 VarDeclBits.addBit(D->isCXXForRangeDecl());
1289
1290 VarDeclBits.addBit(D->isInline());
1291 VarDeclBits.addBit(D->isInlineSpecified());
1292 VarDeclBits.addBit(D->isConstexpr());
1293 VarDeclBits.addBit(D->isInitCapture());
1294 VarDeclBits.addBit(D->isPreviousDeclInSameBlockScope());
1295
1296 VarDeclBits.addBit(D->isEscapingByref());
1297 HasDeducedType = D->getType()->getContainedDeducedType();
1298 VarDeclBits.addBit(HasDeducedType);
1299
1300 if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
1301 VarDeclBits.addBits(llvm::to_underlying(IPD->getParameterKind()),
1302 /*Width=*/3);
1303 else
1304 VarDeclBits.addBits(0, /*Width=*/3);
1305
1306 VarDeclBits.addBit(D->isObjCForDecl());
1307 VarDeclBits.addBit(D->isCXXForRangeImplicitVar());
1308 }
1309
1310 Record.push_back(VarDeclBits);
1311
1312 if (ModulesCodegen)
1313 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);
1314
1315 if (D->hasAttr<BlocksAttr>()) {
1316 BlockVarCopyInit Init = Record.getASTContext().getBlockVarCopyInit(D);
1317 Record.AddStmt(Init.getCopyExpr());
1318 if (Init.getCopyExpr())
1319 Record.push_back(Init.canThrow());
1320 }
1321
1322 enum {
1323 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1324 };
1325 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1326 Record.push_back(VarTemplate);
1327 Record.AddDeclRef(TemplD);
1328 } else if (MemberSpecializationInfo *SpecInfo
1330 Record.push_back(StaticDataMemberSpecialization);
1331 Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1332 Record.push_back(SpecInfo->getTemplateSpecializationKind());
1333 Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1334 } else {
1335 Record.push_back(VarNotTemplate);
1336 }
1337
1338 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
1342 !D->hasExtInfo() && D->getFirstDecl() == D->getMostRecentDecl() &&
1343 D->getKind() == Decl::Var && !D->isInline() && !D->isConstexpr() &&
1345 !D->hasInitWithSideEffects() && !D->isEscapingByref() &&
1346 !HasDeducedType && D->getStorageDuration() != SD_Static &&
1349 !D->isEscapingByref())
1350 AbbrevToUse = Writer.getDeclVarAbbrev();
1351
1353}
1354
1359
1361 VisitVarDecl(D);
1362
1363 // See the implementation of `ParmVarDecl::getParameterIndex()`, which may
1364 // exceed the size of the normal bitfield. So it may be better to not pack
1365 // these bits.
1366 Record.push_back(D->getFunctionScopeIndex());
1367
1368 BitsPacker ParmVarDeclBits;
1369 ParmVarDeclBits.addBit(D->isObjCMethodParameter());
1370 ParmVarDeclBits.addBits(D->getFunctionScopeDepth(), /*BitsWidth=*/7);
1371 // FIXME: stable encoding
1372 ParmVarDeclBits.addBits(D->getObjCDeclQualifier(), /*BitsWidth=*/7);
1373 ParmVarDeclBits.addBit(D->isKNRPromoted());
1374 ParmVarDeclBits.addBit(D->hasInheritedDefaultArg());
1375 ParmVarDeclBits.addBit(D->hasUninstantiatedDefaultArg());
1376 ParmVarDeclBits.addBit(D->getExplicitObjectParamThisLoc().isValid());
1377 Record.push_back(ParmVarDeclBits);
1378
1380 Record.AddStmt(D->getUninstantiatedDefaultArg());
1382 Record.AddSourceLocation(D->getExplicitObjectParamThisLoc());
1384
1385 // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1386 // we dynamically check for the properties that we optimize for, but don't
1387 // know are true of all PARM_VAR_DECLs.
1388 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
1389 !D->hasExtInfo() && D->getStorageClass() == 0 && !D->isInvalidDecl() &&
1391 D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1392 D->getInit() == nullptr) // No default expr.
1393 AbbrevToUse = Writer.getDeclParmVarAbbrev();
1394
1395 // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1396 // just us assuming it.
1397 assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1399 && "PARM_VAR_DECL can't be demoted definition.");
1400 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1401 assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1402 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1403 assert(!D->isStaticDataMember() &&
1404 "PARM_VAR_DECL can't be static data member");
1405}
1406
1408 // Record the number of bindings first to simplify deserialization.
1409 Record.push_back(D->bindings().size());
1410
1411 VisitVarDecl(D);
1412 for (auto *B : D->bindings())
1413 Record.AddDeclRef(B);
1415}
1416
1418 VisitValueDecl(D);
1419 Record.AddStmt(D->getBinding());
1421}
1422
1424 VisitDecl(D);
1425 Record.AddStmt(D->getAsmStringExpr());
1426 Record.AddSourceLocation(D->getRParenLoc());
1428}
1429
1435
1440
1443 VisitDecl(D);
1444 Record.AddDeclRef(D->getExtendingDecl());
1445 Record.AddStmt(D->getTemporaryExpr());
1446 Record.push_back(static_cast<bool>(D->getValue()));
1447 if (D->getValue())
1448 Record.AddAPValue(*D->getValue());
1449 Record.push_back(D->getManglingNumber());
1451}
1453 VisitDecl(D);
1454 Record.AddStmt(D->getBody());
1455 Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1456 Record.push_back(D->param_size());
1457 for (ParmVarDecl *P : D->parameters())
1458 Record.AddDeclRef(P);
1459 Record.push_back(D->isVariadic());
1460 Record.push_back(D->blockMissingReturnType());
1461 Record.push_back(D->isConversionFromLambda());
1462 Record.push_back(D->doesNotEscape());
1463 Record.push_back(D->canAvoidCopyToHeap());
1464 Record.push_back(D->capturesCXXThis());
1465 Record.push_back(D->getNumCaptures());
1466 for (const auto &capture : D->captures()) {
1467 Record.AddDeclRef(capture.getVariable());
1468
1469 unsigned flags = 0;
1470 if (capture.isByRef()) flags |= 1;
1471 if (capture.isNested()) flags |= 2;
1472 if (capture.hasCopyExpr()) flags |= 4;
1473 Record.push_back(flags);
1474
1475 if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1476 }
1477
1479}
1480
1482 Record.push_back(D->getNumParams());
1483 VisitDecl(D);
1484 for (unsigned I = 0; I < D->getNumParams(); ++I)
1485 Record.AddDeclRef(D->getParam(I));
1486 Record.push_back(D->isNothrow() ? 1 : 0);
1487 Record.AddStmt(D->getBody());
1489}
1490
1492 Record.push_back(CD->getNumParams());
1493 VisitDecl(CD);
1494 Record.push_back(CD->getContextParamPosition());
1495 Record.push_back(CD->isNothrow() ? 1 : 0);
1496 // Body is stored by VisitCapturedStmt.
1497 for (unsigned I = 0; I < CD->getNumParams(); ++I)
1498 Record.AddDeclRef(CD->getParam(I));
1500}
1501
1503 static_assert(DeclContext::NumLinkageSpecDeclBits == 17,
1504 "You need to update the serializer after you change the"
1505 "LinkageSpecDeclBits");
1506
1507 VisitDecl(D);
1508 Record.push_back(llvm::to_underlying(D->getLanguage()));
1509 Record.AddSourceLocation(D->getExternLoc());
1510 Record.AddSourceLocation(D->getRBraceLoc());
1512}
1513
1515 VisitDecl(D);
1516 Record.AddSourceLocation(D->getRBraceLoc());
1518}
1519
1521 VisitNamedDecl(D);
1522 Record.AddSourceLocation(D->getBeginLoc());
1524}
1525
1526
1529 VisitNamedDecl(D);
1530
1531 BitsPacker NamespaceDeclBits;
1532 NamespaceDeclBits.addBit(D->isInline());
1533 NamespaceDeclBits.addBit(D->isNested());
1534 Record.push_back(NamespaceDeclBits);
1535
1536 Record.AddSourceLocation(D->getBeginLoc());
1537 Record.AddSourceLocation(D->getRBraceLoc());
1538
1539 if (D->isFirstDecl())
1540 Record.AddDeclRef(D->getAnonymousNamespace());
1542
1543 if (Writer.hasChain() && D->isAnonymousNamespace() &&
1544 D == D->getMostRecentDecl()) {
1545 // This is a most recent reopening of the anonymous namespace. If its parent
1546 // is in a previous PCH (or is the TU), mark that parent for update, because
1547 // the original namespace always points to the latest re-opening of its
1548 // anonymous namespace.
1549 Decl *Parent = cast<Decl>(
1551 if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1552 Writer.DeclUpdates[Parent].push_back(
1553 ASTWriter::DeclUpdate(DeclUpdateKind::CXXAddedAnonymousNamespace, D));
1554 }
1555 }
1556}
1557
1560 VisitNamedDecl(D);
1561 Record.AddSourceLocation(D->getNamespaceLoc());
1562 Record.AddSourceLocation(D->getTargetNameLoc());
1563 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1564 Record.AddDeclRef(D->getNamespace());
1566}
1567
1569 VisitNamedDecl(D);
1570 Record.AddSourceLocation(D->getUsingLoc());
1571 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1572 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1573 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1574 Record.push_back(D->hasTypename());
1575 Record.AddDeclRef(Record.getASTContext().getInstantiatedFromUsingDecl(D));
1577}
1578
1580 VisitNamedDecl(D);
1581 Record.AddSourceLocation(D->getUsingLoc());
1582 Record.AddSourceLocation(D->getEnumLoc());
1583 Record.AddTypeSourceInfo(D->getEnumType());
1584 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1585 Record.AddDeclRef(Record.getASTContext().getInstantiatedFromUsingEnumDecl(D));
1587}
1588
1590 Record.push_back(D->NumExpansions);
1591 VisitNamedDecl(D);
1592 Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
1593 for (auto *E : D->expansions())
1594 Record.AddDeclRef(E);
1596}
1597
1600 VisitNamedDecl(D);
1601 Record.AddDeclRef(D->getTargetDecl());
1602 Record.push_back(D->getIdentifierNamespace());
1603 Record.AddDeclRef(D->UsingOrNextShadow);
1604 Record.AddDeclRef(
1605 Record.getASTContext().getInstantiatedFromUsingShadowDecl(D));
1606
1607 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1608 D->getFirstDecl() == D->getMostRecentDecl() && !D->hasAttrs() &&
1611 AbbrevToUse = Writer.getDeclUsingShadowAbbrev();
1612
1614}
1615
1619 Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1620 Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1621 Record.push_back(D->IsVirtual);
1623}
1624
1626 VisitNamedDecl(D);
1627 Record.AddSourceLocation(D->getUsingLoc());
1628 Record.AddSourceLocation(D->getNamespaceKeyLocation());
1629 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1630 Record.AddDeclRef(D->getNominatedNamespace());
1631 Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1633}
1634
1636 VisitValueDecl(D);
1637 Record.AddSourceLocation(D->getUsingLoc());
1638 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1639 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1640 Record.AddSourceLocation(D->getEllipsisLoc());
1642}
1643
1646 VisitTypeDecl(D);
1647 Record.AddSourceLocation(D->getTypenameLoc());
1648 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1649 Record.AddSourceLocation(D->getEllipsisLoc());
1651}
1652
1658
1660 VisitRecordDecl(D);
1661
1662 enum {
1663 CXXRecNotTemplate = 0,
1664 CXXRecTemplate,
1665 CXXRecMemberSpecialization,
1666 CXXLambda
1667 };
1668 if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1669 Record.push_back(CXXRecTemplate);
1670 Record.AddDeclRef(TemplD);
1671 } else if (MemberSpecializationInfo *MSInfo
1673 Record.push_back(CXXRecMemberSpecialization);
1674 Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1675 Record.push_back(MSInfo->getTemplateSpecializationKind());
1676 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1677 } else if (D->isLambda()) {
1678 // For a lambda, we need some information early for merging.
1679 Record.push_back(CXXLambda);
1680 if (auto *Context = D->getLambdaContextDecl()) {
1681 Record.AddDeclRef(Context);
1682 Record.push_back(D->getLambdaIndexInContext());
1683 } else {
1684 Record.push_back(0);
1685 }
1686 // For lambdas inside template functions, remember the mapping to
1687 // deserialize them together.
1688 if (auto *FD = llvm::dyn_cast_or_null<FunctionDecl>(D->getDeclContext());
1689 FD && isDefinitionInDependentContext(FD)) {
1690 Writer.RelatedDeclsMap[Writer.GetDeclRef(FD)].push_back(
1691 Writer.GetDeclRef(D->getLambdaCallOperator()));
1692 }
1693 } else {
1694 Record.push_back(CXXRecNotTemplate);
1695 }
1696
1697 Record.push_back(D->isThisDeclarationADefinition());
1699 Record.AddCXXDefinitionData(D);
1700
1701 if (D->isCompleteDefinition() && D->isInNamedModule())
1702 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);
1703
1704 // Store (what we currently believe to be) the key function to avoid
1705 // deserializing every method so we can compute it.
1706 //
1707 // FIXME: Avoid adding the key function if the class is defined in
1708 // module purview since in that case the key function is meaningless.
1709 if (D->isCompleteDefinition())
1710 Record.AddDeclRef(Record.getASTContext().getCurrentKeyFunction(D));
1711
1713}
1714
1717 if (D->isCanonicalDecl()) {
1718 Record.push_back(D->size_overridden_methods());
1719 for (const CXXMethodDecl *MD : D->overridden_methods())
1720 Record.AddDeclRef(MD);
1721 } else {
1722 // We only need to record overridden methods once for the canonical decl.
1723 Record.push_back(0);
1724 }
1725
1726 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1727 D->getFirstDecl() == D->getMostRecentDecl() && !D->isInvalidDecl() &&
1728 !D->hasAttrs() && !D->isTopLevelDeclInObjCContainer() &&
1730 !D->hasExtInfo() && !D->isExplicitlyDefaulted()) {
1735 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1736 else if (D->getTemplatedKind() ==
1740
1741 if (FTSInfo->TemplateArguments->size() == 1) {
1742 const TemplateArgument &TA = FTSInfo->TemplateArguments->get(0);
1743 if (TA.getKind() == TemplateArgument::Type &&
1744 !FTSInfo->TemplateArgumentsAsWritten &&
1745 !FTSInfo->getMemberSpecializationInfo())
1746 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1747 }
1748 } else if (D->getTemplatedKind() ==
1752 if (!DFTSInfo->TemplateArgumentsAsWritten)
1753 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1754 }
1755 }
1756
1758}
1759
1761 static_assert(DeclContext::NumCXXConstructorDeclBits == 64,
1762 "You need to update the serializer after you change the "
1763 "CXXConstructorDeclBits");
1764
1765 Record.push_back(D->getTrailingAllocKind());
1766 addExplicitSpecifier(D->getExplicitSpecifierInternal(), Record);
1767 if (auto Inherited = D->getInheritedConstructor()) {
1768 Record.AddDeclRef(Inherited.getShadowDecl());
1769 Record.AddDeclRef(Inherited.getConstructor());
1770 }
1771
1774}
1775
1778
1779 Record.AddDeclRef(D->getOperatorDelete());
1780 if (D->getOperatorDelete())
1781 Record.AddStmt(D->getOperatorDeleteThisArg());
1782 Record.AddDeclRef(D->getOperatorGlobalDelete());
1783 Record.AddDeclRef(D->getArrayOperatorDelete());
1784 Record.AddDeclRef(D->getGlobalArrayOperatorDelete());
1785
1787}
1788
1794
1796 VisitDecl(D);
1797 Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1798 ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1799 Record.push_back(!IdentifierLocs.empty());
1800 if (IdentifierLocs.empty()) {
1801 Record.AddSourceLocation(D->getEndLoc());
1802 Record.push_back(1);
1803 } else {
1804 for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1805 Record.AddSourceLocation(IdentifierLocs[I]);
1806 Record.push_back(IdentifierLocs.size());
1807 }
1808 // Note: the number of source locations must always be the last element in
1809 // the record.
1811}
1812
1814 VisitDecl(D);
1815 Record.AddSourceLocation(D->getColonLoc());
1817}
1818
1820 // Record the number of friend type template parameter lists here
1821 // so as to simplify memory allocation during deserialization.
1822 Record.push_back(D->NumTPLists);
1823 VisitDecl(D);
1824 bool hasFriendDecl = isa<NamedDecl *>(D->Friend);
1825 Record.push_back(hasFriendDecl);
1826 if (hasFriendDecl)
1827 Record.AddDeclRef(D->getFriendDecl());
1828 else
1829 Record.AddTypeSourceInfo(D->getFriendType());
1830 for (unsigned i = 0; i < D->NumTPLists; ++i)
1831 Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1832 Record.AddDeclRef(D->getNextFriend());
1833 Record.push_back(D->UnsupportedFriend);
1834 Record.AddSourceLocation(D->FriendLoc);
1835 Record.AddSourceLocation(D->EllipsisLoc);
1837}
1838
1840 VisitDecl(D);
1841 Record.push_back(D->getNumTemplateParameters());
1842 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1843 Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1844 Record.push_back(D->getFriendDecl() != nullptr);
1845 if (D->getFriendDecl())
1846 Record.AddDeclRef(D->getFriendDecl());
1847 else
1848 Record.AddTypeSourceInfo(D->getFriendType());
1849 Record.AddSourceLocation(D->getFriendLoc());
1851}
1852
1854 VisitNamedDecl(D);
1855
1856 Record.AddTemplateParameterList(D->getTemplateParameters());
1857 Record.AddDeclRef(D->getTemplatedDecl());
1858}
1859
1865
1868 Record.push_back(D->getTemplateArguments().size());
1869 VisitDecl(D);
1870 for (const TemplateArgument &Arg : D->getTemplateArguments())
1871 Record.AddTemplateArgument(Arg);
1873}
1874
1878
1881
1882 // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1883 // getCommonPtr() can be used while this is still initializing.
1884 if (D->isFirstDecl()) {
1885 // This declaration owns the 'common' pointer, so serialize that data now.
1886 Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());
1888 Record.push_back(D->isMemberSpecialization());
1889 }
1890
1892 Record.push_back(D->getIdentifierNamespace());
1893}
1894
1897
1898 if (D->isFirstDecl())
1900
1901 // Force emitting the corresponding deduction guide in reduced BMI mode.
1902 // Otherwise, the deduction guide may be optimized out incorrectly.
1903 if (Writer.isGeneratingReducedBMI()) {
1904 auto Name =
1905 Record.getASTContext().DeclarationNames.getCXXDeductionGuideName(D);
1906 for (auto *DG : D->getDeclContext()->noload_lookup(Name))
1907 Writer.GetDeclRef(DG->getCanonicalDecl());
1908 }
1909
1911}
1912
1916
1918
1919 llvm::PointerUnion<ClassTemplateDecl *,
1922 if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1923 Record.AddDeclRef(InstFromD);
1924 } else {
1925 Record.AddDeclRef(cast<ClassTemplatePartialSpecializationDecl *>(InstFrom));
1926 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1927 }
1928
1929 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1930 Record.AddSourceLocation(D->getPointOfInstantiation());
1931 Record.push_back(D->getSpecializationKind());
1932 Record.push_back(D->hasStrictPackMatch());
1933 Record.push_back(D->isCanonicalDecl());
1934
1935 if (D->isCanonicalDecl()) {
1936 // When reading, we'll add it to the folding set of the following template.
1937 Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1938 }
1939
1944 Record.push_back(ExplicitInstantiation);
1946 Record.AddSourceLocation(D->getExternKeywordLoc());
1947 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1948 }
1949
1950 const ASTTemplateArgumentListInfo *ArgsWritten =
1952 Record.push_back(!!ArgsWritten);
1953 if (ArgsWritten)
1954 Record.AddASTTemplateArgumentListInfo(ArgsWritten);
1955
1956 // Mention the implicitly generated C++ deduction guide to make sure the
1957 // deduction guide will be rewritten as expected.
1958 //
1959 // FIXME: Would it be more efficient to add a callback register function
1960 // in sema to register the deduction guide?
1961 if (Writer.isWritingStdCXXNamedModules()) {
1962 auto Name =
1963 Record.getASTContext().DeclarationNames.getCXXDeductionGuideName(
1965 for (auto *DG : D->getDeclContext()->noload_lookup(Name))
1966 Writer.GetDeclRef(DG->getCanonicalDecl());
1967 }
1968
1970}
1971
1974 Record.AddTemplateParameterList(D->getTemplateParameters());
1975
1977
1978 // These are read/set from/to the first declaration.
1979 if (D->getPreviousDecl() == nullptr) {
1980 Record.AddDeclRef(D->getInstantiatedFromMember());
1981 Record.push_back(D->isMemberSpecialization());
1982 }
1983
1985}
1986
1994
1998
1999 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
2000 InstFrom = D->getSpecializedTemplateOrPartial();
2001 if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
2002 Record.AddDeclRef(InstFromD);
2003 } else {
2004 Record.AddDeclRef(cast<VarTemplatePartialSpecializationDecl *>(InstFrom));
2005 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
2006 }
2007
2012 Record.push_back(ExplicitInstantiation);
2014 Record.AddSourceLocation(D->getExternKeywordLoc());
2015 Record.AddSourceLocation(D->getTemplateKeywordLoc());
2016 }
2017
2018 const ASTTemplateArgumentListInfo *ArgsWritten =
2020 Record.push_back(!!ArgsWritten);
2021 if (ArgsWritten)
2022 Record.AddASTTemplateArgumentListInfo(ArgsWritten);
2023
2024 Record.AddTemplateArgumentList(&D->getTemplateArgs());
2025 Record.AddSourceLocation(D->getPointOfInstantiation());
2026 Record.push_back(D->getSpecializationKind());
2027 Record.push_back(D->IsCompleteDefinition);
2028
2029 VisitVarDecl(D);
2030
2031 Record.push_back(D->isCanonicalDecl());
2032
2033 if (D->isCanonicalDecl()) {
2034 // When reading, we'll add it to the folding set of the following template.
2035 Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
2036 }
2037
2039}
2040
2043 Record.AddTemplateParameterList(D->getTemplateParameters());
2044
2046
2047 // These are read/set from/to the first declaration.
2048 if (D->getPreviousDecl() == nullptr) {
2049 Record.AddDeclRef(D->getInstantiatedFromMember());
2050 Record.push_back(D->isMemberSpecialization());
2051 }
2052
2054}
2055
2063
2065 Record.push_back(D->hasTypeConstraint());
2066 VisitTypeDecl(D);
2067
2068 Record.push_back(D->wasDeclaredWithTypename());
2069
2070 const TypeConstraint *TC = D->getTypeConstraint();
2071 if (D->hasTypeConstraint())
2072 Record.push_back(/*TypeConstraintInitialized=*/TC != nullptr);
2073 if (TC) {
2074 auto *CR = TC->getConceptReference();
2075 Record.push_back(CR != nullptr);
2076 if (CR)
2077 Record.AddConceptReference(CR);
2078 Record.AddStmt(TC->getImmediatelyDeclaredConstraint());
2079 Record.writeUnsignedOrNone(TC->getArgPackSubstIndex());
2080 Record.writeUnsignedOrNone(D->getNumExpansionParameters());
2081 }
2082
2083 bool OwnsDefaultArg = D->hasDefaultArgument() &&
2085 Record.push_back(OwnsDefaultArg);
2086 if (OwnsDefaultArg)
2087 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
2088
2089 if (!D->hasTypeConstraint() && !OwnsDefaultArg &&
2091 !D->isInvalidDecl() && !D->hasAttrs() &&
2094 AbbrevToUse = Writer.getDeclTemplateTypeParmAbbrev();
2095
2097}
2098
2100 // For an expanded parameter pack, record the number of expansion types here
2101 // so that it's easier for deserialization to allocate the right amount of
2102 // memory.
2103 Record.push_back(D->hasPlaceholderTypeConstraint());
2104 if (D->isExpandedParameterPack())
2105 Record.push_back(D->getNumExpansionTypes());
2106
2108 // TemplateParmPosition.
2109 Record.push_back(D->getDepth());
2110 Record.push_back(D->getPosition());
2111
2113 Record.AddStmt(D->getPlaceholderTypeConstraint());
2114
2115 if (D->isExpandedParameterPack()) {
2116 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
2117 Record.AddTypeRef(D->getExpansionType(I));
2118 Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
2119 }
2120
2122 } else {
2123 // Rest of NonTypeTemplateParmDecl.
2124 Record.push_back(D->isParameterPack());
2125 bool OwnsDefaultArg = D->hasDefaultArgument() &&
2127 Record.push_back(OwnsDefaultArg);
2128 if (OwnsDefaultArg)
2129 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
2131 }
2132}
2133
2135 // For an expanded parameter pack, record the number of expansion types here
2136 // so that it's easier for deserialization to allocate the right amount of
2137 // memory.
2138 if (D->isExpandedParameterPack())
2139 Record.push_back(D->getNumExpansionTemplateParameters());
2140
2142 Record.push_back(D->templateParameterKind());
2143 Record.push_back(D->wasDeclaredWithTypename());
2144 // TemplateParmPosition.
2145 Record.push_back(D->getDepth());
2146 Record.push_back(D->getPosition());
2147
2148 if (D->isExpandedParameterPack()) {
2149 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
2150 I != N; ++I)
2151 Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
2153 } else {
2154 // Rest of TemplateTemplateParmDecl.
2155 Record.push_back(D->isParameterPack());
2156 bool OwnsDefaultArg = D->hasDefaultArgument() &&
2158 Record.push_back(OwnsDefaultArg);
2159 if (OwnsDefaultArg)
2160 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
2162 }
2163}
2164
2169
2171 VisitDecl(D);
2172 Record.AddStmt(D->getAssertExpr());
2173 Record.push_back(D->isFailed());
2174 Record.AddStmt(D->getMessage());
2175 Record.AddSourceLocation(D->getRParenLoc());
2177}
2178
2179/// Emit the DeclContext part of a declaration context decl.
2181 static_assert(DeclContext::NumDeclContextBits == 13,
2182 "You need to update the serializer after you change the "
2183 "DeclContextBits");
2184 LookupBlockOffsets Offsets;
2185
2186 if (Writer.isGeneratingReducedBMI() && isa<NamespaceDecl>(DC) &&
2187 cast<NamespaceDecl>(DC)->isFromExplicitGlobalModule()) {
2188 // In reduced BMI, delay writing lexical and visible block for namespace
2189 // in the global module fragment. See the comments of DelayedNamespace for
2190 // details.
2191 Writer.DelayedNamespace.push_back(cast<NamespaceDecl>(DC));
2192 } else {
2193 Offsets.LexicalOffset =
2194 Writer.WriteDeclContextLexicalBlock(Record.getASTContext(), DC);
2195 Writer.WriteDeclContextVisibleBlock(Record.getASTContext(), DC, Offsets);
2196 }
2197
2198 Record.AddLookupOffsets(Offsets);
2199}
2200
2202 assert(IsLocalDecl(D) && "expected a local declaration");
2203
2204 const Decl *Canon = D->getCanonicalDecl();
2205 if (IsLocalDecl(Canon))
2206 return Canon;
2207
2208 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
2209 if (CacheEntry)
2210 return CacheEntry;
2211
2212 for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
2213 if (IsLocalDecl(Redecl))
2214 D = Redecl;
2215 return CacheEntry = D;
2216}
2217
2218template <typename T>
2220 T *First = D->getFirstDecl();
2221 T *MostRecent = First->getMostRecentDecl();
2222 T *DAsT = static_cast<T *>(D);
2223 if (MostRecent != First) {
2224 assert(isRedeclarableDeclKind(DAsT->getKind()) &&
2225 "Not considered redeclarable?");
2226
2227 Record.AddDeclRef(First);
2228
2229 // Write out a list of local redeclarations of this declaration if it's the
2230 // first local declaration in the chain.
2231 const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
2232 if (DAsT == FirstLocal) {
2233 // Emit a list of all imported first declarations so that we can be sure
2234 // that all redeclarations visible to this module are before D in the
2235 // redecl chain.
2236 unsigned I = Record.size();
2237 Record.push_back(0);
2238 if (Writer.Chain)
2239 AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
2240 // This is the number of imported first declarations + 1.
2241 Record[I] = Record.size() - I;
2242
2243 // Collect the set of local redeclarations of this declaration, from
2244 // newest to oldest.
2245 ASTWriter::RecordData LocalRedecls;
2246 ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
2247 for (const Decl *Prev = FirstLocal->getMostRecentDecl();
2248 Prev != FirstLocal; Prev = Prev->getPreviousDecl())
2249 if (!Prev->isFromASTFile())
2250 LocalRedeclWriter.AddDeclRef(Prev);
2251
2252 // If we have any redecls, write them now as a separate record preceding
2253 // the declaration itself.
2254 if (LocalRedecls.empty())
2255 Record.push_back(0);
2256 else
2257 Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
2258 } else {
2259 Record.push_back(0);
2260 Record.AddDeclRef(FirstLocal);
2261 }
2262
2263 // Make sure that we serialize both the previous and the most-recent
2264 // declarations, which (transitively) ensures that all declarations in the
2265 // chain get serialized.
2266 //
2267 // FIXME: This is not correct; when we reach an imported declaration we
2268 // won't emit its previous declaration.
2269 (void)Writer.GetDeclRef(D->getPreviousDecl());
2270 (void)Writer.GetDeclRef(MostRecent);
2271 } else {
2272 // We use the sentinel value 0 to indicate an only declaration.
2273 Record.push_back(0);
2274 }
2275}
2276
2278 VisitNamedDecl(D);
2280 Record.push_back(D->isCBuffer());
2281 Record.AddSourceLocation(D->getLocStart());
2282 Record.AddSourceLocation(D->getLBraceLoc());
2283 Record.AddSourceLocation(D->getRBraceLoc());
2284
2286}
2287
2289 Record.writeOMPChildren(D->Data);
2290 VisitDecl(D);
2292}
2293
2295 Record.writeOMPChildren(D->Data);
2296 VisitDecl(D);
2298}
2299
2301 Record.writeOMPChildren(D->Data);
2302 VisitDecl(D);
2304}
2305
2308 "You need to update the serializer after you change the "
2309 "NumOMPDeclareReductionDeclBits");
2310
2311 VisitValueDecl(D);
2312 Record.AddSourceLocation(D->getBeginLoc());
2313 Record.AddStmt(D->getCombinerIn());
2314 Record.AddStmt(D->getCombinerOut());
2315 Record.AddStmt(D->getCombiner());
2316 Record.AddStmt(D->getInitOrig());
2317 Record.AddStmt(D->getInitPriv());
2318 Record.AddStmt(D->getInitializer());
2319 Record.push_back(llvm::to_underlying(D->getInitializerKind()));
2320 Record.AddDeclRef(D->getPrevDeclInScope());
2322}
2323
2325 Record.writeOMPChildren(D->Data);
2326 VisitValueDecl(D);
2327 Record.AddDeclarationName(D->getVarName());
2328 Record.AddDeclRef(D->getPrevDeclInScope());
2330}
2331
2336
2338 Record.writeUInt32(D->clauses().size());
2339 VisitDecl(D);
2340 Record.writeEnum(D->DirKind);
2341 Record.AddSourceLocation(D->DirectiveLoc);
2342 Record.AddSourceLocation(D->EndLoc);
2343 Record.writeOpenACCClauseList(D->clauses());
2345}
2347 Record.writeUInt32(D->clauses().size());
2348 VisitDecl(D);
2349 Record.writeEnum(D->DirKind);
2350 Record.AddSourceLocation(D->DirectiveLoc);
2351 Record.AddSourceLocation(D->EndLoc);
2352 Record.AddSourceRange(D->ParensLoc);
2353 Record.AddStmt(D->FuncRef);
2354 Record.writeOpenACCClauseList(D->clauses());
2356}
2357
2358//===----------------------------------------------------------------------===//
2359// ASTWriter Implementation
2360//===----------------------------------------------------------------------===//
2361
2362namespace {
2363template <FunctionDecl::TemplatedKind Kind>
2364std::shared_ptr<llvm::BitCodeAbbrev>
2365getFunctionDeclAbbrev(serialization::DeclCode Code) {
2366 using namespace llvm;
2367
2368 auto Abv = std::make_shared<BitCodeAbbrev>();
2369 Abv->Add(BitCodeAbbrevOp(Code));
2370 // RedeclarableDecl
2371 Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2372 Abv->Add(BitCodeAbbrevOp(Kind));
2373 if constexpr (Kind == FunctionDecl::TK_NonTemplate) {
2374
2375 } else if constexpr (Kind == FunctionDecl::TK_FunctionTemplate) {
2376 // DescribedFunctionTemplate
2377 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2378 } else if constexpr (Kind == FunctionDecl::TK_DependentNonTemplate) {
2379 // Instantiated From Decl
2380 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2381 } else if constexpr (Kind == FunctionDecl::TK_MemberSpecialization) {
2382 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedFrom
2383 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2384 3)); // TemplateSpecializationKind
2385 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Specialized Location
2386 } else if constexpr (Kind ==
2388 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template
2389 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2390 3)); // TemplateSpecializationKind
2391 Abv->Add(BitCodeAbbrevOp(1)); // Template Argument Size
2392 Abv->Add(BitCodeAbbrevOp(TemplateArgument::Type)); // Template Argument Kind
2393 Abv->Add(
2394 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template Argument Type
2395 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Is Defaulted
2396 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2397 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2398 Abv->Add(BitCodeAbbrevOp(0));
2399 Abv->Add(
2400 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Canonical Decl of template
2401 } else if constexpr (Kind == FunctionDecl::
2402 TK_DependentFunctionTemplateSpecialization) {
2403 // Candidates of specialization
2404 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2405 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2406 } else {
2407 llvm_unreachable("Unknown templated kind?");
2408 }
2409 // Decl
2410 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2411 8)); // Packed DeclBits: ModuleOwnershipKind,
2412 // isUsed, isReferenced, AccessSpecifier,
2413 // isImplicit
2414 //
2415 // The following bits should be 0:
2416 // HasStandaloneLexicalDC, HasAttrs,
2417 // TopLevelDeclInObjCContainer,
2418 // isInvalidDecl
2419 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2420 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2421 // NamedDecl
2422 Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2423 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2424 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2425 // ValueDecl
2426 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2427 // DeclaratorDecl
2428 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2429 Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2430 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2431 // FunctionDecl
2432 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2433 Abv->Add(BitCodeAbbrevOp(
2434 BitCodeAbbrevOp::Fixed,
2435 28)); // Packed Function Bits: StorageClass, Inline, InlineSpecified,
2436 // VirtualAsWritten, Pure, HasInheritedProto, HasWrittenProto,
2437 // Deleted, Trivial, TrivialForCall, Defaulted, ExplicitlyDefaulted,
2438 // IsIneligibleOrNotSelected, ImplicitReturnZero, Constexpr,
2439 // UsesSEHTry, SkippedBody, MultiVersion, LateParsed,
2440 // FriendConstraintRefersToEnclosingTemplate, Linkage,
2441 // ShouldSkipCheckingODR
2442 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2443 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2444 // This Array slurps the rest of the record. Fortunately we want to encode
2445 // (nearly) all the remaining (variable number of) fields in the same way.
2446 //
2447 // This is:
2448 // NumParams and Params[] from FunctionDecl, and
2449 // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2450 //
2451 // Add an AbbrevOp for 'size then elements' and use it here.
2452 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2453 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2454 return Abv;
2455}
2456
2457template <FunctionDecl::TemplatedKind Kind>
2458std::shared_ptr<llvm::BitCodeAbbrev> getCXXMethodAbbrev() {
2459 return getFunctionDeclAbbrev<Kind>(serialization::DECL_CXX_METHOD);
2460}
2461} // namespace
2462
2463void ASTWriter::WriteDeclAbbrevs() {
2464 using namespace llvm;
2465
2466 std::shared_ptr<BitCodeAbbrev> Abv;
2467
2468 // Abbreviation for DECL_FIELD
2469 Abv = std::make_shared<BitCodeAbbrev>();
2470 Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
2471 // Decl
2472 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2473 7)); // Packed DeclBits: ModuleOwnershipKind,
2474 // isUsed, isReferenced, AccessSpecifier,
2475 //
2476 // The following bits should be 0:
2477 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2478 // TopLevelDeclInObjCContainer,
2479 // isInvalidDecl
2480 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2481 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2482 // NamedDecl
2483 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2484 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2485 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2486 // ValueDecl
2487 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2488 // DeclaratorDecl
2489 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2490 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2491 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2492 // FieldDecl
2493 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2494 Abv->Add(BitCodeAbbrevOp(0)); // StorageKind
2495 // Type Source Info
2496 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2497 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2498 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
2499
2500 // Abbreviation for DECL_OBJC_IVAR
2501 Abv = std::make_shared<BitCodeAbbrev>();
2502 Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
2503 // Decl
2504 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2505 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2506 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2507 // isReferenced, TopLevelDeclInObjCContainer,
2508 // AccessSpecifier, ModuleOwnershipKind
2509 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2510 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2511 // NamedDecl
2512 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2513 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2514 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2515 // ValueDecl
2516 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2517 // DeclaratorDecl
2518 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2519 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2520 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2521 // FieldDecl
2522 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2523 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2524 // ObjC Ivar
2525 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
2526 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
2527 // Type Source Info
2528 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2529 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2530 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2531
2532 // Abbreviation for DECL_ENUM
2533 Abv = std::make_shared<BitCodeAbbrev>();
2534 Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
2535 // Redeclarable
2536 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2537 // Decl
2538 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2539 7)); // Packed DeclBits: ModuleOwnershipKind,
2540 // isUsed, isReferenced, AccessSpecifier,
2541 //
2542 // The following bits should be 0:
2543 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2544 // TopLevelDeclInObjCContainer,
2545 // isInvalidDecl
2546 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2547 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2548 // NamedDecl
2549 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2550 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2551 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2552 // TypeDecl
2553 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2554 // TagDecl
2555 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2556 Abv->Add(BitCodeAbbrevOp(
2557 BitCodeAbbrevOp::Fixed,
2558 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2559 // EmbeddedInDeclarator, IsFreeStanding,
2560 // isCompleteDefinitionRequired, ExtInfoKind
2561 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2562 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2563 // EnumDecl
2564 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
2565 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
2566 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
2567 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 20)); // Enum Decl Bits
2568 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
2569 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
2570 // DC
2571 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2572 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2573 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ModuleLocalOffset
2574 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TULocalOffset
2575 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2576
2577 // Abbreviation for DECL_RECORD
2578 Abv = std::make_shared<BitCodeAbbrev>();
2579 Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
2580 // Redeclarable
2581 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2582 // Decl
2583 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2584 7)); // Packed DeclBits: ModuleOwnershipKind,
2585 // isUsed, isReferenced, AccessSpecifier,
2586 //
2587 // The following bits should be 0:
2588 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2589 // TopLevelDeclInObjCContainer,
2590 // isInvalidDecl
2591 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2592 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2593 // NamedDecl
2594 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2595 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2596 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2597 // TypeDecl
2598 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2599 // TagDecl
2600 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2601 Abv->Add(BitCodeAbbrevOp(
2602 BitCodeAbbrevOp::Fixed,
2603 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2604 // EmbeddedInDeclarator, IsFreeStanding,
2605 // isCompleteDefinitionRequired, ExtInfoKind
2606 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2607 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2608 // RecordDecl
2609 Abv->Add(BitCodeAbbrevOp(
2610 BitCodeAbbrevOp::Fixed,
2611 14)); // Packed Record Decl Bits: FlexibleArrayMember,
2612 // AnonymousStructUnion, hasObjectMember, hasVolatileMember,
2613 // isNonTrivialToPrimitiveDefaultInitialize,
2614 // isNonTrivialToPrimitiveCopy, isNonTrivialToPrimitiveDestroy,
2615 // hasNonTrivialToPrimitiveDefaultInitializeCUnion,
2616 // hasNonTrivialToPrimitiveDestructCUnion,
2617 // hasNonTrivialToPrimitiveCopyCUnion,
2618 // hasUninitializedExplicitInitFields, isParamDestroyedInCallee,
2619 // getArgPassingRestrictions
2620 // ODRHash
2621 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));
2622
2623 // DC
2624 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2625 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2626 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ModuleLocalOffset
2627 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TULocalOffset
2628 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2629
2630 // Abbreviation for DECL_PARM_VAR
2631 Abv = std::make_shared<BitCodeAbbrev>();
2632 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2633 // Redeclarable
2634 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2635 // Decl
2636 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2637 8)); // Packed DeclBits: ModuleOwnershipKind, isUsed,
2638 // isReferenced, AccessSpecifier,
2639 // HasStandaloneLexicalDC, HasAttrs, isImplicit,
2640 // TopLevelDeclInObjCContainer,
2641 // isInvalidDecl,
2642 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2643 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2644 // NamedDecl
2645 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2646 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2647 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2648 // ValueDecl
2649 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2650 // DeclaratorDecl
2651 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2652 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2653 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2654 // VarDecl
2655 Abv->Add(
2656 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2657 12)); // Packed Var Decl bits: SClass, TSCSpec, InitStyle,
2658 // isARCPseudoStrong, Linkage, ModulesCodegen
2659 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2660 // ParmVarDecl
2661 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2662 Abv->Add(BitCodeAbbrevOp(
2663 BitCodeAbbrevOp::Fixed,
2664 19)); // Packed Parm Var Decl bits: IsObjCMethodParameter, ScopeDepth,
2665 // ObjCDeclQualifier, KNRPromoted,
2666 // HasInheritedDefaultArg, HasUninstantiatedDefaultArg
2667 // Type Source Info
2668 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2669 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2670 DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2671
2672 // Abbreviation for DECL_TYPEDEF
2673 Abv = std::make_shared<BitCodeAbbrev>();
2674 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2675 // Redeclarable
2676 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2677 // Decl
2678 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2679 7)); // Packed DeclBits: ModuleOwnershipKind,
2680 // isReferenced, isUsed, AccessSpecifier. Other
2681 // higher bits should be 0: isImplicit,
2682 // HasStandaloneLexicalDC, HasAttrs,
2683 // TopLevelDeclInObjCContainer, isInvalidDecl
2684 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2685 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2686 // NamedDecl
2687 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2688 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2689 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2690 // TypeDecl
2691 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2692 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2693 // TypedefDecl
2694 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2695 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2696 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2697
2698 // Abbreviation for DECL_VAR
2699 Abv = std::make_shared<BitCodeAbbrev>();
2700 Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2701 // Redeclarable
2702 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2703 // Decl
2704 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2705 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2706 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2707 // isReferenced, TopLevelDeclInObjCContainer,
2708 // AccessSpecifier, ModuleOwnershipKind
2709 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2710 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2711 // NamedDecl
2712 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2713 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2714 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2715 // ValueDecl
2716 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2717 // DeclaratorDecl
2718 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2719 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2720 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2721 // VarDecl
2722 Abv->Add(BitCodeAbbrevOp(
2723 BitCodeAbbrevOp::Fixed,
2724 22)); // Packed Var Decl bits: Linkage, ModulesCodegen,
2725 // SClass, TSCSpec, InitStyle,
2726 // isARCPseudoStrong, IsThisDeclarationADemotedDefinition,
2727 // isExceptionVariable, isNRVOVariable, isCXXForRangeDecl,
2728 // isInline, isInlineSpecified, isConstexpr,
2729 // isInitCapture, isPrevDeclInSameScope, hasInitWithSideEffects,
2730 // EscapingByref, HasDeducedType, ImplicitParamKind, isObjCForDecl
2731 // IsCXXForRangeImplicitVar
2732 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2733 // Type Source Info
2734 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2735 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2736 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2737
2738 // Abbreviation for DECL_CXX_METHOD
2739 DeclCXXMethodAbbrev =
2740 Stream.EmitAbbrev(getCXXMethodAbbrev<FunctionDecl::TK_NonTemplate>());
2741 DeclTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2742 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplate>());
2743 DeclDependentNonTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2744 getCXXMethodAbbrev<FunctionDecl::TK_DependentNonTemplate>());
2745 DeclMemberSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2746 getCXXMethodAbbrev<FunctionDecl::TK_MemberSpecialization>());
2747 DeclTemplateSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2748 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplateSpecialization>());
2749 DeclDependentSpecializationCXXMethodAbbrev = Stream.EmitAbbrev(
2750 getCXXMethodAbbrev<
2752
2753 // Abbreviation for DECL_TEMPLATE_TYPE_PARM
2754 Abv = std::make_shared<BitCodeAbbrev>();
2755 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TEMPLATE_TYPE_PARM));
2756 Abv->Add(BitCodeAbbrevOp(0)); // hasTypeConstraint
2757 // Decl
2758 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2759 7)); // Packed DeclBits: ModuleOwnershipKind,
2760 // isReferenced, isUsed, AccessSpecifier. Other
2761 // higher bits should be 0: isImplicit,
2762 // HasStandaloneLexicalDC, HasAttrs,
2763 // TopLevelDeclInObjCContainer, isInvalidDecl
2764 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2765 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2766 // NamedDecl
2767 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2768 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2769 Abv->Add(BitCodeAbbrevOp(0));
2770 // TypeDecl
2771 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2772 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2773 // TemplateTypeParmDecl
2774 Abv->Add(
2775 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // wasDeclaredWithTypename
2776 Abv->Add(BitCodeAbbrevOp(0)); // OwnsDefaultArg
2777 DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));
2778
2779 // Abbreviation for DECL_USING_SHADOW
2780 Abv = std::make_shared<BitCodeAbbrev>();
2781 Abv->Add(BitCodeAbbrevOp(serialization::DECL_USING_SHADOW));
2782 // Redeclarable
2783 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2784 // Decl
2785 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2786 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2787 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2788 // isReferenced, TopLevelDeclInObjCContainer,
2789 // AccessSpecifier, ModuleOwnershipKind
2790 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2791 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2792 // NamedDecl
2793 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2794 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2795 Abv->Add(BitCodeAbbrevOp(0));
2796 // UsingShadowDecl
2797 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TargetDecl
2798 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2799 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // UsingOrNextShadow
2800 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR,
2801 6)); // InstantiatedFromUsingShadowDecl
2802 DeclUsingShadowAbbrev = Stream.EmitAbbrev(std::move(Abv));
2803
2804 // Abbreviation for EXPR_DECL_REF
2805 Abv = std::make_shared<BitCodeAbbrev>();
2806 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2807 // Stmt
2808 // Expr
2809 // PackingBits: DependenceKind, ValueKind. ObjectKind should be 0.
2810 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
2811 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2812 // DeclRefExpr
2813 // Packing Bits: , HadMultipleCandidates, RefersToEnclosingVariableOrCapture,
2814 // IsImmediateEscalating, NonOdrUseReason.
2815 // GetDeclFound, HasQualifier and ExplicitTemplateArgs should be 0.
2816 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2817 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2818 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2819 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2820
2821 // Abbreviation for EXPR_INTEGER_LITERAL
2822 Abv = std::make_shared<BitCodeAbbrev>();
2823 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2824 //Stmt
2825 // Expr
2826 // DependenceKind, ValueKind, ObjectKind
2827 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2828 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2829 // Integer Literal
2830 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2831 Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2832 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2833 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2834
2835 // Abbreviation for EXPR_CHARACTER_LITERAL
2836 Abv = std::make_shared<BitCodeAbbrev>();
2837 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2838 //Stmt
2839 // Expr
2840 // DependenceKind, ValueKind, ObjectKind
2841 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2842 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2843 // Character Literal
2844 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2845 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2846 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2847 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2848
2849 // Abbreviation for EXPR_IMPLICIT_CAST
2850 Abv = std::make_shared<BitCodeAbbrev>();
2851 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2852 // Stmt
2853 // Expr
2854 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2855 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2856 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2857 // CastExpr
2858 Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2859 // Packing Bits: CastKind, StoredFPFeatures, isPartOfExplicitCast
2860 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 9));
2861 // ImplicitCastExpr
2862 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2863
2864 // Abbreviation for EXPR_BINARY_OPERATOR
2865 Abv = std::make_shared<BitCodeAbbrev>();
2866 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_BINARY_OPERATOR));
2867 // Stmt
2868 // Expr
2869 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2870 // be 0 in this case.
2871 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2872 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2873 // BinaryOperator
2874 Abv->Add(
2875 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2876 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2877 BinaryOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2878
2879 // Abbreviation for EXPR_COMPOUND_ASSIGN_OPERATOR
2880 Abv = std::make_shared<BitCodeAbbrev>();
2881 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_COMPOUND_ASSIGN_OPERATOR));
2882 // Stmt
2883 // Expr
2884 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2885 // be 0 in this case.
2886 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2887 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2888 // BinaryOperator
2889 // Packing Bits: OpCode. The HasFPFeatures bit should be 0
2890 Abv->Add(
2891 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2892 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2893 // CompoundAssignOperator
2894 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHSType
2895 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Result Type
2896 CompoundAssignOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2897
2898 // Abbreviation for EXPR_CALL
2899 Abv = std::make_shared<BitCodeAbbrev>();
2900 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CALL));
2901 // Stmt
2902 // Expr
2903 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2904 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2905 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2906 // CallExpr
2907 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2908 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2909 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2910 CallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2911
2912 // Abbreviation for EXPR_CXX_OPERATOR_CALL
2913 Abv = std::make_shared<BitCodeAbbrev>();
2914 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_OPERATOR_CALL));
2915 // Stmt
2916 // Expr
2917 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2918 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2919 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2920 // CallExpr
2921 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2922 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2923 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2924 // CXXOperatorCallExpr
2925 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Operator Kind
2926 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2927 CXXOperatorCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2928
2929 // Abbreviation for EXPR_CXX_MEMBER_CALL
2930 Abv = std::make_shared<BitCodeAbbrev>();
2931 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_MEMBER_CALL));
2932 // Stmt
2933 // Expr
2934 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2935 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2936 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2937 // CallExpr
2938 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2939 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2940 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2941 // CXXMemberCallExpr
2942 CXXMemberCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2943
2944 // Abbreviation for STMT_COMPOUND
2945 Abv = std::make_shared<BitCodeAbbrev>();
2946 Abv->Add(BitCodeAbbrevOp(serialization::STMT_COMPOUND));
2947 // Stmt
2948 // CompoundStmt
2949 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Num Stmts
2950 Abv->Add(BitCodeAbbrevOp(0)); // hasStoredFPFeatures
2951 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2952 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2953 CompoundStmtAbbrev = Stream.EmitAbbrev(std::move(Abv));
2954
2955 Abv = std::make_shared<BitCodeAbbrev>();
2956 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2957 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2958 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2959
2960 Abv = std::make_shared<BitCodeAbbrev>();
2961 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2962 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2963 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2964
2965 Abv = std::make_shared<BitCodeAbbrev>();
2966 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_MODULE_LOCAL_VISIBLE));
2967 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2968 DeclModuleLocalVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2969
2970 Abv = std::make_shared<BitCodeAbbrev>();
2971 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_TU_LOCAL_VISIBLE));
2972 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2973 DeclTULocalLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2974
2975 Abv = std::make_shared<BitCodeAbbrev>();
2976 Abv->Add(BitCodeAbbrevOp(serialization::DECL_SPECIALIZATIONS));
2977 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2978 DeclSpecializationsAbbrev = Stream.EmitAbbrev(std::move(Abv));
2979
2980 Abv = std::make_shared<BitCodeAbbrev>();
2981 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARTIAL_SPECIALIZATIONS));
2982 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2983 DeclPartialSpecializationsAbbrev = Stream.EmitAbbrev(std::move(Abv));
2984}
2985
2986/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2987/// consumers of the AST.
2988///
2989/// Such decls will always be deserialized from the AST file, so we would like
2990/// this to be as restrictive as possible. Currently the predicate is driven by
2991/// code generation requirements, if other clients have a different notion of
2992/// what is "required" then we may have to consider an alternate scheme where
2993/// clients can iterate over the top-level decls and get information on them,
2994/// without necessary deserializing them. We could explicitly require such
2995/// clients to use a separate API call to "realize" the decl. This should be
2996/// relatively painless since they would presumably only do it for top-level
2997/// decls.
2998static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2999 Module *WritingModule) {
3000 // Named modules have different semantics than header modules. Every named
3001 // module units owns a translation unit. So the importer of named modules
3002 // doesn't need to deserilize everything ahead of time.
3003 if (WritingModule && WritingModule->isNamedModule()) {
3004 // The PragmaCommentDecl and PragmaDetectMismatchDecl are MSVC's extension.
3005 // And the behavior of MSVC for such cases will leak this to the module
3006 // users. Given pragma is not a standard thing, the compiler has the space
3007 // to do their own decision. Let's follow MSVC here.
3009 return true;
3010 return false;
3011 }
3012
3013 // An ObjCMethodDecl is never considered as "required" because its
3014 // implementation container always is.
3015
3016 // File scoped assembly or obj-c or OMP declare target implementation must be
3017 // seen.
3019 return true;
3020
3021 if (WritingModule && isPartOfPerModuleInitializer(D)) {
3022 // These declarations are part of the module initializer, and are emitted
3023 // if and when the module is imported, rather than being emitted eagerly.
3024 return false;
3025 }
3026
3027 return Context.DeclMustBeEmitted(D);
3028}
3029
3030void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
3031 PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
3032 "serializing");
3033
3034 // Determine the ID for this declaration.
3035 LocalDeclID ID;
3036 assert(!D->isFromASTFile() && "should not be emitting imported decl");
3037 LocalDeclID &IDR = DeclIDs[D];
3038 if (IDR.isInvalid())
3039 IDR = NextDeclID++;
3040
3041 ID = IDR;
3042
3043 assert(ID >= FirstDeclID && "invalid decl ID");
3044
3046 ASTDeclWriter W(*this, Context, Record, GeneratingReducedBMI);
3047
3048 // Build a record for this declaration
3049 W.Visit(D);
3050
3051 // Emit this declaration to the bitstream.
3052 uint64_t Offset = W.Emit(D);
3053
3054 // Record the offset for this declaration
3055 SourceLocation Loc = D->getLocation();
3057 getRawSourceLocationEncoding(getAdjustedLocation(Loc));
3058
3059 unsigned Index = ID.getRawValue() - FirstDeclID.getRawValue();
3060 if (DeclOffsets.size() == Index)
3061 DeclOffsets.emplace_back(RawLoc, Offset, DeclTypesBlockStartOffset);
3062 else if (DeclOffsets.size() < Index) {
3063 // FIXME: Can/should this happen?
3064 DeclOffsets.resize(Index+1);
3065 DeclOffsets[Index].setRawLoc(RawLoc);
3066 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);
3067 } else {
3068 llvm_unreachable("declarations should be emitted in ID order");
3069 }
3070
3071 SourceManager &SM = Context.getSourceManager();
3072 if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
3073 associateDeclWithFile(D, ID);
3074
3075 // Note declarations that should be deserialized eagerly so that we can add
3076 // them to a record in the AST file later.
3077 if (isRequiredDecl(D, Context, WritingModule))
3078 AddDeclRef(D, EagerlyDeserializedDecls);
3079}
3080
3082 // Switch case IDs are per function body.
3083 Writer->ClearSwitchCaseIDs();
3084
3085 assert(FD->doesThisDeclarationHaveABody());
3086 bool ModulesCodegen = shouldFunctionGenerateHereOnly(FD);
3087 Record->push_back(ModulesCodegen);
3088 if (ModulesCodegen)
3089 Writer->AddDeclRef(FD, Writer->ModularCodegenDecls);
3090 if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
3091 Record->push_back(CD->getNumCtorInitializers());
3092 if (CD->getNumCtorInitializers())
3093 AddCXXCtorInitializers(llvm::ArrayRef(CD->init_begin(), CD->init_end()));
3094 }
3095 AddStmt(FD->getBody());
3096}
static void addExplicitSpecifier(ExplicitSpecifier ES, ASTRecordWriter &Record)
static bool shouldVarGenerateHereOnly(const VarDecl *VD)
static bool shouldFunctionGenerateHereOnly(const FunctionDecl *FD)
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
Definition MachO.h:31
#define SM(sm)
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 ...
Definition ASTContext.h:226
SourceManager & getSourceManager()
Definition ASTContext.h:859
const LangOptions & getLangOpts() const
Definition ASTContext.h:952
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
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)
RedeclarableTemplateDecl::SpecEntryTraits< EntryType >::DeclType * getSpecializationDecl(EntryType &T)
Get the specialization decl from an entry in the specialization list.
void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D)
void VisitOpenACCDeclareDecl(OpenACCDeclareDecl *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)
bool shouldSkipWritingSpecializations(T *Spec)
void VisitFriendTemplateDecl(FriendTemplateDecl *D)
void VisitObjCMethodDecl(ObjCMethodDecl *D)
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
uint64_t Emit(Decl *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 VisitOpenACCRoutineDecl(OpenACCRoutineDecl *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)
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.
Definition ASTWriter.h:97
bool IsLocalDecl(const Decl *D) const
Is this a local declaration (that is, one that will be written to our AST file)?
Definition ASTWriter.h:785
SmallVectorImpl< uint64_t > RecordDataImpl
Definition ASTWriter.h:103
SourceLocationEncoding::RawLocEncoding getRawSourceLocationEncoding(SourceLocation Loc)
Return the raw encodings for source locations.
friend class ASTDeclWriter
Definition ASTWriter.h:99
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
SmallVector< uint64_t, 64 > RecordData
Definition ASTWriter.h:102
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
Represents an access specifier followed by colon ':'.
Definition DeclCXX.h:86
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
Definition DeclCXX.h:108
A binding in a decomposition declaration.
Definition DeclCXX.h:4201
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition DeclCXX.h:4227
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition ASTWriter.h:1086
void addBit(bool Value)
Definition ASTWriter.h:1106
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition ASTWriter.h:1107
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition Decl.h:4689
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition Decl.h:4812
bool canAvoidCopyToHeap() const
Definition Decl.h:4843
size_t param_size() const
Definition Decl.h:4791
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition Decl.h:4768
ArrayRef< Capture > captures() const
Definition Decl.h:4816
bool blockMissingReturnType() const
Definition Decl.h:4824
bool capturesCXXThis() const
Definition Decl.h:4821
bool doesNotEscape() const
Definition Decl.h:4840
bool isConversionFromLambda() const
Definition Decl.h:4832
ArrayRef< ParmVarDecl * > parameters() const
Definition Decl.h:4775
bool isVariadic() const
Definition Decl.h:4764
TypeSourceInfo * getSignatureAsWritten() const
Definition Decl.h:4772
Represents a C++ constructor within a class.
Definition DeclCXX.h:2624
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition DeclCXX.h:2862
Represents a C++ conversion function within a class.
Definition DeclCXX.h:2959
ExplicitSpecifier getExplicitSpecifier()
Definition DeclCXX.h:2986
Represents a C++ deduction guide declaration.
Definition DeclCXX.h:1986
const CXXDeductionGuideDecl * getSourceDeductionGuide() const
Get the deduction guide from which this deduction guide was generated, if it was generated as part of...
Definition DeclCXX.h:2062
ExplicitSpecifier getExplicitSpecifier()
Definition DeclCXX.h:2044
DeductionCandidate getDeductionCandidateKind() const
Definition DeclCXX.h:2082
SourceDeductionGuideKind getSourceDeductionGuideKind() const
Definition DeclCXX.h:2070
Represents a C++ destructor within a class.
Definition DeclCXX.h:2889
const FunctionDecl * getOperatorGlobalDelete() const
Definition DeclCXX.cpp:3227
const FunctionDecl * getGlobalArrayOperatorDelete() const
Definition DeclCXX.cpp:3237
const FunctionDecl * getOperatorDelete() const
Definition DeclCXX.cpp:3222
Expr * getOperatorDeleteThisArg() const
Definition DeclCXX.h:2928
const FunctionDecl * getArrayOperatorDelete() const
Definition DeclCXX.cpp:3232
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:2136
CXXMethodDecl * getMostRecentDecl()
Definition DeclCXX.h:2252
overridden_method_range overridden_methods() const
Definition DeclCXX.cpp:2830
unsigned size_overridden_methods() const
Definition DeclCXX.cpp:2824
Represents a C++ struct/union/class.
Definition DeclCXX.h:258
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
Definition DeclCXX.cpp:1834
unsigned getLambdaIndexInContext() const
Retrieve the index of this lambda within the context declaration returned by getLambdaContextDecl().
Definition DeclCXX.h:1799
bool isLambda() const
Determine whether this class describes a lambda function object.
Definition DeclCXX.h:1018
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
Definition DeclCXX.cpp:2060
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition DeclCXX.cpp:2052
static bool classofKind(Kind K)
Definition DeclCXX.h:1923
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Definition DeclCXX.cpp:2037
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
Definition DeclCXX.cpp:1742
CXXRecordDecl * getPreviousDecl()
Definition DeclCXX.h:530
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition Decl.h:4961
unsigned getNumParams() const
Definition Decl.h:4999
unsigned getContextParamPosition() const
Definition Decl.h:5028
bool isNothrow() const
Definition Decl.cpp:5703
ImplicitParamDecl * getParam(unsigned i) const
Definition Decl.h:5001
Declaration of a class template.
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
bool isMemberSpecialization() const
Determines whether this class template partial specialization template was a specialization of a memb...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a class template specialization, which refers to a class template with a given set of temp...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
SourceLocation getExternKeywordLoc() const
Gets the location of the extern keyword, if present.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition DeclCXX.h:3693
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...
Definition DeclBase.h:1462
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition DeclBase.h:2122
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
Definition DeclBase.h:2138
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
bool isInvalid() const
Definition DeclID.h:123
A simple visitor class that helps create declaration visitors.
Definition DeclVisitor.h:68
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:86
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
Definition DeclBase.h:1074
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition DeclBase.h:1089
SourceLocation getEndLoc() const LLVM_READONLY
Definition DeclBase.h:443
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
Definition DeclBase.h:1239
bool hasAttrs() const
Definition DeclBase.h:526
ASTContext & getASTContext() const LLVM_READONLY
Definition DeclBase.cpp:547
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition DeclBase.h:601
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).
Definition Decl.cpp:99
ModuleOwnershipKind getModuleOwnershipKind() const
Get the kind of module ownership for this declaration.
Definition DeclBase.h:889
bool isReferenced() const
Whether any declaration of this entity was referenced.
Definition DeclBase.cpp:601
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition DeclBase.h:997
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition DeclBase.h:850
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition DeclBase.h:801
bool isInvalidDecl() const
Definition DeclBase.h:596
unsigned getIdentifierNamespace() const
Definition DeclBase.h:902
SourceLocation getLocation() const
Definition DeclBase.h:447
const char * getDeclKindName() const
Definition DeclBase.cpp:169
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Definition DeclBase.h:629
bool isTopLevelDeclInObjCContainer() const
Whether this declaration is a top-level declaration (function, global variable, etc....
Definition DeclBase.h:642
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
Definition DeclBase.cpp:576
DeclContext * getDeclContext()
Definition DeclBase.h:456
AccessSpecifier getAccess() const
Definition DeclBase.h:515
SourceLocation getBeginLoc() const LLVM_READONLY
Definition DeclBase.h:439
AttrVec & getAttrs()
Definition DeclBase.h:532
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition DeclBase.h:931
bool hasAttr() const
Definition DeclBase.h:585
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition DeclBase.h:991
Kind getKind() const
Definition DeclBase.h:450
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
Definition Decl.h:780
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
Definition Decl.h:822
TypeSourceInfo * getTypeSourceInfo() const
Definition Decl.h:809
A decomposition declaration.
Definition DeclCXX.h:4265
ArrayRef< BindingDecl * > bindings() const
Definition DeclCXX.h:4303
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.
Definition Decl.h:5196
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3438
llvm::APSInt getInitVal() const
Definition Decl.h:3458
const Expr * getInitExpr() const
Definition Decl.h:3456
Represents an enum.
Definition Decl.h:4028
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
Definition Decl.h:4300
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition Decl.h:4246
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition Decl.h:4238
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition Decl.h:4249
unsigned getODRHash()
Definition Decl.cpp:5169
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
Definition Decl.h:4217
EnumDecl * getMostRecentDecl()
Definition Decl.h:4133
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition Decl.h:4255
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition Decl.h:4201
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum.
Definition Decl.h:4227
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition Decl.h:4193
Store information needed for an explicit specifier.
Definition DeclCXX.h:1931
ExplicitSpecKind getKind() const
Definition DeclCXX.h:1939
const Expr * getExpr() const
Definition DeclCXX.h:1940
Represents a standard C++ module export declaration.
Definition Decl.h:5149
SourceLocation getRBraceLoc() const
Definition Decl.h:5168
This represents one expression.
Definition Expr.h:112
Represents a member of a struct/union/class.
Definition Decl.h:3175
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition Decl.h:3275
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition Decl.h:3355
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition Decl.h:3394
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
Definition Decl.h:3291
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition Decl.h:3399
const Expr * getAsmStringExpr() const
Definition Decl.h:4637
SourceLocation getRParenLoc() const
Definition Decl.h:4631
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Definition DeclFriend.h:54
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
Definition DeclFriend.h:133
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Definition DeclFriend.h:139
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition DeclFriend.h:125
Declaration of a friend template.
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
NamedDecl * getFriendDecl() const
If this friend declaration names a templated function (or a member function of a templated type),...
TemplateParameterList * getTemplateParameterList(unsigned i) const
unsigned getNumTemplateParameters() const
TypeSourceInfo * getFriendType() const
If this friend declaration names a templated type (or a dependent member type of a templated type),...
Represents a function declaration or definition.
Definition Decl.h:2015
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition Decl.h:2704
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition Decl.cpp:3281
bool isTrivialForCall() const
Definition Decl.h:2395
ConstexprSpecKind getConstexprKind() const
Definition Decl.h:2491
DefaultedOrDeletedFunctionInfo * getDefaultedOrDeletedInfo() const
Definition Decl.cpp:3196
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition Decl.cpp:4195
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
Definition Decl.cpp:3553
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition Decl.h:2936
SourceLocation getDefaultLoc() const
Definition Decl.h:2413
bool usesSEHTry() const
Indicates the function uses __try.
Definition Decl.h:2533
ArrayRef< ParmVarDecl * > parameters() const
Definition Decl.h:2789
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted.
Definition Decl.h:2404
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition Decl.h:2392
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition Decl.h:2463
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
Definition Decl.cpp:4174
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition Decl.cpp:4325
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition Decl.h:2341
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition Decl.cpp:4391
unsigned getODRHash()
Returns ODRHash of the function.
Definition Decl.cpp:4681
@ TK_FunctionTemplateSpecialization
Definition Decl.h:2031
@ TK_DependentFunctionTemplateSpecialization
Definition Decl.h:2034
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition Decl.h:2903
bool FriendConstraintRefersToEnclosingTemplate() const
Definition Decl.h:2722
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition Decl.cpp:4146
bool isDeletedAsWritten() const
Definition Decl.h:2559
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
Definition Decl.h:2368
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition Decl.h:2372
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition Decl.h:2443
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition Decl.h:2694
bool isTypeAwareOperatorNewOrDelete() const
Determine whether this is a type aware operator new or delete.
Definition Decl.cpp:3561
bool isDefaulted() const
Whether this function is defaulted.
Definition Decl.h:2400
bool isIneligibleOrNotSelected() const
Definition Decl.h:2433
FunctionDecl * getInstantiatedFromDecl() const
Definition Decl.cpp:4219
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition Decl.h:2359
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition Decl.h:2474
size_t param_size() const
Definition Decl.h:2805
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition Decl.h:2914
bool isInstantiatedFromMemberTemplate() const
Definition Decl.h:2381
Declaration of a template function.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
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.
Definition Decl.h:5211
bool isCBuffer() const
Definition Decl.h:5255
SourceLocation getLBraceLoc() const
Definition Decl.h:5252
SourceLocation getLocStart() const LLVM_READONLY
Definition Decl.h:5251
SourceLocation getRBraceLoc() const
Definition Decl.h:5253
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition Decl.h:5070
ArrayRef< SourceLocation > getIdentifierLocs() const
Retrieves the locations of each of the identifiers that make up the complete module name in the impor...
Definition Decl.cpp:6072
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition Decl.h:5128
Represents a field injected from an anonymous union/struct into the parent scope.
Definition Decl.h:3482
unsigned getChainingSize() const
Definition Decl.h:3507
ArrayRef< NamedDecl * > chain() const
Definition Decl.h:3503
Represents the declaration of a label.
Definition Decl.h:524
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition DeclCXX.h:3324
Expr * getTemporaryExpr()
Retrieve the expression to which the temporary materialization conversion was applied.
Definition DeclCXX.h:3370
Represents a linkage specification.
Definition DeclCXX.h:3031
LinkageSpecLanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition DeclCXX.h:3054
SourceLocation getExternLoc() const
Definition DeclCXX.h:3070
SourceLocation getRBraceLoc() const
Definition DeclCXX.h:3071
A global _GUID constant.
Definition DeclCXX.h:4414
Parts getParts() const
Get the decomposed parts of this declaration.
Definition DeclCXX.h:4444
MSGuidDeclParts Parts
Definition DeclCXX.h:4416
An instance of this class represents the declaration of a property member.
Definition DeclCXX.h:4360
IdentifierInfo * getGetterId() const
Definition DeclCXX.h:4382
IdentifierInfo * getSetterId() const
Definition DeclCXX.h:4384
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.
Definition Module.h:246
bool isInterfaceOrPartition() const
Definition Module.h:774
bool isNamedModule() const
Does this Module is a named module of a standard named module?
Definition Module.h:326
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
Definition Module.h:825
This represents a decl that may have a name.
Definition Decl.h:274
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
Definition DeclBase.h:656
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Definition Decl.cpp:1182
bool isPlaceholderVar(const LangOptions &LangOpts) const
Definition Decl.cpp:1095
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition Decl.h:340
Represents a C++ namespace alias.
Definition DeclCXX.h:3217
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition DeclCXX.h:3278
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition DeclCXX.h:3303
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition DeclCXX.h:3306
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition DeclCXX.h:3287
Represent a C++ namespace.
Definition Decl.h:592
SourceLocation getRBraceLoc() const
Definition Decl.h:692
NamespaceDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Decl.h:691
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Definition Decl.h:643
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition Decl.h:648
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace that inhabits this namespace, if any.
Definition Decl.h:675
bool isNested() const
Returns true if this is a nested namespace declaration.
Definition Decl.h:657
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
bool hasPlaceholderTypeConstraint() const
Determine whether this non-type template parameter's type has a placeholder with a type-constraint.
unsigned getDepth() const
Get the nesting depth of the template parameter.
Expr * getPlaceholderTypeConstraint() const
Return the constraint introduced by the placeholder type of this non-type template parameter (if any)...
This represents 'pragma omp allocate ...' directive.
Definition DeclOpenMP.h:536
Pseudo declaration for capturing expressions.
Definition DeclOpenMP.h:445
OMPChildren * Data
Data, associated with the directive.
Definition DeclOpenMP.h:43
This represents 'pragma omp declare mapper ...' directive.
Definition DeclOpenMP.h:349
OMPDeclareMapperDecl * getPrevDeclInScope()
Get reference to previous declare mapper construct in the same scope with the same name.
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
Definition DeclOpenMP.h:421
This represents 'pragma omp declare reduction ...' directive.
Definition DeclOpenMP.h:239
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition DeclOpenMP.h:300
Expr * getInitPriv()
Get Priv variable of the initializer.
Definition DeclOpenMP.h:311
Expr * getCombinerOut()
Get Out variable of the combiner.
Definition DeclOpenMP.h:288
Expr * getCombinerIn()
Get In variable of the combiner.
Definition DeclOpenMP.h:285
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition DeclOpenMP.h:282
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name.
Expr * getInitOrig()
Get Orig variable of the initializer.
Definition DeclOpenMP.h:308
OMPDeclareReductionInitKind getInitializerKind() const
Get initializer kind.
Definition DeclOpenMP.h:303
This represents 'pragma omp requires...' directive.
Definition DeclOpenMP.h:479
This represents 'pragma omp threadprivate ...' directive.
Definition DeclOpenMP.h:110
Represents a field declaration created by an @defs(...).
Definition DeclObjC.h:2030
static bool classofKind(Kind K)
Definition DeclObjC.h:2051
ObjCCategoryDecl - Represents a category declaration.
Definition DeclObjC.h:2329
protocol_loc_range protocol_locs() const
Definition DeclObjC.h:2417
unsigned protocol_size() const
Definition DeclObjC.h:2412
ObjCInterfaceDecl * getClassInterface()
Definition DeclObjC.h:2372
SourceLocation getIvarLBraceLoc() const
Definition DeclObjC.h:2464
SourceLocation getIvarRBraceLoc() const
Definition DeclObjC.h:2466
protocol_range protocols() const
Definition DeclObjC.h:2403
SourceLocation getCategoryNameLoc() const
Definition DeclObjC.h:2460
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition DeclObjC.h:2545
SourceLocation getCategoryNameLoc() const
Definition DeclObjC.h:2572
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition DeclObjC.h:2775
const ObjCInterfaceDecl * getClassInterface() const
Definition DeclObjC.h:2793
ObjCContainerDecl - Represents a container for method declarations.
Definition DeclObjC.h:948
SourceRange getAtEndRange() const
Definition DeclObjC.h:1103
SourceLocation getAtStartLoc() const
Definition DeclObjC.h:1096
const ObjCInterfaceDecl * getClassInterface() const
Definition DeclObjC.h:2486
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition DeclObjC.h:2597
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition DeclObjC.h:2678
SourceLocation getIvarRBraceLoc() const
Definition DeclObjC.h:2744
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
Definition DeclObjC.h:2702
SourceLocation getSuperClassLoc() const
Definition DeclObjC.h:2737
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction?
Definition DeclObjC.h:2707
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition DeclObjC.h:2669
const ObjCInterfaceDecl * getSuperClass() const
Definition DeclObjC.h:2735
SourceLocation getIvarLBraceLoc() const
Definition DeclObjC.h:2742
Represents an ObjC class declaration.
Definition DeclObjC.h:1154
protocol_range protocols() const
Definition DeclObjC.h:1359
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition DeclObjC.cpp:788
protocol_loc_range protocol_locs() const
Definition DeclObjC.h:1388
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
Definition DeclObjC.h:1785
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Definition DeclObjC.h:1523
const Type * getTypeForDecl() const
Definition DeclObjC.h:1919
SourceLocation getEndOfDefinitionLoc() const
Definition DeclObjC.h:1878
TypeSourceInfo * getSuperClassTInfo() const
Definition DeclObjC.h:1573
ObjCIvarDecl - Represents an ObjC instance variable.
Definition DeclObjC.h:1952
AccessControl getAccessControl() const
Definition DeclObjC.h:2000
bool getSynthesize() const
Definition DeclObjC.h:2007
static bool classofKind(Kind K)
Definition DeclObjC.h:2015
T *const * iterator
Definition DeclObjC.h:88
ObjCMethodDecl - Represents an instance or class method declaration.
Definition DeclObjC.h:140
ImplicitParamDecl * getSelfDecl() const
Definition DeclObjC.h:418
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
Definition DeclObjC.h:462
ObjCDeclQualifier getObjCDeclQualifier() const
Definition DeclObjC.h:246
ArrayRef< ParmVarDecl * > parameters() const
Definition DeclObjC.h:373
unsigned param_size() const
Definition DeclObjC.h:347
bool isPropertyAccessor() const
Definition DeclObjC.h:436
bool isVariadic() const
Definition DeclObjC.h:431
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition DeclObjC.cpp:906
SourceLocation getEndLoc() const LLVM_READONLY
TypeSourceInfo * getReturnTypeSourceInfo() const
Definition DeclObjC.h:343
bool hasRedeclaration() const
True if redeclared in the same interface.
Definition DeclObjC.h:271
bool isSynthesizedAccessorStub() const
Definition DeclObjC.h:444
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type.
Definition DeclObjC.h:256
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
Definition DeclObjC.h:266
ImplicitParamDecl * getCmdDecl() const
Definition DeclObjC.h:420
bool isInstanceMethod() const
Definition DeclObjC.h:426
bool isDefined() const
Definition DeclObjC.h:452
QualType getReturnType() const
Definition DeclObjC.h:329
ObjCImplementationControl getImplementationControl() const
Definition DeclObjC.h:500
bool hasSkippedBody() const
True if the method was a definition but its body was skipped.
Definition DeclObjC.h:477
Represents one property declaration in an Objective-C interface.
Definition DeclObjC.h:731
SourceLocation getGetterNameLoc() const
Definition DeclObjC.h:886
ObjCMethodDecl * getGetterMethodDecl() const
Definition DeclObjC.h:901
ObjCMethodDecl * getSetterMethodDecl() const
Definition DeclObjC.h:904
SourceLocation getSetterNameLoc() const
Definition DeclObjC.h:894
SourceLocation getAtLoc() const
Definition DeclObjC.h:796
ObjCIvarDecl * getPropertyIvarDecl() const
Definition DeclObjC.h:924
Selector getSetterName() const
Definition DeclObjC.h:893
TypeSourceInfo * getTypeSourceInfo() const
Definition DeclObjC.h:802
QualType getType() const
Definition DeclObjC.h:804
Selector getGetterName() const
Definition DeclObjC.h:885
SourceLocation getLParenLoc() const
Definition DeclObjC.h:799
ObjCPropertyAttribute::Kind getPropertyAttributesAsWritten() const
Definition DeclObjC.h:827
ObjCPropertyAttribute::Kind getPropertyAttributes() const
Definition DeclObjC.h:815
PropertyControl getPropertyImplementation() const
Definition DeclObjC.h:912
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition DeclObjC.h:2805
ObjCIvarDecl * getPropertyIvarDecl() const
Definition DeclObjC.h:2879
SourceLocation getPropertyIvarDeclLoc() const
Definition DeclObjC.h:2882
Expr * getSetterCXXAssignment() const
Definition DeclObjC.h:2915
ObjCPropertyDecl * getPropertyDecl() const
Definition DeclObjC.h:2870
Expr * getGetterCXXConstructor() const
Definition DeclObjC.h:2907
ObjCMethodDecl * getSetterMethodDecl() const
Definition DeclObjC.h:2904
SourceLocation getBeginLoc() const LLVM_READONLY
Definition DeclObjC.h:2867
ObjCMethodDecl * getGetterMethodDecl() const
Definition DeclObjC.h:2901
Represents an Objective-C protocol declaration.
Definition DeclObjC.h:2084
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition DeclObjC.h:2261
protocol_loc_range protocol_locs() const
Definition DeclObjC.h:2182
protocol_range protocols() const
Definition DeclObjC.h:2161
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
unsigned protocol_size() const
Definition DeclObjC.h:2200
Represents the declaration of an Objective-C type parameter.
Definition DeclObjC.h:578
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition DeclObjC.h:662
unsigned size() const
Determine the number of type parameters in this list.
Definition DeclObjC.h:689
SourceLocation getRAngleLoc() const
Definition DeclObjC.h:711
SourceLocation getLAngleLoc() const
Definition DeclObjC.h:710
ArrayRef< const OpenACCClause * > clauses() const
Definition DeclOpenACC.h:62
Represents a partial function definition.
Definition Decl.h:4896
ImplicitParamDecl * getParam(unsigned i) const
Definition Decl.h:4928
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition Decl.cpp:5674
unsigned getNumParams() const
Definition Decl.h:4926
Represents a parameter to a function.
Definition Decl.h:1805
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion:
Definition Decl.h:1886
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition Decl.h:1865
SourceLocation getExplicitObjectParamThisLoc() const
Definition Decl.h:1901
bool isObjCMethodParameter() const
Definition Decl.h:1848
ObjCDeclQualifier getObjCDeclQualifier() const
Definition Decl.h:1869
bool hasUninstantiatedDefaultArg() const
Definition Decl.h:1938
bool hasInheritedDefaultArg() const
Definition Decl.h:1950
Expr * getUninstantiatedDefaultArg()
Definition Decl.cpp:3054
unsigned getFunctionScopeDepth() const
Definition Decl.h:1855
Represents a #pragma comment line.
Definition Decl.h:167
StringRef getArg() const
Definition Decl.h:190
PragmaMSCommentKind getCommentKind() const
Definition Decl.h:188
Represents a #pragma detect_mismatch line.
Definition Decl.h:201
StringRef getName() const
Definition Decl.h:222
StringRef getValue() const
Definition Decl.h:223
A (possibly-)qualified type.
Definition TypeBase.h:937
Represents a struct/union/class.
Definition Decl.h:4342
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition Decl.cpp:5420
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition Decl.h:4452
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition Decl.h:4460
RecordArgPassingKind getArgPassingRestrictions() const
Definition Decl.h:4483
bool hasVolatileMember() const
Definition Decl.h:4405
bool hasFlexibleArrayMember() const
Definition Decl.h:4375
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition Decl.h:4444
bool hasObjectMember() const
Definition Decl.h:4402
bool isNonTrivialToPrimitiveDestroy() const
Definition Decl.h:4436
bool isNonTrivialToPrimitiveCopy() const
Definition Decl.h:4428
bool isParamDestroyedInCallee() const
Definition Decl.h:4492
RecordDecl * getMostRecentDecl()
Definition Decl.h:4368
bool hasUninitializedExplicitInitFields() const
Definition Decl.h:4468
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition Decl.h:4420
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition Decl.h:4394
Declaration of a redeclarable template.
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Provides common interface for the Decls that can be redeclared.
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Represents the body of a requires-expression.
Definition DeclCXX.h:2105
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
Represents a C++11 static_assert declaration.
Definition DeclCXX.h:4152
bool isFailed() const
Definition DeclCXX.h:4181
SourceLocation getRParenLoc() const
Definition DeclCXX.h:4183
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1802
Represents the declaration of a struct/union/class/enum.
Definition Decl.h:3732
SourceRange getBraceRange() const
Definition Decl.h:3809
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition Decl.h:3828
bool isEmbeddedInDeclarator() const
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...
Definition Decl.h:3857
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition Decl.h:3833
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition Decl.h:3969
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition Decl.h:3842
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition Decl.h:3868
TagKind getTagKind() const
Definition Decl.h:3932
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.
@ Declaration
The template argument is a declaration that was provided for a pointer, reference,...
@ 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.).
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
A template parameter object.
const APValue & getValue() const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool wasDeclaredWithTypename() const
Whether this template template parameter was declared with the 'typename' keyword.
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
TemplateNameKind templateParameterKind() const
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Declaration of a template type parameter.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
UnsignedOrNone getNumExpansionParameters() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
A declaration that models statements at global scope.
Definition Decl.h:4652
The top declaration context.
Definition Decl.h:105
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition Decl.h:3703
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition Decl.h:3721
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Definition ASTConcept.h:227
UnsignedOrNone getArgPackSubstIndex() const
Definition ASTConcept.h:250
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
Definition ASTConcept.h:244
ConceptReference * getConceptReference() const
Definition ASTConcept.h:248
Represents a declaration of a type.
Definition Decl.h:3528
const Type * getTypeForDecl() const
Definition Decl.h:3553
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Decl.h:3562
QualType getType() const
Return the type wrapped by this type source info.
Definition TypeBase.h:8413
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
Definition Type.cpp:2074
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition Decl.h:3682
Base class for declarations which introduce a typedef-name.
Definition Decl.h:3577
TypeSourceInfo * getTypeSourceInfo() const
Definition Decl.h:3627
TypedefNameDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
bool isModed() const
Definition Decl.h:3623
QualType getUnderlyingType() const
Definition Decl.h:3632
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes,...
Definition Decl.cpp:5772
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Definition DeclCXX.h:4471
const APValue & getValue() const
Definition DeclCXX.h:4497
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Definition DeclCXX.h:4134
Represents a dependent using declaration which was marked with typename.
Definition DeclCXX.h:4053
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
Definition DeclCXX.h:4083
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition DeclCXX.h:4087
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition DeclCXX.h:4104
Represents a dependent using declaration which was not marked with typename.
Definition DeclCXX.h:3956
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
Definition DeclCXX.h:3987
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition DeclCXX.h:3997
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition DeclCXX.h:4014
Represents a C++ using-declaration.
Definition DeclCXX.h:3607
bool hasTypename() const
Return true if the using declaration has 'typename'.
Definition DeclCXX.h:3656
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition DeclCXX.h:3641
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
Definition DeclCXX.h:3634
Represents C++ using-directive.
Definition DeclCXX.h:3112
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition DeclCXX.h:3183
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition DeclCXX.cpp:3349
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition DeclCXX.h:3179
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition DeclCXX.h:3187
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition DeclCXX.h:3157
Represents a C++ using-enum-declaration.
Definition DeclCXX.h:3808
SourceLocation getEnumLoc() const
The source location of the 'enum' keyword.
Definition DeclCXX.h:3832
TypeSourceInfo * getEnumType() const
Definition DeclCXX.h:3844
SourceLocation getUsingLoc() const
The source location of the 'using' keyword.
Definition DeclCXX.h:3828
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Definition DeclCXX.h:3889
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition DeclCXX.h:3918
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Definition DeclCXX.h:3922
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition DeclCXX.h:3415
UsingShadowDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition DeclCXX.h:3479
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:712
QualType getType() const
Definition Decl.h:723
Represents a variable declaration or definition.
Definition Decl.h:926
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Definition Decl.cpp:2823
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition Decl.h:1584
VarDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition Decl.h:1481
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition Decl.h:1593
@ CInit
C-style initialization with assignment.
Definition Decl.h:931
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C.
Definition Decl.h:1547
bool hasInitWithSideEffects() const
Checks whether this declaration has an initializer with side effects.
Definition Decl.cpp:2457
bool isInlineSpecified() const
Definition Decl.h:1569
bool isStaticDataMember() const
Determines whether this is a static data member.
Definition Decl.h:1298
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
Definition Decl.h:1537
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
Definition Decl.h:1527
bool isCXXForRangeImplicitVar() const
Whether this variable is the implicit '__range' variable in C++ range-based for loops.
Definition Decl.h:1637
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Definition Decl.h:1509
bool isInline() const
Whether this variable is (C++1z) inline.
Definition Decl.h:1566
ThreadStorageClassSpecifier getTSCSpec() const
Definition Decl.h:1177
const Expr * getInit() const
Definition Decl.h:1383
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition Decl.h:1562
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
Definition Decl.h:1244
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition Decl.h:1168
bool isEscapingByref() const
Indicates the capture is a __block variable that is captured by a block that can potentially escape (...
Definition Decl.cpp:2711
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Definition Decl.h:1491
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
Definition Decl.h:1603
VarDecl * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Definition Decl.cpp:2792
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Definition Decl.cpp:2911
Declaration of a variable template.
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
bool isMemberSpecialization() const
Determines whether this variable template partial specialization was a specialization of a member par...
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
SourceLocation getExternKeywordLoc() const
Gets the location of the extern keyword, if present.
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_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...
Definition ASTCommon.h:96
The JSON file list parser is used to communicate input to InstallAPI.
bool isa(CodeGen::Address addr)
Definition Address.h:330
@ GVA_StrongExternal
Definition Linkage.h:76
@ GVA_AvailableExternally
Definition Linkage.h:74
@ GVA_Internal
Definition Linkage.h:73
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
Definition Template.h:50
@ AS_none
Definition Specifiers.h:127
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition Linkage.h:24
@ SD_Thread
Thread storage duration.
Definition Specifiers.h:342
@ SD_Static
Static storage duration.
Definition Specifiers.h:343
@ Template
We are parsing a template declaration.
Definition Parser.h:81
@ ExplicitInstantiation
We are parsing an explicit instantiation.
Definition Parser.h:85
@ VarTemplate
The name was classified as a variable template name.
Definition Sema.h:585
bool CanElideDeclDef(const Decl *D)
If we can elide the definition of.
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition Specifiers.h:206
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition Specifiers.h:202
U cast(CodeGen::Address addr)
Definition Address.h:327
bool isExternallyVisible(Linkage L)
Definition Linkage.h:90
unsigned long uint64_t
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
const Expr * ConstraintExpr
Definition Decl.h:88
UnsignedOrNone ArgPackSubstIndex
Definition Decl.h:89
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Definition Expr.h:6717
Data that is common to all of the declarations of a given function template.
uint16_t Part2
...-89ab-...
Definition DeclCXX.h:4393
uint32_t Part1
{01234567-...
Definition DeclCXX.h:4391
uint16_t Part3
...-cdef-...
Definition DeclCXX.h:4395
uint8_t Part4And5[8]
...-0123-456789abcdef}
Definition DeclCXX.h:4397
static DeclType * getDecl(EntryType *D)