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"
24#include "llvm/Bitstream/BitstreamWriter.h"
25#include "llvm/Support/ErrorHandling.h"
26#include <optional>
27using namespace clang;
28using namespace serialization;
29
30//===----------------------------------------------------------------------===//
31// Declaration serialization
32//===----------------------------------------------------------------------===//
33
34namespace clang {
35 class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {
36 ASTWriter &Writer;
37 ASTContext &Context;
39
41 unsigned AbbrevToUse;
42
43 bool GeneratingReducedBMI = false;
44
45 public:
47 ASTWriter::RecordDataImpl &Record, bool GeneratingReducedBMI)
48 : Writer(Writer), Context(Context), Record(Writer, Record),
49 Code((serialization::DeclCode)0), AbbrevToUse(0),
50 GeneratingReducedBMI(GeneratingReducedBMI) {}
51
52 uint64_t Emit(Decl *D) {
53 if (!Code)
54 llvm::report_fatal_error(StringRef("unexpected declaration kind '") +
55 D->getDeclKindName() + "'");
56 return Record.Emit(Code, AbbrevToUse);
57 }
58
59 void Visit(Decl *D);
60
61 void VisitDecl(Decl *D);
66 void VisitLabelDecl(LabelDecl *LD);
70 void VisitTypeDecl(TypeDecl *D);
76 void VisitTagDecl(TagDecl *D);
77 void VisitEnumDecl(EnumDecl *D);
104 void VisitVarDecl(VarDecl *D);
121 void VisitUsingDecl(UsingDecl *D);
135 void VisitBlockDecl(BlockDecl *D);
137 void VisitEmptyDecl(EmptyDecl *D);
140 template <typename T> void VisitRedeclarable(Redeclarable<T> *D);
142
143 // FIXME: Put in the same order is DeclNodes.td?
164
165 /// Add an Objective-C type parameter list to the given record.
167 // Empty type parameter list.
168 if (!typeParams) {
169 Record.push_back(0);
170 return;
171 }
172
173 Record.push_back(typeParams->size());
174 for (auto *typeParam : *typeParams) {
175 Record.AddDeclRef(typeParam);
176 }
177 Record.AddSourceLocation(typeParams->getLAngleLoc());
178 Record.AddSourceLocation(typeParams->getRAngleLoc());
179 }
180
181 /// Add to the record the first declaration from each module file that
182 /// provides a declaration of D. The intent is to provide a sufficient
183 /// set such that reloading this set will load all current redeclarations.
184 void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
185 llvm::MapVector<ModuleFile*, const Decl*> Firsts;
186 // FIXME: We can skip entries that we know are implied by others.
187 for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) {
188 if (R->isFromASTFile())
189 Firsts[Writer.Chain->getOwningModuleFile(R)] = R;
190 else if (IncludeLocal)
191 Firsts[nullptr] = R;
192 }
193 for (const auto &F : Firsts)
194 Record.AddDeclRef(F.second);
195 }
196
197 /// Get the specialization decl from an entry in the specialization list.
198 template <typename EntryType>
202 }
203
204 /// Get the list of partial specializations from a template's common ptr.
205 template<typename T>
206 decltype(T::PartialSpecializations) &getPartialSpecializations(T *Common) {
207 return Common->PartialSpecializations;
208 }
210 return std::nullopt;
211 }
212
213 template<typename DeclTy>
215 auto *Common = D->getCommonPtr();
216
217 // If we have any lazy specializations, and the external AST source is
218 // our chained AST reader, we can just write out the DeclIDs. Otherwise,
219 // we need to resolve them to actual declarations.
220 if (Writer.Chain != Writer.Context->getExternalSource() &&
221 Common->LazySpecializations) {
222 D->LoadLazySpecializations();
223 assert(!Common->LazySpecializations);
224 }
225
226 ArrayRef<GlobalDeclID> LazySpecializations;
227 if (auto *LS = Common->LazySpecializations)
228 LazySpecializations = llvm::ArrayRef(LS + 1, LS[0].get());
229
230 // Add a slot to the record for the number of specializations.
231 unsigned I = Record.size();
232 Record.push_back(0);
233
234 // AddFirstDeclFromEachModule might trigger deserialization, invalidating
235 // *Specializations iterators.
237 for (auto &Entry : Common->Specializations)
238 Specs.push_back(getSpecializationDecl(Entry));
239 for (auto &Entry : getPartialSpecializations(Common))
240 Specs.push_back(getSpecializationDecl(Entry));
241
242 for (auto *D : Specs) {
243 assert(D->isCanonicalDecl() && "non-canonical decl in set");
244 AddFirstDeclFromEachModule(D, /*IncludeLocal*/true);
245 }
246 Record.append(
247 DeclIDIterator<GlobalDeclID, DeclID>(LazySpecializations.begin()),
248 DeclIDIterator<GlobalDeclID, DeclID>(LazySpecializations.end()));
249
250 // Update the size entry we added earlier.
251 Record[I] = Record.size() - I - 1;
252 }
253
254 /// Ensure that this template specialization is associated with the specified
255 /// template on reload.
257 const Decl *Specialization) {
258 Template = Template->getCanonicalDecl();
259
260 // If the canonical template is local, we'll write out this specialization
261 // when we emit it.
262 // FIXME: We can do the same thing if there is any local declaration of
263 // the template, to avoid emitting an update record.
264 if (!Template->isFromASTFile())
265 return;
266
267 // We only need to associate the first local declaration of the
268 // specialization. The other declarations will get pulled in by it.
270 return;
271
272 Writer.DeclUpdates[Template].push_back(ASTWriter::DeclUpdate(
274 }
275 };
276}
277
279 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
280 if (FD->isInlined() || FD->isConstexpr())
281 return false;
282
283 if (FD->isDependentContext())
284 return false;
285
286 if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
287 return false;
288 }
289
290 if (auto *VD = dyn_cast<VarDecl>(D)) {
291 if (!VD->getDeclContext()->getRedeclContext()->isFileContext() ||
292 VD->isInline() || VD->isConstexpr() || isa<ParmVarDecl>(VD) ||
293 // Constant initialized variable may not affect the ABI, but they
294 // may be used in constant evaluation in the frontend, so we have
295 // to remain them.
296 VD->hasConstantInitialization())
297 return false;
298
299 if (VD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation)
300 return false;
301 }
302
303 return true;
304}
305
308
309 // Source locations require array (variable-length) abbreviations. The
310 // abbreviation infrastructure requires that arrays are encoded last, so
311 // we handle it here in the case of those classes derived from DeclaratorDecl
312 if (auto *DD = dyn_cast<DeclaratorDecl>(D)) {
313 if (auto *TInfo = DD->getTypeSourceInfo())
314 Record.AddTypeLoc(TInfo->getTypeLoc());
315 }
316
317 // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
318 // have been written. We want it last because we will not read it back when
319 // retrieving it from the AST, we'll just lazily set the offset.
320 if (auto *FD = dyn_cast<FunctionDecl>(D)) {
321 if (!GeneratingReducedBMI || !CanElideDeclDef(FD)) {
322 Record.push_back(FD->doesThisDeclarationHaveABody());
323 if (FD->doesThisDeclarationHaveABody())
324 Record.AddFunctionDefinition(FD);
325 } else
326 Record.push_back(0);
327 }
328
329 // Similar to FunctionDecls, handle VarDecl's initializer here and write it
330 // after all other Stmts/Exprs. We will not read the initializer until after
331 // we have finished recursive deserialization, because it can recursively
332 // refer back to the variable.
333 if (auto *VD = dyn_cast<VarDecl>(D)) {
334 if (!GeneratingReducedBMI || !CanElideDeclDef(VD))
335 Record.AddVarDeclInit(VD);
336 else
337 Record.push_back(0);
338 }
339
340 // And similarly for FieldDecls. We already serialized whether there is a
341 // default member initializer.
342 if (auto *FD = dyn_cast<FieldDecl>(D)) {
343 if (FD->hasInClassInitializer()) {
344 if (Expr *Init = FD->getInClassInitializer()) {
345 Record.push_back(1);
346 Record.AddStmt(Init);
347 } else {
348 Record.push_back(0);
349 // Initializer has not been instantiated yet.
350 }
351 }
352 }
353
354 // If this declaration is also a DeclContext, write blocks for the
355 // declarations that lexically stored inside its context and those
356 // declarations that are visible from its context.
357 if (auto *DC = dyn_cast<DeclContext>(D))
359}
360
362 BitsPacker DeclBits;
363
364 // The order matters here. It will be better to put the bit with higher
365 // probability to be 0 in the end of the bits.
366 //
367 // Since we're using VBR6 format to store it.
368 // It will be pretty effient if all the higher bits are 0.
369 // For example, if we need to pack 8 bits into a value and the stored value
370 // is 0xf0, the actual stored value will be 0b000111'110000, which takes 12
371 // bits actually. However, if we changed the order to be 0x0f, then we can
372 // store it as 0b001111, which takes 6 bits only now.
373 DeclBits.addBits((uint64_t)D->getModuleOwnershipKind(), /*BitWidth=*/3);
374 DeclBits.addBit(D->isReferenced());
375 DeclBits.addBit(D->isUsed(false));
376 DeclBits.addBits(D->getAccess(), /*BitWidth=*/2);
377 DeclBits.addBit(D->isImplicit());
378 DeclBits.addBit(D->getDeclContext() != D->getLexicalDeclContext());
379 DeclBits.addBit(D->hasAttrs());
381 DeclBits.addBit(D->isInvalidDecl());
382 Record.push_back(DeclBits);
383
384 Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
385 if (D->getDeclContext() != D->getLexicalDeclContext())
386 Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
387
388 if (D->hasAttrs())
389 Record.AddAttributes(D->getAttrs());
390
391 Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
392
393 // If this declaration injected a name into a context different from its
394 // lexical context, and that context is an imported namespace, we need to
395 // update its visible declarations to include this name.
396 //
397 // This happens when we instantiate a class with a friend declaration or a
398 // function with a local extern declaration, for instance.
399 //
400 // FIXME: Can we handle this in AddedVisibleDecl instead?
401 if (D->isOutOfLine()) {
402 auto *DC = D->getDeclContext();
403 while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
404 if (!NS->isFromASTFile())
405 break;
406 Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
407 if (!NS->isInlineNamespace())
408 break;
409 DC = NS->getParent();
410 }
411 }
412}
413
415 StringRef Arg = D->getArg();
416 Record.push_back(Arg.size());
417 VisitDecl(D);
418 Record.AddSourceLocation(D->getBeginLoc());
419 Record.push_back(D->getCommentKind());
420 Record.AddString(Arg);
422}
423
426 StringRef Name = D->getName();
427 StringRef Value = D->getValue();
428 Record.push_back(Name.size() + 1 + Value.size());
429 VisitDecl(D);
430 Record.AddSourceLocation(D->getBeginLoc());
431 Record.AddString(Name);
432 Record.AddString(Value);
434}
435
437 llvm_unreachable("Translation units aren't directly serialized");
438}
439
441 VisitDecl(D);
442 Record.AddDeclarationName(D->getDeclName());
445 : 0);
446}
447
450 Record.AddSourceLocation(D->getBeginLoc());
451 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
452}
453
456 VisitTypeDecl(D);
457 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
458 Record.push_back(D->isModed());
459 if (D->isModed())
460 Record.AddTypeRef(D->getUnderlyingType());
461 Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
462}
463
466 if (D->getDeclContext() == D->getLexicalDeclContext() &&
467 !D->hasAttrs() &&
468 !D->isImplicit() &&
469 D->getFirstDecl() == D->getMostRecentDecl() &&
470 !D->isInvalidDecl() &&
472 !D->isModulePrivate() &&
475 AbbrevToUse = Writer.getDeclTypedefAbbrev();
476
478}
479
482 Record.AddDeclRef(D->getDescribedAliasTemplate());
484}
485
487 static_assert(DeclContext::NumTagDeclBits == 23,
488 "You need to update the serializer after you change the "
489 "TagDeclBits");
490
492 VisitTypeDecl(D);
493 Record.push_back(D->getIdentifierNamespace());
494
495 BitsPacker TagDeclBits;
496 TagDeclBits.addBits(llvm::to_underlying(D->getTagKind()), /*BitWidth=*/3);
497 TagDeclBits.addBit(!isa<CXXRecordDecl>(D) ? D->isCompleteDefinition() : 0);
498 TagDeclBits.addBit(D->isEmbeddedInDeclarator());
499 TagDeclBits.addBit(D->isFreeStanding());
500 TagDeclBits.addBit(D->isCompleteDefinitionRequired());
501 TagDeclBits.addBits(
502 D->hasExtInfo() ? 1 : (D->getTypedefNameForAnonDecl() ? 2 : 0),
503 /*BitWidth=*/2);
504 Record.push_back(TagDeclBits);
505
506 Record.AddSourceRange(D->getBraceRange());
507
508 if (D->hasExtInfo()) {
509 Record.AddQualifierInfo(*D->getExtInfo());
510 } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
511 Record.AddDeclRef(TD);
512 Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
513 }
514}
515
517 static_assert(DeclContext::NumEnumDeclBits == 43,
518 "You need to update the serializer after you change the "
519 "EnumDeclBits");
520
521 VisitTagDecl(D);
522 Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
523 if (!D->getIntegerTypeSourceInfo())
524 Record.AddTypeRef(D->getIntegerType());
525 Record.AddTypeRef(D->getPromotionType());
526
527 BitsPacker EnumDeclBits;
528 EnumDeclBits.addBits(D->getNumPositiveBits(), /*BitWidth=*/8);
529 EnumDeclBits.addBits(D->getNumNegativeBits(), /*BitWidth=*/8);
530 bool ShouldSkipCheckingODR = shouldSkipCheckingODR(D);
531 EnumDeclBits.addBit(ShouldSkipCheckingODR);
532 EnumDeclBits.addBit(D->isScoped());
533 EnumDeclBits.addBit(D->isScopedUsingClassTag());
534 EnumDeclBits.addBit(D->isFixed());
535 Record.push_back(EnumDeclBits);
536
537 // We only perform ODR checks for decls not in GMF.
538 if (!ShouldSkipCheckingODR)
539 Record.push_back(D->getODRHash());
540
542 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
543 Record.push_back(MemberInfo->getTemplateSpecializationKind());
544 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
545 } else {
546 Record.AddDeclRef(nullptr);
547 }
548
549 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
550 !D->isInvalidDecl() && !D->isImplicit() && !D->hasExtInfo() &&
552 D->getFirstDecl() == D->getMostRecentDecl() &&
558 AbbrevToUse = Writer.getDeclEnumAbbrev();
559
561}
562
564 static_assert(DeclContext::NumRecordDeclBits == 64,
565 "You need to update the serializer after you change the "
566 "RecordDeclBits");
567
568 VisitTagDecl(D);
569
570 BitsPacker RecordDeclBits;
571 RecordDeclBits.addBit(D->hasFlexibleArrayMember());
572 RecordDeclBits.addBit(D->isAnonymousStructOrUnion());
573 RecordDeclBits.addBit(D->hasObjectMember());
574 RecordDeclBits.addBit(D->hasVolatileMember());
576 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveCopy());
577 RecordDeclBits.addBit(D->isNonTrivialToPrimitiveDestroy());
580 RecordDeclBits.addBit(D->hasNonTrivialToPrimitiveCopyCUnion());
581 RecordDeclBits.addBit(D->isParamDestroyedInCallee());
582 RecordDeclBits.addBits(llvm::to_underlying(D->getArgPassingRestrictions()), 2);
583 Record.push_back(RecordDeclBits);
584
585 // Only compute this for C/Objective-C, in C++ this is computed as part
586 // of CXXRecordDecl.
587 if (!isa<CXXRecordDecl>(D))
588 Record.push_back(D->getODRHash());
589
590 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
591 !D->isImplicit() && !D->isInvalidDecl() && !D->hasExtInfo() &&
593 D->getFirstDecl() == D->getMostRecentDecl() &&
598 AbbrevToUse = Writer.getDeclRecordAbbrev();
599
601}
602
605 Record.AddTypeRef(D->getType());
606}
607
610 Record.push_back(D->getInitExpr()? 1 : 0);
611 if (D->getInitExpr())
612 Record.AddStmt(D->getInitExpr());
613 Record.AddAPSInt(D->getInitVal());
614
616}
617
620 Record.AddSourceLocation(D->getInnerLocStart());
621 Record.push_back(D->hasExtInfo());
622 if (D->hasExtInfo()) {
623 DeclaratorDecl::ExtInfo *Info = D->getExtInfo();
624 Record.AddQualifierInfo(*Info);
625 Record.AddStmt(Info->TrailingRequiresClause);
626 }
627 // The location information is deferred until the end of the record.
628 Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()
629 : QualType());
630}
631
633 static_assert(DeclContext::NumFunctionDeclBits == 44,
634 "You need to update the serializer after you change the "
635 "FunctionDeclBits");
636
638
639 Record.push_back(D->getTemplatedKind());
640 switch (D->getTemplatedKind()) {
642 break;
644 Record.AddDeclRef(D->getInstantiatedFromDecl());
645 break;
647 Record.AddDeclRef(D->getDescribedFunctionTemplate());
648 break;
651 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
652 Record.push_back(MemberInfo->getTemplateSpecializationKind());
653 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
654 break;
655 }
658 FTSInfo = D->getTemplateSpecializationInfo();
659
661
662 Record.AddDeclRef(FTSInfo->getTemplate());
663 Record.push_back(FTSInfo->getTemplateSpecializationKind());
664
665 // Template arguments.
666 Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
667
668 // Template args as written.
669 Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
670 if (FTSInfo->TemplateArgumentsAsWritten)
671 Record.AddASTTemplateArgumentListInfo(
673
674 Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
675
676 if (MemberSpecializationInfo *MemberInfo =
677 FTSInfo->getMemberSpecializationInfo()) {
678 Record.push_back(1);
679 Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
680 Record.push_back(MemberInfo->getTemplateSpecializationKind());
681 Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
682 } else {
683 Record.push_back(0);
684 }
685
686 if (D->isCanonicalDecl()) {
687 // Write the template that contains the specializations set. We will
688 // add a FunctionTemplateSpecializationInfo to it when reading.
689 Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
690 }
691 break;
692 }
695 DFTSInfo = D->getDependentSpecializationInfo();
696
697 // Candidates.
698 Record.push_back(DFTSInfo->getCandidates().size());
699 for (FunctionTemplateDecl *FTD : DFTSInfo->getCandidates())
700 Record.AddDeclRef(FTD);
701
702 // Templates args.
703 Record.push_back(DFTSInfo->TemplateArgumentsAsWritten != nullptr);
704 if (DFTSInfo->TemplateArgumentsAsWritten)
705 Record.AddASTTemplateArgumentListInfo(
707 break;
708 }
709 }
710
712 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
713 Record.push_back(D->getIdentifierNamespace());
714
715 // The order matters here. It will be better to put the bit with higher
716 // probability to be 0 in the end of the bits. See the comments in VisitDecl
717 // for details.
718 BitsPacker FunctionDeclBits;
719 // FIXME: stable encoding
720 FunctionDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()), 3);
721 FunctionDeclBits.addBits((uint32_t)D->getStorageClass(), /*BitWidth=*/3);
722 bool ShouldSkipCheckingODR = shouldSkipCheckingODR(D);
723 FunctionDeclBits.addBit(ShouldSkipCheckingODR);
724 FunctionDeclBits.addBit(D->isInlineSpecified());
725 FunctionDeclBits.addBit(D->isInlined());
726 FunctionDeclBits.addBit(D->hasSkippedBody());
727 FunctionDeclBits.addBit(D->isVirtualAsWritten());
728 FunctionDeclBits.addBit(D->isPureVirtual());
729 FunctionDeclBits.addBit(D->hasInheritedPrototype());
730 FunctionDeclBits.addBit(D->hasWrittenPrototype());
731 FunctionDeclBits.addBit(D->isDeletedBit());
732 FunctionDeclBits.addBit(D->isTrivial());
733 FunctionDeclBits.addBit(D->isTrivialForCall());
734 FunctionDeclBits.addBit(D->isDefaulted());
735 FunctionDeclBits.addBit(D->isExplicitlyDefaulted());
736 FunctionDeclBits.addBit(D->isIneligibleOrNotSelected());
737 FunctionDeclBits.addBits((uint64_t)(D->getConstexprKind()), /*BitWidth=*/2);
738 FunctionDeclBits.addBit(D->hasImplicitReturnZero());
739 FunctionDeclBits.addBit(D->isMultiVersion());
740 FunctionDeclBits.addBit(D->isLateTemplateParsed());
742 FunctionDeclBits.addBit(D->usesSEHTry());
743 Record.push_back(FunctionDeclBits);
744
745 Record.AddSourceLocation(D->getEndLoc());
746 if (D->isExplicitlyDefaulted())
747 Record.AddSourceLocation(D->getDefaultLoc());
748
749 // We only perform ODR checks for decls not in GMF.
750 if (!ShouldSkipCheckingODR)
751 Record.push_back(D->getODRHash());
752
753 if (D->isDefaulted() || D->isDeletedAsWritten()) {
754 if (auto *FDI = D->getDefalutedOrDeletedInfo()) {
755 // Store both that there is an DefaultedOrDeletedInfo and whether it
756 // contains a DeletedMessage.
757 StringLiteral *DeletedMessage = FDI->getDeletedMessage();
758 Record.push_back(1 | (DeletedMessage ? 2 : 0));
759 if (DeletedMessage)
760 Record.AddStmt(DeletedMessage);
761
762 Record.push_back(FDI->getUnqualifiedLookups().size());
763 for (DeclAccessPair P : FDI->getUnqualifiedLookups()) {
764 Record.AddDeclRef(P.getDecl());
765 Record.push_back(P.getAccess());
766 }
767 } else {
768 Record.push_back(0);
769 }
770 }
771
772 Record.push_back(D->param_size());
773 for (auto *P : D->parameters())
774 Record.AddDeclRef(P);
776}
777
780 uint64_t Kind = static_cast<uint64_t>(ES.getKind());
781 Kind = Kind << 1 | static_cast<bool>(ES.getExpr());
782 Record.push_back(Kind);
783 if (ES.getExpr()) {
784 Record.AddStmt(ES.getExpr());
785 }
786}
787
790 Record.AddDeclRef(D->Ctor);
792 Record.push_back(static_cast<unsigned char>(D->getDeductionCandidateKind()));
794}
795
797 static_assert(DeclContext::NumObjCMethodDeclBits == 37,
798 "You need to update the serializer after you change the "
799 "ObjCMethodDeclBits");
800
802 // FIXME: convert to LazyStmtPtr?
803 // Unlike C/C++, method bodies will never be in header files.
804 bool HasBodyStuff = D->getBody() != nullptr;
805 Record.push_back(HasBodyStuff);
806 if (HasBodyStuff) {
807 Record.AddStmt(D->getBody());
808 }
809 Record.AddDeclRef(D->getSelfDecl());
810 Record.AddDeclRef(D->getCmdDecl());
811 Record.push_back(D->isInstanceMethod());
812 Record.push_back(D->isVariadic());
813 Record.push_back(D->isPropertyAccessor());
814 Record.push_back(D->isSynthesizedAccessorStub());
815 Record.push_back(D->isDefined());
816 Record.push_back(D->isOverriding());
817 Record.push_back(D->hasSkippedBody());
818
819 Record.push_back(D->isRedeclaration());
820 Record.push_back(D->hasRedeclaration());
821 if (D->hasRedeclaration()) {
822 assert(Context.getObjCMethodRedeclaration(D));
823 Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
824 }
825
826 // FIXME: stable encoding for @required/@optional
827 Record.push_back(llvm::to_underlying(D->getImplementationControl()));
828 // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
829 Record.push_back(D->getObjCDeclQualifier());
830 Record.push_back(D->hasRelatedResultType());
831 Record.AddTypeRef(D->getReturnType());
832 Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
833 Record.AddSourceLocation(D->getEndLoc());
834 Record.push_back(D->param_size());
835 for (const auto *P : D->parameters())
836 Record.AddDeclRef(P);
837
838 Record.push_back(D->getSelLocsKind());
839 unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
840 SourceLocation *SelLocs = D->getStoredSelLocs();
841 Record.push_back(NumStoredSelLocs);
842 for (unsigned i = 0; i != NumStoredSelLocs; ++i)
843 Record.AddSourceLocation(SelLocs[i]);
844
846}
847
850 Record.push_back(D->Variance);
851 Record.push_back(D->Index);
852 Record.AddSourceLocation(D->VarianceLoc);
853 Record.AddSourceLocation(D->ColonLoc);
854
856}
857
859 static_assert(DeclContext::NumObjCContainerDeclBits == 64,
860 "You need to update the serializer after you change the "
861 "ObjCContainerDeclBits");
862
864 Record.AddSourceLocation(D->getAtStartLoc());
865 Record.AddSourceRange(D->getAtEndRange());
866 // Abstract class (no need to define a stable serialization::DECL code).
867}
868
872 Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
873 AddObjCTypeParamList(D->TypeParamList);
874
875 Record.push_back(D->isThisDeclarationADefinition());
877 // Write the DefinitionData
878 ObjCInterfaceDecl::DefinitionData &Data = D->data();
879
880 Record.AddTypeSourceInfo(D->getSuperClassTInfo());
881 Record.AddSourceLocation(D->getEndOfDefinitionLoc());
882 Record.push_back(Data.HasDesignatedInitializers);
883 Record.push_back(D->getODRHash());
884
885 // Write out the protocols that are directly referenced by the @interface.
886 Record.push_back(Data.ReferencedProtocols.size());
887 for (const auto *P : D->protocols())
888 Record.AddDeclRef(P);
889 for (const auto &PL : D->protocol_locs())
890 Record.AddSourceLocation(PL);
891
892 // Write out the protocols that are transitively referenced.
893 Record.push_back(Data.AllReferencedProtocols.size());
895 P = Data.AllReferencedProtocols.begin(),
896 PEnd = Data.AllReferencedProtocols.end();
897 P != PEnd; ++P)
898 Record.AddDeclRef(*P);
899
900
901 if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
902 // Ensure that we write out the set of categories for this class.
903 Writer.ObjCClassesWithCategories.insert(D);
904
905 // Make sure that the categories get serialized.
906 for (; Cat; Cat = Cat->getNextClassCategoryRaw())
907 (void)Writer.GetDeclRef(Cat);
908 }
909 }
910
912}
913
916 // FIXME: stable encoding for @public/@private/@protected/@package
917 Record.push_back(D->getAccessControl());
918 Record.push_back(D->getSynthesize());
919
920 if (D->getDeclContext() == D->getLexicalDeclContext() &&
921 !D->hasAttrs() &&
922 !D->isImplicit() &&
923 !D->isUsed(false) &&
924 !D->isInvalidDecl() &&
925 !D->isReferenced() &&
926 !D->isModulePrivate() &&
927 !D->getBitWidth() &&
928 !D->hasExtInfo() &&
929 D->getDeclName())
930 AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
931
933}
934
938
939 Record.push_back(D->isThisDeclarationADefinition());
941 Record.push_back(D->protocol_size());
942 for (const auto *I : D->protocols())
943 Record.AddDeclRef(I);
944 for (const auto &PL : D->protocol_locs())
945 Record.AddSourceLocation(PL);
946 Record.push_back(D->getODRHash());
947 }
948
950}
951
955}
956
959 Record.AddSourceLocation(D->getCategoryNameLoc());
960 Record.AddSourceLocation(D->getIvarLBraceLoc());
961 Record.AddSourceLocation(D->getIvarRBraceLoc());
962 Record.AddDeclRef(D->getClassInterface());
963 AddObjCTypeParamList(D->TypeParamList);
964 Record.push_back(D->protocol_size());
965 for (const auto *I : D->protocols())
966 Record.AddDeclRef(I);
967 for (const auto &PL : D->protocol_locs())
968 Record.AddSourceLocation(PL);
970}
971
974 Record.AddDeclRef(D->getClassInterface());
976}
977
980 Record.AddSourceLocation(D->getAtLoc());
981 Record.AddSourceLocation(D->getLParenLoc());
982 Record.AddTypeRef(D->getType());
983 Record.AddTypeSourceInfo(D->getTypeSourceInfo());
984 // FIXME: stable encoding
985 Record.push_back((unsigned)D->getPropertyAttributes());
986 Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
987 // FIXME: stable encoding
988 Record.push_back((unsigned)D->getPropertyImplementation());
989 Record.AddDeclarationName(D->getGetterName());
990 Record.AddSourceLocation(D->getGetterNameLoc());
991 Record.AddDeclarationName(D->getSetterName());
992 Record.AddSourceLocation(D->getSetterNameLoc());
993 Record.AddDeclRef(D->getGetterMethodDecl());
994 Record.AddDeclRef(D->getSetterMethodDecl());
995 Record.AddDeclRef(D->getPropertyIvarDecl());
997}
998
1001 Record.AddDeclRef(D->getClassInterface());
1002 // Abstract class (no need to define a stable serialization::DECL code).
1003}
1004
1007 Record.AddSourceLocation(D->getCategoryNameLoc());
1009}
1010
1013 Record.AddDeclRef(D->getSuperClass());
1014 Record.AddSourceLocation(D->getSuperClassLoc());
1015 Record.AddSourceLocation(D->getIvarLBraceLoc());
1016 Record.AddSourceLocation(D->getIvarRBraceLoc());
1017 Record.push_back(D->hasNonZeroConstructors());
1018 Record.push_back(D->hasDestructors());
1019 Record.push_back(D->NumIvarInitializers);
1020 if (D->NumIvarInitializers)
1021 Record.AddCXXCtorInitializers(
1022 llvm::ArrayRef(D->init_begin(), D->init_end()));
1024}
1025
1027 VisitDecl(D);
1028 Record.AddSourceLocation(D->getBeginLoc());
1029 Record.AddDeclRef(D->getPropertyDecl());
1030 Record.AddDeclRef(D->getPropertyIvarDecl());
1031 Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
1032 Record.AddDeclRef(D->getGetterMethodDecl());
1033 Record.AddDeclRef(D->getSetterMethodDecl());
1034 Record.AddStmt(D->getGetterCXXConstructor());
1035 Record.AddStmt(D->getSetterCXXAssignment());
1037}
1038
1041 Record.push_back(D->isMutable());
1042
1043 Record.push_back((D->StorageKind << 1) | D->BitField);
1044 if (D->StorageKind == FieldDecl::ISK_CapturedVLAType)
1045 Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
1046 else if (D->BitField)
1047 Record.AddStmt(D->getBitWidth());
1048
1049 if (!D->getDeclName())
1050 Record.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D));
1051
1052 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1053 !D->hasAttrs() &&
1054 !D->isImplicit() &&
1055 !D->isUsed(false) &&
1056 !D->isInvalidDecl() &&
1057 !D->isReferenced() &&
1059 !D->isModulePrivate() &&
1060 !D->getBitWidth() &&
1061 !D->hasInClassInitializer() &&
1062 !D->hasCapturedVLAType() &&
1063 !D->hasExtInfo() &&
1066 D->getDeclName())
1067 AbbrevToUse = Writer.getDeclFieldAbbrev();
1068
1070}
1071
1074 Record.AddIdentifierRef(D->getGetterId());
1075 Record.AddIdentifierRef(D->getSetterId());
1077}
1078
1080 VisitValueDecl(D);
1081 MSGuidDecl::Parts Parts = D->getParts();
1082 Record.push_back(Parts.Part1);
1083 Record.push_back(Parts.Part2);
1084 Record.push_back(Parts.Part3);
1085 Record.append(std::begin(Parts.Part4And5), std::end(Parts.Part4And5));
1087}
1088
1091 VisitValueDecl(D);
1092 Record.AddAPValue(D->getValue());
1094}
1095
1097 VisitValueDecl(D);
1098 Record.AddAPValue(D->getValue());
1100}
1101
1103 VisitValueDecl(D);
1104 Record.push_back(D->getChainingSize());
1105
1106 for (const auto *P : D->chain())
1107 Record.AddDeclRef(P);
1109}
1110
1114
1115 // The order matters here. It will be better to put the bit with higher
1116 // probability to be 0 in the end of the bits. See the comments in VisitDecl
1117 // for details.
1118 BitsPacker VarDeclBits;
1119 VarDeclBits.addBits(llvm::to_underlying(D->getLinkageInternal()),
1120 /*BitWidth=*/3);
1121
1122 bool ModulesCodegen = false;
1123 if (Writer.WritingModule && D->getStorageDuration() == SD_Static &&
1125 // When building a C++20 module interface unit or a partition unit, a
1126 // strong definition in the module interface is provided by the
1127 // compilation of that unit, not by its users. (Inline variables are still
1128 // emitted in module users.)
1129 ModulesCodegen =
1130 (Writer.WritingModule->isInterfaceOrPartition() ||
1131 (D->hasAttr<DLLExportAttr>() &&
1132 Writer.Context->getLangOpts().BuildingPCHWithObjectFile)) &&
1133 Writer.Context->GetGVALinkageForVariable(D) >= GVA_StrongExternal;
1134 }
1135 VarDeclBits.addBit(ModulesCodegen);
1136
1137 VarDeclBits.addBits(D->getStorageClass(), /*BitWidth=*/3);
1138 VarDeclBits.addBits(D->getTSCSpec(), /*BitWidth=*/2);
1139 VarDeclBits.addBits(D->getInitStyle(), /*BitWidth=*/2);
1140 VarDeclBits.addBit(D->isARCPseudoStrong());
1141
1142 bool HasDeducedType = false;
1143 if (!isa<ParmVarDecl>(D)) {
1145 VarDeclBits.addBit(D->isExceptionVariable());
1146 VarDeclBits.addBit(D->isNRVOVariable());
1147 VarDeclBits.addBit(D->isCXXForRangeDecl());
1148
1149 VarDeclBits.addBit(D->isInline());
1150 VarDeclBits.addBit(D->isInlineSpecified());
1151 VarDeclBits.addBit(D->isConstexpr());
1152 VarDeclBits.addBit(D->isInitCapture());
1153 VarDeclBits.addBit(D->isPreviousDeclInSameBlockScope());
1154
1155 VarDeclBits.addBit(D->isEscapingByref());
1156 HasDeducedType = D->getType()->getContainedDeducedType();
1157 VarDeclBits.addBit(HasDeducedType);
1158
1159 if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
1160 VarDeclBits.addBits(llvm::to_underlying(IPD->getParameterKind()),
1161 /*Width=*/3);
1162 else
1163 VarDeclBits.addBits(0, /*Width=*/3);
1164
1165 VarDeclBits.addBit(D->isObjCForDecl());
1166 }
1167
1168 Record.push_back(VarDeclBits);
1169
1170 if (ModulesCodegen)
1171 Writer.AddDeclRef(D, Writer.ModularCodegenDecls);
1172
1173 if (D->hasAttr<BlocksAttr>()) {
1174 BlockVarCopyInit Init = Writer.Context->getBlockVarCopyInit(D);
1175 Record.AddStmt(Init.getCopyExpr());
1176 if (Init.getCopyExpr())
1177 Record.push_back(Init.canThrow());
1178 }
1179
1180 enum {
1181 VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1182 };
1183 if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1184 Record.push_back(VarTemplate);
1185 Record.AddDeclRef(TemplD);
1186 } else if (MemberSpecializationInfo *SpecInfo
1188 Record.push_back(StaticDataMemberSpecialization);
1189 Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1190 Record.push_back(SpecInfo->getTemplateSpecializationKind());
1191 Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1192 } else {
1193 Record.push_back(VarNotTemplate);
1194 }
1195
1196 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
1200 !D->hasExtInfo() && D->getFirstDecl() == D->getMostRecentDecl() &&
1201 D->getKind() == Decl::Var && !D->isInline() && !D->isConstexpr() &&
1203 !D->isEscapingByref() && !HasDeducedType &&
1206 !isa<ImplicitParamDecl>(D) && !D->isEscapingByref())
1207 AbbrevToUse = Writer.getDeclVarAbbrev();
1208
1210}
1211
1213 VisitVarDecl(D);
1215}
1216
1218 VisitVarDecl(D);
1219
1220 // See the implementation of `ParmVarDecl::getParameterIndex()`, which may
1221 // exceed the size of the normal bitfield. So it may be better to not pack
1222 // these bits.
1223 Record.push_back(D->getFunctionScopeIndex());
1224
1225 BitsPacker ParmVarDeclBits;
1226 ParmVarDeclBits.addBit(D->isObjCMethodParameter());
1227 ParmVarDeclBits.addBits(D->getFunctionScopeDepth(), /*BitsWidth=*/7);
1228 // FIXME: stable encoding
1229 ParmVarDeclBits.addBits(D->getObjCDeclQualifier(), /*BitsWidth=*/7);
1230 ParmVarDeclBits.addBit(D->isKNRPromoted());
1231 ParmVarDeclBits.addBit(D->hasInheritedDefaultArg());
1232 ParmVarDeclBits.addBit(D->hasUninstantiatedDefaultArg());
1233 ParmVarDeclBits.addBit(D->getExplicitObjectParamThisLoc().isValid());
1234 Record.push_back(ParmVarDeclBits);
1235
1237 Record.AddStmt(D->getUninstantiatedDefaultArg());
1239 Record.AddSourceLocation(D->getExplicitObjectParamThisLoc());
1241
1242 // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1243 // we dynamically check for the properties that we optimize for, but don't
1244 // know are true of all PARM_VAR_DECLs.
1245 if (D->getDeclContext() == D->getLexicalDeclContext() && !D->hasAttrs() &&
1246 !D->hasExtInfo() && D->getStorageClass() == 0 && !D->isInvalidDecl() &&
1248 D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1249 D->getInit() == nullptr) // No default expr.
1250 AbbrevToUse = Writer.getDeclParmVarAbbrev();
1251
1252 // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1253 // just us assuming it.
1254 assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1256 && "PARM_VAR_DECL can't be demoted definition.");
1257 assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1258 assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1259 assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1260 assert(!D->isStaticDataMember() &&
1261 "PARM_VAR_DECL can't be static data member");
1262}
1263
1265 // Record the number of bindings first to simplify deserialization.
1266 Record.push_back(D->bindings().size());
1267
1268 VisitVarDecl(D);
1269 for (auto *B : D->bindings())
1270 Record.AddDeclRef(B);
1272}
1273
1275 VisitValueDecl(D);
1276 Record.AddStmt(D->getBinding());
1278}
1279
1281 VisitDecl(D);
1282 Record.AddStmt(D->getAsmString());
1283 Record.AddSourceLocation(D->getRParenLoc());
1285}
1286
1288 VisitDecl(D);
1289 Record.AddStmt(D->getStmt());
1291}
1292
1294 VisitDecl(D);
1296}
1297
1300 VisitDecl(D);
1301 Record.AddDeclRef(D->getExtendingDecl());
1302 Record.AddStmt(D->getTemporaryExpr());
1303 Record.push_back(static_cast<bool>(D->getValue()));
1304 if (D->getValue())
1305 Record.AddAPValue(*D->getValue());
1306 Record.push_back(D->getManglingNumber());
1308}
1310 VisitDecl(D);
1311 Record.AddStmt(D->getBody());
1312 Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1313 Record.push_back(D->param_size());
1314 for (ParmVarDecl *P : D->parameters())
1315 Record.AddDeclRef(P);
1316 Record.push_back(D->isVariadic());
1317 Record.push_back(D->blockMissingReturnType());
1318 Record.push_back(D->isConversionFromLambda());
1319 Record.push_back(D->doesNotEscape());
1320 Record.push_back(D->canAvoidCopyToHeap());
1321 Record.push_back(D->capturesCXXThis());
1322 Record.push_back(D->getNumCaptures());
1323 for (const auto &capture : D->captures()) {
1324 Record.AddDeclRef(capture.getVariable());
1325
1326 unsigned flags = 0;
1327 if (capture.isByRef()) flags |= 1;
1328 if (capture.isNested()) flags |= 2;
1329 if (capture.hasCopyExpr()) flags |= 4;
1330 Record.push_back(flags);
1331
1332 if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1333 }
1334
1336}
1337
1339 Record.push_back(CD->getNumParams());
1340 VisitDecl(CD);
1341 Record.push_back(CD->getContextParamPosition());
1342 Record.push_back(CD->isNothrow() ? 1 : 0);
1343 // Body is stored by VisitCapturedStmt.
1344 for (unsigned I = 0; I < CD->getNumParams(); ++I)
1345 Record.AddDeclRef(CD->getParam(I));
1347}
1348
1350 static_assert(DeclContext::NumLinkageSpecDeclBits == 17,
1351 "You need to update the serializer after you change the"
1352 "LinkageSpecDeclBits");
1353
1354 VisitDecl(D);
1355 Record.push_back(llvm::to_underlying(D->getLanguage()));
1356 Record.AddSourceLocation(D->getExternLoc());
1357 Record.AddSourceLocation(D->getRBraceLoc());
1359}
1360
1362 VisitDecl(D);
1363 Record.AddSourceLocation(D->getRBraceLoc());
1365}
1366
1368 VisitNamedDecl(D);
1369 Record.AddSourceLocation(D->getBeginLoc());
1371}
1372
1373
1376 VisitNamedDecl(D);
1377
1378 BitsPacker NamespaceDeclBits;
1379 NamespaceDeclBits.addBit(D->isInline());
1380 NamespaceDeclBits.addBit(D->isNested());
1381 Record.push_back(NamespaceDeclBits);
1382
1383 Record.AddSourceLocation(D->getBeginLoc());
1384 Record.AddSourceLocation(D->getRBraceLoc());
1385
1386 if (D->isOriginalNamespace())
1387 Record.AddDeclRef(D->getAnonymousNamespace());
1389
1390 if (Writer.hasChain() && D->isAnonymousNamespace() &&
1391 D == D->getMostRecentDecl()) {
1392 // This is a most recent reopening of the anonymous namespace. If its parent
1393 // is in a previous PCH (or is the TU), mark that parent for update, because
1394 // the original namespace always points to the latest re-opening of its
1395 // anonymous namespace.
1396 Decl *Parent = cast<Decl>(
1398 if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1399 Writer.DeclUpdates[Parent].push_back(
1400 ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
1401 }
1402 }
1403}
1404
1407 VisitNamedDecl(D);
1408 Record.AddSourceLocation(D->getNamespaceLoc());
1409 Record.AddSourceLocation(D->getTargetNameLoc());
1410 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1411 Record.AddDeclRef(D->getNamespace());
1413}
1414
1416 VisitNamedDecl(D);
1417 Record.AddSourceLocation(D->getUsingLoc());
1418 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1419 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1420 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1421 Record.push_back(D->hasTypename());
1422 Record.AddDeclRef(Context.getInstantiatedFromUsingDecl(D));
1424}
1425
1427 VisitNamedDecl(D);
1428 Record.AddSourceLocation(D->getUsingLoc());
1429 Record.AddSourceLocation(D->getEnumLoc());
1430 Record.AddTypeSourceInfo(D->getEnumType());
1431 Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1432 Record.AddDeclRef(Context.getInstantiatedFromUsingEnumDecl(D));
1434}
1435
1437 Record.push_back(D->NumExpansions);
1438 VisitNamedDecl(D);
1439 Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
1440 for (auto *E : D->expansions())
1441 Record.AddDeclRef(E);
1443}
1444
1447 VisitNamedDecl(D);
1448 Record.AddDeclRef(D->getTargetDecl());
1449 Record.push_back(D->getIdentifierNamespace());
1450 Record.AddDeclRef(D->UsingOrNextShadow);
1451 Record.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D));
1452
1453 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1454 D->getFirstDecl() == D->getMostRecentDecl() && !D->hasAttrs() &&
1457 AbbrevToUse = Writer.getDeclUsingShadowAbbrev();
1458
1460}
1461
1465 Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1466 Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1467 Record.push_back(D->IsVirtual);
1469}
1470
1472 VisitNamedDecl(D);
1473 Record.AddSourceLocation(D->getUsingLoc());
1474 Record.AddSourceLocation(D->getNamespaceKeyLocation());
1475 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1476 Record.AddDeclRef(D->getNominatedNamespace());
1477 Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1479}
1480
1482 VisitValueDecl(D);
1483 Record.AddSourceLocation(D->getUsingLoc());
1484 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1485 Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1486 Record.AddSourceLocation(D->getEllipsisLoc());
1488}
1489
1492 VisitTypeDecl(D);
1493 Record.AddSourceLocation(D->getTypenameLoc());
1494 Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1495 Record.AddSourceLocation(D->getEllipsisLoc());
1497}
1498
1501 VisitNamedDecl(D);
1503}
1504
1506 VisitRecordDecl(D);
1507
1508 enum {
1509 CXXRecNotTemplate = 0,
1510 CXXRecTemplate,
1511 CXXRecMemberSpecialization,
1512 CXXLambda
1513 };
1514 if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1515 Record.push_back(CXXRecTemplate);
1516 Record.AddDeclRef(TemplD);
1517 } else if (MemberSpecializationInfo *MSInfo
1519 Record.push_back(CXXRecMemberSpecialization);
1520 Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1521 Record.push_back(MSInfo->getTemplateSpecializationKind());
1522 Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1523 } else if (D->isLambda()) {
1524 // For a lambda, we need some information early for merging.
1525 Record.push_back(CXXLambda);
1526 if (auto *Context = D->getLambdaContextDecl()) {
1527 Record.AddDeclRef(Context);
1528 Record.push_back(D->getLambdaIndexInContext());
1529 } else {
1530 Record.push_back(0);
1531 }
1532 } else {
1533 Record.push_back(CXXRecNotTemplate);
1534 }
1535
1536 Record.push_back(D->isThisDeclarationADefinition());
1538 Record.AddCXXDefinitionData(D);
1539
1540 // Store (what we currently believe to be) the key function to avoid
1541 // deserializing every method so we can compute it.
1542 if (D->isCompleteDefinition())
1543 Record.AddDeclRef(Context.getCurrentKeyFunction(D));
1544
1546}
1547
1550 if (D->isCanonicalDecl()) {
1551 Record.push_back(D->size_overridden_methods());
1552 for (const CXXMethodDecl *MD : D->overridden_methods())
1553 Record.AddDeclRef(MD);
1554 } else {
1555 // We only need to record overridden methods once for the canonical decl.
1556 Record.push_back(0);
1557 }
1558
1559 if (D->getDeclContext() == D->getLexicalDeclContext() &&
1560 D->getFirstDecl() == D->getMostRecentDecl() && !D->isInvalidDecl() &&
1561 !D->hasAttrs() && !D->isTopLevelDeclInObjCContainer() &&
1563 !shouldSkipCheckingODR(D) && !D->hasExtInfo() &&
1564 !D->isExplicitlyDefaulted()) {
1569 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1570 else if (D->getTemplatedKind() ==
1574
1575 if (FTSInfo->TemplateArguments->size() == 1) {
1576 const TemplateArgument &TA = FTSInfo->TemplateArguments->get(0);
1577 if (TA.getKind() == TemplateArgument::Type &&
1578 !FTSInfo->TemplateArgumentsAsWritten &&
1579 !FTSInfo->getMemberSpecializationInfo())
1580 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1581 }
1582 } else if (D->getTemplatedKind() ==
1586 if (!DFTSInfo->TemplateArgumentsAsWritten)
1587 AbbrevToUse = Writer.getDeclCXXMethodAbbrev(D->getTemplatedKind());
1588 }
1589 }
1590
1592}
1593
1595 static_assert(DeclContext::NumCXXConstructorDeclBits == 64,
1596 "You need to update the serializer after you change the "
1597 "CXXConstructorDeclBits");
1598
1599 Record.push_back(D->getTrailingAllocKind());
1601 if (auto Inherited = D->getInheritedConstructor()) {
1602 Record.AddDeclRef(Inherited.getShadowDecl());
1603 Record.AddDeclRef(Inherited.getConstructor());
1604 }
1605
1608}
1609
1612
1613 Record.AddDeclRef(D->getOperatorDelete());
1614 if (D->getOperatorDelete())
1615 Record.AddStmt(D->getOperatorDeleteThisArg());
1616
1618}
1619
1624}
1625
1627 VisitDecl(D);
1628 Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1629 ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1630 Record.push_back(!IdentifierLocs.empty());
1631 if (IdentifierLocs.empty()) {
1632 Record.AddSourceLocation(D->getEndLoc());
1633 Record.push_back(1);
1634 } else {
1635 for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1636 Record.AddSourceLocation(IdentifierLocs[I]);
1637 Record.push_back(IdentifierLocs.size());
1638 }
1639 // Note: the number of source locations must always be the last element in
1640 // the record.
1642}
1643
1645 VisitDecl(D);
1646 Record.AddSourceLocation(D->getColonLoc());
1648}
1649
1651 // Record the number of friend type template parameter lists here
1652 // so as to simplify memory allocation during deserialization.
1653 Record.push_back(D->NumTPLists);
1654 VisitDecl(D);
1655 bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1656 Record.push_back(hasFriendDecl);
1657 if (hasFriendDecl)
1658 Record.AddDeclRef(D->getFriendDecl());
1659 else
1660 Record.AddTypeSourceInfo(D->getFriendType());
1661 for (unsigned i = 0; i < D->NumTPLists; ++i)
1662 Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1663 Record.AddDeclRef(D->getNextFriend());
1664 Record.push_back(D->UnsupportedFriend);
1665 Record.AddSourceLocation(D->FriendLoc);
1667}
1668
1670 VisitDecl(D);
1671 Record.push_back(D->getNumTemplateParameters());
1672 for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1673 Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1674 Record.push_back(D->getFriendDecl() != nullptr);
1675 if (D->getFriendDecl())
1676 Record.AddDeclRef(D->getFriendDecl());
1677 else
1678 Record.AddTypeSourceInfo(D->getFriendType());
1679 Record.AddSourceLocation(D->getFriendLoc());
1681}
1682
1684 VisitNamedDecl(D);
1685
1686 Record.AddTemplateParameterList(D->getTemplateParameters());
1687 Record.AddDeclRef(D->getTemplatedDecl());
1688}
1689
1692 Record.AddStmt(D->getConstraintExpr());
1694}
1695
1698 Record.push_back(D->getTemplateArguments().size());
1699 VisitDecl(D);
1700 for (const TemplateArgument &Arg : D->getTemplateArguments())
1701 Record.AddTemplateArgument(Arg);
1703}
1704
1707}
1708
1711
1712 // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1713 // getCommonPtr() can be used while this is still initializing.
1714 if (D->isFirstDecl()) {
1715 // This declaration owns the 'common' pointer, so serialize that data now.
1718 Record.push_back(D->isMemberSpecialization());
1719 }
1720
1722 Record.push_back(D->getIdentifierNamespace());
1723}
1724
1727
1728 if (D->isFirstDecl())
1730
1731 // Force emitting the corresponding deduction guide in reduced BMI mode.
1732 // Otherwise, the deduction guide may be optimized out incorrectly.
1733 if (Writer.isGeneratingReducedBMI()) {
1734 auto Name = Context.DeclarationNames.getCXXDeductionGuideName(D);
1735 for (auto *DG : D->getDeclContext()->noload_lookup(Name))
1736 Writer.GetDeclRef(DG);
1737 }
1738
1740}
1741
1745
1747
1748 llvm::PointerUnion<ClassTemplateDecl *,
1751 if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1752 Record.AddDeclRef(InstFromD);
1753 } else {
1754 Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1755 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1756 }
1757
1758 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1759 Record.AddSourceLocation(D->getPointOfInstantiation());
1760 Record.push_back(D->getSpecializationKind());
1761 Record.push_back(D->isCanonicalDecl());
1762
1763 if (D->isCanonicalDecl()) {
1764 // When reading, we'll add it to the folding set of the following template.
1766 }
1767
1768 bool ExplicitInstantiation =
1772 Record.push_back(ExplicitInstantiation);
1773 if (ExplicitInstantiation) {
1774 Record.AddSourceLocation(D->getExternKeywordLoc());
1775 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1776 }
1777
1778 const ASTTemplateArgumentListInfo *ArgsWritten =
1780 Record.push_back(!!ArgsWritten);
1781 if (ArgsWritten)
1782 Record.AddASTTemplateArgumentListInfo(ArgsWritten);
1783
1785}
1786
1789 Record.AddTemplateParameterList(D->getTemplateParameters());
1790
1792
1793 // These are read/set from/to the first declaration.
1794 if (D->getPreviousDecl() == nullptr) {
1795 Record.AddDeclRef(D->getInstantiatedFromMember());
1796 Record.push_back(D->isMemberSpecialization());
1797 }
1798
1800}
1801
1804
1805 if (D->isFirstDecl())
1808}
1809
1813
1814 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1815 InstFrom = D->getSpecializedTemplateOrPartial();
1816 if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1817 Record.AddDeclRef(InstFromD);
1818 } else {
1819 Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1820 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1821 }
1822
1823 bool ExplicitInstantiation =
1827 Record.push_back(ExplicitInstantiation);
1828 if (ExplicitInstantiation) {
1829 Record.AddSourceLocation(D->getExternKeywordLoc());
1830 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1831 }
1832
1833 const ASTTemplateArgumentListInfo *ArgsWritten =
1835 Record.push_back(!!ArgsWritten);
1836 if (ArgsWritten)
1837 Record.AddASTTemplateArgumentListInfo(ArgsWritten);
1838
1839 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1840 Record.AddSourceLocation(D->getPointOfInstantiation());
1841 Record.push_back(D->getSpecializationKind());
1842 Record.push_back(D->IsCompleteDefinition);
1843
1844 VisitVarDecl(D);
1845
1846 Record.push_back(D->isCanonicalDecl());
1847
1848 if (D->isCanonicalDecl()) {
1849 // When reading, we'll add it to the folding set of the following template.
1851 }
1852
1854}
1855
1858 Record.AddTemplateParameterList(D->getTemplateParameters());
1859
1861
1862 // These are read/set from/to the first declaration.
1863 if (D->getPreviousDecl() == nullptr) {
1864 Record.AddDeclRef(D->getInstantiatedFromMember());
1865 Record.push_back(D->isMemberSpecialization());
1866 }
1867
1869}
1870
1873
1874 if (D->isFirstDecl())
1877}
1878
1880 Record.push_back(D->hasTypeConstraint());
1881 VisitTypeDecl(D);
1882
1883 Record.push_back(D->wasDeclaredWithTypename());
1884
1885 const TypeConstraint *TC = D->getTypeConstraint();
1886 assert((bool)TC == D->hasTypeConstraint());
1887 if (TC) {
1888 auto *CR = TC->getConceptReference();
1889 Record.push_back(CR != nullptr);
1890 if (CR)
1891 Record.AddConceptReference(CR);
1893 Record.push_back(D->isExpandedParameterPack());
1894 if (D->isExpandedParameterPack())
1895 Record.push_back(D->getNumExpansionParameters());
1896 }
1897
1898 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1900 Record.push_back(OwnsDefaultArg);
1901 if (OwnsDefaultArg)
1902 Record.AddTypeSourceInfo(D->getDefaultArgumentInfo());
1903
1904 if (!TC && !OwnsDefaultArg &&
1906 !D->isInvalidDecl() && !D->hasAttrs() &&
1909 AbbrevToUse = Writer.getDeclTemplateTypeParmAbbrev();
1910
1912}
1913
1915 // For an expanded parameter pack, record the number of expansion types here
1916 // so that it's easier for deserialization to allocate the right amount of
1917 // memory.
1919 Record.push_back(!!TypeConstraint);
1920 if (D->isExpandedParameterPack())
1921 Record.push_back(D->getNumExpansionTypes());
1922
1924 // TemplateParmPosition.
1925 Record.push_back(D->getDepth());
1926 Record.push_back(D->getPosition());
1927 if (TypeConstraint)
1928 Record.AddStmt(TypeConstraint);
1929
1930 if (D->isExpandedParameterPack()) {
1931 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1932 Record.AddTypeRef(D->getExpansionType(I));
1933 Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
1934 }
1935
1937 } else {
1938 // Rest of NonTypeTemplateParmDecl.
1939 Record.push_back(D->isParameterPack());
1940 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1942 Record.push_back(OwnsDefaultArg);
1943 if (OwnsDefaultArg)
1944 Record.AddStmt(D->getDefaultArgument());
1946 }
1947}
1948
1950 // For an expanded parameter pack, record the number of expansion types here
1951 // so that it's easier for deserialization to allocate the right amount of
1952 // memory.
1953 if (D->isExpandedParameterPack())
1955
1957 Record.push_back(D->wasDeclaredWithTypename());
1958 // TemplateParmPosition.
1959 Record.push_back(D->getDepth());
1960 Record.push_back(D->getPosition());
1961
1962 if (D->isExpandedParameterPack()) {
1963 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1964 I != N; ++I)
1965 Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
1967 } else {
1968 // Rest of TemplateTemplateParmDecl.
1969 Record.push_back(D->isParameterPack());
1970 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1972 Record.push_back(OwnsDefaultArg);
1973 if (OwnsDefaultArg)
1974 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
1976 }
1977}
1978
1982}
1983
1985 VisitDecl(D);
1986 Record.AddStmt(D->getAssertExpr());
1987 Record.push_back(D->isFailed());
1988 Record.AddStmt(D->getMessage());
1989 Record.AddSourceLocation(D->getRParenLoc());
1991}
1992
1993/// Emit the DeclContext part of a declaration context decl.
1995 static_assert(DeclContext::NumDeclContextBits == 13,
1996 "You need to update the serializer after you change the "
1997 "DeclContextBits");
1998
1999 uint64_t LexicalOffset = 0;
2000 uint64_t VisibleOffset = 0;
2001
2002 if (Writer.isGeneratingReducedBMI() && isa<NamespaceDecl>(DC) &&
2003 cast<NamespaceDecl>(DC)->isFromExplicitGlobalModule()) {
2004 // In reduced BMI, delay writing lexical and visible block for namespace
2005 // in the global module fragment. See the comments of DelayedNamespace for
2006 // details.
2007 Writer.DelayedNamespace.push_back(cast<NamespaceDecl>(DC));
2008 } else {
2009 LexicalOffset = Writer.WriteDeclContextLexicalBlock(Context, DC);
2010 VisibleOffset = Writer.WriteDeclContextVisibleBlock(Context, DC);
2011 }
2012
2013 Record.AddOffset(LexicalOffset);
2014 Record.AddOffset(VisibleOffset);
2015}
2016
2018 assert(IsLocalDecl(D) && "expected a local declaration");
2019
2020 const Decl *Canon = D->getCanonicalDecl();
2021 if (IsLocalDecl(Canon))
2022 return Canon;
2023
2024 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
2025 if (CacheEntry)
2026 return CacheEntry;
2027
2028 for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
2029 if (IsLocalDecl(Redecl))
2030 D = Redecl;
2031 return CacheEntry = D;
2032}
2033
2034template <typename T>
2036 T *First = D->getFirstDecl();
2037 T *MostRecent = First->getMostRecentDecl();
2038 T *DAsT = static_cast<T *>(D);
2039 if (MostRecent != First) {
2040 assert(isRedeclarableDeclKind(DAsT->getKind()) &&
2041 "Not considered redeclarable?");
2042
2043 Record.AddDeclRef(First);
2044
2045 // Write out a list of local redeclarations of this declaration if it's the
2046 // first local declaration in the chain.
2047 const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
2048 if (DAsT == FirstLocal) {
2049 // Emit a list of all imported first declarations so that we can be sure
2050 // that all redeclarations visible to this module are before D in the
2051 // redecl chain.
2052 unsigned I = Record.size();
2053 Record.push_back(0);
2054 if (Writer.Chain)
2055 AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
2056 // This is the number of imported first declarations + 1.
2057 Record[I] = Record.size() - I;
2058
2059 // Collect the set of local redeclarations of this declaration, from
2060 // newest to oldest.
2061 ASTWriter::RecordData LocalRedecls;
2062 ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
2063 for (const Decl *Prev = FirstLocal->getMostRecentDecl();
2064 Prev != FirstLocal; Prev = Prev->getPreviousDecl())
2065 if (!Prev->isFromASTFile())
2066 LocalRedeclWriter.AddDeclRef(Prev);
2067
2068 // If we have any redecls, write them now as a separate record preceding
2069 // the declaration itself.
2070 if (LocalRedecls.empty())
2071 Record.push_back(0);
2072 else
2073 Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
2074 } else {
2075 Record.push_back(0);
2076 Record.AddDeclRef(FirstLocal);
2077 }
2078
2079 // Make sure that we serialize both the previous and the most-recent
2080 // declarations, which (transitively) ensures that all declarations in the
2081 // chain get serialized.
2082 //
2083 // FIXME: This is not correct; when we reach an imported declaration we
2084 // won't emit its previous declaration.
2085 (void)Writer.GetDeclRef(D->getPreviousDecl());
2086 (void)Writer.GetDeclRef(MostRecent);
2087 } else {
2088 // We use the sentinel value 0 to indicate an only declaration.
2089 Record.push_back(0);
2090 }
2091}
2092
2094 VisitNamedDecl(D);
2096 Record.push_back(D->isCBuffer());
2097 Record.AddSourceLocation(D->getLocStart());
2098 Record.AddSourceLocation(D->getLBraceLoc());
2099 Record.AddSourceLocation(D->getRBraceLoc());
2100
2102}
2103
2105 Record.writeOMPChildren(D->Data);
2106 VisitDecl(D);
2108}
2109
2111 Record.writeOMPChildren(D->Data);
2112 VisitDecl(D);
2114}
2115
2117 Record.writeOMPChildren(D->Data);
2118 VisitDecl(D);
2120}
2121
2123 static_assert(DeclContext::NumOMPDeclareReductionDeclBits == 15,
2124 "You need to update the serializer after you change the "
2125 "NumOMPDeclareReductionDeclBits");
2126
2127 VisitValueDecl(D);
2128 Record.AddSourceLocation(D->getBeginLoc());
2129 Record.AddStmt(D->getCombinerIn());
2130 Record.AddStmt(D->getCombinerOut());
2131 Record.AddStmt(D->getCombiner());
2132 Record.AddStmt(D->getInitOrig());
2133 Record.AddStmt(D->getInitPriv());
2134 Record.AddStmt(D->getInitializer());
2135 Record.push_back(llvm::to_underlying(D->getInitializerKind()));
2136 Record.AddDeclRef(D->getPrevDeclInScope());
2138}
2139
2141 Record.writeOMPChildren(D->Data);
2142 VisitValueDecl(D);
2143 Record.AddDeclarationName(D->getVarName());
2144 Record.AddDeclRef(D->getPrevDeclInScope());
2146}
2147
2149 VisitVarDecl(D);
2151}
2152
2153//===----------------------------------------------------------------------===//
2154// ASTWriter Implementation
2155//===----------------------------------------------------------------------===//
2156
2157namespace {
2158template <FunctionDecl::TemplatedKind Kind>
2159std::shared_ptr<llvm::BitCodeAbbrev>
2160getFunctionDeclAbbrev(serialization::DeclCode Code) {
2161 using namespace llvm;
2162
2163 auto Abv = std::make_shared<BitCodeAbbrev>();
2164 Abv->Add(BitCodeAbbrevOp(Code));
2165 // RedeclarableDecl
2166 Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2167 Abv->Add(BitCodeAbbrevOp(Kind));
2168 if constexpr (Kind == FunctionDecl::TK_NonTemplate) {
2169
2170 } else if constexpr (Kind == FunctionDecl::TK_FunctionTemplate) {
2171 // DescribedFunctionTemplate
2172 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2173 } else if constexpr (Kind == FunctionDecl::TK_DependentNonTemplate) {
2174 // Instantiated From Decl
2175 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2176 } else if constexpr (Kind == FunctionDecl::TK_MemberSpecialization) {
2177 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedFrom
2178 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2179 3)); // TemplateSpecializationKind
2180 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Specialized Location
2181 } else if constexpr (Kind ==
2183 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template
2184 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2185 3)); // TemplateSpecializationKind
2186 Abv->Add(BitCodeAbbrevOp(1)); // Template Argument Size
2187 Abv->Add(BitCodeAbbrevOp(TemplateArgument::Type)); // Template Argument Kind
2188 Abv->Add(
2189 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template Argument Type
2190 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Is Defaulted
2191 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2192 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2193 Abv->Add(BitCodeAbbrevOp(0));
2194 Abv->Add(
2195 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Canonical Decl of template
2196 } else if constexpr (Kind == FunctionDecl::
2198 // Candidates of specialization
2199 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2200 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2201 } else {
2202 llvm_unreachable("Unknown templated kind?");
2203 }
2204 // Decl
2205 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2206 8)); // Packed DeclBits: ModuleOwnershipKind,
2207 // isUsed, isReferenced, AccessSpecifier,
2208 // isImplicit
2209 //
2210 // The following bits should be 0:
2211 // HasStandaloneLexicalDC, HasAttrs,
2212 // TopLevelDeclInObjCContainer,
2213 // isInvalidDecl
2214 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2215 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2216 // NamedDecl
2217 Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2218 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2219 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2220 // ValueDecl
2221 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2222 // DeclaratorDecl
2223 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2224 Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2225 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2226 // FunctionDecl
2227 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2228 Abv->Add(BitCodeAbbrevOp(
2229 BitCodeAbbrevOp::Fixed,
2230 28)); // Packed Function Bits: StorageClass, Inline, InlineSpecified,
2231 // VirtualAsWritten, Pure, HasInheritedProto, HasWrittenProto,
2232 // Deleted, Trivial, TrivialForCall, Defaulted, ExplicitlyDefaulted,
2233 // IsIneligibleOrNotSelected, ImplicitReturnZero, Constexpr,
2234 // UsesSEHTry, SkippedBody, MultiVersion, LateParsed,
2235 // FriendConstraintRefersToEnclosingTemplate, Linkage,
2236 // ShouldSkipCheckingODR
2237 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2238 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2239 // This Array slurps the rest of the record. Fortunately we want to encode
2240 // (nearly) all the remaining (variable number of) fields in the same way.
2241 //
2242 // This is:
2243 // NumParams and Params[] from FunctionDecl, and
2244 // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2245 //
2246 // Add an AbbrevOp for 'size then elements' and use it here.
2247 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2248 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2249 return Abv;
2250}
2251
2252template <FunctionDecl::TemplatedKind Kind>
2253std::shared_ptr<llvm::BitCodeAbbrev> getCXXMethodAbbrev() {
2254 return getFunctionDeclAbbrev<Kind>(serialization::DECL_CXX_METHOD);
2255}
2256} // namespace
2257
2258void ASTWriter::WriteDeclAbbrevs() {
2259 using namespace llvm;
2260
2261 std::shared_ptr<BitCodeAbbrev> Abv;
2262
2263 // Abbreviation for DECL_FIELD
2264 Abv = std::make_shared<BitCodeAbbrev>();
2265 Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
2266 // Decl
2267 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2268 7)); // Packed DeclBits: ModuleOwnershipKind,
2269 // isUsed, isReferenced, AccessSpecifier,
2270 //
2271 // The following bits should be 0:
2272 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2273 // TopLevelDeclInObjCContainer,
2274 // isInvalidDecl
2275 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2276 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2277 // NamedDecl
2278 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2279 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2280 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2281 // ValueDecl
2282 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2283 // DeclaratorDecl
2284 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2285 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2286 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2287 // FieldDecl
2288 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2289 Abv->Add(BitCodeAbbrevOp(0)); // StorageKind
2290 // Type Source Info
2291 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2292 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2293 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
2294
2295 // Abbreviation for DECL_OBJC_IVAR
2296 Abv = std::make_shared<BitCodeAbbrev>();
2297 Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
2298 // Decl
2299 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2300 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2301 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2302 // isReferenced, TopLevelDeclInObjCContainer,
2303 // AccessSpecifier, ModuleOwnershipKind
2304 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2305 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2306 // NamedDecl
2307 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2308 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2309 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2310 // ValueDecl
2311 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2312 // DeclaratorDecl
2313 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2314 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2315 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2316 // FieldDecl
2317 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2318 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2319 // ObjC Ivar
2320 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
2321 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
2322 // Type Source Info
2323 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2324 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2325 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2326
2327 // Abbreviation for DECL_ENUM
2328 Abv = std::make_shared<BitCodeAbbrev>();
2329 Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
2330 // Redeclarable
2331 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2332 // Decl
2333 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2334 7)); // Packed DeclBits: ModuleOwnershipKind,
2335 // isUsed, isReferenced, AccessSpecifier,
2336 //
2337 // The following bits should be 0:
2338 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2339 // TopLevelDeclInObjCContainer,
2340 // isInvalidDecl
2341 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2342 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2343 // NamedDecl
2344 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2345 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2346 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2347 // TypeDecl
2348 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2349 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2350 // TagDecl
2351 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2352 Abv->Add(BitCodeAbbrevOp(
2353 BitCodeAbbrevOp::Fixed,
2354 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2355 // EmbeddedInDeclarator, IsFreeStanding,
2356 // isCompleteDefinitionRequired, ExtInfoKind
2357 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2358 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2359 // EnumDecl
2360 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
2361 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
2362 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
2363 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 20)); // Enum Decl Bits
2364 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
2365 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
2366 // DC
2367 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2368 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2369 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2370
2371 // Abbreviation for DECL_RECORD
2372 Abv = std::make_shared<BitCodeAbbrev>();
2373 Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
2374 // Redeclarable
2375 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2376 // Decl
2377 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2378 7)); // Packed DeclBits: ModuleOwnershipKind,
2379 // isUsed, isReferenced, AccessSpecifier,
2380 //
2381 // The following bits should be 0:
2382 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2383 // TopLevelDeclInObjCContainer,
2384 // isInvalidDecl
2385 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2386 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2387 // NamedDecl
2388 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2389 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2390 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2391 // TypeDecl
2392 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2393 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2394 // TagDecl
2395 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2396 Abv->Add(BitCodeAbbrevOp(
2397 BitCodeAbbrevOp::Fixed,
2398 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2399 // EmbeddedInDeclarator, IsFreeStanding,
2400 // isCompleteDefinitionRequired, ExtInfoKind
2401 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2402 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2403 // RecordDecl
2404 Abv->Add(BitCodeAbbrevOp(
2405 BitCodeAbbrevOp::Fixed,
2406 13)); // Packed Record Decl Bits: FlexibleArrayMember,
2407 // AnonymousStructUnion, hasObjectMember, hasVolatileMember,
2408 // isNonTrivialToPrimitiveDefaultInitialize,
2409 // isNonTrivialToPrimitiveCopy, isNonTrivialToPrimitiveDestroy,
2410 // hasNonTrivialToPrimitiveDefaultInitializeCUnion,
2411 // hasNonTrivialToPrimitiveDestructCUnion,
2412 // hasNonTrivialToPrimitiveCopyCUnion, isParamDestroyedInCallee,
2413 // getArgPassingRestrictions
2414 // ODRHash
2415 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));
2416
2417 // DC
2418 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2419 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2420 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2421
2422 // Abbreviation for DECL_PARM_VAR
2423 Abv = std::make_shared<BitCodeAbbrev>();
2424 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2425 // Redeclarable
2426 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2427 // Decl
2428 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2429 8)); // Packed DeclBits: ModuleOwnershipKind, isUsed,
2430 // isReferenced, AccessSpecifier,
2431 // HasStandaloneLexicalDC, HasAttrs, isImplicit,
2432 // TopLevelDeclInObjCContainer,
2433 // isInvalidDecl,
2434 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2435 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2436 // NamedDecl
2437 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2438 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2439 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2440 // ValueDecl
2441 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2442 // DeclaratorDecl
2443 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2444 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2445 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2446 // VarDecl
2447 Abv->Add(
2448 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2449 12)); // Packed Var Decl bits: SClass, TSCSpec, InitStyle,
2450 // isARCPseudoStrong, Linkage, ModulesCodegen
2451 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2452 // ParmVarDecl
2453 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2454 Abv->Add(BitCodeAbbrevOp(
2455 BitCodeAbbrevOp::Fixed,
2456 19)); // Packed Parm Var Decl bits: IsObjCMethodParameter, ScopeDepth,
2457 // ObjCDeclQualifier, KNRPromoted,
2458 // HasInheritedDefaultArg, HasUninstantiatedDefaultArg
2459 // Type Source Info
2460 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2461 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2462 DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2463
2464 // Abbreviation for DECL_TYPEDEF
2465 Abv = std::make_shared<BitCodeAbbrev>();
2466 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2467 // Redeclarable
2468 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2469 // Decl
2470 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2471 7)); // Packed DeclBits: ModuleOwnershipKind,
2472 // isReferenced, isUsed, AccessSpecifier. Other
2473 // higher bits should be 0: isImplicit,
2474 // HasStandaloneLexicalDC, HasAttrs,
2475 // TopLevelDeclInObjCContainer, isInvalidDecl
2476 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2477 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2478 // NamedDecl
2479 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2480 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2481 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2482 // TypeDecl
2483 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2484 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2485 // TypedefDecl
2486 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2487 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2488 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2489
2490 // Abbreviation for DECL_VAR
2491 Abv = std::make_shared<BitCodeAbbrev>();
2492 Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2493 // Redeclarable
2494 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2495 // Decl
2496 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2497 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2498 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2499 // isReferenced, TopLevelDeclInObjCContainer,
2500 // AccessSpecifier, ModuleOwnershipKind
2501 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2502 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2503 // NamedDecl
2504 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2505 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2506 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2507 // ValueDecl
2508 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2509 // DeclaratorDecl
2510 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2511 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2512 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2513 // VarDecl
2514 Abv->Add(BitCodeAbbrevOp(
2515 BitCodeAbbrevOp::Fixed,
2516 21)); // Packed Var Decl bits: Linkage, ModulesCodegen,
2517 // SClass, TSCSpec, InitStyle,
2518 // isARCPseudoStrong, IsThisDeclarationADemotedDefinition,
2519 // isExceptionVariable, isNRVOVariable, isCXXForRangeDecl,
2520 // isInline, isInlineSpecified, isConstexpr,
2521 // isInitCapture, isPrevDeclInSameScope,
2522 // EscapingByref, HasDeducedType, ImplicitParamKind, isObjCForDecl
2523 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2524 // Type Source Info
2525 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2526 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2527 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2528
2529 // Abbreviation for DECL_CXX_METHOD
2530 DeclCXXMethodAbbrev =
2531 Stream.EmitAbbrev(getCXXMethodAbbrev<FunctionDecl::TK_NonTemplate>());
2532 DeclTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2533 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplate>());
2534 DeclDependentNonTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2535 getCXXMethodAbbrev<FunctionDecl::TK_DependentNonTemplate>());
2536 DeclMemberSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2537 getCXXMethodAbbrev<FunctionDecl::TK_MemberSpecialization>());
2538 DeclTemplateSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2539 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplateSpecialization>());
2540 DeclDependentSpecializationCXXMethodAbbrev = Stream.EmitAbbrev(
2541 getCXXMethodAbbrev<
2543
2544 // Abbreviation for DECL_TEMPLATE_TYPE_PARM
2545 Abv = std::make_shared<BitCodeAbbrev>();
2546 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TEMPLATE_TYPE_PARM));
2547 Abv->Add(BitCodeAbbrevOp(0)); // hasTypeConstraint
2548 // Decl
2549 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2550 7)); // Packed DeclBits: ModuleOwnershipKind,
2551 // isReferenced, isUsed, AccessSpecifier. Other
2552 // higher bits should be 0: isImplicit,
2553 // HasStandaloneLexicalDC, HasAttrs,
2554 // TopLevelDeclInObjCContainer, isInvalidDecl
2555 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2556 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2557 // NamedDecl
2558 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2559 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2560 Abv->Add(BitCodeAbbrevOp(0));
2561 // TypeDecl
2562 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2563 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2564 // TemplateTypeParmDecl
2565 Abv->Add(
2566 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // wasDeclaredWithTypename
2567 Abv->Add(BitCodeAbbrevOp(0)); // OwnsDefaultArg
2568 DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));
2569
2570 // Abbreviation for DECL_USING_SHADOW
2571 Abv = std::make_shared<BitCodeAbbrev>();
2572 Abv->Add(BitCodeAbbrevOp(serialization::DECL_USING_SHADOW));
2573 // Redeclarable
2574 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2575 // Decl
2576 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2577 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2578 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2579 // isReferenced, TopLevelDeclInObjCContainer,
2580 // AccessSpecifier, ModuleOwnershipKind
2581 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2582 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2583 // NamedDecl
2584 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2585 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2586 Abv->Add(BitCodeAbbrevOp(0));
2587 // UsingShadowDecl
2588 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TargetDecl
2589 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2590 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // UsingOrNextShadow
2591 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR,
2592 6)); // InstantiatedFromUsingShadowDecl
2593 DeclUsingShadowAbbrev = Stream.EmitAbbrev(std::move(Abv));
2594
2595 // Abbreviation for EXPR_DECL_REF
2596 Abv = std::make_shared<BitCodeAbbrev>();
2597 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2598 // Stmt
2599 // Expr
2600 // PackingBits: DependenceKind, ValueKind. ObjectKind should be 0.
2601 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
2602 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2603 // DeclRefExpr
2604 // Packing Bits: , HadMultipleCandidates, RefersToEnclosingVariableOrCapture,
2605 // IsImmediateEscalating, NonOdrUseReason.
2606 // GetDeclFound, HasQualifier and ExplicitTemplateArgs should be 0.
2607 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2608 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2609 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2610 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2611
2612 // Abbreviation for EXPR_INTEGER_LITERAL
2613 Abv = std::make_shared<BitCodeAbbrev>();
2614 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2615 //Stmt
2616 // Expr
2617 // DependenceKind, ValueKind, ObjectKind
2618 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2619 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2620 // Integer Literal
2621 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2622 Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2623 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2624 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2625
2626 // Abbreviation for EXPR_CHARACTER_LITERAL
2627 Abv = std::make_shared<BitCodeAbbrev>();
2628 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2629 //Stmt
2630 // Expr
2631 // DependenceKind, ValueKind, ObjectKind
2632 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2633 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2634 // Character Literal
2635 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2636 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2637 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2638 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2639
2640 // Abbreviation for EXPR_IMPLICIT_CAST
2641 Abv = std::make_shared<BitCodeAbbrev>();
2642 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2643 // Stmt
2644 // Expr
2645 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2646 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2647 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2648 // CastExpr
2649 Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2650 // Packing Bits: CastKind, StoredFPFeatures, isPartOfExplicitCast
2651 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 9));
2652 // ImplicitCastExpr
2653 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2654
2655 // Abbreviation for EXPR_BINARY_OPERATOR
2656 Abv = std::make_shared<BitCodeAbbrev>();
2657 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_BINARY_OPERATOR));
2658 // Stmt
2659 // Expr
2660 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2661 // be 0 in this case.
2662 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2663 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2664 // BinaryOperator
2665 Abv->Add(
2666 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2667 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2668 BinaryOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2669
2670 // Abbreviation for EXPR_COMPOUND_ASSIGN_OPERATOR
2671 Abv = std::make_shared<BitCodeAbbrev>();
2672 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_COMPOUND_ASSIGN_OPERATOR));
2673 // Stmt
2674 // Expr
2675 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2676 // be 0 in this case.
2677 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2678 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2679 // BinaryOperator
2680 // Packing Bits: OpCode. The HasFPFeatures bit should be 0
2681 Abv->Add(
2682 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2683 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2684 // CompoundAssignOperator
2685 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHSType
2686 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Result Type
2687 CompoundAssignOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2688
2689 // Abbreviation for EXPR_CALL
2690 Abv = std::make_shared<BitCodeAbbrev>();
2691 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CALL));
2692 // Stmt
2693 // Expr
2694 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2695 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2696 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2697 // CallExpr
2698 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2699 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2700 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2701 CallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2702
2703 // Abbreviation for EXPR_CXX_OPERATOR_CALL
2704 Abv = std::make_shared<BitCodeAbbrev>();
2705 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_OPERATOR_CALL));
2706 // Stmt
2707 // Expr
2708 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2709 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2710 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2711 // CallExpr
2712 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2713 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2714 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2715 // CXXOperatorCallExpr
2716 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Operator Kind
2717 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2718 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2719 CXXOperatorCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2720
2721 // Abbreviation for EXPR_CXX_MEMBER_CALL
2722 Abv = std::make_shared<BitCodeAbbrev>();
2723 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_MEMBER_CALL));
2724 // Stmt
2725 // Expr
2726 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2727 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2728 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2729 // CallExpr
2730 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2731 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2732 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2733 // CXXMemberCallExpr
2734 CXXMemberCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2735
2736 // Abbreviation for STMT_COMPOUND
2737 Abv = std::make_shared<BitCodeAbbrev>();
2738 Abv->Add(BitCodeAbbrevOp(serialization::STMT_COMPOUND));
2739 // Stmt
2740 // CompoundStmt
2741 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Num Stmts
2742 Abv->Add(BitCodeAbbrevOp(0)); // hasStoredFPFeatures
2743 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2744 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2745 CompoundStmtAbbrev = Stream.EmitAbbrev(std::move(Abv));
2746
2747 Abv = std::make_shared<BitCodeAbbrev>();
2748 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2749 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2750 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2751
2752 Abv = std::make_shared<BitCodeAbbrev>();
2753 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2754 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2755 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2756}
2757
2758/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2759/// consumers of the AST.
2760///
2761/// Such decls will always be deserialized from the AST file, so we would like
2762/// this to be as restrictive as possible. Currently the predicate is driven by
2763/// code generation requirements, if other clients have a different notion of
2764/// what is "required" then we may have to consider an alternate scheme where
2765/// clients can iterate over the top-level decls and get information on them,
2766/// without necessary deserializing them. We could explicitly require such
2767/// clients to use a separate API call to "realize" the decl. This should be
2768/// relatively painless since they would presumably only do it for top-level
2769/// decls.
2770static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2771 Module *WritingModule) {
2772 // Named modules have different semantics than header modules. Every named
2773 // module units owns a translation unit. So the importer of named modules
2774 // doesn't need to deserilize everything ahead of time.
2775 if (WritingModule && WritingModule->isNamedModule()) {
2776 // The PragmaCommentDecl and PragmaDetectMismatchDecl are MSVC's extension.
2777 // And the behavior of MSVC for such cases will leak this to the module
2778 // users. Given pragma is not a standard thing, the compiler has the space
2779 // to do their own decision. Let's follow MSVC here.
2780 if (isa<PragmaCommentDecl, PragmaDetectMismatchDecl>(D))
2781 return true;
2782 return false;
2783 }
2784
2785 // An ObjCMethodDecl is never considered as "required" because its
2786 // implementation container always is.
2787
2788 // File scoped assembly or obj-c or OMP declare target implementation must be
2789 // seen.
2790 if (isa<FileScopeAsmDecl, TopLevelStmtDecl, ObjCImplDecl>(D))
2791 return true;
2792
2793 if (WritingModule && isPartOfPerModuleInitializer(D)) {
2794 // These declarations are part of the module initializer, and are emitted
2795 // if and when the module is imported, rather than being emitted eagerly.
2796 return false;
2797 }
2798
2799 return Context.DeclMustBeEmitted(D);
2800}
2801
2802void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2803 PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
2804 "serializing");
2805
2806 // Determine the ID for this declaration.
2808 assert(!D->isFromASTFile() && "should not be emitting imported decl");
2809 LocalDeclID &IDR = DeclIDs[D];
2810 if (IDR.isInvalid())
2811 IDR = NextDeclID++;
2812
2813 ID = IDR;
2814
2815 assert(ID >= FirstDeclID && "invalid decl ID");
2816
2818 ASTDeclWriter W(*this, Context, Record, GeneratingReducedBMI);
2819
2820 // Build a record for this declaration
2821 W.Visit(D);
2822
2823 // Emit this declaration to the bitstream.
2824 uint64_t Offset = W.Emit(D);
2825
2826 // Record the offset for this declaration
2829 getRawSourceLocationEncoding(getAdjustedLocation(Loc));
2830
2831 unsigned Index = ID.get() - FirstDeclID.get();
2832 if (DeclOffsets.size() == Index)
2833 DeclOffsets.emplace_back(RawLoc, Offset, DeclTypesBlockStartOffset);
2834 else if (DeclOffsets.size() < Index) {
2835 // FIXME: Can/should this happen?
2836 DeclOffsets.resize(Index+1);
2837 DeclOffsets[Index].setRawLoc(RawLoc);
2838 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);
2839 } else {
2840 llvm_unreachable("declarations should be emitted in ID order");
2841 }
2842
2843 SourceManager &SM = Context.getSourceManager();
2844 if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2845 associateDeclWithFile(D, ID);
2846
2847 // Note declarations that should be deserialized eagerly so that we can add
2848 // them to a record in the AST file later.
2849 if (isRequiredDecl(D, Context, WritingModule))
2850 AddDeclRef(D, EagerlyDeserializedDecls);
2851}
2852
2854 // Switch case IDs are per function body.
2855 Writer->ClearSwitchCaseIDs();
2856
2857 assert(FD->doesThisDeclarationHaveABody());
2858 bool ModulesCodegen = false;
2859 if (!FD->isDependentContext()) {
2860 std::optional<GVALinkage> Linkage;
2861 if (Writer->WritingModule &&
2862 Writer->WritingModule->isInterfaceOrPartition()) {
2863 // When building a C++20 module interface unit or a partition unit, a
2864 // strong definition in the module interface is provided by the
2865 // compilation of that unit, not by its users. (Inline functions are still
2866 // emitted in module users.)
2867 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2868 ModulesCodegen = *Linkage >= GVA_StrongExternal;
2869 }
2870 if (Writer->Context->getLangOpts().ModulesCodegen ||
2871 (FD->hasAttr<DLLExportAttr>() &&
2872 Writer->Context->getLangOpts().BuildingPCHWithObjectFile)) {
2873
2874 // Under -fmodules-codegen, codegen is performed for all non-internal,
2875 // non-always_inline functions, unless they are available elsewhere.
2876 if (!FD->hasAttr<AlwaysInlineAttr>()) {
2877 if (!Linkage)
2878 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2879 ModulesCodegen =
2881 }
2882 }
2883 }
2884 Record->push_back(ModulesCodegen);
2885 if (ModulesCodegen)
2886 Writer->AddDeclRef(FD, Writer->ModularCodegenDecls);
2887 if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2888 Record->push_back(CD->getNumCtorInitializers());
2889 if (CD->getNumCtorInitializers())
2890 AddCXXCtorInitializers(llvm::ArrayRef(CD->init_begin(), CD->init_end()));
2891 }
2892 AddStmt(FD->getBody());
2893}
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:83
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
llvm::MachO::Record Record
Definition: MachO.h:31
This file defines OpenMP AST classes for clauses.
SourceLocation Loc
Definition: SemaObjC.cpp:755
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:1189
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:7668
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:6471
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:90
unsigned getDeclParmVarAbbrev() const
Definition: ASTWriter.h:799
unsigned getDeclTemplateTypeParmAbbrev() const
Definition: ASTWriter.h:823
unsigned getDeclObjCIvarAbbrev() const
Definition: ASTWriter.h:805
unsigned getDeclTypedefAbbrev() const
Definition: ASTWriter.h:801
bool hasChain() const
Definition: ASTWriter.h:842
unsigned getDeclUsingShadowAbbrev() const
Definition: ASTWriter.h:826
bool isGeneratingReducedBMI() const
Definition: ASTWriter.h:849
unsigned getDeclVarAbbrev() const
Definition: ASTWriter.h:802
unsigned getDeclEnumAbbrev() const
Definition: ASTWriter.h:804
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:725
LocalDeclID GetDeclRef(const Decl *D)
Force a declaration to be emitted and get its local ID to the module file been writing.
Definition: ASTWriter.cpp:6136
unsigned getDeclCXXMethodAbbrev(FunctionDecl::TemplatedKind Kind) const
Definition: ASTWriter.h:806
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
SourceLocationEncoding::RawLocEncoding getRawSourceLocationEncoding(SourceLocation Loc, LocSeq *Seq=nullptr)
Return the raw encodings for source locations.
Definition: ASTWriter.cpp:5906
SmallVector< uint64_t, 64 > RecordData
Definition: ASTWriter.h:95
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
Definition: ASTWriter.cpp:6243
unsigned getDeclFieldAbbrev() const
Definition: ASTWriter.h:803
unsigned getDeclRecordAbbrev() const
Definition: ASTWriter.h:800
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
Definition: ASTWriter.cpp:6132
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:4107
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:4131
A simple helper class to pack several bits in order into (a) 32 bit integer(s).
Definition: ASTWriter.h:988
void addBit(bool Value)
Definition: ASTWriter.h:1008
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition: ASTWriter.h:1009
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4494
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition: Decl.h:4617
bool canAvoidCopyToHeap() const
Definition: Decl.h:4648
size_t param_size() const
Definition: Decl.h:4596
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:4573
ArrayRef< Capture > captures() const
Definition: Decl.h:4621
bool blockMissingReturnType() const
Definition: Decl.h:4629
bool capturesCXXThis() const
Definition: Decl.h:4626
bool doesNotEscape() const
Definition: Decl.h:4645
bool isConversionFromLambda() const
Definition: Decl.h:4637
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:4580
bool isVariadic() const
Definition: Decl.h:4569
TypeSourceInfo * getSignatureAsWritten() const
Definition: Decl.h:4577
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2535
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2606
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2772
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2862
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2889
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:1952
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:1987
DeductionCandidate getDeductionCandidateKind() const
Definition: DeclCXX.h:2006
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2799
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2832
Expr * getOperatorDeleteThisArg() const
Definition: DeclCXX.h:2836
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2060
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:2163
overridden_method_range overridden_methods() const
Definition: DeclCXX.cpp:2534
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:2528
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:1685
unsigned getLambdaIndexInContext() const
Retrieve the index of this lambda within the context declaration returned by getLambdaContextDecl().
Definition: DeclCXX.h:1792
bool isLambda() const
Determine whether this class describes a lambda function object.
Definition: DeclCXX.h:1022
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
Definition: DeclCXX.cpp:1905
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1897
static bool classofKind(Kind K)
Definition: DeclCXX.h:1889
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization,...
Definition: DeclCXX.cpp:1883
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:531
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4686
unsigned getNumParams() const
Definition: Decl.h:4728
unsigned getContextParamPosition() const
Definition: Decl.h:4757
bool isNothrow() const
Definition: Decl.cpp:5443
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4730
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() const
Determines whether this class template partial specialization template was a specialization of a memb...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a class template specialization, which refers to a class template with a given set of temp...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
SourceLocation getExternKeywordLoc() const
Gets the location of the extern keyword, if present.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3598
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:1436
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:2066
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:1282
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1938
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:1867
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1372
bool isInvalid() const
Definition: DeclID.h:125
DeclID get() const
Definition: DeclID.h:117
A helper iterator adaptor to convert the iterators to SmallVector<SomeDeclID> to the iterators to Sma...
Definition: DeclID.h:189
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:86
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration,...
Definition: DeclBase.h:1051
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition: DeclBase.h:1066
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:441
bool hasAttrs() const
Definition: DeclBase.h:524
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:599
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:866
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:974
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:833
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:776
bool isInvalidDecl() const
Definition: DeclBase.h:594
unsigned getIdentifierNamespace() const
Definition: DeclBase.h:879
SourceLocation getLocation() const
Definition: DeclBase.h:445
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:634
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required.
Definition: DeclBase.cpp:530
DeclContext * getDeclContext()
Definition: DeclBase.h:454
AccessSpecifier getAccess() const
Definition: DeclBase.h:513
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclBase.h:437
AttrVec & getAttrs()
Definition: DeclBase.h:530
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
Definition: DeclBase.h:908
bool hasAttr() const
Definition: DeclBase.h:583
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:968
Kind getKind() const
Definition: DeclBase.h:448
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:4166
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:4198
Provides information about a dependent function-template specialization declaration.
Definition: DeclTemplate.h:689
ArrayRef< FunctionTemplateDecl * > getCandidates() const
Returns the candidates for the primary function template.
Definition: DeclTemplate.h:708
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:701
Represents an empty-declaration.
Definition: Decl.h:4925
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3297
llvm::APSInt getInitVal() const
Definition: Decl.h:3317
const Expr * getInitExpr() const
Definition: Decl.h:3315
Represents an enum.
Definition: Decl.h:3867
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
Definition: Decl.h:4126
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:4072
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:4064
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:4075
unsigned getODRHash()
Definition: Decl.cpp:4951
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
Definition: Decl.h:4043
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3963
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:4081
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:4027
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum.
Definition: Decl.h:4053
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition: Decl.h:4019
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1897
ExplicitSpecKind getKind() const
Definition: DeclCXX.h:1905
const Expr * getExpr() const
Definition: DeclCXX.h:1906
Represents a standard C++ module export declaration.
Definition: Decl.h:4878
SourceLocation getRBraceLoc() const
Definition: Decl.h:4897
This represents one expression.
Definition: Expr.h:110
Represents a member of a struct/union/class.
Definition: Decl.h:3057
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:3145
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:3218
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition: Decl.h:3253
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
Definition: Decl.h:3161
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition: Decl.h:3258
const StringLiteral * getAsmString() const
Definition: Decl.h:4444
SourceLocation getRParenLoc() const
Definition: Decl.h:4438
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:2599
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:3236
bool isTrivialForCall() const
Definition: Decl.h:2342
ConstexprSpecKind getConstexprKind() const
Definition: Decl.h:2438
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:2830
SourceLocation getDefaultLoc() const
Definition: Decl.h:2360
bool usesSEHTry() const
Indicates the function uses __try.
Definition: Decl.h:2480
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2683
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted.
Definition: Decl.h:2351
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2339
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition: Decl.h:2410
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:2295
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition: Decl.cpp:4237
unsigned getODRHash()
Returns ODRHash of the function.
Definition: Decl.cpp:4524
@ 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:2797
bool FriendConstraintRefersToEnclosingTemplate() const
Definition: Decl.h:2617
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3993
bool isDeletedAsWritten() const
Definition: Decl.h:2506
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2322
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition: Decl.h:2326
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition: Decl.h:2390
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition: Decl.h:2589
bool isDefaulted() const
Whether this function is defaulted.
Definition: Decl.h:2347
bool isIneligibleOrNotSelected() const
Definition: Decl.h:2380
FunctionDecl * getInstantiatedFromDecl() const
Definition: Decl.cpp:4066
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2313
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:2421
size_t param_size() const
Definition: Decl.h:2699
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2808
DefaultedOrDeletedFunctionInfo * getDefalutedOrDeletedInfo() const
Definition: Decl.cpp:3151
Declaration of a template function.
Definition: DeclTemplate.h:957
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
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:522
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:
Definition: DeclTemplate.h:593
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:553
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:525
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition: Decl.h:4940
bool isCBuffer() const
Definition: Decl.h:4968
SourceLocation getLBraceLoc() const
Definition: Decl.h:4965
SourceLocation getLocStart() const LLVM_READONLY
Definition: Decl.h:4964
SourceLocation getRBraceLoc() const
Definition: Decl.h:4966
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4799
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:5729
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4857
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3341
unsigned getChainingSize() const
Definition: Decl.h:3369
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:3363
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:3229
unsigned getManglingNumber() const
Definition: DeclCXX.h:3278
Expr * getTemporaryExpr()
Retrieve the expression to which the temporary materialization conversion was applied.
Definition: DeclCXX.h:3275
Represents a linkage specification.
Definition: DeclCXX.h:2934
LinkageSpecLanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2957
SourceLocation getExternLoc() const
Definition: DeclCXX.h:2973
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:2974
A global _GUID constant.
Definition: DeclCXX.h:4289
Parts getParts() const
Get the decomposed parts of this declaration.
Definition: DeclCXX.h:4319
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:4235
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:4257
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:4259
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:615
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:637
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:655
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:634
Describes a module or submodule.
Definition: Module.h:105
bool isInterfaceOrPartition() const
Definition: Module.h:615
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:648
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:3120
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3183
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3208
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:3211
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition: DeclCXX.h:3192
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:3010
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:474
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:160
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:128
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:417
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:110
Represents a field declaration created by an @defs(...).
Definition: DeclObjC.h:2028
static bool classofKind(Kind K)
Definition: DeclObjC.h:2049
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2326
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2414
unsigned protocol_size() const
Definition: DeclObjC.h:2409
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2369
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2461
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2463
protocol_range protocols() const
Definition: DeclObjC.h:2400
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2457
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition: DeclObjC.h:2542
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2569
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2772
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2790
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:947
SourceRange getAtEndRange() const
Definition: DeclObjC.h:1102
SourceLocation getAtStartLoc() const
Definition: DeclObjC.h:1095
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2483
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2594
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2675
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2741
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
Definition: DeclObjC.h:2699
SourceLocation getSuperClassLoc() const
Definition: DeclObjC.h:2734
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction?
Definition: DeclObjC.h:2704
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2666
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2732
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2739
Represents an ObjC class declaration.
Definition: DeclObjC.h:1153
protocol_range protocols() const
Definition: DeclObjC.h:1358
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: DeclObjC.cpp:791
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:1387
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
Definition: DeclObjC.h:1783
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Definition: DeclObjC.h:1522
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1917
SourceLocation getEndOfDefinitionLoc() const
Definition: DeclObjC.h:1876
TypeSourceInfo * getSuperClassTInfo() const
Definition: DeclObjC.h:1572
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1950
AccessControl getAccessControl() const
Definition: DeclObjC.h:1998
bool getSynthesize() const
Definition: DeclObjC.h:2005
static bool classofKind(Kind K)
Definition: DeclObjC.h:2013
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:909
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclObjC.cpp:1047
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:730
SourceLocation getGetterNameLoc() const
Definition: DeclObjC.h:885
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:900
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:903
SourceLocation getSetterNameLoc() const
Definition: DeclObjC.h:893
SourceLocation getAtLoc() const
Definition: DeclObjC.h:795
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:923
Selector getSetterName() const
Definition: DeclObjC.h:892
TypeSourceInfo * getTypeSourceInfo() const
Definition: DeclObjC.h:801
QualType getType() const
Definition: DeclObjC.h:803
Selector getGetterName() const
Definition: DeclObjC.h:884
SourceLocation getLParenLoc() const
Definition: DeclObjC.h:798
ObjCPropertyAttribute::Kind getPropertyAttributesAsWritten() const
Definition: DeclObjC.h:826
ObjCPropertyAttribute::Kind getPropertyAttributes() const
Definition: DeclObjC.h:814
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:911
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2802
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2876
SourceLocation getPropertyIvarDeclLoc() const
Definition: DeclObjC.h:2879
Expr * getSetterCXXAssignment() const
Definition: DeclObjC.h:2912
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2867
Expr * getGetterCXXConstructor() const
Definition: DeclObjC.h:2904
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:2901
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclObjC.h:2864
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:2898
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2082
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:2258
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2179
protocol_range protocols() const
Definition: DeclObjC.h:2158
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: DeclObjC.cpp:2084
unsigned protocol_size() const
Definition: DeclObjC.h:2197
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:659
unsigned size() const
Determine the number of type parameters in this list.
Definition: DeclObjC.h:686
SourceLocation getRAngleLoc() const
Definition: DeclObjC.h:710
SourceLocation getLAngleLoc() const
Definition: DeclObjC.h:709
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:940
Represents a struct/union/class.
Definition: Decl.h:4168
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: Decl.cpp:5202
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition: Decl.h:4278
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition: Decl.h:4286
RecordArgPassingKind getArgPassingRestrictions() const
Definition: Decl.h:4301
bool hasVolatileMember() const
Definition: Decl.h:4231
bool hasFlexibleArrayMember() const
Definition: Decl.h:4201
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition: Decl.h:4270
bool hasObjectMember() const
Definition: Decl.h:4228
bool isNonTrivialToPrimitiveDestroy() const
Definition: Decl.h:4262
bool isNonTrivialToPrimitiveCopy() const
Definition: Decl.h:4254
bool isParamDestroyedInCallee() const
Definition: Decl.h:4310
RecordDecl * getMostRecentDecl()
Definition: Decl.h:4194
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition: Decl.h:4246
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition: Decl.h:4220
Declaration of a redeclarable template.
Definition: DeclTemplate.h:716
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:860
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:907
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:2029
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:4058
bool isFailed() const
Definition: DeclCXX.h:4087
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:4089
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:3584
SourceRange getBraceRange() const
Definition: Decl.h:3663
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3682
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:3711
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3687
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:3812
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:3696
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition: Decl.h:3722
TagKind getTagKind() const
Definition: Decl.h:3779
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:4457
The top declaration context.
Definition: Decl.h:84
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3555
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:3573
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:3390
const Type * getTypeForDecl() const
Definition: Decl.h:3414
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:3417
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:7341
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
Definition: Type.cpp:2000
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3534
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3432
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:3482
bool isModed() const
Definition: Decl.h:3478
QualType getUnderlyingType() const
Definition: Decl.h:3487
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes,...
Definition: Decl.cpp:5512
An artificial decl, representing a global anonymous constant value which is uniquified by value withi...
Definition: DeclCXX.h:4346
const APValue & getValue() const
Definition: DeclCXX.h:4372
This node is generated when a using-declaration that was annotated with attribute((using_if_exists)) ...
Definition: DeclCXX.h:4040
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3959
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
Definition: DeclCXX.h:3989
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3993
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:4010
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3862
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
Definition: DeclCXX.h:3893
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3903
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3920
Represents a C++ using-declaration.
Definition: DeclCXX.h:3512
bool hasTypename() const
Return true if the using declaration has 'typename'.
Definition: DeclCXX.h:3561
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3546
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
Definition: DeclCXX.h:3539
Represents C++ using-directive.
Definition: DeclCXX.h:3015
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:3086
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2958
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:3082
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3090
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3060
Represents a C++ using-enum-declaration.
Definition: DeclCXX.h:3713
SourceLocation getEnumLoc() const
The source location of the 'enum' keyword.
Definition: DeclCXX.h:3737
TypeSourceInfo * getEnumType() const
Definition: DeclCXX.h:3751
SourceLocation getUsingLoc() const
The source location of the 'using' keyword.
Definition: DeclCXX.h:3733
Represents a pack of using declarations that a single using-declarator pack-expanded into.
Definition: DeclCXX.h:3794
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition: DeclCXX.h:3824
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Definition: DeclCXX.h:3828
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition: DeclCXX.h:3320
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3384
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
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
Definition: Decl.cpp:2756
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.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
bool isMemberSpecialization() const
Determines whether this variable template partial specialization was a specialization of a member par...
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
SourceLocation getExternKeywordLoc() const
Gets the location of the extern keyword, if present.
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:1163
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1171
@ DECL_EMPTY
An EmptyDecl record.
Definition: ASTBitCodes.h:1419
@ DECL_CAPTURED
A CapturedDecl record.
Definition: ASTBitCodes.h:1260
@ DECL_CXX_RECORD
A CXXRecordDecl record.
Definition: ASTBitCodes.h:1321
@ DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1363
@ DECL_OMP_ALLOCATE
An OMPAllocateDcl record.
Definition: ASTBitCodes.h:1416
@ DECL_MS_PROPERTY
A MSPropertyDecl record.
Definition: ASTBitCodes.h:1227
@ DECL_OMP_DECLARE_MAPPER
An OMPDeclareMapperDecl record.
Definition: ASTBitCodes.h:1440
@ DECL_TOP_LEVEL_STMT_DECL
A TopLevelStmtDecl record.
Definition: ASTBitCodes.h:1254
@ DECL_REQUIRES_EXPR_BODY
A RequiresExprBodyDecl record.
Definition: ASTBitCodes.h:1425
@ DECL_STATIC_ASSERT
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1387
@ DECL_INDIRECTFIELD
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1396
@ DECL_TEMPLATE_TEMPLATE_PARM
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1375
@ DECL_IMPORT
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1407
@ DECL_UNNAMED_GLOBAL_CONSTANT
A UnnamedGlobalConstantDecl record.
Definition: ASTBitCodes.h:1446
@ DECL_ACCESS_SPEC
An AccessSpecDecl record.
Definition: ASTBitCodes.h:1339
@ DECL_OBJC_TYPE_PARAM
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1428
@ DECL_OBJC_CATEGORY_IMPL
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1209
@ DECL_ENUM_CONSTANT
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1185
@ DECL_PARM_VAR
A ParmVarDecl record.
Definition: ASTBitCodes.h:1242
@ DECL_TYPEDEF
A TypedefDecl record.
Definition: ASTBitCodes.h:1173
@ DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack.
Definition: ASTBitCodes.h:1404
@ DECL_HLSL_BUFFER
A HLSLBufferDecl record.
Definition: ASTBitCodes.h:1449
@ DECL_NAMESPACE_ALIAS
A NamespaceAliasDecl record.
Definition: ASTBitCodes.h:1288
@ DECL_TYPEALIAS
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1176
@ DECL_FUNCTION_TEMPLATE
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1366
@ DECL_MS_GUID
A MSGuidDecl record.
Definition: ASTBitCodes.h:1230
@ DECL_UNRESOLVED_USING_TYPENAME
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1312
@ DECL_CLASS_TEMPLATE_SPECIALIZATION
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1351
@ DECL_FILE_SCOPE_ASM
A FileScopeAsmDecl record.
Definition: ASTBitCodes.h:1251
@ DECL_CXX_CONSTRUCTOR
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1330
@ DECL_CXX_CONVERSION
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1336
@ DECL_FIELD
A FieldDecl record.
Definition: ASTBitCodes.h:1224
@ DECL_LINKAGE_SPEC
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1315
@ DECL_NAMESPACE
A NamespaceDecl record.
Definition: ASTBitCodes.h:1285
@ DECL_NON_TYPE_TEMPLATE_PARM
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1372
@ DECL_USING_PACK
A UsingPackDecl record.
Definition: ASTBitCodes.h:1297
@ DECL_FUNCTION
A FunctionDecl record.
Definition: ASTBitCodes.h:1188
@ DECL_USING_DIRECTIVE
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1306
@ DECL_RECORD
A RecordDecl record.
Definition: ASTBitCodes.h:1182
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
Definition: ASTBitCodes.h:1270
@ DECL_BLOCK
A BlockDecl record.
Definition: ASTBitCodes.h:1257
@ DECL_UNRESOLVED_USING_VALUE
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1309
@ DECL_TYPE_ALIAS_TEMPLATE
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1378
@ DECL_OBJC_CATEGORY
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1206
@ DECL_VAR
A VarDecl record.
Definition: ASTBitCodes.h:1236
@ DECL_UNRESOLVED_USING_IF_EXISTS
An UnresolvedUsingIfExistsDecl record.
Definition: ASTBitCodes.h:1384
@ DECL_USING
A UsingDecl record.
Definition: ASTBitCodes.h:1291
@ DECL_OBJC_PROTOCOL
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1197
@ DECL_TEMPLATE_TYPE_PARM
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1369
@ DECL_VAR_TEMPLATE_SPECIALIZATION
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1360
@ DECL_OBJC_IMPLEMENTATION
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1212
@ DECL_LABEL
A LabelDecl record.
Definition: ASTBitCodes.h:1282
@ DECL_OBJC_COMPATIBLE_ALIAS
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1215
@ DECL_CONSTRUCTOR_USING_SHADOW
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1303
@ DECL_USING_ENUM
A UsingEnumDecl record.
Definition: ASTBitCodes.h:1294
@ DECL_FRIEND_TEMPLATE
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1345
@ DECL_PRAGMA_DETECT_MISMATCH
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1437
@ DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack.
Definition: ASTBitCodes.h:1400
@ DECL_OBJC_AT_DEFS_FIELD
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1203
@ DECL_IMPLICIT_PARAM
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1239
@ DECL_FRIEND
A FriendDecl record.
Definition: ASTBitCodes.h:1342
@ DECL_CXX_METHOD
A CXXMethodDecl record.
Definition: ASTBitCodes.h:1327
@ DECL_EXPORT
An ExportDecl record.
Definition: ASTBitCodes.h:1318
@ DECL_BINDING
A BindingDecl record.
Definition: ASTBitCodes.h:1248
@ DECL_PRAGMA_COMMENT
A PragmaCommentDecl record.
Definition: ASTBitCodes.h:1434
@ DECL_ENUM
An EnumDecl record.
Definition: ASTBitCodes.h:1179
@ DECL_DECOMPOSITION
A DecompositionDecl record.
Definition: ASTBitCodes.h:1245
@ DECL_OMP_DECLARE_REDUCTION
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1443
@ DECL_OMP_THREADPRIVATE
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1410
@ DECL_OBJC_METHOD
A ObjCMethodDecl record.
Definition: ASTBitCodes.h:1191
@ DECL_CXX_DESTRUCTOR
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1333
@ DECL_OMP_CAPTUREDEXPR
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1431
@ DECL_CLASS_TEMPLATE
A ClassTemplateDecl record.
Definition: ASTBitCodes.h:1348
@ DECL_USING_SHADOW
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1300
@ DECL_CONCEPT
A ConceptDecl record.
Definition: ASTBitCodes.h:1381
@ DECL_CXX_DEDUCTION_GUIDE
A CXXDeductionGuideDecl record.
Definition: ASTBitCodes.h:1324
@ DECL_OMP_REQUIRES
An OMPRequiresDecl record.
Definition: ASTBitCodes.h:1413
@ DECL_OBJC_IVAR
A ObjCIvarDecl record.
Definition: ASTBitCodes.h:1200
@ DECL_OBJC_PROPERTY
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1218
@ DECL_TEMPLATE_PARAM_OBJECT
A TemplateParamObjectDecl record.
Definition: ASTBitCodes.h:1233
@ DECL_OBJC_INTERFACE
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1194
@ DECL_VAR_TEMPLATE
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1357
@ DECL_LIFETIME_EXTENDED_TEMPORARY
An LifetimeExtendedTemporaryDecl record.
Definition: ASTBitCodes.h:1422
@ DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1354
@ DECL_IMPLICIT_CONCEPT_SPECIALIZATION
An ImplicitConceptSpecializationDecl record.
Definition: ASTBitCodes.h:1452
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
Definition: ASTBitCodes.h:1279
@ DECL_OBJC_PROPERTY_IMPL
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1221
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
Definition: ASTBitCodes.h:1590
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1745
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1596
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1557
@ STMT_COMPOUND
A CompoundStmt record.
Definition: ASTBitCodes.h:1479
@ EXPR_CALL
A CallExpr record.
Definition: ASTBitCodes.h:1581
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
Definition: ASTBitCodes.h:1587
@ EXPR_DECL_REF
A DeclRefExpr record.
Definition: ASTBitCodes.h:1542
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
Definition: ASTBitCodes.h:1545
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
Definition: ASTBitCodes.h:1748
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
Definition: ASTCommon.cpp:355
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
Definition: ASTCommon.cpp:459
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:92
@ 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
bool shouldSkipCheckingODR(const Decl *D)
Definition: ASTReader.h:2481
@ TSK_ExplicitInstantiationDefinition
This template specialization was instantiated from a template due to an explicit instantiation defini...
Definition: Specifiers.h:203
@ TSK_ExplicitInstantiationDeclaration
This template specialization was instantiated from a template due to an explicit instantiation declar...
Definition: Specifiers.h:199
@ 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
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Definition: TemplateBase.h:676
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:963
Parts of a decomposed MSGuidDecl.
Definition: DeclCXX.h:4264
uint16_t Part2
...-89ab-...
Definition: DeclCXX.h:4268
uint32_t Part1
{01234567-...
Definition: DeclCXX.h:4266
uint16_t Part3
...-cdef-...
Definition: DeclCXX.h:4270
uint8_t Part4And5[8]
...-0123-456789abcdef}
Definition: DeclCXX.h:4272
static DeclType * getDecl(EntryType *D)
Definition: DeclTemplate.h:736