clang 17.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 (DeclaratorDecl *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 (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
290 Record.push_back(FD->doesThisDeclarationHaveABody());
291 if (FD->doesThisDeclarationHaveABody())
292 Record.AddFunctionDefinition(FD);
293 }
294
295 // If this declaration is also a DeclContext, write blocks for the
296 // declarations that lexically stored inside its context and those
297 // declarations that are visible from its context.
298 if (DeclContext *DC = dyn_cast<DeclContext>(D))
300}
301
303 Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
304 if (D->getDeclContext() != D->getLexicalDeclContext())
305 Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
306 else
307 Record.push_back(0);
308 Record.push_back(D->isInvalidDecl());
309 Record.push_back(D->hasAttrs());
310 if (D->hasAttrs())
311 Record.AddAttributes(D->getAttrs());
312 Record.push_back(D->isImplicit());
313 Record.push_back(D->isUsed(false));
314 Record.push_back(D->isReferenced());
316 Record.push_back(D->getAccess());
317 Record.push_back((uint64_t)D->getModuleOwnershipKind());
318 Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
319
320 // If this declaration injected a name into a context different from its
321 // lexical context, and that context is an imported namespace, we need to
322 // update its visible declarations to include this name.
323 //
324 // This happens when we instantiate a class with a friend declaration or a
325 // function with a local extern declaration, for instance.
326 //
327 // FIXME: Can we handle this in AddedVisibleDecl instead?
328 if (D->isOutOfLine()) {
329 auto *DC = D->getDeclContext();
330 while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
331 if (!NS->isFromASTFile())
332 break;
333 Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
334 if (!NS->isInlineNamespace())
335 break;
336 DC = NS->getParent();
337 }
338 }
339}
340
342 StringRef Arg = D->getArg();
343 Record.push_back(Arg.size());
344 VisitDecl(D);
345 Record.AddSourceLocation(D->getBeginLoc());
346 Record.push_back(D->getCommentKind());
347 Record.AddString(Arg);
349}
350
353 StringRef Name = D->getName();
354 StringRef Value = D->getValue();
355 Record.push_back(Name.size() + 1 + Value.size());
356 VisitDecl(D);
357 Record.AddSourceLocation(D->getBeginLoc());
358 Record.AddString(Name);
359 Record.AddString(Value);
361}
362
364 llvm_unreachable("Translation units aren't directly serialized");
365}
366
368 VisitDecl(D);
369 Record.AddDeclarationName(D->getDeclName());
372 : 0);
373}
374
377 Record.AddSourceLocation(D->getBeginLoc());
378 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
379}
380
383 VisitTypeDecl(D);
385 Record.push_back(D->isModed());
386 if (D->isModed())
387 Record.AddTypeRef(D->getUnderlyingType());
388 Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
389}
390
393 if (D->getDeclContext() == D->getLexicalDeclContext() &&
394 !D->hasAttrs() &&
395 !D->isImplicit() &&
396 D->getFirstDecl() == D->getMostRecentDecl() &&
397 !D->isInvalidDecl() &&
399 !D->isModulePrivate() &&
402 AbbrevToUse = Writer.getDeclTypedefAbbrev();
403
405}
406
411}
412
414 static_assert(DeclContext::NumTagDeclBits == 10,
415 "You need to update the serializer after you change the "
416 "TagDeclBits");
417
419 VisitTypeDecl(D);
421 Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding
422 if (!isa<CXXRecordDecl>(D))
423 Record.push_back(D->isCompleteDefinition());
425 Record.push_back(D->isFreeStanding());
427 Record.AddSourceRange(D->getBraceRange());
428
429 if (D->hasExtInfo()) {
430 Record.push_back(1);
431 Record.AddQualifierInfo(*D->getExtInfo());
432 } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
433 Record.push_back(2);
434 Record.AddDeclRef(TD);
435 Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
436 } else {
437 Record.push_back(0);
438 }
439}
440
442 static_assert(DeclContext::NumEnumDeclBits == 20,
443 "You need to update the serializer after you change the "
444 "EnumDeclBits");
445
446 VisitTagDecl(D);
448 if (!D->getIntegerTypeSourceInfo())
449 Record.AddTypeRef(D->getIntegerType());
450 Record.AddTypeRef(D->getPromotionType());
451 Record.push_back(D->getNumPositiveBits());
452 Record.push_back(D->getNumNegativeBits());
453 Record.push_back(D->isScoped());
454 Record.push_back(D->isScopedUsingClassTag());
455 Record.push_back(D->isFixed());
456 Record.push_back(D->getODRHash());
457
459 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
460 Record.push_back(MemberInfo->getTemplateSpecializationKind());
461 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
462 } else {
463 Record.AddDeclRef(nullptr);
464 }
465
466 if (D->getDeclContext() == D->getLexicalDeclContext() &&
467 !D->hasAttrs() &&
468 !D->isImplicit() &&
469 !D->isUsed(false) &&
470 !D->hasExtInfo() &&
472 D->getFirstDecl() == D->getMostRecentDecl() &&
473 !D->isInvalidDecl() &&
474 !D->isReferenced() &&
476 D->getAccess() == AS_none &&
477 !D->isModulePrivate() &&
483 AbbrevToUse = Writer.getDeclEnumAbbrev();
484
486}
487
489 static_assert(DeclContext::NumRecordDeclBits == 41,
490 "You need to update the serializer after you change the "
491 "RecordDeclBits");
492
493 VisitTagDecl(D);
496 Record.push_back(D->hasObjectMember());
497 Record.push_back(D->hasVolatileMember());
506 // Only compute this for C/Objective-C, in C++ this is computed as part
507 // of CXXRecordDecl.
508 if (!isa<CXXRecordDecl>(D))
509 Record.push_back(D->getODRHash());
510
511 if (D->getDeclContext() == D->getLexicalDeclContext() &&
512 !D->hasAttrs() &&
513 !D->isImplicit() &&
514 !D->isUsed(false) &&
515 !D->hasExtInfo() &&
517 D->getFirstDecl() == D->getMostRecentDecl() &&
518 !D->isInvalidDecl() &&
519 !D->isReferenced() &&
521 D->getAccess() == AS_none &&
522 !D->isModulePrivate() &&
526 AbbrevToUse = Writer.getDeclRecordAbbrev();
527
529}
530
533 Record.AddTypeRef(D->getType());
534}
535
538 Record.push_back(D->getInitExpr()? 1 : 0);
539 if (D->getInitExpr())
540 Record.AddStmt(D->getInitExpr());
541 Record.AddAPSInt(D->getInitVal());
542
544}
545
549 Record.push_back(D->hasExtInfo());
550 if (D->hasExtInfo()) {
551 DeclaratorDecl::ExtInfo *Info = D->getExtInfo();
552 Record.AddQualifierInfo(*Info);
553 Record.AddStmt(Info->TrailingRequiresClause);
554 }
555 // The location information is deferred until the end of the record.
557 : QualType());
558}
559
561 static_assert(DeclContext::NumFunctionDeclBits == 29,
562 "You need to update the serializer after you change the "
563 "FunctionDeclBits");
564
566
567 Record.push_back(D->getTemplatedKind());
568 switch (D->getTemplatedKind()) {
570 break;
573 break;
576 break;
579 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
580 Record.push_back(MemberInfo->getTemplateSpecializationKind());
581 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
582 break;
583 }
586 FTSInfo = D->getTemplateSpecializationInfo();
587
589
590 Record.AddDeclRef(FTSInfo->getTemplate());
591 Record.push_back(FTSInfo->getTemplateSpecializationKind());
592
593 // Template arguments.
595
596 // Template args as written.
597 Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
598 if (FTSInfo->TemplateArgumentsAsWritten) {
600 for (int i=0, e = FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs;
601 i!=e; ++i)
603 (*FTSInfo->TemplateArgumentsAsWritten)[i]);
606 }
607
609
610 if (MemberSpecializationInfo *MemberInfo =
611 FTSInfo->getMemberSpecializationInfo()) {
612 Record.push_back(1);
613 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
614 Record.push_back(MemberInfo->getTemplateSpecializationKind());
615 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
616 } else {
617 Record.push_back(0);
618 }
619
620 if (D->isCanonicalDecl()) {
621 // Write the template that contains the specializations set. We will
622 // add a FunctionTemplateSpecializationInfo to it when reading.
623 Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
624 }
625 break;
626 }
629 DFTSInfo = D->getDependentSpecializationInfo();
630
631 // Templates.
632 Record.push_back(DFTSInfo->getNumTemplates());
633 for (int i=0, e = DFTSInfo->getNumTemplates(); i != e; ++i)
634 Record.AddDeclRef(DFTSInfo->getTemplate(i));
635
636 // Templates args.
637 Record.push_back(DFTSInfo->getNumTemplateArgs());
638 for (int i=0, e = DFTSInfo->getNumTemplateArgs(); i != e; ++i)
639 Record.AddTemplateArgumentLoc(DFTSInfo->getTemplateArg(i));
640 Record.AddSourceLocation(DFTSInfo->getLAngleLoc());
641 Record.AddSourceLocation(DFTSInfo->getRAngleLoc());
642 break;
643 }
644 }
645
647 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
649
650 // FunctionDecl's body is handled last at ASTWriterDecl::Visit,
651 // after everything else is written.
652 Record.push_back(
653 static_cast<int>(D->getStorageClass())); // FIXME: stable encoding
654 Record.push_back(D->isInlineSpecified());
655 Record.push_back(D->isInlined());
656 Record.push_back(D->isVirtualAsWritten());
657 Record.push_back(D->isPure());
658 Record.push_back(D->hasInheritedPrototype());
659 Record.push_back(D->hasWrittenPrototype());
660 Record.push_back(D->isDeletedBit());
661 Record.push_back(D->isTrivial());
662 Record.push_back(D->isTrivialForCall());
663 Record.push_back(D->isDefaulted());
664 Record.push_back(D->isExplicitlyDefaulted());
666 Record.push_back(D->hasImplicitReturnZero());
667 Record.push_back(static_cast<uint64_t>(D->getConstexprKind()));
668 Record.push_back(D->usesSEHTry());
669 Record.push_back(D->hasSkippedBody());
670 Record.push_back(D->isMultiVersion());
671 Record.push_back(D->isLateTemplateParsed());
673 Record.push_back(D->getLinkageInternal());
674 Record.AddSourceLocation(D->getEndLoc());
675 Record.AddSourceLocation(D->getDefaultLoc());
676
677 Record.push_back(D->getODRHash());
678
679 if (D->isDefaulted()) {
680 if (auto *FDI = D->getDefaultedFunctionInfo()) {
681 Record.push_back(FDI->getUnqualifiedLookups().size());
682 for (DeclAccessPair P : FDI->getUnqualifiedLookups()) {
683 Record.AddDeclRef(P.getDecl());
684 Record.push_back(P.getAccess());
685 }
686 } else {
687 Record.push_back(0);
688 }
689 }
690
691 Record.push_back(D->param_size());
692 for (auto *P : D->parameters())
693 Record.AddDeclRef(P);
695}
696
698 ASTRecordWriter &Record) {
699 uint64_t Kind = static_cast<uint64_t>(ES.getKind());
700 Kind = Kind << 1 | static_cast<bool>(ES.getExpr());
701 Record.push_back(Kind);
702 if (ES.getExpr()) {
703 Record.AddStmt(ES.getExpr());
704 }
705}
706
709 Record.AddDeclRef(D->Ctor);
713}
714
716 static_assert(DeclContext::NumObjCMethodDeclBits == 24,
717 "You need to update the serializer after you change the "
718 "ObjCMethodDeclBits");
719
721 // FIXME: convert to LazyStmtPtr?
722 // Unlike C/C++, method bodies will never be in header files.
723 bool HasBodyStuff = D->getBody() != nullptr;
724 Record.push_back(HasBodyStuff);
725 if (HasBodyStuff) {
726 Record.AddStmt(D->getBody());
727 }
728 Record.AddDeclRef(D->getSelfDecl());
729 Record.AddDeclRef(D->getCmdDecl());
730 Record.push_back(D->isInstanceMethod());
731 Record.push_back(D->isVariadic());
732 Record.push_back(D->isPropertyAccessor());
734 Record.push_back(D->isDefined());
735 Record.push_back(D->isOverriding());
736 Record.push_back(D->hasSkippedBody());
737
738 Record.push_back(D->isRedeclaration());
739 Record.push_back(D->hasRedeclaration());
740 if (D->hasRedeclaration()) {
741 assert(Context.getObjCMethodRedeclaration(D));
742 Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
743 }
744
745 // FIXME: stable encoding for @required/@optional
747 // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
748 Record.push_back(D->getObjCDeclQualifier());
749 Record.push_back(D->hasRelatedResultType());
750 Record.AddTypeRef(D->getReturnType());
752 Record.AddSourceLocation(D->getEndLoc());
753 Record.push_back(D->param_size());
754 for (const auto *P : D->parameters())
755 Record.AddDeclRef(P);
756
757 Record.push_back(D->getSelLocsKind());
758 unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
759 SourceLocation *SelLocs = D->getStoredSelLocs();
760 Record.push_back(NumStoredSelLocs);
761 for (unsigned i = 0; i != NumStoredSelLocs; ++i)
762 Record.AddSourceLocation(SelLocs[i]);
763
765}
766
769 Record.push_back(D->Variance);
770 Record.push_back(D->Index);
771 Record.AddSourceLocation(D->VarianceLoc);
772 Record.AddSourceLocation(D->ColonLoc);
773
775}
776
778 static_assert(DeclContext::NumObjCContainerDeclBits == 51,
779 "You need to update the serializer after you change the "
780 "ObjCContainerDeclBits");
781
783 Record.AddSourceLocation(D->getAtStartLoc());
784 Record.AddSourceRange(D->getAtEndRange());
785 // Abstract class (no need to define a stable serialization::DECL code).
786}
787
791 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
792 AddObjCTypeParamList(D->TypeParamList);
793
796 // Write the DefinitionData
797 ObjCInterfaceDecl::DefinitionData &Data = D->data();
798
801 Record.push_back(Data.HasDesignatedInitializers);
802 Record.push_back(D->getODRHash());
803
804 // Write out the protocols that are directly referenced by the @interface.
805 Record.push_back(Data.ReferencedProtocols.size());
806 for (const auto *P : D->protocols())
807 Record.AddDeclRef(P);
808 for (const auto &PL : D->protocol_locs())
809 Record.AddSourceLocation(PL);
810
811 // Write out the protocols that are transitively referenced.
812 Record.push_back(Data.AllReferencedProtocols.size());
814 P = Data.AllReferencedProtocols.begin(),
815 PEnd = Data.AllReferencedProtocols.end();
816 P != PEnd; ++P)
817 Record.AddDeclRef(*P);
818
819
820 if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
821 // Ensure that we write out the set of categories for this class.
822 Writer.ObjCClassesWithCategories.insert(D);
823
824 // Make sure that the categories get serialized.
825 for (; Cat; Cat = Cat->getNextClassCategoryRaw())
826 (void)Writer.GetDeclRef(Cat);
827 }
828 }
829
831}
832
835 // FIXME: stable encoding for @public/@private/@protected/@package
836 Record.push_back(D->getAccessControl());
837 Record.push_back(D->getSynthesize());
838
839 if (D->getDeclContext() == D->getLexicalDeclContext() &&
840 !D->hasAttrs() &&
841 !D->isImplicit() &&
842 !D->isUsed(false) &&
843 !D->isInvalidDecl() &&
844 !D->isReferenced() &&
845 !D->isModulePrivate() &&
846 !D->getBitWidth() &&
847 !D->hasExtInfo() &&
848 D->getDeclName())
849 AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
850
852}
853
857
860 Record.push_back(D->protocol_size());
861 for (const auto *I : D->protocols())
862 Record.AddDeclRef(I);
863 for (const auto &PL : D->protocol_locs())
864 Record.AddSourceLocation(PL);
865 Record.push_back(D->getODRHash());
866 }
867
869}
870
874}
875
881 Record.AddDeclRef(D->getClassInterface());
882 AddObjCTypeParamList(D->TypeParamList);
883 Record.push_back(D->protocol_size());
884 for (const auto *I : D->protocols())
885 Record.AddDeclRef(I);
886 for (const auto &PL : D->protocol_locs())
887 Record.AddSourceLocation(PL);
889}
890
893 Record.AddDeclRef(D->getClassInterface());
895}
896
899 Record.AddSourceLocation(D->getAtLoc());
900 Record.AddSourceLocation(D->getLParenLoc());
901 Record.AddTypeRef(D->getType());
903 // FIXME: stable encoding
904 Record.push_back((unsigned)D->getPropertyAttributes());
905 Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
906 // FIXME: stable encoding
907 Record.push_back((unsigned)D->getPropertyImplementation());
912 Record.AddDeclRef(D->getGetterMethodDecl());
913 Record.AddDeclRef(D->getSetterMethodDecl());
914 Record.AddDeclRef(D->getPropertyIvarDecl());
916}
917
920 Record.AddDeclRef(D->getClassInterface());
921 // Abstract class (no need to define a stable serialization::DECL code).
922}
923
928}
929
932 Record.AddDeclRef(D->getSuperClass());
937 Record.push_back(D->hasDestructors());
938 Record.push_back(D->NumIvarInitializers);
939 if (D->NumIvarInitializers)
943}
944
946 VisitDecl(D);
947 Record.AddSourceLocation(D->getBeginLoc());
948 Record.AddDeclRef(D->getPropertyDecl());
949 Record.AddDeclRef(D->getPropertyIvarDecl());
951 Record.AddDeclRef(D->getGetterMethodDecl());
952 Record.AddDeclRef(D->getSetterMethodDecl());
953 Record.AddStmt(D->getGetterCXXConstructor());
954 Record.AddStmt(D->getSetterCXXAssignment());
956}
957
960 Record.push_back(D->isMutable());
961
962 FieldDecl::InitStorageKind ISK = D->InitStorage.getInt();
963 Record.push_back(ISK);
964 if (ISK == FieldDecl::ISK_CapturedVLAType)
965 Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
966 else if (ISK)
967 Record.AddStmt(D->getInClassInitializer());
968
969 Record.AddStmt(D->getBitWidth());
970
971 if (!D->getDeclName())
973
974 if (D->getDeclContext() == D->getLexicalDeclContext() &&
975 !D->hasAttrs() &&
976 !D->isImplicit() &&
977 !D->isUsed(false) &&
978 !D->isInvalidDecl() &&
979 !D->isReferenced() &&
981 !D->isModulePrivate() &&
982 !D->getBitWidth() &&
983 !D->hasInClassInitializer() &&
984 !D->hasCapturedVLAType() &&
985 !D->hasExtInfo() &&
988 D->getDeclName())
989 AbbrevToUse = Writer.getDeclFieldAbbrev();
990
992}
993
996 Record.AddIdentifierRef(D->getGetterId());
997 Record.AddIdentifierRef(D->getSetterId());
999}
1000
1002 VisitValueDecl(D);
1003 MSGuidDecl::Parts Parts = D->getParts();
1004 Record.push_back(Parts.Part1);
1005 Record.push_back(Parts.Part2);
1006 Record.push_back(Parts.Part3);
1007 Record.append(std::begin(Parts.Part4And5), std::end(Parts.Part4And5));
1009}
1010
1013 VisitValueDecl(D);
1014 Record.AddAPValue(D->getValue());
1016}
1017
1019 VisitValueDecl(D);
1020 Record.AddAPValue(D->getValue());
1022}
1023
1025 VisitValueDecl(D);
1026 Record.push_back(D->getChainingSize());
1027
1028 for (const auto *P : D->chain())
1029 Record.AddDeclRef(P);
1031}
1032
1036 Record.push_back(D->getStorageClass());
1037 Record.push_back(D->getTSCSpec());
1038 Record.push_back(D->getInitStyle());
1039 Record.push_back(D->isARCPseudoStrong());
1040 if (!isa<ParmVarDecl>(D)) {
1042 Record.push_back(D->isExceptionVariable());
1043 Record.push_back(D->isNRVOVariable());
1044 Record.push_back(D->isCXXForRangeDecl());
1045 Record.push_back(D->isObjCForDecl());
1046 Record.push_back(D->isInline());
1047 Record.push_back(D->isInlineSpecified());
1048 Record.push_back(D->isConstexpr());
1049 Record.push_back(D->isInitCapture());
1051 if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
1052 Record.push_back(static_cast<unsigned>(IPD->getParameterKind()));
1053 else
1054 Record.push_back(0);
1055 Record.push_back(D->isEscapingByref());
1056 }
1057 Record.push_back(D->getLinkageInternal());
1058
1059 Record.AddVarDeclInit(D);
1060
1061 if (D->hasAttr<BlocksAttr>() && D->getType()->getAsCXXRecordDecl()) {
1062 BlockVarCopyInit Init = Writer.Context->getBlockVarCopyInit(D);
1063 Record.AddStmt(Init.getCopyExpr());
1064 if (Init.getCopyExpr())
1065 Record.push_back(Init.canThrow());
1066 }
1067
1068 if (D->getStorageDuration() == SD_Static) {
1069 bool ModulesCodegen = false;
1070 if (Writer.WritingModule &&
1072 // When building a C++20 module interface unit or a partition unit, a
1073 // strong definition in the module interface is provided by the
1074 // compilation of that unit, not by its users. (Inline variables are still
1075 // emitted in module users.)
1076 ModulesCodegen =
1077 (Writer.WritingModule->isInterfaceOrPartition() ||
1078 (D->hasAttr<DLLExportAttr>() &&
1079 Writer.Context->getLangOpts().BuildingPCHWithObjectFile)) &&
1080 Writer.Context->GetGVALinkageForVariable(D) >= GVA_StrongExternal;
1081 }
1082 Record.push_back(ModulesCodegen);
1083 if (ModulesCodegen)
1084 Writer.ModularCodegenDecls.push_back(Writer.GetDeclRef(D));
1085 }
1086
1087 enum {
1088 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1089 };
1090 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1091 Record.push_back(VarTemplate);
1092 Record.AddDeclRef(TemplD);
1093 } else if (MemberSpecializationInfo *SpecInfo
1095 Record.push_back(StaticDataMemberSpecialization);
1096 Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1097 Record.push_back(SpecInfo->getTemplateSpecializationKind());
1098 Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1099 } else {
1100 Record.push_back(VarNotTemplate);
1101 }
1102
1103 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1104 !D->hasAttrs() &&
1105 !D->isImplicit() &&
1106 !D->isUsed(false) &&
1107 !D->isInvalidDecl() &&
1108 !D->isReferenced() &&
1110 D->getAccess() == AS_none &&
1111 !D->isModulePrivate() &&
1114 !D->hasExtInfo() &&
1115 D->getFirstDecl() == D->getMostRecentDecl() &&
1116 D->getKind() == Decl::Var &&
1117 !D->isInline() &&
1118 !D->isConstexpr() &&
1119 !D->isInitCapture() &&
1121 !(D->hasAttr<BlocksAttr>() && D->getType()->getAsCXXRecordDecl()) &&
1122 !D->isEscapingByref() &&
1123 D->getStorageDuration() != SD_Static &&
1125 AbbrevToUse = Writer.getDeclVarAbbrev();
1126
1128}
1129
1131 VisitVarDecl(D);
1133}
1134
1136 VisitVarDecl(D);
1137 Record.push_back(D->isObjCMethodParameter());
1138 Record.push_back(D->getFunctionScopeDepth());
1139 Record.push_back(D->getFunctionScopeIndex());
1140 Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding
1141 Record.push_back(D->isKNRPromoted());
1142 Record.push_back(D->hasInheritedDefaultArg());
1147
1148 // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1149 // we dynamically check for the properties that we optimize for, but don't
1150 // know are true of all PARM_VAR_DECLs.
1151 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1152 !D->hasAttrs() &&
1153 !D->hasExtInfo() &&
1154 !D->isImplicit() &&
1155 !D->isUsed(false) &&
1156 !D->isInvalidDecl() &&
1157 !D->isReferenced() &&
1158 D->getAccess() == AS_none &&
1159 !D->isModulePrivate() &&
1160 D->getStorageClass() == 0 &&
1161 D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1162 D->getFunctionScopeDepth() == 0 &&
1163 D->getObjCDeclQualifier() == 0 &&
1164 !D->isKNRPromoted() &&
1165 !D->hasInheritedDefaultArg() &&
1166 D->getInit() == nullptr &&
1167 !D->hasUninstantiatedDefaultArg()) // No default expr.
1168 AbbrevToUse = Writer.getDeclParmVarAbbrev();
1169
1170 // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1171 // just us assuming it.
1172 assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1174 && "PARM_VAR_DECL can't be demoted definition.");
1175 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1176 assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1177 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1178 assert(!D->isStaticDataMember() &&
1179 "PARM_VAR_DECL can't be static data member");
1180}
1181
1183 // Record the number of bindings first to simplify deserialization.
1184 Record.push_back(D->bindings().size());
1185
1186 VisitVarDecl(D);
1187 for (auto *B : D->bindings())
1188 Record.AddDeclRef(B);
1190}
1191
1193 VisitValueDecl(D);
1194 Record.AddStmt(D->getBinding());
1196}
1197
1199 VisitDecl(D);
1200 Record.AddStmt(D->getAsmString());
1201 Record.AddSourceLocation(D->getRParenLoc());
1203}
1204
1206 VisitDecl(D);
1207 Record.AddStmt(D->getStmt());
1209}
1210
1212 VisitDecl(D);
1214}
1215
1218 VisitDecl(D);
1219 Record.AddDeclRef(D->getExtendingDecl());
1220 Record.AddStmt(D->getTemporaryExpr());
1221 Record.push_back(static_cast<bool>(D->getValue()));
1222 if (D->getValue())
1223 Record.AddAPValue(*D->getValue());
1224 Record.push_back(D->getManglingNumber());
1226}
1228 VisitDecl(D);
1229 Record.AddStmt(D->getBody());
1231 Record.push_back(D->param_size());
1232 for (ParmVarDecl *P : D->parameters())
1233 Record.AddDeclRef(P);
1234 Record.push_back(D->isVariadic());
1235 Record.push_back(D->blockMissingReturnType());
1236 Record.push_back(D->isConversionFromLambda());
1237 Record.push_back(D->doesNotEscape());
1238 Record.push_back(D->canAvoidCopyToHeap());
1239 Record.push_back(D->capturesCXXThis());
1240 Record.push_back(D->getNumCaptures());
1241 for (const auto &capture : D->captures()) {
1242 Record.AddDeclRef(capture.getVariable());
1243
1244 unsigned flags = 0;
1245 if (capture.isByRef()) flags |= 1;
1246 if (capture.isNested()) flags |= 2;
1247 if (capture.hasCopyExpr()) flags |= 4;
1248 Record.push_back(flags);
1249
1250 if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1251 }
1252
1254}
1255
1257 Record.push_back(CD->getNumParams());
1258 VisitDecl(CD);
1259 Record.push_back(CD->getContextParamPosition());
1260 Record.push_back(CD->isNothrow() ? 1 : 0);
1261 // Body is stored by VisitCapturedStmt.
1262 for (unsigned I = 0; I < CD->getNumParams(); ++I)
1263 Record.AddDeclRef(CD->getParam(I));
1265}
1266
1268 static_assert(DeclContext::NumLinkageSpecDeclBits == 4,
1269 "You need to update the serializer after you change the"
1270 "LinkageSpecDeclBits");
1271
1272 VisitDecl(D);
1273 Record.push_back(D->getLanguage());
1274 Record.AddSourceLocation(D->getExternLoc());
1275 Record.AddSourceLocation(D->getRBraceLoc());
1277}
1278
1280 VisitDecl(D);
1281 Record.AddSourceLocation(D->getRBraceLoc());
1283}
1284
1286 VisitNamedDecl(D);
1287 Record.AddSourceLocation(D->getBeginLoc());
1289}
1290
1291
1294 VisitNamedDecl(D);
1295 Record.push_back(D->isInline());
1296 Record.push_back(D->isNested());
1297 Record.AddSourceLocation(D->getBeginLoc());
1298 Record.AddSourceLocation(D->getRBraceLoc());
1299
1300 if (D->isOriginalNamespace())
1301 Record.AddDeclRef(D->getAnonymousNamespace());
1303
1304 if (Writer.hasChain() && D->isAnonymousNamespace() &&
1305 D == D->getMostRecentDecl()) {
1306 // This is a most recent reopening of the anonymous namespace. If its parent
1307 // is in a previous PCH (or is the TU), mark that parent for update, because
1308 // the original namespace always points to the latest re-opening of its
1309 // anonymous namespace.
1310 Decl *Parent = cast<Decl>(
1312 if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1313 Writer.DeclUpdates[Parent].push_back(
1314 ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
1315 }
1316 }
1317}
1318
1321 VisitNamedDecl(D);
1325 Record.AddDeclRef(D->getNamespace());
1327}
1328
1330 VisitNamedDecl(D);
1331 Record.AddSourceLocation(D->getUsingLoc());
1333 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1334 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1335 Record.push_back(D->hasTypename());
1336 Record.AddDeclRef(Context.getInstantiatedFromUsingDecl(D));
1338}
1339
1341 VisitNamedDecl(D);
1342 Record.AddSourceLocation(D->getUsingLoc());
1343 Record.AddSourceLocation(D->getEnumLoc());
1344 Record.AddTypeSourceInfo(D->getEnumType());
1345 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1348}
1349
1351 Record.push_back(D->NumExpansions);
1352 VisitNamedDecl(D);
1354 for (auto *E : D->expansions())
1355 Record.AddDeclRef(E);
1357}
1358
1361 VisitNamedDecl(D);
1362 Record.AddDeclRef(D->getTargetDecl());
1363 Record.push_back(D->getIdentifierNamespace());
1364 Record.AddDeclRef(D->UsingOrNextShadow);
1367}
1368
1372 Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1373 Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1374 Record.push_back(D->IsVirtual);
1376}
1377
1379 VisitNamedDecl(D);
1380 Record.AddSourceLocation(D->getUsingLoc());
1383 Record.AddDeclRef(D->getNominatedNamespace());
1384 Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1386}
1387
1389 VisitValueDecl(D);
1390 Record.AddSourceLocation(D->getUsingLoc());
1392 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1393 Record.AddSourceLocation(D->getEllipsisLoc());
1395}
1396
1399 VisitTypeDecl(D);
1400 Record.AddSourceLocation(D->getTypenameLoc());
1402 Record.AddSourceLocation(D->getEllipsisLoc());
1404}
1405
1408 VisitNamedDecl(D);
1410}
1411
1413 VisitRecordDecl(D);
1414
1415 enum {
1416 CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
1417 };
1418 if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1419 Record.push_back(CXXRecTemplate);
1420 Record.AddDeclRef(TemplD);
1421 } else if (MemberSpecializationInfo *MSInfo
1423 Record.push_back(CXXRecMemberSpecialization);
1424 Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1425 Record.push_back(MSInfo->getTemplateSpecializationKind());
1426 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1427 } else {
1428 Record.push_back(CXXRecNotTemplate);
1429 }
1430
1433 Record.AddCXXDefinitionData(D);
1434
1435 // Store (what we currently believe to be) the key function to avoid
1436 // deserializing every method so we can compute it.
1437 if (D->isCompleteDefinition())
1438 Record.AddDeclRef(Context.getCurrentKeyFunction(D));
1439
1441}
1442
1445 if (D->isCanonicalDecl()) {
1447 for (const CXXMethodDecl *MD : D->overridden_methods())
1448 Record.AddDeclRef(MD);
1449 } else {
1450 // We only need to record overridden methods once for the canonical decl.
1451 Record.push_back(0);
1452 }
1453
1454 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1455 D->getFirstDecl() == D->getMostRecentDecl() && !D->isInvalidDecl() &&
1456 !D->hasAttrs() && !D->isTopLevelDeclInObjCContainer() &&
1458 !D->hasExtInfo() && !D->hasInheritedPrototype() &&
1459 D->hasWrittenPrototype() &&
1461 AbbrevToUse = Writer.getDeclCXXMethodAbbrev();
1462
1464}
1465
1467 static_assert(DeclContext::NumCXXConstructorDeclBits == 22,
1468 "You need to update the serializer after you change the "
1469 "CXXConstructorDeclBits");
1470
1471 Record.push_back(D->getTrailingAllocKind());
1473 if (auto Inherited = D->getInheritedConstructor()) {
1474 Record.AddDeclRef(Inherited.getShadowDecl());
1475 Record.AddDeclRef(Inherited.getConstructor());
1476 }
1477
1480}
1481
1484
1485 Record.AddDeclRef(D->getOperatorDelete());
1486 if (D->getOperatorDelete())
1487 Record.AddStmt(D->getOperatorDeleteThisArg());
1488
1490}
1491
1496}
1497
1499 VisitDecl(D);
1500 Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1501 ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1502 Record.push_back(!IdentifierLocs.empty());
1503 if (IdentifierLocs.empty()) {
1504 Record.AddSourceLocation(D->getEndLoc());
1505 Record.push_back(1);
1506 } else {
1507 for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1508 Record.AddSourceLocation(IdentifierLocs[I]);
1509 Record.push_back(IdentifierLocs.size());
1510 }
1511 // Note: the number of source locations must always be the last element in
1512 // the record.
1514}
1515
1517 VisitDecl(D);
1518 Record.AddSourceLocation(D->getColonLoc());
1520}
1521
1523 // Record the number of friend type template parameter lists here
1524 // so as to simplify memory allocation during deserialization.
1525 Record.push_back(D->NumTPLists);
1526 VisitDecl(D);
1527 bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1528 Record.push_back(hasFriendDecl);
1529 if (hasFriendDecl)
1530 Record.AddDeclRef(D->getFriendDecl());
1531 else
1532 Record.AddTypeSourceInfo(D->getFriendType());
1533 for (unsigned i = 0; i < D->NumTPLists; ++i)
1535 Record.AddDeclRef(D->getNextFriend());
1536 Record.push_back(D->UnsupportedFriend);
1537 Record.AddSourceLocation(D->FriendLoc);
1539}
1540
1542 VisitDecl(D);
1544 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1546 Record.push_back(D->getFriendDecl() != nullptr);
1547 if (D->getFriendDecl())
1548 Record.AddDeclRef(D->getFriendDecl());
1549 else
1550 Record.AddTypeSourceInfo(D->getFriendType());
1551 Record.AddSourceLocation(D->getFriendLoc());
1553}
1554
1556 VisitNamedDecl(D);
1557
1559 Record.AddDeclRef(D->getTemplatedDecl());
1560}
1561
1564 Record.AddStmt(D->getConstraintExpr());
1566}
1567
1570 Record.push_back(D->getTemplateArguments().size());
1571 VisitDecl(D);
1572 for (const TemplateArgument &Arg : D->getTemplateArguments())
1573 Record.AddTemplateArgument(Arg);
1575}
1576
1579}
1580
1583
1584 // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1585 // getCommonPtr() can be used while this is still initializing.
1586 if (D->isFirstDecl()) {
1587 // This declaration owns the 'common' pointer, so serialize that data now.
1590 Record.push_back(D->isMemberSpecialization());
1591 }
1592
1594 Record.push_back(D->getIdentifierNamespace());
1595}
1596
1599
1600 if (D->isFirstDecl())
1603}
1604
1608
1610
1611 llvm::PointerUnion<ClassTemplateDecl *,
1614 if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1615 Record.AddDeclRef(InstFromD);
1616 } else {
1617 Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1619 }
1620
1623 Record.push_back(D->getSpecializationKind());
1624 Record.push_back(D->isCanonicalDecl());
1625
1626 if (D->isCanonicalDecl()) {
1627 // When reading, we'll add it to the folding set of the following template.
1629 }
1630
1631 // Explicit info.
1633 if (D->getTypeAsWritten()) {
1634 Record.AddSourceLocation(D->getExternLoc());
1636 }
1637
1639}
1640
1645
1647
1648 // These are read/set from/to the first declaration.
1649 if (D->getPreviousDecl() == nullptr) {
1651 Record.push_back(D->isMemberSpecialization());
1652 }
1653
1655}
1656
1659
1660 if (D->isFirstDecl())
1663}
1664
1668
1669 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1670 InstFrom = D->getSpecializedTemplateOrPartial();
1671 if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1672 Record.AddDeclRef(InstFromD);
1673 } else {
1674 Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1676 }
1677
1678 // Explicit info.
1680 if (D->getTypeAsWritten()) {
1681 Record.AddSourceLocation(D->getExternLoc());
1683 }
1684
1687 Record.push_back(D->getSpecializationKind());
1688 Record.push_back(D->IsCompleteDefinition);
1689
1690 VisitVarDecl(D);
1691
1692 Record.push_back(D->isCanonicalDecl());
1693
1694 if (D->isCanonicalDecl()) {
1695 // When reading, we'll add it to the folding set of the following template.
1697 }
1698
1700}
1701
1706
1708
1709 // These are read/set from/to the first declaration.
1710 if (D->getPreviousDecl() == nullptr) {
1712 Record.push_back(D->isMemberSpecialization());
1713 }
1714
1716}
1717
1720 VisitDecl(D);
1721 Record.AddDeclRef(D->getSpecialization());
1723 if (D->hasExplicitTemplateArgs())
1726}
1727
1728
1731
1732 if (D->isFirstDecl())
1735}
1736
1738 Record.push_back(D->hasTypeConstraint());
1739 VisitTypeDecl(D);
1740
1742
1743 const TypeConstraint *TC = D->getTypeConstraint();
1744 Record.push_back(TC != nullptr);
1745 if (TC) {
1748 Record.AddDeclRef(TC->getNamedConcept());
1749 Record.push_back(TC->getTemplateArgsAsWritten() != nullptr);
1750 if (TC->getTemplateArgsAsWritten())
1754 if (D->isExpandedParameterPack())
1756 }
1757
1758 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1760 Record.push_back(OwnsDefaultArg);
1761 if (OwnsDefaultArg)
1763
1765}
1766
1768 // For an expanded parameter pack, record the number of expansion types here
1769 // so that it's easier for deserialization to allocate the right amount of
1770 // memory.
1772 Record.push_back(!!TypeConstraint);
1773 if (D->isExpandedParameterPack())
1774 Record.push_back(D->getNumExpansionTypes());
1775
1777 // TemplateParmPosition.
1778 Record.push_back(D->getDepth());
1779 Record.push_back(D->getPosition());
1780 if (TypeConstraint)
1781 Record.AddStmt(TypeConstraint);
1782
1783 if (D->isExpandedParameterPack()) {
1784 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1785 Record.AddTypeRef(D->getExpansionType(I));
1787 }
1788
1790 } else {
1791 // Rest of NonTypeTemplateParmDecl.
1792 Record.push_back(D->isParameterPack());
1793 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1795 Record.push_back(OwnsDefaultArg);
1796 if (OwnsDefaultArg)
1797 Record.AddStmt(D->getDefaultArgument());
1799 }
1800}
1801
1803 // For an expanded parameter pack, record the number of expansion types here
1804 // so that it's easier for deserialization to allocate the right amount of
1805 // memory.
1806 if (D->isExpandedParameterPack())
1808
1810 // TemplateParmPosition.
1811 Record.push_back(D->getDepth());
1812 Record.push_back(D->getPosition());
1813
1814 if (D->isExpandedParameterPack()) {
1815 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1816 I != N; ++I)
1819 } else {
1820 // Rest of TemplateTemplateParmDecl.
1821 Record.push_back(D->isParameterPack());
1822 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1824 Record.push_back(OwnsDefaultArg);
1825 if (OwnsDefaultArg)
1828 }
1829}
1830
1834}
1835
1837 VisitDecl(D);
1838 Record.AddStmt(D->getAssertExpr());
1839 Record.push_back(D->isFailed());
1840 Record.AddStmt(D->getMessage());
1841 Record.AddSourceLocation(D->getRParenLoc());
1843}
1844
1845/// Emit the DeclContext part of a declaration context decl.
1847 static_assert(DeclContext::NumDeclContextBits == 13,
1848 "You need to update the serializer after you change the "
1849 "DeclContextBits");
1850
1851 Record.AddOffset(Writer.WriteDeclContextLexicalBlock(Context, DC));
1852 Record.AddOffset(Writer.WriteDeclContextVisibleBlock(Context, DC));
1853}
1854
1856 assert(IsLocalDecl(D) && "expected a local declaration");
1857
1858 const Decl *Canon = D->getCanonicalDecl();
1859 if (IsLocalDecl(Canon))
1860 return Canon;
1861
1862 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
1863 if (CacheEntry)
1864 return CacheEntry;
1865
1866 for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
1867 if (IsLocalDecl(Redecl))
1868 D = Redecl;
1869 return CacheEntry = D;
1870}
1871
1872template <typename T>
1874 T *First = D->getFirstDecl();
1875 T *MostRecent = First->getMostRecentDecl();
1876 T *DAsT = static_cast<T *>(D);
1877 if (MostRecent != First) {
1878 assert(isRedeclarableDeclKind(DAsT->getKind()) &&
1879 "Not considered redeclarable?");
1880
1881 Record.AddDeclRef(First);
1882
1883 // Write out a list of local redeclarations of this declaration if it's the
1884 // first local declaration in the chain.
1885 const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
1886 if (DAsT == FirstLocal) {
1887 // Emit a list of all imported first declarations so that we can be sure
1888 // that all redeclarations visible to this module are before D in the
1889 // redecl chain.
1890 unsigned I = Record.size();
1891 Record.push_back(0);
1892 if (Writer.Chain)
1893 AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
1894 // This is the number of imported first declarations + 1.
1895 Record[I] = Record.size() - I;
1896
1897 // Collect the set of local redeclarations of this declaration, from
1898 // newest to oldest.
1899 ASTWriter::RecordData LocalRedecls;
1900 ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
1901 for (const Decl *Prev = FirstLocal->getMostRecentDecl();
1902 Prev != FirstLocal; Prev = Prev->getPreviousDecl())
1903 if (!Prev->isFromASTFile())
1904 LocalRedeclWriter.AddDeclRef(Prev);
1905
1906 // If we have any redecls, write them now as a separate record preceding
1907 // the declaration itself.
1908 if (LocalRedecls.empty())
1909 Record.push_back(0);
1910 else
1911 Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
1912 } else {
1913 Record.push_back(0);
1914 Record.AddDeclRef(FirstLocal);
1915 }
1916
1917 // Make sure that we serialize both the previous and the most-recent
1918 // declarations, which (transitively) ensures that all declarations in the
1919 // chain get serialized.
1920 //
1921 // FIXME: This is not correct; when we reach an imported declaration we
1922 // won't emit its previous declaration.
1923 (void)Writer.GetDeclRef(D->getPreviousDecl());
1924 (void)Writer.GetDeclRef(MostRecent);
1925 } else {
1926 // We use the sentinel value 0 to indicate an only declaration.
1927 Record.push_back(0);
1928 }
1929}
1930
1932 VisitNamedDecl(D);
1934 Record.push_back(D->isCBuffer());
1935 Record.AddSourceLocation(D->getLocStart());
1936 Record.AddSourceLocation(D->getLBraceLoc());
1937 Record.AddSourceLocation(D->getRBraceLoc());
1938
1940}
1941
1943 Record.writeOMPChildren(D->Data);
1944 VisitDecl(D);
1946}
1947
1949 Record.writeOMPChildren(D->Data);
1950 VisitDecl(D);
1952}
1953
1955 Record.writeOMPChildren(D->Data);
1956 VisitDecl(D);
1958}
1959
1961 static_assert(DeclContext::NumOMPDeclareReductionDeclBits == 2,
1962 "You need to update the serializer after you change the "
1963 "NumOMPDeclareReductionDeclBits");
1964
1965 VisitValueDecl(D);
1966 Record.AddSourceLocation(D->getBeginLoc());
1967 Record.AddStmt(D->getCombinerIn());
1968 Record.AddStmt(D->getCombinerOut());
1969 Record.AddStmt(D->getCombiner());
1970 Record.AddStmt(D->getInitOrig());
1971 Record.AddStmt(D->getInitPriv());
1972 Record.AddStmt(D->getInitializer());
1973 Record.push_back(D->getInitializerKind());
1974 Record.AddDeclRef(D->getPrevDeclInScope());
1976}
1977
1979 Record.writeOMPChildren(D->Data);
1980 VisitValueDecl(D);
1981 Record.AddDeclarationName(D->getVarName());
1982 Record.AddDeclRef(D->getPrevDeclInScope());
1984}
1985
1987 VisitVarDecl(D);
1989}
1990
1991//===----------------------------------------------------------------------===//
1992// ASTWriter Implementation
1993//===----------------------------------------------------------------------===//
1994
1995void ASTWriter::WriteDeclAbbrevs() {
1996 using namespace llvm;
1997
1998 std::shared_ptr<BitCodeAbbrev> Abv;
1999
2000 // Abbreviation for DECL_FIELD
2001 Abv = std::make_shared<BitCodeAbbrev>();
2002 Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
2003 // Decl
2004 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2005 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2006 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2007 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2008 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2009 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2010 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2011 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2012 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
2013 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2014 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2015 // NamedDecl
2016 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2017 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2018 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2019 // ValueDecl
2020 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2021 // DeclaratorDecl
2022 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2023 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2024 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2025 // FieldDecl
2026 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2027 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2028 // Type Source Info
2029 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2030 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2031 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
2032
2033 // Abbreviation for DECL_OBJC_IVAR
2034 Abv = std::make_shared<BitCodeAbbrev>();
2035 Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
2036 // Decl
2037 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2038 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2039 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2040 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2041 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2042 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2043 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2044 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2045 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
2046 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2047 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2048 // NamedDecl
2049 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2050 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2051 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2052 // ValueDecl
2053 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2054 // DeclaratorDecl
2055 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2056 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2057 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2058 // FieldDecl
2059 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2060 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2061 // ObjC Ivar
2062 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
2063 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
2064 // Type Source Info
2065 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2066 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2067 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2068
2069 // Abbreviation for DECL_ENUM
2070 Abv = std::make_shared<BitCodeAbbrev>();
2071 Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
2072 // Redeclarable
2073 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2074 // Decl
2075 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2076 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2077 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2078 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2079 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2080 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2081 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2082 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2083 Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2084 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2085 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2086 // NamedDecl
2087 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2088 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2089 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2090 // TypeDecl
2091 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2092 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2093 // TagDecl
2094 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2095 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
2096 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
2097 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
2098 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
2099 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
2100 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2101 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2102 Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
2103 // EnumDecl
2104 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
2105 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
2106 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
2107 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumPositiveBits
2108 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumNegativeBits
2109 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScoped
2110 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScopedUsingClassTag
2111 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isFixed
2112 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
2113 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
2114 // DC
2115 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2116 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2117 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2118
2119 // Abbreviation for DECL_RECORD
2120 Abv = std::make_shared<BitCodeAbbrev>();
2121 Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
2122 // Redeclarable
2123 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2124 // Decl
2125 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2126 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2127 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2128 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2129 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2130 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2131 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2132 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2133 Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2134 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2135 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2136 // NamedDecl
2137 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2138 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2139 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2140 // TypeDecl
2141 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2142 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2143 // TagDecl
2144 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2145 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
2146 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
2147 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
2148 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
2149 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
2150 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2151 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2152 Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
2153 // RecordDecl
2154 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // FlexibleArrayMember
2155 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // AnonymousStructUnion
2156 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasObjectMember
2157 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasVolatileMember
2158
2159 // isNonTrivialToPrimitiveDefaultInitialize
2160 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2161 // isNonTrivialToPrimitiveCopy
2162 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2163 // isNonTrivialToPrimitiveDestroy
2164 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2165 // hasNonTrivialToPrimitiveDefaultInitializeCUnion
2166 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2167 // hasNonTrivialToPrimitiveDestructCUnion
2168 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2169 // hasNonTrivialToPrimitiveCopyCUnion
2170 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2171 // isParamDestroyedInCallee
2172 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2173 // getArgPassingRestrictions
2174 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
2175 // ODRHash
2176 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));
2177
2178 // DC
2179 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2180 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2181 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2182
2183 // Abbreviation for DECL_PARM_VAR
2184 Abv = std::make_shared<BitCodeAbbrev>();
2185 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2186 // Redeclarable
2187 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2188 // Decl
2189 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2190 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2191 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2192 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2193 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2194 Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2195 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2196 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2197 Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2198 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2199 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2200 // NamedDecl
2201 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2202 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2203 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2204 // ValueDecl
2205 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2206 // DeclaratorDecl
2207 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2208 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2209 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2210 // VarDecl
2211 Abv->Add(BitCodeAbbrevOp(0)); // SClass
2212 Abv->Add(BitCodeAbbrevOp(0)); // TSCSpec
2213 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2214 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
2215 Abv->Add(BitCodeAbbrevOp(0)); // Linkage
2216 Abv->Add(BitCodeAbbrevOp(0)); // HasInit
2217 Abv->Add(BitCodeAbbrevOp(0)); // HasMemberSpecializationInfo
2218 // ParmVarDecl
2219 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsObjCMethodParameter
2220 Abv->Add(BitCodeAbbrevOp(0)); // ScopeDepth
2221 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2222 Abv->Add(BitCodeAbbrevOp(0)); // ObjCDeclQualifier
2223 Abv->Add(BitCodeAbbrevOp(0)); // KNRPromoted
2224 Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedDefaultArg
2225 Abv->Add(BitCodeAbbrevOp(0)); // HasUninstantiatedDefaultArg
2226 // Type Source Info
2227 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2228 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2229 DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2230
2231 // Abbreviation for DECL_TYPEDEF
2232 Abv = std::make_shared<BitCodeAbbrev>();
2233 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2234 // Redeclarable
2235 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2236 // Decl
2237 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2238 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2239 Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2240 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2241 Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2242 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isUsed
2243 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isReferenced
2244 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2245 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // C++ AccessSpecifier
2246 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2247 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2248 // NamedDecl
2249 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2250 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2251 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2252 // TypeDecl
2253 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2254 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2255 // TypedefDecl
2256 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2257 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2258 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2259
2260 // Abbreviation for DECL_VAR
2261 Abv = std::make_shared<BitCodeAbbrev>();
2262 Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
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(0)); // isUsed
2272 Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2273 Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2274 Abv->Add(BitCodeAbbrevOp(AS_none)); // 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 // ValueDecl
2282 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2283 // DeclaratorDecl
2284 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2285 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2286 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2287 // VarDecl
2288 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // SClass
2289 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // TSCSpec
2290 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // InitStyle
2291 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
2292 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsThisDeclarationADemotedDefinition
2293 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isExceptionVariable
2294 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isNRVOVariable
2295 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCXXForRangeDecl
2296 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isObjCForDecl
2297 Abv->Add(BitCodeAbbrevOp(0)); // isInline
2298 Abv->Add(BitCodeAbbrevOp(0)); // isInlineSpecified
2299 Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr
2300 Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture
2301 Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope
2302 Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind
2303 Abv->Add(BitCodeAbbrevOp(0)); // EscapingByref
2304 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2305 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // HasConstant*
2306 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum)
2307 // Type Source Info
2308 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2309 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2310 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2311
2312 // Abbreviation for DECL_CXX_METHOD
2313 Abv = std::make_shared<BitCodeAbbrev>();
2314 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CXX_METHOD));
2315 // RedeclarableDecl
2316 Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2317 // FIXME: Implement abbreviation for other template kinds.
2318 Abv->Add(BitCodeAbbrevOp(FunctionDecl::TK_NonTemplate)); // TemplateKind
2319 // Decl
2320 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2321 Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2322 Abv->Add(BitCodeAbbrevOp(0)); // Invalid
2323 Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2324 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Implicit
2325 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Used
2326 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Referenced
2327 Abv->Add(BitCodeAbbrevOp(0)); // InObjCContainer
2328 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Access
2329 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // ModuleOwnershipKind
2330 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2331 // NamedDecl
2332 Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2333 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2334 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2335 // ValueDecl
2336 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2337 // DeclaratorDecl
2338 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2339 Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2340 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2341 // FunctionDecl
2342 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2343 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // StorageClass
2344 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Inline
2345 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // InlineSpecified
2346 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // VirtualAsWritten
2347 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Pure
2348 Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedProto
2349 Abv->Add(BitCodeAbbrevOp(1)); // HasWrittenProto
2350 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Deleted
2351 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Trivial
2352 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // TrivialForCall
2353 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Defaulted
2354 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted
2355 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsIneligibleOrNotSelected
2356 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero
2357 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Constexpr
2358 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // UsesSEHTry
2359 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody
2360 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // MultiVersion
2361 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // LateParsed
2362 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // FriendConstraintRefersToEnclosingTemplate
2363 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2364 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2365 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Default
2366 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2367 // This Array slurps the rest of the record. Fortunately we want to encode
2368 // (nearly) all the remaining (variable number of) fields in the same way.
2369 //
2370 // This is:
2371 // NumParams and Params[] from FunctionDecl, and
2372 // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2373 //
2374 // Add an AbbrevOp for 'size then elements' and use it here.
2375 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2376 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2377 DeclCXXMethodAbbrev = Stream.EmitAbbrev(std::move(Abv));
2378
2379 unsigned ExprDependenceBits = llvm::BitWidth<ExprDependence>;
2380 // Abbreviation for EXPR_DECL_REF
2381 Abv = std::make_shared<BitCodeAbbrev>();
2382 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2383 //Stmt
2384 // Expr
2385 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2386 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, ExprDependenceBits));
2387 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2388 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2389 //DeclRefExpr
2390 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HasQualifier
2391 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //GetDeclFound
2392 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ExplicitTemplateArgs
2393 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HadMultipleCandidates
2394 Abv->Add(BitCodeAbbrevOp(0)); // RefersToEnclosingVariableOrCapture
2395 Abv->Add(BitCodeAbbrevOp(0)); // NonOdrUseReason
2396 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2397 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2398 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2399
2400 // Abbreviation for EXPR_INTEGER_LITERAL
2401 Abv = std::make_shared<BitCodeAbbrev>();
2402 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2403 //Stmt
2404 // Expr
2405 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2406 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, ExprDependenceBits));
2407 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2408 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2409 //Integer Literal
2410 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2411 Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2412 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2413 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2414
2415 // Abbreviation for EXPR_CHARACTER_LITERAL
2416 Abv = std::make_shared<BitCodeAbbrev>();
2417 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2418 //Stmt
2419 // Expr
2420 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2421 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, ExprDependenceBits));
2422 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2423 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2424 //Character Literal
2425 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2426 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2427 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2428 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2429
2430 // Abbreviation for EXPR_IMPLICIT_CAST
2431 Abv = std::make_shared<BitCodeAbbrev>();
2432 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2433 // Stmt
2434 // Expr
2435 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2436 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, ExprDependenceBits));
2437 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2438 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2439 // CastExpr
2440 Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2441 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // HasFPFeatures
2442 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 6)); // CastKind
2443 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // PartOfExplicitCast
2444 // ImplicitCastExpr
2445 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2446
2447 Abv = std::make_shared<BitCodeAbbrev>();
2448 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2449 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2450 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2451
2452 Abv = std::make_shared<BitCodeAbbrev>();
2453 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2454 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2455 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2456}
2457
2458/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2459/// consumers of the AST.
2460///
2461/// Such decls will always be deserialized from the AST file, so we would like
2462/// this to be as restrictive as possible. Currently the predicate is driven by
2463/// code generation requirements, if other clients have a different notion of
2464/// what is "required" then we may have to consider an alternate scheme where
2465/// clients can iterate over the top-level decls and get information on them,
2466/// without necessary deserializing them. We could explicitly require such
2467/// clients to use a separate API call to "realize" the decl. This should be
2468/// relatively painless since they would presumably only do it for top-level
2469/// decls.
2470static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2471 bool WritingModule) {
2472 // An ObjCMethodDecl is never considered as "required" because its
2473 // implementation container always is.
2474
2475 // File scoped assembly or obj-c or OMP declare target implementation must be
2476 // seen.
2477 if (isa<FileScopeAsmDecl, TopLevelStmtDecl, ObjCImplDecl>(D))
2478 return true;
2479
2480 if (WritingModule && isPartOfPerModuleInitializer(D)) {
2481 // These declarations are part of the module initializer, and are emitted
2482 // if and when the module is imported, rather than being emitted eagerly.
2483 return false;
2484 }
2485
2486 return Context.DeclMustBeEmitted(D);
2487}
2488
2489void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2490 PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
2491 "serializing");
2492
2493 // Determine the ID for this declaration.
2495 assert(!D->isFromASTFile() && "should not be emitting imported decl");
2496 serialization::DeclID &IDR = DeclIDs[D];
2497 if (IDR == 0)
2498 IDR = NextDeclID++;
2499
2500 ID = IDR;
2501
2502 assert(ID >= FirstDeclID && "invalid decl ID");
2503
2505 ASTDeclWriter W(*this, Context, Record);
2506
2507 // Build a record for this declaration
2508 W.Visit(D);
2509
2510 // Emit this declaration to the bitstream.
2511 uint64_t Offset = W.Emit(D);
2512
2513 // Record the offset for this declaration
2514 SourceLocation Loc = D->getLocation();
2515 unsigned Index = ID - FirstDeclID;
2516 if (DeclOffsets.size() == Index)
2517 DeclOffsets.emplace_back(getAdjustedLocation(Loc), Offset,
2518 DeclTypesBlockStartOffset);
2519 else if (DeclOffsets.size() < Index) {
2520 // FIXME: Can/should this happen?
2521 DeclOffsets.resize(Index+1);
2522 DeclOffsets[Index].setLocation(getAdjustedLocation(Loc));
2523 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);
2524 } else {
2525 llvm_unreachable("declarations should be emitted in ID order");
2526 }
2527
2528 SourceManager &SM = Context.getSourceManager();
2529 if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2530 associateDeclWithFile(D, ID);
2531
2532 // Note declarations that should be deserialized eagerly so that we can add
2533 // them to a record in the AST file later.
2534 if (isRequiredDecl(D, Context, WritingModule))
2535 EagerlyDeserializedDecls.push_back(ID);
2536}
2537
2539 // Switch case IDs are per function body.
2540 Writer->ClearSwitchCaseIDs();
2541
2542 assert(FD->doesThisDeclarationHaveABody());
2543 bool ModulesCodegen = false;
2544 if (!FD->isDependentContext()) {
2545 std::optional<GVALinkage> Linkage;
2546 if (Writer->WritingModule &&
2547 Writer->WritingModule->isInterfaceOrPartition()) {
2548 // When building a C++20 module interface unit or a partition unit, a
2549 // strong definition in the module interface is provided by the
2550 // compilation of that unit, not by its users. (Inline functions are still
2551 // emitted in module users.)
2552 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2553 ModulesCodegen = *Linkage >= GVA_StrongExternal;
2554 }
2555 if (Writer->Context->getLangOpts().ModulesCodegen ||
2556 (FD->hasAttr<DLLExportAttr>() &&
2557 Writer->Context->getLangOpts().BuildingPCHWithObjectFile)) {
2558
2559 // Under -fmodules-codegen, codegen is performed for all non-internal,
2560 // non-always_inline functions, unless they are available elsewhere.
2561 if (!FD->hasAttr<AlwaysInlineAttr>()) {
2562 if (!Linkage)
2563 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2564 ModulesCodegen =
2566 }
2567 }
2568 }
2569 Record->push_back(ModulesCodegen);
2570 if (ModulesCodegen)
2571 Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(FD));
2572 if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2573 Record->push_back(CD->getNumCtorInitializers());
2574 if (CD->getNumCtorInitializers())
2575 AddCXXCtorInitializers(llvm::ArrayRef(CD->init_begin(), CD->init_end()));
2576 }
2577 AddStmt(FD->getBody());
2578}
NodeId Parent
Definition: ASTDiff.cpp:191
StringRef P
static void addExplicitSpecifier(ExplicitSpecifier ES, ASTRecordWriter &Record)
static bool isRequiredDecl(const Decl *D, ASTContext &Context, bool WritingModule)
isRequiredDecl - Check if this is a "required" Decl, which must be seen by consumers of the AST.
#define SM(sm)
Definition: Cuda.cpp:78
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
unsigned Offset
Definition: Format.cpp:2776
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:692
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:762
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:1167
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:7458
An object for streaming information to a record.
void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo)
Definition: ASTWriter.cpp:5725
void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs)
Emit a template argument list.
Definition: ASTWriter.cpp:5812
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:5546
void AddCXXCtorInitializers(ArrayRef< CXXCtorInitializer * > CtorInits)
Emit a CXXCtorInitializer array.
Definition: ASTWriter.cpp:5905
void AddTemplateParameterList(const TemplateParameterList *TemplateParams)
Emit a template parameter list.
Definition: ASTWriter.cpp:5793
void AddTemplateArgument(const TemplateArgument &Arg)
Emit a template argument.
void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc, DeclarationName Name)
Definition: ASTWriter.cpp:5698
void AddTypeSourceInfo(TypeSourceInfo *TInfo)
Emits a reference to a declarator info.
Definition: ASTWriter.cpp:5536
void AddQualifierInfo(const QualifierInfo &Info)
Definition: ASTWriter.cpp:5732
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:7156
void AddAPSInt(const llvm::APSInt &Value)
Emit a signed integral value.
void AddString(StringRef Str)
Emit a string.
void AddAttributes(ArrayRef< const Attr * > Attrs)
Emit a list of attributes.
Definition: ASTWriter.cpp:4390
void AddASTTemplateArgumentListInfo(const ASTTemplateArgumentListInfo *ASTTemplArgList)
Emits an AST template argument list info.
Definition: ASTWriter.cpp:5820
void AddCXXDefinitionData(const CXXRecordDecl *D)
Definition: ASTWriter.cpp:5910
void AddVarDeclInit(const VarDecl *VD)
Emit information about the initializer of a VarDecl.
Definition: ASTWriter.cpp:5980
void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg)
Emits a template argument location.
Definition: ASTWriter.cpp:5523
void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS)
Emit a nested name specifier with source-location information.
Definition: ASTWriter.cpp:5739
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:86
unsigned getDeclParmVarAbbrev() const
Definition: ASTWriter.h:722
unsigned getDeclObjCIvarAbbrev() const
Definition: ASTWriter.h:728
serialization::DeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its ID.
Definition: ASTWriter.cpp:5597
unsigned getDeclTypedefAbbrev() const
Definition: ASTWriter.h:724
bool hasChain() const
Definition: ASTWriter.h:736
unsigned getDeclVarAbbrev() const
Definition: ASTWriter.h:725
unsigned getDeclEnumAbbrev() const
Definition: ASTWriter.h:727
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:660
unsigned getDeclCXXMethodAbbrev() const
Definition: ASTWriter.h:729
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:5677
unsigned getDeclFieldAbbrev() const
Definition: ASTWriter.h:726
unsigned getDeclRecordAbbrev() const
Definition: ASTWriter.h:723
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:4043
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:4067
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4334
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition: Decl.h:4457
bool canAvoidCopyToHeap() const
Definition: Decl.h:4488
size_t param_size() const
Definition: Decl.h:4436
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:4413
ArrayRef< Capture > captures() const
Definition: Decl.h:4461
bool blockMissingReturnType() const
Definition: Decl.h:4469
bool capturesCXXThis() const
Definition: Decl.h:4466
bool doesNotEscape() const
Definition: Decl.h:4485
bool isConversionFromLambda() const
Definition: Decl.h:4477
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:4420
bool isVariadic() const
Definition: Decl.h:4409
TypeSourceInfo * getSignatureAsWritten() const
Definition: Decl.h:4417
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2474
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2545
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2711
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2801
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2828
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:1920
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:1953
bool isCopyDeductionCandidate() const
Definition: DeclCXX.h:1974
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2738
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2771
Expr * getOperatorDeleteThisArg() const
Definition: DeclCXX.h:2775
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2018
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:2110
overridden_method_range overridden_methods() const
Definition: DeclCXX.cpp:2477
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:2471
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1853
static bool classofKind(Kind K)
Definition: DeclCXX.h:1857
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Definition: DeclCXX.cpp:1839
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:515
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4526
unsigned getNumParams() const
Definition: Decl.h:4568
unsigned getContextParamPosition() const
Definition: Decl.h:4597
bool isNothrow() const
Definition: Decl.cpp:5139
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4570
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
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
Definition: ASTConcept.h:149
const DeclarationNameInfo & getConceptNameInfo() const
Definition: ASTConcept.h:153
ConceptDecl * getNamedConcept() const
Definition: ASTConcept.h:165
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Definition: ASTConcept.h:169
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3535
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:1393
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1933
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:1186
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1841
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1276
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:1026
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition: DeclBase.h:1041
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:841
bool isReferenced() const
Whether any declaration of this entity was referenced.
Definition: DeclBase.cpp:482
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:949
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:808
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:751
bool isInvalidDecl() const
Definition: DeclBase.h:571
unsigned getIdentifierNamespace() const
Definition: DeclBase.h:854
SourceLocation getLocation() const
Definition: DeclBase.h:432
const char * getDeclKindName() const
Definition: DeclBase.cpp:123
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:457
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:883
bool hasAttr() const
Definition: DeclBase.h:560
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:943
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:765
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
Definition: Decl.h:808
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:794
A decomposition declaration.
Definition: DeclCXX.h:4102
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:4134
Provides information about a dependent function-template specialization declaration.
Definition: DeclTemplate.h:696
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
Definition: DeclTemplate.h:726
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
Definition: DeclTemplate.h:747
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
Definition: DeclTemplate.h:740
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i'th template candidate.
Definition: DeclTemplate.h:729
Represents an empty-declaration.
Definition: Decl.h:4765
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3160
const Expr * getInitExpr() const
Definition: Decl.h:3179
const llvm::APSInt & getInitVal() const
Definition: Decl.h:3181
Represents an enum.
Definition: Decl.h:3720
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
Definition: Decl.h:3979
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3925
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:3917
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3928
unsigned getODRHash()
Definition: Decl.cpp:4666
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
Definition: Decl.h:3896
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3816
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3934
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3880
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum.
Definition: Decl.h:3906
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition: Decl.h:3872
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1865
ExplicitSpecKind getKind() const
Definition: DeclCXX.h:1873
const Expr * getExpr() const
Definition: DeclCXX.h:1874
Represents a standard C++ module export declaration.
Definition: Decl.h:4718
SourceLocation getRBraceLoc() const
Definition: Decl.h:4737
This represents one expression.
Definition: Expr.h:110
Represents a member of a struct/union/class.
Definition: Decl.h:2941
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:3016
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:3085
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set.
Definition: Decl.h:3092
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition: Decl.h:3118
Expr * getBitWidth() const
Definition: Decl.h:3030
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition: Decl.h:3123
const StringLiteral * getAsmString() const
Definition: Decl.h:4295
SourceLocation getRParenLoc() const
Definition: Decl.h:4289
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:1917
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition: Decl.h:2517
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:3135
bool isTrivialForCall() const
Definition: Decl.h:2275
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2255
ConstexprSpecKind getConstexprKind() const
Definition: Decl.h:2371
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:3826
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition: Decl.h:2712
SourceLocation getDefaultLoc() const
Definition: Decl.h:2293
bool usesSEHTry() const
Indicates the function uses __try.
Definition: Decl.h:2398
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2582
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted.
Definition: Decl.h:2284
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2272
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition: Decl.h:2343
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
Definition: Decl.cpp:3805
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3950
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:2228
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition: Decl.cpp:4012
unsigned getODRHash()
Returns ODRHash of the function.
Definition: Decl.cpp:4278
@ TK_MemberSpecialization
Definition: Decl.h:1929
@ TK_DependentNonTemplate
Definition: Decl.h:1938
@ TK_FunctionTemplateSpecialization
Definition: Decl.h:1933
@ TK_DependentFunctionTemplateSpecialization
Definition: Decl.h:1936
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2679
bool FriendConstraintRefersToEnclosingTemplate() const
Definition: Decl.h:2535
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3777
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition: Decl.h:2259
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition: Decl.h:2323
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition: Decl.h:2507
bool isDefaulted() const
Whether this function is defaulted.
Definition: Decl.h:2280
bool isIneligibleOrNotSelected() const
Definition: Decl.h:2313
FunctionDecl * getInstantiatedFromDecl() const
Definition: Decl.cpp:3844
DefaultedFunctionInfo * getDefaultedFunctionInfo() const
Definition: Decl.cpp:3051
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2246
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:2354
size_t param_size() const
Definition: Decl.h:2598
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2690
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:480
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:494
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:536
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:
Definition: DeclTemplate.h:607
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:498
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:567
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:539
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition: Decl.h:4780
bool isCBuffer() const
Definition: Decl.h:4808
SourceLocation getLBraceLoc() const
Definition: Decl.h:4805
SourceLocation getLocStart() const LLVM_READONLY
Definition: Decl.h:4804
SourceLocation getRBraceLoc() const
Definition: Decl.h:4806
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4639
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:5409
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4697
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3200
unsigned getChainingSize() const
Definition: Decl.h:3227
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:3221
Represents the declaration of a label.
Definition: Decl.h:494
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition: DeclCXX.h:3166
unsigned getManglingNumber() const
Definition: DeclCXX.h:3215
Expr * getTemporaryExpr()
Retrieve the expression to which the temporary materialization conversion was applied.
Definition: DeclCXX.h:3212
Represents a linkage specification.
Definition: DeclCXX.h:2867
SourceLocation getExternLoc() const
Definition: DeclCXX.h:2910
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2896
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:2911
A global _GUID constant.
Definition: DeclCXX.h:4225
Parts getParts() const
Get the decomposed parts of this declaration.
Definition: DeclCXX.h:4255
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:4171
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:4193
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:4195
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:629
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:651
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:669
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:648
bool isInterfaceOrPartition() const
Definition: Module.h:585
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:1152
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:471
Represents a C++ namespace alias.
Definition: DeclCXX.h:3057
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3120
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3145
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:3148
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition: DeclCXX.h:3129
Represent a C++ namespace.
Definition: Decl.h:542
SourceLocation getRBraceLoc() const
Definition: Decl.h:681
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:680
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2940
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Definition: Decl.h:600
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:605
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
Definition: Decl.h:660
bool isNested() const
Returns true if this is a nested namespace declaration.
Definition: Decl.h:622
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:1722
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion:
Definition: Decl.h:1803
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition: Decl.h:1782
bool isObjCMethodParameter() const
Definition: Decl.h:1765
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: Decl.h:1786
bool hasUninstantiatedDefaultArg() const
Definition: Decl.h:1843
bool hasInheritedDefaultArg() const
Definition: Decl.h:1855
Expr * getUninstantiatedDefaultArg()
Definition: Decl.cpp:2946
unsigned getFunctionScopeDepth() const
Definition: Decl.h:1772
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:3998
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: Decl.cpp:4905
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition: Decl.h:4130
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition: Decl.h:4138
bool hasVolatileMember() const
Definition: Decl.h:4083
bool hasFlexibleArrayMember() const
Definition: Decl.h:4053
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition: Decl.h:4122
bool hasObjectMember() const
Definition: Decl.h:4080
bool isNonTrivialToPrimitiveDestroy() const
Definition: Decl.h:4114
bool isNonTrivialToPrimitiveCopy() const
Definition: Decl.h:4106
bool isParamDestroyedInCallee() const
Definition: Decl.h:4161
RecordDecl * getMostRecentDecl()
Definition: Decl.h:4046
ArgPassingKind getArgPassingRestrictions() const
Definition: Decl.h:4153
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition: Decl.h:4098
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition: Decl.h:4072
Declaration of a redeclarable template.
Definition: DeclTemplate.h:764
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:908
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:955
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:1996
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:3994
bool isFailed() const
Definition: DeclCXX.h:4023
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:4025
StringLiteral * getMessage()
Definition: DeclCXX.h:4020
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3440
SourceRange getBraceRange() const
Definition: Decl.h:3519
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3538
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:3567
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3543
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:3666
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:3552
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition: Decl.h:3578
TagKind getTagKind() const
Definition: Decl.h:3635
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:407
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:439
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:426
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:4308
The top declaration context.
Definition: Decl.h:82
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3412
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:3429
Declaration of an alias template.
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
Definition: ASTConcept.h:198
Represents a declaration of a type.
Definition: Decl.h:3248
const Type * getTypeForDecl() const
Definition: Decl.h:3272
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:3275
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:6631
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1783
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3392
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3290
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:3340
bool isModed() const
Definition: Decl.h:3336
QualType getUnderlyingType() const
Definition: Decl.h:3345
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes,...
Definition: Decl.cpp:5200
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Definition: DeclCXX.h:4282
const APValue & getValue() const
Definition: DeclCXX.h:4308
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Definition: DeclCXX.h:3976
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3895
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
Definition: DeclCXX.h:3925
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3929
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3946
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3798
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
Definition: DeclCXX.h:3829
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3839
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3856
Represents a C++ using-declaration.
Definition: DeclCXX.h:3449
bool hasTypename() const
Return true if the using declaration has 'typename'.
Definition: DeclCXX.h:3498
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3483
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
Definition: DeclCXX.h:3476
Represents C++ using-directive.
Definition: DeclCXX.h:2952
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:3023
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2889
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:3019
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3027
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:2997
Represents a C++ using-enum-declaration.
Definition: DeclCXX.h:3649
SourceLocation getEnumLoc() const
The source location of the 'enum' keyword.
Definition: DeclCXX.h:3673
TypeSourceInfo * getEnumType() const
Definition: DeclCXX.h:3687
SourceLocation getUsingLoc() const
The source location of the 'using' keyword.
Definition: DeclCXX.h:3669
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Definition: DeclCXX.h:3730
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition: DeclCXX.h:3760
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Definition: DeclCXX.h:3764
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3257
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3321
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:701
QualType getType() const
Definition: Decl.h:712
Represents a variable declaration or definition.
Definition: Decl.h:913
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Definition: Decl.cpp:2723
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1519
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1416
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition: Decl.h:1528
@ CInit
C-style initialization with assignment.
Definition: Decl.h:918
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C.
Definition: Decl.h:1482
bool isInlineSpecified() const
Definition: Decl.h:1504
bool isStaticDataMember() const
Determines whether this is a static data member.
Definition: Decl.h:1240
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
Definition: Decl.h:1472
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
Definition: Decl.h:1462
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Definition: Decl.h:1444
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1501
ThreadStorageClassSpecifier getTSCSpec() const
Definition: Decl.h:1134
const Expr * getInit() const
Definition: Decl.h:1325
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition: Decl.h:1497
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
Definition: Decl.h:1186
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1125
bool isEscapingByref() const
Indicates the capture is a __block variable that is captured by a block that can potentially escape (...
Definition: Decl.cpp:2611
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Definition: Decl.h:1426
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
Definition: Decl.h:1542
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Definition: Decl.cpp:2803
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:1234
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1242
@ DECL_EMPTY
An EmptyDecl record.
Definition: ASTBitCodes.h:1494
@ DECL_CAPTURED
A CapturedDecl record.
Definition: ASTBitCodes.h:1331
@ DECL_CXX_RECORD
A CXXRecordDecl record.
Definition: ASTBitCodes.h:1392
@ DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1434
@ DECL_OMP_ALLOCATE
An OMPAllocateDcl record.
Definition: ASTBitCodes.h:1491
@ DECL_MS_PROPERTY
A MSPropertyDecl record.
Definition: ASTBitCodes.h:1298
@ DECL_OMP_DECLARE_MAPPER
An OMPDeclareMapperDecl record.
Definition: ASTBitCodes.h:1515
@ DECL_TOP_LEVEL_STMT_DECL
A TopLevelStmtDecl record.
Definition: ASTBitCodes.h:1325
@ DECL_REQUIRES_EXPR_BODY
A RequiresExprBodyDecl record.
Definition: ASTBitCodes.h:1500
@ DECL_STATIC_ASSERT
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1458
@ DECL_INDIRECTFIELD
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1467
@ DECL_TEMPLATE_TEMPLATE_PARM
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1446
@ DECL_IMPORT
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1482
@ DECL_UNNAMED_GLOBAL_CONSTANT
A UnnamedGlobalConstantDecl record.
Definition: ASTBitCodes.h:1521
@ DECL_ACCESS_SPEC
An AccessSpecDecl record.
Definition: ASTBitCodes.h:1410
@ DECL_OBJC_TYPE_PARAM
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1503
@ DECL_OBJC_CATEGORY_IMPL
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1280
@ DECL_ENUM_CONSTANT
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1256
@ DECL_PARM_VAR
A ParmVarDecl record.
Definition: ASTBitCodes.h:1313
@ DECL_TYPEDEF
A TypedefDecl record.
Definition: ASTBitCodes.h:1244
@ DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack.
Definition: ASTBitCodes.h:1475
@ DECL_HLSL_BUFFER
A HLSLBufferDecl record.
Definition: ASTBitCodes.h:1524
@ DECL_NAMESPACE_ALIAS
A NamespaceAliasDecl record.
Definition: ASTBitCodes.h:1359
@ DECL_TYPEALIAS
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1247
@ DECL_FUNCTION_TEMPLATE
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1437
@ DECL_MS_GUID
A MSGuidDecl record.
Definition: ASTBitCodes.h:1301
@ DECL_UNRESOLVED_USING_TYPENAME
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1383
@ DECL_CLASS_TEMPLATE_SPECIALIZATION
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1422
@ DECL_FILE_SCOPE_ASM
A FileScopeAsmDecl record.
Definition: ASTBitCodes.h:1322
@ DECL_CXX_CONSTRUCTOR
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1401
@ DECL_CXX_CONVERSION
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1407
@ DECL_FIELD
A FieldDecl record.
Definition: ASTBitCodes.h:1295
@ DECL_LINKAGE_SPEC
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1386
@ DECL_NAMESPACE
A NamespaceDecl record.
Definition: ASTBitCodes.h:1356
@ DECL_NON_TYPE_TEMPLATE_PARM
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1443
@ DECL_USING_PACK
A UsingPackDecl record.
Definition: ASTBitCodes.h:1368
@ DECL_FUNCTION
A FunctionDecl record.
Definition: ASTBitCodes.h:1259
@ DECL_USING_DIRECTIVE
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1377
@ DECL_RECORD
A RecordDecl record.
Definition: ASTBitCodes.h:1253
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
Definition: ASTBitCodes.h:1341
@ DECL_CLASS_SCOPE_FUNCTION_SPECIALIZATION
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
Definition: ASTBitCodes.h:1479
@ DECL_BLOCK
A BlockDecl record.
Definition: ASTBitCodes.h:1328
@ DECL_UNRESOLVED_USING_VALUE
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1380
@ DECL_TYPE_ALIAS_TEMPLATE
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1449
@ DECL_OBJC_CATEGORY
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1277
@ DECL_VAR
A VarDecl record.
Definition: ASTBitCodes.h:1307
@ DECL_UNRESOLVED_USING_IF_EXISTS
An UnresolvedUsingIfExistsDecl record.
Definition: ASTBitCodes.h:1455
@ DECL_USING
A UsingDecl record.
Definition: ASTBitCodes.h:1362
@ DECL_OBJC_PROTOCOL
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1268
@ DECL_TEMPLATE_TYPE_PARM
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1440
@ DECL_VAR_TEMPLATE_SPECIALIZATION
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1431
@ DECL_OBJC_IMPLEMENTATION
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1283
@ DECL_LABEL
A LabelDecl record.
Definition: ASTBitCodes.h:1353
@ DECL_OBJC_COMPATIBLE_ALIAS
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1286
@ DECL_CONSTRUCTOR_USING_SHADOW
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1374
@ DECL_USING_ENUM
A UsingEnumDecl record.
Definition: ASTBitCodes.h:1365
@ DECL_FRIEND_TEMPLATE
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1416
@ DECL_PRAGMA_DETECT_MISMATCH
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1512
@ DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack.
Definition: ASTBitCodes.h:1471
@ DECL_OBJC_AT_DEFS_FIELD
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1274
@ DECL_IMPLICIT_PARAM
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1310
@ DECL_FRIEND
A FriendDecl record.
Definition: ASTBitCodes.h:1413
@ DECL_CXX_METHOD
A CXXMethodDecl record.
Definition: ASTBitCodes.h:1398
@ DECL_EXPORT
An ExportDecl record.
Definition: ASTBitCodes.h:1389
@ DECL_BINDING
A BindingDecl record.
Definition: ASTBitCodes.h:1319
@ DECL_PRAGMA_COMMENT
A PragmaCommentDecl record.
Definition: ASTBitCodes.h:1509
@ DECL_ENUM
An EnumDecl record.
Definition: ASTBitCodes.h:1250
@ DECL_DECOMPOSITION
A DecompositionDecl record.
Definition: ASTBitCodes.h:1316
@ DECL_OMP_DECLARE_REDUCTION
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1518
@ DECL_OMP_THREADPRIVATE
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1485
@ DECL_OBJC_METHOD
A ObjCMethodDecl record.
Definition: ASTBitCodes.h:1262
@ DECL_CXX_DESTRUCTOR
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1404
@ DECL_OMP_CAPTUREDEXPR
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1506
@ DECL_CLASS_TEMPLATE
A ClassTemplateDecl record.
Definition: ASTBitCodes.h:1419
@ DECL_USING_SHADOW
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1371
@ DECL_CONCEPT
A ConceptDecl record.
Definition: ASTBitCodes.h:1452
@ DECL_CXX_DEDUCTION_GUIDE
A CXXDeductionGuideDecl record.
Definition: ASTBitCodes.h:1395
@ DECL_OMP_REQUIRES
An OMPRequiresDecl record.
Definition: ASTBitCodes.h:1488
@ DECL_OBJC_IVAR
A ObjCIvarDecl record.
Definition: ASTBitCodes.h:1271
@ DECL_OBJC_PROPERTY
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1289
@ DECL_TEMPLATE_PARAM_OBJECT
A TemplateParamObjectDecl record.
Definition: ASTBitCodes.h:1304
@ DECL_OBJC_INTERFACE
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1265
@ DECL_VAR_TEMPLATE
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1428
@ DECL_LIFETIME_EXTENDED_TEMPORARY
An LifetimeExtendedTemporaryDecl record.
Definition: ASTBitCodes.h:1497
@ DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1425
@ DECL_IMPLICIT_CONCEPT_SPECIALIZATION
An ImplicitConceptSpecializationDecl record.
Definition: ASTBitCodes.h:1527
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
Definition: ASTBitCodes.h:1350
@ DECL_OBJC_PROPERTY_IMPL
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1292
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1671
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1632
@ EXPR_DECL_REF
A DeclRefExpr record.
Definition: ASTBitCodes.h:1617
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
Definition: ASTBitCodes.h:1620
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:315
@ AS_none
Definition: Specifiers.h:115
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:6021
Data that is common to all of the declarations of a given function template.
Parts of a decomposed MSGuidDecl.
Definition: DeclCXX.h:4200
uint16_t Part2
...-89ab-...
Definition: DeclCXX.h:4204
uint32_t Part1
{01234567-...
Definition: DeclCXX.h:4202
uint16_t Part3
...-cdef-...
Definition: DeclCXX.h:4206
uint8_t Part4And5[8]
...-0123-456789abcdef}
Definition: DeclCXX.h:4208
static DeclType * getDecl(EntryType *D)
Definition: DeclTemplate.h:784