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