clang  10.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"
17 #include "clang/AST/DeclTemplate.h"
18 #include "clang/AST/DeclVisitor.h"
19 #include "clang/AST/Expr.h"
20 #include "clang/AST/OpenMPClause.h"
25 #include "llvm/Bitstream/BitstreamWriter.h"
26 #include "llvm/Support/ErrorHandling.h"
27 using namespace clang;
28 using namespace serialization;
29 
30 //===----------------------------------------------------------------------===//
31 // Declaration serialization
32 //===----------------------------------------------------------------------===//
33 
34 namespace clang {
35  class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {
36  ASTWriter &Writer;
37  ASTContext &Context;
38  ASTRecordWriter Record;
39 
41  unsigned AbbrevToUse;
42 
43  public:
44  ASTDeclWriter(ASTWriter &Writer, ASTContext &Context,
46  : Writer(Writer), Context(Context), Record(Writer, Record),
47  Code((serialization::DeclCode)0), AbbrevToUse(0) {}
48 
49  uint64_t Emit(Decl *D) {
50  if (!Code)
51  llvm::report_fatal_error(StringRef("unexpected declaration kind '") +
52  D->getDeclKindName() + "'");
53  return Record.Emit(Code, AbbrevToUse);
54  }
55 
56  void Visit(Decl *D);
57 
58  void VisitDecl(Decl *D);
59  void VisitPragmaCommentDecl(PragmaCommentDecl *D);
60  void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D);
61  void VisitTranslationUnitDecl(TranslationUnitDecl *D);
62  void VisitNamedDecl(NamedDecl *D);
63  void VisitLabelDecl(LabelDecl *LD);
64  void VisitNamespaceDecl(NamespaceDecl *D);
65  void VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
66  void VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
67  void VisitTypeDecl(TypeDecl *D);
68  void VisitTypedefNameDecl(TypedefNameDecl *D);
69  void VisitTypedefDecl(TypedefDecl *D);
70  void VisitTypeAliasDecl(TypeAliasDecl *D);
71  void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
72  void VisitTagDecl(TagDecl *D);
73  void VisitEnumDecl(EnumDecl *D);
74  void VisitRecordDecl(RecordDecl *D);
75  void VisitCXXRecordDecl(CXXRecordDecl *D);
76  void VisitClassTemplateSpecializationDecl(
78  void VisitClassTemplatePartialSpecializationDecl(
80  void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D);
81  void VisitVarTemplatePartialSpecializationDecl(
83  void VisitClassScopeFunctionSpecializationDecl(
85  void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D);
86  void VisitValueDecl(ValueDecl *D);
87  void VisitEnumConstantDecl(EnumConstantDecl *D);
88  void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
89  void VisitDeclaratorDecl(DeclaratorDecl *D);
90  void VisitFunctionDecl(FunctionDecl *D);
91  void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D);
92  void VisitCXXMethodDecl(CXXMethodDecl *D);
93  void VisitCXXConstructorDecl(CXXConstructorDecl *D);
94  void VisitCXXDestructorDecl(CXXDestructorDecl *D);
95  void VisitCXXConversionDecl(CXXConversionDecl *D);
96  void VisitFieldDecl(FieldDecl *D);
97  void VisitMSPropertyDecl(MSPropertyDecl *D);
98  void VisitIndirectFieldDecl(IndirectFieldDecl *D);
99  void VisitVarDecl(VarDecl *D);
100  void VisitImplicitParamDecl(ImplicitParamDecl *D);
101  void VisitParmVarDecl(ParmVarDecl *D);
102  void VisitDecompositionDecl(DecompositionDecl *D);
103  void VisitBindingDecl(BindingDecl *D);
104  void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D);
105  void VisitTemplateDecl(TemplateDecl *D);
106  void VisitConceptDecl(ConceptDecl *D);
107  void VisitRequiresExprBodyDecl(RequiresExprBodyDecl *D);
108  void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D);
109  void VisitClassTemplateDecl(ClassTemplateDecl *D);
110  void VisitVarTemplateDecl(VarTemplateDecl *D);
111  void VisitFunctionTemplateDecl(FunctionTemplateDecl *D);
112  void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D);
113  void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D);
114  void VisitUsingDecl(UsingDecl *D);
115  void VisitUsingPackDecl(UsingPackDecl *D);
116  void VisitUsingShadowDecl(UsingShadowDecl *D);
117  void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D);
118  void VisitLinkageSpecDecl(LinkageSpecDecl *D);
119  void VisitExportDecl(ExportDecl *D);
120  void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
121  void VisitImportDecl(ImportDecl *D);
122  void VisitAccessSpecDecl(AccessSpecDecl *D);
123  void VisitFriendDecl(FriendDecl *D);
124  void VisitFriendTemplateDecl(FriendTemplateDecl *D);
125  void VisitStaticAssertDecl(StaticAssertDecl *D);
126  void VisitBlockDecl(BlockDecl *D);
127  void VisitCapturedDecl(CapturedDecl *D);
128  void VisitEmptyDecl(EmptyDecl *D);
129  void VisitLifetimeExtendedTemporaryDecl(LifetimeExtendedTemporaryDecl *D);
130 
131  void VisitDeclContext(DeclContext *DC);
132  template <typename T> void VisitRedeclarable(Redeclarable<T> *D);
133 
134 
135  // FIXME: Put in the same order is DeclNodes.td?
136  void VisitObjCMethodDecl(ObjCMethodDecl *D);
137  void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D);
138  void VisitObjCContainerDecl(ObjCContainerDecl *D);
139  void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);
140  void VisitObjCIvarDecl(ObjCIvarDecl *D);
141  void VisitObjCProtocolDecl(ObjCProtocolDecl *D);
142  void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D);
143  void VisitObjCCategoryDecl(ObjCCategoryDecl *D);
144  void VisitObjCImplDecl(ObjCImplDecl *D);
145  void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D);
146  void VisitObjCImplementationDecl(ObjCImplementationDecl *D);
147  void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D);
148  void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
149  void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
150  void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
151  void VisitOMPAllocateDecl(OMPAllocateDecl *D);
152  void VisitOMPRequiresDecl(OMPRequiresDecl *D);
153  void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
154  void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D);
155  void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D);
156 
157  /// Add an Objective-C type parameter list to the given record.
159  // Empty type parameter list.
160  if (!typeParams) {
161  Record.push_back(0);
162  return;
163  }
164 
165  Record.push_back(typeParams->size());
166  for (auto typeParam : *typeParams) {
167  Record.AddDeclRef(typeParam);
168  }
169  Record.AddSourceLocation(typeParams->getLAngleLoc());
170  Record.AddSourceLocation(typeParams->getRAngleLoc());
171  }
172 
173  /// Add to the record the first declaration from each module file that
174  /// provides a declaration of D. The intent is to provide a sufficient
175  /// set such that reloading this set will load all current redeclarations.
176  void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
177  llvm::MapVector<ModuleFile*, const Decl*> Firsts;
178  // FIXME: We can skip entries that we know are implied by others.
179  for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) {
180  if (R->isFromASTFile())
181  Firsts[Writer.Chain->getOwningModuleFile(R)] = R;
182  else if (IncludeLocal)
183  Firsts[nullptr] = R;
184  }
185  for (const auto &F : Firsts)
186  Record.AddDeclRef(F.second);
187  }
188 
189  /// Get the specialization decl from an entry in the specialization list.
190  template <typename EntryType>
192  getSpecializationDecl(EntryType &T) {
194  }
195 
196  /// Get the list of partial specializations from a template's common ptr.
197  template<typename T>
198  decltype(T::PartialSpecializations) &getPartialSpecializations(T *Common) {
199  return Common->PartialSpecializations;
200  }
202  return None;
203  }
204 
205  template<typename DeclTy>
207  auto *Common = D->getCommonPtr();
208 
209  // If we have any lazy specializations, and the external AST source is
210  // our chained AST reader, we can just write out the DeclIDs. Otherwise,
211  // we need to resolve them to actual declarations.
212  if (Writer.Chain != Writer.Context->getExternalSource() &&
213  Common->LazySpecializations) {
214  D->LoadLazySpecializations();
215  assert(!Common->LazySpecializations);
216  }
217 
218  ArrayRef<DeclID> LazySpecializations;
219  if (auto *LS = Common->LazySpecializations)
220  LazySpecializations = llvm::makeArrayRef(LS + 1, LS[0]);
221 
222  // Add a slot to the record for the number of specializations.
223  unsigned I = Record.size();
224  Record.push_back(0);
225 
226  // AddFirstDeclFromEachModule might trigger deserialization, invalidating
227  // *Specializations iterators.
229  for (auto &Entry : Common->Specializations)
230  Specs.push_back(getSpecializationDecl(Entry));
231  for (auto &Entry : getPartialSpecializations(Common))
232  Specs.push_back(getSpecializationDecl(Entry));
233 
234  for (auto *D : Specs) {
235  assert(D->isCanonicalDecl() && "non-canonical decl in set");
236  AddFirstDeclFromEachModule(D, /*IncludeLocal*/true);
237  }
238  Record.append(LazySpecializations.begin(), LazySpecializations.end());
239 
240  // Update the size entry we added earlier.
241  Record[I] = Record.size() - I - 1;
242  }
243 
244  /// Ensure that this template specialization is associated with the specified
245  /// template on reload.
246  void RegisterTemplateSpecialization(const Decl *Template,
247  const Decl *Specialization) {
248  Template = Template->getCanonicalDecl();
249 
250  // If the canonical template is local, we'll write out this specialization
251  // when we emit it.
252  // FIXME: We can do the same thing if there is any local declaration of
253  // the template, to avoid emitting an update record.
254  if (!Template->isFromASTFile())
255  return;
256 
257  // We only need to associate the first local declaration of the
258  // specialization. The other declarations will get pulled in by it.
259  if (Writer.getFirstLocalDecl(Specialization) != Specialization)
260  return;
261 
262  Writer.DeclUpdates[Template].push_back(ASTWriter::DeclUpdate(
263  UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION, Specialization));
264  }
265  };
266 }
267 
270 
271  // Source locations require array (variable-length) abbreviations. The
272  // abbreviation infrastructure requires that arrays are encoded last, so
273  // we handle it here in the case of those classes derived from DeclaratorDecl
274  if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(D)) {
275  if (auto *TInfo = DD->getTypeSourceInfo())
276  Record.AddTypeLoc(TInfo->getTypeLoc());
277  }
278 
279  // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
280  // have been written. We want it last because we will not read it back when
281  // retrieving it from the AST, we'll just lazily set the offset.
282  if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
283  Record.push_back(FD->doesThisDeclarationHaveABody());
284  if (FD->doesThisDeclarationHaveABody())
285  Record.AddFunctionDefinition(FD);
286  }
287 
288  // If this declaration is also a DeclContext, write blocks for the
289  // declarations that lexically stored inside its context and those
290  // declarations that are visible from its context.
291  if (DeclContext *DC = dyn_cast<DeclContext>(D))
292  VisitDeclContext(DC);
293 }
294 
296  Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
297  if (D->getDeclContext() != D->getLexicalDeclContext())
298  Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
299  else
300  Record.push_back(0);
301  Record.push_back(D->isInvalidDecl());
302  Record.push_back(D->hasAttrs());
303  if (D->hasAttrs())
304  Record.AddAttributes(D->getAttrs());
305  Record.push_back(D->isImplicit());
306  Record.push_back(D->isUsed(false));
307  Record.push_back(D->isReferenced());
308  Record.push_back(D->isTopLevelDeclInObjCContainer());
309  Record.push_back(D->getAccess());
310  Record.push_back(D->isModulePrivate());
311  Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
312 
313  // If this declaration injected a name into a context different from its
314  // lexical context, and that context is an imported namespace, we need to
315  // update its visible declarations to include this name.
316  //
317  // This happens when we instantiate a class with a friend declaration or a
318  // function with a local extern declaration, for instance.
319  //
320  // FIXME: Can we handle this in AddedVisibleDecl instead?
321  if (D->isOutOfLine()) {
322  auto *DC = D->getDeclContext();
323  while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
324  if (!NS->isFromASTFile())
325  break;
326  Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
327  if (!NS->isInlineNamespace())
328  break;
329  DC = NS->getParent();
330  }
331  }
332 }
333 
335  StringRef Arg = D->getArg();
336  Record.push_back(Arg.size());
337  VisitDecl(D);
338  Record.AddSourceLocation(D->getBeginLoc());
339  Record.push_back(D->getCommentKind());
340  Record.AddString(Arg);
342 }
343 
346  StringRef Name = D->getName();
347  StringRef Value = D->getValue();
348  Record.push_back(Name.size() + 1 + Value.size());
349  VisitDecl(D);
350  Record.AddSourceLocation(D->getBeginLoc());
351  Record.AddString(Name);
352  Record.AddString(Value);
354 }
355 
357  llvm_unreachable("Translation units aren't directly serialized");
358 }
359 
361  VisitDecl(D);
362  Record.AddDeclarationName(D->getDeclName());
363  Record.push_back(needsAnonymousDeclarationNumber(D)
364  ? Writer.getAnonymousDeclarationNumber(D)
365  : 0);
366 }
367 
369  VisitNamedDecl(D);
370  Record.AddSourceLocation(D->getBeginLoc());
371  Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
372 }
373 
375  VisitRedeclarable(D);
376  VisitTypeDecl(D);
377  Record.AddTypeSourceInfo(D->getTypeSourceInfo());
378  Record.push_back(D->isModed());
379  if (D->isModed())
380  Record.AddTypeRef(D->getUnderlyingType());
381  Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
382 }
383 
385  VisitTypedefNameDecl(D);
386  if (D->getDeclContext() == D->getLexicalDeclContext() &&
387  !D->hasAttrs() &&
388  !D->isImplicit() &&
389  D->getFirstDecl() == D->getMostRecentDecl() &&
390  !D->isInvalidDecl() &&
392  !D->isModulePrivate() &&
395  AbbrevToUse = Writer.getDeclTypedefAbbrev();
396 
398 }
399 
401  VisitTypedefNameDecl(D);
402  Record.AddDeclRef(D->getDescribedAliasTemplate());
404 }
405 
407  VisitRedeclarable(D);
408  VisitTypeDecl(D);
409  Record.push_back(D->getIdentifierNamespace());
410  Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding
411  if (!isa<CXXRecordDecl>(D))
412  Record.push_back(D->isCompleteDefinition());
413  Record.push_back(D->isEmbeddedInDeclarator());
414  Record.push_back(D->isFreeStanding());
415  Record.push_back(D->isCompleteDefinitionRequired());
416  Record.AddSourceRange(D->getBraceRange());
417 
418  if (D->hasExtInfo()) {
419  Record.push_back(1);
420  Record.AddQualifierInfo(*D->getExtInfo());
421  } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
422  Record.push_back(2);
423  Record.AddDeclRef(TD);
424  Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
425  } else {
426  Record.push_back(0);
427  }
428 }
429 
431  VisitTagDecl(D);
432  Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
433  if (!D->getIntegerTypeSourceInfo())
434  Record.AddTypeRef(D->getIntegerType());
435  Record.AddTypeRef(D->getPromotionType());
436  Record.push_back(D->getNumPositiveBits());
437  Record.push_back(D->getNumNegativeBits());
438  Record.push_back(D->isScoped());
439  Record.push_back(D->isScopedUsingClassTag());
440  Record.push_back(D->isFixed());
441  Record.push_back(D->getODRHash());
442 
443  if (MemberSpecializationInfo *MemberInfo = D->getMemberSpecializationInfo()) {
444  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
445  Record.push_back(MemberInfo->getTemplateSpecializationKind());
446  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
447  } else {
448  Record.AddDeclRef(nullptr);
449  }
450 
451  if (D->getDeclContext() == D->getLexicalDeclContext() &&
452  !D->hasAttrs() &&
453  !D->isImplicit() &&
454  !D->isUsed(false) &&
455  !D->hasExtInfo() &&
457  D->getFirstDecl() == D->getMostRecentDecl() &&
458  !D->isInvalidDecl() &&
459  !D->isReferenced() &&
461  D->getAccess() == AS_none &&
462  !D->isModulePrivate() &&
464  !D->getIntegerTypeSourceInfo() &&
468  AbbrevToUse = Writer.getDeclEnumAbbrev();
469 
471 }
472 
474  VisitTagDecl(D);
475  Record.push_back(D->hasFlexibleArrayMember());
476  Record.push_back(D->isAnonymousStructOrUnion());
477  Record.push_back(D->hasObjectMember());
478  Record.push_back(D->hasVolatileMember());
479  Record.push_back(D->isNonTrivialToPrimitiveDefaultInitialize());
480  Record.push_back(D->isNonTrivialToPrimitiveCopy());
481  Record.push_back(D->isNonTrivialToPrimitiveDestroy());
483  Record.push_back(D->hasNonTrivialToPrimitiveDestructCUnion());
484  Record.push_back(D->hasNonTrivialToPrimitiveCopyCUnion());
485  Record.push_back(D->isParamDestroyedInCallee());
486  Record.push_back(D->getArgPassingRestrictions());
487 
488  if (D->getDeclContext() == D->getLexicalDeclContext() &&
489  !D->hasAttrs() &&
490  !D->isImplicit() &&
491  !D->isUsed(false) &&
492  !D->hasExtInfo() &&
494  D->getFirstDecl() == D->getMostRecentDecl() &&
495  !D->isInvalidDecl() &&
496  !D->isReferenced() &&
498  D->getAccess() == AS_none &&
499  !D->isModulePrivate() &&
503  AbbrevToUse = Writer.getDeclRecordAbbrev();
504 
506 }
507 
509  VisitNamedDecl(D);
510  Record.AddTypeRef(D->getType());
511 }
512 
514  VisitValueDecl(D);
515  Record.push_back(D->getInitExpr()? 1 : 0);
516  if (D->getInitExpr())
517  Record.AddStmt(D->getInitExpr());
518  Record.AddAPSInt(D->getInitVal());
519 
521 }
522 
524  VisitValueDecl(D);
525  Record.AddSourceLocation(D->getInnerLocStart());
526  Record.push_back(D->hasExtInfo());
527  if (D->hasExtInfo()) {
528  DeclaratorDecl::ExtInfo *Info = D->getExtInfo();
529  Record.AddQualifierInfo(*Info);
530  Record.AddStmt(Info->TrailingRequiresClause);
531  }
532  // The location information is deferred until the end of the record.
533  Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()
534  : QualType());
535 }
536 
538  VisitRedeclarable(D);
539  VisitDeclaratorDecl(D);
540  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
541  Record.push_back(D->getIdentifierNamespace());
542 
543  // FunctionDecl's body is handled last at ASTWriterDecl::Visit,
544  // after everything else is written.
545  Record.push_back(static_cast<int>(D->getStorageClass())); // FIXME: stable encoding
546  Record.push_back(D->isInlineSpecified());
547  Record.push_back(D->isInlined());
548  Record.push_back(D->isVirtualAsWritten());
549  Record.push_back(D->isPure());
550  Record.push_back(D->hasInheritedPrototype());
551  Record.push_back(D->hasWrittenPrototype());
552  Record.push_back(D->isDeletedBit());
553  Record.push_back(D->isTrivial());
554  Record.push_back(D->isTrivialForCall());
555  Record.push_back(D->isDefaulted());
556  Record.push_back(D->isExplicitlyDefaulted());
557  Record.push_back(D->hasImplicitReturnZero());
558  Record.push_back(D->getConstexprKind());
559  Record.push_back(D->usesSEHTry());
560  Record.push_back(D->hasSkippedBody());
561  Record.push_back(D->isMultiVersion());
562  Record.push_back(D->isLateTemplateParsed());
563  Record.push_back(D->getLinkageInternal());
564  Record.AddSourceLocation(D->getEndLoc());
565 
566  Record.push_back(D->getODRHash());
567  Record.push_back(D->usesFPIntrin());
568 
569  if (D->isDefaulted()) {
570  if (auto *FDI = D->getDefaultedFunctionInfo()) {
571  Record.push_back(FDI->getUnqualifiedLookups().size());
572  for (DeclAccessPair P : FDI->getUnqualifiedLookups()) {
573  Record.AddDeclRef(P.getDecl());
574  Record.push_back(P.getAccess());
575  }
576  } else {
577  Record.push_back(0);
578  }
579  }
580 
581  Record.push_back(D->getTemplatedKind());
582  switch (D->getTemplatedKind()) {
584  break;
586  Record.AddDeclRef(D->getDescribedFunctionTemplate());
587  break;
590  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
591  Record.push_back(MemberInfo->getTemplateSpecializationKind());
592  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
593  break;
594  }
597  FTSInfo = D->getTemplateSpecializationInfo();
598 
599  RegisterTemplateSpecialization(FTSInfo->getTemplate(), D);
600 
601  Record.AddDeclRef(FTSInfo->getTemplate());
602  Record.push_back(FTSInfo->getTemplateSpecializationKind());
603 
604  // Template arguments.
605  Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
606 
607  // Template args as written.
608  Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
609  if (FTSInfo->TemplateArgumentsAsWritten) {
610  Record.push_back(FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs);
611  for (int i=0, e = FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs;
612  i!=e; ++i)
613  Record.AddTemplateArgumentLoc(
614  (*FTSInfo->TemplateArgumentsAsWritten)[i]);
615  Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->LAngleLoc);
616  Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->RAngleLoc);
617  }
618 
619  Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
620 
621  if (MemberSpecializationInfo *MemberInfo =
622  FTSInfo->getMemberSpecializationInfo()) {
623  Record.push_back(1);
624  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
625  Record.push_back(MemberInfo->getTemplateSpecializationKind());
626  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
627  } else {
628  Record.push_back(0);
629  }
630 
631  if (D->isCanonicalDecl()) {
632  // Write the template that contains the specializations set. We will
633  // add a FunctionTemplateSpecializationInfo to it when reading.
634  Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
635  }
636  break;
637  }
640  DFTSInfo = D->getDependentSpecializationInfo();
641 
642  // Templates.
643  Record.push_back(DFTSInfo->getNumTemplates());
644  for (int i=0, e = DFTSInfo->getNumTemplates(); i != e; ++i)
645  Record.AddDeclRef(DFTSInfo->getTemplate(i));
646 
647  // Templates args.
648  Record.push_back(DFTSInfo->getNumTemplateArgs());
649  for (int i=0, e = DFTSInfo->getNumTemplateArgs(); i != e; ++i)
650  Record.AddTemplateArgumentLoc(DFTSInfo->getTemplateArg(i));
651  Record.AddSourceLocation(DFTSInfo->getLAngleLoc());
652  Record.AddSourceLocation(DFTSInfo->getRAngleLoc());
653  break;
654  }
655  }
656 
657  Record.push_back(D->param_size());
658  for (auto P : D->parameters())
659  Record.AddDeclRef(P);
661 }
662 
664  ASTRecordWriter &Record) {
665  uint64_t Kind = static_cast<uint64_t>(ES.getKind());
667  Record.push_back(Kind);
668  if (ES.getExpr()) {
669  Record.AddStmt(ES.getExpr());
670  }
671 }
672 
675  VisitFunctionDecl(D);
676  Record.push_back(D->isCopyDeductionCandidate());
678 }
679 
681  VisitNamedDecl(D);
682  // FIXME: convert to LazyStmtPtr?
683  // Unlike C/C++, method bodies will never be in header files.
684  bool HasBodyStuff = D->getBody() != nullptr;
685  Record.push_back(HasBodyStuff);
686  if (HasBodyStuff) {
687  Record.AddStmt(D->getBody());
688  }
689  Record.AddDeclRef(D->getSelfDecl());
690  Record.AddDeclRef(D->getCmdDecl());
691  Record.push_back(D->isInstanceMethod());
692  Record.push_back(D->isVariadic());
693  Record.push_back(D->isPropertyAccessor());
694  Record.push_back(D->isSynthesizedAccessorStub());
695  Record.push_back(D->isDefined());
696  Record.push_back(D->isOverriding());
697  Record.push_back(D->hasSkippedBody());
698 
699  Record.push_back(D->isRedeclaration());
700  Record.push_back(D->hasRedeclaration());
701  if (D->hasRedeclaration()) {
702  assert(Context.getObjCMethodRedeclaration(D));
703  Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
704  }
705 
706  // FIXME: stable encoding for @required/@optional
707  Record.push_back(D->getImplementationControl());
708  // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
709  Record.push_back(D->getObjCDeclQualifier());
710  Record.push_back(D->hasRelatedResultType());
711  Record.AddTypeRef(D->getReturnType());
712  Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
713  Record.AddSourceLocation(D->getEndLoc());
714  Record.push_back(D->param_size());
715  for (const auto *P : D->parameters())
716  Record.AddDeclRef(P);
717 
718  Record.push_back(D->getSelLocsKind());
719  unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
720  SourceLocation *SelLocs = D->getStoredSelLocs();
721  Record.push_back(NumStoredSelLocs);
722  for (unsigned i = 0; i != NumStoredSelLocs; ++i)
723  Record.AddSourceLocation(SelLocs[i]);
724 
726 }
727 
729  VisitTypedefNameDecl(D);
730  Record.push_back(D->Variance);
731  Record.push_back(D->Index);
732  Record.AddSourceLocation(D->VarianceLoc);
733  Record.AddSourceLocation(D->ColonLoc);
734 
736 }
737 
739  VisitNamedDecl(D);
740  Record.AddSourceLocation(D->getAtStartLoc());
741  Record.AddSourceRange(D->getAtEndRange());
742  // Abstract class (no need to define a stable serialization::DECL code).
743 }
744 
746  VisitRedeclarable(D);
747  VisitObjCContainerDecl(D);
748  Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
749  AddObjCTypeParamList(D->TypeParamList);
750 
751  Record.push_back(D->isThisDeclarationADefinition());
752  if (D->isThisDeclarationADefinition()) {
753  // Write the DefinitionData
754  ObjCInterfaceDecl::DefinitionData &Data = D->data();
755 
756  Record.AddTypeSourceInfo(D->getSuperClassTInfo());
757  Record.AddSourceLocation(D->getEndOfDefinitionLoc());
758  Record.push_back(Data.HasDesignatedInitializers);
759 
760  // Write out the protocols that are directly referenced by the @interface.
761  Record.push_back(Data.ReferencedProtocols.size());
762  for (const auto *P : D->protocols())
763  Record.AddDeclRef(P);
764  for (const auto &PL : D->protocol_locs())
765  Record.AddSourceLocation(PL);
766 
767  // Write out the protocols that are transitively referenced.
768  Record.push_back(Data.AllReferencedProtocols.size());
770  P = Data.AllReferencedProtocols.begin(),
771  PEnd = Data.AllReferencedProtocols.end();
772  P != PEnd; ++P)
773  Record.AddDeclRef(*P);
774 
775 
776  if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
777  // Ensure that we write out the set of categories for this class.
778  Writer.ObjCClassesWithCategories.insert(D);
779 
780  // Make sure that the categories get serialized.
781  for (; Cat; Cat = Cat->getNextClassCategoryRaw())
782  (void)Writer.GetDeclRef(Cat);
783  }
784  }
785 
787 }
788 
790  VisitFieldDecl(D);
791  // FIXME: stable encoding for @public/@private/@protected/@package
792  Record.push_back(D->getAccessControl());
793  Record.push_back(D->getSynthesize());
794 
795  if (D->getDeclContext() == D->getLexicalDeclContext() &&
796  !D->hasAttrs() &&
797  !D->isImplicit() &&
798  !D->isUsed(false) &&
799  !D->isInvalidDecl() &&
800  !D->isReferenced() &&
801  !D->isModulePrivate() &&
802  !D->getBitWidth() &&
803  !D->hasExtInfo() &&
804  D->getDeclName())
805  AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
806 
808 }
809 
811  VisitRedeclarable(D);
812  VisitObjCContainerDecl(D);
813 
814  Record.push_back(D->isThisDeclarationADefinition());
815  if (D->isThisDeclarationADefinition()) {
816  Record.push_back(D->protocol_size());
817  for (const auto *I : D->protocols())
818  Record.AddDeclRef(I);
819  for (const auto &PL : D->protocol_locs())
820  Record.AddSourceLocation(PL);
821  }
822 
824 }
825 
827  VisitFieldDecl(D);
829 }
830 
832  VisitObjCContainerDecl(D);
833  Record.AddSourceLocation(D->getCategoryNameLoc());
834  Record.AddSourceLocation(D->getIvarLBraceLoc());
835  Record.AddSourceLocation(D->getIvarRBraceLoc());
836  Record.AddDeclRef(D->getClassInterface());
837  AddObjCTypeParamList(D->TypeParamList);
838  Record.push_back(D->protocol_size());
839  for (const auto *I : D->protocols())
840  Record.AddDeclRef(I);
841  for (const auto &PL : D->protocol_locs())
842  Record.AddSourceLocation(PL);
844 }
845 
847  VisitNamedDecl(D);
848  Record.AddDeclRef(D->getClassInterface());
850 }
851 
853  VisitNamedDecl(D);
854  Record.AddSourceLocation(D->getAtLoc());
855  Record.AddSourceLocation(D->getLParenLoc());
856  Record.AddTypeRef(D->getType());
857  Record.AddTypeSourceInfo(D->getTypeSourceInfo());
858  // FIXME: stable encoding
859  Record.push_back((unsigned)D->getPropertyAttributes());
860  Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
861  // FIXME: stable encoding
862  Record.push_back((unsigned)D->getPropertyImplementation());
863  Record.AddDeclarationName(D->getGetterName());
864  Record.AddSourceLocation(D->getGetterNameLoc());
865  Record.AddDeclarationName(D->getSetterName());
866  Record.AddSourceLocation(D->getSetterNameLoc());
867  Record.AddDeclRef(D->getGetterMethodDecl());
868  Record.AddDeclRef(D->getSetterMethodDecl());
869  Record.AddDeclRef(D->getPropertyIvarDecl());
871 }
872 
874  VisitObjCContainerDecl(D);
875  Record.AddDeclRef(D->getClassInterface());
876  // Abstract class (no need to define a stable serialization::DECL code).
877 }
878 
880  VisitObjCImplDecl(D);
881  Record.AddSourceLocation(D->getCategoryNameLoc());
883 }
884 
886  VisitObjCImplDecl(D);
887  Record.AddDeclRef(D->getSuperClass());
888  Record.AddSourceLocation(D->getSuperClassLoc());
889  Record.AddSourceLocation(D->getIvarLBraceLoc());
890  Record.AddSourceLocation(D->getIvarRBraceLoc());
891  Record.push_back(D->hasNonZeroConstructors());
892  Record.push_back(D->hasDestructors());
893  Record.push_back(D->NumIvarInitializers);
894  if (D->NumIvarInitializers)
895  Record.AddCXXCtorInitializers(
896  llvm::makeArrayRef(D->init_begin(), D->init_end()));
898 }
899 
901  VisitDecl(D);
902  Record.AddSourceLocation(D->getBeginLoc());
903  Record.AddDeclRef(D->getPropertyDecl());
904  Record.AddDeclRef(D->getPropertyIvarDecl());
905  Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
906  Record.AddDeclRef(D->getGetterMethodDecl());
907  Record.AddDeclRef(D->getSetterMethodDecl());
908  Record.AddStmt(D->getGetterCXXConstructor());
909  Record.AddStmt(D->getSetterCXXAssignment());
911 }
912 
914  VisitDeclaratorDecl(D);
915  Record.push_back(D->isMutable());
916 
917  FieldDecl::InitStorageKind ISK = D->InitStorage.getInt();
918  Record.push_back(ISK);
919  if (ISK == FieldDecl::ISK_CapturedVLAType)
920  Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
921  else if (ISK)
922  Record.AddStmt(D->getInClassInitializer());
923 
924  Record.AddStmt(D->getBitWidth());
925 
926  if (!D->getDeclName())
927  Record.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D));
928 
929  if (D->getDeclContext() == D->getLexicalDeclContext() &&
930  !D->hasAttrs() &&
931  !D->isImplicit() &&
932  !D->isUsed(false) &&
933  !D->isInvalidDecl() &&
934  !D->isReferenced() &&
936  !D->isModulePrivate() &&
937  !D->getBitWidth() &&
938  !D->hasInClassInitializer() &&
939  !D->hasCapturedVLAType() &&
940  !D->hasExtInfo() &&
943  D->getDeclName())
944  AbbrevToUse = Writer.getDeclFieldAbbrev();
945 
947 }
948 
950  VisitDeclaratorDecl(D);
951  Record.AddIdentifierRef(D->getGetterId());
952  Record.AddIdentifierRef(D->getSetterId());
954 }
955 
957  VisitValueDecl(D);
958  Record.push_back(D->getChainingSize());
959 
960  for (const auto *P : D->chain())
961  Record.AddDeclRef(P);
963 }
964 
966  VisitRedeclarable(D);
967  VisitDeclaratorDecl(D);
968  Record.push_back(D->getStorageClass());
969  Record.push_back(D->getTSCSpec());
970  Record.push_back(D->getInitStyle());
971  Record.push_back(D->isARCPseudoStrong());
972  if (!isa<ParmVarDecl>(D)) {
973  Record.push_back(D->isThisDeclarationADemotedDefinition());
974  Record.push_back(D->isExceptionVariable());
975  Record.push_back(D->isNRVOVariable());
976  Record.push_back(D->isCXXForRangeDecl());
977  Record.push_back(D->isObjCForDecl());
978  Record.push_back(D->isInline());
979  Record.push_back(D->isInlineSpecified());
980  Record.push_back(D->isConstexpr());
981  Record.push_back(D->isInitCapture());
982  Record.push_back(D->isPreviousDeclInSameBlockScope());
983  if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
984  Record.push_back(static_cast<unsigned>(IPD->getParameterKind()));
985  else
986  Record.push_back(0);
987  Record.push_back(D->isEscapingByref());
988  }
989  Record.push_back(D->getLinkageInternal());
990 
991  if (D->getInit()) {
992  if (!D->isInitKnownICE())
993  Record.push_back(1);
994  else {
995  Record.push_back(
996  2 |
997  (D->isInitICE() ? 1 : 0) |
999  }
1000  Record.AddStmt(D->getInit());
1001  } else {
1002  Record.push_back(0);
1003  }
1004 
1005  if (D->hasAttr<BlocksAttr>() && D->getType()->getAsCXXRecordDecl()) {
1006  BlockVarCopyInit Init = Writer.Context->getBlockVarCopyInit(D);
1007  Record.AddStmt(Init.getCopyExpr());
1008  if (Init.getCopyExpr())
1009  Record.push_back(Init.canThrow());
1010  }
1011 
1012  if (D->getStorageDuration() == SD_Static) {
1013  bool ModulesCodegen = false;
1015  !isa<VarTemplateSpecializationDecl>(D)) {
1016  // When building a C++ Modules TS module interface unit, a strong
1017  // definition in the module interface is provided by the compilation of
1018  // that module interface unit, not by its users. (Inline variables are
1019  // still emitted in module users.)
1020  ModulesCodegen =
1021  (((Writer.WritingModule &&
1022  Writer.WritingModule->Kind == Module::ModuleInterfaceUnit) ||
1023  Writer.Context->getLangOpts().BuildingPCHWithObjectFile) &&
1024  Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal);
1025  }
1026  Record.push_back(ModulesCodegen);
1027  if (ModulesCodegen)
1028  Writer.ModularCodegenDecls.push_back(Writer.GetDeclRef(D));
1029  }
1030 
1031  enum {
1032  VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1033  };
1034  if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1035  Record.push_back(VarTemplate);
1036  Record.AddDeclRef(TemplD);
1037  } else if (MemberSpecializationInfo *SpecInfo
1038  = D->getMemberSpecializationInfo()) {
1039  Record.push_back(StaticDataMemberSpecialization);
1040  Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1041  Record.push_back(SpecInfo->getTemplateSpecializationKind());
1042  Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1043  } else {
1044  Record.push_back(VarNotTemplate);
1045  }
1046 
1047  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1048  !D->hasAttrs() &&
1049  !D->isImplicit() &&
1050  !D->isUsed(false) &&
1051  !D->isInvalidDecl() &&
1052  !D->isReferenced() &&
1054  D->getAccess() == AS_none &&
1055  !D->isModulePrivate() &&
1058  !D->hasExtInfo() &&
1059  D->getFirstDecl() == D->getMostRecentDecl() &&
1060  D->getKind() == Decl::Var &&
1061  !D->isInline() &&
1062  !D->isConstexpr() &&
1063  !D->isInitCapture() &&
1065  !(D->hasAttr<BlocksAttr>() && D->getType()->getAsCXXRecordDecl()) &&
1066  !D->isEscapingByref() &&
1067  D->getStorageDuration() != SD_Static &&
1069  AbbrevToUse = Writer.getDeclVarAbbrev();
1070 
1071  Code = serialization::DECL_VAR;
1072 }
1073 
1075  VisitVarDecl(D);
1077 }
1078 
1080  VisitVarDecl(D);
1081  Record.push_back(D->isObjCMethodParameter());
1082  Record.push_back(D->getFunctionScopeDepth());
1083  Record.push_back(D->getFunctionScopeIndex());
1084  Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding
1085  Record.push_back(D->isKNRPromoted());
1086  Record.push_back(D->hasInheritedDefaultArg());
1087  Record.push_back(D->hasUninstantiatedDefaultArg());
1088  if (D->hasUninstantiatedDefaultArg())
1089  Record.AddStmt(D->getUninstantiatedDefaultArg());
1091 
1092  assert(!D->isARCPseudoStrong()); // can be true of ImplicitParamDecl
1093 
1094  // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1095  // we dynamically check for the properties that we optimize for, but don't
1096  // know are true of all PARM_VAR_DECLs.
1097  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1098  !D->hasAttrs() &&
1099  !D->hasExtInfo() &&
1100  !D->isImplicit() &&
1101  !D->isUsed(false) &&
1102  !D->isInvalidDecl() &&
1103  !D->isReferenced() &&
1104  D->getAccess() == AS_none &&
1105  !D->isModulePrivate() &&
1106  D->getStorageClass() == 0 &&
1107  D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1108  D->getFunctionScopeDepth() == 0 &&
1109  D->getObjCDeclQualifier() == 0 &&
1110  !D->isKNRPromoted() &&
1111  !D->hasInheritedDefaultArg() &&
1112  D->getInit() == nullptr &&
1113  !D->hasUninstantiatedDefaultArg()) // No default expr.
1114  AbbrevToUse = Writer.getDeclParmVarAbbrev();
1115 
1116  // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1117  // just us assuming it.
1118  assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1120  && "PARM_VAR_DECL can't be demoted definition.");
1121  assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1122  assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1123  assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1124  assert(!D->isStaticDataMember() &&
1125  "PARM_VAR_DECL can't be static data member");
1126 }
1127 
1129  // Record the number of bindings first to simplify deserialization.
1130  Record.push_back(D->bindings().size());
1131 
1132  VisitVarDecl(D);
1133  for (auto *B : D->bindings())
1134  Record.AddDeclRef(B);
1136 }
1137 
1139  VisitValueDecl(D);
1140  Record.AddStmt(D->getBinding());
1142 }
1143 
1145  VisitDecl(D);
1146  Record.AddStmt(D->getAsmString());
1147  Record.AddSourceLocation(D->getRParenLoc());
1149 }
1150 
1152  VisitDecl(D);
1154 }
1155 
1158  VisitDecl(D);
1159  Record.AddDeclRef(D->getExtendingDecl());
1160  Record.AddStmt(D->getTemporaryExpr());
1161  Record.push_back(static_cast<bool>(D->getValue()));
1162  if (D->getValue())
1163  Record.AddAPValue(*D->getValue());
1164  Record.push_back(D->getManglingNumber());
1166 }
1168  VisitDecl(D);
1169  Record.AddStmt(D->getBody());
1170  Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1171  Record.push_back(D->param_size());
1172  for (ParmVarDecl *P : D->parameters())
1173  Record.AddDeclRef(P);
1174  Record.push_back(D->isVariadic());
1175  Record.push_back(D->blockMissingReturnType());
1176  Record.push_back(D->isConversionFromLambda());
1177  Record.push_back(D->doesNotEscape());
1178  Record.push_back(D->canAvoidCopyToHeap());
1179  Record.push_back(D->capturesCXXThis());
1180  Record.push_back(D->getNumCaptures());
1181  for (const auto &capture : D->captures()) {
1182  Record.AddDeclRef(capture.getVariable());
1183 
1184  unsigned flags = 0;
1185  if (capture.isByRef()) flags |= 1;
1186  if (capture.isNested()) flags |= 2;
1187  if (capture.hasCopyExpr()) flags |= 4;
1188  Record.push_back(flags);
1189 
1190  if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1191  }
1192 
1194 }
1195 
1197  Record.push_back(CD->getNumParams());
1198  VisitDecl(CD);
1199  Record.push_back(CD->getContextParamPosition());
1200  Record.push_back(CD->isNothrow() ? 1 : 0);
1201  // Body is stored by VisitCapturedStmt.
1202  for (unsigned I = 0; I < CD->getNumParams(); ++I)
1203  Record.AddDeclRef(CD->getParam(I));
1205 }
1206 
1208  VisitDecl(D);
1209  Record.push_back(D->getLanguage());
1210  Record.AddSourceLocation(D->getExternLoc());
1211  Record.AddSourceLocation(D->getRBraceLoc());
1213 }
1214 
1216  VisitDecl(D);
1217  Record.AddSourceLocation(D->getRBraceLoc());
1219 }
1220 
1222  VisitNamedDecl(D);
1223  Record.AddSourceLocation(D->getBeginLoc());
1225 }
1226 
1227 
1229  VisitRedeclarable(D);
1230  VisitNamedDecl(D);
1231  Record.push_back(D->isInline());
1232  Record.AddSourceLocation(D->getBeginLoc());
1233  Record.AddSourceLocation(D->getRBraceLoc());
1234 
1235  if (D->isOriginalNamespace())
1236  Record.AddDeclRef(D->getAnonymousNamespace());
1238 
1239  if (Writer.hasChain() && D->isAnonymousNamespace() &&
1240  D == D->getMostRecentDecl()) {
1241  // This is a most recent reopening of the anonymous namespace. If its parent
1242  // is in a previous PCH (or is the TU), mark that parent for update, because
1243  // the original namespace always points to the latest re-opening of its
1244  // anonymous namespace.
1245  Decl *Parent = cast<Decl>(
1247  if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1248  Writer.DeclUpdates[Parent].push_back(
1249  ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
1250  }
1251  }
1252 }
1253 
1255  VisitRedeclarable(D);
1256  VisitNamedDecl(D);
1257  Record.AddSourceLocation(D->getNamespaceLoc());
1258  Record.AddSourceLocation(D->getTargetNameLoc());
1259  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1260  Record.AddDeclRef(D->getNamespace());
1262 }
1263 
1265  VisitNamedDecl(D);
1266  Record.AddSourceLocation(D->getUsingLoc());
1267  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1268  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1269  Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1270  Record.push_back(D->hasTypename());
1271  Record.AddDeclRef(Context.getInstantiatedFromUsingDecl(D));
1273 }
1274 
1276  Record.push_back(D->NumExpansions);
1277  VisitNamedDecl(D);
1278  Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
1279  for (auto *E : D->expansions())
1280  Record.AddDeclRef(E);
1282 }
1283 
1285  VisitRedeclarable(D);
1286  VisitNamedDecl(D);
1287  Record.AddDeclRef(D->getTargetDecl());
1288  Record.push_back(D->getIdentifierNamespace());
1289  Record.AddDeclRef(D->UsingOrNextShadow);
1290  Record.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D));
1292 }
1293 
1296  VisitUsingShadowDecl(D);
1297  Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1298  Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1299  Record.push_back(D->IsVirtual);
1301 }
1302 
1304  VisitNamedDecl(D);
1305  Record.AddSourceLocation(D->getUsingLoc());
1306  Record.AddSourceLocation(D->getNamespaceKeyLocation());
1307  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1308  Record.AddDeclRef(D->getNominatedNamespace());
1309  Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1311 }
1312 
1314  VisitValueDecl(D);
1315  Record.AddSourceLocation(D->getUsingLoc());
1316  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1317  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1318  Record.AddSourceLocation(D->getEllipsisLoc());
1320 }
1321 
1324  VisitTypeDecl(D);
1325  Record.AddSourceLocation(D->getTypenameLoc());
1326  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1327  Record.AddSourceLocation(D->getEllipsisLoc());
1329 }
1330 
1332  VisitRecordDecl(D);
1333 
1334  enum {
1335  CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
1336  };
1337  if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1338  Record.push_back(CXXRecTemplate);
1339  Record.AddDeclRef(TemplD);
1340  } else if (MemberSpecializationInfo *MSInfo
1341  = D->getMemberSpecializationInfo()) {
1342  Record.push_back(CXXRecMemberSpecialization);
1343  Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1344  Record.push_back(MSInfo->getTemplateSpecializationKind());
1345  Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1346  } else {
1347  Record.push_back(CXXRecNotTemplate);
1348  }
1349 
1350  Record.push_back(D->isThisDeclarationADefinition());
1352  Record.AddCXXDefinitionData(D);
1353 
1354  // Store (what we currently believe to be) the key function to avoid
1355  // deserializing every method so we can compute it.
1356  if (D->isCompleteDefinition())
1357  Record.AddDeclRef(Context.getCurrentKeyFunction(D));
1358 
1360 }
1361 
1363  VisitFunctionDecl(D);
1364  if (D->isCanonicalDecl()) {
1365  Record.push_back(D->size_overridden_methods());
1366  for (const CXXMethodDecl *MD : D->overridden_methods())
1367  Record.AddDeclRef(MD);
1368  } else {
1369  // We only need to record overridden methods once for the canonical decl.
1370  Record.push_back(0);
1371  }
1372 
1373  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1374  D->getFirstDecl() == D->getMostRecentDecl() &&
1375  !D->isInvalidDecl() &&
1376  !D->hasAttrs() &&
1379  !D->hasExtInfo() &&
1380  !D->hasInheritedPrototype() &&
1381  D->hasWrittenPrototype())
1382  AbbrevToUse = Writer.getDeclCXXMethodAbbrev();
1383 
1385 }
1386 
1388  Record.push_back(D->getTraillingAllocKind());
1390  if (auto Inherited = D->getInheritedConstructor()) {
1391  Record.AddDeclRef(Inherited.getShadowDecl());
1392  Record.AddDeclRef(Inherited.getConstructor());
1393  }
1394 
1395  VisitCXXMethodDecl(D);
1397 }
1398 
1400  VisitCXXMethodDecl(D);
1401 
1402  Record.AddDeclRef(D->getOperatorDelete());
1403  if (D->getOperatorDelete())
1404  Record.AddStmt(D->getOperatorDeleteThisArg());
1405 
1407 }
1408 
1411  VisitCXXMethodDecl(D);
1413 }
1414 
1416  VisitDecl(D);
1417  Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1418  ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1419  Record.push_back(!IdentifierLocs.empty());
1420  if (IdentifierLocs.empty()) {
1421  Record.AddSourceLocation(D->getEndLoc());
1422  Record.push_back(1);
1423  } else {
1424  for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1425  Record.AddSourceLocation(IdentifierLocs[I]);
1426  Record.push_back(IdentifierLocs.size());
1427  }
1428  // Note: the number of source locations must always be the last element in
1429  // the record.
1431 }
1432 
1434  VisitDecl(D);
1435  Record.AddSourceLocation(D->getColonLoc());
1437 }
1438 
1440  // Record the number of friend type template parameter lists here
1441  // so as to simplify memory allocation during deserialization.
1442  Record.push_back(D->NumTPLists);
1443  VisitDecl(D);
1444  bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1445  Record.push_back(hasFriendDecl);
1446  if (hasFriendDecl)
1447  Record.AddDeclRef(D->getFriendDecl());
1448  else
1449  Record.AddTypeSourceInfo(D->getFriendType());
1450  for (unsigned i = 0; i < D->NumTPLists; ++i)
1451  Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1452  Record.AddDeclRef(D->getNextFriend());
1453  Record.push_back(D->UnsupportedFriend);
1454  Record.AddSourceLocation(D->FriendLoc);
1456 }
1457 
1459  VisitDecl(D);
1460  Record.push_back(D->getNumTemplateParameters());
1461  for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1462  Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1463  Record.push_back(D->getFriendDecl() != nullptr);
1464  if (D->getFriendDecl())
1465  Record.AddDeclRef(D->getFriendDecl());
1466  else
1467  Record.AddTypeSourceInfo(D->getFriendType());
1468  Record.AddSourceLocation(D->getFriendLoc());
1470 }
1471 
1473  VisitNamedDecl(D);
1474 
1475  Record.AddDeclRef(D->getTemplatedDecl());
1476  Record.AddTemplateParameterList(D->getTemplateParameters());
1477 }
1478 
1480  VisitTemplateDecl(D);
1481  Record.AddStmt(D->getConstraintExpr());
1483 }
1484 
1487 }
1488 
1490  VisitRedeclarable(D);
1491 
1492  // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1493  // getCommonPtr() can be used while this is still initializing.
1494  if (D->isFirstDecl()) {
1495  // This declaration owns the 'common' pointer, so serialize that data now.
1496  Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());
1498  Record.push_back(D->isMemberSpecialization());
1499  }
1500 
1501  VisitTemplateDecl(D);
1502  Record.push_back(D->getIdentifierNamespace());
1503 }
1504 
1506  VisitRedeclarableTemplateDecl(D);
1507 
1508  if (D->isFirstDecl())
1509  AddTemplateSpecializations(D);
1511 }
1512 
1515  RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
1516 
1517  VisitCXXRecordDecl(D);
1518 
1519  llvm::PointerUnion<ClassTemplateDecl *,
1522  if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1523  Record.AddDeclRef(InstFromD);
1524  } else {
1525  Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1526  Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1527  }
1528 
1529  Record.AddTemplateArgumentList(&D->getTemplateArgs());
1530  Record.AddSourceLocation(D->getPointOfInstantiation());
1531  Record.push_back(D->getSpecializationKind());
1532  Record.push_back(D->isCanonicalDecl());
1533 
1534  if (D->isCanonicalDecl()) {
1535  // When reading, we'll add it to the folding set of the following template.
1536  Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1537  }
1538 
1539  // Explicit info.
1540  Record.AddTypeSourceInfo(D->getTypeAsWritten());
1541  if (D->getTypeAsWritten()) {
1542  Record.AddSourceLocation(D->getExternLoc());
1543  Record.AddSourceLocation(D->getTemplateKeywordLoc());
1544  }
1545 
1547 }
1548 
1551  Record.AddTemplateParameterList(D->getTemplateParameters());
1552  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1553 
1554  VisitClassTemplateSpecializationDecl(D);
1555 
1556  // These are read/set from/to the first declaration.
1557  if (D->getPreviousDecl() == nullptr) {
1558  Record.AddDeclRef(D->getInstantiatedFromMember());
1559  Record.push_back(D->isMemberSpecialization());
1560  }
1561 
1563 }
1564 
1566  VisitRedeclarableTemplateDecl(D);
1567 
1568  if (D->isFirstDecl())
1569  AddTemplateSpecializations(D);
1571 }
1572 
1575  RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
1576 
1577  VisitVarDecl(D);
1578 
1579  llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1580  InstFrom = D->getSpecializedTemplateOrPartial();
1581  if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1582  Record.AddDeclRef(InstFromD);
1583  } else {
1584  Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1585  Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1586  }
1587 
1588  // Explicit info.
1589  Record.AddTypeSourceInfo(D->getTypeAsWritten());
1590  if (D->getTypeAsWritten()) {
1591  Record.AddSourceLocation(D->getExternLoc());
1592  Record.AddSourceLocation(D->getTemplateKeywordLoc());
1593  }
1594 
1595  Record.AddTemplateArgumentList(&D->getTemplateArgs());
1596  Record.AddSourceLocation(D->getPointOfInstantiation());
1597  Record.push_back(D->getSpecializationKind());
1598  Record.push_back(D->IsCompleteDefinition);
1599  Record.push_back(D->isCanonicalDecl());
1600 
1601  if (D->isCanonicalDecl()) {
1602  // When reading, we'll add it to the folding set of the following template.
1603  Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1604  }
1605 
1607 }
1608 
1611  Record.AddTemplateParameterList(D->getTemplateParameters());
1612  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1613 
1614  VisitVarTemplateSpecializationDecl(D);
1615 
1616  // These are read/set from/to the first declaration.
1617  if (D->getPreviousDecl() == nullptr) {
1618  Record.AddDeclRef(D->getInstantiatedFromMember());
1619  Record.push_back(D->isMemberSpecialization());
1620  }
1621 
1623 }
1624 
1627  VisitDecl(D);
1628  Record.AddDeclRef(D->getSpecialization());
1629  Record.push_back(D->hasExplicitTemplateArgs());
1630  if (D->hasExplicitTemplateArgs())
1631  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1633 }
1634 
1635 
1637  VisitRedeclarableTemplateDecl(D);
1638 
1639  if (D->isFirstDecl())
1640  AddTemplateSpecializations(D);
1642 }
1643 
1645  Record.push_back(D->hasTypeConstraint());
1646  VisitTypeDecl(D);
1647 
1648  Record.push_back(D->wasDeclaredWithTypename());
1649 
1650  const TypeConstraint *TC = D->getTypeConstraint();
1651  Record.push_back(TC != nullptr);
1652  if (TC) {
1653  Record.AddNestedNameSpecifierLoc(TC->getNestedNameSpecifierLoc());
1654  Record.AddDeclarationNameInfo(TC->getConceptNameInfo());
1655  Record.AddDeclRef(TC->getNamedConcept());
1656  Record.push_back(TC->getTemplateArgsAsWritten() != nullptr);
1657  if (TC->getTemplateArgsAsWritten())
1658  Record.AddASTTemplateArgumentListInfo(TC->getTemplateArgsAsWritten());
1659  Record.AddStmt(TC->getImmediatelyDeclaredConstraint());
1660  Record.push_back(D->isExpandedParameterPack());
1661  if (D->isExpandedParameterPack())
1662  Record.push_back(D->getNumExpansionParameters());
1663  }
1664 
1665  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1667  Record.push_back(OwnsDefaultArg);
1668  if (OwnsDefaultArg)
1669  Record.AddTypeSourceInfo(D->getDefaultArgumentInfo());
1670 
1672 }
1673 
1675  // For an expanded parameter pack, record the number of expansion types here
1676  // so that it's easier for deserialization to allocate the right amount of
1677  // memory.
1679  Record.push_back(!!TypeConstraint);
1680  if (D->isExpandedParameterPack())
1681  Record.push_back(D->getNumExpansionTypes());
1682 
1683  VisitDeclaratorDecl(D);
1684  // TemplateParmPosition.
1685  Record.push_back(D->getDepth());
1686  Record.push_back(D->getPosition());
1687  if (TypeConstraint)
1688  Record.AddStmt(TypeConstraint);
1689 
1690  if (D->isExpandedParameterPack()) {
1691  for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1692  Record.AddTypeRef(D->getExpansionType(I));
1693  Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
1694  }
1695 
1697  } else {
1698  // Rest of NonTypeTemplateParmDecl.
1699  Record.push_back(D->isParameterPack());
1700  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1702  Record.push_back(OwnsDefaultArg);
1703  if (OwnsDefaultArg)
1704  Record.AddStmt(D->getDefaultArgument());
1706  }
1707 }
1708 
1710  // For an expanded parameter pack, record the number of expansion types here
1711  // so that it's easier for deserialization to allocate the right amount of
1712  // memory.
1713  if (D->isExpandedParameterPack())
1714  Record.push_back(D->getNumExpansionTemplateParameters());
1715 
1716  VisitTemplateDecl(D);
1717  // TemplateParmPosition.
1718  Record.push_back(D->getDepth());
1719  Record.push_back(D->getPosition());
1720 
1721  if (D->isExpandedParameterPack()) {
1722  for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1723  I != N; ++I)
1724  Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
1726  } else {
1727  // Rest of TemplateTemplateParmDecl.
1728  Record.push_back(D->isParameterPack());
1729  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1731  Record.push_back(OwnsDefaultArg);
1732  if (OwnsDefaultArg)
1733  Record.AddTemplateArgumentLoc(D->getDefaultArgument());
1735  }
1736 }
1737 
1739  VisitRedeclarableTemplateDecl(D);
1741 }
1742 
1744  VisitDecl(D);
1745  Record.AddStmt(D->getAssertExpr());
1746  Record.push_back(D->isFailed());
1747  Record.AddStmt(D->getMessage());
1748  Record.AddSourceLocation(D->getRParenLoc());
1750 }
1751 
1752 /// Emit the DeclContext part of a declaration context decl.
1754  Record.AddOffset(Writer.WriteDeclContextLexicalBlock(Context, DC));
1755  Record.AddOffset(Writer.WriteDeclContextVisibleBlock(Context, DC));
1756 }
1757 
1759  assert(IsLocalDecl(D) && "expected a local declaration");
1760 
1761  const Decl *Canon = D->getCanonicalDecl();
1762  if (IsLocalDecl(Canon))
1763  return Canon;
1764 
1765  const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
1766  if (CacheEntry)
1767  return CacheEntry;
1768 
1769  for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
1770  if (IsLocalDecl(Redecl))
1771  D = Redecl;
1772  return CacheEntry = D;
1773 }
1774 
1775 template <typename T>
1777  T *First = D->getFirstDecl();
1778  T *MostRecent = First->getMostRecentDecl();
1779  T *DAsT = static_cast<T *>(D);
1780  if (MostRecent != First) {
1781  assert(isRedeclarableDeclKind(DAsT->getKind()) &&
1782  "Not considered redeclarable?");
1783 
1784  Record.AddDeclRef(First);
1785 
1786  // Write out a list of local redeclarations of this declaration if it's the
1787  // first local declaration in the chain.
1788  const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
1789  if (DAsT == FirstLocal) {
1790  // Emit a list of all imported first declarations so that we can be sure
1791  // that all redeclarations visible to this module are before D in the
1792  // redecl chain.
1793  unsigned I = Record.size();
1794  Record.push_back(0);
1795  if (Writer.Chain)
1796  AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
1797  // This is the number of imported first declarations + 1.
1798  Record[I] = Record.size() - I;
1799 
1800  // Collect the set of local redeclarations of this declaration, from
1801  // newest to oldest.
1802  ASTWriter::RecordData LocalRedecls;
1803  ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
1804  for (const Decl *Prev = FirstLocal->getMostRecentDecl();
1805  Prev != FirstLocal; Prev = Prev->getPreviousDecl())
1806  if (!Prev->isFromASTFile())
1807  LocalRedeclWriter.AddDeclRef(Prev);
1808 
1809  // If we have any redecls, write them now as a separate record preceding
1810  // the declaration itself.
1811  if (LocalRedecls.empty())
1812  Record.push_back(0);
1813  else
1814  Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
1815  } else {
1816  Record.push_back(0);
1817  Record.AddDeclRef(FirstLocal);
1818  }
1819 
1820  // Make sure that we serialize both the previous and the most-recent
1821  // declarations, which (transitively) ensures that all declarations in the
1822  // chain get serialized.
1823  //
1824  // FIXME: This is not correct; when we reach an imported declaration we
1825  // won't emit its previous declaration.
1826  (void)Writer.GetDeclRef(D->getPreviousDecl());
1827  (void)Writer.GetDeclRef(MostRecent);
1828  } else {
1829  // We use the sentinel value 0 to indicate an only declaration.
1830  Record.push_back(0);
1831  }
1832 }
1833 
1835  Record.push_back(D->varlist_size());
1836  VisitDecl(D);
1837  for (auto *I : D->varlists())
1838  Record.AddStmt(I);
1840 }
1841 
1843  Record.push_back(D->varlist_size());
1844  Record.push_back(D->clauselist_size());
1845  VisitDecl(D);
1846  for (auto *I : D->varlists())
1847  Record.AddStmt(I);
1848  for (OMPClause *C : D->clauselists())
1849  Record.writeOMPClause(C);
1851 }
1852 
1854  Record.push_back(D->clauselist_size());
1855  VisitDecl(D);
1856  for (OMPClause *C : D->clauselists())
1857  Record.writeOMPClause(C);
1859 }
1860 
1862  VisitValueDecl(D);
1863  Record.AddSourceLocation(D->getBeginLoc());
1864  Record.AddStmt(D->getCombinerIn());
1865  Record.AddStmt(D->getCombinerOut());
1866  Record.AddStmt(D->getCombiner());
1867  Record.AddStmt(D->getInitOrig());
1868  Record.AddStmt(D->getInitPriv());
1869  Record.AddStmt(D->getInitializer());
1870  Record.push_back(D->getInitializerKind());
1871  Record.AddDeclRef(D->getPrevDeclInScope());
1873 }
1874 
1876  Record.push_back(D->clauselist_size());
1877  VisitValueDecl(D);
1878  Record.AddSourceLocation(D->getBeginLoc());
1879  Record.AddStmt(D->getMapperVarRef());
1880  Record.AddDeclarationName(D->getVarName());
1881  Record.AddDeclRef(D->getPrevDeclInScope());
1882  for (OMPClause *C : D->clauselists())
1883  Record.writeOMPClause(C);
1885 }
1886 
1888  VisitVarDecl(D);
1890 }
1891 
1892 //===----------------------------------------------------------------------===//
1893 // ASTWriter Implementation
1894 //===----------------------------------------------------------------------===//
1895 
1896 void ASTWriter::WriteDeclAbbrevs() {
1897  using namespace llvm;
1898 
1899  std::shared_ptr<BitCodeAbbrev> Abv;
1900 
1901  // Abbreviation for DECL_FIELD
1902  Abv = std::make_shared<BitCodeAbbrev>();
1903  Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
1904  // Decl
1905  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1906  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1907  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1908  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1909  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1910  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1911  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1912  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1913  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
1914  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1915  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1916  // NamedDecl
1917  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1918  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1919  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1920  // ValueDecl
1921  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1922  // DeclaratorDecl
1923  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1924  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1925  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
1926  // FieldDecl
1927  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
1928  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
1929  // Type Source Info
1930  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1931  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1932  DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
1933 
1934  // Abbreviation for DECL_OBJC_IVAR
1935  Abv = std::make_shared<BitCodeAbbrev>();
1936  Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
1937  // Decl
1938  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1939  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1940  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1941  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1942  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1943  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1944  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1945  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1946  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
1947  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1948  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1949  // NamedDecl
1950  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1951  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1952  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1953  // ValueDecl
1954  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1955  // DeclaratorDecl
1956  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1957  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1958  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
1959  // FieldDecl
1960  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
1961  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
1962  // ObjC Ivar
1963  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
1964  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
1965  // Type Source Info
1966  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1967  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1968  DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
1969 
1970  // Abbreviation for DECL_ENUM
1971  Abv = std::make_shared<BitCodeAbbrev>();
1972  Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
1973  // Redeclarable
1974  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1975  // Decl
1976  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1977  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1978  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1979  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1980  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1981  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1982  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1983  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1984  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1985  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1986  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1987  // NamedDecl
1988  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1989  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1990  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1991  // TypeDecl
1992  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
1993  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
1994  // TagDecl
1995  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
1996  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
1997  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
1998  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
1999  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
2000  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
2001  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2002  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2003  Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
2004  // EnumDecl
2005  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
2006  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
2007  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
2008  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumPositiveBits
2009  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumNegativeBits
2010  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScoped
2011  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScopedUsingClassTag
2012  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isFixed
2013  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
2014  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
2015  // DC
2016  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2017  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2018  DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
2019 
2020  // Abbreviation for DECL_RECORD
2021  Abv = std::make_shared<BitCodeAbbrev>();
2022  Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
2023  // Redeclarable
2024  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2025  // Decl
2026  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2027  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2028  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2029  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2030  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2031  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2032  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2033  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2034  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2035  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2036  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2037  // NamedDecl
2038  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2039  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2040  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2041  // TypeDecl
2042  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2043  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2044  // TagDecl
2045  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
2046  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
2047  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
2048  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
2049  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
2050  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
2051  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2052  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
2053  Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
2054  // RecordDecl
2055  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // FlexibleArrayMember
2056  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // AnonymousStructUnion
2057  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasObjectMember
2058  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasVolatileMember
2059 
2060  // isNonTrivialToPrimitiveDefaultInitialize
2061  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2062  // isNonTrivialToPrimitiveCopy
2063  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2064  // isNonTrivialToPrimitiveDestroy
2065  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2066  // hasNonTrivialToPrimitiveDefaultInitializeCUnion
2067  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2068  // hasNonTrivialToPrimitiveDestructCUnion
2069  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2070  // hasNonTrivialToPrimitiveCopyCUnion
2071  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2072  // isParamDestroyedInCallee
2073  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2074  // getArgPassingRestrictions
2075  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
2076 
2077  // DC
2078  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2079  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2080  DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2081 
2082  // Abbreviation for DECL_PARM_VAR
2083  Abv = std::make_shared<BitCodeAbbrev>();
2084  Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2085  // Redeclarable
2086  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2087  // Decl
2088  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2089  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2090  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2091  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2092  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2093  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2094  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2095  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2096  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2097  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2098  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2099  // NamedDecl
2100  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2101  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2102  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2103  // ValueDecl
2104  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2105  // DeclaratorDecl
2106  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2107  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2108  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2109  // VarDecl
2110  Abv->Add(BitCodeAbbrevOp(0)); // SClass
2111  Abv->Add(BitCodeAbbrevOp(0)); // TSCSpec
2112  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2113  Abv->Add(BitCodeAbbrevOp(0)); // ARCPseudoStrong
2114  Abv->Add(BitCodeAbbrevOp(0)); // Linkage
2115  Abv->Add(BitCodeAbbrevOp(0)); // HasInit
2116  Abv->Add(BitCodeAbbrevOp(0)); // HasMemberSpecializationInfo
2117  // ParmVarDecl
2118  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsObjCMethodParameter
2119  Abv->Add(BitCodeAbbrevOp(0)); // ScopeDepth
2120  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2121  Abv->Add(BitCodeAbbrevOp(0)); // ObjCDeclQualifier
2122  Abv->Add(BitCodeAbbrevOp(0)); // KNRPromoted
2123  Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedDefaultArg
2124  Abv->Add(BitCodeAbbrevOp(0)); // HasUninstantiatedDefaultArg
2125  // Type Source Info
2126  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2127  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2128  DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2129 
2130  // Abbreviation for DECL_TYPEDEF
2131  Abv = std::make_shared<BitCodeAbbrev>();
2132  Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2133  // Redeclarable
2134  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2135  // Decl
2136  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2137  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2138  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2139  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2140  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2141  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isUsed
2142  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isReferenced
2143  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2144  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // C++ AccessSpecifier
2145  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2146  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2147  // NamedDecl
2148  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2149  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2150  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2151  // TypeDecl
2152  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2153  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2154  // TypedefDecl
2155  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2156  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2157  DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2158 
2159  // Abbreviation for DECL_VAR
2160  Abv = std::make_shared<BitCodeAbbrev>();
2161  Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2162  // Redeclarable
2163  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2164  // Decl
2165  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2166  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2167  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2168  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2169  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2170  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2171  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2172  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2173  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2174  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2175  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2176  // NamedDecl
2177  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2178  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2179  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2180  // ValueDecl
2181  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2182  // DeclaratorDecl
2183  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2184  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2185  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2186  // VarDecl
2187  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // SClass
2188  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // TSCSpec
2189  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // InitStyle
2190  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
2191  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsThisDeclarationADemotedDefinition
2192  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isExceptionVariable
2193  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isNRVOVariable
2194  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCXXForRangeDecl
2195  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isObjCForDecl
2196  Abv->Add(BitCodeAbbrevOp(0)); // isInline
2197  Abv->Add(BitCodeAbbrevOp(0)); // isInlineSpecified
2198  Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr
2199  Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture
2200  Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope
2201  Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind
2202  Abv->Add(BitCodeAbbrevOp(0)); // EscapingByref
2203  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2204  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // IsInitICE (local)
2205  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum)
2206  // Type Source Info
2207  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2208  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2209  DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2210 
2211  // Abbreviation for DECL_CXX_METHOD
2212  Abv = std::make_shared<BitCodeAbbrev>();
2213  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CXX_METHOD));
2214  // RedeclarableDecl
2215  Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2216  // Decl
2217  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2218  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2219  Abv->Add(BitCodeAbbrevOp(0)); // Invalid
2220  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2221  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Implicit
2222  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Used
2223  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Referenced
2224  Abv->Add(BitCodeAbbrevOp(0)); // InObjCContainer
2225  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Access
2226  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ModulePrivate
2227  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2228  // NamedDecl
2229  Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2230  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2231  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2232  // ValueDecl
2233  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2234  // DeclaratorDecl
2235  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2236  Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2237  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2238  // FunctionDecl
2239  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2240  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // StorageClass
2241  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Inline
2242  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // InlineSpecified
2243  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // VirtualAsWritten
2244  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Pure
2245  Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedProto
2246  Abv->Add(BitCodeAbbrevOp(1)); // HasWrittenProto
2247  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Deleted
2248  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Trivial
2249  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // TrivialForCall
2250  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Defaulted
2251  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted
2252  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero
2253  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constexpr
2254  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // UsesSEHTry
2255  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody
2256  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // MultiVersion
2257  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // LateParsed
2258  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2259  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2260  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2261  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // TemplateKind
2262  // This Array slurps the rest of the record. Fortunately we want to encode
2263  // (nearly) all the remaining (variable number of) fields in the same way.
2264  //
2265  // This is the function template information if any, then
2266  // NumParams and Params[] from FunctionDecl, and
2267  // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2268  //
2269  // Add an AbbrevOp for 'size then elements' and use it here.
2270  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2271  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2272  DeclCXXMethodAbbrev = Stream.EmitAbbrev(std::move(Abv));
2273 
2274  // Abbreviation for EXPR_DECL_REF
2275  Abv = std::make_shared<BitCodeAbbrev>();
2276  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2277  //Stmt
2278  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
2279  // Expr
2280  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2281  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2282  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2283  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2284  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2285  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2286  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2287  //DeclRefExpr
2288  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HasQualifier
2289  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //GetDeclFound
2290  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ExplicitTemplateArgs
2291  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HadMultipleCandidates
2292  Abv->Add(BitCodeAbbrevOp(0)); // RefersToEnclosingVariableOrCapture
2293  Abv->Add(BitCodeAbbrevOp(0)); // NonOdrUseReason
2294  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2295  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2296  DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2297 
2298  // Abbreviation for EXPR_INTEGER_LITERAL
2299  Abv = std::make_shared<BitCodeAbbrev>();
2300  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2301  //Stmt
2302  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
2303  // Expr
2304  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2305  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2306  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2307  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2308  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2309  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2310  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2311  //Integer Literal
2312  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2313  Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2314  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2315  IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2316 
2317  // Abbreviation for EXPR_CHARACTER_LITERAL
2318  Abv = std::make_shared<BitCodeAbbrev>();
2319  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2320  //Stmt
2321  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
2322  // Expr
2323  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2324  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2325  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2326  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2327  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2328  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2329  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2330  //Character Literal
2331  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2332  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2333  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2334  CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2335 
2336  // Abbreviation for EXPR_IMPLICIT_CAST
2337  Abv = std::make_shared<BitCodeAbbrev>();
2338  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2339  // Stmt
2340  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
2341  // Expr
2342  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2343  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2344  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2345  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2346  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2347  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2348  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2349  // CastExpr
2350  Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2351  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 6)); // CastKind
2352  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // PartOfExplicitCast
2353  // ImplicitCastExpr
2354  ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2355 
2356  Abv = std::make_shared<BitCodeAbbrev>();
2357  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2358  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2359  DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2360 
2361  Abv = std::make_shared<BitCodeAbbrev>();
2362  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2363  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2364  DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2365 }
2366 
2367 /// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2368 /// consumers of the AST.
2369 ///
2370 /// Such decls will always be deserialized from the AST file, so we would like
2371 /// this to be as restrictive as possible. Currently the predicate is driven by
2372 /// code generation requirements, if other clients have a different notion of
2373 /// what is "required" then we may have to consider an alternate scheme where
2374 /// clients can iterate over the top-level decls and get information on them,
2375 /// without necessary deserializing them. We could explicitly require such
2376 /// clients to use a separate API call to "realize" the decl. This should be
2377 /// relatively painless since they would presumably only do it for top-level
2378 /// decls.
2379 static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2380  bool WritingModule) {
2381  // An ObjCMethodDecl is never considered as "required" because its
2382  // implementation container always is.
2383 
2384  // File scoped assembly or obj-c or OMP declare target implementation must be
2385  // seen.
2386  if (isa<FileScopeAsmDecl>(D) || isa<ObjCImplDecl>(D))
2387  return true;
2388 
2389  if (WritingModule && isPartOfPerModuleInitializer(D)) {
2390  // These declarations are part of the module initializer, and are emitted
2391  // if and when the module is imported, rather than being emitted eagerly.
2392  return false;
2393  }
2394 
2395  return Context.DeclMustBeEmitted(D);
2396 }
2397 
2398 void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2399  PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
2400  "serializing");
2401 
2402  // Determine the ID for this declaration.
2404  assert(!D->isFromASTFile() && "should not be emitting imported decl");
2405  serialization::DeclID &IDR = DeclIDs[D];
2406  if (IDR == 0)
2407  IDR = NextDeclID++;
2408 
2409  ID = IDR;
2410 
2411  assert(ID >= FirstDeclID && "invalid decl ID");
2412 
2413  RecordData Record;
2414  ASTDeclWriter W(*this, Context, Record);
2415 
2416  // Build a record for this declaration
2417  W.Visit(D);
2418 
2419  // Emit this declaration to the bitstream.
2420  uint64_t Offset = W.Emit(D);
2421 
2422  // Record the offset for this declaration
2423  SourceLocation Loc = D->getLocation();
2424  unsigned Index = ID - FirstDeclID;
2425  if (DeclOffsets.size() == Index)
2426  DeclOffsets.push_back(DeclOffset(Loc, Offset));
2427  else if (DeclOffsets.size() < Index) {
2428  // FIXME: Can/should this happen?
2429  DeclOffsets.resize(Index+1);
2430  DeclOffsets[Index].setLocation(Loc);
2431  DeclOffsets[Index].BitOffset = Offset;
2432  } else {
2433  llvm_unreachable("declarations should be emitted in ID order");
2434  }
2435 
2436  SourceManager &SM = Context.getSourceManager();
2437  if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2438  associateDeclWithFile(D, ID);
2439 
2440  // Note declarations that should be deserialized eagerly so that we can add
2441  // them to a record in the AST file later.
2442  if (isRequiredDecl(D, Context, WritingModule))
2443  EagerlyDeserializedDecls.push_back(ID);
2444 }
2445 
2447  // Switch case IDs are per function body.
2448  Writer->ClearSwitchCaseIDs();
2449 
2450  assert(FD->doesThisDeclarationHaveABody());
2451  bool ModulesCodegen = false;
2452  if (!FD->isDependentContext()) {
2454  if ((Writer->WritingModule &&
2455  Writer->WritingModule->Kind == Module::ModuleInterfaceUnit) ||
2456  Writer->Context->getLangOpts().BuildingPCHWithObjectFile) {
2457  // When building a C++ Modules TS module interface unit, a strong
2458  // definition in the module interface is provided by the compilation of
2459  // that module interface unit, not by its users. (Inline functions are
2460  // still emitted in module users.)
2461  Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2462  ModulesCodegen = *Linkage == GVA_StrongExternal;
2463  }
2464  if (Writer->Context->getLangOpts().ModulesCodegen) {
2465  // Under -fmodules-codegen, codegen is performed for all non-internal,
2466  // non-always_inline functions, unless they are available elsewhere.
2467  if (!FD->hasAttr<AlwaysInlineAttr>()) {
2468  if (!Linkage)
2469  Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2470  ModulesCodegen =
2471  *Linkage != GVA_Internal && *Linkage != GVA_AvailableExternally;
2472  }
2473  }
2474  }
2475  Record->push_back(ModulesCodegen);
2476  if (ModulesCodegen)
2477  Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(FD));
2478  if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2479  Record->push_back(CD->getNumCtorInitializers());
2480  if (CD->getNumCtorInitializers())
2481  AddCXXCtorInitializers(
2482  llvm::makeArrayRef(CD->init_begin(), CD->init_end()));
2483  }
2484  AddStmt(FD->getBody());
2485 }
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Definition: Decl.cpp:2580
clauselist_range clauselists()
Definition: DeclOpenMP.h:270
Expr * getImmediatelyDeclaredConstraint() const
Get the immediately-declared constraint expression introduced by this type-constraint, that is - the constraint expression that is added to the associated constraints of the enclosing declaration in practice.
Definition: ASTConcept.h:187
SourceLocation getGetterNameLoc() const
Definition: DeclObjC.h:921
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1326
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1353
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition: Decl.h:2902
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
Definition: DeclTemplate.h:736
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1933
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3224
Represents a function declaration or definition.
Definition: Decl.h:1783
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:529
void VisitAccessSpecDecl(AccessSpecDecl *D)
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
Definition: DeclTemplate.h:733
OMPDeclareMapperDecl * getPrevDeclInScope()
Get reference to previous declare mapper construct in the same scope with the same name...
Definition: DeclOpenMP.cpp:218
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Definition: Decl.h:1319
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:560
protocol_range protocols() const
Definition: DeclObjC.h:1380
void VisitStaticAssertDecl(StaticAssertDecl *D)
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:759
void VisitCXXMethodDecl(CXXMethodDecl *D)
unsigned llvm::PointerUnion< const Decl *, const Expr * > DeclTy
Definition: Descriptor.h:26
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
Definition: ASTCommon.cpp:322
A (possibly-)qualified type.
Definition: Type.h:654
Static storage duration.
Definition: Specifiers.h:310
const char * getDeclKindName() const
Definition: DeclBase.cpp:123
unsigned param_size() const
Definition: DeclObjC.h:342
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2339
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3647
void VisitRedeclarable(Redeclarable< T > *D)
void VisitEmptyDecl(EmptyDecl *D)
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Definition: DeclObjC.h:1544
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2846
bool isObjCMethodParameter() const
Definition: Decl.h:1638
void RegisterTemplateSpecialization(const Decl *Template, const Decl *Specialization)
Ensure that this template specialization is associated with the specified template on reload...
void VisitTypedefNameDecl(TypedefNameDecl *D)
SourceRange getBraceRange() const
Definition: Decl.h:3300
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1392
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:...
Definition: DeclTemplate.h:600
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Definition: Dominators.h:30
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
void VisitExportDecl(ExportDecl *D)
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
Expr * getBitWidth() const
Definition: Decl.h:2818
This represents &#39;#pragma omp allocate ...&#39; directive.
Definition: DeclOpenMP.h:422
void VisitOMPRequiresDecl(OMPRequiresDecl *D)
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2941
void VisitCXXRecordDecl(CXXRecordDecl *D)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1029
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:3173
Defines the SourceManager interface.
unsigned clauselist_size() const
Definition: DeclOpenMP.h:488
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1425
bool hasVolatileMember() const
Definition: Decl.h:3832
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
bool isInitICE() const
Determines whether the initializer is an integral constant expression, or in C++11, whether the initializer is a constant expression.
Definition: Decl.cpp:2422
const Type * getTypeForDecl() const
Definition: Decl.h:3053
bool isLocalSourceLocation(SourceLocation Loc) const
Returns true if Loc did not come from a PCH/Module.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition: Decl.h:4160
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1566
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclBase.h:421
bool isNothrow() const
Definition: Decl.cpp:4751
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:3962
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1344
ThreadStorageClassSpecifier getTSCSpec() const
Definition: Decl.h:1038
Defines the C++ template declaration subclasses.
StringRef P
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:434
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2740
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition: Decl.h:2178
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
Definition: DeclBase.h:960
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
Expr * getSetterCXXAssignment() const
Definition: DeclObjC.h:2882
void VisitTranslationUnitDecl(TranslationUnitDecl *D)
A record that stores the set of declarations that are lexically stored within a given DeclContext...
Definition: ASTBitCodes.h:1254
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
Definition: DeclCXX.h:107
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
Definition: Decl.h:1365
ExplicitSpecKind getKind() const
Definition: DeclCXX.h:1795
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
Represents an empty-declaration.
Definition: Decl.h:4443
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context, ASTWriter::RecordDataImpl &Record)
Expr * getCopyExpr() const
Definition: Expr.h:5634
Expr * getOperatorDeleteThisArg() const
Definition: DeclCXX.h:2687
bool usesSEHTry() const
Indicates the function uses __try.
Definition: Decl.h:2233
Declaration of a variable template.
void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D)
Represent a C++ namespace.
Definition: Decl.h:497
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1211
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction...
Definition: DeclObjC.h:2673
bool hasRedeclaration() const
True if redeclared in the same interface.
Definition: DeclObjC.h:273
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:425
Store information needed for an explicit specifier.
Definition: DeclCXX.h:1787
void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument&#39;s source information, if any.
An OMPRequiresDecl record.
Definition: ASTBitCodes.h:1395
unsigned getIdentifierNamespace() const
Definition: DeclBase.h:799
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2383
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2096
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:2869
size_t param_size() const
Definition: Decl.h:2415
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
Definition: DeclObjC.h:459
ArrayRef< Decl > getPartialSpecializations(FunctionTemplateDecl::Common *)
uint64_t Emit(unsigned Code, unsigned Abbrev=0)
Emit the record to the stream, followed by its substatements, and return its offset.
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:3059
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3324
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Represents a #pragma comment line.
Definition: Decl.h:114
A ClassTemplateDecl record.
Definition: ASTBitCodes.h:1329
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1419
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1293
void VisitBlockDecl(BlockDecl *D)
void VisitImplicitParamDecl(ImplicitParamDecl *D)
unsigned getDepth() const
Get the nesting depth of the template parameter.
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:53
unsigned getODRHash()
Definition: Decl.cpp:4351
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
Represents a variable declaration or definition.
Definition: Decl.h:820
Declaration of a redeclarable template.
Definition: DeclTemplate.h:751
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1413
void AddFunctionDefinition(const FunctionDecl *FD)
Add a definition for the given function to the queue of statements to emit.
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3684
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1281
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:532
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
bool hasInheritedDefaultArg() const
Definition: Decl.h:1725
Represents a variable template specialization, which refers to a variable template with a given set o...
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack...
Definition: ASTBitCodes.h:1382
void VisitIndirectFieldDecl(IndirectFieldDecl *D)
bool isInvalidDecl() const
Definition: DeclBase.h:553
void VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
unsigned getContextParamPosition() const
Definition: Decl.h:4300
protocol_range protocols() const
Definition: DeclObjC.h:2143
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1356
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:644
Represents a parameter to a function.
Definition: Decl.h:1595
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Definition: Linkage.h:23
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1187
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
Provides information about a dependent function-template specialization declaration.
Definition: DeclTemplate.h:686
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2703
void VisitConceptDecl(ConceptDecl *D)
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition: Decl.h:1390
void VisitCXXDestructorDecl(CXXDestructorDecl *D)
Represents a struct/union/class.
Definition: Decl.h:3748
clauselist_range clauselists()
Definition: DeclOpenMP.h:390
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2807
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
bool canThrow() const
Definition: Expr.h:5635
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:272
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:84
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
Definition: Decl.h:3651
Represents a class template specialization, which refers to a class template with a given set of temp...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:123
bool doesNotEscape() const
Definition: Decl.h:4188
StringLiteral * getMessage()
Definition: DeclCXX.h:3789
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2710
Expr * getGetterCXXConstructor() const
Definition: DeclObjC.h:2874
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:500
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:168
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:558
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition: DeclCXX.h:3040
ConstexprSpecKind getConstexprKind() const
Definition: Decl.h:2206
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:600
bool isExpandedParameterPack() const
Whether this parameter is a template type parameter pack that has a known list of different type-cons...
NameKind getNameKind() const
Determine what kind of name this is.
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition: Decl.h:2341
Represents a member of a struct/union/class.
Definition: Decl.h:2729
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
const llvm::APSInt & getInitVal() const
Definition: Decl.h:2962
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:2871
bool usesFPIntrin() const
Indicates the function uses Floating Point constrained intrinsics.
Definition: Decl.h:2237
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition: Decl.h:1652
StringRef getValue() const
Definition: Decl.h:172
bool isDefined() const
Definition: DeclObjC.h:449
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:173
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:939
NamedDecl * getFriendDecl() const
If this friend declaration doesn&#39;t name a type, return the inner declaration.
Definition: DeclFriend.h:138
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2622
void VisitDecompositionDecl(DecompositionDecl *D)
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
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:4116
void VisitParmVarDecl(ParmVarDecl *D)
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:85
Declaration of a function specialization at template class scope.
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration&#39;s previous declaration was declared in the same block ...
Definition: Decl.h:1435
TypeSourceInfo * getFriendType() const
If this friend declaration names a templated type (or a dependent member type of a templated type)...
TypeSourceInfo * getSignatureAsWritten() const
Definition: Decl.h:4120
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1374
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2399
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:470
Expr * getMapperVarRef()
Get the variable declared in the mapper.
Definition: DeclOpenMP.h:282
Represents a C++ using-declaration.
Definition: DeclCXX.h:3369
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:487
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
A RequiresExprBodyDecl record.
Definition: ASTBitCodes.h:1407
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition: Decl.h:3887
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2712
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:3903
void VisitLabelDecl(LabelDecl *LD)
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:170
void VisitObjCProtocolDecl(ObjCProtocolDecl *D)
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
Definition: DeclObjC.h:2668
void append(InputIterator begin, InputIterator end)
void VisitClassTemplateDecl(ClassTemplateDecl *D)
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:2868
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:2894
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:983
TagKind getTagKind() const
Definition: Decl.h:3398
bool isReferenced() const
Whether any declaration of this entity was referenced.
Definition: DeclBase.cpp:423
void VisitTypedefDecl(TypedefDecl *D)
An AccessSpecDecl record.
Definition: ASTBitCodes.h:1320
void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D)
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion: ...
Definition: Decl.h:1673
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes, if any.
Definition: Decl.cpp:4811
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
void VisitUsingShadowDecl(UsingShadowDecl *D)
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1284
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:3561
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:888
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:3002
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1287
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:853
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:3056
A DecompositionDecl record.
Definition: ASTBitCodes.h:1232
Represents a declaration of a type.
Definition: Decl.h:3029
SourceLocation RAngleLoc
The source location of the right angle bracket (&#39;>&#39;).
Definition: TemplateBase.h:617
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum...
Definition: Decl.h:3661
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
Definition: Decl.h:3729
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:935
ConceptDecl * getNamedConcept() const
Definition: ASTConcept.h:154
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1412
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3663
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
Definition: DeclObjC.h:1798
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
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
void VisitBindingDecl(BindingDecl *D)
TemplateParameterList * getTemplateParameterList(unsigned i) const
const Expr * getInitExpr() const
Definition: Decl.h:2960
SourceLocation getPropertyIvarDeclLoc() const
Definition: DeclObjC.h:2849
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
Definition: DeclFriend.h:131
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1332
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:3333
SourceLocation getExternLoc() const
Definition: DeclCXX.h:2821
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2078
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
Definition: DeclBase.h:828
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
Expr * getTemporaryExpr()
Retrieve the expression to which the temporary materialization conversion was applied.
Definition: DeclCXX.h:3123
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:4961
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:947
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4226
Represents an ObjC class declaration.
Definition: DeclObjC.h:1186
Represents a linkage specification.
Definition: DeclCXX.h:2778
QualType getReturnType() const
Definition: DeclObjC.h:324
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
A binding in a decomposition declaration.
Definition: DeclCXX.h:3812
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
Definition: Decl.cpp:3540
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:877
SourceLocation getAtStartLoc() const
Definition: DeclObjC.h:1129
ArgPassingKind getArgPassingRestrictions() const
Definition: Decl.h:3902
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition: Decl.h:3821
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4375
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:3794
void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D)
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
Definition: Decl.h:1090
StringRef getArg() const
Definition: Decl.h:139
DefaultedFunctionInfo * getDefaultedFunctionInfo() const
Definition: Decl.cpp:2855
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2773
NodeId Parent
Definition: ASTDiff.cpp:191
void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
bool hasAttr() const
Definition: DeclBase.h:542
void VisitObjCContainerDecl(ObjCContainerDecl *D)
unsigned varlist_size() const
Definition: DeclOpenMP.h:486
RecordDecl * getMostRecentDecl()
Definition: Decl.h:3795
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3193
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:1409
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1690
SourceLocation getTypenameLoc() const
Returns the source location of the &#39;typename&#39; keyword.
Definition: DeclCXX.h:3716
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:671
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition: Decl.h:3627
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2456
A CXXDeductionGuideDecl record.
Definition: ASTBitCodes.h:1305
uint64_t Emit(Decl *D)
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
Definition: DeclOpenMP.h:288
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclObjC.cpp:991
unsigned getNumExpansionParameters() const
Retrieves the number of parameters in an expanded parameter pack.
bool canAvoidCopyToHeap() const
Definition: Decl.h:4191
bool isInlineSpecified() const
Definition: Decl.h:1397
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:152
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1365
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:3121
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1341
static bool classofKind(Kind K)
Definition: DeclObjC.h:2013
This represents &#39;#pragma omp requires...&#39; directive.
Definition: DeclOpenMP.h:345
unsigned Offset
Definition: Format.cpp:1827
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1410
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:421
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:883
void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2499
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3263
unsigned getFunctionScopeDepth() const
Definition: Decl.h:1642
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:4037
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition: Decl.h:2351
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:619
This represents one expression.
Definition: Expr.h:108
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3409
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1202
unsigned getChainingSize() const
Definition: Decl.h:3008
Selector getSetterName() const
Definition: DeclObjC.h:928
Represents the body of a requires-expression.
Definition: DeclCXX.h:1909
bool isDefaulted() const
Whether this function is defaulted per C++0x.
Definition: Decl.h:2130
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3678
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1214
TypeSourceInfo * getSuperClassTInfo() const
Definition: DeclObjC.h:1587
Expr * getPlaceholderTypeConstraint() const
Return the constraint introduced by the placeholder type of this non-type template parameter (if any)...
void VisitRecordDecl(RecordDecl *D)
Declaration of a template type parameter.
void VisitFileScopeAsmDecl(FileScopeAsmDecl *D)
TypeSourceInfo * getTypeSourceInfo() const
Definition: DeclObjC.h:840
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:620
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name...
Definition: DeclOpenMP.cpp:158
void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal)
Add to the record the first declaration from each module file that provides a declaration of D...
unsigned getNumParams() const
Definition: Decl.h:4271
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2649
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver&#39;s type...
Definition: DeclObjC.h:258
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:2235
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1311
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Definition: Decl.h:553
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Definition: Decl.h:1337
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:558
bool isCopyDeductionCandidate() const
Definition: DeclCXX.h:1887
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition: DeclBase.h:975
void VisitClassTemplatePartialSpecializationDecl(ClassTemplatePartialSpecializationDecl *D)
void VisitTemplateDecl(TemplateDecl *D)
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
overridden_method_range overridden_methods() const
Definition: DeclCXX.cpp:2327
DeclContext * getDeclContext()
Definition: DeclBase.h:438
void VisitUsingDecl(UsingDecl *D)
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1338
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2488
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
const Expr * getExpr() const
Definition: DeclCXX.h:1796
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3575
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition: Decl.cpp:3725
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1314
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
void VisitCXXConstructorDecl(CXXConstructorDecl *D)
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack...
Definition: ASTBitCodes.h:1378
const DeclarationNameInfo & getConceptNameInfo() const
Definition: ASTConcept.h:142
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:3964
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists...
A NamespaceAliasDecl record.
Definition: ASTBitCodes.h:1272
Declaration of an alias template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1784
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i&#39;th template candidate.
Definition: DeclTemplate.h:722
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
void AddObjCTypeParamList(ObjCTypeParamList *typeParams)
Add an Objective-C type parameter list to the given record.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
bool isInstanceMethod() const
Definition: DeclObjC.h:423
clauselist_range clauselists()
Definition: DeclOpenMP.h:502
void VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization, retrieves the member specialization information.
Definition: DeclCXX.cpp:1678
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
Definition: DeclBase.cpp:1091
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1226
StringRef getName() const
Definition: Decl.h:171
Expr * getInitPriv()
Get Priv variable of the initializer.
Definition: DeclOpenMP.h:180
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:1842
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2713
void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2122
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclObjC.h:2834
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1178
ImplicitParamDecl * getSelfDecl() const
Definition: DeclObjC.h:415
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1309
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
QualType getType() const
Definition: DeclObjC.h:842
const SourceManager & SM
Definition: Format.cpp:1685
void VisitTagDecl(TagDecl *D)
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1389
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1199
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Definition: ASTConcept.h:158
This file defines OpenMP AST classes for clauses.
bool hasSkippedBody() const
True if the method was a definition but its body was skipped.
Definition: DeclObjC.h:474
void VisitObjCCategoryDecl(ObjCCategoryDecl *D)
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:2024
PrettyDeclStackTraceEntry - If a crash occurs in the parser while parsing something related to a decl...
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
static DeclType * getDecl(EntryType *D)
Definition: DeclTemplate.h:773
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:215
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2635
void VisitMSPropertyDecl(MSPropertyDecl *D)
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1208
void VisitVarTemplateDecl(VarTemplateDecl *D)
AttrVec & getAttrs()
Definition: DeclBase.h:490
An LifetimeExtendedTemporaryDecl record.
Definition: ASTBitCodes.h:1404
bool isNonTrivialToPrimitiveDestroy() const
Definition: Decl.h:3863
bool hasAttrs() const
Definition: DeclBase.h:484
void VisitTypeAliasDecl(TypeAliasDecl *D)
void VisitDeclContext(DeclContext *DC)
Emit the DeclContext part of a declaration context decl.
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2384
TypeSourceInfo * getReturnTypeSourceInfo() const
Definition: DeclObjC.h:338
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
void push_back(uint64_t N)
Minimal vector-like interface.
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition: Decl.h:3871
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:2189
bool isSynthesizedAccessorStub() const
Definition: DeclObjC.h:441
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Definition: Expr.h:5627
unsigned protocol_size() const
Definition: DeclObjC.h:2182
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:2934
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:2321
Represents a C++ Modules TS module export declaration.
Definition: Decl.h:4396
SourceLocation getUsingLoc() const
Returns the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3620
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition: Decl.h:3847
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:641
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1290
Kind
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:203
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition: DeclCXX.h:3551
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:491
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
Encodes a location in the source.
bool getSynthesize() const
Definition: DeclObjC.h:2005
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2105
This represents &#39;#pragma omp declare reduction ...&#39; directive.
Definition: DeclOpenMP.h:102
A record that stores the set of declarations that are visible from a given DeclContext.
Definition: ASTBitCodes.h:1263
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:312
SourceLocation getSuperClassLoc() const
Definition: DeclObjC.h:2705
void VisitObjCImplDecl(ObjCImplDecl *D)
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:2938
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition: Decl.h:2907
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the &#39;typename&#39; keyword.
Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:3219
SourceLocation getUsingLoc() const
Return the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3402
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2541
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:3210
ObjCList - This is a simple template class used to hold various lists of decls etc, which is heavily used by the ObjC front-end.
Definition: DeclObjC.h:82
Represents the declaration of a label.
Definition: Decl.h:451
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3588
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3630
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
Definition: Decl.h:2876
RedeclarableTemplateDecl::SpecEntryTraits< EntryType >::DeclType * getSpecializationDecl(EntryType &T)
Get the specialization decl from an entry in the specialization list.
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition: DeclObjC.cpp:855
SourceLocation getRParenLoc() const
Definition: Decl.h:4020
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1931
void VisitVarTemplatePartialSpecializationDecl(VarTemplatePartialSpecializationDecl *D)
void VisitUsingPackDecl(UsingPackDecl *D)
C-style initialization with assignment.
Definition: Decl.h:825
bool isConversionFromLambda() const
Definition: Decl.h:4180
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1350
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Definition: Redeclarable.h:222
Data that is common to all of the declarations of a given function template.
Definition: DeclTemplate.h:983
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:2908
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2294
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:51
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3675
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
Definition: DeclTemplate.h:719
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
void VisitCapturedDecl(CapturedDecl *D)
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2644
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:741
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:702
bool isModed() const
Definition: Decl.h:3117
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:66
unsigned getODRHash()
Returns ODRHash of the function.
Definition: Decl.cpp:3985
bool hasUninstantiatedDefaultArg() const
Definition: Decl.h:1713
void AddSourceLocation(SourceLocation Loc)
Emit a source location.
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
Definition: DeclBase.cpp:398
void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D)
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2798
An OMPDeclareMapperDecl record.
Definition: ASTBitCodes.h:1422
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: DeclObjC.h:248
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition: Decl.h:3879
A NamespaceDecl record.
Definition: ASTBitCodes.h:1269
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
Definition: Decl.h:2135
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3763
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition: Decl.h:2158
void VisitPragmaCommentDecl(PragmaCommentDecl *D)
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:2822
An OMPAllocateDcl record.
Definition: ASTBitCodes.h:1398
bool hasFlexibleArrayMember() const
Definition: Decl.h:3802
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
bool isTrivialForCall() const
Definition: Decl.h:2125
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
Definition: Decl.cpp:99
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2431
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Definition: Decl.cpp:1090
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4331
Expr * getInitOrig()
Get Orig variable of the initializer.
Definition: DeclOpenMP.h:177
protocol_range protocols() const
Definition: DeclObjC.h:2370
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1190
A POD class for pairing a NamedDecl* with an access specifier.
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: Decl.h:1656
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:3071
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1317
void VisitFieldDecl(FieldDecl *D)
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2454
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2753
Dataflow Directional Tag Classes.
unsigned getManglingNumber() const
Definition: DeclCXX.h:3126
void AddTemplateSpecializations(DeclTy *D)
bool isValid() const
Return true if this is a valid SourceLocation object.
void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information.
Definition: Decl.cpp:2624
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition: Decl.h:2109
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1271
ArrayRef< Capture > captures() const
Definition: Decl.h:4164
PropertyAttributeKind getPropertyAttributesAsWritten() const
Definition: DeclObjC.h:865
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:402
bool isVariadic() const
Definition: Decl.h:4112
void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
bool HasConstantDestruction
Whether this variable is known to have constant destruction.
Definition: Decl.h:809
bool isTopLevelDeclInObjCContainer() const
Whether this declaration is a top-level declaration (function, global variable, etc.) that is lexically inside an objc container definition.
Definition: DeclBase.h:593
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
Definition: Decl.cpp:2415
SourceLocation getAtLoc() const
Definition: DeclObjC.h:834
void VisitNamedDecl(NamedDecl *D)
Represents a field injected from an anonymous union/struct into the parent scope. ...
Definition: Decl.h:2980
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1335
QualType getUnderlyingType() const
Definition: Decl.h:3126
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3031
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:2930
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1164
const Expr * getInit() const
Definition: Decl.h:1229
AccessSpecifier getAccess() const
Definition: DeclBase.h:473
A decomposition declaration.
Definition: DeclCXX.h:3869
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:3348
void VisitTypeDecl(TypeDecl *D)
unsigned getNumTemplateParameters() const
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3684
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
Definition: ASTBitCodes.h:1386
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:571
Kind getKind() const
Definition: DeclBase.h:432
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3720
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1296
bool isNonTrivialToPrimitiveCopy() const
Definition: Decl.h:3855
decltype(T::PartialSpecializations) & getPartialSpecializations(T *Common)
Get the list of partial specializations from a template&#39;s common ptr.
const NestedNameSpecifierLoc & getNestedNameSpecifierLoc() const
Definition: ASTConcept.h:138
Represents an enum.
Definition: Decl.h:3481
SourceLocation LAngleLoc
The source location of the left angle bracket (&#39;<&#39;).
Definition: TemplateBase.h:614
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
bool isEscapingByref() const
Indicates the capture is a __block variable that is captured by a block that can potentially escape (...
Definition: Decl.cpp:2476
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition: Decl.h:1421
void VisitDeclaratorDecl(DeclaratorDecl *D)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
Definition: ASTContext.h:1086
SourceLocation getSetterNameLoc() const
Definition: DeclObjC.h:929
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2761
void VisitEnumDecl(EnumDecl *D)
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
Definition: ASTBitCodes.h:68
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2683
A PragmaCommentDecl record.
Definition: ASTBitCodes.h:1416
void VisitNamespaceDecl(NamespaceDecl *D)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2566
void VisitVarDecl(VarDecl *D)
Expr * getUninstantiatedDefaultArg()
Definition: Decl.cpp:2752
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2164
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C...
Definition: Decl.h:1375
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:1872
size_t param_size() const
Definition: Decl.h:4139
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:700
ClassTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1747
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4273
bool isParamDestroyedInCallee() const
Definition: Decl.h:3910
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void VisitFunctionDecl(FunctionDecl *D)
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
unsigned clauselist_size() const
Definition: DeclOpenMP.h:267
bool hasTypename() const
Return true if the using declaration has &#39;typename&#39;.
Definition: DeclCXX.h:3424
SourceManager & getSourceManager()
Definition: ASTContext.h:679
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition: Decl.h:2513
bool capturesCXXThis() const
Definition: Decl.h:4169
ImplementationControl getImplementationControl() const
Definition: DeclObjC.h:494
static bool classofKind(Kind K)
Definition: DeclCXX.h:1780
void VisitDecl(Decl *D)
SourceRange getAtEndRange() const
Definition: DeclObjC.h:1136
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1692
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
static bool classofKind(Kind K)
Definition: DeclObjC.h:2046
Represents a field declaration created by an @defs(...).
Definition: DeclObjC.h:2026
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2427
void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:3429
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:2804
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3319
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&#39;t on...
SourceLocation getRBraceLoc() const
Definition: Decl.h:4415
Represents a C++ struct/union/class.
Definition: DeclCXX.h:253
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1355
static void addExplicitSpecifier(ExplicitSpecifier ES, ASTRecordWriter &Record)
An object for streaming information to a record.
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:3672
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1959
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:959
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
Definition: ASTCommon.cpp:419
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:622
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1205
void VisitEnumConstantDecl(EnumConstantDecl *D)
SourceLocation getFriendLoc() const
Retrieves the location of the &#39;friend&#39; keyword.
bool isFailed() const
Definition: DeclCXX.h:3792
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1196
Declaration of a class template.
void VisitCXXConversionDecl(CXXConversionDecl *D)
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:649
ImplicitParamDecl * getCmdDecl() const
Definition: DeclObjC.h:417
void VisitClassScopeFunctionSpecializationDecl(ClassScopeFunctionSpecializationDecl *D)
bool isVariadic() const
Definition: DeclObjC.h:428
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:96
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
This represents &#39;#pragma omp declare mapper ...&#39; directive.
Definition: DeclOpenMP.h:217
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
Definition: ASTBitCodes.h:1156
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1169
unsigned clauselist_size() const
Definition: DeclOpenMP.h:387
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Definition: DeclCXX.h:3075
varlist_range varlists()
Definition: DeclOpenMP.h:491
unsigned protocol_size() const
Definition: DeclObjC.h:2379
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3635
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:2078
An ExportDecl record.
Definition: ASTBitCodes.h:1299
bool blockMissingReturnType() const
Definition: Decl.h:4172
Expr * getCombinerIn()
Get In variable of the combiner.
Definition: DeclOpenMP.h:155
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3737
unsigned varlist_size() const
Definition: DeclOpenMP.h:74
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Definition: Redeclarable.h:225
void VisitFriendDecl(FriendDecl *D)
The top declaration context.
Definition: Decl.h:82
static bool isRequiredDecl(const Decl *D, ASTContext &Context, bool WritingModule)
isRequiredDecl - Check if this is a "required" Decl, which must be seen by consumers of the AST...
void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:4123
NamedDecl * getMostRecentDecl()
Definition: Decl.h:428
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2837
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
bool hasObjectMember() const
Definition: Decl.h:3829
void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D)
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:3836
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1171
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3517
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1347
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:7215
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1359
void VisitImportDecl(ImportDecl *D)
varlist_range varlists()
Definition: DeclOpenMP.h:77
bool isStaticDataMember() const
Determines whether this is a static data member.
Definition: Decl.h:1144
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
Definition: Decl.h:580
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3940
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3056
QualType getType() const
Definition: Decl.h:630
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
Definition: DeclBase.h:607
void VisitOMPAllocateDecl(OMPAllocateDecl *D)
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:936
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
Definition: DeclObjC.h:268
This represents a decl that may have a name.
Definition: Decl.h:223
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
Represents a C++ namespace alias.
Definition: DeclCXX.h:2967
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen&#39;ed or deserialized from PCH lazily, only when used; this is onl...
void VisitFriendTemplateDecl(FriendTemplateDecl *D)
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1394
AccessControl getAccessControl() const
Definition: DeclObjC.h:1998
Declaration of a friend template.
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2433
bool isPropertyAccessor() const
Definition: DeclObjC.h:433
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
ArrayRef< NamedDecl * > expansions() const
Get the set of using declarations that this pack expanded into.
Definition: DeclCXX.h:3555
Expr * getConstraintExpr() const
Selector getGetterName() const
Definition: DeclObjC.h:920
Represents C++ using-directive.
Definition: DeclCXX.h:2863
SourceLocation getLParenLoc() const
Definition: DeclObjC.h:837
SourceLocation getEndOfDefinitionLoc() const
Definition: DeclObjC.h:1892
Represents a #pragma detect_mismatch line.
Definition: Decl.h:148
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:662
NamedDecl * getFriendDecl() const
If this friend declaration names a templated function (or a member function of a templated type)...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
Expr * getCombinerOut()
Get Out variable of the combiner.
Definition: DeclOpenMP.h:158
void VisitObjCMethodDecl(ObjCMethodDecl *D)
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition: Decl.h:3359
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
Definition: Decl.h:714
unsigned size() const
Determine the number of type parameters in this list.
Definition: DeclObjC.h:689
This represents &#39;#pragma omp threadprivate ...&#39; directive.
Definition: DeclOpenMP.h:39
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2513
This class handles loading and caching of source files into memory.
void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D)
void VisitValueDecl(ValueDecl *D)
Declaration of a template function.
Definition: DeclTemplate.h:977
Source range/offset of a preprocessed entity.
Definition: ASTBitCodes.h:220
SourceLocation getLocation() const
Definition: DeclBase.h:429
const StringLiteral * getAsmString() const
Definition: Decl.h:4026
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3162
Represents a pack of using declarations that a single using-declarator pack-expanded into...
Definition: DeclCXX.h:3519
QualType getType() const
Return the type wrapped by this type source info.
Definition: Type.h:6238
SourceLocation getRBraceLoc() const
Definition: Decl.h:601
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:368
void VisitObjCIvarDecl(ObjCIvarDecl *D)
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:137
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2743
EvaluatedStmt * ensureEvaluatedStmt() const
Convert the initializer for this declaration to the elaborated EvaluatedStmt form, which contains extra information on the evaluated value of the initializer.
Definition: Decl.cpp:2342
This is a C++ Modules TS module interface unit.
Definition: Module.h:78
void VisitLifetimeExtendedTemporaryDecl(LifetimeExtendedTemporaryDecl *D)
void VisitRequiresExprBodyDecl(RequiresExprBodyDecl *D)