clang 18.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"
26#include <optional>
27using namespace clang;
28using namespace serialization;
29
30//===----------------------------------------------------------------------===//
31// Declaration serialization
32//===----------------------------------------------------------------------===//
33
34namespace clang {
35 class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {
36 ASTWriter &Writer;
37 ASTContext &Context;
38 ASTRecordWriter Record;
39
41 unsigned AbbrevToUse;
42
43 public:
46 : Writer(Writer), Context(Context), Record(Writer, Record),
47 Code((serialization::DeclCode)0), AbbrevToUse(0) {}
48
49 uint64_t Emit(Decl *D) {
50 if (!Code)
51 llvm::report_fatal_error(StringRef("unexpected declaration kind '") +
52 D->getDeclKindName() + "'");
53 return Record.Emit(Code, AbbrevToUse);
54 }
55
56 void Visit(Decl *D);
57
58 void VisitDecl(Decl *D);
63 void VisitLabelDecl(LabelDecl *LD);
67 void VisitTypeDecl(TypeDecl *D);
73 void VisitTagDecl(TagDecl *D);
74 void VisitEnumDecl(EnumDecl *D);
103 void VisitVarDecl(VarDecl *D);
120 void VisitUsingDecl(UsingDecl *D);
134 void VisitBlockDecl(BlockDecl *D);
136 void VisitEmptyDecl(EmptyDecl *D);
139 template <typename T> void VisitRedeclarable(Redeclarable<T> *D);
141
142 // FIXME: Put in the same order is DeclNodes.td?
163
164 /// Add an Objective-C type parameter list to the given record.
166 // Empty type parameter list.
167 if (!typeParams) {
168 Record.push_back(0);
169 return;
170 }
171
172 Record.push_back(typeParams->size());
173 for (auto *typeParam : *typeParams) {
174 Record.AddDeclRef(typeParam);
175 }
176 Record.AddSourceLocation(typeParams->getLAngleLoc());
177 Record.AddSourceLocation(typeParams->getRAngleLoc());
178 }
179
180 /// Add to the record the first declaration from each module file that
181 /// provides a declaration of D. The intent is to provide a sufficient
182 /// set such that reloading this set will load all current redeclarations.
183 void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
184 llvm::MapVector<ModuleFile*, const Decl*> Firsts;
185 // FIXME: We can skip entries that we know are implied by others.
186 for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) {
187 if (R->isFromASTFile())
188 Firsts[Writer.Chain->getOwningModuleFile(R)] = R;
189 else if (IncludeLocal)
190 Firsts[nullptr] = R;
191 }
192 for (const auto &F : Firsts)
193 Record.AddDeclRef(F.second);
194 }
195
196 /// Get the specialization decl from an entry in the specialization list.
197 template <typename EntryType>
199 getSpecializationDecl(EntryType &T) {
201 }
202
203 /// Get the list of partial specializations from a template's common ptr.
204 template<typename T>
205 decltype(T::PartialSpecializations) &getPartialSpecializations(T *Common) {
206 return Common->PartialSpecializations;
207 }
209 return std::nullopt;
210 }
211
212 template<typename DeclTy>
214 auto *Common = D->getCommonPtr();
215
216 // If we have any lazy specializations, and the external AST source is
217 // our chained AST reader, we can just write out the DeclIDs. Otherwise,
218 // we need to resolve them to actual declarations.
219 if (Writer.Chain != Writer.Context->getExternalSource() &&
220 Common->LazySpecializations) {
221 D->LoadLazySpecializations();
222 assert(!Common->LazySpecializations);
223 }
224
225 ArrayRef<DeclID> LazySpecializations;
226 if (auto *LS = Common->LazySpecializations)
227 LazySpecializations = llvm::ArrayRef(LS + 1, LS[0]);
228
229 // Add a slot to the record for the number of specializations.
230 unsigned I = Record.size();
231 Record.push_back(0);
232
233 // AddFirstDeclFromEachModule might trigger deserialization, invalidating
234 // *Specializations iterators.
236 for (auto &Entry : Common->Specializations)
237 Specs.push_back(getSpecializationDecl(Entry));
238 for (auto &Entry : getPartialSpecializations(Common))
239 Specs.push_back(getSpecializationDecl(Entry));
240
241 for (auto *D : Specs) {
242 assert(D->isCanonicalDecl() && "non-canonical decl in set");
243 AddFirstDeclFromEachModule(D, /*IncludeLocal*/true);
244 }
245 Record.append(LazySpecializations.begin(), LazySpecializations.end());
246
247 // Update the size entry we added earlier.
248 Record[I] = Record.size() - I - 1;
249 }
250
251 /// Ensure that this template specialization is associated with the specified
252 /// template on reload.
254 const Decl *Specialization) {
255 Template = Template->getCanonicalDecl();
256
257 // If the canonical template is local, we'll write out this specialization
258 // when we emit it.
259 // FIXME: We can do the same thing if there is any local declaration of
260 // the template, to avoid emitting an update record.
261 if (!Template->isFromASTFile())
262 return;
263
264 // We only need to associate the first local declaration of the
265 // specialization. The other declarations will get pulled in by it.
267 return;
268
269 Writer.DeclUpdates[Template].push_back(ASTWriter::DeclUpdate(
271 }
272 };
273}
274
277
278 // Source locations require array (variable-length) abbreviations. The
279 // abbreviation infrastructure requires that arrays are encoded last, so
280 // we handle it here in the case of those classes derived from DeclaratorDecl
281 if (auto *DD = dyn_cast<DeclaratorDecl>(D)) {
282 if (auto *TInfo = DD->getTypeSourceInfo())
283 Record.AddTypeLoc(TInfo->getTypeLoc());
284 }
285
286 // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
287 // have been written. We want it last because we will not read it back when
288 // retrieving it from the AST, we'll just lazily set the offset.
289 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
290 Record.push_back(FD->doesThisDeclarationHaveABody());
291 if (FD->doesThisDeclarationHaveABody())
292 Record.AddFunctionDefinition(FD);
293 }
294
295 // Similar to FunctionDecls, handle VarDecl's initializer here and write it
296 // after all other Stmts/Exprs. We will not read the initializer until after
297 // we have finished recursive deserialization, because it can recursively
298 // refer back to the variable.
299 if (auto *VD = dyn_cast<VarDecl>(D)) {
300 Record.AddVarDeclInit(VD);
301 }
302
303 // And similarly for FieldDecls. We already serialized whether there is a
304 // default member initializer.
305 if (auto *FD = dyn_cast<FieldDecl>(D)) {
306 if (FD->hasInClassInitializer()) {
307 if (Expr *Init = FD->getInClassInitializer()) {
308 Record.push_back(1);
309 Record.AddStmt(Init);
310 } else {
311 Record.push_back(0);
312 // Initializer has not been instantiated yet.
313 }
314 }
315 }
316
317 // If this declaration is also a DeclContext, write blocks for the
318 // declarations that lexically stored inside its context and those
319 // declarations that are visible from its context.
320 if (auto *DC = dyn_cast<DeclContext>(D))
322}
323
325 Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
326 if (D->getDeclContext() != D->getLexicalDeclContext())
327 Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
328 else
329 Record.push_back(0);
330 Record.push_back(D->isInvalidDecl());
331 Record.push_back(D->hasAttrs());
332 if (D->hasAttrs())
333 Record.AddAttributes(D->getAttrs());
334 Record.push_back(D->isImplicit());
335 Record.push_back(D->isUsed(false));
336 Record.push_back(D->isReferenced());
338 Record.push_back(D->getAccess());
339 Record.push_back((uint64_t)D->getModuleOwnershipKind());
340 Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
341
342 // If this declaration injected a name into a context different from its
343 // lexical context, and that context is an imported namespace, we need to
344 // update its visible declarations to include this name.
345 //
346 // This happens when we instantiate a class with a friend declaration or a
347 // function with a local extern declaration, for instance.
348 //
349 // FIXME: Can we handle this in AddedVisibleDecl instead?
350 if (D->isOutOfLine()) {
351 auto *DC = D->getDeclContext();
352 while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
353 if (!NS->isFromASTFile())
354 break;
355 Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
356 if (!NS->isInlineNamespace())
357 break;
358 DC = NS->getParent();
359 }
360 }
361}
362
364 StringRef Arg = D->getArg();
365 Record.push_back(Arg.size());
366 VisitDecl(D);
367 Record.AddSourceLocation(D->getBeginLoc());
368 Record.push_back(D->getCommentKind());
369 Record.AddString(Arg);
371}
372
375 StringRef Name = D->getName();
376 StringRef Value = D->getValue();
377 Record.push_back(Name.size() + 1 + Value.size());
378 VisitDecl(D);
379 Record.AddSourceLocation(D->getBeginLoc());
380 Record.AddString(Name);
381 Record.AddString(Value);
383}
384
386 llvm_unreachable("Translation units aren't directly serialized");
387}
388
390 VisitDecl(D);
391 Record.AddDeclarationName(D->getDeclName());
394 : 0);
395}
396
399 Record.AddSourceLocation(D->getBeginLoc());
400 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
401}
402
405 VisitTypeDecl(D);
407 Record.push_back(D->isModed());
408 if (D->isModed())
409 Record.AddTypeRef(D->getUnderlyingType());
410 Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
411}
412
415 if (D->getDeclContext() == D->getLexicalDeclContext() &&
416 !D->hasAttrs() &&
417 !D->isImplicit() &&
418 D->getFirstDecl() == D->getMostRecentDecl() &&
419 !D->isInvalidDecl() &&
421 !D->isModulePrivate() &&
424 AbbrevToUse = Writer.getDeclTypedefAbbrev();
425
427}
428
433}
434
436 static_assert(DeclContext::NumTagDeclBits == 10,
437 "You need to update the serializer after you change the "
438 "TagDeclBits");
439
441 VisitTypeDecl(D);
443 Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding
444 if (!isa<CXXRecordDecl>(D))
445 Record.push_back(D->isCompleteDefinition());
447 Record.push_back(D->isFreeStanding());
449 Record.AddSourceRange(D->getBraceRange());
450
451 if (D->hasExtInfo()) {
452 Record.push_back(1);
453 Record.AddQualifierInfo(*D->getExtInfo());
454 } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
455 Record.push_back(2);
456 Record.AddDeclRef(TD);
457 Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
458 } else {
459 Record.push_back(0);
460 }
461}
462
464 static_assert(DeclContext::NumEnumDeclBits == 20,
465 "You need to update the serializer after you change the "
466 "EnumDeclBits");
467
468 VisitTagDecl(D);
470 if (!D->getIntegerTypeSourceInfo())
471 Record.AddTypeRef(D->getIntegerType());
472 Record.AddTypeRef(D->getPromotionType());
473 Record.push_back(D->getNumPositiveBits());
474 Record.push_back(D->getNumNegativeBits());
475 Record.push_back(D->isScoped());
476 Record.push_back(D->isScopedUsingClassTag());
477 Record.push_back(D->isFixed());
478 Record.push_back(D->getODRHash());
479
481 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
482 Record.push_back(MemberInfo->getTemplateSpecializationKind());
483 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
484 } else {
485 Record.AddDeclRef(nullptr);
486 }
487
488 if (D->getDeclContext() == D->getLexicalDeclContext() &&
489 !D->hasAttrs() &&
490 !D->isImplicit() &&
491 !D->isUsed(false) &&
492 !D->hasExtInfo() &&
494 D->getFirstDecl() == D->getMostRecentDecl() &&
495 !D->isInvalidDecl() &&
496 !D->isReferenced() &&
498 D->getAccess() == AS_none &&
499 !D->isModulePrivate() &&
505 AbbrevToUse = Writer.getDeclEnumAbbrev();
506
508}
509
511 static_assert(DeclContext::NumRecordDeclBits == 41,
512 "You need to update the serializer after you change the "
513 "RecordDeclBits");
514
515 VisitTagDecl(D);
518 Record.push_back(D->hasObjectMember());
519 Record.push_back(D->hasVolatileMember());
528 // Only compute this for C/Objective-C, in C++ this is computed as part
529 // of CXXRecordDecl.
530 if (!isa<CXXRecordDecl>(D))
531 Record.push_back(D->getODRHash());
532
533 if (D->getDeclContext() == D->getLexicalDeclContext() &&
534 !D->hasAttrs() &&
535 !D->isImplicit() &&
536 !D->isUsed(false) &&
537 !D->hasExtInfo() &&
539 D->getFirstDecl() == D->getMostRecentDecl() &&
540 !D->isInvalidDecl() &&
541 !D->isReferenced() &&
543 D->getAccess() == AS_none &&
544 !D->isModulePrivate() &&
548 AbbrevToUse = Writer.getDeclRecordAbbrev();
549
551}
552
555 Record.AddTypeRef(D->getType());
556}
557
560 Record.push_back(D->getInitExpr()? 1 : 0);
561 if (D->getInitExpr())
562 Record.AddStmt(D->getInitExpr());
563 Record.AddAPSInt(D->getInitVal());
564
566}
567
571 Record.push_back(D->hasExtInfo());
572 if (D->hasExtInfo()) {
573 DeclaratorDecl::ExtInfo *Info = D->getExtInfo();
574 Record.AddQualifierInfo(*Info);
575 Record.AddStmt(Info->TrailingRequiresClause);
576 }
577 // The location information is deferred until the end of the record.
579 : QualType());
580}
581
583 static_assert(DeclContext::NumFunctionDeclBits == 31,
584 "You need to update the serializer after you change the "
585 "FunctionDeclBits");
586
588
589 Record.push_back(D->getTemplatedKind());
590 switch (D->getTemplatedKind()) {
592 break;
595 break;
598 break;
601 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
602 Record.push_back(MemberInfo->getTemplateSpecializationKind());
603 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
604 break;
605 }
608 FTSInfo = D->getTemplateSpecializationInfo();
609
611
612 Record.AddDeclRef(FTSInfo->getTemplate());
613 Record.push_back(FTSInfo->getTemplateSpecializationKind());
614
615 // Template arguments.
617
618 // Template args as written.
619 Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
620 if (FTSInfo->TemplateArgumentsAsWritten) {
622 for (int i=0, e = FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs;
623 i!=e; ++i)
625 (*FTSInfo->TemplateArgumentsAsWritten)[i]);
628 }
629
631
632 if (MemberSpecializationInfo *MemberInfo =
633 FTSInfo->getMemberSpecializationInfo()) {
634 Record.push_back(1);
635 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
636 Record.push_back(MemberInfo->getTemplateSpecializationKind());
637 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
638 } else {
639 Record.push_back(0);
640 }
641
642 if (D->isCanonicalDecl()) {
643 // Write the template that contains the specializations set. We will
644 // add a FunctionTemplateSpecializationInfo to it when reading.
645 Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
646 }
647 break;
648 }
651 DFTSInfo = D->getDependentSpecializationInfo();
652
653 // Templates.
654 Record.push_back(DFTSInfo->getNumTemplates());
655 for (int i=0, e = DFTSInfo->getNumTemplates(); i != e; ++i)
656 Record.AddDeclRef(DFTSInfo->getTemplate(i));
657
658 // Templates args.
659 Record.push_back(DFTSInfo->getNumTemplateArgs());
660 for (int i=0, e = DFTSInfo->getNumTemplateArgs(); i != e; ++i)
661 Record.AddTemplateArgumentLoc(DFTSInfo->getTemplateArg(i));
662 Record.AddSourceLocation(DFTSInfo->getLAngleLoc());
663 Record.AddSourceLocation(DFTSInfo->getRAngleLoc());
664 break;
665 }
666 }
667
669 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
671
672 // FunctionDecl's body is handled last at ASTWriterDecl::Visit,
673 // after everything else is written.
674 Record.push_back(
675 static_cast<int>(D->getStorageClass())); // FIXME: stable encoding
676 Record.push_back(D->isInlineSpecified());
677 Record.push_back(D->isInlined());
678 Record.push_back(D->isVirtualAsWritten());
679 Record.push_back(D->isPure());
680 Record.push_back(D->hasInheritedPrototype());
681 Record.push_back(D->hasWrittenPrototype());
682 Record.push_back(D->isDeletedBit());
683 Record.push_back(D->isTrivial());
684 Record.push_back(D->isTrivialForCall());
685 Record.push_back(D->isDefaulted());
686 Record.push_back(D->isExplicitlyDefaulted());
688 Record.push_back(D->hasImplicitReturnZero());
689 Record.push_back(static_cast<uint64_t>(D->getConstexprKind()));
690 Record.push_back(D->usesSEHTry());
691 Record.push_back(D->hasSkippedBody());
692 Record.push_back(D->isMultiVersion());
693 Record.push_back(D->isLateTemplateParsed());
695 Record.push_back(D->getLinkageInternal());
696 Record.AddSourceLocation(D->getEndLoc());
697 Record.AddSourceLocation(D->getDefaultLoc());
698
699 Record.push_back(D->getODRHash());
700
701 if (D->isDefaulted()) {
702 if (auto *FDI = D->getDefaultedFunctionInfo()) {
703 Record.push_back(FDI->getUnqualifiedLookups().size());
704 for (DeclAccessPair P : FDI->getUnqualifiedLookups()) {
705 Record.AddDeclRef(P.getDecl());
706 Record.push_back(P.getAccess());
707 }
708 } else {
709 Record.push_back(0);
710 }
711 }
712
713 Record.push_back(D->param_size());
714 for (auto *P : D->parameters())
715 Record.AddDeclRef(P);
717}
718
720 ASTRecordWriter &Record) {
721 uint64_t Kind = static_cast<uint64_t>(ES.getKind());
722 Kind = Kind << 1 | static_cast<bool>(ES.getExpr());
723 Record.push_back(Kind);
724 if (ES.getExpr()) {
725 Record.AddStmt(ES.getExpr());
726 }
727}
728
731 Record.AddDeclRef(D->Ctor);
733 Record.push_back(static_cast<unsigned char>(D->getDeductionCandidateKind()));
735}
736
738 static_assert(DeclContext::NumObjCMethodDeclBits == 24,
739 "You need to update the serializer after you change the "
740 "ObjCMethodDeclBits");
741
743 // FIXME: convert to LazyStmtPtr?
744 // Unlike C/C++, method bodies will never be in header files.
745 bool HasBodyStuff = D->getBody() != nullptr;
746 Record.push_back(HasBodyStuff);
747 if (HasBodyStuff) {
748 Record.AddStmt(D->getBody());
749 }
750 Record.AddDeclRef(D->getSelfDecl());
751 Record.AddDeclRef(D->getCmdDecl());
752 Record.push_back(D->isInstanceMethod());
753 Record.push_back(D->isVariadic());
754 Record.push_back(D->isPropertyAccessor());
756 Record.push_back(D->isDefined());
757 Record.push_back(D->isOverriding());
758 Record.push_back(D->hasSkippedBody());
759
760 Record.push_back(D->isRedeclaration());
761 Record.push_back(D->hasRedeclaration());
762 if (D->hasRedeclaration()) {
763 assert(Context.getObjCMethodRedeclaration(D));
764 Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
765 }
766
767 // FIXME: stable encoding for @required/@optional
769 // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
770 Record.push_back(D->getObjCDeclQualifier());
771 Record.push_back(D->hasRelatedResultType());
772 Record.AddTypeRef(D->getReturnType());
774 Record.AddSourceLocation(D->getEndLoc());
775 Record.push_back(D->param_size());
776 for (const auto *P : D->parameters())
777 Record.AddDeclRef(P);
778
779 Record.push_back(D->getSelLocsKind());
780 unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
781 SourceLocation *SelLocs = D->getStoredSelLocs();
782 Record.push_back(NumStoredSelLocs);
783 for (unsigned i = 0; i != NumStoredSelLocs; ++i)
784 Record.AddSourceLocation(SelLocs[i]);
785
787}
788
791 Record.push_back(D->Variance);
792 Record.push_back(D->Index);
793 Record.AddSourceLocation(D->VarianceLoc);
794 Record.AddSourceLocation(D->ColonLoc);
795
797}
798
800 static_assert(DeclContext::NumObjCContainerDeclBits == 51,
801 "You need to update the serializer after you change the "
802 "ObjCContainerDeclBits");
803
805 Record.AddSourceLocation(D->getAtStartLoc());
806 Record.AddSourceRange(D->getAtEndRange());
807 // Abstract class (no need to define a stable serialization::DECL code).
808}
809
813 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
814 AddObjCTypeParamList(D->TypeParamList);
815
818 // Write the DefinitionData
819 ObjCInterfaceDecl::DefinitionData &Data = D->data();
820
823 Record.push_back(Data.HasDesignatedInitializers);
824 Record.push_back(D->getODRHash());
825
826 // Write out the protocols that are directly referenced by the @interface.
827 Record.push_back(Data.ReferencedProtocols.size());
828 for (const auto *P : D->protocols())
829 Record.AddDeclRef(P);
830 for (const auto &PL : D->protocol_locs())
831 Record.AddSourceLocation(PL);
832
833 // Write out the protocols that are transitively referenced.
834 Record.push_back(Data.AllReferencedProtocols.size());
836 P = Data.AllReferencedProtocols.begin(),
837 PEnd = Data.AllReferencedProtocols.end();
838 P != PEnd; ++P)
839 Record.AddDeclRef(*P);
840
841
842 if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
843 // Ensure that we write out the set of categories for this class.
844 Writer.ObjCClassesWithCategories.insert(D);
845
846 // Make sure that the categories get serialized.
847 for (; Cat; Cat = Cat->getNextClassCategoryRaw())
848 (void)Writer.GetDeclRef(Cat);
849 }
850 }
851
853}
854
857 // FIXME: stable encoding for @public/@private/@protected/@package
858 Record.push_back(D->getAccessControl());
859 Record.push_back(D->getSynthesize());
860
861 if (D->getDeclContext() == D->getLexicalDeclContext() &&
862 !D->hasAttrs() &&
863 !D->isImplicit() &&
864 !D->isUsed(false) &&
865 !D->isInvalidDecl() &&
866 !D->isReferenced() &&
867 !D->isModulePrivate() &&
868 !D->getBitWidth() &&
869 !D->hasExtInfo() &&
870 D->getDeclName())
871 AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
872
874}
875
879
882 Record.push_back(D->protocol_size());
883 for (const auto *I : D->protocols())
884 Record.AddDeclRef(I);
885 for (const auto &PL : D->protocol_locs())
886 Record.AddSourceLocation(PL);
887 Record.push_back(D->getODRHash());
888 }
889
891}
892
896}
897
903 Record.AddDeclRef(D->getClassInterface());
904 AddObjCTypeParamList(D->TypeParamList);
905 Record.push_back(D->protocol_size());
906 for (const auto *I : D->protocols())
907 Record.AddDeclRef(I);
908 for (const auto &PL : D->protocol_locs())
909 Record.AddSourceLocation(PL);
911}
912
915 Record.AddDeclRef(D->getClassInterface());
917}
918
921 Record.AddSourceLocation(D->getAtLoc());
922 Record.AddSourceLocation(D->getLParenLoc());
923 Record.AddTypeRef(D->getType());
925 // FIXME: stable encoding
926 Record.push_back((unsigned)D->getPropertyAttributes());
927 Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
928 // FIXME: stable encoding
929 Record.push_back((unsigned)D->getPropertyImplementation());
934 Record.AddDeclRef(D->getGetterMethodDecl());
935 Record.AddDeclRef(D->getSetterMethodDecl());
936 Record.AddDeclRef(D->getPropertyIvarDecl());
938}
939
942 Record.AddDeclRef(D->getClassInterface());
943 // Abstract class (no need to define a stable serialization::DECL code).
944}
945
950}
951
954 Record.AddDeclRef(D->getSuperClass());
959 Record.push_back(D->hasDestructors());
960 Record.push_back(D->NumIvarInitializers);
961 if (D->NumIvarInitializers)
965}
966
968 VisitDecl(D);
969 Record.AddSourceLocation(D->getBeginLoc());
970 Record.AddDeclRef(D->getPropertyDecl());
971 Record.AddDeclRef(D->getPropertyIvarDecl());
973 Record.AddDeclRef(D->getGetterMethodDecl());
974 Record.AddDeclRef(D->getSetterMethodDecl());
975 Record.AddStmt(D->getGetterCXXConstructor());
976 Record.AddStmt(D->getSetterCXXAssignment());
978}
979
982 Record.push_back(D->isMutable());
983
984 Record.push_back((D->StorageKind << 1) | D->BitField);
985 if (D->StorageKind == FieldDecl::ISK_CapturedVLAType)
986 Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
987 else if (D->BitField)
988 Record.AddStmt(D->getBitWidth());
989
990 if (!D->getDeclName())
992
993 if (D->getDeclContext() == D->getLexicalDeclContext() &&
994 !D->hasAttrs() &&
995 !D->isImplicit() &&
996 !D->isUsed(false) &&
997 !D->isInvalidDecl() &&
998 !D->isReferenced() &&
1000 !D->isModulePrivate() &&
1001 !D->getBitWidth() &&
1002 !D->hasInClassInitializer() &&
1003 !D->hasCapturedVLAType() &&
1004 !D->hasExtInfo() &&
1007 D->getDeclName())
1008 AbbrevToUse = Writer.getDeclFieldAbbrev();
1009
1011}
1012
1015 Record.AddIdentifierRef(D->getGetterId());
1016 Record.AddIdentifierRef(D->getSetterId());
1018}
1019
1021 VisitValueDecl(D);
1022 MSGuidDecl::Parts Parts = D->getParts();
1023 Record.push_back(Parts.Part1);
1024 Record.push_back(Parts.Part2);
1025 Record.push_back(Parts.Part3);
1026 Record.append(std::begin(Parts.Part4And5), std::end(Parts.Part4And5));
1028}
1029
1032 VisitValueDecl(D);
1033 Record.AddAPValue(D->getValue());
1035}
1036
1038 VisitValueDecl(D);
1039 Record.AddAPValue(D->getValue());
1041}
1042
1044 VisitValueDecl(D);
1045 Record.push_back(D->getChainingSize());
1046
1047 for (const auto *P : D->chain())
1048 Record.AddDeclRef(P);
1050}
1051
1055 Record.push_back(D->getStorageClass());
1056 Record.push_back(D->getTSCSpec());
1057 Record.push_back(D->getInitStyle());
1058 Record.push_back(D->isARCPseudoStrong());
1059 bool HasDeducedType = false;
1060 if (!isa<ParmVarDecl>(D)) {
1062 Record.push_back(D->isExceptionVariable());
1063 Record.push_back(D->isNRVOVariable());
1064 Record.push_back(D->isCXXForRangeDecl());
1065 Record.push_back(D->isObjCForDecl());
1066 Record.push_back(D->isInline());
1067 Record.push_back(D->isInlineSpecified());
1068 Record.push_back(D->isConstexpr());
1069 Record.push_back(D->isInitCapture());
1071 if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
1072 Record.push_back(static_cast<unsigned>(IPD->getParameterKind()));
1073 else
1074 Record.push_back(0);
1075 Record.push_back(D->isEscapingByref());
1076 HasDeducedType = D->getType()->getContainedDeducedType();
1077 Record.push_back(HasDeducedType);
1078 }
1079 Record.push_back(D->getLinkageInternal());
1080
1081 if (D->hasAttr<BlocksAttr>()) {
1082 BlockVarCopyInit Init = Writer.Context->getBlockVarCopyInit(D);
1083 Record.AddStmt(Init.getCopyExpr());
1084 if (Init.getCopyExpr())
1085 Record.push_back(Init.canThrow());
1086 }
1087
1088 bool ModulesCodegen = false;
1089 if (Writer.WritingModule && D->getStorageDuration() == SD_Static &&
1091 // When building a C++20 module interface unit or a partition unit, a
1092 // strong definition in the module interface is provided by the
1093 // compilation of that unit, not by its users. (Inline variables are still
1094 // emitted in module users.)
1095 ModulesCodegen =
1096 (Writer.WritingModule->isInterfaceOrPartition() ||
1097 (D->hasAttr<DLLExportAttr>() &&
1098 Writer.Context->getLangOpts().BuildingPCHWithObjectFile)) &&
1099 Writer.Context->GetGVALinkageForVariable(D) >= GVA_StrongExternal;
1100 }
1101 Record.push_back(ModulesCodegen);
1102 if (ModulesCodegen)
1103 Writer.ModularCodegenDecls.push_back(Writer.GetDeclRef(D));
1104
1105 enum {
1106 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1107 };
1108 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1109 Record.push_back(VarTemplate);
1110 Record.AddDeclRef(TemplD);
1111 } else if (MemberSpecializationInfo *SpecInfo
1113 Record.push_back(StaticDataMemberSpecialization);
1114 Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1115 Record.push_back(SpecInfo->getTemplateSpecializationKind());
1116 Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1117 } else {
1118 Record.push_back(VarNotTemplate);
1119 }
1120
1121 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1122 !D->hasAttrs() &&
1123 !D->isImplicit() &&
1124 !D->isUsed(false) &&
1125 !D->isInvalidDecl() &&
1126 !D->isReferenced() &&
1128 D->getAccess() == AS_none &&
1129 !D->isModulePrivate() &&
1132 !D->hasExtInfo() &&
1133 D->getFirstDecl() == D->getMostRecentDecl() &&
1134 D->getKind() == Decl::Var &&
1135 !D->isInline() &&
1136 !D->isConstexpr() &&
1137 !D->isInitCapture() &&
1139 !D->isEscapingByref() &&
1140 !HasDeducedType &&
1141 D->getStorageDuration() != SD_Static &&
1144 AbbrevToUse = Writer.getDeclVarAbbrev();
1145
1147}
1148
1150 VisitVarDecl(D);
1152}
1153
1155 VisitVarDecl(D);
1156 Record.push_back(D->isObjCMethodParameter());
1157 Record.push_back(D->getFunctionScopeDepth());
1158 Record.push_back(D->getFunctionScopeIndex());
1159 Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding
1160 Record.push_back(D->isKNRPromoted());
1161 Record.push_back(D->hasInheritedDefaultArg());
1166
1167 // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1168 // we dynamically check for the properties that we optimize for, but don't
1169 // know are true of all PARM_VAR_DECLs.
1170 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1171 !D->hasAttrs() &&
1172 !D->hasExtInfo() &&
1173 !D->isImplicit() &&
1174 !D->isUsed(false) &&
1175 !D->isInvalidDecl() &&
1176 !D->isReferenced() &&
1177 D->getAccess() == AS_none &&
1178 !D->isModulePrivate() &&
1179 D->getStorageClass() == 0 &&
1180 D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1181 D->getFunctionScopeDepth() == 0 &&
1182 D->getObjCDeclQualifier() == 0 &&
1183 !D->isKNRPromoted() &&
1184 !D->hasInheritedDefaultArg() &&
1185 D->getInit() == nullptr &&
1186 !D->hasUninstantiatedDefaultArg()) // No default expr.
1187 AbbrevToUse = Writer.getDeclParmVarAbbrev();
1188
1189 // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1190 // just us assuming it.
1191 assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1193 && "PARM_VAR_DECL can't be demoted definition.");
1194 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1195 assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1196 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1197 assert(!D->isStaticDataMember() &&
1198 "PARM_VAR_DECL can't be static data member");
1199}
1200
1202 // Record the number of bindings first to simplify deserialization.
1203 Record.push_back(D->bindings().size());
1204
1205 VisitVarDecl(D);
1206 for (auto *B : D->bindings())
1207 Record.AddDeclRef(B);
1209}
1210
1212 VisitValueDecl(D);
1213 Record.AddStmt(D->getBinding());
1215}
1216
1218 VisitDecl(D);
1219 Record.AddStmt(D->getAsmString());
1220 Record.AddSourceLocation(D->getRParenLoc());
1222}
1223
1225 VisitDecl(D);
1226 Record.AddStmt(D->getStmt());
1228}
1229
1231 VisitDecl(D);
1233}
1234
1237 VisitDecl(D);
1238 Record.AddDeclRef(D->getExtendingDecl());
1239 Record.AddStmt(D->getTemporaryExpr());
1240 Record.push_back(static_cast<bool>(D->getValue()));
1241 if (D->getValue())
1242 Record.AddAPValue(*D->getValue());
1243 Record.push_back(D->getManglingNumber());
1245}
1247 VisitDecl(D);
1248 Record.AddStmt(D->getBody());
1250 Record.push_back(D->param_size());
1251 for (ParmVarDecl *P : D->parameters())
1252 Record.AddDeclRef(P);
1253 Record.push_back(D->isVariadic());
1254 Record.push_back(D->blockMissingReturnType());
1255 Record.push_back(D->isConversionFromLambda());
1256 Record.push_back(D->doesNotEscape());
1257 Record.push_back(D->canAvoidCopyToHeap());
1258 Record.push_back(D->capturesCXXThis());
1259 Record.push_back(D->getNumCaptures());
1260 for (const auto &capture : D->captures()) {
1261 Record.AddDeclRef(capture.getVariable());
1262
1263 unsigned flags = 0;
1264 if (capture.isByRef()) flags |= 1;
1265 if (capture.isNested()) flags |= 2;
1266 if (capture.hasCopyExpr()) flags |= 4;
1267 Record.push_back(flags);
1268
1269 if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1270 }
1271
1273}
1274
1276 Record.push_back(CD->getNumParams());
1277 VisitDecl(CD);
1278 Record.push_back(CD->getContextParamPosition());
1279 Record.push_back(CD->isNothrow() ? 1 : 0);
1280 // Body is stored by VisitCapturedStmt.
1281 for (unsigned I = 0; I < CD->getNumParams(); ++I)
1282 Record.AddDeclRef(CD->getParam(I));
1284}
1285
1287 static_assert(DeclContext::NumLinkageSpecDeclBits == 4,
1288 "You need to update the serializer after you change the"
1289 "LinkageSpecDeclBits");
1290
1291 VisitDecl(D);
1292 Record.push_back(D->getLanguage());
1293 Record.AddSourceLocation(D->getExternLoc());
1294 Record.AddSourceLocation(D->getRBraceLoc());
1296}
1297
1299 VisitDecl(D);
1300 Record.AddSourceLocation(D->getRBraceLoc());
1302}
1303
1305 VisitNamedDecl(D);
1306 Record.AddSourceLocation(D->getBeginLoc());
1308}
1309
1310
1313 VisitNamedDecl(D);
1314 Record.push_back(D->isInline());
1315 Record.push_back(D->isNested());
1316 Record.AddSourceLocation(D->getBeginLoc());
1317 Record.AddSourceLocation(D->getRBraceLoc());
1318
1319 if (D->isOriginalNamespace())
1320 Record.AddDeclRef(D->getAnonymousNamespace());
1322
1323 if (Writer.hasChain() && D->isAnonymousNamespace() &&
1324 D == D->getMostRecentDecl()) {
1325 // This is a most recent reopening of the anonymous namespace. If its parent
1326 // is in a previous PCH (or is the TU), mark that parent for update, because
1327 // the original namespace always points to the latest re-opening of its
1328 // anonymous namespace.
1329 Decl *Parent = cast<Decl>(
1331 if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1332 Writer.DeclUpdates[Parent].push_back(
1333 ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
1334 }
1335 }
1336}
1337
1340 VisitNamedDecl(D);
1344 Record.AddDeclRef(D->getNamespace());
1346}
1347
1349 VisitNamedDecl(D);
1350 Record.AddSourceLocation(D->getUsingLoc());
1352 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1353 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1354 Record.push_back(D->hasTypename());
1355 Record.AddDeclRef(Context.getInstantiatedFromUsingDecl(D));
1357}
1358
1360 VisitNamedDecl(D);
1361 Record.AddSourceLocation(D->getUsingLoc());
1362 Record.AddSourceLocation(D->getEnumLoc());
1363 Record.AddTypeSourceInfo(D->getEnumType());
1364 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1367}
1368
1370 Record.push_back(D->NumExpansions);
1371 VisitNamedDecl(D);
1373 for (auto *E : D->expansions())
1374 Record.AddDeclRef(E);
1376}
1377
1380 VisitNamedDecl(D);
1381 Record.AddDeclRef(D->getTargetDecl());
1382 Record.push_back(D->getIdentifierNamespace());
1383 Record.AddDeclRef(D->UsingOrNextShadow);
1386}
1387
1391 Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1392 Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1393 Record.push_back(D->IsVirtual);
1395}
1396
1398 VisitNamedDecl(D);
1399 Record.AddSourceLocation(D->getUsingLoc());
1402 Record.AddDeclRef(D->getNominatedNamespace());
1403 Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1405}
1406
1408 VisitValueDecl(D);
1409 Record.AddSourceLocation(D->getUsingLoc());
1411 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1412 Record.AddSourceLocation(D->getEllipsisLoc());
1414}
1415
1418 VisitTypeDecl(D);
1419 Record.AddSourceLocation(D->getTypenameLoc());
1421 Record.AddSourceLocation(D->getEllipsisLoc());
1423}
1424
1427 VisitNamedDecl(D);
1429}
1430
1432 VisitRecordDecl(D);
1433
1434 enum {
1435 CXXRecNotTemplate = 0,
1436 CXXRecTemplate,
1437 CXXRecMemberSpecialization,
1438 CXXLambda
1439 };
1440 if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1441 Record.push_back(CXXRecTemplate);
1442 Record.AddDeclRef(TemplD);
1443 } else if (MemberSpecializationInfo *MSInfo
1445 Record.push_back(CXXRecMemberSpecialization);
1446 Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1447 Record.push_back(MSInfo->getTemplateSpecializationKind());
1448 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1449 } else if (D->isLambda()) {
1450 // For a lambda, we need some information early for merging.
1451 Record.push_back(CXXLambda);
1452 if (auto *Context = D->getLambdaContextDecl()) {
1453 Record.AddDeclRef(Context);
1455 } else {
1456 Record.push_back(0);
1457 }
1458 } else {
1459 Record.push_back(CXXRecNotTemplate);
1460 }
1461
1464 Record.AddCXXDefinitionData(D);
1465
1466 // Store (what we currently believe to be) the key function to avoid
1467 // deserializing every method so we can compute it.
1468 if (D->isCompleteDefinition())
1469 Record.AddDeclRef(Context.getCurrentKeyFunction(D));
1470
1472}
1473
1476 if (D->isCanonicalDecl()) {
1478 for (const CXXMethodDecl *MD : D->overridden_methods())
1479 Record.AddDeclRef(MD);
1480 } else {
1481 // We only need to record overridden methods once for the canonical decl.
1482 Record.push_back(0);
1483 }
1484
1485 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1486 D->getFirstDecl() == D->getMostRecentDecl() && !D->isInvalidDecl() &&
1487 !D->hasAttrs() && !D->isTopLevelDeclInObjCContainer() &&
1489 !D->hasExtInfo() && !D->hasInheritedPrototype() &&
1490 D->hasWrittenPrototype() &&
1492 AbbrevToUse = Writer.getDeclCXXMethodAbbrev();
1493
1495}
1496
1498 static_assert(DeclContext::NumCXXConstructorDeclBits == 20,
1499 "You need to update the serializer after you change the "
1500 "CXXConstructorDeclBits");
1501
1502 Record.push_back(D->getTrailingAllocKind());
1504 if (auto Inherited = D->getInheritedConstructor()) {
1505 Record.AddDeclRef(Inherited.getShadowDecl());
1506 Record.AddDeclRef(Inherited.getConstructor());
1507 }
1508
1511}
1512
1515
1516 Record.AddDeclRef(D->getOperatorDelete());
1517 if (D->getOperatorDelete())
1518 Record.AddStmt(D->getOperatorDeleteThisArg());
1519
1521}
1522
1527}
1528
1530 VisitDecl(D);
1531 Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1532 ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1533 Record.push_back(!IdentifierLocs.empty());
1534 if (IdentifierLocs.empty()) {
1535 Record.AddSourceLocation(D->getEndLoc());
1536 Record.push_back(1);
1537 } else {
1538 for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1539 Record.AddSourceLocation(IdentifierLocs[I]);
1540 Record.push_back(IdentifierLocs.size());
1541 }
1542 // Note: the number of source locations must always be the last element in
1543 // the record.
1545}
1546
1548 VisitDecl(D);
1549 Record.AddSourceLocation(D->getColonLoc());
1551}
1552
1554 // Record the number of friend type template parameter lists here
1555 // so as to simplify memory allocation during deserialization.
1556 Record.push_back(D->NumTPLists);
1557 VisitDecl(D);
1558 bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1559 Record.push_back(hasFriendDecl);
1560 if (hasFriendDecl)
1561 Record.AddDeclRef(D->getFriendDecl());
1562 else
1563 Record.AddTypeSourceInfo(D->getFriendType());
1564 for (unsigned i = 0; i < D->NumTPLists; ++i)
1566 Record.AddDeclRef(D->getNextFriend());
1567 Record.push_back(D->UnsupportedFriend);
1568 Record.AddSourceLocation(D->FriendLoc);
1570}
1571
1573 VisitDecl(D);
1575 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1577 Record.push_back(D->getFriendDecl() != nullptr);
1578 if (D->getFriendDecl())
1579 Record.AddDeclRef(D->getFriendDecl());
1580 else
1581 Record.AddTypeSourceInfo(D->getFriendType());
1582 Record.AddSourceLocation(D->getFriendLoc());
1584}
1585
1587 VisitNamedDecl(D);
1588
1590 Record.AddDeclRef(D->getTemplatedDecl());
1591}
1592
1595 Record.AddStmt(D->getConstraintExpr());
1597}
1598
1601 Record.push_back(D->getTemplateArguments().size());
1602 VisitDecl(D);
1603 for (const TemplateArgument &Arg : D->getTemplateArguments())
1604 Record.AddTemplateArgument(Arg);
1606}
1607
1610}
1611
1614
1615 // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1616 // getCommonPtr() can be used while this is still initializing.
1617 if (D->isFirstDecl()) {
1618 // This declaration owns the 'common' pointer, so serialize that data now.
1621 Record.push_back(D->isMemberSpecialization());
1622 }
1623
1625 Record.push_back(D->getIdentifierNamespace());
1626}
1627
1630
1631 if (D->isFirstDecl())
1634}
1635
1639
1641
1642 llvm::PointerUnion<ClassTemplateDecl *,
1645 if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1646 Record.AddDeclRef(InstFromD);
1647 } else {
1648 Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1650 }
1651
1654 Record.push_back(D->getSpecializationKind());
1655 Record.push_back(D->isCanonicalDecl());
1656
1657 if (D->isCanonicalDecl()) {
1658 // When reading, we'll add it to the folding set of the following template.
1660 }
1661
1662 // Explicit info.
1664 if (D->getTypeAsWritten()) {
1665 Record.AddSourceLocation(D->getExternLoc());
1667 }
1668
1670}
1671
1676
1678
1679 // These are read/set from/to the first declaration.
1680 if (D->getPreviousDecl() == nullptr) {
1682 Record.push_back(D->isMemberSpecialization());
1683 }
1684
1686}
1687
1690
1691 if (D->isFirstDecl())
1694}
1695
1699
1700 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1701 InstFrom = D->getSpecializedTemplateOrPartial();
1702 if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1703 Record.AddDeclRef(InstFromD);
1704 } else {
1705 Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1707 }
1708
1709 // Explicit info.
1711 if (D->getTypeAsWritten()) {
1712 Record.AddSourceLocation(D->getExternLoc());
1714 }
1715
1718 Record.push_back(D->getSpecializationKind());
1719 Record.push_back(D->IsCompleteDefinition);
1720
1721 VisitVarDecl(D);
1722
1723 Record.push_back(D->isCanonicalDecl());
1724
1725 if (D->isCanonicalDecl()) {
1726 // When reading, we'll add it to the folding set of the following template.
1728 }
1729
1731}
1732
1737
1739
1740 // These are read/set from/to the first declaration.
1741 if (D->getPreviousDecl() == nullptr) {
1743 Record.push_back(D->isMemberSpecialization());
1744 }
1745
1747}
1748
1751 VisitDecl(D);
1752 Record.AddDeclRef(D->getSpecialization());
1754 if (D->hasExplicitTemplateArgs())
1757}
1758
1759
1762
1763 if (D->isFirstDecl())
1766}
1767
1769 Record.push_back(D->hasTypeConstraint());
1770 VisitTypeDecl(D);
1771
1773
1774 const TypeConstraint *TC = D->getTypeConstraint();
1775 Record.push_back(TC != nullptr);
1776 if (TC) {
1777 auto *CR = TC->getConceptReference();
1778 Record.push_back(CR != nullptr);
1779 if (CR)
1780 Record.AddConceptReference(CR);
1783 if (D->isExpandedParameterPack())
1785 }
1786
1787 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1789 Record.push_back(OwnsDefaultArg);
1790 if (OwnsDefaultArg)
1792
1794}
1795
1797 // For an expanded parameter pack, record the number of expansion types here
1798 // so that it's easier for deserialization to allocate the right amount of
1799 // memory.
1801 Record.push_back(!!TypeConstraint);
1802 if (D->isExpandedParameterPack())
1803 Record.push_back(D->getNumExpansionTypes());
1804
1806 // TemplateParmPosition.
1807 Record.push_back(D->getDepth());
1808 Record.push_back(D->getPosition());
1809 if (TypeConstraint)
1810 Record.AddStmt(TypeConstraint);
1811
1812 if (D->isExpandedParameterPack()) {
1813 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1814 Record.AddTypeRef(D->getExpansionType(I));
1816 }
1817
1819 } else {
1820 // Rest of NonTypeTemplateParmDecl.
1821 Record.push_back(D->isParameterPack());
1822 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1824 Record.push_back(OwnsDefaultArg);
1825 if (OwnsDefaultArg)
1826 Record.AddStmt(D->getDefaultArgument());
1828 }
1829}
1830
1832 // For an expanded parameter pack, record the number of expansion types here
1833 // so that it's easier for deserialization to allocate the right amount of
1834 // memory.
1835 if (D->isExpandedParameterPack())
1837
1839 // TemplateParmPosition.
1840 Record.push_back(D->getDepth());
1841 Record.push_back(D->getPosition());
1842
1843 if (D->isExpandedParameterPack()) {
1844 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1845 I != N; ++I)
1848 } else {
1849 // Rest of TemplateTemplateParmDecl.
1850 Record.push_back(D->isParameterPack());
1851 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1853 Record.push_back(OwnsDefaultArg);
1854 if (OwnsDefaultArg)
1857 }
1858}
1859
1863}
1864
1866 VisitDecl(D);
1867 Record.AddStmt(D->getAssertExpr());
1868 Record.push_back(D->isFailed());
1869 Record.AddStmt(D->getMessage());
1870 Record.AddSourceLocation(D->getRParenLoc());
1872}
1873
1874/// Emit the DeclContext part of a declaration context decl.
1876 static_assert(DeclContext::NumDeclContextBits == 13,
1877 "You need to update the serializer after you change the "
1878 "DeclContextBits");
1879
1880 Record.AddOffset(Writer.WriteDeclContextLexicalBlock(Context, DC));
1881 Record.AddOffset(Writer.WriteDeclContextVisibleBlock(Context, DC));
1882}
1883
1885 assert(IsLocalDecl(D) && "expected a local declaration");
1886
1887 const Decl *Canon = D->getCanonicalDecl();
1888 if (IsLocalDecl(Canon))
1889 return Canon;
1890
1891 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
1892 if (CacheEntry)
1893 return CacheEntry;
1894
1895 for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
1896 if (IsLocalDecl(Redecl))
1897 D = Redecl;
1898 return CacheEntry = D;
1899}
1900
1901template <typename T>
1903 T *First = D->getFirstDecl();
1904 T *MostRecent = First->getMostRecentDecl();
1905 T *DAsT = static_cast<T *>(D);
1906 if (MostRecent != First) {
1907 assert(isRedeclarableDeclKind(DAsT->getKind()) &&
1908 "Not considered redeclarable?");
1909
1910 Record.AddDeclRef(First);
1911
1912 // Write out a list of local redeclarations of this declaration if it's the
1913 // first local declaration in the chain.
1914 const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
1915 if (DAsT == FirstLocal) {
1916 // Emit a list of all imported first declarations so that we can be sure
1917 // that all redeclarations visible to this module are before D in the
1918 // redecl chain.
1919 unsigned I = Record.size();
1920 Record.push_back(0);
1921 if (Writer.Chain)
1922 AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
1923 // This is the number of imported first declarations + 1.
1924 Record[I] = Record.size() - I;
1925
1926 // Collect the set of local redeclarations of this declaration, from
1927 // newest to oldest.
1928 ASTWriter::RecordData LocalRedecls;
1929 ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
1930 for (const Decl *Prev = FirstLocal->getMostRecentDecl();
1931 Prev != FirstLocal; Prev = Prev->getPreviousDecl())
1932 if (!Prev->isFromASTFile())
1933 LocalRedeclWriter.AddDeclRef(Prev);
1934
1935 // If we have any redecls, write them now as a separate record preceding
1936 // the declaration itself.
1937 if (LocalRedecls.empty())
1938 Record.push_back(0);
1939 else
1940 Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
1941 } else {
1942 Record.push_back(0);
1943 Record.AddDeclRef(FirstLocal);
1944 }
1945
1946 // Make sure that we serialize both the previous and the most-recent
1947 // declarations, which (transitively) ensures that all declarations in the
1948 // chain get serialized.
1949 //
1950 // FIXME: This is not correct; when we reach an imported declaration we
1951 // won't emit its previous declaration.
1952 (void)Writer.GetDeclRef(D->getPreviousDecl());
1953 (void)Writer.GetDeclRef(MostRecent);
1954 } else {
1955 // We use the sentinel value 0 to indicate an only declaration.
1956 Record.push_back(0);
1957 }
1958}
1959
1961 VisitNamedDecl(D);
1963 Record.push_back(D->isCBuffer());
1964 Record.AddSourceLocation(D->getLocStart());
1965 Record.AddSourceLocation(D->getLBraceLoc());
1966 Record.AddSourceLocation(D->getRBraceLoc());
1967
1969}
1970
1972 Record.writeOMPChildren(D->Data);
1973 VisitDecl(D);
1975}
1976
1978 Record.writeOMPChildren(D->Data);
1979 VisitDecl(D);
1981}
1982
1984 Record.writeOMPChildren(D->Data);
1985 VisitDecl(D);
1987}
1988
1990 static_assert(DeclContext::NumOMPDeclareReductionDeclBits == 2,
1991 "You need to update the serializer after you change the "
1992 "NumOMPDeclareReductionDeclBits");
1993
1994 VisitValueDecl(D);
1995 Record.AddSourceLocation(D->getBeginLoc());
1996 Record.AddStmt(D->getCombinerIn());
1997 Record.AddStmt(D->getCombinerOut());
1998 Record.AddStmt(D->getCombiner());
1999 Record.AddStmt(D->getInitOrig());
2000 Record.AddStmt(D->getInitPriv());
2001 Record.AddStmt(D->getInitializer());
2002 Record.push_back(D->getInitializerKind());
2003 Record.AddDeclRef(D->getPrevDeclInScope());
2005}
2006
2008 Record.writeOMPChildren(D->Data);
2009 VisitValueDecl(D);
2010 Record.AddDeclarationName(D->getVarName());
2011 Record.AddDeclRef(D->getPrevDeclInScope());
2013}
2014
2016 VisitVarDecl(D);
2018}
2019
2020//===----------------------------------------------------------------------===//
2021// ASTWriter Implementation
2022//===----------------------------------------------------------------------===//
2023
2024void ASTWriter::WriteDeclAbbrevs() {
2025 using namespace llvm;
2026
2027 std::shared_ptr<BitCodeAbbrev> Abv;
2028
2029 // Abbreviation for DECL_FIELD
2030 Abv = std::make_shared<BitCodeAbbrev>();
2031 Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
2032 // Decl
2033 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2034 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2035 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2036 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2037 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2038 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2039 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2040 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2041 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
2042 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2043 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2044 // NamedDecl
2045 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2046 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2047 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2048 // ValueDecl
2049 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2050 // DeclaratorDecl
2051 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2052 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2053 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2054 // FieldDecl
2055 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2056 Abv->Add(BitCodeAbbrevOp(0)); // StorageKind
2057 // Type Source Info
2058 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2059 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2060 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
2061
2062 // Abbreviation for DECL_OBJC_IVAR
2063 Abv = std::make_shared<BitCodeAbbrev>();
2064 Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
2065 // Decl
2066 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2067 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2068 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2069 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2070 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2071 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2072 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2073 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2074 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
2075 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2076 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2077 // NamedDecl
2078 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2079 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2080 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2081 // ValueDecl
2082 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2083 // DeclaratorDecl
2084 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2085 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2086 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2087 // FieldDecl
2088 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2089 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2090 // ObjC Ivar
2091 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
2092 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
2093 // Type Source Info
2094 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2095 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2096 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2097
2098 // Abbreviation for DECL_ENUM
2099 Abv = std::make_shared<BitCodeAbbrev>();
2100 Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
2101 // Redeclarable
2102 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2103 // Decl
2104 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2105 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2106 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2107 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2108 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2109 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2110 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2111 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2112 Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2113 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2114 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2115 // NamedDecl
2116 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2117 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2118 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2119 // TypeDecl
2120 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2121 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2122 // TagDecl
2123 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2124 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
2125 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
2126 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
2127 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
2128 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
2129 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2130 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2131 Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
2132 // EnumDecl
2133 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
2134 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
2135 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
2136 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumPositiveBits
2137 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumNegativeBits
2138 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScoped
2139 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScopedUsingClassTag
2140 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isFixed
2141 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
2142 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
2143 // DC
2144 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2145 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2146 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2147
2148 // Abbreviation for DECL_RECORD
2149 Abv = std::make_shared<BitCodeAbbrev>();
2150 Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
2151 // Redeclarable
2152 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2153 // Decl
2154 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2155 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2156 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2157 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2158 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2159 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2160 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2161 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2162 Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2163 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2164 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2165 // NamedDecl
2166 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2167 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2168 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2169 // TypeDecl
2170 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2171 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2172 // TagDecl
2173 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2174 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
2175 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
2176 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
2177 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
2178 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
2179 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2180 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2181 Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
2182 // RecordDecl
2183 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // FlexibleArrayMember
2184 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // AnonymousStructUnion
2185 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasObjectMember
2186 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasVolatileMember
2187
2188 // isNonTrivialToPrimitiveDefaultInitialize
2189 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2190 // isNonTrivialToPrimitiveCopy
2191 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2192 // isNonTrivialToPrimitiveDestroy
2193 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2194 // hasNonTrivialToPrimitiveDefaultInitializeCUnion
2195 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2196 // hasNonTrivialToPrimitiveDestructCUnion
2197 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2198 // hasNonTrivialToPrimitiveCopyCUnion
2199 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2200 // isParamDestroyedInCallee
2201 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2202 // getArgPassingRestrictions
2203 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
2204 // ODRHash
2205 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));
2206
2207 // DC
2208 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2209 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2210 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2211
2212 // Abbreviation for DECL_PARM_VAR
2213 Abv = std::make_shared<BitCodeAbbrev>();
2214 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2215 // Redeclarable
2216 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2217 // Decl
2218 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2219 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2220 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2221 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2222 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2223 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2224 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2225 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2226 Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2227 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2228 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2229 // NamedDecl
2230 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2231 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2232 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2233 // ValueDecl
2234 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2235 // DeclaratorDecl
2236 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2237 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2238 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2239 // VarDecl
2240 Abv->Add(BitCodeAbbrevOp(0)); // SClass
2241 Abv->Add(BitCodeAbbrevOp(0)); // TSCSpec
2242 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2243 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
2244 Abv->Add(BitCodeAbbrevOp(0)); // Linkage
2245 Abv->Add(BitCodeAbbrevOp(0)); // ModulesCodegen
2246 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2247 // ParmVarDecl
2248 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsObjCMethodParameter
2249 Abv->Add(BitCodeAbbrevOp(0)); // ScopeDepth
2250 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2251 Abv->Add(BitCodeAbbrevOp(0)); // ObjCDeclQualifier
2252 Abv->Add(BitCodeAbbrevOp(0)); // KNRPromoted
2253 Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedDefaultArg
2254 Abv->Add(BitCodeAbbrevOp(0)); // HasUninstantiatedDefaultArg
2255 // Type Source Info
2256 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2257 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2258 DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2259
2260 // Abbreviation for DECL_TYPEDEF
2261 Abv = std::make_shared<BitCodeAbbrev>();
2262 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2263 // Redeclarable
2264 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2265 // Decl
2266 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2267 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2268 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2269 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2270 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2271 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isUsed
2272 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isReferenced
2273 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2274 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // C++ AccessSpecifier
2275 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2276 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2277 // NamedDecl
2278 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2279 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2280 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2281 // TypeDecl
2282 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2283 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2284 // TypedefDecl
2285 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2286 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2287 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2288
2289 // Abbreviation for DECL_VAR
2290 Abv = std::make_shared<BitCodeAbbrev>();
2291 Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2292 // Redeclarable
2293 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2294 // Decl
2295 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2296 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2297 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2298 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2299 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2300 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2301 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2302 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2303 Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2304 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2305 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2306 // NamedDecl
2307 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2308 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2309 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2310 // ValueDecl
2311 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2312 // DeclaratorDecl
2313 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2314 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2315 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2316 // VarDecl
2317 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // SClass
2318 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // TSCSpec
2319 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // InitStyle
2320 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
2321 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsThisDeclarationADemotedDefinition
2322 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isExceptionVariable
2323 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isNRVOVariable
2324 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCXXForRangeDecl
2325 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isObjCForDecl
2326 Abv->Add(BitCodeAbbrevOp(0)); // isInline
2327 Abv->Add(BitCodeAbbrevOp(0)); // isInlineSpecified
2328 Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr
2329 Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture
2330 Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope
2331 Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind
2332 Abv->Add(BitCodeAbbrevOp(0)); // EscapingByref
2333 Abv->Add(BitCodeAbbrevOp(0)); // HasDeducedType
2334 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2335 Abv->Add(BitCodeAbbrevOp(0)); // ModulesCodeGen
2336 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2337 // Type Source Info
2338 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2339 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2340 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2341
2342 // Abbreviation for DECL_CXX_METHOD
2343 Abv = std::make_shared<BitCodeAbbrev>();
2344 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CXX_METHOD));
2345 // RedeclarableDecl
2346 Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2347 // FIXME: Implement abbreviation for other template kinds.
2348 Abv->Add(BitCodeAbbrevOp(FunctionDecl::TK_NonTemplate)); // TemplateKind
2349 // Decl
2350 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2351 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2352 Abv->Add(BitCodeAbbrevOp(0)); // Invalid
2353 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2354 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Implicit
2355 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Used
2356 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Referenced
2357 Abv->Add(BitCodeAbbrevOp(0)); // InObjCContainer
2358 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Access
2359 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2360 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2361 // NamedDecl
2362 Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2363 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2364 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2365 // ValueDecl
2366 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2367 // DeclaratorDecl
2368 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2369 Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2370 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2371 // FunctionDecl
2372 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2373 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // StorageClass
2374 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Inline
2375 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // InlineSpecified
2376 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // VirtualAsWritten
2377 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Pure
2378 Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedProto
2379 Abv->Add(BitCodeAbbrevOp(1)); // HasWrittenProto
2380 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Deleted
2381 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Trivial
2382 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // TrivialForCall
2383 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Defaulted
2384 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted
2385 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsIneligibleOrNotSelected
2386 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero
2387 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Constexpr
2388 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // UsesSEHTry
2389 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody
2390 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // MultiVersion
2391 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // LateParsed
2392 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // FriendConstraintRefersToEnclosingTemplate
2393 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2394 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2395 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Default
2396 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2397 // This Array slurps the rest of the record. Fortunately we want to encode
2398 // (nearly) all the remaining (variable number of) fields in the same way.
2399 //
2400 // This is:
2401 // NumParams and Params[] from FunctionDecl, and
2402 // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2403 //
2404 // Add an AbbrevOp for 'size then elements' and use it here.
2405 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2406 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2407 DeclCXXMethodAbbrev = Stream.EmitAbbrev(std::move(Abv));
2408
2409 unsigned ExprDependenceBits = llvm::BitWidth<ExprDependence>;
2410 // Abbreviation for EXPR_DECL_REF
2411 Abv = std::make_shared<BitCodeAbbrev>();
2412 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2413 //Stmt
2414 // Expr
2415 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2416 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, ExprDependenceBits));
2417 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2418 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2419 //DeclRefExpr
2420 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HasQualifier
2421 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //GetDeclFound
2422 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ExplicitTemplateArgs
2423 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HadMultipleCandidates
2424 Abv->Add(BitCodeAbbrevOp(0)); // RefersToEnclosingVariableOrCapture
2425 Abv->Add(BitCodeAbbrevOp(0)); // NonOdrUseReason
2426 Abv->Add(BitCodeAbbrevOp(0)); // IsImmediateEscalating
2427 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2428 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2429 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2430
2431 // Abbreviation for EXPR_INTEGER_LITERAL
2432 Abv = std::make_shared<BitCodeAbbrev>();
2433 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2434 //Stmt
2435 // Expr
2436 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2437 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, ExprDependenceBits));
2438 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2439 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2440 //Integer Literal
2441 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2442 Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2443 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2444 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2445
2446 // Abbreviation for EXPR_CHARACTER_LITERAL
2447 Abv = std::make_shared<BitCodeAbbrev>();
2448 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2449 //Stmt
2450 // Expr
2451 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2452 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, ExprDependenceBits));
2453 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2454 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2455 //Character Literal
2456 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2457 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2458 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2459 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2460
2461 // Abbreviation for EXPR_IMPLICIT_CAST
2462 Abv = std::make_shared<BitCodeAbbrev>();
2463 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2464 // Stmt
2465 // Expr
2466 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2467 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, ExprDependenceBits));
2468 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2469 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2470 // CastExpr
2471 Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2472 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // HasFPFeatures
2473 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 6)); // CastKind
2474 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // PartOfExplicitCast
2475 // ImplicitCastExpr
2476 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2477
2478 Abv = std::make_shared<BitCodeAbbrev>();
2479 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2480 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2481 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2482
2483 Abv = std::make_shared<BitCodeAbbrev>();
2484 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2485 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2486 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2487}
2488
2489/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2490/// consumers of the AST.
2491///
2492/// Such decls will always be deserialized from the AST file, so we would like
2493/// this to be as restrictive as possible. Currently the predicate is driven by
2494/// code generation requirements, if other clients have a different notion of
2495/// what is "required" then we may have to consider an alternate scheme where
2496/// clients can iterate over the top-level decls and get information on them,
2497/// without necessary deserializing them. We could explicitly require such
2498/// clients to use a separate API call to "realize" the decl. This should be
2499/// relatively painless since they would presumably only do it for top-level
2500/// decls.
2501static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2502 Module *WritingModule) {
2503 // Named modules have different semantics than header modules. Every named
2504 // module units owns a translation unit. So the importer of named modules
2505 // doesn't need to deserilize everything ahead of time.
2506 if (WritingModule && WritingModule->isModulePurview()) {
2507 // The PragmaCommentDecl and PragmaDetectMismatchDecl are MSVC's extension.
2508 // And the behavior of MSVC for such cases will leak this to the module
2509 // users. Given pragma is not a standard thing, the compiler has the space
2510 // to do their own decision. Let's follow MSVC here.
2511 if (isa<PragmaCommentDecl, PragmaDetectMismatchDecl>(D))
2512 return true;
2513 return false;
2514 }
2515
2516 // An ObjCMethodDecl is never considered as "required" because its
2517 // implementation container always is.
2518
2519 // File scoped assembly or obj-c or OMP declare target implementation must be
2520 // seen.
2521 if (isa<FileScopeAsmDecl, TopLevelStmtDecl, ObjCImplDecl>(D))
2522 return true;
2523
2524 if (WritingModule && isPartOfPerModuleInitializer(D)) {
2525 // These declarations are part of the module initializer, and are emitted
2526 // if and when the module is imported, rather than being emitted eagerly.
2527 return false;
2528 }
2529
2530 return Context.DeclMustBeEmitted(D);
2531}
2532
2533void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2534 PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
2535 "serializing");
2536
2537 // Determine the ID for this declaration.
2539 assert(!D->isFromASTFile() && "should not be emitting imported decl");
2540 serialization::DeclID &IDR = DeclIDs[D];
2541 if (IDR == 0)
2542 IDR = NextDeclID++;
2543
2544 ID = IDR;
2545
2546 assert(ID >= FirstDeclID && "invalid decl ID");
2547
2549 ASTDeclWriter W(*this, Context, Record);
2550
2551 // Build a record for this declaration
2552 W.Visit(D);
2553
2554 // Emit this declaration to the bitstream.
2555 uint64_t Offset = W.Emit(D);
2556
2557 // Record the offset for this declaration
2558 SourceLocation Loc = D->getLocation();
2559 unsigned Index = ID - FirstDeclID;
2560 if (DeclOffsets.size() == Index)
2561 DeclOffsets.emplace_back(getAdjustedLocation(Loc), Offset,
2562 DeclTypesBlockStartOffset);
2563 else if (DeclOffsets.size() < Index) {
2564 // FIXME: Can/should this happen?
2565 DeclOffsets.resize(Index+1);
2566 DeclOffsets[Index].setLocation(getAdjustedLocation(Loc));
2567 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);
2568 } else {
2569 llvm_unreachable("declarations should be emitted in ID order");
2570 }
2571
2572 SourceManager &SM = Context.getSourceManager();
2573 if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2574 associateDeclWithFile(D, ID);
2575
2576 // Note declarations that should be deserialized eagerly so that we can add
2577 // them to a record in the AST file later.
2578 if (isRequiredDecl(D, Context, WritingModule))
2579 EagerlyDeserializedDecls.push_back(ID);
2580}
2581
2583 // Switch case IDs are per function body.
2584 Writer->ClearSwitchCaseIDs();
2585
2586 assert(FD->doesThisDeclarationHaveABody());
2587 bool ModulesCodegen = false;
2588 if (!FD->isDependentContext()) {
2589 std::optional<GVALinkage> Linkage;
2590 if (Writer->WritingModule &&
2591 Writer->WritingModule->isInterfaceOrPartition()) {
2592 // When building a C++20 module interface unit or a partition unit, a
2593 // strong definition in the module interface is provided by the
2594 // compilation of that unit, not by its users. (Inline functions are still
2595 // emitted in module users.)
2596 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2597 ModulesCodegen = *Linkage >= GVA_StrongExternal;
2598 }
2599 if (Writer->Context->getLangOpts().ModulesCodegen ||
2600 (FD->hasAttr<DLLExportAttr>() &&
2601 Writer->Context->getLangOpts().BuildingPCHWithObjectFile)) {
2602
2603 // Under -fmodules-codegen, codegen is performed for all non-internal,
2604 // non-always_inline functions, unless they are available elsewhere.
2605 if (!FD->hasAttr<AlwaysInlineAttr>()) {
2606 if (!Linkage)
2607 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2608 ModulesCodegen =
2610 }
2611 }
2612 }
2613 Record->push_back(ModulesCodegen);
2614 if (ModulesCodegen)
2615 Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(FD));
2616 if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2617 Record->push_back(CD->getNumCtorInitializers());
2618 if (CD->getNumCtorInitializers())
2619 AddCXXCtorInitializers(llvm::ArrayRef(CD->init_begin(), CD->init_end()));
2620 }
2621 AddStmt(FD->getBody());
2622}
NodeId Parent
Definition: ASTDiff.cpp:191
StringRef P
static void addExplicitSpecifier(ExplicitSpecifier ES, ASTRecordWriter &Record)
static bool isRequiredDecl(const Decl *D, ASTContext &Context, Module *WritingModule)
isRequiredDecl - Check if this is a "required" Decl, which must be seen by consumers of the AST.
#define SM(sm)
Definition: Cuda.cpp:80
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
This file defines OpenMP AST classes for clauses.
Defines the SourceManager interface.
const char * Data
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
SourceManager & getSourceManager()
Definition: ASTContext.h:691
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
const LangOptions & getLangOpts() const
Definition: ASTContext.h:761
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
UsingEnumDecl * getInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst)
If the given using-enum decl Inst is an instantiation of another using-enum decl, return it.
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
Definition: ASTContext.h:1169
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 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 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)
void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
void VisitDecl(Decl *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 VisitClassScopeFunctionSpecializationDecl(ClassScopeFunctionSpecializationDecl *D)
void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D)
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
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 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)
ArrayRef< Decl > getPartialSpecializations(FunctionTemplateDecl::Common *)
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context, ASTWriter::RecordDataImpl &Record)
void VisitTagDecl(TagDecl *D)
void VisitTypeAliasDecl(TypeAliasDecl *D)
void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D)
ModuleFile * getOwningModuleFile(const Decl *D)
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
Definition: ASTReader.cpp:7559
An object for streaming information to a record.
void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs)
Emit a template argument list.
Definition: ASTWriter.cpp:5905
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 AddAPValue(const APValue &Value)
Emit an APvalue.
void AddIdentifierRef(const IdentifierInfo *II)
Emit a reference to an identifier.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
void AddDeclarationName(DeclarationName Name)
Emit a declaration name.
void AddSourceRange(SourceRange Range, LocSeq *Seq=nullptr)
Emit a source range.
void AddOffset(uint64_t BitOffset)
Add a bit offset into the record.
void AddTypeRef(QualType T)
Emit a reference to a type.
void AddSourceLocation(SourceLocation Loc, LocSeq *Seq=nullptr)
Emit a source location.
void push_back(uint64_t N)
Minimal vector-like interface.
void append(InputIterator begin, InputIterator end)
void AddTypeLoc(TypeLoc TL, LocSeq *Seq=nullptr)
Emits source location information for a type. Does not emit the type.
Definition: ASTWriter.cpp:5639
void AddCXXCtorInitializers(ArrayRef< CXXCtorInitializer * > CtorInits)
Emit a CXXCtorInitializer array.
Definition: ASTWriter.cpp:5998
void AddTemplateParameterList(const TemplateParameterList *TemplateParams)
Emit a template parameter list.
Definition: ASTWriter.cpp:5886
void AddTemplateArgument(const TemplateArgument &Arg)
Emit a template argument.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name)
Definition: ASTWriter.cpp:5791
void AddTypeSourceInfo(TypeSourceInfo *TInfo)
Emits a reference to a declarator info.
Definition: ASTWriter.cpp:5629
void AddQualifierInfo(const QualifierInfo &Info)
Definition: ASTWriter.cpp:5825
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
void writeOMPChildren(OMPChildren *Data)
Writes data related to the OpenMP directives.
Definition: ASTWriter.cpp:7278
void AddAPSInt(const llvm::APSInt &Value)
Emit a signed integral value.
void AddConceptReference(const ConceptReference *CR)
Definition: ASTWriter.cpp:473
void AddString(StringRef Str)
Emit a string.
void AddAttributes(ArrayRef< const Attr * > Attrs)
Emit a list of attributes.
Definition: ASTWriter.cpp:4473
void AddASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *ASTTemplArgList)
Emits an AST template argument list info.
Definition: ASTWriter.cpp:5913
void AddCXXDefinitionData(const CXXRecordDecl *D)
Definition: ASTWriter.cpp:6003
void AddVarDeclInit(const VarDecl *VD)
Emit information about the initializer of a VarDecl.
Definition: ASTWriter.cpp:6075
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg)
Emits a template argument location.
Definition: ASTWriter.cpp:5616
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Emit a nested name specifier with source-location information.
Definition: ASTWriter.cpp:5832
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:86
unsigned getDeclParmVarAbbrev() const
Definition: ASTWriter.h:732
unsigned getDeclObjCIvarAbbrev() const
Definition: ASTWriter.h:738
serialization::DeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its ID.
Definition: ASTWriter.cpp:5690
unsigned getDeclTypedefAbbrev() const
Definition: ASTWriter.h:734
bool hasChain() const
Definition: ASTWriter.h:746
unsigned getDeclVarAbbrev() const
Definition: ASTWriter.h:735
unsigned getDeclEnumAbbrev() const
Definition: ASTWriter.h:737
bool IsLocalDecl(const Decl *D)
Is this a local declaration (that is, one that will be written to our AST file)? This is the case for...
Definition: ASTWriter.h:670
unsigned getDeclCXXMethodAbbrev() const
Definition: ASTWriter.h:739
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:91
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
Definition: ASTWriter.cpp:5770
unsigned getDeclFieldAbbrev() const
Definition: ASTWriter.h:736
unsigned getDeclRecordAbbrev() const
Definition: ASTWriter.h:733
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:4060
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:4084
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4379
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition: Decl.h:4502
bool canAvoidCopyToHeap() const
Definition: Decl.h:4533
size_t param_size() const
Definition: Decl.h:4481
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:4458
ArrayRef< Capture > captures() const
Definition: Decl.h:4506
bool blockMissingReturnType() const
Definition: Decl.h:4514
bool capturesCXXThis() const
Definition: Decl.h:4511
bool doesNotEscape() const
Definition: Decl.h:4530
bool isConversionFromLambda() const
Definition: Decl.h:4522
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:4465
bool isVariadic() const
Definition: Decl.h:4454
TypeSourceInfo * getSignatureAsWritten() const
Definition: Decl.h:4462
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2491
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2562
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2728
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2818
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2845
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:1937
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:1971
DeductionCandidate getDeductionCandidateKind() const
Definition: DeclCXX.h:1990
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2755
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2788
Expr * getOperatorDeleteThisArg() const
Definition: DeclCXX.h:2792
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2035
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:2127
overridden_method_range overridden_methods() const
Definition: DeclCXX.cpp:2479
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:2473
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
Definition: DeclCXX.cpp:1643
unsigned getLambdaIndexInContext() const
Retrieve the index of this lambda within the context declaration returned by getLambdaContextDecl().
Definition: DeclCXX.h:1781
bool isLambda() const
Determine whether this class describes a lambda function object.
Definition: DeclCXX.h:1009
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1855
static bool classofKind(Kind K)
Definition: DeclCXX.h:1874
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Definition: DeclCXX.cpp:1841
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:519
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4571
unsigned getNumParams() const
Definition: Decl.h:4613
unsigned getContextParamPosition() const
Definition: Decl.h:4642
bool isNothrow() const
Definition: Decl.cpp:5315
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4615
Declaration of a function specialization at template class scope.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Declaration of a class template.
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
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.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
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.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
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:3552
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:1409
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1951
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:1209
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1864
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1299
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:67
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
Definition: DeclBase.h:1029
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition: DeclBase.h:1044
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:428
bool hasAttrs() const
Definition: DeclBase.h:502
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:576
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
Definition: Decl.cpp:100
ModuleOwnershipKind getModuleOwnershipKind() const
Get the kind of module ownership for this declaration.
Definition: DeclBase.h:844
bool isReferenced() const
Whether any declaration of this entity was referenced.
Definition: DeclBase.cpp:483
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:952
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:811
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:754
bool isInvalidDecl() const
Definition: DeclBase.h:571
unsigned getIdentifierNamespace() const
Definition: DeclBase.h:857
SourceLocation getLocation() const
Definition: DeclBase.h:432
const char * getDeclKindName() const
Definition: DeclBase.cpp:124
bool isTopLevelDeclInObjCContainer() const
Whether this declaration is a top-level declaration (function, global variable, etc....
Definition: DeclBase.h:611
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
Definition: DeclBase.cpp:458
DeclContext * getDeclContext()
Definition: DeclBase.h:441
AccessSpecifier getAccess() const
Definition: DeclBase.h:491
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclBase.h:424
AttrVec & getAttrs()
Definition: DeclBase.h:508
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition: DeclBase.h:886
bool hasAttr() const
Definition: DeclBase.h:560
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:946
Kind getKind() const
Definition: DeclBase.h:435
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:767
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
Definition: Decl.h:810
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:796
A decomposition declaration.
Definition: DeclCXX.h:4119
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:4151
Provides information about a dependent function-template specialization declaration.
Definition: DeclTemplate.h:699
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
Definition: DeclTemplate.h:729
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
Definition: DeclTemplate.h:750
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
Definition: DeclTemplate.h:743
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i'th template candidate.
Definition: DeclTemplate.h:732
Represents an empty-declaration.
Definition: Decl.h:4810
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3197
const Expr * getInitExpr() const
Definition: Decl.h:3216
const llvm::APSInt & getInitVal() const
Definition: Decl.h:3218
Represents an enum.
Definition: Decl.h:3758
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
Definition: Decl.h:4017
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3963
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:3955
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3966
unsigned getODRHash()
Definition: Decl.cpp:4837
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
Definition: Decl.h:3934
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3854
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3972
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3918
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum.
Definition: Decl.h:3944
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition: Decl.h:3910
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1882
ExplicitSpecKind getKind() const
Definition: DeclCXX.h:1890
const Expr * getExpr() const
Definition: DeclCXX.h:1891
Represents a standard C++ module export declaration.
Definition: Decl.h:4763
SourceLocation getRBraceLoc() const
Definition: Decl.h:4782
This represents one expression.
Definition: Expr.h:110
Represents a member of a struct/union/class.
Definition: Decl.h:2962
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:3047
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:3120
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition: Decl.h:3155
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
Definition: Decl.h:3063
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition: Decl.h:3160
const StringLiteral * getAsmString() const
Definition: Decl.h:4333
SourceLocation getRParenLoc() const
Definition: Decl.h:4327
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:129
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Definition: DeclFriend.h:136
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:121
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:1919
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition: Decl.h:2534
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:3174
bool isTrivialForCall() const
Definition: Decl.h:2277
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2257
ConstexprSpecKind getConstexprKind() const
Definition: Decl.h:2373
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:3952
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition: Decl.h:2733
SourceLocation getDefaultLoc() const
Definition: Decl.h:2295
bool usesSEHTry() const
Indicates the function uses __try.
Definition: Decl.h:2415
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2603
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted.
Definition: Decl.h:2286
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2274
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition: Decl.h:2345
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
Definition: Decl.cpp:3931
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:4076
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:2230
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition: Decl.cpp:4138
unsigned getODRHash()
Returns ODRHash of the function.
Definition: Decl.cpp:4410
@ TK_MemberSpecialization
Definition: Decl.h:1931
@ TK_DependentNonTemplate
Definition: Decl.h:1940
@ TK_FunctionTemplateSpecialization
Definition: Decl.h:1935
@ TK_DependentFunctionTemplateSpecialization
Definition: Decl.h:1938
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2700
bool FriendConstraintRefersToEnclosingTemplate() const
Definition: Decl.h:2552
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3903
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition: Decl.h:2261
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition: Decl.h:2325
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition: Decl.h:2524
bool isDefaulted() const
Whether this function is defaulted.
Definition: Decl.h:2282
bool isIneligibleOrNotSelected() const
Definition: Decl.h:2315
FunctionDecl * getInstantiatedFromDecl() const
Definition: Decl.cpp:3970
DefaultedFunctionInfo * getDefaultedFunctionInfo() const
Definition: Decl.cpp:3090
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2248
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:2356
size_t param_size() const
Definition: Decl.h:2619
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2711
Declaration of a template function.
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:483
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:497
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:539
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:
Definition: DeclTemplate.h:610
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:501
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:570
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:542
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition: Decl.h:4825
bool isCBuffer() const
Definition: Decl.h:4853
SourceLocation getLBraceLoc() const
Definition: Decl.h:4850
SourceLocation getLocStart() const LLVM_READONLY
Definition: Decl.h:4849
SourceLocation getRBraceLoc() const
Definition: Decl.h:4851
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4684
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:5585
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4742
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3237
unsigned getChainingSize() const
Definition: Decl.h:3264
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:3258
Represents the declaration of a label.
Definition: Decl.h:496
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition: DeclCXX.h:3183
unsigned getManglingNumber() const
Definition: DeclCXX.h:3232
Expr * getTemporaryExpr()
Retrieve the expression to which the temporary materialization conversion was applied.
Definition: DeclCXX.h:3229
Represents a linkage specification.
Definition: DeclCXX.h:2884
SourceLocation getExternLoc() const
Definition: DeclCXX.h:2927
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2913
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:2928
A global _GUID constant.
Definition: DeclCXX.h:4242
Parts getParts() const
Get the decomposed parts of this declaration.
Definition: DeclCXX.h:4272
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:4188
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:4210
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:4212
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:632
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:654
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:672
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:651
Describes a module or submodule.
Definition: Module.h:104
bool isInterfaceOrPartition() const
Definition: Module.h:590
bool isModulePurview() const
Does this Module scope describe part of the purview of a standard named C++ module?
Definition: Module.h:182
This represents a decl that may have a name.
Definition: Decl.h:247
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
Definition: DeclBase.h:625
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Definition: Decl.cpp:1186
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:313
NamedDecl * getMostRecentDecl()
Definition: Decl.h:473
Represents a C++ namespace alias.
Definition: DeclCXX.h:3074
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3137
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3162
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:3165
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition: DeclCXX.h:3146
Represent a C++ namespace.
Definition: Decl.h:544
SourceLocation getRBraceLoc() const
Definition: Decl.h:683
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:682
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2943
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Definition: Decl.h:602
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:607
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
Definition: Decl.h:662
bool isNested() const
Returns true if this is a nested namespace declaration.
Definition: Decl.h:624
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.
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.
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
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:473
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:383
OMPChildren * Data
Data, associated with the directive.
Definition: DeclOpenMP.h:43
This represents '#pragma omp declare mapper ...' directive.
Definition: DeclOpenMP.h:287
OMPDeclareMapperDecl * getPrevDeclInScope()
Get reference to previous declare mapper construct in the same scope with the same name.
Definition: DeclOpenMP.cpp:158
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
Definition: DeclOpenMP.h:359
This represents '#pragma omp declare reduction ...' directive.
Definition: DeclOpenMP.h:171
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:239
Expr * getInitPriv()
Get Priv variable of the initializer.
Definition: DeclOpenMP.h:249
Expr * getCombinerOut()
Get Out variable of the combiner.
Definition: DeclOpenMP.h:227
Expr * getCombinerIn()
Get In variable of the combiner.
Definition: DeclOpenMP.h:224
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:221
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:242
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name.
Definition: DeclOpenMP.cpp:126
Expr * getInitOrig()
Get Orig variable of the initializer.
Definition: DeclOpenMP.h:246
This represents '#pragma omp requires...' directive.
Definition: DeclOpenMP.h:416
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:110
Represents a field declaration created by an @defs(...).
Definition: DeclObjC.h:2016
static bool classofKind(Kind K)
Definition: DeclObjC.h:2036
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2312
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2402
unsigned protocol_size() const
Definition: DeclObjC.h:2397
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2357
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2449
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2451
protocol_range protocols() const
Definition: DeclObjC.h:2388
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2445
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2531
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2559
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2759
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2777
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:941
SourceRange getAtEndRange() const
Definition: DeclObjC.h:1096
SourceLocation getAtStartLoc() const
Definition: DeclObjC.h:1089
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2472
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2584
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2662
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2728
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
Definition: DeclObjC.h:2686
SourceLocation getSuperClassLoc() const
Definition: DeclObjC.h:2721
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction?
Definition: DeclObjC.h:2691
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2653
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2719
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2726
Represents an ObjC class declaration.
Definition: DeclObjC.h:1147
protocol_range protocols() const
Definition: DeclObjC.h:1347
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: DeclObjC.cpp:792
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:1376
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
Definition: DeclObjC.h:1772
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Definition: DeclObjC.h:1511
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1906
SourceLocation getEndOfDefinitionLoc() const
Definition: DeclObjC.h:1865
TypeSourceInfo * getSuperClassTInfo() const
Definition: DeclObjC.h:1561
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1939
AccessControl getAccessControl() const
Definition: DeclObjC.h:1988
bool getSynthesize() const
Definition: DeclObjC.h:1995
static bool classofKind(Kind K)
Definition: DeclObjC.h:2003
T *const * iterator
Definition: DeclObjC.h:88
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
ImplicitParamDecl * getSelfDecl() const
Definition: DeclObjC.h:420
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
Definition: DeclObjC.h:464
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: DeclObjC.h:248
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:375
unsigned param_size() const
Definition: DeclObjC.h:349
bool isPropertyAccessor() const
Definition: DeclObjC.h:438
bool isVariadic() const
Definition: DeclObjC.h:433
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition: DeclObjC.cpp:909
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclObjC.cpp:1047
TypeSourceInfo * getReturnTypeSourceInfo() const
Definition: DeclObjC.h:345
bool hasRedeclaration() const
True if redeclared in the same interface.
Definition: DeclObjC.h:273
bool isSynthesizedAccessorStub() const
Definition: DeclObjC.h:446
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type.
Definition: DeclObjC.h:258
ImplementationControl getImplementationControl() const
Definition: DeclObjC.h:502
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
Definition: DeclObjC.h:268
ImplicitParamDecl * getCmdDecl() const
Definition: DeclObjC.h:422
bool isInstanceMethod() const
Definition: DeclObjC.h:428
bool isDefined() const
Definition: DeclObjC.h:454
QualType getReturnType() const
Definition: DeclObjC.h:331
bool hasSkippedBody() const
True if the method was a definition but its body was skipped.
Definition: DeclObjC.h:479
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:729
SourceLocation getGetterNameLoc() const
Definition: DeclObjC.h:879
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:894
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:897
SourceLocation getSetterNameLoc() const
Definition: DeclObjC.h:887
SourceLocation getAtLoc() const
Definition: DeclObjC.h:789
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:917
Selector getSetterName() const
Definition: DeclObjC.h:886
TypeSourceInfo * getTypeSourceInfo() const
Definition: DeclObjC.h:795
QualType getType() const
Definition: DeclObjC.h:797
Selector getGetterName() const
Definition: DeclObjC.h:878
SourceLocation getLParenLoc() const
Definition: DeclObjC.h:792
ObjCPropertyAttribute::Kind getPropertyAttributesAsWritten() const
Definition: DeclObjC.h:820
ObjCPropertyAttribute::Kind getPropertyAttributes() const
Definition: DeclObjC.h:808
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:905
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2789
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2862
SourceLocation getPropertyIvarDeclLoc() const
Definition: DeclObjC.h:2865
Expr * getSetterCXXAssignment() const
Definition: DeclObjC.h:2898
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2853
Expr * getGetterCXXConstructor() const
Definition: DeclObjC.h:2890
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:2887
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclObjC.h:2850
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:2884
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2069
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:2244
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2165
protocol_range protocols() const
Definition: DeclObjC.h:2144
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: DeclObjC.cpp:2090
unsigned protocol_size() const
Definition: DeclObjC.h:2183
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:579
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:658
unsigned size() const
Determine the number of type parameters in this list.
Definition: DeclObjC.h:685
SourceLocation getRAngleLoc() const
Definition: DeclObjC.h:709
SourceLocation getLAngleLoc() const
Definition: DeclObjC.h:708
Represents a parameter to a function.
Definition: Decl.h:1724
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion:
Definition: Decl.h:1805
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition: Decl.h:1784
bool isObjCMethodParameter() const
Definition: Decl.h:1767
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: Decl.h:1788
bool hasUninstantiatedDefaultArg() const
Definition: Decl.h:1845
bool hasInheritedDefaultArg() const
Definition: Decl.h:1857
Expr * getUninstantiatedDefaultArg()
Definition: Decl.cpp:2983
unsigned getFunctionScopeDepth() const
Definition: Decl.h:1774
Represents a #pragma comment line.
Definition: Decl.h:140
StringRef getArg() const
Definition: Decl.h:163
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:161
Represents a #pragma detect_mismatch line.
Definition: Decl.h:174
StringRef getName() const
Definition: Decl.h:195
StringRef getValue() const
Definition: Decl.h:196
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
A (possibly-)qualified type.
Definition: Type.h:736
Represents a struct/union/class.
Definition: Decl.h:4036
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: Decl.cpp:5081
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition: Decl.h:4168
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition: Decl.h:4176
bool hasVolatileMember() const
Definition: Decl.h:4121
bool hasFlexibleArrayMember() const
Definition: Decl.h:4091
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition: Decl.h:4160
bool hasObjectMember() const
Definition: Decl.h:4118
bool isNonTrivialToPrimitiveDestroy() const
Definition: Decl.h:4152
bool isNonTrivialToPrimitiveCopy() const
Definition: Decl.h:4144
bool isParamDestroyedInCallee() const
Definition: Decl.h:4199
RecordDecl * getMostRecentDecl()
Definition: Decl.h:4084
ArgPassingKind getArgPassingRestrictions() const
Definition: Decl.h:4191
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition: Decl.h:4136
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition: Decl.h:4110
Declaration of a redeclarable template.
Definition: DeclTemplate.h:767
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:911
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:958
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:84
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:216
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:204
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Definition: Redeclarable.h:226
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Definition: Redeclarable.h:223
Represents the body of a requires-expression.
Definition: DeclCXX.h:2013
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
This class handles loading and caching of source files into memory.
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:4011
bool isFailed() const
Definition: DeclCXX.h:4040
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:4042
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3477
SourceRange getBraceRange() const
Definition: Decl.h:3556
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3575
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:3604
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3580
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:3703
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:3589
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition: Decl.h:3615
TagKind getTagKind() const
Definition: Decl.h:3672
Represents a template argument.
Definition: TemplateBase.h:60
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:410
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:442
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:429
A template parameter object.
const APValue & getValue() const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
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.
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.
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
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.
bool isExpandedParameterPack() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
unsigned getNumExpansionParameters() const
Retrieves the number of parameters in an expanded parameter pack.
A declaration that models statements at global scope.
Definition: Decl.h:4346
The top declaration context.
Definition: Decl.h:82
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3449
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:3466
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Definition: ASTConcept.h:231
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
Definition: ASTConcept.h:246
ConceptReference * getConceptReference() const
Definition: ASTConcept.h:250
Represents a declaration of a type.
Definition: Decl.h:3285
const Type * getTypeForDecl() const
Definition: Decl.h:3309
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:3312
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:6729
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
Definition: Type.cpp:1952
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3429
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3327
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:3377
bool isModed() const
Definition: Decl.h:3373
QualType getUnderlyingType() const
Definition: Decl.h:3382
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes,...
Definition: Decl.cpp:5376
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Definition: DeclCXX.h:4299
const APValue & getValue() const
Definition: DeclCXX.h:4325
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Definition: DeclCXX.h:3993
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3912
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
Definition: DeclCXX.h:3942
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3946
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3963
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3815
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
Definition: DeclCXX.h:3846
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3856
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3873
Represents a C++ using-declaration.
Definition: DeclCXX.h:3466
bool hasTypename() const
Return true if the using declaration has 'typename'.
Definition: DeclCXX.h:3515
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3500
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
Definition: DeclCXX.h:3493
Represents C++ using-directive.
Definition: DeclCXX.h:2969
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:3040
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2892
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:3036
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3044
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3014
Represents a C++ using-enum-declaration.
Definition: DeclCXX.h:3666
SourceLocation getEnumLoc() const
The source location of the 'enum' keyword.
Definition: DeclCXX.h:3690
TypeSourceInfo * getEnumType() const
Definition: DeclCXX.h:3704
SourceLocation getUsingLoc() const
The source location of the 'using' keyword.
Definition: DeclCXX.h:3686
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Definition: DeclCXX.h:3747
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition: DeclCXX.h:3777
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Definition: DeclCXX.h:3781
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3274
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3338
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:703
QualType getType() const
Definition: Decl.h:714
Represents a variable declaration or definition.
Definition: Decl.h:915
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Definition: Decl.cpp:2760
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1521
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1418
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition: Decl.h:1530
@ CInit
C-style initialization with assignment.
Definition: Decl.h:920
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C.
Definition: Decl.h:1484
bool isInlineSpecified() const
Definition: Decl.h:1506
bool isStaticDataMember() const
Determines whether this is a static data member.
Definition: Decl.h:1242
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
Definition: Decl.h:1474
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
Definition: Decl.h:1464
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Definition: Decl.h:1446
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1503
ThreadStorageClassSpecifier getTSCSpec() const
Definition: Decl.h:1136
const Expr * getInit() const
Definition: Decl.h:1327
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition: Decl.h:1499
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
Definition: Decl.h:1188
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1127
bool isEscapingByref() const
Indicates the capture is a __block variable that is captured by a block that can potentially escape (...
Definition: Decl.cpp:2648
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Definition: Decl.h:1428
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
Definition: Decl.h:1544
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Definition: Decl.cpp:2840
Declaration of a variable template.
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
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()
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 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 getExternLoc() const
Gets the location of the extern keyword, if present.
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.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
RetTy Visit(PTR(Decl) D)
Definition: DeclVisitor.h:37
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
Definition: ASTBitCodes.h:1241
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1249
@ DECL_EMPTY
An EmptyDecl record.
Definition: ASTBitCodes.h:1501
@ DECL_CAPTURED
A CapturedDecl record.
Definition: ASTBitCodes.h:1338
@ DECL_CXX_RECORD
A CXXRecordDecl record.
Definition: ASTBitCodes.h:1399
@ DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1441
@ DECL_OMP_ALLOCATE
An OMPAllocateDcl record.
Definition: ASTBitCodes.h:1498
@ DECL_MS_PROPERTY
A MSPropertyDecl record.
Definition: ASTBitCodes.h:1305
@ DECL_OMP_DECLARE_MAPPER
An OMPDeclareMapperDecl record.
Definition: ASTBitCodes.h:1522
@ DECL_TOP_LEVEL_STMT_DECL
A TopLevelStmtDecl record.
Definition: ASTBitCodes.h:1332
@ DECL_REQUIRES_EXPR_BODY
A RequiresExprBodyDecl record.
Definition: ASTBitCodes.h:1507
@ DECL_STATIC_ASSERT
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1465
@ DECL_INDIRECTFIELD
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1474
@ DECL_TEMPLATE_TEMPLATE_PARM
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1453
@ DECL_IMPORT
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1489
@ DECL_UNNAMED_GLOBAL_CONSTANT
A UnnamedGlobalConstantDecl record.
Definition: ASTBitCodes.h:1528
@ DECL_ACCESS_SPEC
An AccessSpecDecl record.
Definition: ASTBitCodes.h:1417
@ DECL_OBJC_TYPE_PARAM
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1510
@ DECL_OBJC_CATEGORY_IMPL
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1287
@ DECL_ENUM_CONSTANT
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1263
@ DECL_PARM_VAR
A ParmVarDecl record.
Definition: ASTBitCodes.h:1320
@ DECL_TYPEDEF
A TypedefDecl record.
Definition: ASTBitCodes.h:1251
@ DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack.
Definition: ASTBitCodes.h:1482
@ DECL_HLSL_BUFFER
A HLSLBufferDecl record.
Definition: ASTBitCodes.h:1531
@ DECL_NAMESPACE_ALIAS
A NamespaceAliasDecl record.
Definition: ASTBitCodes.h:1366
@ DECL_TYPEALIAS
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1254
@ DECL_FUNCTION_TEMPLATE
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1444
@ DECL_MS_GUID
A MSGuidDecl record.
Definition: ASTBitCodes.h:1308
@ DECL_UNRESOLVED_USING_TYPENAME
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1390
@ DECL_CLASS_TEMPLATE_SPECIALIZATION
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1429
@ DECL_FILE_SCOPE_ASM
A FileScopeAsmDecl record.
Definition: ASTBitCodes.h:1329
@ DECL_CXX_CONSTRUCTOR
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1408
@ DECL_CXX_CONVERSION
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1414
@ DECL_FIELD
A FieldDecl record.
Definition: ASTBitCodes.h:1302
@ DECL_LINKAGE_SPEC
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1393
@ DECL_NAMESPACE
A NamespaceDecl record.
Definition: ASTBitCodes.h:1363
@ DECL_NON_TYPE_TEMPLATE_PARM
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1450
@ DECL_USING_PACK
A UsingPackDecl record.
Definition: ASTBitCodes.h:1375
@ DECL_FUNCTION
A FunctionDecl record.
Definition: ASTBitCodes.h:1266
@ DECL_USING_DIRECTIVE
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1384
@ DECL_RECORD
A RecordDecl record.
Definition: ASTBitCodes.h:1260
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
Definition: ASTBitCodes.h:1348
@ DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
Definition: ASTBitCodes.h:1486
@ DECL_BLOCK
A BlockDecl record.
Definition: ASTBitCodes.h:1335
@ DECL_UNRESOLVED_USING_VALUE
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1387
@ DECL_TYPE_ALIAS_TEMPLATE
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1456
@ DECL_OBJC_CATEGORY
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1284
@ DECL_VAR
A VarDecl record.
Definition: ASTBitCodes.h:1314
@ DECL_UNRESOLVED_USING_IF_EXISTS
An UnresolvedUsingIfExistsDecl record.
Definition: ASTBitCodes.h:1462
@ DECL_USING
A UsingDecl record.
Definition: ASTBitCodes.h:1369
@ DECL_OBJC_PROTOCOL
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1275
@ DECL_TEMPLATE_TYPE_PARM
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1447
@ DECL_VAR_TEMPLATE_SPECIALIZATION
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1438
@ DECL_OBJC_IMPLEMENTATION
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1290
@ DECL_LABEL
A LabelDecl record.
Definition: ASTBitCodes.h:1360
@ DECL_OBJC_COMPATIBLE_ALIAS
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1293
@ DECL_CONSTRUCTOR_USING_SHADOW
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1381
@ DECL_USING_ENUM
A UsingEnumDecl record.
Definition: ASTBitCodes.h:1372
@ DECL_FRIEND_TEMPLATE
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1423
@ DECL_PRAGMA_DETECT_MISMATCH
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1519
@ DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack.
Definition: ASTBitCodes.h:1478
@ DECL_OBJC_AT_DEFS_FIELD
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1281
@ DECL_IMPLICIT_PARAM
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1317
@ DECL_FRIEND
A FriendDecl record.
Definition: ASTBitCodes.h:1420
@ DECL_CXX_METHOD
A CXXMethodDecl record.
Definition: ASTBitCodes.h:1405
@ DECL_EXPORT
An ExportDecl record.
Definition: ASTBitCodes.h:1396
@ DECL_BINDING
A BindingDecl record.
Definition: ASTBitCodes.h:1326
@ DECL_PRAGMA_COMMENT
A PragmaCommentDecl record.
Definition: ASTBitCodes.h:1516
@ DECL_ENUM
An EnumDecl record.
Definition: ASTBitCodes.h:1257
@ DECL_DECOMPOSITION
A DecompositionDecl record.
Definition: ASTBitCodes.h:1323
@ DECL_OMP_DECLARE_REDUCTION
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1525
@ DECL_OMP_THREADPRIVATE
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1492
@ DECL_OBJC_METHOD
A ObjCMethodDecl record.
Definition: ASTBitCodes.h:1269
@ DECL_CXX_DESTRUCTOR
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1411
@ DECL_OMP_CAPTUREDEXPR
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1513
@ DECL_CLASS_TEMPLATE
A ClassTemplateDecl record.
Definition: ASTBitCodes.h:1426
@ DECL_USING_SHADOW
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1378
@ DECL_CONCEPT
A ConceptDecl record.
Definition: ASTBitCodes.h:1459
@ DECL_CXX_DEDUCTION_GUIDE
A CXXDeductionGuideDecl record.
Definition: ASTBitCodes.h:1402
@ DECL_OMP_REQUIRES
An OMPRequiresDecl record.
Definition: ASTBitCodes.h:1495
@ DECL_OBJC_IVAR
A ObjCIvarDecl record.
Definition: ASTBitCodes.h:1278
@ DECL_OBJC_PROPERTY
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1296
@ DECL_TEMPLATE_PARAM_OBJECT
A TemplateParamObjectDecl record.
Definition: ASTBitCodes.h:1311
@ DECL_OBJC_INTERFACE
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1272
@ DECL_VAR_TEMPLATE
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1435
@ DECL_LIFETIME_EXTENDED_TEMPORARY
An LifetimeExtendedTemporaryDecl record.
Definition: ASTBitCodes.h:1504
@ DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1432
@ DECL_IMPLICIT_CONCEPT_SPECIALIZATION
An ImplicitConceptSpecializationDecl record.
Definition: ASTBitCodes.h:1534
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
Definition: ASTBitCodes.h:1357
@ DECL_OBJC_PROPERTY_IMPL
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1299
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1678
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1639
@ EXPR_DECL_REF
A DeclRefExpr record.
Definition: ASTBitCodes.h:1624
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
Definition: ASTBitCodes.h:1627
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
Definition: ASTCommon.cpp:352
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
Definition: ASTCommon.cpp:457
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
Definition: ASTBitCodes.h:68
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:116
@ UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION
Definition: ASTCommon.h:26
@ UPD_CXX_ADDED_ANONYMOUS_NAMESPACE
Definition: ASTCommon.h:27
@ GVA_StrongExternal
Definition: Linkage.h:72
@ GVA_AvailableExternally
Definition: Linkage.h:70
@ GVA_Internal
Definition: Linkage.h:69
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition: Linkage.h:23
@ SD_Static
Static storage duration.
Definition: Specifiers.h:318
@ AS_none
Definition: Specifiers.h:118
unsigned long uint64_t
YAML serialization mapping.
Definition: Dominators.h:30
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
Definition: TemplateBase.h:656
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
Definition: TemplateBase.h:653
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:659
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Definition: Expr.h:6213
Data that is common to all of the declarations of a given function template.
Parts of a decomposed MSGuidDecl.
Definition: DeclCXX.h:4217
uint16_t Part2
...-89ab-...
Definition: DeclCXX.h:4221
uint32_t Part1
{01234567-...
Definition: DeclCXX.h:4219
uint16_t Part3
...-cdef-...
Definition: DeclCXX.h:4223
uint8_t Part4And5[8]
...-0123-456789abcdef}
Definition: DeclCXX.h:4225
static DeclType * getDecl(EntryType *D)
Definition: DeclTemplate.h:787