clang 19.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"
19#include "clang/AST/ODRHash.h"
25#include "llvm/Bitstream/BitstreamWriter.h"
26#include "llvm/Support/ErrorHandling.h"
27#include <optional>
28using namespace clang;
29using namespace serialization;
30
31//===----------------------------------------------------------------------===//
32// Declaration serialization
33//===----------------------------------------------------------------------===//
34
35namespace clang {
36 class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {
37 ASTWriter &Writer;
38 ASTContext &Context;
40
42 unsigned AbbrevToUse;
43
44 bool GeneratingReducedBMI = false;
45
46 public:
48 ASTWriter::RecordDataImpl &Record, bool GeneratingReducedBMI)
49 : Writer(Writer), Context(Context), Record(Writer, Record),
50 Code((serialization::DeclCode)0), AbbrevToUse(0),
51 GeneratingReducedBMI(GeneratingReducedBMI) {}
52
53 uint64_t Emit(Decl *D) {
54 if (!Code)
55 llvm::report_fatal_error(StringRef("unexpected declaration kind '") +
56 D->getDeclKindName() + "'");
57 return Record.Emit(Code, AbbrevToUse);
58 }
59
60 void Visit(Decl *D);
61
62 void VisitDecl(Decl *D);
67 void VisitLabelDecl(LabelDecl *LD);
71 void VisitTypeDecl(TypeDecl *D);
77 void VisitTagDecl(TagDecl *D);
78 void VisitEnumDecl(EnumDecl *D);
105 void VisitVarDecl(VarDecl *D);
122 void VisitUsingDecl(UsingDecl *D);
136 void VisitBlockDecl(BlockDecl *D);
138 void VisitEmptyDecl(EmptyDecl *D);
141 template <typename T> void VisitRedeclarable(Redeclarable<T> *D);
143
144 // FIXME: Put in the same order is DeclNodes.td?
165
166 /// Add an Objective-C type parameter list to the given record.
168 // Empty type parameter list.
169 if (!typeParams) {
170 Record.push_back(0);
171 return;
172 }
173
174 Record.push_back(typeParams->size());
175 for (auto *typeParam : *typeParams) {
176 Record.AddDeclRef(typeParam);
177 }
178 Record.AddSourceLocation(typeParams->getLAngleLoc());
179 Record.AddSourceLocation(typeParams->getRAngleLoc());
180 }
181
182 /// Add to the record the first declaration from each module file that
183 /// provides a declaration of D. The intent is to provide a sufficient
184 /// set such that reloading this set will load all current redeclarations.
185 void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
186 llvm::MapVector<ModuleFile*, const Decl*> Firsts;
187 // FIXME: We can skip entries that we know are implied by others.
188 for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) {
189 if (R->isFromASTFile())
190 Firsts[Writer.Chain->getOwningModuleFile(R)] = R;
191 else if (IncludeLocal)
192 Firsts[nullptr] = R;
193 }
194 for (const auto &F : Firsts)
195 Record.AddDeclRef(F.second);
196 }
197
198 /// Get the specialization decl from an entry in the specialization list.
199 template <typename EntryType>
203 }
204
205 /// Get the list of partial specializations from a template's common ptr.
206 template<typename T>
207 decltype(T::PartialSpecializations) &getPartialSpecializations(T *Common) {
208 return Common->PartialSpecializations;
209 }
211 return std::nullopt;
212 }
213
214 template<typename DeclTy>
216 auto *Common = D->getCommonPtr();
217
218 // If we have any lazy specializations, and the external AST source is
219 // our chained AST reader, we can just write out the DeclIDs. Otherwise,
220 // we need to resolve them to actual declarations.
221 if (Writer.Chain != Writer.Context->getExternalSource() &&
222 Common->LazySpecializations) {
223 D->LoadLazySpecializations();
224 assert(!Common->LazySpecializations);
225 }
226
227 ArrayRef<DeclID> LazySpecializations;
228 if (auto *LS = Common->LazySpecializations)
229 LazySpecializations = llvm::ArrayRef(LS + 1, LS[0]);
230
231 // Add a slot to the record for the number of specializations.
232 unsigned I = Record.size();
233 Record.push_back(0);
234
235 // AddFirstDeclFromEachModule might trigger deserialization, invalidating
236 // *Specializations iterators.
238 for (auto &Entry : Common->Specializations)
239 Specs.push_back(getSpecializationDecl(Entry));
240 for (auto &Entry : getPartialSpecializations(Common))
241 Specs.push_back(getSpecializationDecl(Entry));
242
243 for (auto *D : Specs) {
244 assert(D->isCanonicalDecl() && "non-canonical decl in set");
245 AddFirstDeclFromEachModule(D, /*IncludeLocal*/true);
246 }
247 Record.append(LazySpecializations.begin(), LazySpecializations.end());
248
249 // Update the size entry we added earlier.
250 Record[I] = Record.size() - I - 1;
251 }
252
253 /// Ensure that this template specialization is associated with the specified
254 /// template on reload.
256 const Decl *Specialization) {
257 Template = Template->getCanonicalDecl();
258
259 // If the canonical template is local, we'll write out this specialization
260 // when we emit it.
261 // FIXME: We can do the same thing if there is any local declaration of
262 // the template, to avoid emitting an update record.
263 if (!Template->isFromASTFile())
264 return;
265
266 // We only need to associate the first local declaration of the
267 // specialization. The other declarations will get pulled in by it.
269 return;
270
271 Writer.DeclUpdates[Template].push_back(ASTWriter::DeclUpdate(
273 }
274 };
275}
276
278 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
279 if (FD->isInlined() || FD->isConstexpr())
280 return false;
281
282 if (FD->isDependentContext())
283 return false;
284
285 if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
286 return false;
287 }
288
289 if (auto *VD = dyn_cast<VarDecl>(D)) {
290 if (!VD->getDeclContext()->getRedeclContext()->isFileContext() ||
291 VD->isInline() || VD->isConstexpr() || isa<ParmVarDecl>(VD) ||
292 // Constant initialized variable may not affect the ABI, but they
293 // may be used in constant evaluation in the frontend, so we have
294 // to remain them.
295 VD->hasConstantInitialization())
296 return false;
297
298 if (VD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
299 return false;
300 }
301
302 return true;
303}
304
307
308 // Source locations require array (variable-length) abbreviations. The
309 // abbreviation infrastructure requires that arrays are encoded last, so
310 // we handle it here in the case of those classes derived from DeclaratorDecl
311 if (auto *DD = dyn_cast<DeclaratorDecl>(D)) {
312 if (auto *TInfo = DD->getTypeSourceInfo())
313 Record.AddTypeLoc(TInfo->getTypeLoc());
314 }
315
316 // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
317 // have been written. We want it last because we will not read it back when
318 // retrieving it from the AST, we'll just lazily set the offset.
319 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
320 if (!GeneratingReducedBMI || !CanElideDeclDef(FD)) {
321 Record.push_back(FD->doesThisDeclarationHaveABody());
322 if (FD->doesThisDeclarationHaveABody())
323 Record.AddFunctionDefinition(FD);
324 } else
325 Record.push_back(0);
326 }
327
328 // Similar to FunctionDecls, handle VarDecl's initializer here and write it
329 // after all other Stmts/Exprs. We will not read the initializer until after
330 // we have finished recursive deserialization, because it can recursively
331 // refer back to the variable.
332 if (auto *VD = dyn_cast<VarDecl>(D)) {
333 if (!GeneratingReducedBMI || !CanElideDeclDef(VD))
334 Record.AddVarDeclInit(VD);
335 else
336 Record.push_back(0);
337 }
338
339 // And similarly for FieldDecls. We already serialized whether there is a
340 // default member initializer.
341 if (auto *FD = dyn_cast<FieldDecl>(D)) {
342 if (FD->hasInClassInitializer()) {
343 if (Expr *Init = FD->getInClassInitializer()) {
344 Record.push_back(1);
345 Record.AddStmt(Init);
346 } else {
347 Record.push_back(0);
348 // Initializer has not been instantiated yet.
349 }
350 }
351 }
352
353 // If this declaration is also a DeclContext, write blocks for the
354 // declarations that lexically stored inside its context and those
355 // declarations that are visible from its context.
356 if (auto *DC = dyn_cast<DeclContext>(D))
358}
359
361 BitsPacker DeclBits;
362
363 // The order matters here. It will be better to put the bit with higher
364 // probability to be 0 in the end of the bits.
365 //
366 // Since we're using VBR6 format to store it.
367 // It will be pretty effient if all the higher bits are 0.
368 // For example, if we need to pack 8 bits into a value and the stored value
369 // is 0xf0, the actual stored value will be 0b000111'110000, which takes 12
370 // bits actually. However, if we changed the order to be 0x0f, then we can
371 // store it as 0b001111, which takes 6 bits only now.
372 DeclBits.addBits((uint64_t)D->getModuleOwnershipKind(), /*BitWidth=*/3);
373 DeclBits.addBit(D->isReferenced());
374 DeclBits.addBit(D->isUsed(false));
375 DeclBits.addBits(D->getAccess(), /*BitWidth=*/2);
376 DeclBits.addBit(D->isImplicit());
377 DeclBits.addBit(D->getDeclContext() != D->getLexicalDeclContext());
378 DeclBits.addBit(D->hasAttrs());
380 DeclBits.addBit(D->isInvalidDecl());
381 Record.push_back(DeclBits);
382
383 Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
384 if (D->getDeclContext() != D->getLexicalDeclContext())
385 Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
386
387 if (D->hasAttrs())
388 Record.AddAttributes(D->getAttrs());
389
390 Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
391
392 // If this declaration injected a name into a context different from its
393 // lexical context, and that context is an imported namespace, we need to
394 // update its visible declarations to include this name.
395 //
396 // This happens when we instantiate a class with a friend declaration or a
397 // function with a local extern declaration, for instance.
398 //
399 // FIXME: Can we handle this in AddedVisibleDecl instead?
400 if (D->isOutOfLine()) {
401 auto *DC = D->getDeclContext();
402 while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
403 if (!NS->isFromASTFile())
404 break;
405 Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
406 if (!NS->isInlineNamespace())
407 break;
408 DC = NS->getParent();
409 }
410 }
411}
412
414 StringRef Arg = D->getArg();
415 Record.push_back(Arg.size());
416 VisitDecl(D);
417 Record.AddSourceLocation(D->getBeginLoc());
418 Record.push_back(D->getCommentKind());
419 Record.AddString(Arg);
421}
422
425 StringRef Name = D->getName();
426 StringRef Value = D->getValue();
427 Record.push_back(Name.size() + 1 + Value.size());
428 VisitDecl(D);
429 Record.AddSourceLocation(D->getBeginLoc());
430 Record.AddString(Name);
431 Record.AddString(Value);
433}
434
436 llvm_unreachable("Translation units aren't directly serialized");
437}
438
440 VisitDecl(D);
441 Record.AddDeclarationName(D->getDeclName());
444 : 0);
445}
446
449 Record.AddSourceLocation(D->getBeginLoc());
450 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
451}
452
455 VisitTypeDecl(D);
456 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
457 Record.push_back(D->isModed());
458 if (D->isModed())
459 Record.AddTypeRef(D->getUnderlyingType());
460 Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
461}
462
465 if (D->getDeclContext() == D->getLexicalDeclContext() &&
466 !D->hasAttrs() &&
467 !D->isImplicit() &&
468 D->getFirstDecl() == D->getMostRecentDecl() &&
469 !D->isInvalidDecl() &&
471 !D->isModulePrivate() &&
474 AbbrevToUse = Writer.getDeclTypedefAbbrev();
475
477}
478
481 Record.AddDeclRef(D->getDescribedAliasTemplate());
483}
484
486 static_assert(DeclContext::NumTagDeclBits == 23,
487 "You need to update the serializer after you change the "
488 "TagDeclBits");
489
491 VisitTypeDecl(D);
492 Record.push_back(D->getIdentifierNamespace());
493
494 BitsPacker TagDeclBits;
495 TagDeclBits.addBits(llvm::to_underlying(D->getTagKind()), /*BitWidth=*/3);
496 TagDeclBits.addBit(!isa<CXXRecordDecl>(D) ? D->isCompleteDefinition() : 0);
497 TagDeclBits.addBit(D->isEmbeddedInDeclarator());
498 TagDeclBits.addBit(D->isFreeStanding());
499 TagDeclBits.addBit(D->isCompleteDefinitionRequired());
500 TagDeclBits.addBits(
501 D->hasExtInfo() ? 1 : (D->getTypedefNameForAnonDecl() ? 2 : 0),
502 /*BitWidth=*/2);
503 Record.push_back(TagDeclBits);
504
505 Record.AddSourceRange(D->getBraceRange());
506
507 if (D->hasExtInfo()) {
508 Record.AddQualifierInfo(*D->getExtInfo());
509 } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
510 Record.AddDeclRef(TD);
511 Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
512 }
513}
514
516 static_assert(DeclContext::NumEnumDeclBits == 43,
517 "You need to update the serializer after you change the "
518 "EnumDeclBits");
519
520 VisitTagDecl(D);
521 Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
522 if (!D->getIntegerTypeSourceInfo())
523 Record.AddTypeRef(D->getIntegerType());
524 Record.AddTypeRef(D->getPromotionType());
525
526 BitsPacker EnumDeclBits;
527 EnumDeclBits.addBits(D->getNumPositiveBits(), /*BitWidth=*/8);
528 EnumDeclBits.addBits(D->getNumNegativeBits(), /*BitWidth=*/8);
529 bool ShouldSkipCheckingODR = D->shouldSkipCheckingODR();
530 EnumDeclBits.addBit(ShouldSkipCheckingODR);
531 EnumDeclBits.addBit(D->isScoped());
532 EnumDeclBits.addBit(D->isScopedUsingClassTag());
533 EnumDeclBits.addBit(D->isFixed());
534 Record.push_back(EnumDeclBits);
535
536 // We only perform ODR checks for decls not in GMF.
537 if (!ShouldSkipCheckingODR)
538 Record.push_back(D->getODRHash());
539
541 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
542 Record.push_back(MemberInfo->getTemplateSpecializationKind());
543 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
544 } else {
545 Record.AddDeclRef(nullptr);
546 }
547
548 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
549 !D->isInvalidDecl() && !D->isImplicit() && !D->hasExtInfo() &&
551 D->getFirstDecl() == D->getMostRecentDecl() &&
557 AbbrevToUse = Writer.getDeclEnumAbbrev();
558
560}
561
563 static_assert(DeclContext::NumRecordDeclBits == 64,
564 "You need to update the serializer after you change the "
565 "RecordDeclBits");
566
567 VisitTagDecl(D);
568
569 BitsPacker RecordDeclBits;
570 RecordDeclBits.addBit(D->hasFlexibleArrayMember());
571 RecordDeclBits.addBit(D->isAnonymousStructOrUnion());
572 RecordDeclBits.addBit(D->hasObjectMember());
573 RecordDeclBits.addBit(D->hasVolatileMember());
575 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveCopy());
576 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveDestroy());
579 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveCopyCUnion());
580 RecordDeclBits.addBit(D->isParamDestroyedInCallee());
581 RecordDeclBits.addBits(llvm::to_underlying(D->getArgPassingRestrictions()), 2);
582 Record.push_back(RecordDeclBits);
583
584 // Only compute this for C/Objective-C, in C++ this is computed as part
585 // of CXXRecordDecl.
586 if (!isa<CXXRecordDecl>(D))
587 Record.push_back(D->getODRHash());
588
589 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
590 !D->isImplicit() && !D->isInvalidDecl() && !D->hasExtInfo() &&
592 D->getFirstDecl() == D->getMostRecentDecl() &&
597 AbbrevToUse = Writer.getDeclRecordAbbrev();
598
600}
601
604 Record.AddTypeRef(D->getType());
605}
606
609 Record.push_back(D->getInitExpr()? 1 : 0);
610 if (D->getInitExpr())
611 Record.AddStmt(D->getInitExpr());
612 Record.AddAPSInt(D->getInitVal());
613
615}
616
619 Record.AddSourceLocation(D->getInnerLocStart());
620 Record.push_back(D->hasExtInfo());
621 if (D->hasExtInfo()) {
622 DeclaratorDecl::ExtInfo *Info = D->getExtInfo();
623 Record.AddQualifierInfo(*Info);
624 Record.AddStmt(Info->TrailingRequiresClause);
625 }
626 // The location information is deferred until the end of the record.
627 Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()
628 : QualType());
629}
630
632 static_assert(DeclContext::NumFunctionDeclBits == 44,
633 "You need to update the serializer after you change the "
634 "FunctionDeclBits");
635
637
638 Record.push_back(D->getTemplatedKind());
639 switch (D->getTemplatedKind()) {
641 break;
643 Record.AddDeclRef(D->getInstantiatedFromDecl());
644 break;
646 Record.AddDeclRef(D->getDescribedFunctionTemplate());
647 break;
650 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
651 Record.push_back(MemberInfo->getTemplateSpecializationKind());
652 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
653 break;
654 }
657 FTSInfo = D->getTemplateSpecializationInfo();
658
660
661 Record.AddDeclRef(FTSInfo->getTemplate());
662 Record.push_back(FTSInfo->getTemplateSpecializationKind());
663
664 // Template arguments.
665 Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
666
667 // Template args as written.
668 Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
669 if (FTSInfo->TemplateArgumentsAsWritten)
670 Record.AddASTTemplateArgumentListInfo(
672
673 Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
674
675 if (MemberSpecializationInfo *MemberInfo =
676 FTSInfo->getMemberSpecializationInfo()) {
677 Record.push_back(1);
678 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
679 Record.push_back(MemberInfo->getTemplateSpecializationKind());
680 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
681 } else {
682 Record.push_back(0);
683 }
684
685 if (D->isCanonicalDecl()) {
686 // Write the template that contains the specializations set. We will
687 // add a FunctionTemplateSpecializationInfo to it when reading.
688 Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
689 }
690 break;
691 }
694 DFTSInfo = D->getDependentSpecializationInfo();
695
696 // Candidates.
697 Record.push_back(DFTSInfo->getCandidates().size());
698 for (FunctionTemplateDecl *FTD : DFTSInfo->getCandidates())
699 Record.AddDeclRef(FTD);
700
701 // Templates args.
702 Record.push_back(DFTSInfo->TemplateArgumentsAsWritten != nullptr);
703 if (DFTSInfo->TemplateArgumentsAsWritten)
704 Record.AddASTTemplateArgumentListInfo(
706 break;
707 }
708 }
709
711 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
712 Record.push_back(D->getIdentifierNamespace());
713
714 // The order matters here. It will be better to put the bit with higher
715 // probability to be 0 in the end of the bits. See the comments in VisitDecl
716 // for details.
717 BitsPacker FunctionDeclBits;
718 // FIXME: stable encoding
719 FunctionDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), 3);
720 FunctionDeclBits.addBits((uint32_t)D->getStorageClass(), /*BitWidth=*/3);
721 bool ShouldSkipCheckingODR = D->shouldSkipCheckingODR();
722 FunctionDeclBits.addBit(ShouldSkipCheckingODR);
723 FunctionDeclBits.addBit(D->isInlineSpecified());
724 FunctionDeclBits.addBit(D->isInlined());
725 FunctionDeclBits.addBit(D->hasSkippedBody());
726 FunctionDeclBits.addBit(D->isVirtualAsWritten());
727 FunctionDeclBits.addBit(D->isPureVirtual());
728 FunctionDeclBits.addBit(D->hasInheritedPrototype());
729 FunctionDeclBits.addBit(D->hasWrittenPrototype());
730 FunctionDeclBits.addBit(D->isDeletedBit());
731 FunctionDeclBits.addBit(D->isTrivial());
732 FunctionDeclBits.addBit(D->isTrivialForCall());
733 FunctionDeclBits.addBit(D->isDefaulted());
734 FunctionDeclBits.addBit(D->isExplicitlyDefaulted());
735 FunctionDeclBits.addBit(D->isIneligibleOrNotSelected());
736 FunctionDeclBits.addBits((uint64_t)(D->getConstexprKind()), /*BitWidth=*/2);
737 FunctionDeclBits.addBit(D->hasImplicitReturnZero());
738 FunctionDeclBits.addBit(D->isMultiVersion());
739 FunctionDeclBits.addBit(D->isLateTemplateParsed());
741 FunctionDeclBits.addBit(D->usesSEHTry());
742 Record.push_back(FunctionDeclBits);
743
744 Record.AddSourceLocation(D->getEndLoc());
745 if (D->isExplicitlyDefaulted())
746 Record.AddSourceLocation(D->getDefaultLoc());
747
748 // We only perform ODR checks for decls not in GMF.
749 if (!ShouldSkipCheckingODR)
750 Record.push_back(D->getODRHash());
751
752 if (D->isDefaulted() || D->isDeletedAsWritten()) {
753 if (auto *FDI = D->getDefalutedOrDeletedInfo()) {
754 // Store both that there is an DefaultedOrDeletedInfo and whether it
755 // contains a DeletedMessage.
756 StringLiteral *DeletedMessage = FDI->getDeletedMessage();
757 Record.push_back(1 | (DeletedMessage ? 2 : 0));
758 if (DeletedMessage)
759 Record.AddStmt(DeletedMessage);
760
761 Record.push_back(FDI->getUnqualifiedLookups().size());
762 for (DeclAccessPair P : FDI->getUnqualifiedLookups()) {
763 Record.AddDeclRef(P.getDecl());
764 Record.push_back(P.getAccess());
765 }
766 } else {
767 Record.push_back(0);
768 }
769 }
770
771 Record.push_back(D->param_size());
772 for (auto *P : D->parameters())
773 Record.AddDeclRef(P);
775}
776
779 uint64_t Kind = static_cast<uint64_t>(ES.getKind());
780 Kind = Kind << 1 | static_cast<bool>(ES.getExpr());
781 Record.push_back(Kind);
782 if (ES.getExpr()) {
783 Record.AddStmt(ES.getExpr());
784 }
785}
786
789 Record.AddDeclRef(D->Ctor);
791 Record.push_back(static_cast<unsigned char>(D->getDeductionCandidateKind()));
793}
794
796 static_assert(DeclContext::NumObjCMethodDeclBits == 37,
797 "You need to update the serializer after you change the "
798 "ObjCMethodDeclBits");
799
801 // FIXME: convert to LazyStmtPtr?
802 // Unlike C/C++, method bodies will never be in header files.
803 bool HasBodyStuff = D->getBody() != nullptr;
804 Record.push_back(HasBodyStuff);
805 if (HasBodyStuff) {
806 Record.AddStmt(D->getBody());
807 }
808 Record.AddDeclRef(D->getSelfDecl());
809 Record.AddDeclRef(D->getCmdDecl());
810 Record.push_back(D->isInstanceMethod());
811 Record.push_back(D->isVariadic());
812 Record.push_back(D->isPropertyAccessor());
813 Record.push_back(D->isSynthesizedAccessorStub());
814 Record.push_back(D->isDefined());
815 Record.push_back(D->isOverriding());
816 Record.push_back(D->hasSkippedBody());
817
818 Record.push_back(D->isRedeclaration());
819 Record.push_back(D->hasRedeclaration());
820 if (D->hasRedeclaration()) {
821 assert(Context.getObjCMethodRedeclaration(D));
822 Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
823 }
824
825 // FIXME: stable encoding for @required/@optional
826 Record.push_back(llvm::to_underlying(D->getImplementationControl()));
827 // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
828 Record.push_back(D->getObjCDeclQualifier());
829 Record.push_back(D->hasRelatedResultType());
830 Record.AddTypeRef(D->getReturnType());
831 Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
832 Record.AddSourceLocation(D->getEndLoc());
833 Record.push_back(D->param_size());
834 for (const auto *P : D->parameters())
835 Record.AddDeclRef(P);
836
837 Record.push_back(D->getSelLocsKind());
838 unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
839 SourceLocation *SelLocs = D->getStoredSelLocs();
840 Record.push_back(NumStoredSelLocs);
841 for (unsigned i = 0; i != NumStoredSelLocs; ++i)
842 Record.AddSourceLocation(SelLocs[i]);
843
845}
846
849 Record.push_back(D->Variance);
850 Record.push_back(D->Index);
851 Record.AddSourceLocation(D->VarianceLoc);
852 Record.AddSourceLocation(D->ColonLoc);
853
855}
856
858 static_assert(DeclContext::NumObjCContainerDeclBits == 64,
859 "You need to update the serializer after you change the "
860 "ObjCContainerDeclBits");
861
863 Record.AddSourceLocation(D->getAtStartLoc());
864 Record.AddSourceRange(D->getAtEndRange());
865 // Abstract class (no need to define a stable serialization::DECL code).
866}
867
871 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
872 AddObjCTypeParamList(D->TypeParamList);
873
874 Record.push_back(D->isThisDeclarationADefinition());
876 // Write the DefinitionData
877 ObjCInterfaceDecl::DefinitionData &Data = D->data();
878
879 Record.AddTypeSourceInfo(D->getSuperClassTInfo());
880 Record.AddSourceLocation(D->getEndOfDefinitionLoc());
881 Record.push_back(Data.HasDesignatedInitializers);
882 Record.push_back(D->getODRHash());
883
884 // Write out the protocols that are directly referenced by the @interface.
885 Record.push_back(Data.ReferencedProtocols.size());
886 for (const auto *P : D->protocols())
887 Record.AddDeclRef(P);
888 for (const auto &PL : D->protocol_locs())
889 Record.AddSourceLocation(PL);
890
891 // Write out the protocols that are transitively referenced.
892 Record.push_back(Data.AllReferencedProtocols.size());
894 P = Data.AllReferencedProtocols.begin(),
895 PEnd = Data.AllReferencedProtocols.end();
896 P != PEnd; ++P)
897 Record.AddDeclRef(*P);
898
899
900 if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
901 // Ensure that we write out the set of categories for this class.
902 Writer.ObjCClassesWithCategories.insert(D);
903
904 // Make sure that the categories get serialized.
905 for (; Cat; Cat = Cat->getNextClassCategoryRaw())
906 (void)Writer.GetDeclRef(Cat);
907 }
908 }
909
911}
912
915 // FIXME: stable encoding for @public/@private/@protected/@package
916 Record.push_back(D->getAccessControl());
917 Record.push_back(D->getSynthesize());
918
919 if (D->getDeclContext() == D->getLexicalDeclContext() &&
920 !D->hasAttrs() &&
921 !D->isImplicit() &&
922 !D->isUsed(false) &&
923 !D->isInvalidDecl() &&
924 !D->isReferenced() &&
925 !D->isModulePrivate() &&
926 !D->getBitWidth() &&
927 !D->hasExtInfo() &&
928 D->getDeclName())
929 AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
930
932}
933
937
938 Record.push_back(D->isThisDeclarationADefinition());
940 Record.push_back(D->protocol_size());
941 for (const auto *I : D->protocols())
942 Record.AddDeclRef(I);
943 for (const auto &PL : D->protocol_locs())
944 Record.AddSourceLocation(PL);
945 Record.push_back(D->getODRHash());
946 }
947
949}
950
954}
955
958 Record.AddSourceLocation(D->getCategoryNameLoc());
959 Record.AddSourceLocation(D->getIvarLBraceLoc());
960 Record.AddSourceLocation(D->getIvarRBraceLoc());
961 Record.AddDeclRef(D->getClassInterface());
962 AddObjCTypeParamList(D->TypeParamList);
963 Record.push_back(D->protocol_size());
964 for (const auto *I : D->protocols())
965 Record.AddDeclRef(I);
966 for (const auto &PL : D->protocol_locs())
967 Record.AddSourceLocation(PL);
969}
970
973 Record.AddDeclRef(D->getClassInterface());
975}
976
979 Record.AddSourceLocation(D->getAtLoc());
980 Record.AddSourceLocation(D->getLParenLoc());
981 Record.AddTypeRef(D->getType());
982 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
983 // FIXME: stable encoding
984 Record.push_back((unsigned)D->getPropertyAttributes());
985 Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
986 // FIXME: stable encoding
987 Record.push_back((unsigned)D->getPropertyImplementation());
988 Record.AddDeclarationName(D->getGetterName());
989 Record.AddSourceLocation(D->getGetterNameLoc());
990 Record.AddDeclarationName(D->getSetterName());
991 Record.AddSourceLocation(D->getSetterNameLoc());
992 Record.AddDeclRef(D->getGetterMethodDecl());
993 Record.AddDeclRef(D->getSetterMethodDecl());
994 Record.AddDeclRef(D->getPropertyIvarDecl());
996}
997
1000 Record.AddDeclRef(D->getClassInterface());
1001 // Abstract class (no need to define a stable serialization::DECL code).
1002}
1003
1006 Record.AddSourceLocation(D->getCategoryNameLoc());
1008}
1009
1012 Record.AddDeclRef(D->getSuperClass());
1013 Record.AddSourceLocation(D->getSuperClassLoc());
1014 Record.AddSourceLocation(D->getIvarLBraceLoc());
1015 Record.AddSourceLocation(D->getIvarRBraceLoc());
1016 Record.push_back(D->hasNonZeroConstructors());
1017 Record.push_back(D->hasDestructors());
1018 Record.push_back(D->NumIvarInitializers);
1019 if (D->NumIvarInitializers)
1020 Record.AddCXXCtorInitializers(
1021 llvm::ArrayRef(D->init_begin(), D->init_end()));
1023}
1024
1026 VisitDecl(D);
1027 Record.AddSourceLocation(D->getBeginLoc());
1028 Record.AddDeclRef(D->getPropertyDecl());
1029 Record.AddDeclRef(D->getPropertyIvarDecl());
1030 Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
1031 Record.AddDeclRef(D->getGetterMethodDecl());
1032 Record.AddDeclRef(D->getSetterMethodDecl());
1033 Record.AddStmt(D->getGetterCXXConstructor());
1034 Record.AddStmt(D->getSetterCXXAssignment());
1036}
1037
1040 Record.push_back(D->isMutable());
1041
1042 Record.push_back((D->StorageKind << 1) | D->BitField);
1043 if (D->StorageKind == FieldDecl::ISK_CapturedVLAType)
1044 Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
1045 else if (D->BitField)
1046 Record.AddStmt(D->getBitWidth());
1047
1048 if (!D->getDeclName())
1049 Record.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D));
1050
1051 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1052 !D->hasAttrs() &&
1053 !D->isImplicit() &&
1054 !D->isUsed(false) &&
1055 !D->isInvalidDecl() &&
1056 !D->isReferenced() &&
1058 !D->isModulePrivate() &&
1059 !D->getBitWidth() &&
1060 !D->hasInClassInitializer() &&
1061 !D->hasCapturedVLAType() &&
1062 !D->hasExtInfo() &&
1065 D->getDeclName())
1066 AbbrevToUse = Writer.getDeclFieldAbbrev();
1067
1069}
1070
1073 Record.AddIdentifierRef(D->getGetterId());
1074 Record.AddIdentifierRef(D->getSetterId());
1076}
1077
1079 VisitValueDecl(D);
1080 MSGuidDecl::Parts Parts = D->getParts();
1081 Record.push_back(Parts.Part1);
1082 Record.push_back(Parts.Part2);
1083 Record.push_back(Parts.Part3);
1084 Record.append(std::begin(Parts.Part4And5), std::end(Parts.Part4And5));
1086}
1087
1090 VisitValueDecl(D);
1091 Record.AddAPValue(D->getValue());
1093}
1094
1096 VisitValueDecl(D);
1097 Record.AddAPValue(D->getValue());
1099}
1100
1102 VisitValueDecl(D);
1103 Record.push_back(D->getChainingSize());
1104
1105 for (const auto *P : D->chain())
1106 Record.AddDeclRef(P);
1108}
1109
1113
1114 // The order matters here. It will be better to put the bit with higher
1115 // probability to be 0 in the end of the bits. See the comments in VisitDecl
1116 // for details.
1117 BitsPacker VarDeclBits;
1118 VarDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()),
1119 /*BitWidth=*/3);
1120
1121 bool ModulesCodegen = false;
1122 if (Writer.WritingModule && D->getStorageDuration() == SD_Static &&
1124 // When building a C++20 module interface unit or a partition unit, a
1125 // strong definition in the module interface is provided by the
1126 // compilation of that unit, not by its users. (Inline variables are still
1127 // emitted in module users.)
1128 ModulesCodegen =
1129 (Writer.WritingModule->isInterfaceOrPartition() ||
1130 (D->hasAttr<DLLExportAttr>() &&
1131 Writer.Context->getLangOpts().BuildingPCHWithObjectFile)) &&
1132 Writer.Context->GetGVALinkageForVariable(D) >= GVA_StrongExternal;
1133 }
1134 VarDeclBits.addBit(ModulesCodegen);
1135
1136 VarDeclBits.addBits(D->getStorageClass(), /*BitWidth=*/3);
1137 VarDeclBits.addBits(D->getTSCSpec(), /*BitWidth=*/2);
1138 VarDeclBits.addBits(D->getInitStyle(), /*BitWidth=*/2);
1139 VarDeclBits.addBit(D->isARCPseudoStrong());
1140
1141 bool HasDeducedType = false;
1142 if (!isa<ParmVarDecl>(D)) {
1144 VarDeclBits.addBit(D->isExceptionVariable());
1145 VarDeclBits.addBit(D->isNRVOVariable());
1146 VarDeclBits.addBit(D->isCXXForRangeDecl());
1147
1148 VarDeclBits.addBit(D->isInline());
1149 VarDeclBits.addBit(D->isInlineSpecified());
1150 VarDeclBits.addBit(D->isConstexpr());
1151 VarDeclBits.addBit(D->isInitCapture());
1152 VarDeclBits.addBit(D->isPreviousDeclInSameBlockScope());
1153
1154 VarDeclBits.addBit(D->isEscapingByref());
1155 HasDeducedType = D->getType()->getContainedDeducedType();
1156 VarDeclBits.addBit(HasDeducedType);
1157
1158 if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
1159 VarDeclBits.addBits(llvm::to_underlying(IPD->getParameterKind()),
1160 /*Width=*/3);
1161 else
1162 VarDeclBits.addBits(0, /*Width=*/3);
1163
1164 VarDeclBits.addBit(D->isObjCForDecl());
1165 }
1166
1167 Record.push_back(VarDeclBits);
1168
1169 if (ModulesCodegen)
1170 Writer.ModularCodegenDecls.push_back(Writer.GetDeclRef(D));
1171
1172 if (D->hasAttr<BlocksAttr>()) {
1173 BlockVarCopyInit Init = Writer.Context->getBlockVarCopyInit(D);
1174 Record.AddStmt(Init.getCopyExpr());
1175 if (Init.getCopyExpr())
1176 Record.push_back(Init.canThrow());
1177 }
1178
1179 enum {
1180 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1181 };
1182 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1183 Record.push_back(VarTemplate);
1184 Record.AddDeclRef(TemplD);
1185 } else if (MemberSpecializationInfo *SpecInfo
1187 Record.push_back(StaticDataMemberSpecialization);
1188 Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1189 Record.push_back(SpecInfo->getTemplateSpecializationKind());
1190 Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1191 } else {
1192 Record.push_back(VarNotTemplate);
1193 }
1194
1195 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
1199 !D->hasExtInfo() && D->getFirstDecl() == D->getMostRecentDecl() &&
1200 D->getKind() == Decl::Var && !D->isInline() && !D->isConstexpr() &&
1202 !D->isEscapingByref() && !HasDeducedType &&
1205 !isa<ImplicitParamDecl>(D) && !D->isEscapingByref())
1206 AbbrevToUse = Writer.getDeclVarAbbrev();
1207
1209}
1210
1212 VisitVarDecl(D);
1214}
1215
1217 VisitVarDecl(D);
1218
1219 // See the implementation of `ParmVarDecl::getParameterIndex()`, which may
1220 // exceed the size of the normal bitfield. So it may be better to not pack
1221 // these bits.
1222 Record.push_back(D->getFunctionScopeIndex());
1223
1224 BitsPacker ParmVarDeclBits;
1225 ParmVarDeclBits.addBit(D->isObjCMethodParameter());
1226 ParmVarDeclBits.addBits(D->getFunctionScopeDepth(), /*BitsWidth=*/7);
1227 // FIXME: stable encoding
1228 ParmVarDeclBits.addBits(D->getObjCDeclQualifier(), /*BitsWidth=*/7);
1229 ParmVarDeclBits.addBit(D->isKNRPromoted());
1230 ParmVarDeclBits.addBit(D->hasInheritedDefaultArg());
1231 ParmVarDeclBits.addBit(D->hasUninstantiatedDefaultArg());
1232 ParmVarDeclBits.addBit(D->getExplicitObjectParamThisLoc().isValid());
1233 Record.push_back(ParmVarDeclBits);
1234
1236 Record.AddStmt(D->getUninstantiatedDefaultArg());
1238 Record.AddSourceLocation(D->getExplicitObjectParamThisLoc());
1240
1241 // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1242 // we dynamically check for the properties that we optimize for, but don't
1243 // know are true of all PARM_VAR_DECLs.
1244 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
1245 !D->hasExtInfo() && D->getStorageClass() == 0 && !D->isInvalidDecl() &&
1247 D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1248 D->getInit() == nullptr) // No default expr.
1249 AbbrevToUse = Writer.getDeclParmVarAbbrev();
1250
1251 // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1252 // just us assuming it.
1253 assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1255 && "PARM_VAR_DECL can't be demoted definition.");
1256 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1257 assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1258 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1259 assert(!D->isStaticDataMember() &&
1260 "PARM_VAR_DECL can't be static data member");
1261}
1262
1264 // Record the number of bindings first to simplify deserialization.
1265 Record.push_back(D->bindings().size());
1266
1267 VisitVarDecl(D);
1268 for (auto *B : D->bindings())
1269 Record.AddDeclRef(B);
1271}
1272
1274 VisitValueDecl(D);
1275 Record.AddStmt(D->getBinding());
1277}
1278
1280 VisitDecl(D);
1281 Record.AddStmt(D->getAsmString());
1282 Record.AddSourceLocation(D->getRParenLoc());
1284}
1285
1287 VisitDecl(D);
1288 Record.AddStmt(D->getStmt());
1290}
1291
1293 VisitDecl(D);
1295}
1296
1299 VisitDecl(D);
1300 Record.AddDeclRef(D->getExtendingDecl());
1301 Record.AddStmt(D->getTemporaryExpr());
1302 Record.push_back(static_cast<bool>(D->getValue()));
1303 if (D->getValue())
1304 Record.AddAPValue(*D->getValue());
1305 Record.push_back(D->getManglingNumber());
1307}
1309 VisitDecl(D);
1310 Record.AddStmt(D->getBody());
1311 Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1312 Record.push_back(D->param_size());
1313 for (ParmVarDecl *P : D->parameters())
1314 Record.AddDeclRef(P);
1315 Record.push_back(D->isVariadic());
1316 Record.push_back(D->blockMissingReturnType());
1317 Record.push_back(D->isConversionFromLambda());
1318 Record.push_back(D->doesNotEscape());
1319 Record.push_back(D->canAvoidCopyToHeap());
1320 Record.push_back(D->capturesCXXThis());
1321 Record.push_back(D->getNumCaptures());
1322 for (const auto &capture : D->captures()) {
1323 Record.AddDeclRef(capture.getVariable());
1324
1325 unsigned flags = 0;
1326 if (capture.isByRef()) flags |= 1;
1327 if (capture.isNested()) flags |= 2;
1328 if (capture.hasCopyExpr()) flags |= 4;
1329 Record.push_back(flags);
1330
1331 if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1332 }
1333
1335}
1336
1338 Record.push_back(CD->getNumParams());
1339 VisitDecl(CD);
1340 Record.push_back(CD->getContextParamPosition());
1341 Record.push_back(CD->isNothrow() ? 1 : 0);
1342 // Body is stored by VisitCapturedStmt.
1343 for (unsigned I = 0; I < CD->getNumParams(); ++I)
1344 Record.AddDeclRef(CD->getParam(I));
1346}
1347
1349 static_assert(DeclContext::NumLinkageSpecDeclBits == 17,
1350 "You need to update the serializer after you change the"
1351 "LinkageSpecDeclBits");
1352
1353 VisitDecl(D);
1354 Record.push_back(llvm::to_underlying(D->getLanguage()));
1355 Record.AddSourceLocation(D->getExternLoc());
1356 Record.AddSourceLocation(D->getRBraceLoc());
1358}
1359
1361 VisitDecl(D);
1362 Record.AddSourceLocation(D->getRBraceLoc());
1364}
1365
1367 VisitNamedDecl(D);
1368 Record.AddSourceLocation(D->getBeginLoc());
1370}
1371
1372
1375 VisitNamedDecl(D);
1376
1377 BitsPacker NamespaceDeclBits;
1378 NamespaceDeclBits.addBit(D->isInline());
1379 NamespaceDeclBits.addBit(D->isNested());
1380 Record.push_back(NamespaceDeclBits);
1381
1382 Record.AddSourceLocation(D->getBeginLoc());
1383 Record.AddSourceLocation(D->getRBraceLoc());
1384
1385 if (D->isOriginalNamespace())
1386 Record.AddDeclRef(D->getAnonymousNamespace());
1388
1389 if (Writer.hasChain() && D->isAnonymousNamespace() &&
1390 D == D->getMostRecentDecl()) {
1391 // This is a most recent reopening of the anonymous namespace. If its parent
1392 // is in a previous PCH (or is the TU), mark that parent for update, because
1393 // the original namespace always points to the latest re-opening of its
1394 // anonymous namespace.
1395 Decl *Parent = cast<Decl>(
1397 if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1398 Writer.DeclUpdates[Parent].push_back(
1399 ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
1400 }
1401 }
1402}
1403
1406 VisitNamedDecl(D);
1407 Record.AddSourceLocation(D->getNamespaceLoc());
1408 Record.AddSourceLocation(D->getTargetNameLoc());
1409 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1410 Record.AddDeclRef(D->getNamespace());
1412}
1413
1415 VisitNamedDecl(D);
1416 Record.AddSourceLocation(D->getUsingLoc());
1417 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1418 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1419 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1420 Record.push_back(D->hasTypename());
1421 Record.AddDeclRef(Context.getInstantiatedFromUsingDecl(D));
1423}
1424
1426 VisitNamedDecl(D);
1427 Record.AddSourceLocation(D->getUsingLoc());
1428 Record.AddSourceLocation(D->getEnumLoc());
1429 Record.AddTypeSourceInfo(D->getEnumType());
1430 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1431 Record.AddDeclRef(Context.getInstantiatedFromUsingEnumDecl(D));
1433}
1434
1436 Record.push_back(D->NumExpansions);
1437 VisitNamedDecl(D);
1438 Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
1439 for (auto *E : D->expansions())
1440 Record.AddDeclRef(E);
1442}
1443
1446 VisitNamedDecl(D);
1447 Record.AddDeclRef(D->getTargetDecl());
1448 Record.push_back(D->getIdentifierNamespace());
1449 Record.AddDeclRef(D->UsingOrNextShadow);
1450 Record.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D));
1451
1452 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1453 D->getFirstDecl() == D->getMostRecentDecl() && !D->hasAttrs() &&
1456 AbbrevToUse = Writer.getDeclUsingShadowAbbrev();
1457
1459}
1460
1464 Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1465 Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1466 Record.push_back(D->IsVirtual);
1468}
1469
1471 VisitNamedDecl(D);
1472 Record.AddSourceLocation(D->getUsingLoc());
1473 Record.AddSourceLocation(D->getNamespaceKeyLocation());
1474 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1475 Record.AddDeclRef(D->getNominatedNamespace());
1476 Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1478}
1479
1481 VisitValueDecl(D);
1482 Record.AddSourceLocation(D->getUsingLoc());
1483 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1484 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1485 Record.AddSourceLocation(D->getEllipsisLoc());
1487}
1488
1491 VisitTypeDecl(D);
1492 Record.AddSourceLocation(D->getTypenameLoc());
1493 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1494 Record.AddSourceLocation(D->getEllipsisLoc());
1496}
1497
1500 VisitNamedDecl(D);
1502}
1503
1505 VisitRecordDecl(D);
1506
1507 enum {
1508 CXXRecNotTemplate = 0,
1509 CXXRecTemplate,
1510 CXXRecMemberSpecialization,
1511 CXXLambda
1512 };
1513 if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1514 Record.push_back(CXXRecTemplate);
1515 Record.AddDeclRef(TemplD);
1516 } else if (MemberSpecializationInfo *MSInfo
1518 Record.push_back(CXXRecMemberSpecialization);
1519 Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1520 Record.push_back(MSInfo->getTemplateSpecializationKind());
1521 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1522 } else if (D->isLambda()) {
1523 // For a lambda, we need some information early for merging.
1524 Record.push_back(CXXLambda);
1525 if (auto *Context = D->getLambdaContextDecl()) {
1526 Record.AddDeclRef(Context);
1527 Record.push_back(D->getLambdaIndexInContext());
1528 } else {
1529 Record.push_back(0);
1530 }
1531 } else {
1532 Record.push_back(CXXRecNotTemplate);
1533 }
1534
1535 Record.push_back(D->isThisDeclarationADefinition());
1537 Record.AddCXXDefinitionData(D);
1538
1539 // Store (what we currently believe to be) the key function to avoid
1540 // deserializing every method so we can compute it.
1541 if (D->isCompleteDefinition())
1542 Record.AddDeclRef(Context.getCurrentKeyFunction(D));
1543
1545}
1546
1549 if (D->isCanonicalDecl()) {
1550 Record.push_back(D->size_overridden_methods());
1551 for (const CXXMethodDecl *MD : D->overridden_methods())
1552 Record.AddDeclRef(MD);
1553 } else {
1554 // We only need to record overridden methods once for the canonical decl.
1555 Record.push_back(0);
1556 }
1557
1558 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1559 D->getFirstDecl() == D->getMostRecentDecl() && !D->isInvalidDecl() &&
1560 !D->hasAttrs() && !D->isTopLevelDeclInObjCContainer() &&
1562 !D->shouldSkipCheckingODR() && !D->hasExtInfo() &&
1563 !D->isExplicitlyDefaulted()) {
1568 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1569 else if (D->getTemplatedKind() ==
1573
1574 if (FTSInfo->TemplateArguments->size() == 1) {
1575 const TemplateArgument &TA = FTSInfo->TemplateArguments->get(0);
1576 if (TA.getKind() == TemplateArgument::Type &&
1577 !FTSInfo->TemplateArgumentsAsWritten &&
1578 !FTSInfo->getMemberSpecializationInfo())
1579 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1580 }
1581 } else if (D->getTemplatedKind() ==
1585 if (!DFTSInfo->TemplateArgumentsAsWritten)
1586 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1587 }
1588 }
1589
1591}
1592
1594 static_assert(DeclContext::NumCXXConstructorDeclBits == 64,
1595 "You need to update the serializer after you change the "
1596 "CXXConstructorDeclBits");
1597
1598 Record.push_back(D->getTrailingAllocKind());
1600 if (auto Inherited = D->getInheritedConstructor()) {
1601 Record.AddDeclRef(Inherited.getShadowDecl());
1602 Record.AddDeclRef(Inherited.getConstructor());
1603 }
1604
1607}
1608
1611
1612 Record.AddDeclRef(D->getOperatorDelete());
1613 if (D->getOperatorDelete())
1614 Record.AddStmt(D->getOperatorDeleteThisArg());
1615
1617}
1618
1623}
1624
1626 VisitDecl(D);
1627 Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1628 ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1629 Record.push_back(!IdentifierLocs.empty());
1630 if (IdentifierLocs.empty()) {
1631 Record.AddSourceLocation(D->getEndLoc());
1632 Record.push_back(1);
1633 } else {
1634 for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1635 Record.AddSourceLocation(IdentifierLocs[I]);
1636 Record.push_back(IdentifierLocs.size());
1637 }
1638 // Note: the number of source locations must always be the last element in
1639 // the record.
1641}
1642
1644 VisitDecl(D);
1645 Record.AddSourceLocation(D->getColonLoc());
1647}
1648
1650 // Record the number of friend type template parameter lists here
1651 // so as to simplify memory allocation during deserialization.
1652 Record.push_back(D->NumTPLists);
1653 VisitDecl(D);
1654 bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1655 Record.push_back(hasFriendDecl);
1656 if (hasFriendDecl)
1657 Record.AddDeclRef(D->getFriendDecl());
1658 else
1659 Record.AddTypeSourceInfo(D->getFriendType());
1660 for (unsigned i = 0; i < D->NumTPLists; ++i)
1661 Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1662 Record.AddDeclRef(D->getNextFriend());
1663 Record.push_back(D->UnsupportedFriend);
1664 Record.AddSourceLocation(D->FriendLoc);
1666}
1667
1669 VisitDecl(D);
1670 Record.push_back(D->getNumTemplateParameters());
1671 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1672 Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1673 Record.push_back(D->getFriendDecl() != nullptr);
1674 if (D->getFriendDecl())
1675 Record.AddDeclRef(D->getFriendDecl());
1676 else
1677 Record.AddTypeSourceInfo(D->getFriendType());
1678 Record.AddSourceLocation(D->getFriendLoc());
1680}
1681
1683 VisitNamedDecl(D);
1684
1685 Record.AddTemplateParameterList(D->getTemplateParameters());
1686 Record.AddDeclRef(D->getTemplatedDecl());
1687}
1688
1691 Record.AddStmt(D->getConstraintExpr());
1693}
1694
1697 Record.push_back(D->getTemplateArguments().size());
1698 VisitDecl(D);
1699 for (const TemplateArgument &Arg : D->getTemplateArguments())
1700 Record.AddTemplateArgument(Arg);
1702}
1703
1706}
1707
1710
1711 // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1712 // getCommonPtr() can be used while this is still initializing.
1713 if (D->isFirstDecl()) {
1714 // This declaration owns the 'common' pointer, so serialize that data now.
1717 Record.push_back(D->isMemberSpecialization());
1718 }
1719
1721 Record.push_back(D->getIdentifierNamespace());
1722}
1723
1726
1727 if (D->isFirstDecl())
1729
1730 // Force emitting the corresponding deduction guide in reduced BMI mode.
1731 // Otherwise, the deduction guide may be optimized out incorrectly.
1732 if (Writer.isGeneratingReducedBMI()) {
1733 auto Name = Context.DeclarationNames.getCXXDeductionGuideName(D);
1734 for (auto *DG : D->getDeclContext()->noload_lookup(Name))
1735 Writer.GetDeclRef(DG);
1736 }
1737
1739}
1740
1744
1746
1747 llvm::PointerUnion<ClassTemplateDecl *,
1750 if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1751 Record.AddDeclRef(InstFromD);
1752 } else {
1753 Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1754 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1755 }
1756
1757 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1758 Record.AddSourceLocation(D->getPointOfInstantiation());
1759 Record.push_back(D->getSpecializationKind());
1760 Record.push_back(D->isCanonicalDecl());
1761
1762 if (D->isCanonicalDecl()) {
1763 // When reading, we'll add it to the folding set of the following template.
1765 }
1766
1767 // Explicit info.
1768 Record.AddTypeSourceInfo(D->getTypeAsWritten());
1769 if (D->getTypeAsWritten()) {
1770 Record.AddSourceLocation(D->getExternLoc());
1771 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1772 }
1773
1775}
1776
1779 Record.AddTemplateParameterList(D->getTemplateParameters());
1780 Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1781
1783
1784 // These are read/set from/to the first declaration.
1785 if (D->getPreviousDecl() == nullptr) {
1786 Record.AddDeclRef(D->getInstantiatedFromMember());
1787 Record.push_back(D->isMemberSpecialization());
1788 }
1789
1791}
1792
1795
1796 if (D->isFirstDecl())
1799}
1800
1804
1805 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1806 InstFrom = D->getSpecializedTemplateOrPartial();
1807 if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1808 Record.AddDeclRef(InstFromD);
1809 } else {
1810 Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1811 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1812 }
1813
1814 // Explicit info.
1815 Record.AddTypeSourceInfo(D->getTypeAsWritten());
1816 if (D->getTypeAsWritten()) {
1817 Record.AddSourceLocation(D->getExternLoc());
1818 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1819 }
1820
1821 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1822 Record.AddSourceLocation(D->getPointOfInstantiation());
1823 Record.push_back(D->getSpecializationKind());
1824 Record.push_back(D->IsCompleteDefinition);
1825
1826 VisitVarDecl(D);
1827
1828 Record.push_back(D->isCanonicalDecl());
1829
1830 if (D->isCanonicalDecl()) {
1831 // When reading, we'll add it to the folding set of the following template.
1833 }
1834
1836}
1837
1840 Record.AddTemplateParameterList(D->getTemplateParameters());
1841 Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1842
1844
1845 // These are read/set from/to the first declaration.
1846 if (D->getPreviousDecl() == nullptr) {
1847 Record.AddDeclRef(D->getInstantiatedFromMember());
1848 Record.push_back(D->isMemberSpecialization());
1849 }
1850
1852}
1853
1856
1857 if (D->isFirstDecl())
1860}
1861
1863 Record.push_back(D->hasTypeConstraint());
1864 VisitTypeDecl(D);
1865
1866 Record.push_back(D->wasDeclaredWithTypename());
1867
1868 const TypeConstraint *TC = D->getTypeConstraint();
1869 assert((bool)TC == D->hasTypeConstraint());
1870 if (TC) {
1871 auto *CR = TC->getConceptReference();
1872 Record.push_back(CR != nullptr);
1873 if (CR)
1874 Record.AddConceptReference(CR);
1876 Record.push_back(D->isExpandedParameterPack());
1877 if (D->isExpandedParameterPack())
1878 Record.push_back(D->getNumExpansionParameters());
1879 }
1880
1881 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1883 Record.push_back(OwnsDefaultArg);
1884 if (OwnsDefaultArg)
1885 Record.AddTypeSourceInfo(D->getDefaultArgumentInfo());
1886
1887 if (!TC && !OwnsDefaultArg &&
1889 !D->isInvalidDecl() && !D->hasAttrs() &&
1892 AbbrevToUse = Writer.getDeclTemplateTypeParmAbbrev();
1893
1895}
1896
1898 // For an expanded parameter pack, record the number of expansion types here
1899 // so that it's easier for deserialization to allocate the right amount of
1900 // memory.
1902 Record.push_back(!!TypeConstraint);
1903 if (D->isExpandedParameterPack())
1904 Record.push_back(D->getNumExpansionTypes());
1905
1907 // TemplateParmPosition.
1908 Record.push_back(D->getDepth());
1909 Record.push_back(D->getPosition());
1910 if (TypeConstraint)
1911 Record.AddStmt(TypeConstraint);
1912
1913 if (D->isExpandedParameterPack()) {
1914 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1915 Record.AddTypeRef(D->getExpansionType(I));
1916 Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
1917 }
1918
1920 } else {
1921 // Rest of NonTypeTemplateParmDecl.
1922 Record.push_back(D->isParameterPack());
1923 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1925 Record.push_back(OwnsDefaultArg);
1926 if (OwnsDefaultArg)
1927 Record.AddStmt(D->getDefaultArgument());
1929 }
1930}
1931
1933 // For an expanded parameter pack, record the number of expansion types here
1934 // so that it's easier for deserialization to allocate the right amount of
1935 // memory.
1936 if (D->isExpandedParameterPack())
1938
1940 Record.push_back(D->wasDeclaredWithTypename());
1941 // TemplateParmPosition.
1942 Record.push_back(D->getDepth());
1943 Record.push_back(D->getPosition());
1944
1945 if (D->isExpandedParameterPack()) {
1946 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1947 I != N; ++I)
1948 Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
1950 } else {
1951 // Rest of TemplateTemplateParmDecl.
1952 Record.push_back(D->isParameterPack());
1953 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1955 Record.push_back(OwnsDefaultArg);
1956 if (OwnsDefaultArg)
1957 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
1959 }
1960}
1961
1965}
1966
1968 VisitDecl(D);
1969 Record.AddStmt(D->getAssertExpr());
1970 Record.push_back(D->isFailed());
1971 Record.AddStmt(D->getMessage());
1972 Record.AddSourceLocation(D->getRParenLoc());
1974}
1975
1976/// Emit the DeclContext part of a declaration context decl.
1978 static_assert(DeclContext::NumDeclContextBits == 13,
1979 "You need to update the serializer after you change the "
1980 "DeclContextBits");
1981
1982 uint64_t LexicalOffset = 0;
1983 uint64_t VisibleOffset = 0;
1984
1985 if (Writer.isGeneratingReducedBMI() && isa<NamespaceDecl>(DC) &&
1986 cast<NamespaceDecl>(DC)->isFromExplicitGlobalModule()) {
1987 // In reduced BMI, delay writing lexical and visible block for namespace
1988 // in the global module fragment. See the comments of DelayedNamespace for
1989 // details.
1990 Writer.DelayedNamespace.push_back(cast<NamespaceDecl>(DC));
1991 } else {
1992 LexicalOffset = Writer.WriteDeclContextLexicalBlock(Context, DC);
1993 VisibleOffset = Writer.WriteDeclContextVisibleBlock(Context, DC);
1994 }
1995
1996 Record.AddOffset(LexicalOffset);
1997 Record.AddOffset(VisibleOffset);
1998}
1999
2001 assert(IsLocalDecl(D) && "expected a local declaration");
2002
2003 const Decl *Canon = D->getCanonicalDecl();
2004 if (IsLocalDecl(Canon))
2005 return Canon;
2006
2007 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
2008 if (CacheEntry)
2009 return CacheEntry;
2010
2011 for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
2012 if (IsLocalDecl(Redecl))
2013 D = Redecl;
2014 return CacheEntry = D;
2015}
2016
2017template <typename T>
2019 T *First = D->getFirstDecl();
2020 T *MostRecent = First->getMostRecentDecl();
2021 T *DAsT = static_cast<T *>(D);
2022 if (MostRecent != First) {
2023 assert(isRedeclarableDeclKind(DAsT->getKind()) &&
2024 "Not considered redeclarable?");
2025
2026 Record.AddDeclRef(First);
2027
2028 // Write out a list of local redeclarations of this declaration if it's the
2029 // first local declaration in the chain.
2030 const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
2031 if (DAsT == FirstLocal) {
2032 // Emit a list of all imported first declarations so that we can be sure
2033 // that all redeclarations visible to this module are before D in the
2034 // redecl chain.
2035 unsigned I = Record.size();
2036 Record.push_back(0);
2037 if (Writer.Chain)
2038 AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
2039 // This is the number of imported first declarations + 1.
2040 Record[I] = Record.size() - I;
2041
2042 // Collect the set of local redeclarations of this declaration, from
2043 // newest to oldest.
2044 ASTWriter::RecordData LocalRedecls;
2045 ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
2046 for (const Decl *Prev = FirstLocal->getMostRecentDecl();
2047 Prev != FirstLocal; Prev = Prev->getPreviousDecl())
2048 if (!Prev->isFromASTFile())
2049 LocalRedeclWriter.AddDeclRef(Prev);
2050
2051 // If we have any redecls, write them now as a separate record preceding
2052 // the declaration itself.
2053 if (LocalRedecls.empty())
2054 Record.push_back(0);
2055 else
2056 Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
2057 } else {
2058 Record.push_back(0);
2059 Record.AddDeclRef(FirstLocal);
2060 }
2061
2062 // Make sure that we serialize both the previous and the most-recent
2063 // declarations, which (transitively) ensures that all declarations in the
2064 // chain get serialized.
2065 //
2066 // FIXME: This is not correct; when we reach an imported declaration we
2067 // won't emit its previous declaration.
2068 (void)Writer.GetDeclRef(D->getPreviousDecl());
2069 (void)Writer.GetDeclRef(MostRecent);
2070 } else {
2071 // We use the sentinel value 0 to indicate an only declaration.
2072 Record.push_back(0);
2073 }
2074}
2075
2077 VisitNamedDecl(D);
2079 Record.push_back(D->isCBuffer());
2080 Record.AddSourceLocation(D->getLocStart());
2081 Record.AddSourceLocation(D->getLBraceLoc());
2082 Record.AddSourceLocation(D->getRBraceLoc());
2083
2085}
2086
2088 Record.writeOMPChildren(D->Data);
2089 VisitDecl(D);
2091}
2092
2094 Record.writeOMPChildren(D->Data);
2095 VisitDecl(D);
2097}
2098
2100 Record.writeOMPChildren(D->Data);
2101 VisitDecl(D);
2103}
2104
2106 static_assert(DeclContext::NumOMPDeclareReductionDeclBits == 15,
2107 "You need to update the serializer after you change the "
2108 "NumOMPDeclareReductionDeclBits");
2109
2110 VisitValueDecl(D);
2111 Record.AddSourceLocation(D->getBeginLoc());
2112 Record.AddStmt(D->getCombinerIn());
2113 Record.AddStmt(D->getCombinerOut());
2114 Record.AddStmt(D->getCombiner());
2115 Record.AddStmt(D->getInitOrig());
2116 Record.AddStmt(D->getInitPriv());
2117 Record.AddStmt(D->getInitializer());
2118 Record.push_back(llvm::to_underlying(D->getInitializerKind()));
2119 Record.AddDeclRef(D->getPrevDeclInScope());
2121}
2122
2124 Record.writeOMPChildren(D->Data);
2125 VisitValueDecl(D);
2126 Record.AddDeclarationName(D->getVarName());
2127 Record.AddDeclRef(D->getPrevDeclInScope());
2129}
2130
2132 VisitVarDecl(D);
2134}
2135
2136//===----------------------------------------------------------------------===//
2137// ASTWriter Implementation
2138//===----------------------------------------------------------------------===//
2139
2140namespace {
2141template <FunctionDecl::TemplatedKind Kind>
2142std::shared_ptr<llvm::BitCodeAbbrev>
2143getFunctionDeclAbbrev(serialization::DeclCode Code) {
2144 using namespace llvm;
2145
2146 auto Abv = std::make_shared<BitCodeAbbrev>();
2147 Abv->Add(BitCodeAbbrevOp(Code));
2148 // RedeclarableDecl
2149 Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2150 Abv->Add(BitCodeAbbrevOp(Kind));
2151 if constexpr (Kind == FunctionDecl::TK_NonTemplate) {
2152
2153 } else if constexpr (Kind == FunctionDecl::TK_FunctionTemplate) {
2154 // DescribedFunctionTemplate
2155 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2156 } else if constexpr (Kind == FunctionDecl::TK_DependentNonTemplate) {
2157 // Instantiated From Decl
2158 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2159 } else if constexpr (Kind == FunctionDecl::TK_MemberSpecialization) {
2160 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedFrom
2161 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2162 3)); // TemplateSpecializationKind
2163 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Specialized Location
2164 } else if constexpr (Kind ==
2166 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template
2167 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2168 3)); // TemplateSpecializationKind
2169 Abv->Add(BitCodeAbbrevOp(1)); // Template Argument Size
2170 Abv->Add(BitCodeAbbrevOp(TemplateArgument::Type)); // Template Argument Kind
2171 Abv->Add(
2172 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template Argument Type
2173 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Is Defaulted
2174 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2175 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2176 Abv->Add(BitCodeAbbrevOp(0));
2177 Abv->Add(
2178 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Canonical Decl of template
2179 } else if constexpr (Kind == FunctionDecl::
2181 // Candidates of specialization
2182 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2183 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2184 } else {
2185 llvm_unreachable("Unknown templated kind?");
2186 }
2187 // Decl
2188 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2189 8)); // Packed DeclBits: ModuleOwnershipKind,
2190 // isUsed, isReferenced, AccessSpecifier,
2191 // isImplicit
2192 //
2193 // The following bits should be 0:
2194 // HasStandaloneLexicalDC, HasAttrs,
2195 // TopLevelDeclInObjCContainer,
2196 // isInvalidDecl
2197 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2198 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2199 // NamedDecl
2200 Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2201 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2202 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2203 // ValueDecl
2204 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2205 // DeclaratorDecl
2206 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2207 Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2208 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2209 // FunctionDecl
2210 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2211 Abv->Add(BitCodeAbbrevOp(
2212 BitCodeAbbrevOp::Fixed,
2213 28)); // Packed Function Bits: StorageClass, Inline, InlineSpecified,
2214 // VirtualAsWritten, Pure, HasInheritedProto, HasWrittenProto,
2215 // Deleted, Trivial, TrivialForCall, Defaulted, ExplicitlyDefaulted,
2216 // IsIneligibleOrNotSelected, ImplicitReturnZero, Constexpr,
2217 // UsesSEHTry, SkippedBody, MultiVersion, LateParsed,
2218 // FriendConstraintRefersToEnclosingTemplate, Linkage,
2219 // ShouldSkipCheckingODR
2220 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2221 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2222 // This Array slurps the rest of the record. Fortunately we want to encode
2223 // (nearly) all the remaining (variable number of) fields in the same way.
2224 //
2225 // This is:
2226 // NumParams and Params[] from FunctionDecl, and
2227 // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2228 //
2229 // Add an AbbrevOp for 'size then elements' and use it here.
2230 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2231 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2232 return Abv;
2233}
2234
2235template <FunctionDecl::TemplatedKind Kind>
2236std::shared_ptr<llvm::BitCodeAbbrev> getCXXMethodAbbrev() {
2237 return getFunctionDeclAbbrev<Kind>(serialization::DECL_CXX_METHOD);
2238}
2239} // namespace
2240
2241void ASTWriter::WriteDeclAbbrevs() {
2242 using namespace llvm;
2243
2244 std::shared_ptr<BitCodeAbbrev> Abv;
2245
2246 // Abbreviation for DECL_FIELD
2247 Abv = std::make_shared<BitCodeAbbrev>();
2248 Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
2249 // Decl
2250 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2251 7)); // Packed DeclBits: ModuleOwnershipKind,
2252 // isUsed, isReferenced, AccessSpecifier,
2253 //
2254 // The following bits should be 0:
2255 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2256 // TopLevelDeclInObjCContainer,
2257 // isInvalidDecl
2258 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2259 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2260 // NamedDecl
2261 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2262 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2263 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2264 // ValueDecl
2265 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2266 // DeclaratorDecl
2267 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2268 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2269 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2270 // FieldDecl
2271 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2272 Abv->Add(BitCodeAbbrevOp(0)); // StorageKind
2273 // Type Source Info
2274 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2275 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2276 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
2277
2278 // Abbreviation for DECL_OBJC_IVAR
2279 Abv = std::make_shared<BitCodeAbbrev>();
2280 Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
2281 // Decl
2282 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2283 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2284 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2285 // isReferenced, TopLevelDeclInObjCContainer,
2286 // AccessSpecifier, ModuleOwnershipKind
2287 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2288 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2289 // NamedDecl
2290 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2291 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2292 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2293 // ValueDecl
2294 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2295 // DeclaratorDecl
2296 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2297 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2298 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2299 // FieldDecl
2300 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2301 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2302 // ObjC Ivar
2303 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
2304 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
2305 // Type Source Info
2306 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2307 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2308 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2309
2310 // Abbreviation for DECL_ENUM
2311 Abv = std::make_shared<BitCodeAbbrev>();
2312 Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
2313 // Redeclarable
2314 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2315 // Decl
2316 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2317 7)); // Packed DeclBits: ModuleOwnershipKind,
2318 // isUsed, isReferenced, AccessSpecifier,
2319 //
2320 // The following bits should be 0:
2321 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2322 // TopLevelDeclInObjCContainer,
2323 // isInvalidDecl
2324 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2325 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2326 // NamedDecl
2327 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2328 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2329 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2330 // TypeDecl
2331 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2332 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2333 // TagDecl
2334 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2335 Abv->Add(BitCodeAbbrevOp(
2336 BitCodeAbbrevOp::Fixed,
2337 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2338 // EmbeddedInDeclarator, IsFreeStanding,
2339 // isCompleteDefinitionRequired, ExtInfoKind
2340 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2341 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2342 // EnumDecl
2343 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
2344 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
2345 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
2346 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 20)); // Enum Decl Bits
2347 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
2348 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
2349 // DC
2350 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2351 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2352 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2353
2354 // Abbreviation for DECL_RECORD
2355 Abv = std::make_shared<BitCodeAbbrev>();
2356 Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
2357 // Redeclarable
2358 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2359 // Decl
2360 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2361 7)); // Packed DeclBits: ModuleOwnershipKind,
2362 // isUsed, isReferenced, AccessSpecifier,
2363 //
2364 // The following bits should be 0:
2365 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2366 // TopLevelDeclInObjCContainer,
2367 // isInvalidDecl
2368 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2369 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2370 // NamedDecl
2371 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2372 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2373 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2374 // TypeDecl
2375 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2376 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2377 // TagDecl
2378 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2379 Abv->Add(BitCodeAbbrevOp(
2380 BitCodeAbbrevOp::Fixed,
2381 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2382 // EmbeddedInDeclarator, IsFreeStanding,
2383 // isCompleteDefinitionRequired, ExtInfoKind
2384 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2385 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2386 // RecordDecl
2387 Abv->Add(BitCodeAbbrevOp(
2388 BitCodeAbbrevOp::Fixed,
2389 13)); // Packed Record Decl Bits: FlexibleArrayMember,
2390 // AnonymousStructUnion, hasObjectMember, hasVolatileMember,
2391 // isNonTrivialToPrimitiveDefaultInitialize,
2392 // isNonTrivialToPrimitiveCopy, isNonTrivialToPrimitiveDestroy,
2393 // hasNonTrivialToPrimitiveDefaultInitializeCUnion,
2394 // hasNonTrivialToPrimitiveDestructCUnion,
2395 // hasNonTrivialToPrimitiveCopyCUnion, isParamDestroyedInCallee,
2396 // getArgPassingRestrictions
2397 // ODRHash
2398 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));
2399
2400 // DC
2401 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2402 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2403 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2404
2405 // Abbreviation for DECL_PARM_VAR
2406 Abv = std::make_shared<BitCodeAbbrev>();
2407 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2408 // Redeclarable
2409 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2410 // Decl
2411 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2412 8)); // Packed DeclBits: ModuleOwnershipKind, isUsed,
2413 // isReferenced, AccessSpecifier,
2414 // HasStandaloneLexicalDC, HasAttrs, isImplicit,
2415 // TopLevelDeclInObjCContainer,
2416 // isInvalidDecl,
2417 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2418 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2419 // NamedDecl
2420 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2421 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2422 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2423 // ValueDecl
2424 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2425 // DeclaratorDecl
2426 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2427 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2428 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2429 // VarDecl
2430 Abv->Add(
2431 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2432 12)); // Packed Var Decl bits: SClass, TSCSpec, InitStyle,
2433 // isARCPseudoStrong, Linkage, ModulesCodegen
2434 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2435 // ParmVarDecl
2436 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2437 Abv->Add(BitCodeAbbrevOp(
2438 BitCodeAbbrevOp::Fixed,
2439 19)); // Packed Parm Var Decl bits: IsObjCMethodParameter, ScopeDepth,
2440 // ObjCDeclQualifier, KNRPromoted,
2441 // HasInheritedDefaultArg, HasUninstantiatedDefaultArg
2442 // Type Source Info
2443 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2444 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2445 DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2446
2447 // Abbreviation for DECL_TYPEDEF
2448 Abv = std::make_shared<BitCodeAbbrev>();
2449 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2450 // Redeclarable
2451 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2452 // Decl
2453 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2454 7)); // Packed DeclBits: ModuleOwnershipKind,
2455 // isReferenced, isUsed, AccessSpecifier. Other
2456 // higher bits should be 0: isImplicit,
2457 // HasStandaloneLexicalDC, HasAttrs,
2458 // TopLevelDeclInObjCContainer, isInvalidDecl
2459 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2460 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2461 // NamedDecl
2462 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2463 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2464 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2465 // TypeDecl
2466 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2467 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2468 // TypedefDecl
2469 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2470 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2471 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2472
2473 // Abbreviation for DECL_VAR
2474 Abv = std::make_shared<BitCodeAbbrev>();
2475 Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2476 // Redeclarable
2477 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2478 // Decl
2479 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2480 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2481 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2482 // isReferenced, TopLevelDeclInObjCContainer,
2483 // AccessSpecifier, ModuleOwnershipKind
2484 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2485 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2486 // NamedDecl
2487 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2488 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2489 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2490 // ValueDecl
2491 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2492 // DeclaratorDecl
2493 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2494 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2495 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2496 // VarDecl
2497 Abv->Add(BitCodeAbbrevOp(
2498 BitCodeAbbrevOp::Fixed,
2499 21)); // Packed Var Decl bits: Linkage, ModulesCodegen,
2500 // SClass, TSCSpec, InitStyle,
2501 // isARCPseudoStrong, IsThisDeclarationADemotedDefinition,
2502 // isExceptionVariable, isNRVOVariable, isCXXForRangeDecl,
2503 // isInline, isInlineSpecified, isConstexpr,
2504 // isInitCapture, isPrevDeclInSameScope,
2505 // EscapingByref, HasDeducedType, ImplicitParamKind, isObjCForDecl
2506 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2507 // Type Source Info
2508 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2509 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2510 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2511
2512 // Abbreviation for DECL_CXX_METHOD
2513 DeclCXXMethodAbbrev =
2514 Stream.EmitAbbrev(getCXXMethodAbbrev<FunctionDecl::TK_NonTemplate>());
2515 DeclTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2516 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplate>());
2517 DeclDependentNonTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2518 getCXXMethodAbbrev<FunctionDecl::TK_DependentNonTemplate>());
2519 DeclMemberSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2520 getCXXMethodAbbrev<FunctionDecl::TK_MemberSpecialization>());
2521 DeclTemplateSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2522 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplateSpecialization>());
2523 DeclDependentSpecializationCXXMethodAbbrev = Stream.EmitAbbrev(
2524 getCXXMethodAbbrev<
2526
2527 // Abbreviation for DECL_TEMPLATE_TYPE_PARM
2528 Abv = std::make_shared<BitCodeAbbrev>();
2529 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TEMPLATE_TYPE_PARM));
2530 Abv->Add(BitCodeAbbrevOp(0)); // hasTypeConstraint
2531 // Decl
2532 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2533 7)); // Packed DeclBits: ModuleOwnershipKind,
2534 // isReferenced, isUsed, AccessSpecifier. Other
2535 // higher bits should be 0: isImplicit,
2536 // HasStandaloneLexicalDC, HasAttrs,
2537 // TopLevelDeclInObjCContainer, isInvalidDecl
2538 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2539 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2540 // NamedDecl
2541 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2542 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2543 Abv->Add(BitCodeAbbrevOp(0));
2544 // TypeDecl
2545 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2546 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2547 // TemplateTypeParmDecl
2548 Abv->Add(
2549 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // wasDeclaredWithTypename
2550 Abv->Add(BitCodeAbbrevOp(0)); // OwnsDefaultArg
2551 DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));
2552
2553 // Abbreviation for DECL_USING_SHADOW
2554 Abv = std::make_shared<BitCodeAbbrev>();
2555 Abv->Add(BitCodeAbbrevOp(serialization::DECL_USING_SHADOW));
2556 // Redeclarable
2557 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2558 // Decl
2559 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2560 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2561 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2562 // isReferenced, TopLevelDeclInObjCContainer,
2563 // AccessSpecifier, ModuleOwnershipKind
2564 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2565 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2566 // NamedDecl
2567 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2568 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2569 Abv->Add(BitCodeAbbrevOp(0));
2570 // UsingShadowDecl
2571 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TargetDecl
2572 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2573 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // UsingOrNextShadow
2574 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR,
2575 6)); // InstantiatedFromUsingShadowDecl
2576 DeclUsingShadowAbbrev = Stream.EmitAbbrev(std::move(Abv));
2577
2578 // Abbreviation for EXPR_DECL_REF
2579 Abv = std::make_shared<BitCodeAbbrev>();
2580 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2581 // Stmt
2582 // Expr
2583 // PackingBits: DependenceKind, ValueKind. ObjectKind should be 0.
2584 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
2585 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2586 // DeclRefExpr
2587 // Packing Bits: , HadMultipleCandidates, RefersToEnclosingVariableOrCapture,
2588 // IsImmediateEscalating, NonOdrUseReason.
2589 // GetDeclFound, HasQualifier and ExplicitTemplateArgs should be 0.
2590 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2591 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2592 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2593 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2594
2595 // Abbreviation for EXPR_INTEGER_LITERAL
2596 Abv = std::make_shared<BitCodeAbbrev>();
2597 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2598 //Stmt
2599 // Expr
2600 // DependenceKind, ValueKind, ObjectKind
2601 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2602 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2603 // Integer Literal
2604 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2605 Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2606 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2607 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2608
2609 // Abbreviation for EXPR_CHARACTER_LITERAL
2610 Abv = std::make_shared<BitCodeAbbrev>();
2611 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2612 //Stmt
2613 // Expr
2614 // DependenceKind, ValueKind, ObjectKind
2615 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2616 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2617 // Character Literal
2618 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2619 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2620 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2621 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2622
2623 // Abbreviation for EXPR_IMPLICIT_CAST
2624 Abv = std::make_shared<BitCodeAbbrev>();
2625 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2626 // Stmt
2627 // Expr
2628 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2629 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2630 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2631 // CastExpr
2632 Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2633 // Packing Bits: CastKind, StoredFPFeatures, isPartOfExplicitCast
2634 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 9));
2635 // ImplicitCastExpr
2636 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2637
2638 // Abbreviation for EXPR_BINARY_OPERATOR
2639 Abv = std::make_shared<BitCodeAbbrev>();
2640 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_BINARY_OPERATOR));
2641 // Stmt
2642 // Expr
2643 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2644 // be 0 in this case.
2645 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2646 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2647 // BinaryOperator
2648 Abv->Add(
2649 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2650 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2651 BinaryOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2652
2653 // Abbreviation for EXPR_COMPOUND_ASSIGN_OPERATOR
2654 Abv = std::make_shared<BitCodeAbbrev>();
2655 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_COMPOUND_ASSIGN_OPERATOR));
2656 // Stmt
2657 // Expr
2658 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2659 // be 0 in this case.
2660 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2661 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2662 // BinaryOperator
2663 // Packing Bits: OpCode. The HasFPFeatures bit should be 0
2664 Abv->Add(
2665 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2666 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2667 // CompoundAssignOperator
2668 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHSType
2669 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Result Type
2670 CompoundAssignOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2671
2672 // Abbreviation for EXPR_CALL
2673 Abv = std::make_shared<BitCodeAbbrev>();
2674 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CALL));
2675 // Stmt
2676 // Expr
2677 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2678 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2679 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2680 // CallExpr
2681 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2682 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2683 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2684 CallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2685
2686 // Abbreviation for EXPR_CXX_OPERATOR_CALL
2687 Abv = std::make_shared<BitCodeAbbrev>();
2688 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_OPERATOR_CALL));
2689 // Stmt
2690 // Expr
2691 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2692 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2693 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2694 // CallExpr
2695 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2696 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2697 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2698 // CXXOperatorCallExpr
2699 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Operator Kind
2700 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2701 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2702 CXXOperatorCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2703
2704 // Abbreviation for EXPR_CXX_MEMBER_CALL
2705 Abv = std::make_shared<BitCodeAbbrev>();
2706 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_MEMBER_CALL));
2707 // Stmt
2708 // Expr
2709 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2710 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2711 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2712 // CallExpr
2713 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2714 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2715 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2716 // CXXMemberCallExpr
2717 CXXMemberCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2718
2719 // Abbreviation for STMT_COMPOUND
2720 Abv = std::make_shared<BitCodeAbbrev>();
2721 Abv->Add(BitCodeAbbrevOp(serialization::STMT_COMPOUND));
2722 // Stmt
2723 // CompoundStmt
2724 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Num Stmts
2725 Abv->Add(BitCodeAbbrevOp(0)); // hasStoredFPFeatures
2726 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2727 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2728 CompoundStmtAbbrev = Stream.EmitAbbrev(std::move(Abv));
2729
2730 Abv = std::make_shared<BitCodeAbbrev>();
2731 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2732 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2733 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2734
2735 Abv = std::make_shared<BitCodeAbbrev>();
2736 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2737 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2738 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2739}
2740
2741/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2742/// consumers of the AST.
2743///
2744/// Such decls will always be deserialized from the AST file, so we would like
2745/// this to be as restrictive as possible. Currently the predicate is driven by
2746/// code generation requirements, if other clients have a different notion of
2747/// what is "required" then we may have to consider an alternate scheme where
2748/// clients can iterate over the top-level decls and get information on them,
2749/// without necessary deserializing them. We could explicitly require such
2750/// clients to use a separate API call to "realize" the decl. This should be
2751/// relatively painless since they would presumably only do it for top-level
2752/// decls.
2753static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2754 Module *WritingModule) {
2755 // Named modules have different semantics than header modules. Every named
2756 // module units owns a translation unit. So the importer of named modules
2757 // doesn't need to deserilize everything ahead of time.
2758 if (WritingModule && WritingModule->isNamedModule()) {
2759 // The PragmaCommentDecl and PragmaDetectMismatchDecl are MSVC's extension.
2760 // And the behavior of MSVC for such cases will leak this to the module
2761 // users. Given pragma is not a standard thing, the compiler has the space
2762 // to do their own decision. Let's follow MSVC here.
2763 if (isa<PragmaCommentDecl, PragmaDetectMismatchDecl>(D))
2764 return true;
2765 return false;
2766 }
2767
2768 // An ObjCMethodDecl is never considered as "required" because its
2769 // implementation container always is.
2770
2771 // File scoped assembly or obj-c or OMP declare target implementation must be
2772 // seen.
2773 if (isa<FileScopeAsmDecl, TopLevelStmtDecl, ObjCImplDecl>(D))
2774 return true;
2775
2776 if (WritingModule && isPartOfPerModuleInitializer(D)) {
2777 // These declarations are part of the module initializer, and are emitted
2778 // if and when the module is imported, rather than being emitted eagerly.
2779 return false;
2780 }
2781
2782 return Context.DeclMustBeEmitted(D);
2783}
2784
2785void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2786 PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
2787 "serializing");
2788
2789 // Determine the ID for this declaration.
2791 assert(!D->isFromASTFile() && "should not be emitting imported decl");
2792 serialization::DeclID &IDR = DeclIDs[D];
2793 if (IDR == 0)
2794 IDR = NextDeclID++;
2795
2796 ID = IDR;
2797
2798 assert(ID >= FirstDeclID && "invalid decl ID");
2799
2801 ASTDeclWriter W(*this, Context, Record, GeneratingReducedBMI);
2802
2803 // Build a record for this declaration
2804 W.Visit(D);
2805
2806 // Emit this declaration to the bitstream.
2807 uint64_t Offset = W.Emit(D);
2808
2809 // Record the offset for this declaration
2810 SourceLocation Loc = D->getLocation();
2811 unsigned Index = ID - FirstDeclID;
2812 if (DeclOffsets.size() == Index)
2813 DeclOffsets.emplace_back(getAdjustedLocation(Loc), Offset,
2814 DeclTypesBlockStartOffset);
2815 else if (DeclOffsets.size() < Index) {
2816 // FIXME: Can/should this happen?
2817 DeclOffsets.resize(Index+1);
2818 DeclOffsets[Index].setLocation(getAdjustedLocation(Loc));
2819 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);
2820 } else {
2821 llvm_unreachable("declarations should be emitted in ID order");
2822 }
2823
2824 SourceManager &SM = Context.getSourceManager();
2825 if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2826 associateDeclWithFile(D, ID);
2827
2828 // Note declarations that should be deserialized eagerly so that we can add
2829 // them to a record in the AST file later.
2830 if (isRequiredDecl(D, Context, WritingModule))
2831 EagerlyDeserializedDecls.push_back(ID);
2832}
2833
2835 // Switch case IDs are per function body.
2836 Writer->ClearSwitchCaseIDs();
2837
2838 assert(FD->doesThisDeclarationHaveABody());
2839 bool ModulesCodegen = false;
2840 if (!FD->isDependentContext()) {
2841 std::optional<GVALinkage> Linkage;
2842 if (Writer->WritingModule &&
2843 Writer->WritingModule->isInterfaceOrPartition()) {
2844 // When building a C++20 module interface unit or a partition unit, a
2845 // strong definition in the module interface is provided by the
2846 // compilation of that unit, not by its users. (Inline functions are still
2847 // emitted in module users.)
2848 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2849 ModulesCodegen = *Linkage >= GVA_StrongExternal;
2850 }
2851 if (Writer->Context->getLangOpts().ModulesCodegen ||
2852 (FD->hasAttr<DLLExportAttr>() &&
2853 Writer->Context->getLangOpts().BuildingPCHWithObjectFile)) {
2854
2855 // Under -fmodules-codegen, codegen is performed for all non-internal,
2856 // non-always_inline functions, unless they are available elsewhere.
2857 if (!FD->hasAttr<AlwaysInlineAttr>()) {
2858 if (!Linkage)
2859 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2860 ModulesCodegen =
2862 }
2863 }
2864 }
2865 Record->push_back(ModulesCodegen);
2866 if (ModulesCodegen)
2867 Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(FD));
2868 if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2869 Record->push_back(CD->getNumCtorInitializers());
2870 if (CD->getNumCtorInitializers())
2871 AddCXXCtorInitializers(llvm::ArrayRef(CD->init_begin(), CD->init_end()));
2872 }
2873 AddStmt(FD->getBody());
2874}
NodeId Parent
Definition: ASTDiff.cpp:191
StringRef P
static void addExplicitSpecifier(ExplicitSpecifier ES, ASTRecordWriter &Record)
static bool isRequiredDecl(const Decl *D, ASTContext &Context, Module *WritingModule)
isRequiredDecl - Check if this is a "required" Decl, which must be seen by consumers of the AST.
#define SM(sm)
Definition: Cuda.cpp:82
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
llvm::MachO::Record Record
Definition: MachO.h:30
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes,...
This file defines OpenMP AST classes for clauses.
Defines the SourceManager interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
SourceManager & getSourceManager()
Definition: ASTContext.h:705
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
DeclarationNameTable DeclarationNames
Definition: ASTContext.h:648
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:775
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:1187
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)
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context, ASTWriter::RecordDataImpl &Record, bool GeneratingReducedBMI)
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 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 *)
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:7694
An object for streaming information to a record.
void AddFunctionDefinition(const FunctionDecl *FD)
Add a definition for the given function to the queue of statements to emit.
uint64_t Emit(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, followed by its substatements, and return its offset.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
void AddCXXCtorInitializers(ArrayRef< CXXCtorInitializer * > CtorInits)
Emit a CXXCtorInitializer array.
Definition: ASTWriter.cpp:6179
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:86
unsigned getDeclParmVarAbbrev() const
Definition: ASTWriter.h:771
unsigned getDeclTemplateTypeParmAbbrev() const
Definition: ASTWriter.h:795
unsigned getDeclObjCIvarAbbrev() const
Definition: ASTWriter.h:777
serialization::DeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its ID.
Definition: ASTWriter.cpp:5856
unsigned getDeclTypedefAbbrev() const
Definition: ASTWriter.h:773
bool hasChain() const
Definition: ASTWriter.h:814
unsigned getDeclUsingShadowAbbrev() const
Definition: ASTWriter.h:798
bool isGeneratingReducedBMI() const
Definition: ASTWriter.h:821
unsigned getDeclVarAbbrev() const
Definition: ASTWriter.h:774
unsigned getDeclEnumAbbrev() const
Definition: ASTWriter.h:776
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:700
unsigned getDeclCXXMethodAbbrev(FunctionDecl::TemplatedKind Kind) const
Definition: ASTWriter.h:778
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:5951
unsigned getDeclFieldAbbrev() const
Definition: ASTWriter.h:775
unsigned getDeclRecordAbbrev() const
Definition: ASTWriter.h:772
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:4104
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:4128
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition: ASTWriter.h:936
void addBit(bool Value)
Definition: ASTWriter.h:956
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition: ASTWriter.h:957
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4495
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition: Decl.h:4618
bool canAvoidCopyToHeap() const
Definition: Decl.h:4649
size_t param_size() const
Definition: Decl.h:4597
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:4574
ArrayRef< Capture > captures() const
Definition: Decl.h:4622
bool blockMissingReturnType() const
Definition: Decl.h:4630
bool capturesCXXThis() const
Definition: Decl.h:4627
bool doesNotEscape() const
Definition: Decl.h:4646
bool isConversionFromLambda() const
Definition: Decl.h:4638
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:4581
bool isVariadic() const
Definition: Decl.h:4570
TypeSourceInfo * getSignatureAsWritten() const
Definition: Decl.h:4578
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2532
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2603
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2769
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2859
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2886
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:1951
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:1985
DeductionCandidate getDeductionCandidateKind() const
Definition: DeclCXX.h:2004
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2796
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2829
Expr * getOperatorDeleteThisArg() const
Definition: DeclCXX.h:2833
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2057
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:2160
overridden_method_range overridden_methods() const
Definition: DeclCXX.cpp:2532
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:2526
Represents a C++ struct/union/class.
Definition: DeclCXX.h:258
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
Definition: DeclCXX.cpp:1684
unsigned getLambdaIndexInContext() const
Retrieve the index of this lambda within the context declaration returned by getLambdaContextDecl().
Definition: DeclCXX.h:1791
bool isLambda() const
Determine whether this class describes a lambda function object.
Definition: DeclCXX.h:1021
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1896
static bool classofKind(Kind K)
Definition: DeclCXX.h:1888
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Definition: DeclCXX.cpp:1882
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:531
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4687
unsigned getNumParams() const
Definition: Decl.h:4729
unsigned getContextParamPosition() const
Definition: Decl.h:4758
bool isNothrow() const
Definition: Decl.cpp:5437
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4731
Declaration of a class template.
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a class template specialization, which refers to a class template with a given set of temp...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3595
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:1445
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:2075
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:1269
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1925
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
Definition: DeclBase.cpp:1854
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1359
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:85
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
Definition: DeclBase.h:1060
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition: DeclBase.h:1075
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:440
bool hasAttrs() const
Definition: DeclBase.h:523
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:598
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:875
bool isReferenced() const
Whether any declaration of this entity was referenced.
Definition: DeclBase.cpp:555
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:983
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:842
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:785
bool isInvalidDecl() const
Definition: DeclBase.h:593
unsigned getIdentifierNamespace() const
Definition: DeclBase.h:888
SourceLocation getLocation() const
Definition: DeclBase.h:444
bool shouldSkipCheckingODR() const
Check if we should skip checking ODRHash for declaration.
Definition: DeclBase.cpp:1109
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:633
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
Definition: DeclBase.cpp:530
DeclContext * getDeclContext()
Definition: DeclBase.h:453
AccessSpecifier getAccess() const
Definition: DeclBase.h:512
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclBase.h:436
AttrVec & getAttrs()
Definition: DeclBase.h:529
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition: DeclBase.h:917
bool hasAttr() const
Definition: DeclBase.h:582
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:977
Kind getKind() const
Definition: DeclBase.h:447
DeclarationName getCXXDeductionGuideName(TemplateDecl *TD)
Returns the name of a C++ deduction guide for the given template.
NameKind getNameKind() const
Determine what kind of name this is.
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:770
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
Definition: Decl.h:813
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:799
A decomposition declaration.
Definition: DeclCXX.h:4163
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:4195
Provides information about a dependent function-template specialization declaration.
Definition: DeclTemplate.h:690
ArrayRef< FunctionTemplateDecl * > getCandidates() const
Returns the candidates for the primary function template.
Definition: DeclTemplate.h:709
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:702
Represents an empty-declaration.
Definition: Decl.h:4926
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3298
llvm::APSInt getInitVal() const
Definition: Decl.h:3318
const Expr * getInitExpr() const
Definition: Decl.h:3316
Represents an enum.
Definition: Decl.h:3868
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
Definition: Decl.h:4127
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:4073
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:4065
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:4076
unsigned getODRHash()
Definition: Decl.cpp:4953
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
Definition: Decl.h:4044
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3964
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:4082
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:4028
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum.
Definition: Decl.h:4054
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition: Decl.h:4020
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1896
ExplicitSpecKind getKind() const
Definition: DeclCXX.h:1904
const Expr * getExpr() const
Definition: DeclCXX.h:1905
Represents a standard C++ module export declaration.
Definition: Decl.h:4879
SourceLocation getRBraceLoc() const
Definition: Decl.h:4898
This represents one expression.
Definition: Expr.h:110
Represents a member of a struct/union/class.
Definition: Decl.h:3058
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:3146
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:3219
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition: Decl.h:3254
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
Definition: Decl.h:3162
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition: Decl.h:3259
const StringLiteral * getAsmString() const
Definition: Decl.h:4445
SourceLocation getRParenLoc() const
Definition: Decl.h:4439
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:130
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Definition: DeclFriend.h:137
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:122
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:1971
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition: Decl.h:2600
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:3236
bool isTrivialForCall() const
Definition: Decl.h:2343
ConstexprSpecKind getConstexprKind() const
Definition: Decl.h:2439
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:4042
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition: Decl.h:2831
SourceLocation getDefaultLoc() const
Definition: Decl.h:2361
bool usesSEHTry() const
Indicates the function uses __try.
Definition: Decl.h:2481
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2684
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted.
Definition: Decl.h:2352
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2340
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition: Decl.h:2411
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
Definition: Decl.cpp:4021
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:4172
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:2296
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition: Decl.cpp:4239
unsigned getODRHash()
Returns ODRHash of the function.
Definition: Decl.cpp:4526
@ TK_MemberSpecialization
Definition: Decl.h:1983
@ TK_DependentNonTemplate
Definition: Decl.h:1992
@ TK_FunctionTemplateSpecialization
Definition: Decl.h:1987
@ TK_DependentFunctionTemplateSpecialization
Definition: Decl.h:1990
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2798
bool FriendConstraintRefersToEnclosingTemplate() const
Definition: Decl.h:2618
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3993
bool isDeletedAsWritten() const
Definition: Decl.h:2507
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2323
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition: Decl.h:2327
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition: Decl.h:2391
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition: Decl.h:2590
bool isDefaulted() const
Whether this function is defaulted.
Definition: Decl.h:2348
bool isIneligibleOrNotSelected() const
Definition: Decl.h:2381
FunctionDecl * getInstantiatedFromDecl() const
Definition: Decl.cpp:4066
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2314
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:2422
size_t param_size() const
Definition: Decl.h:2700
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2809
DefaultedOrDeletedFunctionInfo * getDefalutedOrDeletedInfo() const
Definition: Decl.cpp:3151
Declaration of a template function.
Definition: DeclTemplate.h:958
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:467
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:481
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:523
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:
Definition: DeclTemplate.h:594
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:485
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:554
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:526
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition: Decl.h:4941
bool isCBuffer() const
Definition: Decl.h:4969
SourceLocation getLBraceLoc() const
Definition: Decl.h:4966
SourceLocation getLocStart() const LLVM_READONLY
Definition: Decl.h:4965
SourceLocation getRBraceLoc() const
Definition: Decl.h:4967
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4800
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:5721
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4858
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3342
unsigned getChainingSize() const
Definition: Decl.h:3370
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:3364
Represents the declaration of a label.
Definition: Decl.h:499
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition: DeclCXX.h:3226
unsigned getManglingNumber() const
Definition: DeclCXX.h:3275
Expr * getTemporaryExpr()
Retrieve the expression to which the temporary materialization conversion was applied.
Definition: DeclCXX.h:3272
Represents a linkage specification.
Definition: DeclCXX.h:2931
LinkageSpecLanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2954
SourceLocation getExternLoc() const
Definition: DeclCXX.h:2970
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:2971
A global _GUID constant.
Definition: DeclCXX.h:4286
Parts getParts() const
Get the decomposed parts of this declaration.
Definition: DeclCXX.h:4316
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:4232
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:4254
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:4256
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:616
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:638
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:656
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:635
Describes a module or submodule.
Definition: Module.h:105
bool isInterfaceOrPartition() const
Definition: Module.h:614
bool isNamedModule() const
Does this Module is a named module of a standard named module?
Definition: Module.h:185
This represents a decl that may have a name.
Definition: Decl.h:249
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
Definition: DeclBase.h:647
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Definition: Decl.cpp:1169
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:315
NamedDecl * getMostRecentDecl()
Definition: Decl.h:476
Represents a C++ namespace alias.
Definition: DeclCXX.h:3117
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3180
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3205
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:3208
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition: DeclCXX.h:3189
Represent a C++ namespace.
Definition: Decl.h:547
SourceLocation getRBraceLoc() const
Definition: Decl.h:686
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:685
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:3007
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Definition: Decl.h:605
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:610
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
Definition: Decl.h:665
bool isNested() const
Returns true if this is a nested namespace declaration.
Definition: Decl.h:627
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:177
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:238
Expr * getInitPriv()
Get Priv variable of the initializer.
Definition: DeclOpenMP.h:249
Expr * getCombinerOut()
Get Out variable of the combiner.
Definition: DeclOpenMP.h:226
Expr * getCombinerIn()
Get In variable of the combiner.
Definition: DeclOpenMP.h:223
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:220
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
OMPDeclareReductionInitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:241
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:2026
static bool classofKind(Kind K)
Definition: DeclObjC.h:2046
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2323
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2411
unsigned protocol_size() const
Definition: DeclObjC.h:2406
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2366
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2458
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2460
protocol_range protocols() const
Definition: DeclObjC.h:2397
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2454
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2539
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2565
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2767
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2785
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:946
SourceRange getAtEndRange() const
Definition: DeclObjC.h:1101
SourceLocation getAtStartLoc() const
Definition: DeclObjC.h:1094
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2480
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2590
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2670
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2736
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
Definition: DeclObjC.h:2694
SourceLocation getSuperClassLoc() const
Definition: DeclObjC.h:2729
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction?
Definition: DeclObjC.h:2699
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2661
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2727
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2734
Represents an ObjC class declaration.
Definition: DeclObjC.h:1152
protocol_range protocols() const
Definition: DeclObjC.h:1356
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: DeclObjC.cpp:791
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:1385
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
Definition: DeclObjC.h:1781
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Definition: DeclObjC.h:1520
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1915
SourceLocation getEndOfDefinitionLoc() const
Definition: DeclObjC.h:1874
TypeSourceInfo * getSuperClassTInfo() const
Definition: DeclObjC.h:1570
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1948
AccessControl getAccessControl() const
Definition: DeclObjC.h:1996
bool getSynthesize() const
Definition: DeclObjC.h:2003
static bool classofKind(Kind K)
Definition: DeclObjC.h:2011
T *const * iterator
Definition: DeclObjC.h:88
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:140
ImplicitParamDecl * getSelfDecl() const
Definition: DeclObjC.h:418
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
Definition: DeclObjC.h:462
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: DeclObjC.h:246
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:373
unsigned param_size() const
Definition: DeclObjC.h:347
bool isPropertyAccessor() const
Definition: DeclObjC.h:436
bool isVariadic() const
Definition: DeclObjC.h:431
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition: DeclObjC.cpp:908
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclObjC.cpp:1046
TypeSourceInfo * getReturnTypeSourceInfo() const
Definition: DeclObjC.h:343
bool hasRedeclaration() const
True if redeclared in the same interface.
Definition: DeclObjC.h:271
bool isSynthesizedAccessorStub() const
Definition: DeclObjC.h:444
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type.
Definition: DeclObjC.h:256
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
Definition: DeclObjC.h:266
ImplicitParamDecl * getCmdDecl() const
Definition: DeclObjC.h:420
bool isInstanceMethod() const
Definition: DeclObjC.h:426
bool isDefined() const
Definition: DeclObjC.h:452
QualType getReturnType() const
Definition: DeclObjC.h:329
ObjCImplementationControl getImplementationControl() const
Definition: DeclObjC.h:500
bool hasSkippedBody() const
True if the method was a definition but its body was skipped.
Definition: DeclObjC.h:477
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:729
SourceLocation getGetterNameLoc() const
Definition: DeclObjC.h:884
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:899
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:902
SourceLocation getSetterNameLoc() const
Definition: DeclObjC.h:892
SourceLocation getAtLoc() const
Definition: DeclObjC.h:794
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:922
Selector getSetterName() const
Definition: DeclObjC.h:891
TypeSourceInfo * getTypeSourceInfo() const
Definition: DeclObjC.h:800
QualType getType() const
Definition: DeclObjC.h:802
Selector getGetterName() const
Definition: DeclObjC.h:883
SourceLocation getLParenLoc() const
Definition: DeclObjC.h:797
ObjCPropertyAttribute::Kind getPropertyAttributesAsWritten() const
Definition: DeclObjC.h:825
ObjCPropertyAttribute::Kind getPropertyAttributes() const
Definition: DeclObjC.h:813
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:910
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2797
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2870
SourceLocation getPropertyIvarDeclLoc() const
Definition: DeclObjC.h:2873
Expr * getSetterCXXAssignment() const
Definition: DeclObjC.h:2906
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2861
Expr * getGetterCXXConstructor() const
Definition: DeclObjC.h:2898
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:2895
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclObjC.h:2858
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:2892
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2079
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:2255
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2176
protocol_range protocols() const
Definition: DeclObjC.h:2155
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: DeclObjC.cpp:2083
unsigned protocol_size() const
Definition: DeclObjC.h:2194
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:578
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h: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:1761
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion:
Definition: Decl.h:1842
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition: Decl.h:1821
SourceLocation getExplicitObjectParamThisLoc() const
Definition: Decl.h:1857
bool isObjCMethodParameter() const
Definition: Decl.h:1804
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: Decl.h:1825
bool hasUninstantiatedDefaultArg() const
Definition: Decl.h:1894
bool hasInheritedDefaultArg() const
Definition: Decl.h:1906
Expr * getUninstantiatedDefaultArg()
Definition: Decl.cpp:3010
unsigned getFunctionScopeDepth() const
Definition: Decl.h:1811
Represents a #pragma comment line.
Definition: Decl.h:142
StringRef getArg() const
Definition: Decl.h:165
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:163
Represents a #pragma detect_mismatch line.
Definition: Decl.h:176
StringRef getName() const
Definition: Decl.h:197
StringRef getValue() const
Definition: Decl.h:198
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
A (possibly-)qualified type.
Definition: Type.h:738
Represents a struct/union/class.
Definition: Decl.h:4169
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: Decl.cpp:5203
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition: Decl.h:4279
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition: Decl.h:4287
RecordArgPassingKind getArgPassingRestrictions() const
Definition: Decl.h:4302
bool hasVolatileMember() const
Definition: Decl.h:4232
bool hasFlexibleArrayMember() const
Definition: Decl.h:4202
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition: Decl.h:4271
bool hasObjectMember() const
Definition: Decl.h:4229
bool isNonTrivialToPrimitiveDestroy() const
Definition: Decl.h:4263
bool isNonTrivialToPrimitiveCopy() const
Definition: Decl.h:4255
bool isParamDestroyedInCallee() const
Definition: Decl.h:4311
RecordDecl * getMostRecentDecl()
Definition: Decl.h:4195
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition: Decl.h:4247
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition: Decl.h:4221
Declaration of a redeclarable template.
Definition: DeclTemplate.h:717
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:861
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:908
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:2027
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:4055
bool isFailed() const
Definition: DeclCXX.h:4084
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:4086
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1773
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3585
SourceRange getBraceRange() const
Definition: Decl.h:3664
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3683
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:3712
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3688
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:3813
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:3697
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition: Decl.h:3723
TagKind getTagKind() const
Definition: Decl.h:3780
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:280
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Definition: DeclTemplate.h:265
Represents a template argument.
Definition: TemplateBase.h:61
@ Type
The template argument is a type.
Definition: TemplateBase.h:70
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:295
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:394
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:426
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:413
A template parameter object.
const APValue & getValue() const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool wasDeclaredWithTypename() const
Whether this template template parameter was declared with the 'typename' keyword.
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
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:4458
The top declaration context.
Definition: Decl.h:84
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3556
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:3574
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Definition: ASTConcept.h:231
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
Definition: ASTConcept.h:246
ConceptReference * getConceptReference() const
Definition: ASTConcept.h:250
Represents a declaration of a type.
Definition: Decl.h:3391
const Type * getTypeForDecl() const
Definition: Decl.h:3415
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:3418
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:7131
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
Definition: Type.cpp:1999
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3535
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3433
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:3483
bool isModed() const
Definition: Decl.h:3479
QualType getUnderlyingType() const
Definition: Decl.h:3488
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes,...
Definition: Decl.cpp:5506
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Definition: DeclCXX.h:4343
const APValue & getValue() const
Definition: DeclCXX.h:4369
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Definition: DeclCXX.h:4037
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3956
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
Definition: DeclCXX.h:3986
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3990
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:4007
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3859
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
Definition: DeclCXX.h:3890
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3900
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3917
Represents a C++ using-declaration.
Definition: DeclCXX.h:3509
bool hasTypename() const
Return true if the using declaration has 'typename'.
Definition: DeclCXX.h:3558
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3543
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
Definition: DeclCXX.h:3536
Represents C++ using-directive.
Definition: DeclCXX.h:3012
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:3083
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2956
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:3079
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3087
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3057
Represents a C++ using-enum-declaration.
Definition: DeclCXX.h:3710
SourceLocation getEnumLoc() const
The source location of the 'enum' keyword.
Definition: DeclCXX.h:3734
TypeSourceInfo * getEnumType() const
Definition: DeclCXX.h:3748
SourceLocation getUsingLoc() const
The source location of the 'using' keyword.
Definition: DeclCXX.h:3730
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Definition: DeclCXX.h:3791
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition: DeclCXX.h:3821
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Definition: DeclCXX.h:3825
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3317
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3381
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:706
QualType getType() const
Definition: Decl.h:717
Represents a variable declaration or definition.
Definition: Decl.h:918
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Definition: Decl.cpp:2787
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1549
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1446
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition: Decl.h:1558
@ CInit
C-style initialization with assignment.
Definition: Decl.h:923
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C.
Definition: Decl.h:1512
bool isInlineSpecified() const
Definition: Decl.h:1534
bool isStaticDataMember() const
Determines whether this is a static data member.
Definition: Decl.h:1270
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement.
Definition: Decl.h:1502
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO).
Definition: Decl.h:1492
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Definition: Decl.h:1474
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1531
ThreadStorageClassSpecifier getTSCSpec() const
Definition: Decl.h:1164
const Expr * getInit() const
Definition: Decl.h:1355
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition: Decl.h:1527
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
Definition: Decl.h:1216
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1155
bool isEscapingByref() const
Indicates the capture is a __block variable that is captured by a block that can potentially escape (...
Definition: Decl.cpp:2675
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Definition: Decl.h:1456
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
Definition: Decl.h:1572
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Definition: Decl.cpp:2867
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:1242
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1250
@ DECL_EMPTY
An EmptyDecl record.
Definition: ASTBitCodes.h:1498
@ DECL_CAPTURED
A CapturedDecl record.
Definition: ASTBitCodes.h:1339
@ DECL_CXX_RECORD
A CXXRecordDecl record.
Definition: ASTBitCodes.h:1400
@ DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1442
@ DECL_OMP_ALLOCATE
An OMPAllocateDcl record.
Definition: ASTBitCodes.h:1495
@ DECL_MS_PROPERTY
A MSPropertyDecl record.
Definition: ASTBitCodes.h:1306
@ DECL_OMP_DECLARE_MAPPER
An OMPDeclareMapperDecl record.
Definition: ASTBitCodes.h:1519
@ DECL_TOP_LEVEL_STMT_DECL
A TopLevelStmtDecl record.
Definition: ASTBitCodes.h:1333
@ DECL_REQUIRES_EXPR_BODY
A RequiresExprBodyDecl record.
Definition: ASTBitCodes.h:1504
@ DECL_STATIC_ASSERT
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1466
@ DECL_INDIRECTFIELD
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1475
@ DECL_TEMPLATE_TEMPLATE_PARM
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1454
@ DECL_IMPORT
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1486
@ DECL_UNNAMED_GLOBAL_CONSTANT
A UnnamedGlobalConstantDecl record.
Definition: ASTBitCodes.h:1525
@ DECL_ACCESS_SPEC
An AccessSpecDecl record.
Definition: ASTBitCodes.h:1418
@ DECL_OBJC_TYPE_PARAM
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1507
@ DECL_OBJC_CATEGORY_IMPL
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1288
@ DECL_ENUM_CONSTANT
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1264
@ DECL_PARM_VAR
A ParmVarDecl record.
Definition: ASTBitCodes.h:1321
@ DECL_TYPEDEF
A TypedefDecl record.
Definition: ASTBitCodes.h:1252
@ DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack.
Definition: ASTBitCodes.h:1483
@ DECL_HLSL_BUFFER
A HLSLBufferDecl record.
Definition: ASTBitCodes.h:1528
@ DECL_NAMESPACE_ALIAS
A NamespaceAliasDecl record.
Definition: ASTBitCodes.h:1367
@ DECL_TYPEALIAS
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1255
@ DECL_FUNCTION_TEMPLATE
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1445
@ DECL_MS_GUID
A MSGuidDecl record.
Definition: ASTBitCodes.h:1309
@ DECL_UNRESOLVED_USING_TYPENAME
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1391
@ DECL_CLASS_TEMPLATE_SPECIALIZATION
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1430
@ DECL_FILE_SCOPE_ASM
A FileScopeAsmDecl record.
Definition: ASTBitCodes.h:1330
@ DECL_CXX_CONSTRUCTOR
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1409
@ DECL_CXX_CONVERSION
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1415
@ DECL_FIELD
A FieldDecl record.
Definition: ASTBitCodes.h:1303
@ DECL_LINKAGE_SPEC
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1394
@ DECL_NAMESPACE
A NamespaceDecl record.
Definition: ASTBitCodes.h:1364
@ DECL_NON_TYPE_TEMPLATE_PARM
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1451
@ DECL_USING_PACK
A UsingPackDecl record.
Definition: ASTBitCodes.h:1376
@ DECL_FUNCTION
A FunctionDecl record.
Definition: ASTBitCodes.h:1267
@ DECL_USING_DIRECTIVE
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1385
@ DECL_RECORD
A RecordDecl record.
Definition: ASTBitCodes.h:1261
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
Definition: ASTBitCodes.h:1349
@ DECL_BLOCK
A BlockDecl record.
Definition: ASTBitCodes.h:1336
@ DECL_UNRESOLVED_USING_VALUE
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1388
@ DECL_TYPE_ALIAS_TEMPLATE
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1457
@ DECL_OBJC_CATEGORY
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1285
@ DECL_VAR
A VarDecl record.
Definition: ASTBitCodes.h:1315
@ DECL_UNRESOLVED_USING_IF_EXISTS
An UnresolvedUsingIfExistsDecl record.
Definition: ASTBitCodes.h:1463
@ DECL_USING
A UsingDecl record.
Definition: ASTBitCodes.h:1370
@ DECL_OBJC_PROTOCOL
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1276
@ DECL_TEMPLATE_TYPE_PARM
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1448
@ DECL_VAR_TEMPLATE_SPECIALIZATION
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1439
@ DECL_OBJC_IMPLEMENTATION
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1291
@ DECL_LABEL
A LabelDecl record.
Definition: ASTBitCodes.h:1361
@ DECL_OBJC_COMPATIBLE_ALIAS
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1294
@ DECL_CONSTRUCTOR_USING_SHADOW
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1382
@ DECL_USING_ENUM
A UsingEnumDecl record.
Definition: ASTBitCodes.h:1373
@ DECL_FRIEND_TEMPLATE
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1424
@ DECL_PRAGMA_DETECT_MISMATCH
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1516
@ DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack.
Definition: ASTBitCodes.h:1479
@ DECL_OBJC_AT_DEFS_FIELD
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1282
@ DECL_IMPLICIT_PARAM
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1318
@ DECL_FRIEND
A FriendDecl record.
Definition: ASTBitCodes.h:1421
@ DECL_CXX_METHOD
A CXXMethodDecl record.
Definition: ASTBitCodes.h:1406
@ DECL_EXPORT
An ExportDecl record.
Definition: ASTBitCodes.h:1397
@ DECL_BINDING
A BindingDecl record.
Definition: ASTBitCodes.h:1327
@ DECL_PRAGMA_COMMENT
A PragmaCommentDecl record.
Definition: ASTBitCodes.h:1513
@ DECL_ENUM
An EnumDecl record.
Definition: ASTBitCodes.h:1258
@ DECL_DECOMPOSITION
A DecompositionDecl record.
Definition: ASTBitCodes.h:1324
@ DECL_OMP_DECLARE_REDUCTION
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1522
@ DECL_OMP_THREADPRIVATE
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1489
@ DECL_OBJC_METHOD
A ObjCMethodDecl record.
Definition: ASTBitCodes.h:1270
@ DECL_CXX_DESTRUCTOR
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1412
@ DECL_OMP_CAPTUREDEXPR
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1510
@ DECL_CLASS_TEMPLATE
A ClassTemplateDecl record.
Definition: ASTBitCodes.h:1427
@ DECL_USING_SHADOW
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1379
@ DECL_CONCEPT
A ConceptDecl record.
Definition: ASTBitCodes.h:1460
@ DECL_CXX_DEDUCTION_GUIDE
A CXXDeductionGuideDecl record.
Definition: ASTBitCodes.h:1403
@ DECL_OMP_REQUIRES
An OMPRequiresDecl record.
Definition: ASTBitCodes.h:1492
@ DECL_OBJC_IVAR
A ObjCIvarDecl record.
Definition: ASTBitCodes.h:1279
@ DECL_OBJC_PROPERTY
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1297
@ DECL_TEMPLATE_PARAM_OBJECT
A TemplateParamObjectDecl record.
Definition: ASTBitCodes.h:1312
@ DECL_OBJC_INTERFACE
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1273
@ DECL_VAR_TEMPLATE
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1436
@ DECL_LIFETIME_EXTENDED_TEMPORARY
An LifetimeExtendedTemporaryDecl record.
Definition: ASTBitCodes.h:1501
@ DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1433
@ DECL_IMPLICIT_CONCEPT_SPECIALIZATION
An ImplicitConceptSpecializationDecl record.
Definition: ASTBitCodes.h:1531
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
Definition: ASTBitCodes.h:1358
@ DECL_OBJC_PROPERTY_IMPL
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1300
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
Definition: ASTBitCodes.h:1669
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1824
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1675
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1636
@ STMT_COMPOUND
A CompoundStmt record.
Definition: ASTBitCodes.h:1558
@ EXPR_CALL
A CallExpr record.
Definition: ASTBitCodes.h:1660
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
Definition: ASTBitCodes.h:1666
@ EXPR_DECL_REF
A DeclRefExpr record.
Definition: ASTBitCodes.h:1621
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
Definition: ASTBitCodes.h:1624
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
Definition: ASTBitCodes.h:1827
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:456
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
The JSON file list parser is used to communicate input to InstallAPI.
@ GVA_StrongExternal
Definition: Linkage.h:76
@ GVA_AvailableExternally
Definition: Linkage.h:74
@ GVA_Internal
Definition: Linkage.h:73
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition: Linkage.h:24
@ SD_Static
Static storage duration.
Definition: Specifiers.h:328
bool CanElideDeclDef(const Decl *D)
If we can elide the definition of.
const FunctionProtoType * T
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
Definition: Specifiers.h:191
@ AS_none
Definition: Specifiers.h:124
unsigned long uint64_t
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Definition: Expr.h:6219
Data that is common to all of the declarations of a given function template.
Definition: DeclTemplate.h:964
Parts of a decomposed MSGuidDecl.
Definition: DeclCXX.h:4261
uint16_t Part2
...-89ab-...
Definition: DeclCXX.h:4265
uint32_t Part1
{01234567-...
Definition: DeclCXX.h:4263
uint16_t Part3
...-cdef-...
Definition: DeclCXX.h:4267
uint8_t Part4And5[8]
...-0123-456789abcdef}
Definition: DeclCXX.h:4269
static DeclType * getDecl(EntryType *D)
Definition: DeclTemplate.h:737