clang  8.0.0svn
ASTWriterDecl.cpp
Go to the documentation of this file.
1 //===--- ASTWriterDecl.cpp - Declaration Serialization --------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements serialization for Declarations.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "ASTCommon.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"
24 #include "llvm/Bitcode/BitstreamWriter.h"
25 #include "llvm/Support/ErrorHandling.h"
26 using namespace clang;
27 using namespace serialization;
28 
29 //===----------------------------------------------------------------------===//
30 // Declaration serialization
31 //===----------------------------------------------------------------------===//
32 
33 namespace clang {
34  class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {
35  ASTWriter &Writer;
36  ASTContext &Context;
37  ASTRecordWriter Record;
38 
40  unsigned AbbrevToUse;
41 
42  public:
43  ASTDeclWriter(ASTWriter &Writer, ASTContext &Context,
45  : Writer(Writer), Context(Context), Record(Writer, Record),
46  Code((serialization::DeclCode)0), AbbrevToUse(0) {}
47 
48  uint64_t Emit(Decl *D) {
49  if (!Code)
50  llvm::report_fatal_error(StringRef("unexpected declaration kind '") +
51  D->getDeclKindName() + "'");
52  return Record.Emit(Code, AbbrevToUse);
53  }
54 
55  void Visit(Decl *D);
56 
57  void VisitDecl(Decl *D);
58  void VisitPragmaCommentDecl(PragmaCommentDecl *D);
59  void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D);
60  void VisitTranslationUnitDecl(TranslationUnitDecl *D);
61  void VisitNamedDecl(NamedDecl *D);
62  void VisitLabelDecl(LabelDecl *LD);
63  void VisitNamespaceDecl(NamespaceDecl *D);
64  void VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
65  void VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
66  void VisitTypeDecl(TypeDecl *D);
67  void VisitTypedefNameDecl(TypedefNameDecl *D);
68  void VisitTypedefDecl(TypedefDecl *D);
69  void VisitTypeAliasDecl(TypeAliasDecl *D);
70  void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
71  void VisitTagDecl(TagDecl *D);
72  void VisitEnumDecl(EnumDecl *D);
73  void VisitRecordDecl(RecordDecl *D);
74  void VisitCXXRecordDecl(CXXRecordDecl *D);
75  void VisitClassTemplateSpecializationDecl(
77  void VisitClassTemplatePartialSpecializationDecl(
79  void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D);
80  void VisitVarTemplatePartialSpecializationDecl(
82  void VisitClassScopeFunctionSpecializationDecl(
84  void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D);
85  void VisitValueDecl(ValueDecl *D);
86  void VisitEnumConstantDecl(EnumConstantDecl *D);
87  void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
88  void VisitDeclaratorDecl(DeclaratorDecl *D);
89  void VisitFunctionDecl(FunctionDecl *D);
90  void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D);
91  void VisitCXXMethodDecl(CXXMethodDecl *D);
92  void VisitCXXConstructorDecl(CXXConstructorDecl *D);
93  void VisitCXXDestructorDecl(CXXDestructorDecl *D);
94  void VisitCXXConversionDecl(CXXConversionDecl *D);
95  void VisitFieldDecl(FieldDecl *D);
96  void VisitMSPropertyDecl(MSPropertyDecl *D);
97  void VisitIndirectFieldDecl(IndirectFieldDecl *D);
98  void VisitVarDecl(VarDecl *D);
99  void VisitImplicitParamDecl(ImplicitParamDecl *D);
100  void VisitParmVarDecl(ParmVarDecl *D);
101  void VisitDecompositionDecl(DecompositionDecl *D);
102  void VisitBindingDecl(BindingDecl *D);
103  void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D);
104  void VisitTemplateDecl(TemplateDecl *D);
105  void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D);
106  void VisitClassTemplateDecl(ClassTemplateDecl *D);
107  void VisitVarTemplateDecl(VarTemplateDecl *D);
108  void VisitFunctionTemplateDecl(FunctionTemplateDecl *D);
109  void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D);
110  void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D);
111  void VisitUsingDecl(UsingDecl *D);
112  void VisitUsingPackDecl(UsingPackDecl *D);
113  void VisitUsingShadowDecl(UsingShadowDecl *D);
114  void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D);
115  void VisitLinkageSpecDecl(LinkageSpecDecl *D);
116  void VisitExportDecl(ExportDecl *D);
117  void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
118  void VisitImportDecl(ImportDecl *D);
119  void VisitAccessSpecDecl(AccessSpecDecl *D);
120  void VisitFriendDecl(FriendDecl *D);
121  void VisitFriendTemplateDecl(FriendTemplateDecl *D);
122  void VisitStaticAssertDecl(StaticAssertDecl *D);
123  void VisitBlockDecl(BlockDecl *D);
124  void VisitCapturedDecl(CapturedDecl *D);
125  void VisitEmptyDecl(EmptyDecl *D);
126 
127  void VisitDeclContext(DeclContext *DC);
128  template <typename T> void VisitRedeclarable(Redeclarable<T> *D);
129 
130 
131  // FIXME: Put in the same order is DeclNodes.td?
132  void VisitObjCMethodDecl(ObjCMethodDecl *D);
133  void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D);
134  void VisitObjCContainerDecl(ObjCContainerDecl *D);
135  void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);
136  void VisitObjCIvarDecl(ObjCIvarDecl *D);
137  void VisitObjCProtocolDecl(ObjCProtocolDecl *D);
138  void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D);
139  void VisitObjCCategoryDecl(ObjCCategoryDecl *D);
140  void VisitObjCImplDecl(ObjCImplDecl *D);
141  void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D);
142  void VisitObjCImplementationDecl(ObjCImplementationDecl *D);
143  void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D);
144  void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
145  void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
146  void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
147  void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
148  void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D);
149 
150  /// Add an Objective-C type parameter list to the given record.
152  // Empty type parameter list.
153  if (!typeParams) {
154  Record.push_back(0);
155  return;
156  }
157 
158  Record.push_back(typeParams->size());
159  for (auto typeParam : *typeParams) {
160  Record.AddDeclRef(typeParam);
161  }
162  Record.AddSourceLocation(typeParams->getLAngleLoc());
163  Record.AddSourceLocation(typeParams->getRAngleLoc());
164  }
165 
166  /// Add to the record the first declaration from each module file that
167  /// provides a declaration of D. The intent is to provide a sufficient
168  /// set such that reloading this set will load all current redeclarations.
169  void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
170  llvm::MapVector<ModuleFile*, const Decl*> Firsts;
171  // FIXME: We can skip entries that we know are implied by others.
172  for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) {
173  if (R->isFromASTFile())
174  Firsts[Writer.Chain->getOwningModuleFile(R)] = R;
175  else if (IncludeLocal)
176  Firsts[nullptr] = R;
177  }
178  for (const auto &F : Firsts)
179  Record.AddDeclRef(F.second);
180  }
181 
182  /// Get the specialization decl from an entry in the specialization list.
183  template <typename EntryType>
185  getSpecializationDecl(EntryType &T) {
187  }
188 
189  /// Get the list of partial specializations from a template's common ptr.
190  template<typename T>
191  decltype(T::PartialSpecializations) &getPartialSpecializations(T *Common) {
192  return Common->PartialSpecializations;
193  }
195  return None;
196  }
197 
198  template<typename DeclTy>
199  void AddTemplateSpecializations(DeclTy *D) {
200  auto *Common = D->getCommonPtr();
201 
202  // If we have any lazy specializations, and the external AST source is
203  // our chained AST reader, we can just write out the DeclIDs. Otherwise,
204  // we need to resolve them to actual declarations.
205  if (Writer.Chain != Writer.Context->getExternalSource() &&
206  Common->LazySpecializations) {
207  D->LoadLazySpecializations();
208  assert(!Common->LazySpecializations);
209  }
210 
211  ArrayRef<DeclID> LazySpecializations;
212  if (auto *LS = Common->LazySpecializations)
213  LazySpecializations = llvm::makeArrayRef(LS + 1, LS[0]);
214 
215  // Add a slot to the record for the number of specializations.
216  unsigned I = Record.size();
217  Record.push_back(0);
218 
219  // AddFirstDeclFromEachModule might trigger deserialization, invalidating
220  // *Specializations iterators.
222  for (auto &Entry : Common->Specializations)
223  Specs.push_back(getSpecializationDecl(Entry));
224  for (auto &Entry : getPartialSpecializations(Common))
225  Specs.push_back(getSpecializationDecl(Entry));
226 
227  for (auto *D : Specs) {
228  assert(D->isCanonicalDecl() && "non-canonical decl in set");
229  AddFirstDeclFromEachModule(D, /*IncludeLocal*/true);
230  }
231  Record.append(LazySpecializations.begin(), LazySpecializations.end());
232 
233  // Update the size entry we added earlier.
234  Record[I] = Record.size() - I - 1;
235  }
236 
237  /// Ensure that this template specialization is associated with the specified
238  /// template on reload.
239  void RegisterTemplateSpecialization(const Decl *Template,
240  const Decl *Specialization) {
241  Template = Template->getCanonicalDecl();
242 
243  // If the canonical template is local, we'll write out this specialization
244  // when we emit it.
245  // FIXME: We can do the same thing if there is any local declaration of
246  // the template, to avoid emitting an update record.
247  if (!Template->isFromASTFile())
248  return;
249 
250  // We only need to associate the first local declaration of the
251  // specialization. The other declarations will get pulled in by it.
252  if (Writer.getFirstLocalDecl(Specialization) != Specialization)
253  return;
254 
255  Writer.DeclUpdates[Template].push_back(ASTWriter::DeclUpdate(
256  UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION, Specialization));
257  }
258  };
259 }
260 
263 
264  // Source locations require array (variable-length) abbreviations. The
265  // abbreviation infrastructure requires that arrays are encoded last, so
266  // we handle it here in the case of those classes derived from DeclaratorDecl
267  if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(D)) {
268  if (auto *TInfo = DD->getTypeSourceInfo())
269  Record.AddTypeLoc(TInfo->getTypeLoc());
270  }
271 
272  // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
273  // have been written. We want it last because we will not read it back when
274  // retrieving it from the AST, we'll just lazily set the offset.
275  if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
276  Record.push_back(FD->doesThisDeclarationHaveABody());
277  if (FD->doesThisDeclarationHaveABody())
278  Record.AddFunctionDefinition(FD);
279  }
280 
281  // If this declaration is also a DeclContext, write blocks for the
282  // declarations that lexically stored inside its context and those
283  // declarations that are visible from its context.
284  if (DeclContext *DC = dyn_cast<DeclContext>(D))
285  VisitDeclContext(DC);
286 }
287 
289  Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
290  if (D->getDeclContext() != D->getLexicalDeclContext())
291  Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
292  else
293  Record.push_back(0);
294  Record.push_back(D->isInvalidDecl());
295  Record.push_back(D->hasAttrs());
296  if (D->hasAttrs())
297  Record.AddAttributes(D->getAttrs());
298  Record.push_back(D->isImplicit());
299  Record.push_back(D->isUsed(false));
300  Record.push_back(D->isReferenced());
301  Record.push_back(D->isTopLevelDeclInObjCContainer());
302  Record.push_back(D->getAccess());
303  Record.push_back(D->isModulePrivate());
304  Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
305 
306  // If this declaration injected a name into a context different from its
307  // lexical context, and that context is an imported namespace, we need to
308  // update its visible declarations to include this name.
309  //
310  // This happens when we instantiate a class with a friend declaration or a
311  // function with a local extern declaration, for instance.
312  //
313  // FIXME: Can we handle this in AddedVisibleDecl instead?
314  if (D->isOutOfLine()) {
315  auto *DC = D->getDeclContext();
316  while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
317  if (!NS->isFromASTFile())
318  break;
319  Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
320  if (!NS->isInlineNamespace())
321  break;
322  DC = NS->getParent();
323  }
324  }
325 }
326 
328  StringRef Arg = D->getArg();
329  Record.push_back(Arg.size());
330  VisitDecl(D);
331  Record.AddSourceLocation(D->getBeginLoc());
332  Record.push_back(D->getCommentKind());
333  Record.AddString(Arg);
335 }
336 
339  StringRef Name = D->getName();
340  StringRef Value = D->getValue();
341  Record.push_back(Name.size() + 1 + Value.size());
342  VisitDecl(D);
343  Record.AddSourceLocation(D->getBeginLoc());
344  Record.AddString(Name);
345  Record.AddString(Value);
347 }
348 
350  llvm_unreachable("Translation units aren't directly serialized");
351 }
352 
354  VisitDecl(D);
355  Record.AddDeclarationName(D->getDeclName());
356  Record.push_back(needsAnonymousDeclarationNumber(D)
357  ? Writer.getAnonymousDeclarationNumber(D)
358  : 0);
359 }
360 
362  VisitNamedDecl(D);
363  Record.AddSourceLocation(D->getBeginLoc());
364  Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
365 }
366 
368  VisitRedeclarable(D);
369  VisitTypeDecl(D);
370  Record.AddTypeSourceInfo(D->getTypeSourceInfo());
371  Record.push_back(D->isModed());
372  if (D->isModed())
373  Record.AddTypeRef(D->getUnderlyingType());
374  Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
375 }
376 
378  VisitTypedefNameDecl(D);
379  if (D->getDeclContext() == D->getLexicalDeclContext() &&
380  !D->hasAttrs() &&
381  !D->isImplicit() &&
382  D->getFirstDecl() == D->getMostRecentDecl() &&
383  !D->isInvalidDecl() &&
385  !D->isModulePrivate() &&
388  AbbrevToUse = Writer.getDeclTypedefAbbrev();
389 
391 }
392 
394  VisitTypedefNameDecl(D);
395  Record.AddDeclRef(D->getDescribedAliasTemplate());
397 }
398 
400  VisitRedeclarable(D);
401  VisitTypeDecl(D);
402  Record.push_back(D->getIdentifierNamespace());
403  Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding
404  if (!isa<CXXRecordDecl>(D))
405  Record.push_back(D->isCompleteDefinition());
406  Record.push_back(D->isEmbeddedInDeclarator());
407  Record.push_back(D->isFreeStanding());
408  Record.push_back(D->isCompleteDefinitionRequired());
409  Record.AddSourceRange(D->getBraceRange());
410 
411  if (D->hasExtInfo()) {
412  Record.push_back(1);
413  Record.AddQualifierInfo(*D->getExtInfo());
414  } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
415  Record.push_back(2);
416  Record.AddDeclRef(TD);
417  Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
418  } else {
419  Record.push_back(0);
420  }
421 }
422 
424  VisitTagDecl(D);
425  Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
426  if (!D->getIntegerTypeSourceInfo())
427  Record.AddTypeRef(D->getIntegerType());
428  Record.AddTypeRef(D->getPromotionType());
429  Record.push_back(D->getNumPositiveBits());
430  Record.push_back(D->getNumNegativeBits());
431  Record.push_back(D->isScoped());
432  Record.push_back(D->isScopedUsingClassTag());
433  Record.push_back(D->isFixed());
434  Record.push_back(D->getODRHash());
435 
436  if (MemberSpecializationInfo *MemberInfo = D->getMemberSpecializationInfo()) {
437  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
438  Record.push_back(MemberInfo->getTemplateSpecializationKind());
439  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
440  } else {
441  Record.AddDeclRef(nullptr);
442  }
443 
444  if (D->getDeclContext() == D->getLexicalDeclContext() &&
445  !D->hasAttrs() &&
446  !D->isImplicit() &&
447  !D->isUsed(false) &&
448  !D->hasExtInfo() &&
450  D->getFirstDecl() == D->getMostRecentDecl() &&
451  !D->isInvalidDecl() &&
452  !D->isReferenced() &&
454  D->getAccess() == AS_none &&
455  !D->isModulePrivate() &&
457  !D->getIntegerTypeSourceInfo() &&
461  AbbrevToUse = Writer.getDeclEnumAbbrev();
462 
464 }
465 
467  VisitTagDecl(D);
468  Record.push_back(D->hasFlexibleArrayMember());
469  Record.push_back(D->isAnonymousStructOrUnion());
470  Record.push_back(D->hasObjectMember());
471  Record.push_back(D->hasVolatileMember());
472  Record.push_back(D->isNonTrivialToPrimitiveDefaultInitialize());
473  Record.push_back(D->isNonTrivialToPrimitiveCopy());
474  Record.push_back(D->isNonTrivialToPrimitiveDestroy());
475  Record.push_back(D->isParamDestroyedInCallee());
476  Record.push_back(D->getArgPassingRestrictions());
477 
478  if (D->getDeclContext() == D->getLexicalDeclContext() &&
479  !D->hasAttrs() &&
480  !D->isImplicit() &&
481  !D->isUsed(false) &&
482  !D->hasExtInfo() &&
484  D->getFirstDecl() == D->getMostRecentDecl() &&
485  !D->isInvalidDecl() &&
486  !D->isReferenced() &&
488  D->getAccess() == AS_none &&
489  !D->isModulePrivate() &&
493  AbbrevToUse = Writer.getDeclRecordAbbrev();
494 
496 }
497 
499  VisitNamedDecl(D);
500  Record.AddTypeRef(D->getType());
501 }
502 
504  VisitValueDecl(D);
505  Record.push_back(D->getInitExpr()? 1 : 0);
506  if (D->getInitExpr())
507  Record.AddStmt(D->getInitExpr());
508  Record.AddAPSInt(D->getInitVal());
509 
511 }
512 
514  VisitValueDecl(D);
515  Record.AddSourceLocation(D->getInnerLocStart());
516  Record.push_back(D->hasExtInfo());
517  if (D->hasExtInfo())
518  Record.AddQualifierInfo(*D->getExtInfo());
519  // The location information is deferred until the end of the record.
520  Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()
521  : QualType());
522 }
523 
525  VisitRedeclarable(D);
526  VisitDeclaratorDecl(D);
527  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
528  Record.push_back(D->getIdentifierNamespace());
529 
530  // FunctionDecl's body is handled last at ASTWriterDecl::Visit,
531  // after everything else is written.
532  Record.push_back(static_cast<int>(D->getStorageClass())); // FIXME: stable encoding
533  Record.push_back(D->isInlineSpecified());
534  Record.push_back(D->isInlined());
535  Record.push_back(D->isExplicitSpecified());
536  Record.push_back(D->isVirtualAsWritten());
537  Record.push_back(D->isPure());
538  Record.push_back(D->hasInheritedPrototype());
539  Record.push_back(D->hasWrittenPrototype());
540  Record.push_back(D->isDeletedBit());
541  Record.push_back(D->isTrivial());
542  Record.push_back(D->isTrivialForCall());
543  Record.push_back(D->isDefaulted());
544  Record.push_back(D->isExplicitlyDefaulted());
545  Record.push_back(D->hasImplicitReturnZero());
546  Record.push_back(D->isConstexpr());
547  Record.push_back(D->usesSEHTry());
548  Record.push_back(D->hasSkippedBody());
549  Record.push_back(D->isMultiVersion());
550  Record.push_back(D->isLateTemplateParsed());
551  Record.push_back(D->getLinkageInternal());
552  Record.AddSourceLocation(D->getEndLoc());
553 
554  Record.push_back(D->getODRHash());
555 
556  Record.push_back(D->getTemplatedKind());
557  switch (D->getTemplatedKind()) {
559  break;
561  Record.AddDeclRef(D->getDescribedFunctionTemplate());
562  break;
565  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
566  Record.push_back(MemberInfo->getTemplateSpecializationKind());
567  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
568  break;
569  }
572  FTSInfo = D->getTemplateSpecializationInfo();
573 
574  RegisterTemplateSpecialization(FTSInfo->getTemplate(), D);
575 
576  Record.AddDeclRef(FTSInfo->getTemplate());
577  Record.push_back(FTSInfo->getTemplateSpecializationKind());
578 
579  // Template arguments.
580  Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
581 
582  // Template args as written.
583  Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
584  if (FTSInfo->TemplateArgumentsAsWritten) {
585  Record.push_back(FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs);
586  for (int i=0, e = FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs;
587  i!=e; ++i)
588  Record.AddTemplateArgumentLoc(
589  (*FTSInfo->TemplateArgumentsAsWritten)[i]);
590  Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->LAngleLoc);
591  Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->RAngleLoc);
592  }
593 
594  Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
595 
596  if (D->isCanonicalDecl()) {
597  // Write the template that contains the specializations set. We will
598  // add a FunctionTemplateSpecializationInfo to it when reading.
599  Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
600  }
601  break;
602  }
605  DFTSInfo = D->getDependentSpecializationInfo();
606 
607  // Templates.
608  Record.push_back(DFTSInfo->getNumTemplates());
609  for (int i=0, e = DFTSInfo->getNumTemplates(); i != e; ++i)
610  Record.AddDeclRef(DFTSInfo->getTemplate(i));
611 
612  // Templates args.
613  Record.push_back(DFTSInfo->getNumTemplateArgs());
614  for (int i=0, e = DFTSInfo->getNumTemplateArgs(); i != e; ++i)
615  Record.AddTemplateArgumentLoc(DFTSInfo->getTemplateArg(i));
616  Record.AddSourceLocation(DFTSInfo->getLAngleLoc());
617  Record.AddSourceLocation(DFTSInfo->getRAngleLoc());
618  break;
619  }
620  }
621 
622  Record.push_back(D->param_size());
623  for (auto P : D->parameters())
624  Record.AddDeclRef(P);
626 }
627 
629  VisitFunctionDecl(D);
630  Record.push_back(D->isCopyDeductionCandidate());
632 }
633 
635  VisitNamedDecl(D);
636  // FIXME: convert to LazyStmtPtr?
637  // Unlike C/C++, method bodies will never be in header files.
638  bool HasBodyStuff = D->getBody() != nullptr ||
639  D->getSelfDecl() != nullptr || D->getCmdDecl() != nullptr;
640  Record.push_back(HasBodyStuff);
641  if (HasBodyStuff) {
642  Record.AddStmt(D->getBody());
643  Record.AddDeclRef(D->getSelfDecl());
644  Record.AddDeclRef(D->getCmdDecl());
645  }
646  Record.push_back(D->isInstanceMethod());
647  Record.push_back(D->isVariadic());
648  Record.push_back(D->isPropertyAccessor());
649  Record.push_back(D->isDefined());
650  Record.push_back(D->isOverriding());
651  Record.push_back(D->hasSkippedBody());
652 
653  Record.push_back(D->isRedeclaration());
654  Record.push_back(D->hasRedeclaration());
655  if (D->hasRedeclaration()) {
656  assert(Context.getObjCMethodRedeclaration(D));
657  Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
658  }
659 
660  // FIXME: stable encoding for @required/@optional
661  Record.push_back(D->getImplementationControl());
662  // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
663  Record.push_back(D->getObjCDeclQualifier());
664  Record.push_back(D->hasRelatedResultType());
665  Record.AddTypeRef(D->getReturnType());
666  Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
667  Record.AddSourceLocation(D->getEndLoc());
668  Record.push_back(D->param_size());
669  for (const auto *P : D->parameters())
670  Record.AddDeclRef(P);
671 
672  Record.push_back(D->getSelLocsKind());
673  unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
674  SourceLocation *SelLocs = D->getStoredSelLocs();
675  Record.push_back(NumStoredSelLocs);
676  for (unsigned i = 0; i != NumStoredSelLocs; ++i)
677  Record.AddSourceLocation(SelLocs[i]);
678 
680 }
681 
683  VisitTypedefNameDecl(D);
684  Record.push_back(D->Variance);
685  Record.push_back(D->Index);
686  Record.AddSourceLocation(D->VarianceLoc);
687  Record.AddSourceLocation(D->ColonLoc);
688 
690 }
691 
693  VisitNamedDecl(D);
694  Record.AddSourceLocation(D->getAtStartLoc());
695  Record.AddSourceRange(D->getAtEndRange());
696  // Abstract class (no need to define a stable serialization::DECL code).
697 }
698 
700  VisitRedeclarable(D);
701  VisitObjCContainerDecl(D);
702  Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
703  AddObjCTypeParamList(D->TypeParamList);
704 
705  Record.push_back(D->isThisDeclarationADefinition());
706  if (D->isThisDeclarationADefinition()) {
707  // Write the DefinitionData
708  ObjCInterfaceDecl::DefinitionData &Data = D->data();
709 
710  Record.AddTypeSourceInfo(D->getSuperClassTInfo());
711  Record.AddSourceLocation(D->getEndOfDefinitionLoc());
712  Record.push_back(Data.HasDesignatedInitializers);
713 
714  // Write out the protocols that are directly referenced by the @interface.
715  Record.push_back(Data.ReferencedProtocols.size());
716  for (const auto *P : D->protocols())
717  Record.AddDeclRef(P);
718  for (const auto &PL : D->protocol_locs())
719  Record.AddSourceLocation(PL);
720 
721  // Write out the protocols that are transitively referenced.
722  Record.push_back(Data.AllReferencedProtocols.size());
724  P = Data.AllReferencedProtocols.begin(),
725  PEnd = Data.AllReferencedProtocols.end();
726  P != PEnd; ++P)
727  Record.AddDeclRef(*P);
728 
729 
730  if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
731  // Ensure that we write out the set of categories for this class.
732  Writer.ObjCClassesWithCategories.insert(D);
733 
734  // Make sure that the categories get serialized.
735  for (; Cat; Cat = Cat->getNextClassCategoryRaw())
736  (void)Writer.GetDeclRef(Cat);
737  }
738  }
739 
741 }
742 
744  VisitFieldDecl(D);
745  // FIXME: stable encoding for @public/@private/@protected/@package
746  Record.push_back(D->getAccessControl());
747  Record.push_back(D->getSynthesize());
748 
749  if (D->getDeclContext() == D->getLexicalDeclContext() &&
750  !D->hasAttrs() &&
751  !D->isImplicit() &&
752  !D->isUsed(false) &&
753  !D->isInvalidDecl() &&
754  !D->isReferenced() &&
755  !D->isModulePrivate() &&
756  !D->getBitWidth() &&
757  !D->hasExtInfo() &&
758  D->getDeclName())
759  AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
760 
762 }
763 
765  VisitRedeclarable(D);
766  VisitObjCContainerDecl(D);
767 
768  Record.push_back(D->isThisDeclarationADefinition());
769  if (D->isThisDeclarationADefinition()) {
770  Record.push_back(D->protocol_size());
771  for (const auto *I : D->protocols())
772  Record.AddDeclRef(I);
773  for (const auto &PL : D->protocol_locs())
774  Record.AddSourceLocation(PL);
775  }
776 
778 }
779 
781  VisitFieldDecl(D);
783 }
784 
786  VisitObjCContainerDecl(D);
787  Record.AddSourceLocation(D->getCategoryNameLoc());
788  Record.AddSourceLocation(D->getIvarLBraceLoc());
789  Record.AddSourceLocation(D->getIvarRBraceLoc());
790  Record.AddDeclRef(D->getClassInterface());
791  AddObjCTypeParamList(D->TypeParamList);
792  Record.push_back(D->protocol_size());
793  for (const auto *I : D->protocols())
794  Record.AddDeclRef(I);
795  for (const auto &PL : D->protocol_locs())
796  Record.AddSourceLocation(PL);
798 }
799 
801  VisitNamedDecl(D);
802  Record.AddDeclRef(D->getClassInterface());
804 }
805 
807  VisitNamedDecl(D);
808  Record.AddSourceLocation(D->getAtLoc());
809  Record.AddSourceLocation(D->getLParenLoc());
810  Record.AddTypeRef(D->getType());
811  Record.AddTypeSourceInfo(D->getTypeSourceInfo());
812  // FIXME: stable encoding
813  Record.push_back((unsigned)D->getPropertyAttributes());
814  Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
815  // FIXME: stable encoding
816  Record.push_back((unsigned)D->getPropertyImplementation());
817  Record.AddDeclarationName(D->getGetterName());
818  Record.AddSourceLocation(D->getGetterNameLoc());
819  Record.AddDeclarationName(D->getSetterName());
820  Record.AddSourceLocation(D->getSetterNameLoc());
821  Record.AddDeclRef(D->getGetterMethodDecl());
822  Record.AddDeclRef(D->getSetterMethodDecl());
823  Record.AddDeclRef(D->getPropertyIvarDecl());
825 }
826 
828  VisitObjCContainerDecl(D);
829  Record.AddDeclRef(D->getClassInterface());
830  // Abstract class (no need to define a stable serialization::DECL code).
831 }
832 
834  VisitObjCImplDecl(D);
835  Record.AddSourceLocation(D->getCategoryNameLoc());
837 }
838 
840  VisitObjCImplDecl(D);
841  Record.AddDeclRef(D->getSuperClass());
842  Record.AddSourceLocation(D->getSuperClassLoc());
843  Record.AddSourceLocation(D->getIvarLBraceLoc());
844  Record.AddSourceLocation(D->getIvarRBraceLoc());
845  Record.push_back(D->hasNonZeroConstructors());
846  Record.push_back(D->hasDestructors());
847  Record.push_back(D->NumIvarInitializers);
848  if (D->NumIvarInitializers)
849  Record.AddCXXCtorInitializers(
850  llvm::makeArrayRef(D->init_begin(), D->init_end()));
852 }
853 
855  VisitDecl(D);
856  Record.AddSourceLocation(D->getBeginLoc());
857  Record.AddDeclRef(D->getPropertyDecl());
858  Record.AddDeclRef(D->getPropertyIvarDecl());
859  Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
860  Record.AddStmt(D->getGetterCXXConstructor());
861  Record.AddStmt(D->getSetterCXXAssignment());
863 }
864 
866  VisitDeclaratorDecl(D);
867  Record.push_back(D->isMutable());
868 
869  FieldDecl::InitStorageKind ISK = D->InitStorage.getInt();
870  Record.push_back(ISK);
871  if (ISK == FieldDecl::ISK_CapturedVLAType)
872  Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
873  else if (ISK)
874  Record.AddStmt(D->getInClassInitializer());
875 
876  Record.AddStmt(D->getBitWidth());
877 
878  if (!D->getDeclName())
879  Record.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D));
880 
881  if (D->getDeclContext() == D->getLexicalDeclContext() &&
882  !D->hasAttrs() &&
883  !D->isImplicit() &&
884  !D->isUsed(false) &&
885  !D->isInvalidDecl() &&
886  !D->isReferenced() &&
888  !D->isModulePrivate() &&
889  !D->getBitWidth() &&
890  !D->hasInClassInitializer() &&
891  !D->hasCapturedVLAType() &&
892  !D->hasExtInfo() &&
895  D->getDeclName())
896  AbbrevToUse = Writer.getDeclFieldAbbrev();
897 
899 }
900 
902  VisitDeclaratorDecl(D);
903  Record.AddIdentifierRef(D->getGetterId());
904  Record.AddIdentifierRef(D->getSetterId());
906 }
907 
909  VisitValueDecl(D);
910  Record.push_back(D->getChainingSize());
911 
912  for (const auto *P : D->chain())
913  Record.AddDeclRef(P);
915 }
916 
918  VisitRedeclarable(D);
919  VisitDeclaratorDecl(D);
920  Record.push_back(D->getStorageClass());
921  Record.push_back(D->getTSCSpec());
922  Record.push_back(D->getInitStyle());
923  if (!isa<ParmVarDecl>(D)) {
924  Record.push_back(D->isThisDeclarationADemotedDefinition());
925  Record.push_back(D->isExceptionVariable());
926  Record.push_back(D->isNRVOVariable());
927  Record.push_back(D->isCXXForRangeDecl());
928  Record.push_back(D->isObjCForDecl());
929  Record.push_back(D->isARCPseudoStrong());
930  Record.push_back(D->isInline());
931  Record.push_back(D->isInlineSpecified());
932  Record.push_back(D->isConstexpr());
933  Record.push_back(D->isInitCapture());
934  Record.push_back(D->isPreviousDeclInSameBlockScope());
935  if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
936  Record.push_back(static_cast<unsigned>(IPD->getParameterKind()));
937  else
938  Record.push_back(0);
939  }
940  Record.push_back(D->getLinkageInternal());
941 
942  if (D->getInit()) {
943  Record.push_back(!D->isInitKnownICE() ? 1 : (D->isInitICE() ? 3 : 2));
944  Record.AddStmt(D->getInit());
945  } else {
946  Record.push_back(0);
947  }
948 
949  if (D->hasAttr<BlocksAttr>() && D->getType()->getAsCXXRecordDecl()) {
950  ASTContext::BlockVarCopyInit Init = Writer.Context->getBlockVarCopyInit(D);
951  Record.AddStmt(Init.getCopyExpr());
952  if (Init.getCopyExpr())
953  Record.push_back(Init.canThrow());
954  }
955 
956  if (D->getStorageDuration() == SD_Static) {
957  bool ModulesCodegen = false;
958  if (Writer.WritingModule &&
960  !isa<VarTemplateSpecializationDecl>(D)) {
961  // When building a C++ Modules TS module interface unit, a strong
962  // definition in the module interface is provided by the compilation of
963  // that module interface unit, not by its users. (Inline variables are
964  // still emitted in module users.)
965  ModulesCodegen =
966  (Writer.WritingModule->Kind == Module::ModuleInterfaceUnit &&
967  Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal);
968  }
969  Record.push_back(ModulesCodegen);
970  if (ModulesCodegen)
971  Writer.ModularCodegenDecls.push_back(Writer.GetDeclRef(D));
972  }
973 
974  enum {
975  VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
976  };
977  if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
978  Record.push_back(VarTemplate);
979  Record.AddDeclRef(TemplD);
980  } else if (MemberSpecializationInfo *SpecInfo
982  Record.push_back(StaticDataMemberSpecialization);
983  Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
984  Record.push_back(SpecInfo->getTemplateSpecializationKind());
985  Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
986  } else {
987  Record.push_back(VarNotTemplate);
988  }
989 
990  if (D->getDeclContext() == D->getLexicalDeclContext() &&
991  !D->hasAttrs() &&
992  !D->isImplicit() &&
993  !D->isUsed(false) &&
994  !D->isInvalidDecl() &&
995  !D->isReferenced() &&
997  D->getAccess() == AS_none &&
998  !D->isModulePrivate() &&
1001  !D->hasExtInfo() &&
1002  D->getFirstDecl() == D->getMostRecentDecl() &&
1003  D->getKind() == Decl::Var &&
1004  !D->isInline() &&
1005  !D->isConstexpr() &&
1006  !D->isInitCapture() &&
1008  !(D->hasAttr<BlocksAttr>() && D->getType()->getAsCXXRecordDecl()) &&
1009  D->getStorageDuration() != SD_Static &&
1011  AbbrevToUse = Writer.getDeclVarAbbrev();
1012 
1013  Code = serialization::DECL_VAR;
1014 }
1015 
1017  VisitVarDecl(D);
1019 }
1020 
1022  VisitVarDecl(D);
1023  Record.push_back(D->isObjCMethodParameter());
1024  Record.push_back(D->getFunctionScopeDepth());
1025  Record.push_back(D->getFunctionScopeIndex());
1026  Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding
1027  Record.push_back(D->isKNRPromoted());
1028  Record.push_back(D->hasInheritedDefaultArg());
1029  Record.push_back(D->hasUninstantiatedDefaultArg());
1030  if (D->hasUninstantiatedDefaultArg())
1031  Record.AddStmt(D->getUninstantiatedDefaultArg());
1033 
1034  assert(!D->isARCPseudoStrong()); // can be true of ImplicitParamDecl
1035 
1036  // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1037  // we dynamically check for the properties that we optimize for, but don't
1038  // know are true of all PARM_VAR_DECLs.
1039  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1040  !D->hasAttrs() &&
1041  !D->hasExtInfo() &&
1042  !D->isImplicit() &&
1043  !D->isUsed(false) &&
1044  !D->isInvalidDecl() &&
1045  !D->isReferenced() &&
1046  D->getAccess() == AS_none &&
1047  !D->isModulePrivate() &&
1048  D->getStorageClass() == 0 &&
1049  D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1050  D->getFunctionScopeDepth() == 0 &&
1051  D->getObjCDeclQualifier() == 0 &&
1052  !D->isKNRPromoted() &&
1053  !D->hasInheritedDefaultArg() &&
1054  D->getInit() == nullptr &&
1055  !D->hasUninstantiatedDefaultArg()) // No default expr.
1056  AbbrevToUse = Writer.getDeclParmVarAbbrev();
1057 
1058  // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1059  // just us assuming it.
1060  assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1062  && "PARM_VAR_DECL can't be demoted definition.");
1063  assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1064  assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1065  assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1066  assert(!D->isStaticDataMember() &&
1067  "PARM_VAR_DECL can't be static data member");
1068 }
1069 
1071  // Record the number of bindings first to simplify deserialization.
1072  Record.push_back(D->bindings().size());
1073 
1074  VisitVarDecl(D);
1075  for (auto *B : D->bindings())
1076  Record.AddDeclRef(B);
1078 }
1079 
1081  VisitValueDecl(D);
1082  Record.AddStmt(D->getBinding());
1084 }
1085 
1087  VisitDecl(D);
1088  Record.AddStmt(D->getAsmString());
1089  Record.AddSourceLocation(D->getRParenLoc());
1091 }
1092 
1094  VisitDecl(D);
1096 }
1097 
1099  VisitDecl(D);
1100  Record.AddStmt(D->getBody());
1101  Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1102  Record.push_back(D->param_size());
1103  for (ParmVarDecl *P : D->parameters())
1104  Record.AddDeclRef(P);
1105  Record.push_back(D->isVariadic());
1106  Record.push_back(D->blockMissingReturnType());
1107  Record.push_back(D->isConversionFromLambda());
1108  Record.push_back(D->doesNotEscape());
1109  Record.push_back(D->capturesCXXThis());
1110  Record.push_back(D->getNumCaptures());
1111  for (const auto &capture : D->captures()) {
1112  Record.AddDeclRef(capture.getVariable());
1113 
1114  unsigned flags = 0;
1115  if (capture.isByRef()) flags |= 1;
1116  if (capture.isNested()) flags |= 2;
1117  if (capture.hasCopyExpr()) flags |= 4;
1118  Record.push_back(flags);
1119 
1120  if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1121  }
1122 
1124 }
1125 
1127  Record.push_back(CD->getNumParams());
1128  VisitDecl(CD);
1129  Record.push_back(CD->getContextParamPosition());
1130  Record.push_back(CD->isNothrow() ? 1 : 0);
1131  // Body is stored by VisitCapturedStmt.
1132  for (unsigned I = 0; I < CD->getNumParams(); ++I)
1133  Record.AddDeclRef(CD->getParam(I));
1135 }
1136 
1138  VisitDecl(D);
1139  Record.push_back(D->getLanguage());
1140  Record.AddSourceLocation(D->getExternLoc());
1141  Record.AddSourceLocation(D->getRBraceLoc());
1143 }
1144 
1146  VisitDecl(D);
1147  Record.AddSourceLocation(D->getRBraceLoc());
1149 }
1150 
1152  VisitNamedDecl(D);
1153  Record.AddSourceLocation(D->getBeginLoc());
1155 }
1156 
1157 
1159  VisitRedeclarable(D);
1160  VisitNamedDecl(D);
1161  Record.push_back(D->isInline());
1162  Record.AddSourceLocation(D->getBeginLoc());
1163  Record.AddSourceLocation(D->getRBraceLoc());
1164 
1165  if (D->isOriginalNamespace())
1166  Record.AddDeclRef(D->getAnonymousNamespace());
1168 
1169  if (Writer.hasChain() && D->isAnonymousNamespace() &&
1170  D == D->getMostRecentDecl()) {
1171  // This is a most recent reopening of the anonymous namespace. If its parent
1172  // is in a previous PCH (or is the TU), mark that parent for update, because
1173  // the original namespace always points to the latest re-opening of its
1174  // anonymous namespace.
1175  Decl *Parent = cast<Decl>(
1177  if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1178  Writer.DeclUpdates[Parent].push_back(
1179  ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
1180  }
1181  }
1182 }
1183 
1185  VisitRedeclarable(D);
1186  VisitNamedDecl(D);
1187  Record.AddSourceLocation(D->getNamespaceLoc());
1188  Record.AddSourceLocation(D->getTargetNameLoc());
1189  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1190  Record.AddDeclRef(D->getNamespace());
1192 }
1193 
1195  VisitNamedDecl(D);
1196  Record.AddSourceLocation(D->getUsingLoc());
1197  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1198  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1199  Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1200  Record.push_back(D->hasTypename());
1201  Record.AddDeclRef(Context.getInstantiatedFromUsingDecl(D));
1203 }
1204 
1206  Record.push_back(D->NumExpansions);
1207  VisitNamedDecl(D);
1208  Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
1209  for (auto *E : D->expansions())
1210  Record.AddDeclRef(E);
1212 }
1213 
1215  VisitRedeclarable(D);
1216  VisitNamedDecl(D);
1217  Record.AddDeclRef(D->getTargetDecl());
1218  Record.push_back(D->getIdentifierNamespace());
1219  Record.AddDeclRef(D->UsingOrNextShadow);
1220  Record.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D));
1222 }
1223 
1226  VisitUsingShadowDecl(D);
1227  Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1228  Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1229  Record.push_back(D->IsVirtual);
1231 }
1232 
1234  VisitNamedDecl(D);
1235  Record.AddSourceLocation(D->getUsingLoc());
1236  Record.AddSourceLocation(D->getNamespaceKeyLocation());
1237  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1238  Record.AddDeclRef(D->getNominatedNamespace());
1239  Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1241 }
1242 
1244  VisitValueDecl(D);
1245  Record.AddSourceLocation(D->getUsingLoc());
1246  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1247  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1248  Record.AddSourceLocation(D->getEllipsisLoc());
1250 }
1251 
1254  VisitTypeDecl(D);
1255  Record.AddSourceLocation(D->getTypenameLoc());
1256  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1257  Record.AddSourceLocation(D->getEllipsisLoc());
1259 }
1260 
1262  VisitRecordDecl(D);
1263 
1264  enum {
1265  CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
1266  };
1267  if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1268  Record.push_back(CXXRecTemplate);
1269  Record.AddDeclRef(TemplD);
1270  } else if (MemberSpecializationInfo *MSInfo
1271  = D->getMemberSpecializationInfo()) {
1272  Record.push_back(CXXRecMemberSpecialization);
1273  Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1274  Record.push_back(MSInfo->getTemplateSpecializationKind());
1275  Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1276  } else {
1277  Record.push_back(CXXRecNotTemplate);
1278  }
1279 
1280  Record.push_back(D->isThisDeclarationADefinition());
1282  Record.AddCXXDefinitionData(D);
1283 
1284  // Store (what we currently believe to be) the key function to avoid
1285  // deserializing every method so we can compute it.
1286  if (D->isCompleteDefinition())
1287  Record.AddDeclRef(Context.getCurrentKeyFunction(D));
1288 
1290 }
1291 
1293  VisitFunctionDecl(D);
1294  if (D->isCanonicalDecl()) {
1295  Record.push_back(D->size_overridden_methods());
1296  for (const CXXMethodDecl *MD : D->overridden_methods())
1297  Record.AddDeclRef(MD);
1298  } else {
1299  // We only need to record overridden methods once for the canonical decl.
1300  Record.push_back(0);
1301  }
1302 
1303  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1304  D->getFirstDecl() == D->getMostRecentDecl() &&
1305  !D->isInvalidDecl() &&
1306  !D->hasAttrs() &&
1309  !D->hasExtInfo() &&
1310  !D->hasInheritedPrototype() &&
1311  D->hasWrittenPrototype())
1312  AbbrevToUse = Writer.getDeclCXXMethodAbbrev();
1313 
1315 }
1316 
1318  if (auto Inherited = D->getInheritedConstructor()) {
1319  Record.AddDeclRef(Inherited.getShadowDecl());
1320  Record.AddDeclRef(Inherited.getConstructor());
1322  } else {
1324  }
1325 
1326  VisitCXXMethodDecl(D);
1327 
1328  Code = D->isInheritingConstructor()
1331 }
1332 
1334  VisitCXXMethodDecl(D);
1335 
1336  Record.AddDeclRef(D->getOperatorDelete());
1337  if (D->getOperatorDelete())
1338  Record.AddStmt(D->getOperatorDeleteThisArg());
1339 
1341 }
1342 
1344  VisitCXXMethodDecl(D);
1346 }
1347 
1349  VisitDecl(D);
1350  Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1351  ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1352  Record.push_back(!IdentifierLocs.empty());
1353  if (IdentifierLocs.empty()) {
1354  Record.AddSourceLocation(D->getEndLoc());
1355  Record.push_back(1);
1356  } else {
1357  for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1358  Record.AddSourceLocation(IdentifierLocs[I]);
1359  Record.push_back(IdentifierLocs.size());
1360  }
1361  // Note: the number of source locations must always be the last element in
1362  // the record.
1364 }
1365 
1367  VisitDecl(D);
1368  Record.AddSourceLocation(D->getColonLoc());
1370 }
1371 
1373  // Record the number of friend type template parameter lists here
1374  // so as to simplify memory allocation during deserialization.
1375  Record.push_back(D->NumTPLists);
1376  VisitDecl(D);
1377  bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1378  Record.push_back(hasFriendDecl);
1379  if (hasFriendDecl)
1380  Record.AddDeclRef(D->getFriendDecl());
1381  else
1382  Record.AddTypeSourceInfo(D->getFriendType());
1383  for (unsigned i = 0; i < D->NumTPLists; ++i)
1384  Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1385  Record.AddDeclRef(D->getNextFriend());
1386  Record.push_back(D->UnsupportedFriend);
1387  Record.AddSourceLocation(D->FriendLoc);
1389 }
1390 
1392  VisitDecl(D);
1393  Record.push_back(D->getNumTemplateParameters());
1394  for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1395  Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1396  Record.push_back(D->getFriendDecl() != nullptr);
1397  if (D->getFriendDecl())
1398  Record.AddDeclRef(D->getFriendDecl());
1399  else
1400  Record.AddTypeSourceInfo(D->getFriendType());
1401  Record.AddSourceLocation(D->getFriendLoc());
1403 }
1404 
1406  VisitNamedDecl(D);
1407 
1408  Record.AddDeclRef(D->getTemplatedDecl());
1409  Record.AddTemplateParameterList(D->getTemplateParameters());
1410 }
1411 
1413  VisitRedeclarable(D);
1414 
1415  // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1416  // getCommonPtr() can be used while this is still initializing.
1417  if (D->isFirstDecl()) {
1418  // This declaration owns the 'common' pointer, so serialize that data now.
1419  Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());
1421  Record.push_back(D->isMemberSpecialization());
1422  }
1423 
1424  VisitTemplateDecl(D);
1425  Record.push_back(D->getIdentifierNamespace());
1426 }
1427 
1429  VisitRedeclarableTemplateDecl(D);
1430 
1431  if (D->isFirstDecl())
1432  AddTemplateSpecializations(D);
1434 }
1435 
1438  RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
1439 
1440  VisitCXXRecordDecl(D);
1441 
1442  llvm::PointerUnion<ClassTemplateDecl *,
1445  if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1446  Record.AddDeclRef(InstFromD);
1447  } else {
1448  Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1449  Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1450  }
1451 
1452  Record.AddTemplateArgumentList(&D->getTemplateArgs());
1453  Record.AddSourceLocation(D->getPointOfInstantiation());
1454  Record.push_back(D->getSpecializationKind());
1455  Record.push_back(D->isCanonicalDecl());
1456 
1457  if (D->isCanonicalDecl()) {
1458  // When reading, we'll add it to the folding set of the following template.
1459  Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1460  }
1461 
1462  // Explicit info.
1463  Record.AddTypeSourceInfo(D->getTypeAsWritten());
1464  if (D->getTypeAsWritten()) {
1465  Record.AddSourceLocation(D->getExternLoc());
1466  Record.AddSourceLocation(D->getTemplateKeywordLoc());
1467  }
1468 
1470 }
1471 
1474  VisitClassTemplateSpecializationDecl(D);
1475 
1476  Record.AddTemplateParameterList(D->getTemplateParameters());
1477  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1478 
1479  // These are read/set from/to the first declaration.
1480  if (D->getPreviousDecl() == nullptr) {
1481  Record.AddDeclRef(D->getInstantiatedFromMember());
1482  Record.push_back(D->isMemberSpecialization());
1483  }
1484 
1486 }
1487 
1489  VisitRedeclarableTemplateDecl(D);
1490 
1491  if (D->isFirstDecl())
1492  AddTemplateSpecializations(D);
1494 }
1495 
1498  RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
1499 
1500  VisitVarDecl(D);
1501 
1502  llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1503  InstFrom = D->getSpecializedTemplateOrPartial();
1504  if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1505  Record.AddDeclRef(InstFromD);
1506  } else {
1507  Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1508  Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1509  }
1510 
1511  // Explicit info.
1512  Record.AddTypeSourceInfo(D->getTypeAsWritten());
1513  if (D->getTypeAsWritten()) {
1514  Record.AddSourceLocation(D->getExternLoc());
1515  Record.AddSourceLocation(D->getTemplateKeywordLoc());
1516  }
1517 
1518  Record.AddTemplateArgumentList(&D->getTemplateArgs());
1519  Record.AddSourceLocation(D->getPointOfInstantiation());
1520  Record.push_back(D->getSpecializationKind());
1521  Record.push_back(D->IsCompleteDefinition);
1522  Record.push_back(D->isCanonicalDecl());
1523 
1524  if (D->isCanonicalDecl()) {
1525  // When reading, we'll add it to the folding set of the following template.
1526  Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1527  }
1528 
1530 }
1531 
1534  VisitVarTemplateSpecializationDecl(D);
1535 
1536  Record.AddTemplateParameterList(D->getTemplateParameters());
1537  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1538 
1539  // These are read/set from/to the first declaration.
1540  if (D->getPreviousDecl() == nullptr) {
1541  Record.AddDeclRef(D->getInstantiatedFromMember());
1542  Record.push_back(D->isMemberSpecialization());
1543  }
1544 
1546 }
1547 
1550  VisitDecl(D);
1551  Record.AddDeclRef(D->getSpecialization());
1553 }
1554 
1555 
1557  VisitRedeclarableTemplateDecl(D);
1558 
1559  if (D->isFirstDecl())
1560  AddTemplateSpecializations(D);
1562 }
1563 
1565  VisitTypeDecl(D);
1566 
1567  Record.push_back(D->wasDeclaredWithTypename());
1568 
1569  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1571  Record.push_back(OwnsDefaultArg);
1572  if (OwnsDefaultArg)
1573  Record.AddTypeSourceInfo(D->getDefaultArgumentInfo());
1574 
1576 }
1577 
1579  // For an expanded parameter pack, record the number of expansion types here
1580  // so that it's easier for deserialization to allocate the right amount of
1581  // memory.
1582  if (D->isExpandedParameterPack())
1583  Record.push_back(D->getNumExpansionTypes());
1584 
1585  VisitDeclaratorDecl(D);
1586  // TemplateParmPosition.
1587  Record.push_back(D->getDepth());
1588  Record.push_back(D->getPosition());
1589 
1590  if (D->isExpandedParameterPack()) {
1591  for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1592  Record.AddTypeRef(D->getExpansionType(I));
1593  Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
1594  }
1595 
1597  } else {
1598  // Rest of NonTypeTemplateParmDecl.
1599  Record.push_back(D->isParameterPack());
1600  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1602  Record.push_back(OwnsDefaultArg);
1603  if (OwnsDefaultArg)
1604  Record.AddStmt(D->getDefaultArgument());
1606  }
1607 }
1608 
1610  // For an expanded parameter pack, record the number of expansion types here
1611  // so that it's easier for deserialization to allocate the right amount of
1612  // memory.
1613  if (D->isExpandedParameterPack())
1614  Record.push_back(D->getNumExpansionTemplateParameters());
1615 
1616  VisitTemplateDecl(D);
1617  // TemplateParmPosition.
1618  Record.push_back(D->getDepth());
1619  Record.push_back(D->getPosition());
1620 
1621  if (D->isExpandedParameterPack()) {
1622  for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1623  I != N; ++I)
1624  Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
1626  } else {
1627  // Rest of TemplateTemplateParmDecl.
1628  Record.push_back(D->isParameterPack());
1629  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1631  Record.push_back(OwnsDefaultArg);
1632  if (OwnsDefaultArg)
1633  Record.AddTemplateArgumentLoc(D->getDefaultArgument());
1635  }
1636 }
1637 
1639  VisitRedeclarableTemplateDecl(D);
1641 }
1642 
1644  VisitDecl(D);
1645  Record.AddStmt(D->getAssertExpr());
1646  Record.push_back(D->isFailed());
1647  Record.AddStmt(D->getMessage());
1648  Record.AddSourceLocation(D->getRParenLoc());
1650 }
1651 
1652 /// Emit the DeclContext part of a declaration context decl.
1654  Record.AddOffset(Writer.WriteDeclContextLexicalBlock(Context, DC));
1655  Record.AddOffset(Writer.WriteDeclContextVisibleBlock(Context, DC));
1656 }
1657 
1659  assert(IsLocalDecl(D) && "expected a local declaration");
1660 
1661  const Decl *Canon = D->getCanonicalDecl();
1662  if (IsLocalDecl(Canon))
1663  return Canon;
1664 
1665  const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
1666  if (CacheEntry)
1667  return CacheEntry;
1668 
1669  for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
1670  if (IsLocalDecl(Redecl))
1671  D = Redecl;
1672  return CacheEntry = D;
1673 }
1674 
1675 template <typename T>
1677  T *First = D->getFirstDecl();
1678  T *MostRecent = First->getMostRecentDecl();
1679  T *DAsT = static_cast<T *>(D);
1680  if (MostRecent != First) {
1681  assert(isRedeclarableDeclKind(DAsT->getKind()) &&
1682  "Not considered redeclarable?");
1683 
1684  Record.AddDeclRef(First);
1685 
1686  // Write out a list of local redeclarations of this declaration if it's the
1687  // first local declaration in the chain.
1688  const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
1689  if (DAsT == FirstLocal) {
1690  // Emit a list of all imported first declarations so that we can be sure
1691  // that all redeclarations visible to this module are before D in the
1692  // redecl chain.
1693  unsigned I = Record.size();
1694  Record.push_back(0);
1695  if (Writer.Chain)
1696  AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
1697  // This is the number of imported first declarations + 1.
1698  Record[I] = Record.size() - I;
1699 
1700  // Collect the set of local redeclarations of this declaration, from
1701  // newest to oldest.
1702  ASTWriter::RecordData LocalRedecls;
1703  ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
1704  for (const Decl *Prev = FirstLocal->getMostRecentDecl();
1705  Prev != FirstLocal; Prev = Prev->getPreviousDecl())
1706  if (!Prev->isFromASTFile())
1707  LocalRedeclWriter.AddDeclRef(Prev);
1708 
1709  // If we have any redecls, write them now as a separate record preceding
1710  // the declaration itself.
1711  if (LocalRedecls.empty())
1712  Record.push_back(0);
1713  else
1714  Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
1715  } else {
1716  Record.push_back(0);
1717  Record.AddDeclRef(FirstLocal);
1718  }
1719 
1720  // Make sure that we serialize both the previous and the most-recent
1721  // declarations, which (transitively) ensures that all declarations in the
1722  // chain get serialized.
1723  //
1724  // FIXME: This is not correct; when we reach an imported declaration we
1725  // won't emit its previous declaration.
1726  (void)Writer.GetDeclRef(D->getPreviousDecl());
1727  (void)Writer.GetDeclRef(MostRecent);
1728  } else {
1729  // We use the sentinel value 0 to indicate an only declaration.
1730  Record.push_back(0);
1731  }
1732 }
1733 
1735  Record.push_back(D->varlist_size());
1736  VisitDecl(D);
1737  for (auto *I : D->varlists())
1738  Record.AddStmt(I);
1740 }
1741 
1743  VisitValueDecl(D);
1744  Record.AddSourceLocation(D->getBeginLoc());
1745  Record.AddStmt(D->getCombiner());
1746  Record.AddStmt(D->getInitializer());
1747  Record.push_back(D->getInitializerKind());
1748  Record.AddDeclRef(D->getPrevDeclInScope());
1750 }
1751 
1753  VisitVarDecl(D);
1755 }
1756 
1757 //===----------------------------------------------------------------------===//
1758 // ASTWriter Implementation
1759 //===----------------------------------------------------------------------===//
1760 
1761 void ASTWriter::WriteDeclAbbrevs() {
1762  using namespace llvm;
1763 
1764  std::shared_ptr<BitCodeAbbrev> Abv;
1765 
1766  // Abbreviation for DECL_FIELD
1767  Abv = std::make_shared<BitCodeAbbrev>();
1768  Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
1769  // Decl
1770  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1771  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1772  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1773  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1774  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1775  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1776  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1777  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1778  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
1779  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1780  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1781  // NamedDecl
1782  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1783  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1784  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1785  // ValueDecl
1786  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1787  // DeclaratorDecl
1788  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1789  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1790  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
1791  // FieldDecl
1792  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
1793  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
1794  // Type Source Info
1795  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1796  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1797  DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
1798 
1799  // Abbreviation for DECL_OBJC_IVAR
1800  Abv = std::make_shared<BitCodeAbbrev>();
1801  Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
1802  // Decl
1803  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1804  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1805  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1806  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1807  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1808  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1809  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1810  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1811  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
1812  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1813  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1814  // NamedDecl
1815  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1816  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1817  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1818  // ValueDecl
1819  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1820  // DeclaratorDecl
1821  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1822  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1823  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
1824  // FieldDecl
1825  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
1826  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
1827  // ObjC Ivar
1828  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
1829  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
1830  // Type Source Info
1831  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1832  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1833  DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
1834 
1835  // Abbreviation for DECL_ENUM
1836  Abv = std::make_shared<BitCodeAbbrev>();
1837  Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
1838  // Redeclarable
1839  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1840  // Decl
1841  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1842  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1843  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1844  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1845  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1846  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1847  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1848  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1849  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1850  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1851  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1852  // NamedDecl
1853  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1854  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1855  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1856  // TypeDecl
1857  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
1858  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
1859  // TagDecl
1860  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
1861  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
1862  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
1863  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
1864  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
1865  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
1866  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1867  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1868  Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
1869  // EnumDecl
1870  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
1871  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
1872  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
1873  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumPositiveBits
1874  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumNegativeBits
1875  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScoped
1876  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScopedUsingClassTag
1877  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isFixed
1878  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
1879  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
1880  // DC
1881  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
1882  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
1883  DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
1884 
1885  // Abbreviation for DECL_RECORD
1886  Abv = std::make_shared<BitCodeAbbrev>();
1887  Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
1888  // Redeclarable
1889  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1890  // Decl
1891  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1892  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1893  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1894  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1895  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1896  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1897  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1898  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1899  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1900  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1901  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1902  // NamedDecl
1903  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1904  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1905  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1906  // TypeDecl
1907  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
1908  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
1909  // TagDecl
1910  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
1911  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
1912  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
1913  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
1914  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
1915  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
1916  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1917  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1918  Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
1919  // RecordDecl
1920  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // FlexibleArrayMember
1921  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // AnonymousStructUnion
1922  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasObjectMember
1923  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasVolatileMember
1924 
1925  // isNonTrivialToPrimitiveDefaultInitialize
1926  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1927  // isNonTrivialToPrimitiveCopy
1928  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1929  // isNonTrivialToPrimitiveDestroy
1930  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1931  // isParamDestroyedInCallee
1932  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
1933  // getArgPassingRestrictions
1934  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
1935 
1936  // DC
1937  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
1938  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
1939  DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
1940 
1941  // Abbreviation for DECL_PARM_VAR
1942  Abv = std::make_shared<BitCodeAbbrev>();
1943  Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
1944  // Redeclarable
1945  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1946  // Decl
1947  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1948  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1949  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1950  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1951  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1952  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1953  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1954  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1955  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1956  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1957  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1958  // NamedDecl
1959  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1960  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1961  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1962  // ValueDecl
1963  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1964  // DeclaratorDecl
1965  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1966  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1967  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
1968  // VarDecl
1969  Abv->Add(BitCodeAbbrevOp(0)); // SClass
1970  Abv->Add(BitCodeAbbrevOp(0)); // TSCSpec
1971  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
1972  Abv->Add(BitCodeAbbrevOp(0)); // Linkage
1973  Abv->Add(BitCodeAbbrevOp(0)); // HasInit
1974  Abv->Add(BitCodeAbbrevOp(0)); // HasMemberSpecializationInfo
1975  // ParmVarDecl
1976  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsObjCMethodParameter
1977  Abv->Add(BitCodeAbbrevOp(0)); // ScopeDepth
1978  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
1979  Abv->Add(BitCodeAbbrevOp(0)); // ObjCDeclQualifier
1980  Abv->Add(BitCodeAbbrevOp(0)); // KNRPromoted
1981  Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedDefaultArg
1982  Abv->Add(BitCodeAbbrevOp(0)); // HasUninstantiatedDefaultArg
1983  // Type Source Info
1984  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1985  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1986  DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
1987 
1988  // Abbreviation for DECL_TYPEDEF
1989  Abv = std::make_shared<BitCodeAbbrev>();
1990  Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
1991  // Redeclarable
1992  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1993  // Decl
1994  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1995  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1996  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1997  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1998  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1999  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isUsed
2000  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isReferenced
2001  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2002  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // C++ AccessSpecifier
2003  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2004  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2005  // NamedDecl
2006  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2007  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2008  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2009  // TypeDecl
2010  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2011  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2012  // TypedefDecl
2013  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2014  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2015  DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2016 
2017  // Abbreviation for DECL_VAR
2018  Abv = std::make_shared<BitCodeAbbrev>();
2019  Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2020  // Redeclarable
2021  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2022  // Decl
2023  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2024  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2025  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2026  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2027  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2028  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2029  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2030  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2031  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2032  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2033  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2034  // NamedDecl
2035  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2036  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2037  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2038  // ValueDecl
2039  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2040  // DeclaratorDecl
2041  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2042  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2043  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2044  // VarDecl
2045  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // SClass
2046  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // TSCSpec
2047  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // InitStyle
2048  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsThisDeclarationADemotedDefinition
2049  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isExceptionVariable
2050  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isNRVOVariable
2051  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCXXForRangeDecl
2052  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isObjCForDecl
2053  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
2054  Abv->Add(BitCodeAbbrevOp(0)); // isInline
2055  Abv->Add(BitCodeAbbrevOp(0)); // isInlineSpecified
2056  Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr
2057  Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture
2058  Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope
2059  Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind
2060  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2061  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // IsInitICE (local)
2062  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum)
2063  // Type Source Info
2064  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2065  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2066  DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2067 
2068  // Abbreviation for DECL_CXX_METHOD
2069  Abv = std::make_shared<BitCodeAbbrev>();
2070  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CXX_METHOD));
2071  // RedeclarableDecl
2072  Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2073  // Decl
2074  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2075  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2076  Abv->Add(BitCodeAbbrevOp(0)); // Invalid
2077  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2078  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Implicit
2079  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Used
2080  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Referenced
2081  Abv->Add(BitCodeAbbrevOp(0)); // InObjCContainer
2082  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Access
2083  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ModulePrivate
2084  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2085  // NamedDecl
2086  Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2087  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2088  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2089  // ValueDecl
2090  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2091  // DeclaratorDecl
2092  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2093  Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2094  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2095  // FunctionDecl
2096  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2097  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // StorageClass
2098  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Inline
2099  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // InlineSpecified
2100  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitSpecified
2101  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // VirtualAsWritten
2102  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Pure
2103  Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedProto
2104  Abv->Add(BitCodeAbbrevOp(1)); // HasWrittenProto
2105  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Deleted
2106  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Trivial
2107  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // TrivialForCall
2108  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Defaulted
2109  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted
2110  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero
2111  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constexpr
2112  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // UsesSEHTry
2113  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody
2114  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // MultiVersion
2115  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // LateParsed
2116  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2117  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2118  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2119  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // TemplateKind
2120  // This Array slurps the rest of the record. Fortunately we want to encode
2121  // (nearly) all the remaining (variable number of) fields in the same way.
2122  //
2123  // This is the function template information if any, then
2124  // NumParams and Params[] from FunctionDecl, and
2125  // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2126  //
2127  // Add an AbbrevOp for 'size then elements' and use it here.
2128  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2129  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2130  DeclCXXMethodAbbrev = Stream.EmitAbbrev(std::move(Abv));
2131 
2132  // Abbreviation for EXPR_DECL_REF
2133  Abv = std::make_shared<BitCodeAbbrev>();
2134  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2135  //Stmt
2136  //Expr
2137  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2138  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2139  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2140  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2141  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2142  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2143  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2144  //DeclRefExpr
2145  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HasQualifier
2146  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //GetDeclFound
2147  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ExplicitTemplateArgs
2148  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HadMultipleCandidates
2149  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2150  1)); // RefersToEnclosingVariableOrCapture
2151  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2152  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2153  DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2154 
2155  // Abbreviation for EXPR_INTEGER_LITERAL
2156  Abv = std::make_shared<BitCodeAbbrev>();
2157  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2158  //Stmt
2159  //Expr
2160  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2161  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2162  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2163  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2164  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2165  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2166  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2167  //Integer Literal
2168  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2169  Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2170  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2171  IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2172 
2173  // Abbreviation for EXPR_CHARACTER_LITERAL
2174  Abv = std::make_shared<BitCodeAbbrev>();
2175  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2176  //Stmt
2177  //Expr
2178  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2179  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2180  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2181  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2182  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2183  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2184  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2185  //Character Literal
2186  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2187  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2188  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2189  CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2190 
2191  // Abbreviation for EXPR_IMPLICIT_CAST
2192  Abv = std::make_shared<BitCodeAbbrev>();
2193  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2194  // Stmt
2195  // Expr
2196  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2197  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2198  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2199  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2200  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2201  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2202  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2203  // CastExpr
2204  Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2205  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 6)); // CastKind
2206  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // PartOfExplicitCast
2207  // ImplicitCastExpr
2208  ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2209 
2210  Abv = std::make_shared<BitCodeAbbrev>();
2211  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2212  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2213  DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2214 
2215  Abv = std::make_shared<BitCodeAbbrev>();
2216  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2217  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2218  DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2219 }
2220 
2221 /// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2222 /// consumers of the AST.
2223 ///
2224 /// Such decls will always be deserialized from the AST file, so we would like
2225 /// this to be as restrictive as possible. Currently the predicate is driven by
2226 /// code generation requirements, if other clients have a different notion of
2227 /// what is "required" then we may have to consider an alternate scheme where
2228 /// clients can iterate over the top-level decls and get information on them,
2229 /// without necessary deserializing them. We could explicitly require such
2230 /// clients to use a separate API call to "realize" the decl. This should be
2231 /// relatively painless since they would presumably only do it for top-level
2232 /// decls.
2233 static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2234  bool WritingModule) {
2235  // An ObjCMethodDecl is never considered as "required" because its
2236  // implementation container always is.
2237 
2238  // File scoped assembly or obj-c or OMP declare target implementation must be
2239  // seen.
2240  if (isa<FileScopeAsmDecl>(D) || isa<ObjCImplDecl>(D) ||
2241  D->hasAttr<OMPDeclareTargetDeclAttr>())
2242  return true;
2243 
2244  if (WritingModule && (isa<VarDecl>(D) || isa<ImportDecl>(D))) {
2245  // These declarations are part of the module initializer, and are emitted
2246  // if and when the module is imported, rather than being emitted eagerly.
2247  return false;
2248  }
2249 
2250  return Context.DeclMustBeEmitted(D);
2251 }
2252 
2253 void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2254  PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
2255  "serializing");
2256 
2257  // Determine the ID for this declaration.
2259  assert(!D->isFromASTFile() && "should not be emitting imported decl");
2260  serialization::DeclID &IDR = DeclIDs[D];
2261  if (IDR == 0)
2262  IDR = NextDeclID++;
2263 
2264  ID = IDR;
2265 
2266  assert(ID >= FirstDeclID && "invalid decl ID");
2267 
2268  RecordData Record;
2269  ASTDeclWriter W(*this, Context, Record);
2270 
2271  // Build a record for this declaration
2272  W.Visit(D);
2273 
2274  // Emit this declaration to the bitstream.
2275  uint64_t Offset = W.Emit(D);
2276 
2277  // Record the offset for this declaration
2278  SourceLocation Loc = D->getLocation();
2279  unsigned Index = ID - FirstDeclID;
2280  if (DeclOffsets.size() == Index)
2281  DeclOffsets.push_back(DeclOffset(Loc, Offset));
2282  else if (DeclOffsets.size() < Index) {
2283  // FIXME: Can/should this happen?
2284  DeclOffsets.resize(Index+1);
2285  DeclOffsets[Index].setLocation(Loc);
2286  DeclOffsets[Index].BitOffset = Offset;
2287  } else {
2288  llvm_unreachable("declarations should be emitted in ID order");
2289  }
2290 
2291  SourceManager &SM = Context.getSourceManager();
2292  if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2293  associateDeclWithFile(D, ID);
2294 
2295  // Note declarations that should be deserialized eagerly so that we can add
2296  // them to a record in the AST file later.
2297  if (isRequiredDecl(D, Context, WritingModule))
2298  EagerlyDeserializedDecls.push_back(ID);
2299 }
2300 
2302  // Switch case IDs are per function body.
2303  Writer->ClearSwitchCaseIDs();
2304 
2305  assert(FD->doesThisDeclarationHaveABody());
2306  bool ModulesCodegen = false;
2307  if (Writer->WritingModule && !FD->isDependentContext()) {
2309  if (Writer->WritingModule->Kind == Module::ModuleInterfaceUnit) {
2310  // When building a C++ Modules TS module interface unit, a strong
2311  // definition in the module interface is provided by the compilation of
2312  // that module interface unit, not by its users. (Inline functions are
2313  // still emitted in module users.)
2314  Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2315  ModulesCodegen = *Linkage == GVA_StrongExternal;
2316  }
2317  if (Writer->Context->getLangOpts().ModulesCodegen) {
2318  // Under -fmodules-codegen, codegen is performed for all non-internal,
2319  // non-always_inline functions.
2320  if (!FD->hasAttr<AlwaysInlineAttr>()) {
2321  if (!Linkage)
2322  Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2323  ModulesCodegen = *Linkage != GVA_Internal;
2324  }
2325  }
2326  }
2327  Record->push_back(ModulesCodegen);
2328  if (ModulesCodegen)
2329  Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(FD));
2330  if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2331  Record->push_back(CD->getNumCtorInitializers());
2332  if (CD->getNumCtorInitializers())
2333  AddCXXCtorInitializers(
2334  llvm::makeArrayRef(CD->init_begin(), CD->init_end()));
2335  }
2336  AddStmt(FD->getBody());
2337 }
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Definition: Decl.cpp:2426
SourceLocation getGetterNameLoc() const
Definition: DeclObjC.h:904
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1454
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1481
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition: Decl.h:2722
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
Definition: DeclTemplate.h:722
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1916
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3204
Represents a function declaration or definition.
Definition: Decl.h:1722
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:550
void VisitAccessSpecDecl(AccessSpecDecl *D)
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
Definition: DeclTemplate.h:719
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Definition: Decl.h:1294
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:581
protocol_range protocols() const
Definition: DeclObjC.h:1363
void VisitStaticAssertDecl(StaticAssertDecl *D)
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:765
void VisitCXXMethodDecl(CXXMethodDecl *D)
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
Definition: ASTCommon.cpp:313
A (possibly-)qualified type.
Definition: Type.h:640
Static storage duration.
Definition: Specifiers.h:280
const char * getDeclKindName() const
Definition: DeclBase.cpp:123
unsigned param_size() const
Definition: DeclObjC.h:349
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2322
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3633
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:1527
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2828
bool isObjCMethodParameter() const
Definition: Decl.h:1584
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:3124
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1517
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
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:2643
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2761
void VisitCXXRecordDecl(CXXRecordDecl *D)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1025
Represents the declaration of a typedef-name via the &#39;typedef&#39; type specifier.
Definition: Decl.h:2997
Defines the SourceManager interface.
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
Definition: Decl.h:2078
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1535
bool hasVolatileMember() const
Definition: Decl.h:3656
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:2304
const Type * getTypeForDecl() const
Definition: Decl.h:2873
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:86
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition: Decl.h:3952
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1671
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclBase.h:413
bool isNothrow() const
Definition: Decl.cpp:4431
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:3936
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1472
ThreadStorageClassSpecifier getTSCSpec() const
Definition: Decl.h:1034
Defines the C++ template declaration subclasses.
StringRef P
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:453
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition: Decl.h:2056
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:966
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
Expr * getSetterCXXAssignment() const
Definition: DeclObjC.h:2858
void VisitTranslationUnitDecl(TranslationUnitDecl *D)
A record that stores the set of declarations that are lexically stored within a given DeclContext...
Definition: ASTBitCodes.h:1379
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
Definition: DeclCXX.h:154
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
Definition: Decl.h:1340
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:4234
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context, ASTWriter::RecordDataImpl &Record)
Expr * getOperatorDeleteThisArg() const
Definition: DeclCXX.h:2741
bool usesSEHTry() const
Indicates the function uses __try.
Definition: Decl.h:2098
Declaration of a variable template.
void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D)
Represent a C++ namespace.
Definition: Decl.h:514
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1336
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction...
Definition: DeclObjC.h:2656
bool hasRedeclaration() const
True if redeclared in the same interface.
Definition: DeclObjC.h:272
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:421
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.
unsigned getIdentifierNamespace() const
Definition: DeclBase.h:805
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2483
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:1984
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:2689
size_t param_size() const
Definition: Decl.h:2252
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
Definition: DeclObjC.h:450
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.
Definition: ASTWriter.h:807
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:3115
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3148
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:139
A ClassTemplateDecl record.
Definition: ASTBitCodes.h:1457
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1532
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1418
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:54
unsigned getODRHash()
Definition: Decl.cpp:4036
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:737
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1526
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:3508
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1406
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:553
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
bool hasInheritedDefaultArg() const
Definition: Decl.h:1667
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:139
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:1507
void VisitIndirectFieldDecl(IndirectFieldDecl *D)
bool isInvalidDecl() const
Definition: DeclBase.h:555
void VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
unsigned getContextParamPosition() const
Definition: Decl.h:4089
protocol_range protocols() const
Definition: DeclObjC.h:2126
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1484
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:630
Represents a parameter to a function.
Definition: Decl.h:1541
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Definition: Linkage.h:24
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1312
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:672
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2686
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition: Decl.h:1362
void VisitCXXDestructorDecl(CXXDestructorDecl *D)
A CXXConstructorDecl record for an inherited constructor.
Definition: ASTBitCodes.h:1439
Represents a struct/union/class.
Definition: Decl.h:3572
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2859
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.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:297
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:85
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
Definition: Decl.h:3475
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:124
bool doesNotEscape() const
Definition: Decl.h:3980
StringLiteral * getMessage()
Definition: DeclCXX.h:3775
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2693
Expr * getGetterCXXConstructor() const
Definition: DeclObjC.h:2850
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:744
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:153
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:575
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:3096
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:621
bool hasSkippedBody() const
True if the function was a definition but its body was skipped.
Definition: Decl.h:2199
Represents a member of a struct/union/class.
Definition: Decl.h:2554
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
const llvm::APSInt & getInitVal() const
Definition: Decl.h:2782
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition: Decl.h:1594
StringRef getValue() const
Definition: Decl.h:197
bool isDefined() const
Definition: DeclObjC.h:440
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:154
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:922
NamedDecl * getFriendDecl() const
If this friend declaration doesn&#39;t name a type, return the inner declaration.
Definition: DeclFriend.h:139
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2678
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:3908
void VisitParmVarDecl(ParmVarDecl *D)
Represents an access specifier followed by colon &#39;:&#39;.
Definition: DeclCXX.h:132
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:1408
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:3912
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1499
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2236
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:508
Represents a C++ using-declaration.
Definition: DeclCXX.h:3355
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:540
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2695
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:3878
void VisitLabelDecl(LabelDecl *LD)
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:151
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:2651
void append(InputIterator begin, InputIterator end)
Definition: ASTWriter.h:796
void VisitClassTemplateDecl(ClassTemplateDecl *D)
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:2694
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:966
TagKind getTagKind() const
Definition: Decl.h:3222
bool isReferenced() const
Whether any declaration of this entity was referenced.
Definition: DeclBase.cpp:422
void VisitTypedefDecl(TypedefDecl *D)
An AccessSpecDecl record.
Definition: ASTBitCodes.h:1448
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:1615
uint32_t Offset
Definition: CacheTokens.cpp:43
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:4491
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
void VisitUsingShadowDecl(UsingShadowDecl *D)
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1409
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:3316
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:879
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:2822
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1412
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:837
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:2880
A DecompositionDecl record.
Definition: ASTBitCodes.h:1357
Represents a declaration of a type.
Definition: Decl.h:2849
SourceLocation RAngleLoc
The source location of the right angle bracket (&#39;>&#39;).
Definition: TemplateBase.h:615
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum...
Definition: Decl.h:3485
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
Definition: Decl.h:3553
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:926
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1389
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3431
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:1781
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
void VisitBindingDecl(BindingDecl *D)
TemplateParameterList * getTemplateParameterList(unsigned i) const
const Expr * getInitExpr() const
Definition: Decl.h:2780
SourceLocation getPropertyIvarDeclLoc() const
Definition: DeclObjC.h:2831
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
Definition: DeclFriend.h:132
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1460
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:3157
SourceLocation getExternLoc() const
Definition: DeclCXX.h:2873
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2061
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
Definition: DeclBase.h:834
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
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:4641
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:930
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4015
Represents an ObjC class declaration.
Definition: DeclObjC.h:1169
Represents a linkage specification.
Definition: DeclCXX.h:2825
QualType getReturnType() const
Definition: DeclObjC.h:331
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
A binding in a decomposition declaration.
Definition: DeclCXX.h:3798
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:3301
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:883
SourceLocation getAtStartLoc() const
Definition: DeclObjC.h:1112
ArgPassingKind getArgPassingRestrictions() const
Definition: Decl.h:3702
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition: Decl.h:3645
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4164
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:3780
void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D)
StorageDuration getStorageDuration() const
Get the storage duration of this variable, per C++ [basic.stc].
Definition: Decl.h:1086
StringRef getArg() const
Definition: Decl.h:164
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:2756
NodeId Parent
Definition: ASTDiff.cpp:192
void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
bool hasAttr() const
Definition: DeclBase.h:544
void VisitObjCContainerDecl(ObjCContainerDecl *D)
RecordDecl * getMostRecentDecl()
Definition: Decl.h:3619
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3017
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:1392
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1627
SourceLocation getTypenameLoc() const
Returns the source location of the &#39;typename&#39; keyword.
Definition: DeclCXX.h:3702
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:692
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
Definition: Decl.h:3451
A CXXDeductionGuideDecl record.
Definition: ASTBitCodes.h:1430
uint64_t Emit(Decl *D)
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:972
bool isInlineSpecified() const
Definition: Decl.h:1374
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:144
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1490
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:2945
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1469
static bool classofKind(Kind K)
Definition: DeclObjC.h:1996
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1523
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:432
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:889
void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2317
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3243
unsigned getFunctionScopeDepth() const
Definition: Decl.h:1588
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3837
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition: Decl.h:2209
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:640
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3395
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1327
unsigned getChainingSize() const
Definition: Decl.h:2828
Selector getSetterName() const
Definition: DeclObjC.h:911
bool isDefaulted() const
Whether this function is defaulted per C++0x.
Definition: Decl.h:2018
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3502
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1339
TypeSourceInfo * getSuperClassTInfo() const
Definition: DeclObjC.h:1570
void VisitRecordDecl(RecordDecl *D)
Declaration of a template type parameter.
void VisitFileScopeAsmDecl(FileScopeAsmDecl *D)
TypeSourceInfo * getTypeSourceInfo() const
Definition: DeclObjC.h:824
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:618
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name...
Definition: DeclOpenMP.cpp:84
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:4060
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2705
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver&#39;s type...
Definition: DeclObjC.h:257
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:2218
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1436
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Definition: Decl.h:570
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Definition: Decl.h:1312
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:560
bool isCopyDeductionCandidate() const
Definition: DeclCXX.h:2038
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition: DeclBase.h:981
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:2143
DeclContext * getDeclContext()
Definition: DeclBase.h:434
void VisitUsingDecl(UsingDecl *D)
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1466
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2306
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3399
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:3489
bool isExplicitSpecified() const
Whether this function is marked as explicit explicitly.
Definition: Decl.h:2334
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1442
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:1503
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:3938
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:1397
Declaration of an alias template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1769
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i&#39;th template candidate.
Definition: DeclTemplate.h:708
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
Definition: ASTWriter.h:904
void AddObjCTypeParamList(ObjCTypeParamList *typeParams)
Add an Objective-C type parameter list to the given record.
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
bool isInstanceMethod() const
Definition: DeclObjC.h:422
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:1582
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:1050
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1351
StringRef getName() const
Definition: Decl.h:196
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:1998
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2767
void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2010
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclObjC.h:2816
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1303
ImplicitParamDecl * getSelfDecl() const
Definition: DeclObjC.h:414
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1284
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
QualType getType() const
Definition: DeclObjC.h:826
const SourceManager & SM
Definition: Format.cpp:1475
void VisitTagDecl(TagDecl *D)
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1514
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1324
bool hasSkippedBody() const
True if the method was a definition but its body was skipped.
Definition: DeclObjC.h:465
void VisitObjCCategoryDecl(ObjCCategoryDecl *D)
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:2139
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:758
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:216
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2618
void VisitMSPropertyDecl(MSPropertyDecl *D)
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1333
void VisitVarTemplateDecl(VarTemplateDecl *D)
AttrVec & getAttrs()
Definition: DeclBase.h:486
bool isNonTrivialToPrimitiveDestroy() const
Definition: Decl.h:3687
bool hasAttrs() const
Definition: DeclBase.h:480
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:2367
TypeSourceInfo * getReturnTypeSourceInfo() const
Definition: DeclObjC.h:345
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.
Definition: ASTWriter.h:794
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:2067
unsigned protocol_size() const
Definition: DeclObjC.h:2165
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:2990
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:2137
Represents a C++ Modules TS module export declaration.
Definition: Decl.h:4185
SourceLocation getUsingLoc() const
Returns the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3606
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition: Decl.h:3671
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:627
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1415
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:204
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition: DeclCXX.h:3537
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:543
Encodes a location in the source.
bool getSynthesize() const
Definition: DeclObjC.h:1988
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:1993
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:1388
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:186
SourceLocation getSuperClassLoc() const
Definition: DeclObjC.h:2688
void VisitObjCImplDecl(ObjCImplDecl *D)
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:2994
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition: Decl.h:2727
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:3043
SourceLocation getUsingLoc() const
Return the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3388
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2524
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:3034
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:83
Represents the declaration of a label.
Definition: Decl.h:468
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3574
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3616
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
Definition: Decl.h:2696
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:844
SourceLocation getRParenLoc() const
Definition: Decl.h:3820
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2051
void VisitVarTemplatePartialSpecializationDecl(VarTemplatePartialSpecializationDecl *D)
void VisitUsingPackDecl(UsingPackDecl *D)
C-style initialization with assignment.
Definition: Decl.h:825
bool isConversionFromLambda() const
Definition: Decl.h:3972
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1478
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Definition: Redeclarable.h:223
Data that is common to all of the declarations of a given function template.
Definition: DeclTemplate.h:974
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:2964
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2277
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:3499
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
Definition: DeclTemplate.h:705
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:2627
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:726
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:708
bool isModed() const
Definition: Decl.h:2941
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:70
unsigned getODRHash()
Returns ODRHash of the function.
Definition: Decl.cpp:3703
bool hasUninstantiatedDefaultArg() const
Definition: Decl.h:1655
void AddSourceLocation(SourceLocation Loc)
Emit a source location.
Definition: ASTWriter.h:846
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
Definition: DeclBase.cpp:397
void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D)
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2574
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:247
A NamespaceDecl record.
Definition: ASTBitCodes.h:1394
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
Definition: Decl.h:2023
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3749
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition: Decl.h:2036
void VisitPragmaCommentDecl(PragmaCommentDecl *D)
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:2874
bool hasFlexibleArrayMember() const
Definition: Decl.h:3626
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:2013
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:2414
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Definition: Decl.cpp:1062
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4120
protocol_range protocols() const
Definition: DeclObjC.h:2353
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1315
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: Decl.h:1598
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2895
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1445
void VisitFieldDecl(FieldDecl *D)
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2437
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2529
Dataflow Directional Tag Classes.
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:2452
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition: Decl.h:1997
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1272
ArrayRef< Capture > captures() const
Definition: Decl.h:3956
PropertyAttributeKind getPropertyAttributesAsWritten() const
Definition: DeclObjC.h:849
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:399
bool isVariadic() const
Definition: Decl.h:3904
void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
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:595
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
Definition: Decl.cpp:2297
SourceLocation getAtLoc() const
Definition: DeclObjC.h:818
void VisitNamedDecl(NamedDecl *D)
Represents a field injected from an anonymous union/struct into the parent scope. ...
Definition: Decl.h:2800
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1463
QualType getUnderlyingType() const
Definition: Decl.h:2950
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3087
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:2986
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1289
const Expr * getInit() const
Definition: Decl.h:1225
AccessSpecifier getAccess() const
Definition: DeclBase.h:469
A decomposition declaration.
Definition: DeclCXX.h:3846
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:3172
void VisitTypeDecl(TypeDecl *D)
unsigned getNumTemplateParameters() const
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3670
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
Definition: ASTBitCodes.h:1511
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:556
Kind getKind() const
Definition: DeclBase.h:428
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3706
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1421
bool isNonTrivialToPrimitiveCopy() const
Definition: Decl.h:3679
decltype(T::PartialSpecializations) & getPartialSpecializations(T *Common)
Get the list of partial specializations from a template&#39;s common ptr.
Represents an enum.
Definition: Decl.h:3305
SourceLocation LAngleLoc
The source location of the left angle bracket (&#39;<&#39;).
Definition: TemplateBase.h:612
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition: Decl.h:1398
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:1087
SourceLocation getSetterNameLoc() const
Definition: DeclObjC.h:912
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2744
void VisitEnumDecl(EnumDecl *D)
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
Definition: ASTBitCodes.h:69
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2737
Copy initialization expr of a __block variable and a boolean flag that indicates whether the expressi...
Definition: ASTContext.h:157
A PragmaCommentDecl record.
Definition: ASTBitCodes.h:1529
void VisitNamespaceDecl(NamespaceDecl *D)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2549
void VisitVarDecl(VarDecl *D)
Expr * getUninstantiatedDefaultArg()
Definition: Decl.cpp:2581
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2147
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C...
Definition: Decl.h:1350
size_t param_size() const
Definition: Decl.h:3931
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:719
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:1694
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4062
bool isParamDestroyedInCallee() const
Definition: Decl.h:3710
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void VisitFunctionDecl(FunctionDecl *D)
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
bool hasTypename() const
Return true if the using declaration has &#39;typename&#39;.
Definition: DeclCXX.h:3410
SourceManager & getSourceManager()
Definition: ASTContext.h:670
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition: Decl.h:2331
bool capturesCXXThis() const
Definition: Decl.h:3961
ImplementationControl getImplementationControl() const
Definition: DeclObjC.h:482
static bool classofKind(Kind K)
Definition: DeclCXX.h:1983
void VisitDecl(Decl *D)
SourceRange getAtEndRange() const
Definition: DeclObjC.h:1119
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1596
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:2029
Represents a field declaration created by an @defs(...).
Definition: DeclObjC.h:2009
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2410
void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:3253
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:2629
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3143
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:4204
Represents a C++ struct/union/class.
Definition: DeclCXX.h:308
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1330
An object for streaming information to a record.
Definition: ASTWriter.h:746
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:3496
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1942
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:942
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
Definition: ASTCommon.cpp:404
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:608
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1330
void VisitEnumConstantDecl(EnumConstantDecl *D)
SourceLocation getFriendLoc() const
Retrieves the location of the &#39;friend&#39; keyword.
bool isFailed() const
Definition: DeclCXX.h:3778
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1321
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:634
ImplicitParamDecl * getCmdDecl() const
Definition: DeclObjC.h:416
void VisitClassScopeFunctionSpecializationDecl(ClassScopeFunctionSpecializationDecl *D)
bool isVariadic() const
Definition: DeclObjC.h:427
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:103
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
Definition: ASTBitCodes.h:1281
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1294
unsigned protocol_size() const
Definition: DeclObjC.h:2362
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3459
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:1973
An ExportDecl record.
Definition: ASTBitCodes.h:1424
bool blockMissingReturnType() const
Definition: Decl.h:3964
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3723
unsigned varlist_size() const
Definition: DeclOpenMP.h:74
size_t size() const
Definition: ASTWriter.h:800
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Definition: Redeclarable.h:226
void VisitFriendDecl(FriendDecl *D)
The top declaration context.
Definition: Decl.h:107
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:3915
NamedDecl * getMostRecentDecl()
Definition: Decl.h:445
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2819
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
bool hasObjectMember() const
Definition: Decl.h:3653
void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D)
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:3820
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1130
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3278
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1475
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:7246
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1487
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:1140
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
Definition: Decl.h:597
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3915
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3112
QualType getType() const
Definition: Decl.h:651
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
Definition: DeclBase.h:609
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:919
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
Definition: DeclObjC.h:267
This represents a decl that may have a name.
Definition: Decl.h:248
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:3023
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:1371
AccessControl getAccessControl() const
Definition: DeclObjC.h:1981
Declaration of a friend template.
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2416
bool isPropertyAccessor() const
Definition: DeclObjC.h:432
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:3541
Selector getGetterName() const
Definition: DeclObjC.h:903
Represents C++ using-directive.
Definition: DeclCXX.h:2919
SourceLocation getLParenLoc() const
Definition: DeclObjC.h:821
SourceLocation getEndOfDefinitionLoc() const
Definition: DeclObjC.h:1875
Represents a #pragma detect_mismatch line.
Definition: Decl.h:173
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:648
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.
void VisitObjCMethodDecl(ObjCMethodDecl *D)
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition: Decl.h:3183
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:733
unsigned size() const
Determine the number of type parameters in this list.
Definition: DeclObjC.h:674
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:2496
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:968
Source range/offset of a preprocessed entity.
Definition: ASTBitCodes.h:221
SourceLocation getLocation() const
Definition: DeclBase.h:425
const StringLiteral * getAsmString() const
Definition: Decl.h:3826
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3142
Represents a pack of using declarations that a single using-declarator pack-expanded into...
Definition: DeclCXX.h:3505
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:97
SourceLocation getRBraceLoc() const
Definition: Decl.h:622
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:375
void VisitObjCIvarDecl(ObjCIvarDecl *D)
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:162
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2726
This is a C++ Modules TS module interface unit.
Definition: Module.h:79
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
Definition: DeclCXX.h:2667