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 // Explicit info.
1769 Record.AddTypeSourceInfo(D->getTypeAsWritten());
1770 if (D->getTypeAsWritten()) {
1771 Record.AddSourceLocation(D->getExternLoc());
1772 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1773 }
1774
1776}
1777
1780 Record.AddTemplateParameterList(D->getTemplateParameters());
1781 Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1782
1784
1785 // These are read/set from/to the first declaration.
1786 if (D->getPreviousDecl() == nullptr) {
1787 Record.AddDeclRef(D->getInstantiatedFromMember());
1788 Record.push_back(D->isMemberSpecialization());
1789 }
1790
1792}
1793
1796
1797 if (D->isFirstDecl())
1800}
1801
1805
1806 llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1807 InstFrom = D->getSpecializedTemplateOrPartial();
1808 if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1809 Record.AddDeclRef(InstFromD);
1810 } else {
1811 Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1812 Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1813 }
1814
1815 // Explicit info.
1816 Record.AddTypeSourceInfo(D->getTypeAsWritten());
1817 if (D->getTypeAsWritten()) {
1818 Record.AddSourceLocation(D->getExternLoc());
1819 Record.AddSourceLocation(D->getTemplateKeywordLoc());
1820 }
1821
1822 Record.AddTemplateArgumentList(&D->getTemplateArgs());
1823 Record.AddSourceLocation(D->getPointOfInstantiation());
1824 Record.push_back(D->getSpecializationKind());
1825 Record.push_back(D->IsCompleteDefinition);
1826
1827 VisitVarDecl(D);
1828
1829 Record.push_back(D->isCanonicalDecl());
1830
1831 if (D->isCanonicalDecl()) {
1832 // When reading, we'll add it to the folding set of the following template.
1834 }
1835
1837}
1838
1841 Record.AddTemplateParameterList(D->getTemplateParameters());
1842 Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1843
1845
1846 // These are read/set from/to the first declaration.
1847 if (D->getPreviousDecl() == nullptr) {
1848 Record.AddDeclRef(D->getInstantiatedFromMember());
1849 Record.push_back(D->isMemberSpecialization());
1850 }
1851
1853}
1854
1857
1858 if (D->isFirstDecl())
1861}
1862
1864 Record.push_back(D->hasTypeConstraint());
1865 VisitTypeDecl(D);
1866
1867 Record.push_back(D->wasDeclaredWithTypename());
1868
1869 const TypeConstraint *TC = D->getTypeConstraint();
1870 assert((bool)TC == D->hasTypeConstraint());
1871 if (TC) {
1872 auto *CR = TC->getConceptReference();
1873 Record.push_back(CR != nullptr);
1874 if (CR)
1875 Record.AddConceptReference(CR);
1877 Record.push_back(D->isExpandedParameterPack());
1878 if (D->isExpandedParameterPack())
1879 Record.push_back(D->getNumExpansionParameters());
1880 }
1881
1882 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1884 Record.push_back(OwnsDefaultArg);
1885 if (OwnsDefaultArg)
1886 Record.AddTypeSourceInfo(D->getDefaultArgumentInfo());
1887
1888 if (!TC && !OwnsDefaultArg &&
1890 !D->isInvalidDecl() && !D->hasAttrs() &&
1893 AbbrevToUse = Writer.getDeclTemplateTypeParmAbbrev();
1894
1896}
1897
1899 // For an expanded parameter pack, record the number of expansion types here
1900 // so that it's easier for deserialization to allocate the right amount of
1901 // memory.
1903 Record.push_back(!!TypeConstraint);
1904 if (D->isExpandedParameterPack())
1905 Record.push_back(D->getNumExpansionTypes());
1906
1908 // TemplateParmPosition.
1909 Record.push_back(D->getDepth());
1910 Record.push_back(D->getPosition());
1911 if (TypeConstraint)
1912 Record.AddStmt(TypeConstraint);
1913
1914 if (D->isExpandedParameterPack()) {
1915 for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1916 Record.AddTypeRef(D->getExpansionType(I));
1917 Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
1918 }
1919
1921 } else {
1922 // Rest of NonTypeTemplateParmDecl.
1923 Record.push_back(D->isParameterPack());
1924 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1926 Record.push_back(OwnsDefaultArg);
1927 if (OwnsDefaultArg)
1928 Record.AddStmt(D->getDefaultArgument());
1930 }
1931}
1932
1934 // For an expanded parameter pack, record the number of expansion types here
1935 // so that it's easier for deserialization to allocate the right amount of
1936 // memory.
1937 if (D->isExpandedParameterPack())
1939
1941 Record.push_back(D->wasDeclaredWithTypename());
1942 // TemplateParmPosition.
1943 Record.push_back(D->getDepth());
1944 Record.push_back(D->getPosition());
1945
1946 if (D->isExpandedParameterPack()) {
1947 for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1948 I != N; ++I)
1949 Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
1951 } else {
1952 // Rest of TemplateTemplateParmDecl.
1953 Record.push_back(D->isParameterPack());
1954 bool OwnsDefaultArg = D->hasDefaultArgument() &&
1956 Record.push_back(OwnsDefaultArg);
1957 if (OwnsDefaultArg)
1958 Record.AddTemplateArgumentLoc(D->getDefaultArgument());
1960 }
1961}
1962
1966}
1967
1969 VisitDecl(D);
1970 Record.AddStmt(D->getAssertExpr());
1971 Record.push_back(D->isFailed());
1972 Record.AddStmt(D->getMessage());
1973 Record.AddSourceLocation(D->getRParenLoc());
1975}
1976
1977/// Emit the DeclContext part of a declaration context decl.
1979 static_assert(DeclContext::NumDeclContextBits == 13,
1980 "You need to update the serializer after you change the "
1981 "DeclContextBits");
1982
1983 uint64_t LexicalOffset = 0;
1984 uint64_t VisibleOffset = 0;
1985
1986 if (Writer.isGeneratingReducedBMI() && isa<NamespaceDecl>(DC) &&
1987 cast<NamespaceDecl>(DC)->isFromExplicitGlobalModule()) {
1988 // In reduced BMI, delay writing lexical and visible block for namespace
1989 // in the global module fragment. See the comments of DelayedNamespace for
1990 // details.
1991 Writer.DelayedNamespace.push_back(cast<NamespaceDecl>(DC));
1992 } else {
1993 LexicalOffset = Writer.WriteDeclContextLexicalBlock(Context, DC);
1994 VisibleOffset = Writer.WriteDeclContextVisibleBlock(Context, DC);
1995 }
1996
1997 Record.AddOffset(LexicalOffset);
1998 Record.AddOffset(VisibleOffset);
1999}
2000
2002 assert(IsLocalDecl(D) && "expected a local declaration");
2003
2004 const Decl *Canon = D->getCanonicalDecl();
2005 if (IsLocalDecl(Canon))
2006 return Canon;
2007
2008 const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
2009 if (CacheEntry)
2010 return CacheEntry;
2011
2012 for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
2013 if (IsLocalDecl(Redecl))
2014 D = Redecl;
2015 return CacheEntry = D;
2016}
2017
2018template <typename T>
2020 T *First = D->getFirstDecl();
2021 T *MostRecent = First->getMostRecentDecl();
2022 T *DAsT = static_cast<T *>(D);
2023 if (MostRecent != First) {
2024 assert(isRedeclarableDeclKind(DAsT->getKind()) &&
2025 "Not considered redeclarable?");
2026
2027 Record.AddDeclRef(First);
2028
2029 // Write out a list of local redeclarations of this declaration if it's the
2030 // first local declaration in the chain.
2031 const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
2032 if (DAsT == FirstLocal) {
2033 // Emit a list of all imported first declarations so that we can be sure
2034 // that all redeclarations visible to this module are before D in the
2035 // redecl chain.
2036 unsigned I = Record.size();
2037 Record.push_back(0);
2038 if (Writer.Chain)
2039 AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
2040 // This is the number of imported first declarations + 1.
2041 Record[I] = Record.size() - I;
2042
2043 // Collect the set of local redeclarations of this declaration, from
2044 // newest to oldest.
2045 ASTWriter::RecordData LocalRedecls;
2046 ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
2047 for (const Decl *Prev = FirstLocal->getMostRecentDecl();
2048 Prev != FirstLocal; Prev = Prev->getPreviousDecl())
2049 if (!Prev->isFromASTFile())
2050 LocalRedeclWriter.AddDeclRef(Prev);
2051
2052 // If we have any redecls, write them now as a separate record preceding
2053 // the declaration itself.
2054 if (LocalRedecls.empty())
2055 Record.push_back(0);
2056 else
2057 Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
2058 } else {
2059 Record.push_back(0);
2060 Record.AddDeclRef(FirstLocal);
2061 }
2062
2063 // Make sure that we serialize both the previous and the most-recent
2064 // declarations, which (transitively) ensures that all declarations in the
2065 // chain get serialized.
2066 //
2067 // FIXME: This is not correct; when we reach an imported declaration we
2068 // won't emit its previous declaration.
2069 (void)Writer.GetDeclRef(D->getPreviousDecl());
2070 (void)Writer.GetDeclRef(MostRecent);
2071 } else {
2072 // We use the sentinel value 0 to indicate an only declaration.
2073 Record.push_back(0);
2074 }
2075}
2076
2078 VisitNamedDecl(D);
2080 Record.push_back(D->isCBuffer());
2081 Record.AddSourceLocation(D->getLocStart());
2082 Record.AddSourceLocation(D->getLBraceLoc());
2083 Record.AddSourceLocation(D->getRBraceLoc());
2084
2086}
2087
2089 Record.writeOMPChildren(D->Data);
2090 VisitDecl(D);
2092}
2093
2095 Record.writeOMPChildren(D->Data);
2096 VisitDecl(D);
2098}
2099
2101 Record.writeOMPChildren(D->Data);
2102 VisitDecl(D);
2104}
2105
2107 static_assert(DeclContext::NumOMPDeclareReductionDeclBits == 15,
2108 "You need to update the serializer after you change the "
2109 "NumOMPDeclareReductionDeclBits");
2110
2111 VisitValueDecl(D);
2112 Record.AddSourceLocation(D->getBeginLoc());
2113 Record.AddStmt(D->getCombinerIn());
2114 Record.AddStmt(D->getCombinerOut());
2115 Record.AddStmt(D->getCombiner());
2116 Record.AddStmt(D->getInitOrig());
2117 Record.AddStmt(D->getInitPriv());
2118 Record.AddStmt(D->getInitializer());
2119 Record.push_back(llvm::to_underlying(D->getInitializerKind()));
2120 Record.AddDeclRef(D->getPrevDeclInScope());
2122}
2123
2125 Record.writeOMPChildren(D->Data);
2126 VisitValueDecl(D);
2127 Record.AddDeclarationName(D->getVarName());
2128 Record.AddDeclRef(D->getPrevDeclInScope());
2130}
2131
2133 VisitVarDecl(D);
2135}
2136
2137//===----------------------------------------------------------------------===//
2138// ASTWriter Implementation
2139//===----------------------------------------------------------------------===//
2140
2141namespace {
2142template <FunctionDecl::TemplatedKind Kind>
2143std::shared_ptr<llvm::BitCodeAbbrev>
2144getFunctionDeclAbbrev(serialization::DeclCode Code) {
2145 using namespace llvm;
2146
2147 auto Abv = std::make_shared<BitCodeAbbrev>();
2148 Abv->Add(BitCodeAbbrevOp(Code));
2149 // RedeclarableDecl
2150 Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2151 Abv->Add(BitCodeAbbrevOp(Kind));
2152 if constexpr (Kind == FunctionDecl::TK_NonTemplate) {
2153
2154 } else if constexpr (Kind == FunctionDecl::TK_FunctionTemplate) {
2155 // DescribedFunctionTemplate
2156 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2157 } else if constexpr (Kind == FunctionDecl::TK_DependentNonTemplate) {
2158 // Instantiated From Decl
2159 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2160 } else if constexpr (Kind == FunctionDecl::TK_MemberSpecialization) {
2161 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedFrom
2162 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2163 3)); // TemplateSpecializationKind
2164 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Specialized Location
2165 } else if constexpr (Kind ==
2167 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template
2168 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2169 3)); // TemplateSpecializationKind
2170 Abv->Add(BitCodeAbbrevOp(1)); // Template Argument Size
2171 Abv->Add(BitCodeAbbrevOp(TemplateArgument::Type)); // Template Argument Kind
2172 Abv->Add(
2173 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Template Argument Type
2174 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Is Defaulted
2175 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2176 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2177 Abv->Add(BitCodeAbbrevOp(0));
2178 Abv->Add(
2179 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Canonical Decl of template
2180 } else if constexpr (Kind == FunctionDecl::
2182 // Candidates of specialization
2183 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2184 Abv->Add(BitCodeAbbrevOp(0)); // TemplateArgumentsAsWritten
2185 } else {
2186 llvm_unreachable("Unknown templated kind?");
2187 }
2188 // Decl
2189 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2190 8)); // Packed DeclBits: ModuleOwnershipKind,
2191 // isUsed, isReferenced, AccessSpecifier,
2192 // isImplicit
2193 //
2194 // The following bits should be 0:
2195 // HasStandaloneLexicalDC, HasAttrs,
2196 // TopLevelDeclInObjCContainer,
2197 // isInvalidDecl
2198 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2199 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2200 // NamedDecl
2201 Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2202 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2203 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2204 // ValueDecl
2205 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2206 // DeclaratorDecl
2207 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2208 Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2209 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2210 // FunctionDecl
2211 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2212 Abv->Add(BitCodeAbbrevOp(
2213 BitCodeAbbrevOp::Fixed,
2214 28)); // Packed Function Bits: StorageClass, Inline, InlineSpecified,
2215 // VirtualAsWritten, Pure, HasInheritedProto, HasWrittenProto,
2216 // Deleted, Trivial, TrivialForCall, Defaulted, ExplicitlyDefaulted,
2217 // IsIneligibleOrNotSelected, ImplicitReturnZero, Constexpr,
2218 // UsesSEHTry, SkippedBody, MultiVersion, LateParsed,
2219 // FriendConstraintRefersToEnclosingTemplate, Linkage,
2220 // ShouldSkipCheckingODR
2221 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2222 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2223 // This Array slurps the rest of the record. Fortunately we want to encode
2224 // (nearly) all the remaining (variable number of) fields in the same way.
2225 //
2226 // This is:
2227 // NumParams and Params[] from FunctionDecl, and
2228 // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2229 //
2230 // Add an AbbrevOp for 'size then elements' and use it here.
2231 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2232 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2233 return Abv;
2234}
2235
2236template <FunctionDecl::TemplatedKind Kind>
2237std::shared_ptr<llvm::BitCodeAbbrev> getCXXMethodAbbrev() {
2238 return getFunctionDeclAbbrev<Kind>(serialization::DECL_CXX_METHOD);
2239}
2240} // namespace
2241
2242void ASTWriter::WriteDeclAbbrevs() {
2243 using namespace llvm;
2244
2245 std::shared_ptr<BitCodeAbbrev> Abv;
2246
2247 // Abbreviation for DECL_FIELD
2248 Abv = std::make_shared<BitCodeAbbrev>();
2249 Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
2250 // Decl
2251 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2252 7)); // Packed DeclBits: ModuleOwnershipKind,
2253 // isUsed, isReferenced, AccessSpecifier,
2254 //
2255 // The following bits should be 0:
2256 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2257 // TopLevelDeclInObjCContainer,
2258 // isInvalidDecl
2259 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2260 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2261 // NamedDecl
2262 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2263 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2264 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2265 // ValueDecl
2266 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2267 // DeclaratorDecl
2268 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2269 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2270 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2271 // FieldDecl
2272 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2273 Abv->Add(BitCodeAbbrevOp(0)); // StorageKind
2274 // Type Source Info
2275 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2276 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2277 DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
2278
2279 // Abbreviation for DECL_OBJC_IVAR
2280 Abv = std::make_shared<BitCodeAbbrev>();
2281 Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
2282 // Decl
2283 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2284 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2285 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2286 // isReferenced, TopLevelDeclInObjCContainer,
2287 // AccessSpecifier, ModuleOwnershipKind
2288 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2289 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2290 // NamedDecl
2291 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2292 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2293 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2294 // ValueDecl
2295 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2296 // DeclaratorDecl
2297 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2298 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2299 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2300 // FieldDecl
2301 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
2302 Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2303 // ObjC Ivar
2304 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
2305 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
2306 // Type Source Info
2307 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2308 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2309 DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2310
2311 // Abbreviation for DECL_ENUM
2312 Abv = std::make_shared<BitCodeAbbrev>();
2313 Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
2314 // Redeclarable
2315 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2316 // Decl
2317 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2318 7)); // Packed DeclBits: ModuleOwnershipKind,
2319 // isUsed, isReferenced, AccessSpecifier,
2320 //
2321 // The following bits should be 0:
2322 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2323 // TopLevelDeclInObjCContainer,
2324 // isInvalidDecl
2325 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2326 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2327 // NamedDecl
2328 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2329 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2330 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2331 // TypeDecl
2332 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2333 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2334 // TagDecl
2335 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2336 Abv->Add(BitCodeAbbrevOp(
2337 BitCodeAbbrevOp::Fixed,
2338 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2339 // EmbeddedInDeclarator, IsFreeStanding,
2340 // isCompleteDefinitionRequired, ExtInfoKind
2341 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2342 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2343 // EnumDecl
2344 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
2345 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
2346 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
2347 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 20)); // Enum Decl Bits
2348 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
2349 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
2350 // DC
2351 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2352 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2353 DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2354
2355 // Abbreviation for DECL_RECORD
2356 Abv = std::make_shared<BitCodeAbbrev>();
2357 Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
2358 // Redeclarable
2359 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2360 // Decl
2361 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2362 7)); // Packed DeclBits: ModuleOwnershipKind,
2363 // isUsed, isReferenced, AccessSpecifier,
2364 //
2365 // The following bits should be 0:
2366 // isImplicit, HasStandaloneLexicalDC, HasAttrs,
2367 // TopLevelDeclInObjCContainer,
2368 // isInvalidDecl
2369 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2370 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2371 // NamedDecl
2372 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2373 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2374 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2375 // TypeDecl
2376 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2377 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2378 // TagDecl
2379 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2380 Abv->Add(BitCodeAbbrevOp(
2381 BitCodeAbbrevOp::Fixed,
2382 9)); // Packed Tag Decl Bits: getTagKind, isCompleteDefinition,
2383 // EmbeddedInDeclarator, IsFreeStanding,
2384 // isCompleteDefinitionRequired, ExtInfoKind
2385 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2386 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2387 // RecordDecl
2388 Abv->Add(BitCodeAbbrevOp(
2389 BitCodeAbbrevOp::Fixed,
2390 13)); // Packed Record Decl Bits: FlexibleArrayMember,
2391 // AnonymousStructUnion, hasObjectMember, hasVolatileMember,
2392 // isNonTrivialToPrimitiveDefaultInitialize,
2393 // isNonTrivialToPrimitiveCopy, isNonTrivialToPrimitiveDestroy,
2394 // hasNonTrivialToPrimitiveDefaultInitializeCUnion,
2395 // hasNonTrivialToPrimitiveDestructCUnion,
2396 // hasNonTrivialToPrimitiveCopyCUnion, isParamDestroyedInCallee,
2397 // getArgPassingRestrictions
2398 // ODRHash
2399 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 26));
2400
2401 // DC
2402 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2403 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2404 DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2405
2406 // Abbreviation for DECL_PARM_VAR
2407 Abv = std::make_shared<BitCodeAbbrev>();
2408 Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2409 // Redeclarable
2410 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2411 // Decl
2412 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2413 8)); // Packed DeclBits: ModuleOwnershipKind, isUsed,
2414 // isReferenced, AccessSpecifier,
2415 // HasStandaloneLexicalDC, HasAttrs, isImplicit,
2416 // TopLevelDeclInObjCContainer,
2417 // isInvalidDecl,
2418 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2419 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2420 // NamedDecl
2421 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2422 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2423 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2424 // ValueDecl
2425 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2426 // DeclaratorDecl
2427 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2428 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2429 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2430 // VarDecl
2431 Abv->Add(
2432 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2433 12)); // Packed Var Decl bits: SClass, TSCSpec, InitStyle,
2434 // isARCPseudoStrong, Linkage, ModulesCodegen
2435 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2436 // ParmVarDecl
2437 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2438 Abv->Add(BitCodeAbbrevOp(
2439 BitCodeAbbrevOp::Fixed,
2440 19)); // Packed Parm Var Decl bits: IsObjCMethodParameter, ScopeDepth,
2441 // ObjCDeclQualifier, KNRPromoted,
2442 // HasInheritedDefaultArg, HasUninstantiatedDefaultArg
2443 // Type Source Info
2444 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2445 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2446 DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2447
2448 // Abbreviation for DECL_TYPEDEF
2449 Abv = std::make_shared<BitCodeAbbrev>();
2450 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2451 // Redeclarable
2452 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2453 // Decl
2454 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2455 7)); // Packed DeclBits: ModuleOwnershipKind,
2456 // isReferenced, isUsed, AccessSpecifier. Other
2457 // higher bits should be 0: isImplicit,
2458 // HasStandaloneLexicalDC, HasAttrs,
2459 // TopLevelDeclInObjCContainer, isInvalidDecl
2460 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2461 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2462 // NamedDecl
2463 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2464 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2465 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2466 // TypeDecl
2467 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2468 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2469 // TypedefDecl
2470 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2471 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2472 DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2473
2474 // Abbreviation for DECL_VAR
2475 Abv = std::make_shared<BitCodeAbbrev>();
2476 Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2477 // Redeclarable
2478 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2479 // Decl
2480 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2481 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2482 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2483 // isReferenced, TopLevelDeclInObjCContainer,
2484 // AccessSpecifier, ModuleOwnershipKind
2485 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2486 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2487 // NamedDecl
2488 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2489 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2490 Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2491 // ValueDecl
2492 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2493 // DeclaratorDecl
2494 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2495 Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2496 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2497 // VarDecl
2498 Abv->Add(BitCodeAbbrevOp(
2499 BitCodeAbbrevOp::Fixed,
2500 21)); // Packed Var Decl bits: Linkage, ModulesCodegen,
2501 // SClass, TSCSpec, InitStyle,
2502 // isARCPseudoStrong, IsThisDeclarationADemotedDefinition,
2503 // isExceptionVariable, isNRVOVariable, isCXXForRangeDecl,
2504 // isInline, isInlineSpecified, isConstexpr,
2505 // isInitCapture, isPrevDeclInSameScope,
2506 // EscapingByref, HasDeducedType, ImplicitParamKind, isObjCForDecl
2507 Abv->Add(BitCodeAbbrevOp(0)); // VarKind (local enum)
2508 // Type Source Info
2509 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2510 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2511 DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2512
2513 // Abbreviation for DECL_CXX_METHOD
2514 DeclCXXMethodAbbrev =
2515 Stream.EmitAbbrev(getCXXMethodAbbrev<FunctionDecl::TK_NonTemplate>());
2516 DeclTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2517 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplate>());
2518 DeclDependentNonTemplateCXXMethodAbbrev = Stream.EmitAbbrev(
2519 getCXXMethodAbbrev<FunctionDecl::TK_DependentNonTemplate>());
2520 DeclMemberSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2521 getCXXMethodAbbrev<FunctionDecl::TK_MemberSpecialization>());
2522 DeclTemplateSpecializedCXXMethodAbbrev = Stream.EmitAbbrev(
2523 getCXXMethodAbbrev<FunctionDecl::TK_FunctionTemplateSpecialization>());
2524 DeclDependentSpecializationCXXMethodAbbrev = Stream.EmitAbbrev(
2525 getCXXMethodAbbrev<
2527
2528 // Abbreviation for DECL_TEMPLATE_TYPE_PARM
2529 Abv = std::make_shared<BitCodeAbbrev>();
2530 Abv->Add(BitCodeAbbrevOp(serialization::DECL_TEMPLATE_TYPE_PARM));
2531 Abv->Add(BitCodeAbbrevOp(0)); // hasTypeConstraint
2532 // Decl
2533 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2534 7)); // Packed DeclBits: ModuleOwnershipKind,
2535 // isReferenced, isUsed, AccessSpecifier. Other
2536 // higher bits should be 0: isImplicit,
2537 // HasStandaloneLexicalDC, HasAttrs,
2538 // TopLevelDeclInObjCContainer, isInvalidDecl
2539 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2540 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2541 // NamedDecl
2542 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2543 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2544 Abv->Add(BitCodeAbbrevOp(0));
2545 // TypeDecl
2546 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2547 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2548 // TemplateTypeParmDecl
2549 Abv->Add(
2550 BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // wasDeclaredWithTypename
2551 Abv->Add(BitCodeAbbrevOp(0)); // OwnsDefaultArg
2552 DeclTemplateTypeParmAbbrev = Stream.EmitAbbrev(std::move(Abv));
2553
2554 // Abbreviation for DECL_USING_SHADOW
2555 Abv = std::make_shared<BitCodeAbbrev>();
2556 Abv->Add(BitCodeAbbrevOp(serialization::DECL_USING_SHADOW));
2557 // Redeclarable
2558 Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2559 // Decl
2560 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2561 12)); // Packed DeclBits: HasStandaloneLexicalDC,
2562 // isInvalidDecl, HasAttrs, isImplicit, isUsed,
2563 // isReferenced, TopLevelDeclInObjCContainer,
2564 // AccessSpecifier, ModuleOwnershipKind
2565 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2566 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2567 // NamedDecl
2568 Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2569 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2570 Abv->Add(BitCodeAbbrevOp(0));
2571 // UsingShadowDecl
2572 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TargetDecl
2573 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2574 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // UsingOrNextShadow
2575 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR,
2576 6)); // InstantiatedFromUsingShadowDecl
2577 DeclUsingShadowAbbrev = Stream.EmitAbbrev(std::move(Abv));
2578
2579 // Abbreviation for EXPR_DECL_REF
2580 Abv = std::make_shared<BitCodeAbbrev>();
2581 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2582 // Stmt
2583 // Expr
2584 // PackingBits: DependenceKind, ValueKind. ObjectKind should be 0.
2585 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 7));
2586 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2587 // DeclRefExpr
2588 // Packing Bits: , HadMultipleCandidates, RefersToEnclosingVariableOrCapture,
2589 // IsImmediateEscalating, NonOdrUseReason.
2590 // GetDeclFound, HasQualifier and ExplicitTemplateArgs should be 0.
2591 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2592 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2593 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2594 DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2595
2596 // Abbreviation for EXPR_INTEGER_LITERAL
2597 Abv = std::make_shared<BitCodeAbbrev>();
2598 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2599 //Stmt
2600 // Expr
2601 // DependenceKind, ValueKind, ObjectKind
2602 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2603 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2604 // Integer Literal
2605 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2606 Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2607 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2608 IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2609
2610 // Abbreviation for EXPR_CHARACTER_LITERAL
2611 Abv = std::make_shared<BitCodeAbbrev>();
2612 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2613 //Stmt
2614 // Expr
2615 // DependenceKind, ValueKind, ObjectKind
2616 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2617 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2618 // Character Literal
2619 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2620 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2621 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2622 CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2623
2624 // Abbreviation for EXPR_IMPLICIT_CAST
2625 Abv = std::make_shared<BitCodeAbbrev>();
2626 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2627 // Stmt
2628 // Expr
2629 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2630 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2631 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2632 // CastExpr
2633 Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2634 // Packing Bits: CastKind, StoredFPFeatures, isPartOfExplicitCast
2635 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 9));
2636 // ImplicitCastExpr
2637 ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2638
2639 // Abbreviation for EXPR_BINARY_OPERATOR
2640 Abv = std::make_shared<BitCodeAbbrev>();
2641 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_BINARY_OPERATOR));
2642 // Stmt
2643 // Expr
2644 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2645 // be 0 in this case.
2646 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2647 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2648 // BinaryOperator
2649 Abv->Add(
2650 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2651 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2652 BinaryOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2653
2654 // Abbreviation for EXPR_COMPOUND_ASSIGN_OPERATOR
2655 Abv = std::make_shared<BitCodeAbbrev>();
2656 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_COMPOUND_ASSIGN_OPERATOR));
2657 // Stmt
2658 // Expr
2659 // Packing Bits: DependenceKind. ValueKind and ObjectKind should
2660 // be 0 in this case.
2661 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 5));
2662 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2663 // BinaryOperator
2664 // Packing Bits: OpCode. The HasFPFeatures bit should be 0
2665 Abv->Add(
2666 BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // OpCode and HasFPFeatures
2667 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2668 // CompoundAssignOperator
2669 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LHSType
2670 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Result Type
2671 CompoundAssignOperatorAbbrev = Stream.EmitAbbrev(std::move(Abv));
2672
2673 // Abbreviation for EXPR_CALL
2674 Abv = std::make_shared<BitCodeAbbrev>();
2675 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CALL));
2676 // Stmt
2677 // Expr
2678 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2679 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2680 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2681 // CallExpr
2682 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2683 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2684 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2685 CallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2686
2687 // Abbreviation for EXPR_CXX_OPERATOR_CALL
2688 Abv = std::make_shared<BitCodeAbbrev>();
2689 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_OPERATOR_CALL));
2690 // Stmt
2691 // Expr
2692 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2693 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2694 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2695 // CallExpr
2696 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2697 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2698 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2699 // CXXOperatorCallExpr
2700 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Operator Kind
2701 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2702 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2703 CXXOperatorCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2704
2705 // Abbreviation for EXPR_CXX_MEMBER_CALL
2706 Abv = std::make_shared<BitCodeAbbrev>();
2707 Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CXX_MEMBER_CALL));
2708 // Stmt
2709 // Expr
2710 // Packing Bits: DependenceKind, ValueKind, ObjectKind,
2711 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 10));
2712 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2713 // CallExpr
2714 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // NumArgs
2715 Abv->Add(BitCodeAbbrevOp(0)); // ADLCallKind
2716 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2717 // CXXMemberCallExpr
2718 CXXMemberCallExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2719
2720 // Abbreviation for STMT_COMPOUND
2721 Abv = std::make_shared<BitCodeAbbrev>();
2722 Abv->Add(BitCodeAbbrevOp(serialization::STMT_COMPOUND));
2723 // Stmt
2724 // CompoundStmt
2725 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Num Stmts
2726 Abv->Add(BitCodeAbbrevOp(0)); // hasStoredFPFeatures
2727 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2728 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2729 CompoundStmtAbbrev = Stream.EmitAbbrev(std::move(Abv));
2730
2731 Abv = std::make_shared<BitCodeAbbrev>();
2732 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2733 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2734 DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2735
2736 Abv = std::make_shared<BitCodeAbbrev>();
2737 Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2738 Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2739 DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2740}
2741
2742/// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2743/// consumers of the AST.
2744///
2745/// Such decls will always be deserialized from the AST file, so we would like
2746/// this to be as restrictive as possible. Currently the predicate is driven by
2747/// code generation requirements, if other clients have a different notion of
2748/// what is "required" then we may have to consider an alternate scheme where
2749/// clients can iterate over the top-level decls and get information on them,
2750/// without necessary deserializing them. We could explicitly require such
2751/// clients to use a separate API call to "realize" the decl. This should be
2752/// relatively painless since they would presumably only do it for top-level
2753/// decls.
2754static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2755 Module *WritingModule) {
2756 // Named modules have different semantics than header modules. Every named
2757 // module units owns a translation unit. So the importer of named modules
2758 // doesn't need to deserilize everything ahead of time.
2759 if (WritingModule && WritingModule->isNamedModule()) {
2760 // The PragmaCommentDecl and PragmaDetectMismatchDecl are MSVC's extension.
2761 // And the behavior of MSVC for such cases will leak this to the module
2762 // users. Given pragma is not a standard thing, the compiler has the space
2763 // to do their own decision. Let's follow MSVC here.
2764 if (isa<PragmaCommentDecl, PragmaDetectMismatchDecl>(D))
2765 return true;
2766 return false;
2767 }
2768
2769 // An ObjCMethodDecl is never considered as "required" because its
2770 // implementation container always is.
2771
2772 // File scoped assembly or obj-c or OMP declare target implementation must be
2773 // seen.
2774 if (isa<FileScopeAsmDecl, TopLevelStmtDecl, ObjCImplDecl>(D))
2775 return true;
2776
2777 if (WritingModule && isPartOfPerModuleInitializer(D)) {
2778 // These declarations are part of the module initializer, and are emitted
2779 // if and when the module is imported, rather than being emitted eagerly.
2780 return false;
2781 }
2782
2783 return Context.DeclMustBeEmitted(D);
2784}
2785
2786void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2787 PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
2788 "serializing");
2789
2790 // Determine the ID for this declaration.
2792 assert(!D->isFromASTFile() && "should not be emitting imported decl");
2793 LocalDeclID &IDR = DeclIDs[D];
2794 if (IDR.isInvalid())
2795 IDR = NextDeclID++;
2796
2797 ID = IDR;
2798
2799 assert(ID >= FirstDeclID && "invalid decl ID");
2800
2802 ASTDeclWriter W(*this, Context, Record, GeneratingReducedBMI);
2803
2804 // Build a record for this declaration
2805 W.Visit(D);
2806
2807 // Emit this declaration to the bitstream.
2808 uint64_t Offset = W.Emit(D);
2809
2810 // Record the offset for this declaration
2811 SourceLocation Loc = D->getLocation();
2812 unsigned Index = ID.get() - FirstDeclID.get();
2813 if (DeclOffsets.size() == Index)
2814 DeclOffsets.emplace_back(getAdjustedLocation(Loc), Offset,
2815 DeclTypesBlockStartOffset);
2816 else if (DeclOffsets.size() < Index) {
2817 // FIXME: Can/should this happen?
2818 DeclOffsets.resize(Index+1);
2819 DeclOffsets[Index].setLocation(getAdjustedLocation(Loc));
2820 DeclOffsets[Index].setBitOffset(Offset, DeclTypesBlockStartOffset);
2821 } else {
2822 llvm_unreachable("declarations should be emitted in ID order");
2823 }
2824
2825 SourceManager &SM = Context.getSourceManager();
2826 if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2827 associateDeclWithFile(D, ID);
2828
2829 // Note declarations that should be deserialized eagerly so that we can add
2830 // them to a record in the AST file later.
2831 if (isRequiredDecl(D, Context, WritingModule))
2832 AddDeclRef(D, EagerlyDeserializedDecls);
2833}
2834
2836 // Switch case IDs are per function body.
2837 Writer->ClearSwitchCaseIDs();
2838
2839 assert(FD->doesThisDeclarationHaveABody());
2840 bool ModulesCodegen = false;
2841 if (!FD->isDependentContext()) {
2842 std::optional<GVALinkage> Linkage;
2843 if (Writer->WritingModule &&
2844 Writer->WritingModule->isInterfaceOrPartition()) {
2845 // When building a C++20 module interface unit or a partition unit, a
2846 // strong definition in the module interface is provided by the
2847 // compilation of that unit, not by its users. (Inline functions are still
2848 // emitted in module users.)
2849 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2850 ModulesCodegen = *Linkage >= GVA_StrongExternal;
2851 }
2852 if (Writer->Context->getLangOpts().ModulesCodegen ||
2853 (FD->hasAttr<DLLExportAttr>() &&
2854 Writer->Context->getLangOpts().BuildingPCHWithObjectFile)) {
2855
2856 // Under -fmodules-codegen, codegen is performed for all non-internal,
2857 // non-always_inline functions, unless they are available elsewhere.
2858 if (!FD->hasAttr<AlwaysInlineAttr>()) {
2859 if (!Linkage)
2860 Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2861 ModulesCodegen =
2863 }
2864 }
2865 }
2866 Record->push_back(ModulesCodegen);
2867 if (ModulesCodegen)
2868 Writer->AddDeclRef(FD, Writer->ModularCodegenDecls);
2869 if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2870 Record->push_back(CD->getNumCtorInitializers());
2871 if (CD->getNumCtorInitializers())
2872 AddCXXCtorInitializers(llvm::ArrayRef(CD->init_begin(), CD->init_end()));
2873 }
2874 AddStmt(FD->getBody());
2875}
NodeId Parent
Definition: ASTDiff.cpp:191
StringRef P
static void addExplicitSpecifier(ExplicitSpecifier ES, ASTRecordWriter &Record)
static bool isRequiredDecl(const Decl *D, ASTContext &Context, Module *WritingModule)
isRequiredDecl - Check if this is a "required" Decl, which must be seen by consumers of the AST.
#define SM(sm)
Definition: Cuda.cpp:82
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the C++ template declaration subclasses.
llvm::MachO::Record Record
Definition: MachO.h:31
This file defines OpenMP AST classes for clauses.
Defines the SourceManager interface.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:182
SourceManager & getSourceManager()
Definition: ASTContext.h:705
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of another (possibly unresolved) using decl,...
DeclarationNameTable DeclarationNames
Definition: ASTContext.h:648
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
const CXXMethodDecl * getCurrentKeyFunction(const CXXRecordDecl *RD)
Get our current best idea for the key function of the given record decl, or nullptr if there isn't on...
const LangOptions & getLangOpts() const
Definition: ASTContext.h:775
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
UsingEnumDecl * getInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst)
If the given using-enum decl Inst is an instantiation of another using-enum decl, return it.
GVALinkage GetGVALinkageForFunction(const FunctionDecl *FD) const
BlockVarCopyInit getBlockVarCopyInit(const VarDecl *VD) const
Get the copy initialization expression of the VarDecl VD, or nullptr if none exists.
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists.
GVALinkage GetGVALinkageForVariable(const VarDecl *VD) const
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any.
Definition: ASTContext.h:1188
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:7679
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:6318
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:86
unsigned getDeclParmVarAbbrev() const
Definition: ASTWriter.h:780
unsigned getDeclTemplateTypeParmAbbrev() const
Definition: ASTWriter.h:804
unsigned getDeclObjCIvarAbbrev() const
Definition: ASTWriter.h:786
unsigned getDeclTypedefAbbrev() const
Definition: ASTWriter.h:782
bool hasChain() const
Definition: ASTWriter.h:823
unsigned getDeclUsingShadowAbbrev() const
Definition: ASTWriter.h:807
bool isGeneratingReducedBMI() const
Definition: ASTWriter.h:830
unsigned getDeclVarAbbrev() const
Definition: ASTWriter.h:783
unsigned getDeclEnumAbbrev() const
Definition: ASTWriter.h:785
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:706
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:5987
unsigned getDeclCXXMethodAbbrev(FunctionDecl::TemplatedKind Kind) const
Definition: ASTWriter.h:787
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
SmallVector< uint64_t, 64 > RecordData
Definition: ASTWriter.h:91
unsigned getAnonymousDeclarationNumber(const NamedDecl *D)
Definition: ASTWriter.cpp:6090
unsigned getDeclFieldAbbrev() const
Definition: ASTWriter.h:784
unsigned getDeclRecordAbbrev() const
Definition: ASTWriter.h:781
void AddDeclRef(const Decl *D, RecordDataImpl &Record)
Emit a reference to a declaration.
Definition: ASTWriter.cpp:5983
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:950
void addBit(bool Value)
Definition: ASTWriter.h:970
void addBits(uint32_t Value, uint32_t BitsWidth)
Definition: ASTWriter.h:971
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4495
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition: Decl.h:4618
bool canAvoidCopyToHeap() const
Definition: Decl.h:4649
size_t param_size() const
Definition: Decl.h:4597
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Definition: Decl.h:4574
ArrayRef< Capture > captures() const
Definition: Decl.h:4622
bool blockMissingReturnType() const
Definition: Decl.h:4630
bool capturesCXXThis() const
Definition: Decl.h:4627
bool doesNotEscape() const
Definition: Decl.h:4646
bool isConversionFromLambda() const
Definition: Decl.h:4638
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:4581
bool isVariadic() const
Definition: Decl.h:4570
TypeSourceInfo * getSignatureAsWritten() const
Definition: Decl.h:4578
Represents a C++ constructor within a class.
Definition: DeclCXX.h: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
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:4687
unsigned getNumParams() const
Definition: Decl.h:4729
unsigned getContextParamPosition() const
Definition: Decl.h:4758
bool isNothrow() const
Definition: Decl.cpp:5445
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4731
Declaration of a class template.
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a class template specialization, which refers to a class template with a given set of temp...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
Declaration of a C++20 concept.
Expr * getConstraintExpr() const
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h: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:1264
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1920
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:1849
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1354
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:690
ArrayRef< FunctionTemplateDecl * > getCandidates() const
Returns the candidates for the primary function template.
Definition: DeclTemplate.h:709
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:702
Represents an empty-declaration.
Definition: Decl.h:4926
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:3298
llvm::APSInt getInitVal() const
Definition: Decl.h:3318
const Expr * getInitExpr() const
Definition: Decl.h:3316
Represents an enum.
Definition: Decl.h:3868
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization,...
Definition: Decl.h:4127
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:4073
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:4065
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:4076
unsigned getODRHash()
Definition: Decl.cpp:4953
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists,...
Definition: Decl.h:4044
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3964
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:4082
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:4028
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum.
Definition: Decl.h:4054
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition: Decl.h:4020
Store information needed for an explicit specifier.
Definition: DeclCXX.h: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:4879
SourceLocation getRBraceLoc() const
Definition: Decl.h:4898
This represents one expression.
Definition: Expr.h:110
Represents a member of a struct/union/class.
Definition: Decl.h:3058
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:3146
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:3219
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition: Decl.h:3254
Expr * getBitWidth() const
Returns the expression that represents the bit width, if this field is a bit field.
Definition: Decl.h:3162
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition: Decl.h:3259
const StringLiteral * getAsmString() const
Definition: Decl.h:4445
SourceLocation getRParenLoc() const
Definition: Decl.h:4439
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Definition: DeclFriend.h:54
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
Definition: DeclFriend.h:130
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Definition: DeclFriend.h:137
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:122
Declaration of a friend template.
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
NamedDecl * getFriendDecl() const
If this friend declaration names a templated function (or a member function of a templated type),...
TemplateParameterList * getTemplateParameterList(unsigned i) const
unsigned getNumTemplateParameters() const
TypeSourceInfo * getFriendType() const
If this friend declaration names a templated type (or a dependent member type of a templated type),...
Represents a function declaration or definition.
Definition: Decl.h:1971
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition: Decl.h:2600
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:3236
bool isTrivialForCall() const
Definition: Decl.h:2343
ConstexprSpecKind getConstexprKind() const
Definition: Decl.h:2439
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:4042
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition: Decl.h:2831
SourceLocation getDefaultLoc() const
Definition: Decl.h:2361
bool usesSEHTry() const
Indicates the function uses __try.
Definition: Decl.h:2481
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2684
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted.
Definition: Decl.h:2352
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2340
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition: Decl.h:2411
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization,...
Definition: Decl.cpp:4021
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:4172
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:2296
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition: Decl.cpp:4239
unsigned getODRHash()
Returns ODRHash of the function.
Definition: Decl.cpp:4526
@ TK_MemberSpecialization
Definition: Decl.h:1983
@ TK_DependentNonTemplate
Definition: Decl.h:1992
@ TK_FunctionTemplateSpecialization
Definition: Decl.h:1987
@ TK_DependentFunctionTemplateSpecialization
Definition: Decl.h:1990
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2798
bool FriendConstraintRefersToEnclosingTemplate() const
Definition: Decl.h:2618
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3993
bool isDeletedAsWritten() const
Definition: Decl.h:2507
bool isPureVirtual() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2323
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition: Decl.h:2327
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition: Decl.h:2391
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition: Decl.h:2590
bool isDefaulted() const
Whether this function is defaulted.
Definition: Decl.h:2348
bool isIneligibleOrNotSelected() const
Definition: Decl.h:2381
FunctionDecl * getInstantiatedFromDecl() const
Definition: Decl.cpp:4066
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2314
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:2422
size_t param_size() const
Definition: Decl.h:2700
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2809
DefaultedOrDeletedFunctionInfo * getDefalutedOrDeletedInfo() const
Definition: Decl.cpp:3151
Declaration of a template function.
Definition: DeclTemplate.h:958
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:467
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:481
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:523
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:
Definition: DeclTemplate.h:594
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:485
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:554
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:526
HLSLBufferDecl - Represent a cbuffer or tbuffer declaration.
Definition: Decl.h:4941
bool isCBuffer() const
Definition: Decl.h:4969
SourceLocation getLBraceLoc() const
Definition: Decl.h:4966
SourceLocation getLocStart() const LLVM_READONLY
Definition: Decl.h:4965
SourceLocation getRBraceLoc() const
Definition: Decl.h:4967
ArrayRef< TemplateArgument > getTemplateArguments() const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4800
ArrayRef< SourceLocation > getIdentifierLocs() const
Retrieves the locations of each of the identifiers that make up the complete module name in the impor...
Definition: Decl.cpp:5731
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4858
Represents a field injected from an anonymous union/struct into the parent scope.
Definition: Decl.h:3342
unsigned getChainingSize() const
Definition: Decl.h:3370
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:3364
Represents the declaration of a label.
Definition: Decl.h:499
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition: DeclCXX.h: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:616
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:638
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:656
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:635
Describes a module or submodule.
Definition: Module.h:105
bool isInterfaceOrPartition() const
Definition: Module.h:614
bool isNamedModule() const
Does this Module is a named module of a standard named module?
Definition: Module.h:185
This represents a decl that may have a name.
Definition: Decl.h:249
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined.
Definition: DeclBase.h: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:4169
unsigned getODRHash()
Get precomputed ODRHash or add a new one.
Definition: Decl.cpp:5204
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition: Decl.h:4279
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition: Decl.h:4287
RecordArgPassingKind getArgPassingRestrictions() const
Definition: Decl.h:4302
bool hasVolatileMember() const
Definition: Decl.h:4232
bool hasFlexibleArrayMember() const
Definition: Decl.h:4202
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition: Decl.h:4271
bool hasObjectMember() const
Definition: Decl.h:4229
bool isNonTrivialToPrimitiveDestroy() const
Definition: Decl.h:4263
bool isNonTrivialToPrimitiveCopy() const
Definition: Decl.h:4255
bool isParamDestroyedInCallee() const
Definition: Decl.h:4311
RecordDecl * getMostRecentDecl()
Definition: Decl.h:4195
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition: Decl.h:4247
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition: Decl.h:4221
Declaration of a redeclarable template.
Definition: DeclTemplate.h:717
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:861
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:908
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:84
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:216
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:204
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Definition: Redeclarable.h:226
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Definition: Redeclarable.h:223
Represents the body of a requires-expression.
Definition: DeclCXX.h: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:3585
SourceRange getBraceRange() const
Definition: Decl.h:3664
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3683
bool isEmbeddedInDeclarator() const
True if this tag declaration is "embedded" (i.e., defined or declared for the very first time) in the...
Definition: Decl.h:3712
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3688
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:3813
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:3697
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition: Decl.h:3723
TagKind getTagKind() const
Definition: Decl.h:3780
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:280
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Definition: DeclTemplate.h:265
Represents a template argument.
Definition: TemplateBase.h:61
@ Type
The template argument is a type.
Definition: TemplateBase.h:70
ArgKind getKind() const
Return the kind of stored template argument.
Definition: TemplateBase.h:295
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:394
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:426
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:413
A template parameter object.
const APValue & getValue() const
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
bool wasDeclaredWithTypename() const
Whether this template template parameter was declared with the 'typename' keyword.
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Declaration of a template type parameter.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template.
bool isExpandedParameterPack() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
unsigned getNumExpansionParameters() const
Retrieves the number of parameters in an expanded parameter pack.
A declaration that models statements at global scope.
Definition: Decl.h:4458
The top declaration context.
Definition: Decl.h:84
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3556
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:3574
Declaration of an alias template.
Models the abbreviated syntax to constrain a template type parameter: template <convertible_to<string...
Definition: ASTConcept.h:231
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint,...
Definition: ASTConcept.h:246
ConceptReference * getConceptReference() const
Definition: ASTConcept.h:250
Represents a declaration of a type.
Definition: Decl.h:3391
const Type * getTypeForDecl() const
Definition: Decl.h:3415
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:3418
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:7337
DeducedType * getContainedDeducedType() const
Get the DeducedType whose type will be deduced for a variable with an initializer of this type.
Definition: Type.cpp:1999
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition: Decl.h:3535
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3433
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:3483
bool isModed() const
Definition: Decl.h:3479
QualType getUnderlyingType() const
Definition: Decl.h:3488
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes,...
Definition: Decl.cpp:5514
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
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization,...
Definition: Decl.cpp:2867
Declaration of a variable template.
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
RetTy Visit(PTR(Decl) D)
Definition: DeclVisitor.h:37
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
Definition: ASTBitCodes.h:1166
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1174
@ DECL_EMPTY
An EmptyDecl record.
Definition: ASTBitCodes.h:1422
@ DECL_CAPTURED
A CapturedDecl record.
Definition: ASTBitCodes.h:1263
@ DECL_CXX_RECORD
A CXXRecordDecl record.
Definition: ASTBitCodes.h:1324
@ DECL_VAR_TEMPLATE_PARTIAL_SPECIALIZATION
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1366
@ DECL_OMP_ALLOCATE
An OMPAllocateDcl record.
Definition: ASTBitCodes.h:1419
@ DECL_MS_PROPERTY
A MSPropertyDecl record.
Definition: ASTBitCodes.h:1230
@ DECL_OMP_DECLARE_MAPPER
An OMPDeclareMapperDecl record.
Definition: ASTBitCodes.h:1443
@ DECL_TOP_LEVEL_STMT_DECL
A TopLevelStmtDecl record.
Definition: ASTBitCodes.h:1257
@ DECL_REQUIRES_EXPR_BODY
A RequiresExprBodyDecl record.
Definition: ASTBitCodes.h:1428
@ DECL_STATIC_ASSERT
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1390
@ DECL_INDIRECTFIELD
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1399
@ DECL_TEMPLATE_TEMPLATE_PARM
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1378
@ DECL_IMPORT
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1410
@ DECL_UNNAMED_GLOBAL_CONSTANT
A UnnamedGlobalConstantDecl record.
Definition: ASTBitCodes.h:1449
@ DECL_ACCESS_SPEC
An AccessSpecDecl record.
Definition: ASTBitCodes.h:1342
@ DECL_OBJC_TYPE_PARAM
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1431
@ DECL_OBJC_CATEGORY_IMPL
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1212
@ DECL_ENUM_CONSTANT
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1188
@ DECL_PARM_VAR
A ParmVarDecl record.
Definition: ASTBitCodes.h:1245
@ DECL_TYPEDEF
A TypedefDecl record.
Definition: ASTBitCodes.h:1176
@ DECL_EXPANDED_TEMPLATE_TEMPLATE_PARM_PACK
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack.
Definition: ASTBitCodes.h:1407
@ DECL_HLSL_BUFFER
A HLSLBufferDecl record.
Definition: ASTBitCodes.h:1452
@ DECL_NAMESPACE_ALIAS
A NamespaceAliasDecl record.
Definition: ASTBitCodes.h:1291
@ DECL_TYPEALIAS
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1179
@ DECL_FUNCTION_TEMPLATE
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1369
@ DECL_MS_GUID
A MSGuidDecl record.
Definition: ASTBitCodes.h:1233
@ DECL_UNRESOLVED_USING_TYPENAME
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1315
@ DECL_CLASS_TEMPLATE_SPECIALIZATION
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1354
@ DECL_FILE_SCOPE_ASM
A FileScopeAsmDecl record.
Definition: ASTBitCodes.h:1254
@ DECL_CXX_CONSTRUCTOR
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1333
@ DECL_CXX_CONVERSION
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1339
@ DECL_FIELD
A FieldDecl record.
Definition: ASTBitCodes.h:1227
@ DECL_LINKAGE_SPEC
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1318
@ DECL_NAMESPACE
A NamespaceDecl record.
Definition: ASTBitCodes.h:1288
@ DECL_NON_TYPE_TEMPLATE_PARM
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1375
@ DECL_USING_PACK
A UsingPackDecl record.
Definition: ASTBitCodes.h:1300
@ DECL_FUNCTION
A FunctionDecl record.
Definition: ASTBitCodes.h:1191
@ DECL_USING_DIRECTIVE
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1309
@ DECL_RECORD
A RecordDecl record.
Definition: ASTBitCodes.h:1185
@ DECL_CONTEXT_LEXICAL
A record that stores the set of declarations that are lexically stored within a given DeclContext.
Definition: ASTBitCodes.h:1273
@ DECL_BLOCK
A BlockDecl record.
Definition: ASTBitCodes.h:1260
@ DECL_UNRESOLVED_USING_VALUE
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1312
@ DECL_TYPE_ALIAS_TEMPLATE
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1381
@ DECL_OBJC_CATEGORY
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1209
@ DECL_VAR
A VarDecl record.
Definition: ASTBitCodes.h:1239
@ DECL_UNRESOLVED_USING_IF_EXISTS
An UnresolvedUsingIfExistsDecl record.
Definition: ASTBitCodes.h:1387
@ DECL_USING
A UsingDecl record.
Definition: ASTBitCodes.h:1294
@ DECL_OBJC_PROTOCOL
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1200
@ DECL_TEMPLATE_TYPE_PARM
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1372
@ DECL_VAR_TEMPLATE_SPECIALIZATION
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1363
@ DECL_OBJC_IMPLEMENTATION
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1215
@ DECL_LABEL
A LabelDecl record.
Definition: ASTBitCodes.h:1285
@ DECL_OBJC_COMPATIBLE_ALIAS
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1218
@ DECL_CONSTRUCTOR_USING_SHADOW
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1306
@ DECL_USING_ENUM
A UsingEnumDecl record.
Definition: ASTBitCodes.h:1297
@ DECL_FRIEND_TEMPLATE
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1348
@ DECL_PRAGMA_DETECT_MISMATCH
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1440
@ DECL_EXPANDED_NON_TYPE_TEMPLATE_PARM_PACK
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack.
Definition: ASTBitCodes.h:1403
@ DECL_OBJC_AT_DEFS_FIELD
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1206
@ DECL_IMPLICIT_PARAM
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1242
@ DECL_FRIEND
A FriendDecl record.
Definition: ASTBitCodes.h:1345
@ DECL_CXX_METHOD
A CXXMethodDecl record.
Definition: ASTBitCodes.h:1330
@ DECL_EXPORT
An ExportDecl record.
Definition: ASTBitCodes.h:1321
@ DECL_BINDING
A BindingDecl record.
Definition: ASTBitCodes.h:1251
@ DECL_PRAGMA_COMMENT
A PragmaCommentDecl record.
Definition: ASTBitCodes.h:1437
@ DECL_ENUM
An EnumDecl record.
Definition: ASTBitCodes.h:1182
@ DECL_DECOMPOSITION
A DecompositionDecl record.
Definition: ASTBitCodes.h:1248
@ DECL_OMP_DECLARE_REDUCTION
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1446
@ DECL_OMP_THREADPRIVATE
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1413
@ DECL_OBJC_METHOD
A ObjCMethodDecl record.
Definition: ASTBitCodes.h:1194
@ DECL_CXX_DESTRUCTOR
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1336
@ DECL_OMP_CAPTUREDEXPR
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1434
@ DECL_CLASS_TEMPLATE
A ClassTemplateDecl record.
Definition: ASTBitCodes.h:1351
@ DECL_USING_SHADOW
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1303
@ DECL_CONCEPT
A ConceptDecl record.
Definition: ASTBitCodes.h:1384
@ DECL_CXX_DEDUCTION_GUIDE
A CXXDeductionGuideDecl record.
Definition: ASTBitCodes.h:1327
@ DECL_OMP_REQUIRES
An OMPRequiresDecl record.
Definition: ASTBitCodes.h:1416
@ DECL_OBJC_IVAR
A ObjCIvarDecl record.
Definition: ASTBitCodes.h:1203
@ DECL_OBJC_PROPERTY
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1221
@ DECL_TEMPLATE_PARAM_OBJECT
A TemplateParamObjectDecl record.
Definition: ASTBitCodes.h:1236
@ DECL_OBJC_INTERFACE
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1197
@ DECL_VAR_TEMPLATE
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1360
@ DECL_LIFETIME_EXTENDED_TEMPORARY
An LifetimeExtendedTemporaryDecl record.
Definition: ASTBitCodes.h:1425
@ DECL_CLASS_TEMPLATE_PARTIAL_SPECIALIZATION
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1357
@ DECL_IMPLICIT_CONCEPT_SPECIALIZATION
An ImplicitConceptSpecializationDecl record.
Definition: ASTBitCodes.h:1455
@ DECL_CONTEXT_VISIBLE
A record that stores the set of declarations that are visible from a given DeclContext.
Definition: ASTBitCodes.h:1282
@ DECL_OBJC_PROPERTY_IMPL
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1224
@ EXPR_COMPOUND_ASSIGN_OPERATOR
A CompoundAssignOperator record.
Definition: ASTBitCodes.h:1593
@ EXPR_CXX_OPERATOR_CALL
A CXXOperatorCallExpr record.
Definition: ASTBitCodes.h:1748
@ EXPR_IMPLICIT_CAST
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1599
@ EXPR_CHARACTER_LITERAL
A CharacterLiteral record.
Definition: ASTBitCodes.h:1560
@ STMT_COMPOUND
A CompoundStmt record.
Definition: ASTBitCodes.h:1482
@ EXPR_CALL
A CallExpr record.
Definition: ASTBitCodes.h:1584
@ EXPR_BINARY_OPERATOR
A BinaryOperator record.
Definition: ASTBitCodes.h:1590
@ EXPR_DECL_REF
A DeclRefExpr record.
Definition: ASTBitCodes.h:1545
@ EXPR_INTEGER_LITERAL
An IntegerLiteral record.
Definition: ASTBitCodes.h:1548
@ EXPR_CXX_MEMBER_CALL
A CXXMemberCallExpr record.
Definition: ASTBitCodes.h:1751
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
Definition: ASTCommon.cpp:352
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
Definition: ASTCommon.cpp:456
bool isPartOfPerModuleInitializer(const Decl *D)
Determine whether the given declaration will be included in the per-module initializer if it needs to...
Definition: ASTCommon.h:116
@ UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION
Definition: ASTCommon.h:26
@ UPD_CXX_ADDED_ANONYMOUS_NAMESPACE
Definition: ASTCommon.h:27
The JSON file list parser is used to communicate input to InstallAPI.
@ GVA_StrongExternal
Definition: Linkage.h:76
@ GVA_AvailableExternally
Definition: Linkage.h:74
@ GVA_Internal
Definition: Linkage.h:73
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have.
Definition: Linkage.h:24
@ SD_Static
Static storage duration.
Definition: Specifiers.h:328
bool CanElideDeclDef(const Decl *D)
If we can elide the definition of.
const FunctionProtoType * T
bool shouldSkipCheckingODR(const Decl *D)
Definition: ASTReader.h:2467
@ TSK_ImplicitInstantiation
This template specialization was implicitly instantiated from a template.
Definition: Specifiers.h:191
@ AS_none
Definition: Specifiers.h:124
unsigned long uint64_t
Diagnostic wrappers for TextAPI types for error reporting.
Definition: Dominators.h:30
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Definition: Expr.h:6219
Data that is common to all of the declarations of a given function template.
Definition: DeclTemplate.h:964
Parts of a decomposed MSGuidDecl.
Definition: DeclCXX.h: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:737