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)
365 return false;
366
367 if (VD->getDescribedVarTemplate())
368 return false;
369
370 Module *M = VD->getOwningModule();
371 if (!M)
372 return false;
373
374 M = M->getTopLevelModule();
375 ASTContext &Ctx = VD->getASTContext();
376 if (!M->isInterfaceOrPartition() &&
377 (!VD->hasAttr<DLLExportAttr>() ||
378 !Ctx.getLangOpts().BuildingPCHWithObjectFile))
379 return false;
380
382}
383
385 if (FD->isDependentContext())
386 return false;
387
388 ASTContext &Ctx = FD->getASTContext();
389 auto Linkage = Ctx.GetGVALinkageForFunction(FD);
390 if (Ctx.getLangOpts().ModulesCodegen ||
391 (FD->hasAttr<DLLExportAttr>() &&
392 Ctx.getLangOpts().BuildingPCHWithObjectFile))
393 // Under -fmodules-codegen, codegen is performed for all non-internal,
394 // non-always_inline functions, unless they are available elsewhere.
395 if (!FD->hasAttr<AlwaysInlineAttr>() && Linkage != GVA_Internal &&
397 return true;
398
399 Module *M = FD->getOwningModule();
400 if (!M)
401 return false;
402
403 M = M->getTopLevelModule();
404 if (M->isInterfaceOrPartition())
406 return true;
407
408 return false;
409}
410
412 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
413 if (FD->isInlined() || FD->isConstexpr() || FD->isConsteval())
414 return false;
415
416 // If the function should be generated somewhere else, we shouldn't elide
417 // it.
419 return false;
420 }
421
422 if (auto *VD = dyn_cast<VarDecl>(D)) {
423 if (VD->getDeclContext()->isDependentContext())
424 return false;
425
426 // Constant initialized variable may not affect the ABI, but they
427 // may be used in constant evaluation in the frontend, so we have
428 // to remain them.
429 if (VD->hasConstantInitialization() || VD->isConstexpr())
430 return false;
431
432 // If the variable should be generated somewhere else, we shouldn't elide
433 // it.
435 return false;
436 }
437
438 return true;
439}
440
443
444 // Source locations require array (variable-length) abbreviations. The
445 // abbreviation infrastructure requires that arrays are encoded last, so
446 // we handle it here in the case of those classes derived from DeclaratorDecl
447 if (auto *DD = dyn_cast<DeclaratorDecl>(D)) {
448 if (auto *TInfo = DD->getTypeSourceInfo())
449 Record.AddTypeLoc(TInfo->getTypeLoc());
450 }
451
452 // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
453 // have been written. We want it last because we will not read it back when
454 // retrieving it from the AST, we'll just lazily set the offset.
455 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
456 if (!GeneratingReducedBMI || !CanElideDeclDef(FD)) {
457 Record.push_back(FD->doesThisDeclarationHaveABody());
458 if (FD->doesThisDeclarationHaveABody())
459 Record.AddFunctionDefinition(FD);
460 } else
461 Record.push_back(0);
462 }
463
464 // Similar to FunctionDecls, handle VarDecl's initializer here and write it
465 // after all other Stmts/Exprs. We will not read the initializer until after
466 // we have finished recursive deserialization, because it can recursively
467 // refer back to the variable.
468 if (auto *VD = dyn_cast<VarDecl>(D)) {
469 if (!GeneratingReducedBMI || !CanElideDeclDef(VD))
470 Record.AddVarDeclInit(VD);
471 else
472 Record.push_back(0);
473 }
474
475 // And similarly for FieldDecls. We already serialized whether there is a
476 // default member initializer.
477 if (auto *FD = dyn_cast<FieldDecl>(D)) {
478 if (FD->hasInClassInitializer()) {
479 if (Expr *Init = FD->getInClassInitializer()) {
480 Record.push_back(1);
481 Record.AddStmt(Init);
482 } else {
483 Record.push_back(0);
484 // Initializer has not been instantiated yet.
485 }
486 }
487 }
488
489 // If this declaration is also a DeclContext, write blocks for the
490 // declarations that lexically stored inside its context and those
491 // declarations that are visible from its context.
492 if (auto *DC = dyn_cast<DeclContext>(D))
494}
495
497 BitsPacker DeclBits;
498
499 // The order matters here. It will be better to put the bit with higher
500 // probability to be 0 in the end of the bits.
501 //
502 // Since we're using VBR6 format to store it.
503 // It will be pretty effient if all the higher bits are 0.
504 // For example, if we need to pack 8 bits into a value and the stored value
505 // is 0xf0, the actual stored value will be 0b000111'110000, which takes 12
506 // bits actually. However, if we changed the order to be 0x0f, then we can
507 // store it as 0b001111, which takes 6 bits only now.
508 DeclBits.addBits((uint64_t)D->getModuleOwnershipKind(), /*BitWidth=*/3);
509 DeclBits.addBit(D->isThisDeclarationReferenced());
510 // If we're writing a BMI for a named module unit, we can treat all decls as in
511 // the BMI as used. Otherwise, the consumer need to mark it as used again, this
512 // simply waste time.
513 DeclBits.addBit(Writer.isWritingStdCXXNamedModules() ? true : D->isUsed(false));
514 DeclBits.addBits(D->getAccess(), /*BitWidth=*/2);
515 DeclBits.addBit(D->isImplicit());
516 DeclBits.addBit(D->getDeclContext() != D->getLexicalDeclContext());
517 DeclBits.addBit(D->hasAttrs());
519 DeclBits.addBit(D->isInvalidDecl());
520 Record.push_back(DeclBits);
521
522 Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
523 if (D->getDeclContext() != D->getLexicalDeclContext())
524 Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
525
526 if (D->hasAttrs())
527 Record.AddAttributes(D->getAttrs());
528
529 Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
530
531 // If this declaration injected a name into a context different from its
532 // lexical context, and that context is an imported namespace, we need to
533 // update its visible declarations to include this name.
534 //
535 // This happens when we instantiate a class with a friend declaration or a
536 // function with a local extern declaration, for instance.
537 //
538 // FIXME: Can we handle this in AddedVisibleDecl instead?
539 if (D->isOutOfLine()) {
540 auto *DC = D->getDeclContext();
541 while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
542 if (!NS->isFromASTFile())
543 break;
544 Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
545 if (!NS->isInlineNamespace())
546 break;
547 DC = NS->getParent();
548 }
549 }
550}
551
553 StringRef Arg = D->getArg();
554 Record.push_back(Arg.size());
555 VisitDecl(D);
556 Record.AddSourceLocation(D->getBeginLoc());
557 Record.push_back(D->getCommentKind());
558 Record.AddString(Arg);
560}
561
564 StringRef Name = D->getName();
565 StringRef Value = D->getValue();
566 Record.push_back(Name.size() + 1 + Value.size());
567 VisitDecl(D);
568 Record.AddSourceLocation(D->getBeginLoc());
569 Record.AddString(Name);
570 Record.AddString(Value);
572}
573
575 llvm_unreachable("Translation units aren't directly serialized");
576}
577
579 VisitDecl(D);
580 Record.AddDeclarationName(D->getDeclName());
581 Record.push_back(needsAnonymousDeclarationNumber(D)
582 ? Writer.getAnonymousDeclarationNumber(D)
583 : 0);
584}
585
588 Record.AddSourceLocation(D->getBeginLoc());
590 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
591}
592
595 VisitTypeDecl(D);
596 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
597 Record.push_back(D->isModed());
598 if (D->isModed())
599 Record.AddTypeRef(D->getUnderlyingType());
600 Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
601}
602
605 if (D->getDeclContext() == D->getLexicalDeclContext() &&
606 !D->hasAttrs() &&
607 !D->isImplicit() &&
608 D->getFirstDecl() == D->getMostRecentDecl() &&
609 !D->isInvalidDecl() &&
611 !D->isModulePrivate() &&
614 AbbrevToUse = Writer.getDeclTypedefAbbrev();
615
617}
618
624
626 static_assert(DeclContext::NumTagDeclBits == 23,
627 "You need to update the serializer after you change the "
628 "TagDeclBits");
629
631 VisitTypeDecl(D);
632 Record.push_back(D->getIdentifierNamespace());
633
634 BitsPacker TagDeclBits;
635 TagDeclBits.addBits(llvm::to_underlying(D->getTagKind()), /*BitWidth=*/3);
636 TagDeclBits.addBit(!isa<CXXRecordDecl>(D) ? D->isCompleteDefinition() : 0);
637 TagDeclBits.addBit(D->isEmbeddedInDeclarator());
638 TagDeclBits.addBit(D->isFreeStanding());
639 TagDeclBits.addBit(D->isCompleteDefinitionRequired());
640 TagDeclBits.addBits(
641 D->hasExtInfo() ? 1 : (D->getTypedefNameForAnonDecl() ? 2 : 0),
642 /*BitWidth=*/2);
643 Record.push_back(TagDeclBits);
644
645 Record.AddSourceRange(D->getBraceRange());
646
647 if (D->hasExtInfo()) {
648 Record.AddQualifierInfo(*D->getExtInfo());
649 } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
650 Record.AddDeclRef(TD);
651 Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
652 }
653}
654
656 static_assert(DeclContext::NumEnumDeclBits == 43,
657 "You need to update the serializer after you change the "
658 "EnumDeclBits");
659
660 VisitTagDecl(D);
661 Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
662 if (!D->getIntegerTypeSourceInfo())
663 Record.AddTypeRef(D->getIntegerType());
664 Record.AddTypeRef(D->getPromotionType());
665
666 BitsPacker EnumDeclBits;
667 EnumDeclBits.addBits(D->getNumPositiveBits(), /*BitWidth=*/8);
668 EnumDeclBits.addBits(D->getNumNegativeBits(), /*BitWidth=*/8);
669 EnumDeclBits.addBit(D->isScoped());
670 EnumDeclBits.addBit(D->isScopedUsingClassTag());
671 EnumDeclBits.addBit(D->isFixed());
672 Record.push_back(EnumDeclBits);
673
674 Record.push_back(D->getODRHash());
675
677 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
678 Record.push_back(MemberInfo->getTemplateSpecializationKind());
679 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
680 } else {
681 Record.AddDeclRef(nullptr);
682 }
683
684 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
685 !D->isInvalidDecl() && !D->isImplicit() && !D->hasExtInfo() &&
687 D->getFirstDecl() == D->getMostRecentDecl() &&
693 AbbrevToUse = Writer.getDeclEnumAbbrev();
694
696}
697
699 static_assert(DeclContext::NumRecordDeclBits == 64,
700 "You need to update the serializer after you change the "
701 "RecordDeclBits");
702
703 VisitTagDecl(D);
704
705 BitsPacker RecordDeclBits;
706 RecordDeclBits.addBit(D->hasFlexibleArrayMember());
707 RecordDeclBits.addBit(D->isAnonymousStructOrUnion());
708 RecordDeclBits.addBit(D->hasObjectMember());
709 RecordDeclBits.addBit(D->hasVolatileMember());
711 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveCopy());
712 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveDestroy());
715 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveCopyCUnion());
716 RecordDeclBits.addBit(D->hasUninitializedExplicitInitFields());
717 RecordDeclBits.addBit(D->isParamDestroyedInCallee());
718 RecordDeclBits.addBits(llvm::to_underlying(D->getArgPassingRestrictions()), 2);
719 Record.push_back(RecordDeclBits);
720
721 // Only compute this for C/Objective-C, in C++ this is computed as part
722 // of CXXRecordDecl.
723 if (!isa<CXXRecordDecl>(D))
724 Record.push_back(D->getODRHash());
725
726 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
727 !D->isImplicit() && !D->isInvalidDecl() && !D->hasExtInfo() &&
729 D->getFirstDecl() == D->getMostRecentDecl() &&
734 AbbrevToUse = Writer.getDeclRecordAbbrev();
735
737}
738
741 Record.AddTypeRef(D->getType());
742}
743
746 Record.push_back(D->getInitExpr()? 1 : 0);
747 if (D->getInitExpr())
748 Record.AddStmt(D->getInitExpr());
749 Record.AddAPSInt(D->getInitVal());
750
752}
753
756 Record.AddSourceLocation(D->getInnerLocStart());
757 Record.push_back(D->hasExtInfo());
758 if (D->hasExtInfo()) {
759 DeclaratorDecl::ExtInfo *Info = D->getExtInfo();
760 Record.AddQualifierInfo(*Info);
761 Record.AddStmt(
762 const_cast<Expr *>(Info->TrailingRequiresClause.ConstraintExpr));
763 Record.writeUnsignedOrNone(Info->TrailingRequiresClause.ArgPackSubstIndex);
764 }
765 // The location information is deferred until the end of the record.
766 Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()
767 : QualType());
768}
769
771 static_assert(DeclContext::NumFunctionDeclBits == 45,
772 "You need to update the serializer after you change the "
773 "FunctionDeclBits");
774
776
777 Record.push_back(D->getTemplatedKind());
778 switch (D->getTemplatedKind()) {
780 break;
782 Record.AddDeclRef(D->getInstantiatedFromDecl());
783 break;
785 Record.AddDeclRef(D->getDescribedFunctionTemplate());
786 break;
789 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
790 Record.push_back(MemberInfo->getTemplateSpecializationKind());
791 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
792 break;
793 }
796 FTSInfo = D->getTemplateSpecializationInfo();
797
799
800 Record.AddDeclRef(FTSInfo->getTemplate());
801 Record.push_back(FTSInfo->getTemplateSpecializationKind());
802
803 // Template arguments.
804 Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
805
806 // Template args as written.
807 Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
808 if (FTSInfo->TemplateArgumentsAsWritten)
809 Record.AddASTTemplateArgumentListInfo(
811
812 Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
813
814 if (MemberSpecializationInfo *MemberInfo =
815 FTSInfo->getMemberSpecializationInfo()) {
816 Record.push_back(1);
817 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
818 Record.push_back(MemberInfo->getTemplateSpecializationKind());
819 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
820 } else {
821 Record.push_back(0);
822 }
823
824 if (D->isCanonicalDecl()) {
825 // Write the template that contains the specializations set. We will
826 // add a FunctionTemplateSpecializationInfo to it when reading.
827 Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
828 }
829 break;
830 }
833 DFTSInfo = D->getDependentSpecializationInfo();
834
835 // Candidates.
836 Record.push_back(DFTSInfo->getCandidates().size());
837 for (FunctionTemplateDecl *FTD : DFTSInfo->getCandidates())
838 Record.AddDeclRef(FTD);
839
840 // Templates args.
841 Record.push_back(DFTSInfo->TemplateArgumentsAsWritten != nullptr);
842 if (DFTSInfo->TemplateArgumentsAsWritten)
843 Record.AddASTTemplateArgumentListInfo(
845 break;
846 }
847 }
848
850 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
851 Record.push_back(D->getIdentifierNamespace());
852
853 // The order matters here. It will be better to put the bit with higher
854 // probability to be 0 in the end of the bits. See the comments in VisitDecl
855 // for details.
856 BitsPacker FunctionDeclBits;
857 // FIXME: stable encoding
858 FunctionDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), 3);
859 FunctionDeclBits.addBits((uint32_t)D->getStorageClass(), /*BitWidth=*/3);
860 FunctionDeclBits.addBit(D->isInlineSpecified());
861 FunctionDeclBits.addBit(D->isInlined());
862 FunctionDeclBits.addBit(D->hasSkippedBody());
863 FunctionDeclBits.addBit(D->isVirtualAsWritten());
864 FunctionDeclBits.addBit(D->isPureVirtual());
865 FunctionDeclBits.addBit(D->hasInheritedPrototype());
866 FunctionDeclBits.addBit(D->hasWrittenPrototype());
867 FunctionDeclBits.addBit(D->isDeletedBit());
868 FunctionDeclBits.addBit(D->isTrivial());
869 FunctionDeclBits.addBit(D->isTrivialForCall());
870 FunctionDeclBits.addBit(D->isDefaulted());
871 FunctionDeclBits.addBit(D->isExplicitlyDefaulted());
872 FunctionDeclBits.addBit(D->isIneligibleOrNotSelected());
873 FunctionDeclBits.addBits((uint64_t)(D->getConstexprKind()), /*BitWidth=*/2);
874 FunctionDeclBits.addBit(D->hasImplicitReturnZero());
875 FunctionDeclBits.addBit(D->isMultiVersion());
876 FunctionDeclBits.addBit(D->isLateTemplateParsed());
877 FunctionDeclBits.addBit(D->isInstantiatedFromMemberTemplate());
879 FunctionDeclBits.addBit(D->usesSEHTry());
880 FunctionDeclBits.addBit(D->isDestroyingOperatorDelete());
881 FunctionDeclBits.addBit(D->isTypeAwareOperatorNewOrDelete());
882 Record.push_back(FunctionDeclBits);
883
884 Record.AddSourceLocation(D->getEndLoc());
885 if (D->isExplicitlyDefaulted())
886 Record.AddSourceLocation(D->getDefaultLoc());
887
888 Record.push_back(D->getODRHash());
889
890 if (D->isDefaulted() || D->isDeletedAsWritten()) {
891 if (auto *FDI = D->getDefaultedOrDeletedInfo()) {
892 // Store both that there is an DefaultedOrDeletedInfo and whether it
893 // contains a DeletedMessage.
894 StringLiteral *DeletedMessage = FDI->getDeletedMessage();
895 Record.push_back(1 | (DeletedMessage ? 2 : 0));
896 if (DeletedMessage)
897 Record.AddStmt(DeletedMessage);
898
899 Record.push_back(FDI->getUnqualifiedLookups().size());
900 for (DeclAccessPair P : FDI->getUnqualifiedLookups()) {
901 Record.AddDeclRef(P.getDecl());
902 Record.push_back(P.getAccess());
903 }
904 } else {
905 Record.push_back(0);
906 }
907 }
908
909 if (D->getFriendObjectKind()) {
910 // For a friend function defined inline within a class template, we have to
911 // force the definition to be the one inside the definition of the template
912 // class. Remember this relation to deserialize them together.
913 if (auto *RD = dyn_cast<CXXRecordDecl>(D->getLexicalParent());
914 RD && isDefinitionInDependentContext(RD)) {
915 Writer.RelatedDeclsMap[Writer.GetDeclRef(RD)].push_back(
916 Writer.GetDeclRef(D));
917 }
918 }
919
920 Record.push_back(D->param_size());
921 for (auto *P : D->parameters())
922 Record.AddDeclRef(P);
924}
925
928 uint64_t Kind = static_cast<uint64_t>(ES.getKind());
929 Kind = Kind << 1 | static_cast<bool>(ES.getExpr());
930 Record.push_back(Kind);
931 if (ES.getExpr()) {
932 Record.AddStmt(ES.getExpr());
933 }
934}
935
938 Record.AddDeclRef(D->Ctor);
940 Record.push_back(static_cast<unsigned char>(D->getDeductionCandidateKind()));
941 Record.AddDeclRef(D->getSourceDeductionGuide());
942 Record.push_back(
943 static_cast<unsigned char>(D->getSourceDeductionGuideKind()));
945}
946
948 static_assert(DeclContext::NumObjCMethodDeclBits == 37,
949 "You need to update the serializer after you change the "
950 "ObjCMethodDeclBits");
951
953 // FIXME: convert to LazyStmtPtr?
954 // Unlike C/C++, method bodies will never be in header files.
955 bool HasBodyStuff = D->getBody() != nullptr;
956 Record.push_back(HasBodyStuff);
957 if (HasBodyStuff) {
958 Record.AddStmt(D->getBody());
959 }
960 Record.AddDeclRef(D->getSelfDecl());
961 Record.AddDeclRef(D->getCmdDecl());
962 Record.push_back(D->isInstanceMethod());
963 Record.push_back(D->isVariadic());
964 Record.push_back(D->isPropertyAccessor());
965 Record.push_back(D->isSynthesizedAccessorStub());
966 Record.push_back(D->isDefined());
967 Record.push_back(D->isOverriding());
968 Record.push_back(D->hasSkippedBody());
969
970 Record.push_back(D->isRedeclaration());
971 Record.push_back(D->hasRedeclaration());
972 if (D->hasRedeclaration()) {
973 assert(Record.getASTContext().getObjCMethodRedeclaration(D));
974 Record.AddDeclRef(Record.getASTContext().getObjCMethodRedeclaration(D));
975 }
976
977 // FIXME: stable encoding for @required/@optional
978 Record.push_back(llvm::to_underlying(D->getImplementationControl()));
979 // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
980 Record.push_back(D->getObjCDeclQualifier());
981 Record.push_back(D->hasRelatedResultType());
982 Record.AddTypeRef(D->getReturnType());
983 Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
984 Record.AddSourceLocation(D->getEndLoc());
985 Record.push_back(D->param_size());
986 for (const auto *P : D->parameters())
987 Record.AddDeclRef(P);
988
989 Record.push_back(D->getSelLocsKind());
990 unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
991 SourceLocation *SelLocs = D->getStoredSelLocs();
992 Record.push_back(NumStoredSelLocs);
993 for (unsigned i = 0; i != NumStoredSelLocs; ++i)
994 Record.AddSourceLocation(SelLocs[i]);
995
997}
998
1001 Record.push_back(D->Variance);
1002 Record.push_back(D->Index);
1003 Record.AddSourceLocation(D->VarianceLoc);
1004 Record.AddSourceLocation(D->ColonLoc);
1005
1007}
1008
1010 static_assert(DeclContext::NumObjCContainerDeclBits == 64,
1011 "You need to update the serializer after you change the "
1012 "ObjCContainerDeclBits");
1013
1014 VisitNamedDecl(D);
1015 Record.AddSourceLocation(D->getAtStartLoc());
1016 Record.AddSourceRange(D->getAtEndRange());
1017 // Abstract class (no need to define a stable serialization::DECL code).
1018}
1019
1023 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
1024 AddObjCTypeParamList(D->TypeParamList);
1025
1026 Record.push_back(D->isThisDeclarationADefinition());
1028 // Write the DefinitionData
1029 ObjCInterfaceDecl::DefinitionData &Data = D->data();
1030
1031 Record.AddTypeSourceInfo(D->getSuperClassTInfo());
1032 Record.AddSourceLocation(D->getEndOfDefinitionLoc());
1033 Record.push_back(Data.HasDesignatedInitializers);
1034 Record.push_back(D->getODRHash());
1035
1036 // Write out the protocols that are directly referenced by the @interface.
1037 Record.push_back(Data.ReferencedProtocols.size());
1038 for (const auto *P : D->protocols())
1039 Record.AddDeclRef(P);
1040 for (const auto &PL : D->protocol_locs())
1041 Record.AddSourceLocation(PL);
1042
1043 // Write out the protocols that are transitively referenced.
1044 Record.push_back(Data.AllReferencedProtocols.size());
1046 P = Data.AllReferencedProtocols.begin(),
1047 PEnd = Data.AllReferencedProtocols.end();
1048 P != PEnd; ++P)
1049 Record.AddDeclRef(*P);
1050
1051
1052 if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
1053 // Ensure that we write out the set of categories for this class.
1054 Writer.ObjCClassesWithCategories.insert(D);
1055
1056 // Make sure that the categories get serialized.
1057 for (; Cat; Cat = Cat->getNextClassCategoryRaw())
1058 (void)Writer.GetDeclRef(Cat);
1059 }
1060 }
1061
1063}
1064
1066 VisitFieldDecl(D);
1067 // FIXME: stable encoding for @public/@private/@protected/@package
1068 Record.push_back(D->getAccessControl());
1069 Record.push_back(D->getSynthesize());
1070
1071 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1072 !D->hasAttrs() &&
1073 !D->isImplicit() &&
1074 !D->isUsed(false) &&
1075 !D->isInvalidDecl() &&
1076 !D->isReferenced() &&
1077 !D->isModulePrivate() &&
1078 !D->getBitWidth() &&
1079 !D->hasExtInfo() &&
1080 D->getDeclName())
1081 AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
1082
1084}
1085
1089
1090 Record.push_back(D->isThisDeclarationADefinition());
1092 Record.push_back(D->protocol_size());
1093 for (const auto *I : D->protocols())
1094 Record.AddDeclRef(I);
1095 for (const auto &PL : D->protocol_locs())
1096 Record.AddSourceLocation(PL);
1097 Record.push_back(D->getODRHash());
1098 }
1099
1101}
1102
1107
1110 Record.AddSourceLocation(D->getCategoryNameLoc());
1111 Record.AddSourceLocation(D->getIvarLBraceLoc());
1112 Record.AddSourceLocation(D->getIvarRBraceLoc());
1113 Record.AddDeclRef(D->getClassInterface());
1114 AddObjCTypeParamList(D->TypeParamList);
1115 Record.push_back(D->protocol_size());
1116 for (const auto *I : D->protocols())
1117 Record.AddDeclRef(I);
1118 for (const auto &PL : D->protocol_locs())
1119 Record.AddSourceLocation(PL);
1121}
1122
1128
1130 VisitNamedDecl(D);
1131 Record.AddSourceLocation(D->getAtLoc());
1132 Record.AddSourceLocation(D->getLParenLoc());
1133 Record.AddTypeRef(D->getType());
1134 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
1135 // FIXME: stable encoding
1136 Record.push_back((unsigned)D->getPropertyAttributes());
1137 Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
1138 // FIXME: stable encoding
1139 Record.push_back((unsigned)D->getPropertyImplementation());
1140 Record.AddDeclarationName(D->getGetterName());
1141 Record.AddSourceLocation(D->getGetterNameLoc());
1142 Record.AddDeclarationName(D->getSetterName());
1143 Record.AddSourceLocation(D->getSetterNameLoc());
1144 Record.AddDeclRef(D->getGetterMethodDecl());
1145 Record.AddDeclRef(D->getSetterMethodDecl());
1146 Record.AddDeclRef(D->getPropertyIvarDecl());
1148}
1149
1152 Record.AddDeclRef(D->getClassInterface());
1153 // Abstract class (no need to define a stable serialization::DECL code).
1154}
1155
1161
1164 Record.AddDeclRef(D->getSuperClass());
1165 Record.AddSourceLocation(D->getSuperClassLoc());
1166 Record.AddSourceLocation(D->getIvarLBraceLoc());
1167 Record.AddSourceLocation(D->getIvarRBraceLoc());
1168 Record.push_back(D->hasNonZeroConstructors());
1169 Record.push_back(D->hasDestructors());
1170 Record.push_back(D->NumIvarInitializers);
1171 if (D->NumIvarInitializers)
1172 Record.AddCXXCtorInitializers(
1173 llvm::ArrayRef(D->init_begin(), D->init_end()));
1175}
1176
1178 VisitDecl(D);
1179 Record.AddSourceLocation(D->getBeginLoc());
1180 Record.AddDeclRef(D->getPropertyDecl());
1181 Record.AddDeclRef(D->getPropertyIvarDecl());
1182 Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
1183 Record.AddDeclRef(D->getGetterMethodDecl());
1184 Record.AddDeclRef(D->getSetterMethodDecl());
1185 Record.AddStmt(D->getGetterCXXConstructor());
1186 Record.AddStmt(D->getSetterCXXAssignment());
1188}
1189
1192 Record.push_back(D->isMutable());
1193
1194 Record.push_back((D->StorageKind << 1) | D->BitField);
1195 if (D->StorageKind == FieldDecl::ISK_CapturedVLAType)
1196 Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
1197 else if (D->BitField)
1198 Record.AddStmt(D->getBitWidth());
1199
1200 if (!D->getDeclName() || D->isPlaceholderVar(Writer.getLangOpts()))
1201 Record.AddDeclRef(
1202 Record.getASTContext().getInstantiatedFromUnnamedFieldDecl(D));
1203
1204 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1205 !D->hasAttrs() &&
1206 !D->isImplicit() &&
1207 !D->isUsed(false) &&
1208 !D->isInvalidDecl() &&
1209 !D->isReferenced() &&
1211 !D->isModulePrivate() &&
1212 !D->getBitWidth() &&
1213 !D->hasInClassInitializer() &&
1214 !D->hasCapturedVLAType() &&
1215 !D->hasExtInfo() &&
1218 D->getDeclName())
1219 AbbrevToUse = Writer.getDeclFieldAbbrev();
1220
1222}
1223
1226 Record.AddIdentifierRef(D->getGetterId());
1227 Record.AddIdentifierRef(D->getSetterId());
1229}
1230
1232 VisitValueDecl(D);
1233 MSGuidDecl::Parts Parts = D->getParts();
1234 Record.push_back(Parts.Part1);
1235 Record.push_back(Parts.Part2);
1236 Record.push_back(Parts.Part3);
1237 Record.append(std::begin(Parts.Part4And5), std::end(Parts.Part4And5));
1239}
1240
1247
1253
1255 VisitValueDecl(D);
1256 Record.push_back(D->getChainingSize());
1257
1258 for (const auto *P : D->chain())
1259 Record.AddDeclRef(P);
1261}
1262
1266
1267 // The order matters here. It will be better to put the bit with higher
1268 // probability to be 0 in the end of the bits. See the comments in VisitDecl
1269 // for details.
1270 BitsPacker VarDeclBits;
1271 VarDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()),
1272 /*BitWidth=*/3);
1273
1274 bool ModulesCodegen = shouldVarGenerateHereOnly(D);
1275 VarDeclBits.addBit(ModulesCodegen);
1276
1277 VarDeclBits.addBits(D->getStorageClass(), /*BitWidth=*/3);
1278 VarDeclBits.addBits(D->getTSCSpec(), /*BitWidth=*/2);
1279 VarDeclBits.addBits(D->getInitStyle(), /*BitWidth=*/2);
1280 VarDeclBits.addBit(D->isARCPseudoStrong());
1281
1282 bool HasDeducedType = false;
1283 if (!isa<ParmVarDecl>(D)) {
1285 VarDeclBits.addBit(D->isExceptionVariable());
1286 VarDeclBits.addBit(D->isNRVOVariable());
1287 VarDeclBits.addBit(D->isCXXForRangeDecl());
1288
1289 VarDeclBits.addBit(D->isInline());
1290 VarDeclBits.addBit(D->isInlineSpecified());
1291 VarDeclBits.addBit(D->isConstexpr());
1292 VarDeclBits.addBit(D->isInitCapture());
1293 VarDeclBits.addBit(D->isPreviousDeclInSameBlockScope());
1294
1295 VarDeclBits.addBit(D->isEscapingByref());
1296 HasDeducedType = D->getType()->getContainedDeducedType();
1297 VarDeclBits.addBit(HasDeducedType);
1298
1299 if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
1300 VarDeclBits.addBits(llvm::to_underlying(IPD->getParameterKind()),
1301 /*Width=*/3);
1302 else
1303 VarDeclBits.addBits(0, /*Width=*/3);
1304
1305 VarDeclBits.addBit(D->isObjCForDecl());
1306 VarDeclBits.addBit(D->isCXXForRangeImplicitVar());
1307 }
1308
1309 Record.push_back(VarDeclBits);
1310
1311 if (ModulesCodegen)
1312 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);
1313
1314 if (D->hasAttr<BlocksAttr>()) {
1315 BlockVarCopyInit Init = Record.getASTContext().getBlockVarCopyInit(D);
1316 Record.AddStmt(Init.getCopyExpr());
1317 if (Init.getCopyExpr())
1318 Record.push_back(Init.canThrow());
1319 }
1320
1321 enum {
1322 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1323 };
1324 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1325 Record.push_back(VarTemplate);
1326 Record.AddDeclRef(TemplD);
1327 } else if (MemberSpecializationInfo *SpecInfo
1329 Record.push_back(StaticDataMemberSpecialization);
1330 Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1331 Record.push_back(SpecInfo->getTemplateSpecializationKind());
1332 Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1333 } else {
1334 Record.push_back(VarNotTemplate);
1335 }
1336
1337 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
1341 !D->hasExtInfo() && D->getFirstDecl() == D->getMostRecentDecl() &&
1342 D->getKind() == Decl::Var && !D->isInline() && !D->isConstexpr() &&
1344 !D->hasInitWithSideEffects() && !D->isEscapingByref() &&
1345 !HasDeducedType && D->getStorageDuration() != SD_Static &&
1348 !D->isEscapingByref())
1349 AbbrevToUse = Writer.getDeclVarAbbrev();
1350
1352}
1353
1358
1360 VisitVarDecl(D);
1361
1362 // See the implementation of `ParmVarDecl::getParameterIndex()`, which may
1363 // exceed the size of the normal bitfield. So it may be better to not pack
1364 // these bits.
1365 Record.push_back(D->getFunctionScopeIndex());
1366
1367 BitsPacker ParmVarDeclBits;
1368 ParmVarDeclBits.addBit(D->isObjCMethodParameter());
1369 ParmVarDeclBits.addBits(D->getFunctionScopeDepth(), /*BitsWidth=*/7);
1370 // FIXME: stable encoding
1371 ParmVarDeclBits.addBits(D->getObjCDeclQualifier(), /*BitsWidth=*/7);
1372 ParmVarDeclBits.addBit(D->isKNRPromoted());
1373 ParmVarDeclBits.addBit(D->hasInheritedDefaultArg());
1374 ParmVarDeclBits.addBit(D->hasUninstantiatedDefaultArg());
1375 ParmVarDeclBits.addBit(D->getExplicitObjectParamThisLoc().isValid());
1376 Record.push_back(ParmVarDeclBits);
1377
1379 Record.AddStmt(D->getUninstantiatedDefaultArg());
1381 Record.AddSourceLocation(D->getExplicitObjectParamThisLoc());
1383
1384 // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1385 // we dynamically check for the properties that we optimize for, but don't
1386 // know are true of all PARM_VAR_DECLs.
1387 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
1388 !D->hasExtInfo() && D->getStorageClass() == 0 && !D->isInvalidDecl() &&
1390 D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1391 D->getInit() == nullptr) // No default expr.
1392 AbbrevToUse = Writer.getDeclParmVarAbbrev();
1393
1394 // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1395 // just us assuming it.
1396 assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1398 && "PARM_VAR_DECL can't be demoted definition.");
1399 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1400 assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1401 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1402 assert(!D->isStaticDataMember() &&
1403 "PARM_VAR_DECL can't be static data member");
1404}
1405
1407 // Record the number of bindings first to simplify deserialization.
1408 Record.push_back(D->bindings().size());
1409
1410 VisitVarDecl(D);
1411 for (auto *B : D->bindings())
1412 Record.AddDeclRef(B);
1414}
1415
1417 VisitValueDecl(D);
1418 Record.AddStmt(D->getBinding());
1420}
1421
1423 VisitDecl(D);
1424 Record.AddStmt(D->getAsmStringExpr());
1425 Record.AddSourceLocation(D->getRParenLoc());
1427}
1428
1434
1439
1442 VisitDecl(D);
1443 Record.AddDeclRef(D->getExtendingDecl());
1444 Record.AddStmt(D->getTemporaryExpr());
1445 Record.push_back(static_cast<bool>(D->getValue()));
1446 if (D->getValue())
1447 Record.AddAPValue(*D->getValue());
1448 Record.push_back(D->getManglingNumber());
1450}
1452 VisitDecl(D);
1453 Record.AddStmt(D->getBody());
1454 Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1455 Record.push_back(D->param_size());
1456 for (ParmVarDecl *P : D->parameters())
1457 Record.AddDeclRef(P);
1458 Record.push_back(D->isVariadic());
1459 Record.push_back(D->blockMissingReturnType());
1460 Record.push_back(D->isConversionFromLambda());
1461 Record.push_back(D->doesNotEscape());
1462 Record.push_back(D->canAvoidCopyToHeap());
1463 Record.push_back(D->capturesCXXThis());
1464 Record.push_back(D->getNumCaptures());
1465 for (const auto &capture : D->captures()) {
1466 Record.AddDeclRef(capture.getVariable());
1467
1468 unsigned flags = 0;
1469 if (capture.isByRef()) flags |= 1;
1470 if (capture.isNested()) flags |= 2;
1471 if (capture.hasCopyExpr()) flags |= 4;
1472 Record.push_back(flags);
1473
1474 if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1475 }
1476
1478}
1479
1481 Record.push_back(D->getNumParams());
1482 VisitDecl(D);
1483 for (unsigned I = 0; I < D->getNumParams(); ++I)
1484 Record.AddDeclRef(D->getParam(I));
1485 Record.push_back(D->isNothrow() ? 1 : 0);
1486 Record.AddStmt(D->getBody());
1488}
1489
1491 Record.push_back(CD->getNumParams());
1492 VisitDecl(CD);
1493 Record.push_back(CD->getContextParamPosition());
1494 Record.push_back(CD->isNothrow() ? 1 : 0);
1495 // Body is stored by VisitCapturedStmt.
1496 for (unsigned I = 0; I < CD->getNumParams(); ++I)
1497 Record.AddDeclRef(CD->getParam(I));
1499}
1500
1502 static_assert(DeclContext::NumLinkageSpecDeclBits == 17,
1503 "You need to update the serializer after you change the"
1504 "LinkageSpecDeclBits");
1505
1506 VisitDecl(D);
1507 Record.push_back(llvm::to_underlying(D->getLanguage()));
1508 Record.AddSourceLocation(D->getExternLoc());
1509 Record.AddSourceLocation(D->getRBraceLoc());
1511}
1512
1514 VisitDecl(D);
1515 Record.AddSourceLocation(D->getRBraceLoc());
1517}
1518
1520 VisitNamedDecl(D);
1521 Record.AddSourceLocation(D->getBeginLoc());
1523}
1524
1525
1528 VisitNamedDecl(D);
1529
1530 BitsPacker NamespaceDeclBits;
1531 NamespaceDeclBits.addBit(D->isInline());
1532 NamespaceDeclBits.addBit(D->isNested());
1533 Record.push_back(NamespaceDeclBits);
1534
1535 Record.AddSourceLocation(D->getBeginLoc());
1536 Record.AddSourceLocation(D->getRBraceLoc());
1537
1538 if (D->isFirstDecl())
1539 Record.AddDeclRef(D->getAnonymousNamespace());
1541
1542 if (Writer.hasChain() && D->isAnonymousNamespace() &&
1543 D == D->getMostRecentDecl()) {
1544 // This is a most recent reopening of the anonymous namespace. If its parent
1545 // is in a previous PCH (or is the TU), mark that parent for update, because
1546 // the original namespace always points to the latest re-opening of its
1547 // anonymous namespace.
1548 Decl *Parent = cast<Decl>(
1550 if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1551 Writer.DeclUpdates[Parent].push_back(
1552 ASTWriter::DeclUpdate(DeclUpdateKind::CXXAddedAnonymousNamespace, D));
1553 }
1554 }
1555}
1556
1559 VisitNamedDecl(D);
1560 Record.AddSourceLocation(D->getNamespaceLoc());
1561 Record.AddSourceLocation(D->getTargetNameLoc());
1562 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1563 Record.AddDeclRef(D->getNamespace());
1565}
1566
1568 VisitNamedDecl(D);
1569 Record.AddSourceLocation(D->getUsingLoc());
1570 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1571 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1572 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1573 Record.push_back(D->hasTypename());
1574 Record.AddDeclRef(Record.getASTContext().getInstantiatedFromUsingDecl(D));
1576}
1577
1579 VisitNamedDecl(D);
1580 Record.AddSourceLocation(D->getUsingLoc());
1581 Record.AddSourceLocation(D->getEnumLoc());
1582 Record.AddTypeSourceInfo(D->getEnumType());
1583 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1584 Record.AddDeclRef(Record.getASTContext().getInstantiatedFromUsingEnumDecl(D));
1586}
1587
1589 Record.push_back(D->NumExpansions);
1590 VisitNamedDecl(D);
1591 Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
1592 for (auto *E : D->expansions())
1593 Record.AddDeclRef(E);
1595}
1596
1599 VisitNamedDecl(D);
1600 Record.AddDeclRef(D->getTargetDecl());
1601 Record.push_back(D->getIdentifierNamespace());
1602 Record.AddDeclRef(D->UsingOrNextShadow);
1603 Record.AddDeclRef(
1604 Record.getASTContext().getInstantiatedFromUsingShadowDecl(D));
1605
1606 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1607 D->getFirstDecl() == D->getMostRecentDecl() && !D->hasAttrs() &&
1610 AbbrevToUse = Writer.getDeclUsingShadowAbbrev();
1611
1613}
1614
1618 Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1619 Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1620 Record.push_back(D->IsVirtual);
1622}
1623
1625 VisitNamedDecl(D);
1626 Record.AddSourceLocation(D->getUsingLoc());
1627 Record.AddSourceLocation(D->getNamespaceKeyLocation());
1628 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1629 Record.AddDeclRef(D->getNominatedNamespace());
1630 Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1632}
1633
1635 VisitValueDecl(D);
1636 Record.AddSourceLocation(D->getUsingLoc());
1637 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1638 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1639 Record.AddSourceLocation(D->getEllipsisLoc());
1641}
1642
1645 VisitTypeDecl(D);
1646 Record.AddSourceLocation(D->getTypenameLoc());
1647 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1648 Record.AddSourceLocation(D->getEllipsisLoc());
1650}
1651
1657
1659 VisitRecordDecl(D);
1660
1661 enum {
1662 CXXRecNotTemplate = 0,
1663 CXXRecTemplate,
1664 CXXRecMemberSpecialization,
1665 CXXLambda
1666 };
1667 if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1668 Record.push_back(CXXRecTemplate);
1669 Record.AddDeclRef(TemplD);
1670 } else if (MemberSpecializationInfo *MSInfo
1672 Record.push_back(CXXRecMemberSpecialization);
1673 Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1674 Record.push_back(MSInfo->getTemplateSpecializationKind());
1675 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1676 } else if (D->isLambda()) {
1677 // For a lambda, we need some information early for merging.
1678 Record.push_back(CXXLambda);
1679 if (auto *Context = D->getLambdaContextDecl()) {
1680 Record.AddDeclRef(Context);
1681 Record.push_back(D->getLambdaIndexInContext());
1682 } else {
1683 Record.push_back(0);
1684 }
1685 // For lambdas inside template functions, remember the mapping to
1686 // deserialize them together.
1687 if (auto *FD = llvm::dyn_cast_or_null<FunctionDecl>(D->getDeclContext());
1688 FD && isDefinitionInDependentContext(FD)) {
1689 Writer.RelatedDeclsMap[Writer.GetDeclRef(FD)].push_back(
1690 Writer.GetDeclRef(D->getLambdaCallOperator()));
1691 }
1692 } else {
1693 Record.push_back(CXXRecNotTemplate);
1694 }
1695
1696 Record.push_back(D->isThisDeclarationADefinition());
1698 Record.AddCXXDefinitionData(D);
1699
1700 if (D->isCompleteDefinition() && D->isInNamedModule())
1701 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);
1702
1703 // Store (what we currently believe to be) the key function to avoid
1704 // deserializing every method so we can compute it.
1705 //
1706 // FIXME: Avoid adding the key function if the class is defined in
1707 // module purview since in that case the key function is meaningless.
1708 if (D->isCompleteDefinition())
1709 Record.AddDeclRef(Record.getASTContext().getCurrentKeyFunction(D));
1710
1712}
1713
1716 if (D->isCanonicalDecl()) {
1717 Record.push_back(D->size_overridden_methods());
1718 for (const CXXMethodDecl *MD : D->overridden_methods())
1719 Record.AddDeclRef(MD);
1720 } else {
1721 // We only need to record overridden methods once for the canonical decl.
1722 Record.push_back(0);
1723 }
1724
1725 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1726 D->getFirstDecl() == D->getMostRecentDecl() && !D->isInvalidDecl() &&
1727 !D->hasAttrs() && !D->isTopLevelDeclInObjCContainer() &&
1729 !D->hasExtInfo() && !D->isExplicitlyDefaulted()) {
1734 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1735 else if (D->getTemplatedKind() ==
1739
1740 if (FTSInfo->TemplateArguments->size() == 1) {
1741 const TemplateArgument &TA = FTSInfo->TemplateArguments->get(0);
1742 if (TA.getKind() == TemplateArgument::Type &&
1743 !FTSInfo->TemplateArgumentsAsWritten &&
1744 !FTSInfo->getMemberSpecializationInfo())
1745 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1746 }
1747 } else if (D->getTemplatedKind() ==
1751 if (!DFTSInfo->TemplateArgumentsAsWritten)
1752 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1753 }
1754 }
1755
1757}
1758
1760 static_assert(DeclContext::NumCXXConstructorDeclBits == 64,
1761 "You need to update the serializer after you change the "
1762 "CXXConstructorDeclBits");
1763
1764 Record.push_back(D->getTrailingAllocKind());
1765 addExplicitSpecifier(D->getExplicitSpecifierInternal(), Record);
1766 if (auto Inherited = D->getInheritedConstructor()) {
1767 Record.AddDeclRef(Inherited.getShadowDecl());
1768 Record.AddDeclRef(Inherited.getConstructor());
1769 }
1770
1773}
1774
1777
1778 Record.AddDeclRef(D->getOperatorDelete());
1779 if (D->getOperatorDelete())
1780 Record.AddStmt(D->getOperatorDeleteThisArg());
1781 Record.AddDeclRef(D->getOperatorGlobalDelete());
1782 Record.AddDeclRef(D->getArrayOperatorDelete());
1783 Record.AddDeclRef(D->getGlobalArrayOperatorDelete());
1784
1786}
1787
1793
1795 VisitDecl(D);
1796 Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1797 ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1798 Record.push_back(!IdentifierLocs.empty());
1799 if (IdentifierLocs.empty()) {
1800 Record.AddSourceLocation(D->getEndLoc());
1801 Record.push_back(1);
1802 } else {
1803 for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1804 Record.AddSourceLocation(IdentifierLocs[I]);
1805 Record.push_back(IdentifierLocs.size());
1806 }
1807 // Note: the number of source locations must always be the last element in
1808 // the record.
1810}
1811
1813 VisitDecl(D);
1814 Record.AddSourceLocation(D->getColonLoc());
1816}
1817
1819 // Record the number of friend type template parameter lists here
1820 // so as to simplify memory allocation during deserialization.
1821 Record.push_back(D->NumTPLists);
1822 VisitDecl(D);
1823 bool hasFriendDecl = isa<NamedDecl *>(D->Friend);
1824 Record.push_back(hasFriendDecl);
1825 if (hasFriendDecl)
1826 Record.AddDeclRef(D->getFriendDecl());
1827 else
1828 Record.AddTypeSourceInfo(D->getFriendType());
1829 for (unsigned i = 0; i < D->NumTPLists; ++i)
1830 Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1831 Record.AddDeclRef(D->getNextFriend());
1832 Record.push_back(D->UnsupportedFriend);
1833 Record.AddSourceLocation(D->FriendLoc);
1834 Record.AddSourceLocation(D->EllipsisLoc);
1836}
1837
1839 VisitDecl(D);
1840 Record.push_back(D->getNumTemplateParameters());
1841 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1842 Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1843 Record.push_back(D->getFriendDecl() != nullptr);
1844 if (D->getFriendDecl())
1845 Record.AddDeclRef(D->getFriendDecl());
1846 else
1847 Record.AddTypeSourceInfo(D->getFriendType());
1848 Record.AddSourceLocation(D->getFriendLoc());
1850}
1851
1853 VisitNamedDecl(D);
1854
1855 Record.AddTemplateParameterList(D->getTemplateParameters());
1856 Record.AddDeclRef(D->getTemplatedDecl());
1857}
1858
1864
1867 Record.push_back(D->getTemplateArguments().size());
1868 VisitDecl(D);
1869 for (const TemplateArgument &Arg : D->getTemplateArguments())
1870 Record.AddTemplateArgument(Arg);
1872}
1873
1877
1880
1881 // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1882 // getCommonPtr() can be used while this is still initializing.
1883 if (D->isFirstDecl()) {
1884 // This declaration owns the 'common' pointer, so serialize that data now.
1885 Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());
1887 Record.push_back(D->isMemberSpecialization());
1888 }
1889
1891 Record.push_back(D->getIdentifierNamespace());
1892}
1893
1896
1897 if (D->isFirstDecl())
1899
1900 // Force emitting the corresponding deduction guide in reduced BMI mode.
1901 // Otherwise, the deduction guide may be optimized out incorrectly.
1902 if (Writer.isGeneratingReducedBMI()) {
1903 auto Name =
1904 Record.getASTContext().DeclarationNames.getCXXDeductionGuideName(D);
1905 for (auto *DG : D->getDeclContext()->noload_lookup(Name))
1906 Writer.GetDeclRef(DG->getCanonicalDecl());
1907 }
1908
1910}
1911
1915
1917
1918 llvm::PointerUnion<ClassTemplateDecl *,
1921 if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1922 Record.AddDeclRef(InstFromD);
1923 } else {
1924 Record.AddDeclRef(cast<ClassTemplatePartialSpecializationDecl *>(InstFrom));
1925 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1926 }
1927
1928 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1929 Record.AddSourceLocation(D->getPointOfInstantiation());
1930 Record.push_back(D->getSpecializationKind());
1931 Record.push_back(D->hasStrictPackMatch());
1932 Record.push_back(D->isCanonicalDecl());
1933
1934 if (D->isCanonicalDecl()) {
1935 // When reading, we'll add it to the folding set of the following template.
1936 Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1937 }
1938
1943 Record.push_back(ExplicitInstantiation);
1945 Record.AddSourceLocation(D->getExternKeywordLoc());
1946 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1947 }
1948
1949 const ASTTemplateArgumentListInfo *ArgsWritten =
1951 Record.push_back(!!ArgsWritten);
1952 if (ArgsWritten)
1953 Record.AddASTTemplateArgumentListInfo(ArgsWritten);
1954
1955 // Mention the implicitly generated C++ deduction guide to make sure the
1956 // deduction guide will be rewritten as expected.
1957 //
1958 // FIXME: Would it be more efficient to add a callback register function
1959 // in sema to register the deduction guide?
1960 if (Writer.isWritingStdCXXNamedModules()) {
1961 auto Name =
1962 Record.getASTContext().DeclarationNames.getCXXDeductionGuideName(
1964 for (auto *DG : D->getDeclContext()->noload_lookup(Name))
1965 Writer.GetDeclRef(DG->getCanonicalDecl());
1966 }
1967
1969}
1970
1973 Record.AddTemplateParameterList(D->getTemplateParameters());
1974
1976
1977 // These are read/set from/to the first declaration.
1978 if (D->getPreviousDecl() == nullptr) {
1979 Record.AddDeclRef(D->getInstantiatedFromMember());
1980 Record.push_back(D->isMemberSpecialization());
1981 }
1982
1984}
1985
1993
1997
1998 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1999 InstFrom = D->getSpecializedTemplateOrPartial();
2000 if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
2001 Record.AddDeclRef(InstFromD);
2002 } else {
2003 Record.AddDeclRef(cast<VarTemplatePartialSpecializationDecl *>(InstFrom));
2004 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
2005 }
2006
2011 Record.push_back(ExplicitInstantiation);
2013 Record.AddSourceLocation(D->getExternKeywordLoc());
2014 Record.AddSourceLocation(D->getTemplateKeywordLoc());
2015 }
2016
2017 const ASTTemplateArgumentListInfo *ArgsWritten =
2019 Record.push_back(!!ArgsWritten);
2020 if (ArgsWritten)
2021 Record.AddASTTemplateArgumentListInfo(ArgsWritten);
2022
2023 Record.AddTemplateArgumentList(&D->getTemplateArgs());
2024 Record.AddSourceLocation(D->getPointOfInstantiation());
2025 Record.push_back(D->getSpecializationKind());
2026 Record.push_back(D->IsCompleteDefinition);
2027
2028 VisitVarDecl(D);
2029
2030 Record.push_back(D->isCanonicalDecl());
2031
2032 if (D->isCanonicalDecl()) {
2033 // When reading, we'll add it to the folding set of the following template.
2034 Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
2035 }
2036
2038}
2039
2042 Record.AddTemplateParameterList(D->getTemplateParameters());
2043
2045
2046 // These are read/set from/to the first declaration.
2047 if (D->getPreviousDecl() == nullptr) {
2048 Record.AddDeclRef(D->getInstantiatedFromMember());
2049 Record.push_back(D->isMemberSpecialization());
2050 }
2051
2053}
2054
2062
2064 Record.push_back(D->hasTypeConstraint());
2065 VisitTypeDecl(D);
2066
2067 Record.push_back(D->wasDeclaredWithTypename());
2068
2069 const TypeConstraint *TC = D->getTypeConstraint();
2070 if (D->hasTypeConstraint())
2071 Record.push_back(/*TypeConstraintInitialized=*/TC != nullptr);
2072 if (TC) {
2073 auto *CR = TC->getConceptReference();
2074 Record.push_back(CR != nullptr);
2075 if (CR)
2076 Record.AddConceptReference(CR);
2077 Record.AddStmt(TC->getImmediatelyDeclaredConstraint());
2078 Record.writeUnsignedOrNone(TC->getArgPackSubstIndex());
2079 Record.writeUnsignedOrNone(D->getNumExpansionParameters());
2080 }
2081
2082 bool OwnsDefaultArg = D->hasDefaultArgument() &&
2084 Record.push_back(OwnsDefaultArg);
2085 if (OwnsDefaultArg)
2086 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
2087
2088 if (!D->hasTypeConstraint() && !OwnsDefaultArg &&
2090 !D->isInvalidDecl() && !D->hasAttrs() &&
2093 AbbrevToUse = Writer.getDeclTemplateTypeParmAbbrev();
2094
2096}
2097
2099 // For an expanded parameter pack, record the number of expansion types here
2100 // so that it's easier for deserialization to allocate the right amount of
2101 // memory.
2102 Record.push_back(D->hasPlaceholderTypeConstraint());
2103 if (D->isExpandedParameterPack())
2104 Record.push_back(D->getNumExpansionTypes());
2105
2107 // TemplateParmPosition.
2108 Record.push_back(D->getDepth());
2109 Record.push_back(D->getPosition());
2110
2112 Record.AddStmt(D->getPlaceholderTypeConstraint());
2113
2114 if (D->isExpandedParameterPack()) {
2115 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
2116 Record.AddTypeRef(D->getExpansionType(I));
2117 Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
2118 }
2119
2121 } else {
2122 // Rest of NonTypeTemplateParmDecl.
2123 Record.push_back(D->isParameterPack());
2124 bool OwnsDefaultArg = D->hasDefaultArgument() &&
2126 Record.push_back(OwnsDefaultArg);
2127 if (OwnsDefaultArg)
2128 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
2130 }
2131}
2132
2134 // For an expanded parameter pack, record the number of expansion types here
2135 // so that it's easier for deserialization to allocate the right amount of
2136 // memory.
2137 if (D->isExpandedParameterPack())
2138 Record.push_back(D->getNumExpansionTemplateParameters());
2139
2141 Record.push_back(D->templateParameterKind());
2142 Record.push_back(D->wasDeclaredWithTypename());
2143 // TemplateParmPosition.
2144 Record.push_back(D->getDepth());
2145 Record.push_back(D->getPosition());
2146
2147 if (D->isExpandedParameterPack()) {
2148 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
2149 I != N; ++I)
2150 Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
2152 } else {
2153 // Rest of TemplateTemplateParmDecl.
2154 Record.push_back(D->isParameterPack());
2155 bool OwnsDefaultArg = D->hasDefaultArgument() &&
2157 Record.push_back(OwnsDefaultArg);
2158 if (OwnsDefaultArg)
2159 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
2161 }
2162}
2163
2168
2170 VisitDecl(D);
2171 Record.AddStmt(D->getAssertExpr());
2172 Record.push_back(D->isFailed());
2173 Record.AddStmt(D->getMessage());
2174 Record.AddSourceLocation(D->getRParenLoc());
2176}
2177
2178/// Emit the DeclContext part of a declaration context decl.
2180 static_assert(DeclContext::NumDeclContextBits == 13,
2181 "You need to update the serializer after you change the "
2182 "DeclContextBits");
2183 LookupBlockOffsets Offsets;
2184
2185 if (Writer.isGeneratingReducedBMI() && isa<NamespaceDecl>(DC) &&
2186 cast<NamespaceDecl>(DC)->isFromExplicitGlobalModule()) {
2187 // In reduced BMI, delay writing lexical and visible block for namespace
2188 // in the global module fragment. See the comments of DelayedNamespace for
2189 // details.
2190 Writer.DelayedNamespace.push_back(cast<NamespaceDecl>(DC));
2191 } else {
2192 Offsets.LexicalOffset =
2193 Writer.WriteDeclContextLexicalBlock(Record.getASTContext(), DC);
2194 Writer.WriteDeclContextVisibleBlock(Record.getASTContext(), DC, Offsets);
2195 }
2196
2197 Record.AddLookupOffsets(Offsets);
2198}
2199
2201 assert(IsLocalDecl(D) && "expected a local declaration");
2202
2203 const Decl *Canon = D->getCanonicalDecl();
2204 if (IsLocalDecl(Canon))
2205 return Canon;
2206
2207 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
2208 if (CacheEntry)
2209 return CacheEntry;
2210
2211 for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
2212 if (IsLocalDecl(Redecl))
2213 D = Redecl;
2214 return CacheEntry = D;
2215}
2216
2217template <typename T>
2219 T *First = D->getFirstDecl();
2220 T *MostRecent = First->getMostRecentDecl();
2221 T *DAsT = static_cast<T *>(D);
2222 if (MostRecent != First) {
2223 assert(isRedeclarableDeclKind(DAsT->getKind()) &&
2224 "Not considered redeclarable?");
2225
2226 Record.AddDeclRef(First);
2227
2228 // Write out a list of local redeclarations of this declaration if it's the
2229 // first local declaration in the chain.
2230 const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
2231 if (DAsT == FirstLocal) {
2232 // Emit a list of all imported first declarations so that we can be sure
2233 // that all redeclarations visible to this module are before D in the
2234 // redecl chain.
2235 unsigned I = Record.size();
2236 Record.push_back(0);
2237 if (Writer.Chain)
2238 AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
2239 // This is the number of imported first declarations + 1.
2240 Record[I] = Record.size() - I;
2241
2242 // Collect the set of local redeclarations of this declaration, from
2243 // newest to oldest.
2244 ASTWriter::RecordData LocalRedecls;
2245 ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
2246 for (const Decl *Prev = FirstLocal->getMostRecentDecl();
2247 Prev != FirstLocal; Prev = Prev->getPreviousDecl())
2248 if (!Prev->isFromASTFile())
2249 LocalRedeclWriter.AddDeclRef(Prev);
2250
2251 // If we have any redecls, write them now as a separate record preceding
2252 // the declaration itself.
2253 if (LocalRedecls.empty())
2254 Record.push_back(0);
2255 else
2256 Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
2257 } else {
2258 Record.push_back(0);
2259 Record.AddDeclRef(FirstLocal);
2260 }
2261
2262 // Make sure that we serialize both the previous and the most-recent
2263 // declarations, which (transitively) ensures that all declarations in the
2264 // chain get serialized.
2265 //
2266 // FIXME: This is not correct; when we reach an imported declaration we
2267 // won't emit its previous declaration.
2268 (void)Writer.GetDeclRef(D->getPreviousDecl());
2269 (void)Writer.GetDeclRef(MostRecent);
2270 } else {
2271 // We use the sentinel value 0 to indicate an only declaration.
2272 Record.push_back(0);
2273 }
2274}
2275
2277 VisitNamedDecl(D);
2279 Record.push_back(D->isCBuffer());
2280 Record.AddSourceLocation(D->getLocStart());
2281 Record.AddSourceLocation(D->getLBraceLoc());
2282 Record.AddSourceLocation(D->getRBraceLoc());
2283
2285}
2286
2288 Record.writeOMPChildren(D->Data);
2289 VisitDecl(D);
2291}
2292
2294 Record.writeOMPChildren(D->Data);
2295 VisitDecl(D);
2297}
2298
2300 Record.writeOMPChildren(D->Data);
2301 VisitDecl(D);
2303}
2304
2307 "You need to update the serializer after you change the "
2308 "NumOMPDeclareReductionDeclBits");
2309
2310 VisitValueDecl(D);
2311 Record.AddSourceLocation(D->getBeginLoc());
2312 Record.AddStmt(D->getCombinerIn());
2313 Record.AddStmt(D->getCombinerOut());
2314 Record.AddStmt(D->getCombiner());
2315 Record.AddStmt(D->getInitOrig());
2316 Record.AddStmt(D->getInitPriv());
2317 Record.AddStmt(D->getInitializer());
2318 Record.push_back(llvm::to_underlying(D->getInitializerKind()));
2319 Record.AddDeclRef(D->getPrevDeclInScope());
2321}
2322
2324 Record.writeOMPChildren(D->Data);
2325 VisitValueDecl(D);
2326 Record.AddDeclarationName(D->getVarName());
2327 Record.AddDeclRef(D->getPrevDeclInScope());
2329}
2330
2335
2337 Record.writeUInt32(D->clauses().size());
2338 VisitDecl(D);
2339 Record.writeEnum(D->DirKind);
2340 Record.AddSourceLocation(D->DirectiveLoc);
2341 Record.AddSourceLocation(D->EndLoc);
2342 Record.writeOpenACCClauseList(D->clauses());
2344}
2346 Record.writeUInt32(D->clauses().size());
2347 VisitDecl(D);
2348 Record.writeEnum(D->DirKind);
2349 Record.AddSourceLocation(D->DirectiveLoc);
2350 Record.AddSourceLocation(D->EndLoc);
2351 Record.AddSourceRange(D->ParensLoc);
2352 Record.AddStmt(D->FuncRef);
2353 Record.writeOpenACCClauseList(D->clauses());
2355}
2356
2357//===----------------------------------------------------------------------===//
2358// ASTWriter Implementation
2359//===----------------------------------------------------------------------===//
2360
2361namespace {
2362template <FunctionDecl::TemplatedKind Kind>
2363std::shared_ptr<llvm::BitCodeAbbrev>
2364getFunctionDeclAbbrev(serialization::DeclCode Code) {
2365 using namespace llvm;
2366
2367 auto Abv = std::make_shared<BitCodeAbbrev>();
2368 Abv->Add(BitCodeAbbrevOp(Code));
2369 // RedeclarableDecl
2370 Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2371 Abv->Add(BitCodeAbbrevOp(Kind));
2372 if constexpr (Kind == FunctionDecl::TK_NonTemplate) {
2373
2374 } else if constexpr (Kind == FunctionDecl::TK_FunctionTemplate) {
2375 // DescribedFunctionTemplate
2376 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2377 } else if constexpr (Kind == FunctionDecl::TK_DependentNonTemplate) {
2378 // Instantiated From Decl
2379 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2380 } else if constexpr (Kind == FunctionDecl::TK_MemberSpecialization) {
2381 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedFrom
2382 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2383 3)); // TemplateSpecializationKind
2384 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Specialized Location
2385 } else if constexpr (Kind ==
2387 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template
2388 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2389 3)); // TemplateSpecializationKind
2390 Abv->Add(BitCodeAbbrevOp(1)); // Template Argument Size
2391 Abv->Add(BitCodeAbbrevOp(TemplateArgument::Type)); // Template Argument Kind
2392 Abv->Add(
2393 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template Argument Type
2394 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Is Defaulted
2395 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2396 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2397 Abv->Add(BitCodeAbbrevOp(0));
2398 Abv->Add(
2399 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Canonical Decl of template
2400 } else if constexpr (Kind == FunctionDecl::
2401 TK_DependentFunctionTemplateSpecialization) {
2402 // Candidates of specialization
2403 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2404 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2405 } else {
2406 llvm_unreachable("Unknown templated kind?");
2407 }
2408 // Decl
2409 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2410 8)); // Packed DeclBits: ModuleOwnershipKind,
2411 // isUsed, isReferenced, AccessSpecifier,
2412 // isImplicit
2413 //
2414 // The following bits should be 0:
2415 // HasStandaloneLexicalDC, HasAttrs,
2416 // TopLevelDeclInObjCContainer,
2417 // isInvalidDecl
2418 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2419 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2420 // NamedDecl
2421 Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2422 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2423 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2424 // ValueDecl
2425 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2426 // DeclaratorDecl
2427 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2428 Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2429 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2430 // FunctionDecl
2431 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2432 Abv->Add(BitCodeAbbrevOp(
2433 BitCodeAbbrevOp::Fixed,
2434 28)); // Packed Function Bits: StorageClass, Inline, InlineSpecified,
2435 // VirtualAsWritten, Pure, HasInheritedProto, HasWrittenProto,
2436 // Deleted, Trivial, TrivialForCall, Defaulted, ExplicitlyDefaulted,
2437 // IsIneligibleOrNotSelected, ImplicitReturnZero, Constexpr,
2438 // UsesSEHTry, SkippedBody, MultiVersion, LateParsed,
2439 // FriendConstraintRefersToEnclosingTemplate, Linkage,
2440 // ShouldSkipCheckingODR
2441 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2442 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2443 // This Array slurps the rest of the record. Fortunately we want to encode
2444 // (nearly) all the remaining (variable number of) fields in the same way.
2445 //
2446 // This is:
2447 // NumParams and Params[] from FunctionDecl, and
2448 // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2449 //
2450 // Add an AbbrevOp for 'size then elements' and use it here.
2451 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2452 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2453 return Abv;
2454}
2455
2456template <FunctionDecl::TemplatedKind Kind>
2457std::shared_ptr<llvm::BitCodeAbbrev> getCXXMethodAbbrev() {
2458 return getFunctionDeclAbbrev<Kind>(serialization::DECL_CXX_METHOD);
2459}
2460} // namespace
2461
2462void ASTWriter::WriteDeclAbbrevs() {
2463 using namespace llvm;
2464
2465 std::shared_ptr<BitCodeAbbrev> Abv;
2466
2467 // Abbreviation for DECL_FIELD
2468 Abv = std::make_shared<BitCodeAbbrev>();
2469 Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
2470 // Decl
2471 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2472 7)); // Packed DeclBits: ModuleOwnershipKind,
2473 // isUsed, isReferenced, AccessSpecifier,
2474 //
2475 // The following bits should be 0:
2476 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2477 // TopLevelDeclInObjCContainer,
2478 // isInvalidDecl
2479 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2480 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2481 // NamedDecl
2482 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2483 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2484 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2485 // ValueDecl
2486 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2487 // DeclaratorDecl
2488 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2489 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2490 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2491 // FieldDecl
2492 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2493 Abv->Add(BitCodeAbbrevOp(0)); // StorageKind
2494 // Type Source Info
2495 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2496 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2497 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
2498
2499 // Abbreviation for DECL_OBJC_IVAR
2500 Abv = std::make_shared<BitCodeAbbrev>();
2501 Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
2502 // Decl
2503 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2504 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2505 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2506 // isReferenced, TopLevelDeclInObjCContainer,
2507 // AccessSpecifier, ModuleOwnershipKind
2508 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2509 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2510 // NamedDecl
2511 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2512 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2513 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2514 // ValueDecl
2515 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2516 // DeclaratorDecl
2517 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2518 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2519 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2520 // FieldDecl
2521 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2522 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2523 // ObjC Ivar
2524 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
2525 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
2526 // Type Source Info
2527 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2528 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2529 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2530
2531 // Abbreviation for DECL_ENUM
2532 Abv = std::make_shared<BitCodeAbbrev>();
2533 Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
2534 // Redeclarable
2535 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2536 // Decl
2537 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2538 7)); // Packed DeclBits: ModuleOwnershipKind,
2539 // isUsed, isReferenced, AccessSpecifier,
2540 //
2541 // The following bits should be 0:
2542 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2543 // TopLevelDeclInObjCContainer,
2544 // isInvalidDecl
2545 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2546 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2547 // NamedDecl
2548 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2549 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2550 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2551 // TypeDecl
2552 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2553 // TagDecl
2554 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2555 Abv->Add(BitCodeAbbrevOp(
2556 BitCodeAbbrevOp::Fixed,
2557 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2558 // EmbeddedInDeclarator, IsFreeStanding,
2559 // isCompleteDefinitionRequired, ExtInfoKind
2560 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2561 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2562 // EnumDecl
2563 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
2564 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
2565 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
2566 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 20)); // Enum Decl Bits
2567 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
2568 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
2569 // DC
2570 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2571 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2572 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ModuleLocalOffset
2573 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TULocalOffset
2574 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2575
2576 // Abbreviation for DECL_RECORD
2577 Abv = std::make_shared<BitCodeAbbrev>();
2578 Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
2579 // Redeclarable
2580 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2581 // Decl
2582 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2583 7)); // Packed DeclBits: ModuleOwnershipKind,
2584 // isUsed, isReferenced, AccessSpecifier,
2585 //
2586 // The following bits should be 0:
2587 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2588 // TopLevelDeclInObjCContainer,
2589 // isInvalidDecl
2590 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2591 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2592 // NamedDecl
2593 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2594 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2595 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2596 // TypeDecl
2597 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2598 // TagDecl
2599 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2600 Abv->Add(BitCodeAbbrevOp(
2601 BitCodeAbbrevOp::Fixed,
2602 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2603 // EmbeddedInDeclarator, IsFreeStanding,
2604 // isCompleteDefinitionRequired, ExtInfoKind
2605 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2606 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2607 // RecordDecl
2608 Abv->Add(BitCodeAbbrevOp(
2609 BitCodeAbbrevOp::Fixed,
2610 14)); // Packed Record Decl Bits: FlexibleArrayMember,
2611 // AnonymousStructUnion, hasObjectMember, hasVolatileMember,
2612 // isNonTrivialToPrimitiveDefaultInitialize,
2613 // isNonTrivialToPrimitiveCopy, isNonTrivialToPrimitiveDestroy,
2614 // hasNonTrivialToPrimitiveDefaultInitializeCUnion,
2615 // hasNonTrivialToPrimitiveDestructCUnion,
2616 // hasNonTrivialToPrimitiveCopyCUnion,
2617 // hasUninitializedExplicitInitFields, isParamDestroyedInCallee,
2618 // getArgPassingRestrictions
2619 // ODRHash
2620 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));
2621
2622 // DC
2623 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2624 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2625 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ModuleLocalOffset
2626 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TULocalOffset
2627 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2628
2629 // Abbreviation for DECL_PARM_VAR
2630 Abv = std::make_shared<BitCodeAbbrev>();
2631 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2632 // Redeclarable
2633 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2634 // Decl
2635 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2636 8)); // Packed DeclBits: ModuleOwnershipKind, isUsed,
2637 // isReferenced, AccessSpecifier,
2638 // HasStandaloneLexicalDC, HasAttrs, isImplicit,
2639 // TopLevelDeclInObjCContainer,
2640 // isInvalidDecl,
2641 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2642 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2643 // NamedDecl
2644 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2645 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2646 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2647 // ValueDecl
2648 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2649 // DeclaratorDecl
2650 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2651 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2652 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2653 // VarDecl
2654 Abv->Add(
2655 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2656 12)); // Packed Var Decl bits: SClass, TSCSpec, InitStyle,
2657 // isARCPseudoStrong, Linkage, ModulesCodegen
2658 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2659 // ParmVarDecl
2660 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2661 Abv->Add(BitCodeAbbrevOp(
2662 BitCodeAbbrevOp::Fixed,
2663 19)); // Packed Parm Var Decl bits: IsObjCMethodParameter, ScopeDepth,
2664 // ObjCDeclQualifier, KNRPromoted,
2665 // HasInheritedDefaultArg, HasUninstantiatedDefaultArg
2666 // Type Source Info
2667 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2668 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2669 DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2670
2671 // Abbreviation for DECL_TYPEDEF
2672 Abv = std::make_shared<BitCodeAbbrev>();
2673 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2674 // Redeclarable
2675 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2676 // Decl
2677 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2678 7)); // Packed DeclBits: ModuleOwnershipKind,
2679 // isReferenced, isUsed, AccessSpecifier. Other
2680 // higher bits should be 0: isImplicit,
2681 // HasStandaloneLexicalDC, HasAttrs,
2682 // TopLevelDeclInObjCContainer, isInvalidDecl
2683 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2684 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2685 // NamedDecl
2686 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2687 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2688 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2689 // TypeDecl
2690 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2691 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2692 // TypedefDecl
2693 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2694 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2695 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2696
2697 // Abbreviation for DECL_VAR
2698 Abv = std::make_shared<BitCodeAbbrev>();
2699 Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2700 // Redeclarable
2701 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2702 // Decl
2703 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2704 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2705 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2706 // isReferenced, TopLevelDeclInObjCContainer,
2707 // AccessSpecifier, ModuleOwnershipKind
2708 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2709 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2710 // NamedDecl
2711 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2712 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2713 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2714 // ValueDecl
2715 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2716 // DeclaratorDecl
2717 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2718 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2719 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2720 // VarDecl
2721 Abv->Add(BitCodeAbbrevOp(
2722 BitCodeAbbrevOp::Fixed,
2723 22)); // Packed Var Decl bits: Linkage, ModulesCodegen,
2724 // SClass, TSCSpec, InitStyle,
2725 // isARCPseudoStrong, IsThisDeclarationADemotedDefinition,
2726 // isExceptionVariable, isNRVOVariable, isCXXForRangeDecl,
2727 // isInline, isInlineSpecified, isConstexpr,
2728 // isInitCapture, isPrevDeclInSameScope, hasInitWithSideEffects,
2729 // EscapingByref, HasDeducedType, ImplicitParamKind, isObjCForDecl
2730 // IsCXXForRangeImplicitVar
2731 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2732 // Type Source Info
2733 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2734 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2735 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2736
2737 // Abbreviation for DECL_CXX_METHOD
2738 DeclCXXMethodAbbrev =
2739 Stream.EmitAbbrev(getCXXMethodAbbrev<FunctionDecl::TK_NonTemplate>());
2740 DeclTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2741 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplate>());
2742 DeclDependentNonTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2743 getCXXMethodAbbrev<FunctionDecl::TK_DependentNonTemplate>());
2744 DeclMemberSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2745 getCXXMethodAbbrev<FunctionDecl::TK_MemberSpecialization>());
2746 DeclTemplateSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2747 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplateSpecialization>());
2748 DeclDependentSpecializationCXXMethodAbbrev = Stream.EmitAbbrev(
2749 getCXXMethodAbbrev<
2751
2752 // Abbreviation for DECL_TEMPLATE_TYPE_PARM
2753 Abv = std::make_shared<BitCodeAbbrev>();
2754 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TEMPLATE_TYPE_PARM));
2755 Abv->Add(BitCodeAbbrevOp(0)); // hasTypeConstraint
2756 // Decl
2757 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2758 7)); // Packed DeclBits: ModuleOwnershipKind,
2759 // isReferenced, isUsed, AccessSpecifier. Other
2760 // higher bits should be 0: isImplicit,
2761 // HasStandaloneLexicalDC, HasAttrs,
2762 // TopLevelDeclInObjCContainer, isInvalidDecl
2763 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2764 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2765 // NamedDecl
2766 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2767 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2768 Abv->Add(BitCodeAbbrevOp(0));
2769 // TypeDecl
2770 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2771 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2772 // TemplateTypeParmDecl
2773 Abv->Add(
2774 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // wasDeclaredWithTypename
2775 Abv->Add(BitCodeAbbrevOp(0)); // OwnsDefaultArg
2776 DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));
2777
2778 // Abbreviation for DECL_USING_SHADOW
2779 Abv = std::make_shared<BitCodeAbbrev>();
2780 Abv->Add(BitCodeAbbrevOp(serialization::DECL_USING_SHADOW));
2781 // Redeclarable
2782 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2783 // Decl
2784 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2785 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2786 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2787 // isReferenced, TopLevelDeclInObjCContainer,
2788 // AccessSpecifier, ModuleOwnershipKind
2789 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2790 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2791 // NamedDecl
2792 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2793 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2794 Abv->Add(BitCodeAbbrevOp(0));
2795 // UsingShadowDecl
2796 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TargetDecl
2797 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2798 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // UsingOrNextShadow
2799 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR,
2800 6)); // InstantiatedFromUsingShadowDecl
2801 DeclUsingShadowAbbrev = Stream.EmitAbbrev(std::move(Abv));
2802
2803 // Abbreviation for EXPR_DECL_REF
2804 Abv = std::make_shared<BitCodeAbbrev>();
2805 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2806 // Stmt
2807 // Expr
2808 // PackingBits: DependenceKind, ValueKind. ObjectKind should be 0.
2809 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
2810 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2811 // DeclRefExpr
2812 // Packing Bits: , HadMultipleCandidates, RefersToEnclosingVariableOrCapture,
2813 // IsImmediateEscalating, NonOdrUseReason.
2814 // GetDeclFound, HasQualifier and ExplicitTemplateArgs should be 0.
2815 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2816 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2817 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2818 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2819
2820 // Abbreviation for EXPR_INTEGER_LITERAL
2821 Abv = std::make_shared<BitCodeAbbrev>();
2822 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2823 //Stmt
2824 // Expr
2825 // DependenceKind, ValueKind, ObjectKind
2826 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2827 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2828 // Integer Literal
2829 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2830 Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2831 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2832 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2833
2834 // Abbreviation for EXPR_CHARACTER_LITERAL
2835 Abv = std::make_shared<BitCodeAbbrev>();
2836 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2837 //Stmt
2838 // Expr
2839 // DependenceKind, ValueKind, ObjectKind
2840 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2841 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2842 // Character Literal
2843 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2844 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2845 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2846 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2847
2848 // Abbreviation for EXPR_IMPLICIT_CAST
2849 Abv = std::make_shared<BitCodeAbbrev>();
2850 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2851 // Stmt
2852 // Expr
2853 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2854 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2855 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2856 // CastExpr
2857 Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2858 // Packing Bits: CastKind, StoredFPFeatures, isPartOfExplicitCast
2859 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 9));
2860 // ImplicitCastExpr
2861 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2862
2863 // Abbreviation for EXPR_BINARY_OPERATOR
2864 Abv = std::make_shared<BitCodeAbbrev>();
2865 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_BINARY_OPERATOR));
2866 // Stmt
2867 // Expr
2868 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2869 // be 0 in this case.
2870 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2871 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2872 // BinaryOperator
2873 Abv->Add(
2874 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2875 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2876 BinaryOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2877
2878 // Abbreviation for EXPR_COMPOUND_ASSIGN_OPERATOR
2879 Abv = std::make_shared<BitCodeAbbrev>();
2880 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_COMPOUND_ASSIGN_OPERATOR));
2881 // Stmt
2882 // Expr
2883 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2884 // be 0 in this case.
2885 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2886 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2887 // BinaryOperator
2888 // Packing Bits: OpCode. The HasFPFeatures bit should be 0
2889 Abv->Add(
2890 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2891 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2892 // CompoundAssignOperator
2893 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHSType
2894 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Result Type
2895 CompoundAssignOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2896
2897 // Abbreviation for EXPR_CALL
2898 Abv = std::make_shared<BitCodeAbbrev>();
2899 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CALL));
2900 // Stmt
2901 // Expr
2902 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2903 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2904 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2905 // CallExpr
2906 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2907 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2908 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2909 CallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2910
2911 // Abbreviation for EXPR_CXX_OPERATOR_CALL
2912 Abv = std::make_shared<BitCodeAbbrev>();
2913 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_OPERATOR_CALL));
2914 // Stmt
2915 // Expr
2916 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2917 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2918 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2919 // CallExpr
2920 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2921 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2922 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2923 // CXXOperatorCallExpr
2924 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Operator Kind
2925 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2926 CXXOperatorCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2927
2928 // Abbreviation for EXPR_CXX_MEMBER_CALL
2929 Abv = std::make_shared<BitCodeAbbrev>();
2930 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_MEMBER_CALL));
2931 // Stmt
2932 // Expr
2933 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2934 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2935 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2936 // CallExpr
2937 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2938 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2939 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2940 // CXXMemberCallExpr
2941 CXXMemberCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2942
2943 // Abbreviation for STMT_COMPOUND
2944 Abv = std::make_shared<BitCodeAbbrev>();
2945 Abv->Add(BitCodeAbbrevOp(serialization::STMT_COMPOUND));
2946 // Stmt
2947 // CompoundStmt
2948 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Num Stmts
2949 Abv->Add(BitCodeAbbrevOp(0)); // hasStoredFPFeatures
2950 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2951 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2952 CompoundStmtAbbrev = Stream.EmitAbbrev(std::move(Abv));
2953
2954 Abv = std::make_shared<BitCodeAbbrev>();
2955 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2956 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2957 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2958
2959 Abv = std::make_shared<BitCodeAbbrev>();
2960 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2961 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2962 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2963
2964 Abv = std::make_shared<BitCodeAbbrev>();
2965 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_MODULE_LOCAL_VISIBLE));
2966 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2967 DeclModuleLocalVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2968
2969 Abv = std::make_shared<BitCodeAbbrev>();
2970 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_TU_LOCAL_VISIBLE));
2971 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2972 DeclTULocalLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2973
2974 Abv = std::make_shared<BitCodeAbbrev>();
2975 Abv->Add(BitCodeAbbrevOp(serialization::DECL_SPECIALIZATIONS));
2976 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2977 DeclSpecializationsAbbrev = Stream.EmitAbbrev(std::move(Abv));
2978
2979 Abv = std::make_shared<BitCodeAbbrev>();
2980 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARTIAL_SPECIALIZATIONS));
2981 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2982 DeclPartialSpecializationsAbbrev = Stream.EmitAbbrev(std::move(Abv));
2983}
2984
2985/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2986/// consumers of the AST.
2987///
2988/// Such decls will always be deserialized from the AST file, so we would like
2989/// this to be as restrictive as possible. Currently the predicate is driven by
2990/// code generation requirements, if other clients have a different notion of
2991/// what is "required" then we may have to consider an alternate scheme where
2992/// clients can iterate over the top-level decls and get information on them,
2993/// without necessary deserializing them. We could explicitly require such
2994/// clients to use a separate API call to "realize" the decl. This should be
2995/// relatively painless since they would presumably only do it for top-level
2996/// decls.
2997static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2998 Module *WritingModule) {
2999 // Named modules have different semantics than header modules. Every named
3000 // module units owns a translation unit. So the importer of named modules
3001 // doesn't need to deserilize everything ahead of time.
3002 if (WritingModule && WritingModule->isNamedModule()) {
3003 // The PragmaCommentDecl and PragmaDetectMismatchDecl are MSVC's extension.
3004 // And the behavior of MSVC for such cases will leak this to the module
3005 // users. Given pragma is not a standard thing, the compiler has the space
3006 // to do their own decision. Let's follow MSVC here.
3008 return true;
3009 return false;
3010 }
3011
3012 // An ObjCMethodDecl is never considered as "required" because its
3013 // implementation container always is.
3014
3015 // File scoped assembly or obj-c or OMP declare target implementation must be
3016 // seen.
3018 return true;
3019
3020 if (WritingModule && isPartOfPerModuleInitializer(D)) {
3021 // These declarations are part of the module initializer, and are emitted
3022 // if and when the module is imported, rather than being emitted eagerly.
3023 return false;
3024 }
3025
3026 return Context.DeclMustBeEmitted(D);
3027}
3028
3029void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
3030 PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
3031 "serializing");
3032
3033 // Determine the ID for this declaration.
3034 LocalDeclID ID;
3035 assert(!D->isFromASTFile() && "should not be emitting imported decl");
3036 LocalDeclID &IDR = DeclIDs[D];
3037 if (IDR.isInvalid())
3038 IDR = NextDeclID++;
3039
3040 ID = IDR;
3041
3042 assert(ID >= FirstDeclID && "invalid decl ID");
3043
3045 ASTDeclWriter W(*this, Context, Record, GeneratingReducedBMI);
3046
3047 // Build a record for this declaration
3048 W.Visit(D);
3049
3050 // Emit this declaration to the bitstream.
3051 uint64_t Offset = W.Emit(D);
3052
3053 // Record the offset for this declaration
3054 SourceLocation Loc = D->getLocation();
3056 getRawSourceLocationEncoding(getAdjustedLocation(Loc));
3057
3058 unsigned Index = ID.getRawValue() - FirstDeclID.getRawValue();
3059 if (DeclOffsets.size() == Index)
3060 DeclOffsets.emplace_back(RawLoc, Offset, DeclTypesBlockStartOffset);
3061 else if (DeclOffsets.size() < Index) {
3062 // FIXME: Can/should this happen?
3063 DeclOffsets.resize(Index+1);
3064 DeclOffsets[Index].setRawLoc(RawLoc);
3065 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);
3066 } else {
3067 llvm_unreachable("declarations should be emitted in ID order");
3068 }
3069
3070 SourceManager &SM = Context.getSourceManager();
3071 if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
3072 associateDeclWithFile(D, ID);
3073
3074 // Note declarations that should be deserialized eagerly so that we can add
3075 // them to a record in the AST file later.
3076 if (isRequiredDecl(D, Context, WritingModule))
3077 AddDeclRef(D, EagerlyDeserializedDecls);
3078}
3079
3081 // Switch case IDs are per function body.
3082 Writer->ClearSwitchCaseIDs();
3083
3084 assert(FD->doesThisDeclarationHaveABody());
3085 bool ModulesCodegen = shouldFunctionGenerateHereOnly(FD);
3086 Record->push_back(ModulesCodegen);
3087 if (ModulesCodegen)
3088 Writer->AddDeclRef(FD, Writer->ModularCodegenDecls);
3089 if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
3090 Record->push_back(CD->getNumCtorInitializers());
3091 if (CD->getNumCtorInitializers())
3092 AddCXXCtorInitializers(llvm::ArrayRef(CD->init_begin(), CD->init_end()));
3093 }
3094 AddStmt(FD->getBody());
3095}
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:220
SourceManager & getSourceManager()
Definition ASTContext.h:851
const LangOptions & getLangOpts() const
Definition ASTContext.h:944
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:776
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:4181
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition DeclCXX.h:4207
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition ASTWriter.h:1079
void addBit(bool Value)
Definition ASTWriter.h:1099
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition ASTWriter.h:1100
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition Decl.h:4671
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition Decl.h:4794
bool canAvoidCopyToHeap() const
Definition Decl.h:4825
size_t param_size() const
Definition Decl.h:4773
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:4750
ArrayRef< Capture > captures() const
Definition Decl.h:4798
bool blockMissingReturnType() const
Definition Decl.h:4806
bool capturesCXXThis() const
Definition Decl.h:4803
bool doesNotEscape() const
Definition Decl.h:4822
bool isConversionFromLambda() const
Definition Decl.h:4814
ArrayRef< ParmVarDecl * > parameters() const
Definition Decl.h:4757
bool isVariadic() const
Definition Decl.h:4746
TypeSourceInfo * getSignatureAsWritten() const
Definition Decl.h:4754
Represents a C++ constructor within a class.
Definition DeclCXX.h:2604
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition DeclCXX.h:2842
Represents a C++ conversion function within a class.
Definition DeclCXX.h:2939
ExplicitSpecifier getExplicitSpecifier()
Definition DeclCXX.h:2966
Represents a C++ deduction guide declaration.
Definition DeclCXX.h:1979
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:2055
ExplicitSpecifier getExplicitSpecifier()
Definition DeclCXX.h:2037
DeductionCandidate getDeductionCandidateKind() const
Definition DeclCXX.h:2075
SourceDeductionGuideKind getSourceDeductionGuideKind() const
Definition DeclCXX.h:2063
Represents a C++ destructor within a class.
Definition DeclCXX.h:2869
const FunctionDecl * getOperatorGlobalDelete() const
Definition DeclCXX.cpp:3175
const FunctionDecl * getGlobalArrayOperatorDelete() const
Definition DeclCXX.cpp:3185
const FunctionDecl * getOperatorDelete() const
Definition DeclCXX.cpp:3170
Expr * getOperatorDeleteThisArg() const
Definition DeclCXX.h:2908
const FunctionDecl * getArrayOperatorDelete() const
Definition DeclCXX.cpp:3180
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:2129
CXXMethodDecl * getMostRecentDecl()
Definition DeclCXX.h:2232
overridden_method_range overridden_methods() const
Definition DeclCXX.cpp:2778
unsigned size_overridden_methods() const
Definition DeclCXX.cpp:2772
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:1828
unsigned getLambdaIndexInContext() const
Retrieve the index of this lambda within the context declaration returned by getLambdaContextDecl().
Definition DeclCXX.h:1790
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:2050
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition DeclCXX.cpp:2042
static bool classofKind(Kind K)
Definition DeclCXX.h:1916
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Definition DeclCXX.cpp:2027
CXXMethodDecl * getLambdaCallOperator() const
Retrieve the lambda call operator of the closure type if this is a closure type.
Definition DeclCXX.cpp:1736
CXXRecordDecl * getPreviousDecl()
Definition DeclCXX.h:530
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition Decl.h:4943
unsigned getNumParams() const
Definition Decl.h:4981
unsigned getContextParamPosition() const
Definition Decl.h:5010
bool isNothrow() const
Definition Decl.cpp:5696
ImplicitParamDecl * getParam(unsigned i) const
Definition Decl.h:4983
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:3673
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:1449
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition DeclBase.h:2109
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
DeclContext * getLexicalParent()
getLexicalParent - Returns the containing lexical DeclContext.
Definition DeclBase.h:2125
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:1061
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition DeclBase.h:1076
SourceLocation getEndLoc() const LLVM_READONLY
Definition DeclBase.h:435
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
Definition DeclBase.h:1226
bool hasAttrs() const
Definition DeclBase.h:518
ASTContext & getASTContext() const LLVM_READONLY
Definition DeclBase.cpp:546
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition DeclBase.h:593
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:876
bool isReferenced() const
Whether any declaration of this entity was referenced.
Definition DeclBase.cpp:600
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition DeclBase.h:984
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition DeclBase.h:842
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition DeclBase.h:793
bool isInvalidDecl() const
Definition DeclBase.h:588
unsigned getIdentifierNamespace() const
Definition DeclBase.h:889
SourceLocation getLocation() const
Definition DeclBase.h:439
const char * getDeclKindName() const
Definition DeclBase.cpp:169
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Definition DeclBase.h:621
bool isTopLevelDeclInObjCContainer() const
Whether this declaration is a top-level declaration (function, global variable, etc....
Definition DeclBase.h:634
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
Definition DeclBase.cpp:575
DeclContext * getDeclContext()
Definition DeclBase.h:448
AccessSpecifier getAccess() const
Definition DeclBase.h:507
SourceLocation getBeginLoc() const LLVM_READONLY
Definition DeclBase.h:431
AttrVec & getAttrs()
Definition DeclBase.h:524
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition DeclBase.h:918
bool hasAttr() const
Definition DeclBase.h:577
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition DeclBase.h:978
Kind getKind() const
Definition DeclBase.h:442
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:4245
ArrayRef< BindingDecl * > bindings() const
Definition DeclCXX.h:4283
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:5178
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3423
llvm::APSInt getInitVal() const
Definition Decl.h:3443
const Expr * getInitExpr() const
Definition Decl.h:3441
Represents an enum.
Definition Decl.h:4010
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
Definition Decl.h:4282
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition Decl.h:4228
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition Decl.h:4220
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition Decl.h:4231
unsigned getODRHash()
Definition Decl.cpp:5162
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
Definition Decl.h:4199
EnumDecl * getMostRecentDecl()
Definition Decl.h:4115
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition Decl.h:4237
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition Decl.h:4183
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum.
Definition Decl.h:4209
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition Decl.h:4175
Store information needed for an explicit specifier.
Definition DeclCXX.h:1924
ExplicitSpecKind getKind() const
Definition DeclCXX.h:1932
const Expr * getExpr() const
Definition DeclCXX.h:1933
Represents a standard C++ module export declaration.
Definition Decl.h:5131
SourceLocation getRBraceLoc() const
Definition Decl.h:5150
This represents one expression.
Definition Expr.h:112
Represents a member of a struct/union/class.
Definition Decl.h:3160
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition Decl.h:3260
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition Decl.h:3340
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition Decl.h:3379
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
Definition Decl.h:3276
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition Decl.h:3384
const Expr * getAsmStringExpr() const
Definition Decl.h:4619
SourceLocation getRParenLoc() const
Definition Decl.h:4613
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:2000
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition Decl.h:2689
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition Decl.cpp:3279
bool isTrivialForCall() const
Definition Decl.h:2380
ConstexprSpecKind getConstexprKind() const
Definition Decl.h:2476
DefaultedOrDeletedFunctionInfo * getDefaultedOrDeletedInfo() const
Definition Decl.cpp:3194
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition Decl.cpp:4193
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
Definition Decl.cpp:3551
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition Decl.h:2921
SourceLocation getDefaultLoc() const
Definition Decl.h:2398
bool usesSEHTry() const
Indicates the function uses __try.
Definition Decl.h:2518
ArrayRef< ParmVarDecl * > parameters() const
Definition Decl.h:2774
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted.
Definition Decl.h:2389
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition Decl.h:2377
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition Decl.h:2448
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
Definition Decl.cpp:4172
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition Decl.cpp:4323
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition Decl.h:2326
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition Decl.cpp:4389
unsigned getODRHash()
Returns ODRHash of the function.
Definition Decl.cpp:4679
@ TK_FunctionTemplateSpecialization
Definition Decl.h:2016
@ TK_DependentFunctionTemplateSpecialization
Definition Decl.h:2019
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition Decl.h:2888
bool FriendConstraintRefersToEnclosingTemplate() const
Definition Decl.h:2707
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition Decl.cpp:4144
bool isDeletedAsWritten() const
Definition Decl.h:2544
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
Definition Decl.h:2353
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition Decl.h:2357
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition Decl.h:2428
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition Decl.h:2679
bool isTypeAwareOperatorNewOrDelete() const
Determine whether this is a type aware operator new or delete.
Definition Decl.cpp:3559
bool isDefaulted() const
Whether this function is defaulted.
Definition Decl.h:2385
bool isIneligibleOrNotSelected() const
Definition Decl.h:2418
FunctionDecl * getInstantiatedFromDecl() const
Definition Decl.cpp:4217
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition Decl.h:2344
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition Decl.h:2459
size_t param_size() const
Definition Decl.h:2790
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition Decl.h:2899
bool isInstantiatedFromMemberTemplate() const
Definition Decl.h:2366
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:5193
bool isCBuffer() const
Definition Decl.h:5237
SourceLocation getLBraceLoc() const
Definition Decl.h:5234
SourceLocation getLocStart() const LLVM_READONLY
Definition Decl.h:5233
SourceLocation getRBraceLoc() const
Definition Decl.h:5235
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition Decl.h:5052
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:6065
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition Decl.h:5110
Represents a field injected from an anonymous union/struct into the parent scope.
Definition Decl.h:3467
unsigned getChainingSize() const
Definition Decl.h:3492
ArrayRef< NamedDecl * > chain() const
Definition Decl.h:3488
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:3304
Expr * getTemporaryExpr()
Retrieve the expression to which the temporary materialization conversion was applied.
Definition DeclCXX.h:3350
Represents a linkage specification.
Definition DeclCXX.h:3011
LinkageSpecLanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition DeclCXX.h:3034
SourceLocation getExternLoc() const
Definition DeclCXX.h:3050
SourceLocation getRBraceLoc() const
Definition DeclCXX.h:3051
A global _GUID constant.
Definition DeclCXX.h:4394
Parts getParts() const
Get the decomposed parts of this declaration.
Definition DeclCXX.h:4424
MSGuidDeclParts Parts
Definition DeclCXX.h:4396
An instance of this class represents the declaration of a property member.
Definition DeclCXX.h:4340
IdentifierInfo * getGetterId() const
Definition DeclCXX.h:4362
IdentifierInfo * getSetterId() const
Definition DeclCXX.h:4364
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:144
bool isInterfaceOrPartition() const
Definition Module.h:671
bool isNamedModule() const
Does this Module is a named module of a standard named module?
Definition Module.h:224
Module * getTopLevelModule()
Retrieve the top-level module for this (sub)module, which may be this module.
Definition Module.h:722
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:648
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:3197
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition DeclCXX.h:3258
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition DeclCXX.h:3283
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition DeclCXX.h:3286
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition DeclCXX.h:3267
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:4878
ImplicitParamDecl * getParam(unsigned i) const
Definition Decl.h:4910
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:5667
unsigned getNumParams() const
Definition Decl.h:4908
Represents a parameter to a function.
Definition Decl.h:1790
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion:
Definition Decl.h:1871
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition Decl.h:1850
SourceLocation getExplicitObjectParamThisLoc() const
Definition Decl.h:1886
bool isObjCMethodParameter() const
Definition Decl.h:1833
ObjCDeclQualifier getObjCDeclQualifier() const
Definition Decl.h:1854
bool hasUninstantiatedDefaultArg() const
Definition Decl.h:1923
bool hasInheritedDefaultArg() const
Definition Decl.h:1935
Expr * getUninstantiatedDefaultArg()
Definition Decl.cpp:3052
unsigned getFunctionScopeDepth() const
Definition Decl.h:1840
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:4324
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition Decl.cpp:5413
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition Decl.h:4434
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition Decl.h:4442
RecordArgPassingKind getArgPassingRestrictions() const
Definition Decl.h:4465
bool hasVolatileMember() const
Definition Decl.h:4387
bool hasFlexibleArrayMember() const
Definition Decl.h:4357
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition Decl.h:4426
bool hasObjectMember() const
Definition Decl.h:4384
bool isNonTrivialToPrimitiveDestroy() const
Definition Decl.h:4418
bool isNonTrivialToPrimitiveCopy() const
Definition Decl.h:4410
bool isParamDestroyedInCallee() const
Definition Decl.h:4474
RecordDecl * getMostRecentDecl()
Definition Decl.h:4350
bool hasUninitializedExplicitInitFields() const
Definition Decl.h:4450
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition Decl.h:4402
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition Decl.h:4376
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:2098
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:4132
bool isFailed() const
Definition DeclCXX.h:4161
SourceLocation getRParenLoc() const
Definition DeclCXX.h:4163
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1799
Represents the declaration of a struct/union/class/enum.
Definition Decl.h:3717
SourceRange getBraceRange() const
Definition Decl.h:3791
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition Decl.h:3810
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:3839
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition Decl.h:3815
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition Decl.h:3951
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition Decl.h:3824
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition Decl.h:3850
TagKind getTagKind() const
Definition Decl.h:3914
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:4634
The top declaration context.
Definition Decl.h:105
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition Decl.h:3688
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition Decl.h:3706
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:3513
const Type * getTypeForDecl() const
Definition Decl.h:3538
SourceLocation getBeginLoc() const LLVM_READONLY
Definition Decl.h:3547
QualType getType() const
Return the type wrapped by this type source info.
Definition TypeBase.h:8284
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
Definition Type.cpp:2057
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition Decl.h:3667
Base class for declarations which introduce a typedef-name.
Definition Decl.h:3562
TypeSourceInfo * getTypeSourceInfo() const
Definition Decl.h:3612
TypedefNameDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
bool isModed() const
Definition Decl.h:3608
QualType getUnderlyingType() const
Definition Decl.h:3617
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes,...
Definition Decl.cpp:5765
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Definition DeclCXX.h:4451
const APValue & getValue() const
Definition DeclCXX.h:4477
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Definition DeclCXX.h:4114
Represents a dependent using declaration which was marked with typename.
Definition DeclCXX.h:4033
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
Definition DeclCXX.h:4063
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition DeclCXX.h:4067
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition DeclCXX.h:4084
Represents a dependent using declaration which was not marked with typename.
Definition DeclCXX.h:3936
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
Definition DeclCXX.h:3967
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition DeclCXX.h:3977
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition DeclCXX.h:3994
Represents a C++ using-declaration.
Definition DeclCXX.h:3587
bool hasTypename() const
Return true if the using declaration has 'typename'.
Definition DeclCXX.h:3636
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition DeclCXX.h:3621
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
Definition DeclCXX.h:3614
Represents C++ using-directive.
Definition DeclCXX.h:3092
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition DeclCXX.h:3163
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition DeclCXX.cpp:3297
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition DeclCXX.h:3159
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition DeclCXX.h:3167
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition DeclCXX.h:3137
Represents a C++ using-enum-declaration.
Definition DeclCXX.h:3788
SourceLocation getEnumLoc() const
The source location of the 'enum' keyword.
Definition DeclCXX.h:3812
TypeSourceInfo * getEnumType() const
Definition DeclCXX.h:3824
SourceLocation getUsingLoc() const
The source location of the 'using' keyword.
Definition DeclCXX.h:3808
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Definition DeclCXX.h:3869
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition DeclCXX.h:3898
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Definition DeclCXX.h:3902
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition DeclCXX.h:3395
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:3459
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:2821
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition Decl.h:1569
VarDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition Decl.h:1466
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition Decl.h:1578
@ 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:1532
bool hasInitWithSideEffects() const
Checks whether this declaration has an initializer with side effects.
Definition Decl.cpp:2455
bool isInlineSpecified() const
Definition Decl.h:1554
bool isStaticDataMember() const
Determines whether this is a static data member.
Definition Decl.h:1283
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
Definition Decl.h:1522
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
Definition Decl.h:1512
bool isCXXForRangeImplicitVar() const
Whether this variable is the implicit '__range' variable in C++ range-based for loops.
Definition Decl.h:1622
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Definition Decl.h:1494
bool isInline() const
Whether this variable is (C++1z) inline.
Definition Decl.h:1551
ThreadStorageClassSpecifier getTSCSpec() const
Definition Decl.h:1177
const Expr * getInit() const
Definition Decl.h:1368
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition Decl.h:1547
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
Definition Decl.h:1229
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:2709
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Definition Decl.h:1476
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
Definition Decl.h:1588
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:2790
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Definition Decl.cpp:2909
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:95
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_Static
Static storage duration.
Definition Specifiers.h:343
const FunctionProtoType * T
@ 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:6670
Data that is common to all of the declarations of a given function template.
uint16_t Part2
...-89ab-...
Definition DeclCXX.h:4373
uint32_t Part1
{01234567-...
Definition DeclCXX.h:4371
uint16_t Part3
...-cdef-...
Definition DeclCXX.h:4375
uint8_t Part4And5[8]
...-0123-456789abcdef}
Definition DeclCXX.h:4377
static DeclType * getDecl(EntryType *D)