clang  9.0.0svn
ASTWriterDecl.cpp
Go to the documentation of this file.
1 //===--- ASTWriterDecl.cpp - Declaration Serialization --------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements serialization for Declarations.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "ASTCommon.h"
14 #include "clang/AST/DeclCXX.h"
16 #include "clang/AST/DeclTemplate.h"
17 #include "clang/AST/DeclVisitor.h"
18 #include "clang/AST/Expr.h"
19 #include "clang/AST/OpenMPClause.h"
24 #include "llvm/Bitstream/BitstreamWriter.h"
25 #include "llvm/Support/ErrorHandling.h"
26 using namespace clang;
27 using namespace serialization;
28 
29 //===----------------------------------------------------------------------===//
30 // Declaration serialization
31 //===----------------------------------------------------------------------===//
32 
33 namespace clang {
34  class ASTDeclWriter : public DeclVisitor<ASTDeclWriter, void> {
35  ASTWriter &Writer;
36  ASTContext &Context;
37  ASTRecordWriter Record;
38 
40  unsigned AbbrevToUse;
41 
42  public:
43  ASTDeclWriter(ASTWriter &Writer, ASTContext &Context,
45  : Writer(Writer), Context(Context), Record(Writer, Record),
46  Code((serialization::DeclCode)0), AbbrevToUse(0) {}
47 
48  uint64_t Emit(Decl *D) {
49  if (!Code)
50  llvm::report_fatal_error(StringRef("unexpected declaration kind '") +
51  D->getDeclKindName() + "'");
52  return Record.Emit(Code, AbbrevToUse);
53  }
54 
55  void Visit(Decl *D);
56 
57  void VisitDecl(Decl *D);
58  void VisitPragmaCommentDecl(PragmaCommentDecl *D);
59  void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D);
60  void VisitTranslationUnitDecl(TranslationUnitDecl *D);
61  void VisitNamedDecl(NamedDecl *D);
62  void VisitLabelDecl(LabelDecl *LD);
63  void VisitNamespaceDecl(NamespaceDecl *D);
64  void VisitUsingDirectiveDecl(UsingDirectiveDecl *D);
65  void VisitNamespaceAliasDecl(NamespaceAliasDecl *D);
66  void VisitTypeDecl(TypeDecl *D);
67  void VisitTypedefNameDecl(TypedefNameDecl *D);
68  void VisitTypedefDecl(TypedefDecl *D);
69  void VisitTypeAliasDecl(TypeAliasDecl *D);
70  void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D);
71  void VisitTagDecl(TagDecl *D);
72  void VisitEnumDecl(EnumDecl *D);
73  void VisitRecordDecl(RecordDecl *D);
74  void VisitCXXRecordDecl(CXXRecordDecl *D);
75  void VisitClassTemplateSpecializationDecl(
77  void VisitClassTemplatePartialSpecializationDecl(
79  void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D);
80  void VisitVarTemplatePartialSpecializationDecl(
82  void VisitClassScopeFunctionSpecializationDecl(
84  void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D);
85  void VisitValueDecl(ValueDecl *D);
86  void VisitEnumConstantDecl(EnumConstantDecl *D);
87  void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D);
88  void VisitDeclaratorDecl(DeclaratorDecl *D);
89  void VisitFunctionDecl(FunctionDecl *D);
90  void VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D);
91  void VisitCXXMethodDecl(CXXMethodDecl *D);
92  void VisitCXXConstructorDecl(CXXConstructorDecl *D);
93  void VisitCXXDestructorDecl(CXXDestructorDecl *D);
94  void VisitCXXConversionDecl(CXXConversionDecl *D);
95  void VisitFieldDecl(FieldDecl *D);
96  void VisitMSPropertyDecl(MSPropertyDecl *D);
97  void VisitIndirectFieldDecl(IndirectFieldDecl *D);
98  void VisitVarDecl(VarDecl *D);
99  void VisitImplicitParamDecl(ImplicitParamDecl *D);
100  void VisitParmVarDecl(ParmVarDecl *D);
101  void VisitDecompositionDecl(DecompositionDecl *D);
102  void VisitBindingDecl(BindingDecl *D);
103  void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D);
104  void VisitTemplateDecl(TemplateDecl *D);
105  void VisitConceptDecl(ConceptDecl *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 VisitOMPAllocateDecl(OMPAllocateDecl *D);
149  void VisitOMPRequiresDecl(OMPRequiresDecl *D);
150  void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
151  void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D);
152  void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D);
153 
154  /// Add an Objective-C type parameter list to the given record.
156  // Empty type parameter list.
157  if (!typeParams) {
158  Record.push_back(0);
159  return;
160  }
161 
162  Record.push_back(typeParams->size());
163  for (auto typeParam : *typeParams) {
164  Record.AddDeclRef(typeParam);
165  }
166  Record.AddSourceLocation(typeParams->getLAngleLoc());
167  Record.AddSourceLocation(typeParams->getRAngleLoc());
168  }
169 
170  /// Add to the record the first declaration from each module file that
171  /// provides a declaration of D. The intent is to provide a sufficient
172  /// set such that reloading this set will load all current redeclarations.
173  void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
174  llvm::MapVector<ModuleFile*, const Decl*> Firsts;
175  // FIXME: We can skip entries that we know are implied by others.
176  for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) {
177  if (R->isFromASTFile())
178  Firsts[Writer.Chain->getOwningModuleFile(R)] = R;
179  else if (IncludeLocal)
180  Firsts[nullptr] = R;
181  }
182  for (const auto &F : Firsts)
183  Record.AddDeclRef(F.second);
184  }
185 
186  /// Get the specialization decl from an entry in the specialization list.
187  template <typename EntryType>
189  getSpecializationDecl(EntryType &T) {
191  }
192 
193  /// Get the list of partial specializations from a template's common ptr.
194  template<typename T>
195  decltype(T::PartialSpecializations) &getPartialSpecializations(T *Common) {
196  return Common->PartialSpecializations;
197  }
199  return None;
200  }
201 
202  template<typename DeclTy>
203  void AddTemplateSpecializations(DeclTy *D) {
204  auto *Common = D->getCommonPtr();
205 
206  // If we have any lazy specializations, and the external AST source is
207  // our chained AST reader, we can just write out the DeclIDs. Otherwise,
208  // we need to resolve them to actual declarations.
209  if (Writer.Chain != Writer.Context->getExternalSource() &&
210  Common->LazySpecializations) {
211  D->LoadLazySpecializations();
212  assert(!Common->LazySpecializations);
213  }
214 
215  ArrayRef<DeclID> LazySpecializations;
216  if (auto *LS = Common->LazySpecializations)
217  LazySpecializations = llvm::makeArrayRef(LS + 1, LS[0]);
218 
219  // Add a slot to the record for the number of specializations.
220  unsigned I = Record.size();
221  Record.push_back(0);
222 
223  // AddFirstDeclFromEachModule might trigger deserialization, invalidating
224  // *Specializations iterators.
226  for (auto &Entry : Common->Specializations)
227  Specs.push_back(getSpecializationDecl(Entry));
228  for (auto &Entry : getPartialSpecializations(Common))
229  Specs.push_back(getSpecializationDecl(Entry));
230 
231  for (auto *D : Specs) {
232  assert(D->isCanonicalDecl() && "non-canonical decl in set");
233  AddFirstDeclFromEachModule(D, /*IncludeLocal*/true);
234  }
235  Record.append(LazySpecializations.begin(), LazySpecializations.end());
236 
237  // Update the size entry we added earlier.
238  Record[I] = Record.size() - I - 1;
239  }
240 
241  /// Ensure that this template specialization is associated with the specified
242  /// template on reload.
243  void RegisterTemplateSpecialization(const Decl *Template,
244  const Decl *Specialization) {
245  Template = Template->getCanonicalDecl();
246 
247  // If the canonical template is local, we'll write out this specialization
248  // when we emit it.
249  // FIXME: We can do the same thing if there is any local declaration of
250  // the template, to avoid emitting an update record.
251  if (!Template->isFromASTFile())
252  return;
253 
254  // We only need to associate the first local declaration of the
255  // specialization. The other declarations will get pulled in by it.
256  if (Writer.getFirstLocalDecl(Specialization) != Specialization)
257  return;
258 
259  Writer.DeclUpdates[Template].push_back(ASTWriter::DeclUpdate(
260  UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION, Specialization));
261  }
262  };
263 }
264 
267 
268  // Source locations require array (variable-length) abbreviations. The
269  // abbreviation infrastructure requires that arrays are encoded last, so
270  // we handle it here in the case of those classes derived from DeclaratorDecl
271  if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(D)) {
272  if (auto *TInfo = DD->getTypeSourceInfo())
273  Record.AddTypeLoc(TInfo->getTypeLoc());
274  }
275 
276  // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
277  // have been written. We want it last because we will not read it back when
278  // retrieving it from the AST, we'll just lazily set the offset.
279  if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
280  Record.push_back(FD->doesThisDeclarationHaveABody());
281  if (FD->doesThisDeclarationHaveABody())
282  Record.AddFunctionDefinition(FD);
283  }
284 
285  // If this declaration is also a DeclContext, write blocks for the
286  // declarations that lexically stored inside its context and those
287  // declarations that are visible from its context.
288  if (DeclContext *DC = dyn_cast<DeclContext>(D))
289  VisitDeclContext(DC);
290 }
291 
293  Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
294  if (D->getDeclContext() != D->getLexicalDeclContext())
295  Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
296  else
297  Record.push_back(0);
298  Record.push_back(D->isInvalidDecl());
299  Record.push_back(D->hasAttrs());
300  if (D->hasAttrs())
301  Record.AddAttributes(D->getAttrs());
302  Record.push_back(D->isImplicit());
303  Record.push_back(D->isUsed(false));
304  Record.push_back(D->isReferenced());
305  Record.push_back(D->isTopLevelDeclInObjCContainer());
306  Record.push_back(D->getAccess());
307  Record.push_back(D->isModulePrivate());
308  Record.push_back(Writer.getSubmoduleID(D->getOwningModule()));
309 
310  // If this declaration injected a name into a context different from its
311  // lexical context, and that context is an imported namespace, we need to
312  // update its visible declarations to include this name.
313  //
314  // This happens when we instantiate a class with a friend declaration or a
315  // function with a local extern declaration, for instance.
316  //
317  // FIXME: Can we handle this in AddedVisibleDecl instead?
318  if (D->isOutOfLine()) {
319  auto *DC = D->getDeclContext();
320  while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
321  if (!NS->isFromASTFile())
322  break;
323  Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
324  if (!NS->isInlineNamespace())
325  break;
326  DC = NS->getParent();
327  }
328  }
329 }
330 
332  StringRef Arg = D->getArg();
333  Record.push_back(Arg.size());
334  VisitDecl(D);
335  Record.AddSourceLocation(D->getBeginLoc());
336  Record.push_back(D->getCommentKind());
337  Record.AddString(Arg);
339 }
340 
343  StringRef Name = D->getName();
344  StringRef Value = D->getValue();
345  Record.push_back(Name.size() + 1 + Value.size());
346  VisitDecl(D);
347  Record.AddSourceLocation(D->getBeginLoc());
348  Record.AddString(Name);
349  Record.AddString(Value);
351 }
352 
354  llvm_unreachable("Translation units aren't directly serialized");
355 }
356 
358  VisitDecl(D);
359  Record.AddDeclarationName(D->getDeclName());
360  Record.push_back(needsAnonymousDeclarationNumber(D)
361  ? Writer.getAnonymousDeclarationNumber(D)
362  : 0);
363 }
364 
366  VisitNamedDecl(D);
367  Record.AddSourceLocation(D->getBeginLoc());
368  Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
369 }
370 
372  VisitRedeclarable(D);
373  VisitTypeDecl(D);
374  Record.AddTypeSourceInfo(D->getTypeSourceInfo());
375  Record.push_back(D->isModed());
376  if (D->isModed())
377  Record.AddTypeRef(D->getUnderlyingType());
378  Record.AddDeclRef(D->getAnonDeclWithTypedefName(false));
379 }
380 
382  VisitTypedefNameDecl(D);
383  if (D->getDeclContext() == D->getLexicalDeclContext() &&
384  !D->hasAttrs() &&
385  !D->isImplicit() &&
386  D->getFirstDecl() == D->getMostRecentDecl() &&
387  !D->isInvalidDecl() &&
389  !D->isModulePrivate() &&
392  AbbrevToUse = Writer.getDeclTypedefAbbrev();
393 
395 }
396 
398  VisitTypedefNameDecl(D);
399  Record.AddDeclRef(D->getDescribedAliasTemplate());
401 }
402 
404  VisitRedeclarable(D);
405  VisitTypeDecl(D);
406  Record.push_back(D->getIdentifierNamespace());
407  Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding
408  if (!isa<CXXRecordDecl>(D))
409  Record.push_back(D->isCompleteDefinition());
410  Record.push_back(D->isEmbeddedInDeclarator());
411  Record.push_back(D->isFreeStanding());
412  Record.push_back(D->isCompleteDefinitionRequired());
413  Record.AddSourceRange(D->getBraceRange());
414 
415  if (D->hasExtInfo()) {
416  Record.push_back(1);
417  Record.AddQualifierInfo(*D->getExtInfo());
418  } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
419  Record.push_back(2);
420  Record.AddDeclRef(TD);
421  Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
422  } else {
423  Record.push_back(0);
424  }
425 }
426 
428  VisitTagDecl(D);
429  Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
430  if (!D->getIntegerTypeSourceInfo())
431  Record.AddTypeRef(D->getIntegerType());
432  Record.AddTypeRef(D->getPromotionType());
433  Record.push_back(D->getNumPositiveBits());
434  Record.push_back(D->getNumNegativeBits());
435  Record.push_back(D->isScoped());
436  Record.push_back(D->isScopedUsingClassTag());
437  Record.push_back(D->isFixed());
438  Record.push_back(D->getODRHash());
439 
440  if (MemberSpecializationInfo *MemberInfo = D->getMemberSpecializationInfo()) {
441  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
442  Record.push_back(MemberInfo->getTemplateSpecializationKind());
443  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
444  } else {
445  Record.AddDeclRef(nullptr);
446  }
447 
448  if (D->getDeclContext() == D->getLexicalDeclContext() &&
449  !D->hasAttrs() &&
450  !D->isImplicit() &&
451  !D->isUsed(false) &&
452  !D->hasExtInfo() &&
454  D->getFirstDecl() == D->getMostRecentDecl() &&
455  !D->isInvalidDecl() &&
456  !D->isReferenced() &&
458  D->getAccess() == AS_none &&
459  !D->isModulePrivate() &&
461  !D->getIntegerTypeSourceInfo() &&
465  AbbrevToUse = Writer.getDeclEnumAbbrev();
466 
468 }
469 
471  VisitTagDecl(D);
472  Record.push_back(D->hasFlexibleArrayMember());
473  Record.push_back(D->isAnonymousStructOrUnion());
474  Record.push_back(D->hasObjectMember());
475  Record.push_back(D->hasVolatileMember());
476  Record.push_back(D->isNonTrivialToPrimitiveDefaultInitialize());
477  Record.push_back(D->isNonTrivialToPrimitiveCopy());
478  Record.push_back(D->isNonTrivialToPrimitiveDestroy());
480  Record.push_back(D->hasNonTrivialToPrimitiveDestructCUnion());
481  Record.push_back(D->hasNonTrivialToPrimitiveCopyCUnion());
482  Record.push_back(D->isParamDestroyedInCallee());
483  Record.push_back(D->getArgPassingRestrictions());
484 
485  if (D->getDeclContext() == D->getLexicalDeclContext() &&
486  !D->hasAttrs() &&
487  !D->isImplicit() &&
488  !D->isUsed(false) &&
489  !D->hasExtInfo() &&
491  D->getFirstDecl() == D->getMostRecentDecl() &&
492  !D->isInvalidDecl() &&
493  !D->isReferenced() &&
495  D->getAccess() == AS_none &&
496  !D->isModulePrivate() &&
500  AbbrevToUse = Writer.getDeclRecordAbbrev();
501 
503 }
504 
506  VisitNamedDecl(D);
507  Record.AddTypeRef(D->getType());
508 }
509 
511  VisitValueDecl(D);
512  Record.push_back(D->getInitExpr()? 1 : 0);
513  if (D->getInitExpr())
514  Record.AddStmt(D->getInitExpr());
515  Record.AddAPSInt(D->getInitVal());
516 
518 }
519 
521  VisitValueDecl(D);
522  Record.AddSourceLocation(D->getInnerLocStart());
523  Record.push_back(D->hasExtInfo());
524  if (D->hasExtInfo())
525  Record.AddQualifierInfo(*D->getExtInfo());
526  // The location information is deferred until the end of the record.
527  Record.AddTypeRef(D->getTypeSourceInfo() ? D->getTypeSourceInfo()->getType()
528  : QualType());
529 }
530 
532  VisitRedeclarable(D);
533  VisitDeclaratorDecl(D);
534  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
535  Record.push_back(D->getIdentifierNamespace());
536 
537  // FunctionDecl's body is handled last at ASTWriterDecl::Visit,
538  // after everything else is written.
539  Record.push_back(static_cast<int>(D->getStorageClass())); // FIXME: stable encoding
540  Record.push_back(D->isInlineSpecified());
541  Record.push_back(D->isInlined());
542  Record.push_back(D->isVirtualAsWritten());
543  Record.push_back(D->isPure());
544  Record.push_back(D->hasInheritedPrototype());
545  Record.push_back(D->hasWrittenPrototype());
546  Record.push_back(D->isDeletedBit());
547  Record.push_back(D->isTrivial());
548  Record.push_back(D->isTrivialForCall());
549  Record.push_back(D->isDefaulted());
550  Record.push_back(D->isExplicitlyDefaulted());
551  Record.push_back(D->hasImplicitReturnZero());
552  Record.push_back(D->getConstexprKind());
553  Record.push_back(D->usesSEHTry());
554  Record.push_back(D->hasSkippedBody());
555  Record.push_back(D->isMultiVersion());
556  Record.push_back(D->isLateTemplateParsed());
557  Record.push_back(D->getLinkageInternal());
558  Record.AddSourceLocation(D->getEndLoc());
559 
560  Record.push_back(D->getODRHash());
561 
562  Record.push_back(D->getTemplatedKind());
563  switch (D->getTemplatedKind()) {
565  break;
567  Record.AddDeclRef(D->getDescribedFunctionTemplate());
568  break;
571  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
572  Record.push_back(MemberInfo->getTemplateSpecializationKind());
573  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
574  break;
575  }
578  FTSInfo = D->getTemplateSpecializationInfo();
579 
580  RegisterTemplateSpecialization(FTSInfo->getTemplate(), D);
581 
582  Record.AddDeclRef(FTSInfo->getTemplate());
583  Record.push_back(FTSInfo->getTemplateSpecializationKind());
584 
585  // Template arguments.
586  Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
587 
588  // Template args as written.
589  Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
590  if (FTSInfo->TemplateArgumentsAsWritten) {
591  Record.push_back(FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs);
592  for (int i=0, e = FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs;
593  i!=e; ++i)
594  Record.AddTemplateArgumentLoc(
595  (*FTSInfo->TemplateArgumentsAsWritten)[i]);
596  Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->LAngleLoc);
597  Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->RAngleLoc);
598  }
599 
600  Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
601 
602  if (MemberSpecializationInfo *MemberInfo =
603  FTSInfo->getMemberSpecializationInfo()) {
604  Record.push_back(1);
605  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
606  Record.push_back(MemberInfo->getTemplateSpecializationKind());
607  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
608  } else {
609  Record.push_back(0);
610  }
611 
612  if (D->isCanonicalDecl()) {
613  // Write the template that contains the specializations set. We will
614  // add a FunctionTemplateSpecializationInfo to it when reading.
615  Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
616  }
617  break;
618  }
621  DFTSInfo = D->getDependentSpecializationInfo();
622 
623  // Templates.
624  Record.push_back(DFTSInfo->getNumTemplates());
625  for (int i=0, e = DFTSInfo->getNumTemplates(); i != e; ++i)
626  Record.AddDeclRef(DFTSInfo->getTemplate(i));
627 
628  // Templates args.
629  Record.push_back(DFTSInfo->getNumTemplateArgs());
630  for (int i=0, e = DFTSInfo->getNumTemplateArgs(); i != e; ++i)
631  Record.AddTemplateArgumentLoc(DFTSInfo->getTemplateArg(i));
632  Record.AddSourceLocation(DFTSInfo->getLAngleLoc());
633  Record.AddSourceLocation(DFTSInfo->getRAngleLoc());
634  break;
635  }
636  }
637 
638  Record.push_back(D->param_size());
639  for (auto P : D->parameters())
640  Record.AddDeclRef(P);
642 }
643 
645  ASTRecordWriter &Record) {
646  uint64_t Kind = static_cast<uint64_t>(ES.getKind());
648  Record.push_back(Kind);
649  if (ES.getExpr()) {
650  Record.AddStmt(ES.getExpr());
651  }
652 }
653 
656  VisitFunctionDecl(D);
657  Record.push_back(D->isCopyDeductionCandidate());
659 }
660 
662  VisitNamedDecl(D);
663  // FIXME: convert to LazyStmtPtr?
664  // Unlike C/C++, method bodies will never be in header files.
665  bool HasBodyStuff = D->getBody() != nullptr ||
666  D->getSelfDecl() != nullptr || D->getCmdDecl() != nullptr;
667  Record.push_back(HasBodyStuff);
668  if (HasBodyStuff) {
669  Record.AddStmt(D->getBody());
670  Record.AddDeclRef(D->getSelfDecl());
671  Record.AddDeclRef(D->getCmdDecl());
672  }
673  Record.push_back(D->isInstanceMethod());
674  Record.push_back(D->isVariadic());
675  Record.push_back(D->isPropertyAccessor());
676  Record.push_back(D->isDefined());
677  Record.push_back(D->isOverriding());
678  Record.push_back(D->hasSkippedBody());
679 
680  Record.push_back(D->isRedeclaration());
681  Record.push_back(D->hasRedeclaration());
682  if (D->hasRedeclaration()) {
683  assert(Context.getObjCMethodRedeclaration(D));
684  Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
685  }
686 
687  // FIXME: stable encoding for @required/@optional
688  Record.push_back(D->getImplementationControl());
689  // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
690  Record.push_back(D->getObjCDeclQualifier());
691  Record.push_back(D->hasRelatedResultType());
692  Record.AddTypeRef(D->getReturnType());
693  Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
694  Record.AddSourceLocation(D->getEndLoc());
695  Record.push_back(D->param_size());
696  for (const auto *P : D->parameters())
697  Record.AddDeclRef(P);
698 
699  Record.push_back(D->getSelLocsKind());
700  unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
701  SourceLocation *SelLocs = D->getStoredSelLocs();
702  Record.push_back(NumStoredSelLocs);
703  for (unsigned i = 0; i != NumStoredSelLocs; ++i)
704  Record.AddSourceLocation(SelLocs[i]);
705 
707 }
708 
710  VisitTypedefNameDecl(D);
711  Record.push_back(D->Variance);
712  Record.push_back(D->Index);
713  Record.AddSourceLocation(D->VarianceLoc);
714  Record.AddSourceLocation(D->ColonLoc);
715 
717 }
718 
720  VisitNamedDecl(D);
721  Record.AddSourceLocation(D->getAtStartLoc());
722  Record.AddSourceRange(D->getAtEndRange());
723  // Abstract class (no need to define a stable serialization::DECL code).
724 }
725 
727  VisitRedeclarable(D);
728  VisitObjCContainerDecl(D);
729  Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
730  AddObjCTypeParamList(D->TypeParamList);
731 
732  Record.push_back(D->isThisDeclarationADefinition());
733  if (D->isThisDeclarationADefinition()) {
734  // Write the DefinitionData
735  ObjCInterfaceDecl::DefinitionData &Data = D->data();
736 
737  Record.AddTypeSourceInfo(D->getSuperClassTInfo());
738  Record.AddSourceLocation(D->getEndOfDefinitionLoc());
739  Record.push_back(Data.HasDesignatedInitializers);
740 
741  // Write out the protocols that are directly referenced by the @interface.
742  Record.push_back(Data.ReferencedProtocols.size());
743  for (const auto *P : D->protocols())
744  Record.AddDeclRef(P);
745  for (const auto &PL : D->protocol_locs())
746  Record.AddSourceLocation(PL);
747 
748  // Write out the protocols that are transitively referenced.
749  Record.push_back(Data.AllReferencedProtocols.size());
751  P = Data.AllReferencedProtocols.begin(),
752  PEnd = Data.AllReferencedProtocols.end();
753  P != PEnd; ++P)
754  Record.AddDeclRef(*P);
755 
756 
757  if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
758  // Ensure that we write out the set of categories for this class.
759  Writer.ObjCClassesWithCategories.insert(D);
760 
761  // Make sure that the categories get serialized.
762  for (; Cat; Cat = Cat->getNextClassCategoryRaw())
763  (void)Writer.GetDeclRef(Cat);
764  }
765  }
766 
768 }
769 
771  VisitFieldDecl(D);
772  // FIXME: stable encoding for @public/@private/@protected/@package
773  Record.push_back(D->getAccessControl());
774  Record.push_back(D->getSynthesize());
775 
776  if (D->getDeclContext() == D->getLexicalDeclContext() &&
777  !D->hasAttrs() &&
778  !D->isImplicit() &&
779  !D->isUsed(false) &&
780  !D->isInvalidDecl() &&
781  !D->isReferenced() &&
782  !D->isModulePrivate() &&
783  !D->getBitWidth() &&
784  !D->hasExtInfo() &&
785  D->getDeclName())
786  AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
787 
789 }
790 
792  VisitRedeclarable(D);
793  VisitObjCContainerDecl(D);
794 
795  Record.push_back(D->isThisDeclarationADefinition());
796  if (D->isThisDeclarationADefinition()) {
797  Record.push_back(D->protocol_size());
798  for (const auto *I : D->protocols())
799  Record.AddDeclRef(I);
800  for (const auto &PL : D->protocol_locs())
801  Record.AddSourceLocation(PL);
802  }
803 
805 }
806 
808  VisitFieldDecl(D);
810 }
811 
813  VisitObjCContainerDecl(D);
814  Record.AddSourceLocation(D->getCategoryNameLoc());
815  Record.AddSourceLocation(D->getIvarLBraceLoc());
816  Record.AddSourceLocation(D->getIvarRBraceLoc());
817  Record.AddDeclRef(D->getClassInterface());
818  AddObjCTypeParamList(D->TypeParamList);
819  Record.push_back(D->protocol_size());
820  for (const auto *I : D->protocols())
821  Record.AddDeclRef(I);
822  for (const auto &PL : D->protocol_locs())
823  Record.AddSourceLocation(PL);
825 }
826 
828  VisitNamedDecl(D);
829  Record.AddDeclRef(D->getClassInterface());
831 }
832 
834  VisitNamedDecl(D);
835  Record.AddSourceLocation(D->getAtLoc());
836  Record.AddSourceLocation(D->getLParenLoc());
837  Record.AddTypeRef(D->getType());
838  Record.AddTypeSourceInfo(D->getTypeSourceInfo());
839  // FIXME: stable encoding
840  Record.push_back((unsigned)D->getPropertyAttributes());
841  Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
842  // FIXME: stable encoding
843  Record.push_back((unsigned)D->getPropertyImplementation());
844  Record.AddDeclarationName(D->getGetterName());
845  Record.AddSourceLocation(D->getGetterNameLoc());
846  Record.AddDeclarationName(D->getSetterName());
847  Record.AddSourceLocation(D->getSetterNameLoc());
848  Record.AddDeclRef(D->getGetterMethodDecl());
849  Record.AddDeclRef(D->getSetterMethodDecl());
850  Record.AddDeclRef(D->getPropertyIvarDecl());
852 }
853 
855  VisitObjCContainerDecl(D);
856  Record.AddDeclRef(D->getClassInterface());
857  // Abstract class (no need to define a stable serialization::DECL code).
858 }
859 
861  VisitObjCImplDecl(D);
862  Record.AddSourceLocation(D->getCategoryNameLoc());
864 }
865 
867  VisitObjCImplDecl(D);
868  Record.AddDeclRef(D->getSuperClass());
869  Record.AddSourceLocation(D->getSuperClassLoc());
870  Record.AddSourceLocation(D->getIvarLBraceLoc());
871  Record.AddSourceLocation(D->getIvarRBraceLoc());
872  Record.push_back(D->hasNonZeroConstructors());
873  Record.push_back(D->hasDestructors());
874  Record.push_back(D->NumIvarInitializers);
875  if (D->NumIvarInitializers)
876  Record.AddCXXCtorInitializers(
877  llvm::makeArrayRef(D->init_begin(), D->init_end()));
879 }
880 
882  VisitDecl(D);
883  Record.AddSourceLocation(D->getBeginLoc());
884  Record.AddDeclRef(D->getPropertyDecl());
885  Record.AddDeclRef(D->getPropertyIvarDecl());
886  Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
887  Record.AddStmt(D->getGetterCXXConstructor());
888  Record.AddStmt(D->getSetterCXXAssignment());
890 }
891 
893  VisitDeclaratorDecl(D);
894  Record.push_back(D->isMutable());
895 
896  FieldDecl::InitStorageKind ISK = D->InitStorage.getInt();
897  Record.push_back(ISK);
898  if (ISK == FieldDecl::ISK_CapturedVLAType)
899  Record.AddTypeRef(QualType(D->getCapturedVLAType(), 0));
900  else if (ISK)
901  Record.AddStmt(D->getInClassInitializer());
902 
903  Record.AddStmt(D->getBitWidth());
904 
905  if (!D->getDeclName())
906  Record.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D));
907 
908  if (D->getDeclContext() == D->getLexicalDeclContext() &&
909  !D->hasAttrs() &&
910  !D->isImplicit() &&
911  !D->isUsed(false) &&
912  !D->isInvalidDecl() &&
913  !D->isReferenced() &&
915  !D->isModulePrivate() &&
916  !D->getBitWidth() &&
917  !D->hasInClassInitializer() &&
918  !D->hasCapturedVLAType() &&
919  !D->hasExtInfo() &&
922  D->getDeclName())
923  AbbrevToUse = Writer.getDeclFieldAbbrev();
924 
926 }
927 
929  VisitDeclaratorDecl(D);
930  Record.AddIdentifierRef(D->getGetterId());
931  Record.AddIdentifierRef(D->getSetterId());
933 }
934 
936  VisitValueDecl(D);
937  Record.push_back(D->getChainingSize());
938 
939  for (const auto *P : D->chain())
940  Record.AddDeclRef(P);
942 }
943 
945  VisitRedeclarable(D);
946  VisitDeclaratorDecl(D);
947  Record.push_back(D->getStorageClass());
948  Record.push_back(D->getTSCSpec());
949  Record.push_back(D->getInitStyle());
950  Record.push_back(D->isARCPseudoStrong());
951  if (!isa<ParmVarDecl>(D)) {
952  Record.push_back(D->isThisDeclarationADemotedDefinition());
953  Record.push_back(D->isExceptionVariable());
954  Record.push_back(D->isNRVOVariable());
955  Record.push_back(D->isCXXForRangeDecl());
956  Record.push_back(D->isObjCForDecl());
957  Record.push_back(D->isInline());
958  Record.push_back(D->isInlineSpecified());
959  Record.push_back(D->isConstexpr());
960  Record.push_back(D->isInitCapture());
961  Record.push_back(D->isPreviousDeclInSameBlockScope());
962  if (const auto *IPD = dyn_cast<ImplicitParamDecl>(D))
963  Record.push_back(static_cast<unsigned>(IPD->getParameterKind()));
964  else
965  Record.push_back(0);
966  Record.push_back(D->isEscapingByref());
967  }
968  Record.push_back(D->getLinkageInternal());
969 
970  if (D->getInit()) {
971  Record.push_back(!D->isInitKnownICE() ? 1 : (D->isInitICE() ? 3 : 2));
972  Record.AddStmt(D->getInit());
973  } else {
974  Record.push_back(0);
975  }
976 
977  if (D->hasAttr<BlocksAttr>() && D->getType()->getAsCXXRecordDecl()) {
978  ASTContext::BlockVarCopyInit Init = Writer.Context->getBlockVarCopyInit(D);
979  Record.AddStmt(Init.getCopyExpr());
980  if (Init.getCopyExpr())
981  Record.push_back(Init.canThrow());
982  }
983 
984  if (D->getStorageDuration() == SD_Static) {
985  bool ModulesCodegen = false;
986  if (Writer.WritingModule &&
988  !isa<VarTemplateSpecializationDecl>(D)) {
989  // When building a C++ Modules TS module interface unit, a strong
990  // definition in the module interface is provided by the compilation of
991  // that module interface unit, not by its users. (Inline variables are
992  // still emitted in module users.)
993  ModulesCodegen =
994  (Writer.WritingModule->Kind == Module::ModuleInterfaceUnit &&
995  Writer.Context->GetGVALinkageForVariable(D) == GVA_StrongExternal);
996  }
997  Record.push_back(ModulesCodegen);
998  if (ModulesCodegen)
999  Writer.ModularCodegenDecls.push_back(Writer.GetDeclRef(D));
1000  }
1001 
1002  enum {
1003  VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
1004  };
1005  if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
1006  Record.push_back(VarTemplate);
1007  Record.AddDeclRef(TemplD);
1008  } else if (MemberSpecializationInfo *SpecInfo
1009  = D->getMemberSpecializationInfo()) {
1010  Record.push_back(StaticDataMemberSpecialization);
1011  Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
1012  Record.push_back(SpecInfo->getTemplateSpecializationKind());
1013  Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
1014  } else {
1015  Record.push_back(VarNotTemplate);
1016  }
1017 
1018  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1019  !D->hasAttrs() &&
1020  !D->isImplicit() &&
1021  !D->isUsed(false) &&
1022  !D->isInvalidDecl() &&
1023  !D->isReferenced() &&
1025  D->getAccess() == AS_none &&
1026  !D->isModulePrivate() &&
1029  !D->hasExtInfo() &&
1030  D->getFirstDecl() == D->getMostRecentDecl() &&
1031  D->getKind() == Decl::Var &&
1032  !D->isInline() &&
1033  !D->isConstexpr() &&
1034  !D->isInitCapture() &&
1036  !(D->hasAttr<BlocksAttr>() && D->getType()->getAsCXXRecordDecl()) &&
1037  !D->isEscapingByref() &&
1038  D->getStorageDuration() != SD_Static &&
1040  AbbrevToUse = Writer.getDeclVarAbbrev();
1041 
1042  Code = serialization::DECL_VAR;
1043 }
1044 
1046  VisitVarDecl(D);
1048 }
1049 
1051  VisitVarDecl(D);
1052  Record.push_back(D->isObjCMethodParameter());
1053  Record.push_back(D->getFunctionScopeDepth());
1054  Record.push_back(D->getFunctionScopeIndex());
1055  Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding
1056  Record.push_back(D->isKNRPromoted());
1057  Record.push_back(D->hasInheritedDefaultArg());
1058  Record.push_back(D->hasUninstantiatedDefaultArg());
1059  if (D->hasUninstantiatedDefaultArg())
1060  Record.AddStmt(D->getUninstantiatedDefaultArg());
1062 
1063  assert(!D->isARCPseudoStrong()); // can be true of ImplicitParamDecl
1064 
1065  // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
1066  // we dynamically check for the properties that we optimize for, but don't
1067  // know are true of all PARM_VAR_DECLs.
1068  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1069  !D->hasAttrs() &&
1070  !D->hasExtInfo() &&
1071  !D->isImplicit() &&
1072  !D->isUsed(false) &&
1073  !D->isInvalidDecl() &&
1074  !D->isReferenced() &&
1075  D->getAccess() == AS_none &&
1076  !D->isModulePrivate() &&
1077  D->getStorageClass() == 0 &&
1078  D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
1079  D->getFunctionScopeDepth() == 0 &&
1080  D->getObjCDeclQualifier() == 0 &&
1081  !D->isKNRPromoted() &&
1082  !D->hasInheritedDefaultArg() &&
1083  D->getInit() == nullptr &&
1084  !D->hasUninstantiatedDefaultArg()) // No default expr.
1085  AbbrevToUse = Writer.getDeclParmVarAbbrev();
1086 
1087  // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1088  // just us assuming it.
1089  assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1091  && "PARM_VAR_DECL can't be demoted definition.");
1092  assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1093  assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1094  assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1095  assert(!D->isStaticDataMember() &&
1096  "PARM_VAR_DECL can't be static data member");
1097 }
1098 
1100  // Record the number of bindings first to simplify deserialization.
1101  Record.push_back(D->bindings().size());
1102 
1103  VisitVarDecl(D);
1104  for (auto *B : D->bindings())
1105  Record.AddDeclRef(B);
1107 }
1108 
1110  VisitValueDecl(D);
1111  Record.AddStmt(D->getBinding());
1113 }
1114 
1116  VisitDecl(D);
1117  Record.AddStmt(D->getAsmString());
1118  Record.AddSourceLocation(D->getRParenLoc());
1120 }
1121 
1123  VisitDecl(D);
1125 }
1126 
1128  VisitDecl(D);
1129  Record.AddStmt(D->getBody());
1130  Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1131  Record.push_back(D->param_size());
1132  for (ParmVarDecl *P : D->parameters())
1133  Record.AddDeclRef(P);
1134  Record.push_back(D->isVariadic());
1135  Record.push_back(D->blockMissingReturnType());
1136  Record.push_back(D->isConversionFromLambda());
1137  Record.push_back(D->doesNotEscape());
1138  Record.push_back(D->canAvoidCopyToHeap());
1139  Record.push_back(D->capturesCXXThis());
1140  Record.push_back(D->getNumCaptures());
1141  for (const auto &capture : D->captures()) {
1142  Record.AddDeclRef(capture.getVariable());
1143 
1144  unsigned flags = 0;
1145  if (capture.isByRef()) flags |= 1;
1146  if (capture.isNested()) flags |= 2;
1147  if (capture.hasCopyExpr()) flags |= 4;
1148  Record.push_back(flags);
1149 
1150  if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1151  }
1152 
1154 }
1155 
1157  Record.push_back(CD->getNumParams());
1158  VisitDecl(CD);
1159  Record.push_back(CD->getContextParamPosition());
1160  Record.push_back(CD->isNothrow() ? 1 : 0);
1161  // Body is stored by VisitCapturedStmt.
1162  for (unsigned I = 0; I < CD->getNumParams(); ++I)
1163  Record.AddDeclRef(CD->getParam(I));
1165 }
1166 
1168  VisitDecl(D);
1169  Record.push_back(D->getLanguage());
1170  Record.AddSourceLocation(D->getExternLoc());
1171  Record.AddSourceLocation(D->getRBraceLoc());
1173 }
1174 
1176  VisitDecl(D);
1177  Record.AddSourceLocation(D->getRBraceLoc());
1179 }
1180 
1182  VisitNamedDecl(D);
1183  Record.AddSourceLocation(D->getBeginLoc());
1185 }
1186 
1187 
1189  VisitRedeclarable(D);
1190  VisitNamedDecl(D);
1191  Record.push_back(D->isInline());
1192  Record.AddSourceLocation(D->getBeginLoc());
1193  Record.AddSourceLocation(D->getRBraceLoc());
1194 
1195  if (D->isOriginalNamespace())
1196  Record.AddDeclRef(D->getAnonymousNamespace());
1198 
1199  if (Writer.hasChain() && D->isAnonymousNamespace() &&
1200  D == D->getMostRecentDecl()) {
1201  // This is a most recent reopening of the anonymous namespace. If its parent
1202  // is in a previous PCH (or is the TU), mark that parent for update, because
1203  // the original namespace always points to the latest re-opening of its
1204  // anonymous namespace.
1205  Decl *Parent = cast<Decl>(
1207  if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1208  Writer.DeclUpdates[Parent].push_back(
1209  ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
1210  }
1211  }
1212 }
1213 
1215  VisitRedeclarable(D);
1216  VisitNamedDecl(D);
1217  Record.AddSourceLocation(D->getNamespaceLoc());
1218  Record.AddSourceLocation(D->getTargetNameLoc());
1219  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1220  Record.AddDeclRef(D->getNamespace());
1222 }
1223 
1225  VisitNamedDecl(D);
1226  Record.AddSourceLocation(D->getUsingLoc());
1227  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1228  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1229  Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1230  Record.push_back(D->hasTypename());
1231  Record.AddDeclRef(Context.getInstantiatedFromUsingDecl(D));
1233 }
1234 
1236  Record.push_back(D->NumExpansions);
1237  VisitNamedDecl(D);
1238  Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
1239  for (auto *E : D->expansions())
1240  Record.AddDeclRef(E);
1242 }
1243 
1245  VisitRedeclarable(D);
1246  VisitNamedDecl(D);
1247  Record.AddDeclRef(D->getTargetDecl());
1248  Record.push_back(D->getIdentifierNamespace());
1249  Record.AddDeclRef(D->UsingOrNextShadow);
1250  Record.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D));
1252 }
1253 
1256  VisitUsingShadowDecl(D);
1257  Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1258  Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1259  Record.push_back(D->IsVirtual);
1261 }
1262 
1264  VisitNamedDecl(D);
1265  Record.AddSourceLocation(D->getUsingLoc());
1266  Record.AddSourceLocation(D->getNamespaceKeyLocation());
1267  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1268  Record.AddDeclRef(D->getNominatedNamespace());
1269  Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1271 }
1272 
1274  VisitValueDecl(D);
1275  Record.AddSourceLocation(D->getUsingLoc());
1276  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1277  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1278  Record.AddSourceLocation(D->getEllipsisLoc());
1280 }
1281 
1284  VisitTypeDecl(D);
1285  Record.AddSourceLocation(D->getTypenameLoc());
1286  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1287  Record.AddSourceLocation(D->getEllipsisLoc());
1289 }
1290 
1292  VisitRecordDecl(D);
1293 
1294  enum {
1295  CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
1296  };
1297  if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1298  Record.push_back(CXXRecTemplate);
1299  Record.AddDeclRef(TemplD);
1300  } else if (MemberSpecializationInfo *MSInfo
1301  = D->getMemberSpecializationInfo()) {
1302  Record.push_back(CXXRecMemberSpecialization);
1303  Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1304  Record.push_back(MSInfo->getTemplateSpecializationKind());
1305  Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1306  } else {
1307  Record.push_back(CXXRecNotTemplate);
1308  }
1309 
1310  Record.push_back(D->isThisDeclarationADefinition());
1312  Record.AddCXXDefinitionData(D);
1313 
1314  // Store (what we currently believe to be) the key function to avoid
1315  // deserializing every method so we can compute it.
1316  if (D->isCompleteDefinition())
1317  Record.AddDeclRef(Context.getCurrentKeyFunction(D));
1318 
1320 }
1321 
1323  VisitFunctionDecl(D);
1324  if (D->isCanonicalDecl()) {
1325  Record.push_back(D->size_overridden_methods());
1326  for (const CXXMethodDecl *MD : D->overridden_methods())
1327  Record.AddDeclRef(MD);
1328  } else {
1329  // We only need to record overridden methods once for the canonical decl.
1330  Record.push_back(0);
1331  }
1332 
1333  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1334  D->getFirstDecl() == D->getMostRecentDecl() &&
1335  !D->isInvalidDecl() &&
1336  !D->hasAttrs() &&
1339  !D->hasExtInfo() &&
1340  !D->hasInheritedPrototype() &&
1341  D->hasWrittenPrototype())
1342  AbbrevToUse = Writer.getDeclCXXMethodAbbrev();
1343 
1345 }
1346 
1348  Record.push_back(D->getTraillingAllocKind());
1350  if (auto Inherited = D->getInheritedConstructor()) {
1351  Record.AddDeclRef(Inherited.getShadowDecl());
1352  Record.AddDeclRef(Inherited.getConstructor());
1353  }
1354 
1355  VisitCXXMethodDecl(D);
1357 }
1358 
1360  VisitCXXMethodDecl(D);
1361 
1362  Record.AddDeclRef(D->getOperatorDelete());
1363  if (D->getOperatorDelete())
1364  Record.AddStmt(D->getOperatorDeleteThisArg());
1365 
1367 }
1368 
1371  VisitCXXMethodDecl(D);
1373 }
1374 
1376  VisitDecl(D);
1377  Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1378  ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1379  Record.push_back(!IdentifierLocs.empty());
1380  if (IdentifierLocs.empty()) {
1381  Record.AddSourceLocation(D->getEndLoc());
1382  Record.push_back(1);
1383  } else {
1384  for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1385  Record.AddSourceLocation(IdentifierLocs[I]);
1386  Record.push_back(IdentifierLocs.size());
1387  }
1388  // Note: the number of source locations must always be the last element in
1389  // the record.
1391 }
1392 
1394  VisitDecl(D);
1395  Record.AddSourceLocation(D->getColonLoc());
1397 }
1398 
1400  // Record the number of friend type template parameter lists here
1401  // so as to simplify memory allocation during deserialization.
1402  Record.push_back(D->NumTPLists);
1403  VisitDecl(D);
1404  bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1405  Record.push_back(hasFriendDecl);
1406  if (hasFriendDecl)
1407  Record.AddDeclRef(D->getFriendDecl());
1408  else
1409  Record.AddTypeSourceInfo(D->getFriendType());
1410  for (unsigned i = 0; i < D->NumTPLists; ++i)
1411  Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1412  Record.AddDeclRef(D->getNextFriend());
1413  Record.push_back(D->UnsupportedFriend);
1414  Record.AddSourceLocation(D->FriendLoc);
1416 }
1417 
1419  VisitDecl(D);
1420  Record.push_back(D->getNumTemplateParameters());
1421  for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1422  Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1423  Record.push_back(D->getFriendDecl() != nullptr);
1424  if (D->getFriendDecl())
1425  Record.AddDeclRef(D->getFriendDecl());
1426  else
1427  Record.AddTypeSourceInfo(D->getFriendType());
1428  Record.AddSourceLocation(D->getFriendLoc());
1430 }
1431 
1433  VisitNamedDecl(D);
1434 
1435  Record.AddDeclRef(D->getTemplatedDecl());
1436  Record.AddTemplateParameterList(D->getTemplateParameters());
1437 }
1438 
1440  VisitTemplateDecl(D);
1441  Record.AddStmt(D->getConstraintExpr());
1443 }
1444 
1446  VisitRedeclarable(D);
1447 
1448  // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1449  // getCommonPtr() can be used while this is still initializing.
1450  if (D->isFirstDecl()) {
1451  // This declaration owns the 'common' pointer, so serialize that data now.
1452  Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());
1454  Record.push_back(D->isMemberSpecialization());
1455  }
1456 
1457  VisitTemplateDecl(D);
1458  Record.push_back(D->getIdentifierNamespace());
1459 }
1460 
1462  VisitRedeclarableTemplateDecl(D);
1463 
1464  if (D->isFirstDecl())
1465  AddTemplateSpecializations(D);
1467 }
1468 
1471  RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
1472 
1473  VisitCXXRecordDecl(D);
1474 
1475  llvm::PointerUnion<ClassTemplateDecl *,
1478  if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1479  Record.AddDeclRef(InstFromD);
1480  } else {
1481  Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1482  Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1483  }
1484 
1485  Record.AddTemplateArgumentList(&D->getTemplateArgs());
1486  Record.AddSourceLocation(D->getPointOfInstantiation());
1487  Record.push_back(D->getSpecializationKind());
1488  Record.push_back(D->isCanonicalDecl());
1489 
1490  if (D->isCanonicalDecl()) {
1491  // When reading, we'll add it to the folding set of the following template.
1492  Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1493  }
1494 
1495  // Explicit info.
1496  Record.AddTypeSourceInfo(D->getTypeAsWritten());
1497  if (D->getTypeAsWritten()) {
1498  Record.AddSourceLocation(D->getExternLoc());
1499  Record.AddSourceLocation(D->getTemplateKeywordLoc());
1500  }
1501 
1503 }
1504 
1507  VisitClassTemplateSpecializationDecl(D);
1508 
1509  Record.AddTemplateParameterList(D->getTemplateParameters());
1510  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1511 
1512  // These are read/set from/to the first declaration.
1513  if (D->getPreviousDecl() == nullptr) {
1514  Record.AddDeclRef(D->getInstantiatedFromMember());
1515  Record.push_back(D->isMemberSpecialization());
1516  }
1517 
1519 }
1520 
1522  VisitRedeclarableTemplateDecl(D);
1523 
1524  if (D->isFirstDecl())
1525  AddTemplateSpecializations(D);
1527 }
1528 
1531  RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
1532 
1533  VisitVarDecl(D);
1534 
1535  llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1536  InstFrom = D->getSpecializedTemplateOrPartial();
1537  if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1538  Record.AddDeclRef(InstFromD);
1539  } else {
1540  Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1541  Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1542  }
1543 
1544  // Explicit info.
1545  Record.AddTypeSourceInfo(D->getTypeAsWritten());
1546  if (D->getTypeAsWritten()) {
1547  Record.AddSourceLocation(D->getExternLoc());
1548  Record.AddSourceLocation(D->getTemplateKeywordLoc());
1549  }
1550 
1551  Record.AddTemplateArgumentList(&D->getTemplateArgs());
1552  Record.AddSourceLocation(D->getPointOfInstantiation());
1553  Record.push_back(D->getSpecializationKind());
1554  Record.push_back(D->IsCompleteDefinition);
1555  Record.push_back(D->isCanonicalDecl());
1556 
1557  if (D->isCanonicalDecl()) {
1558  // When reading, we'll add it to the folding set of the following template.
1559  Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1560  }
1561 
1563 }
1564 
1567  VisitVarTemplateSpecializationDecl(D);
1568 
1569  Record.AddTemplateParameterList(D->getTemplateParameters());
1570  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1571 
1572  // These are read/set from/to the first declaration.
1573  if (D->getPreviousDecl() == nullptr) {
1574  Record.AddDeclRef(D->getInstantiatedFromMember());
1575  Record.push_back(D->isMemberSpecialization());
1576  }
1577 
1579 }
1580 
1583  VisitDecl(D);
1584  Record.AddDeclRef(D->getSpecialization());
1585  Record.push_back(D->hasExplicitTemplateArgs());
1586  if (D->hasExplicitTemplateArgs())
1587  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1589 }
1590 
1591 
1593  VisitRedeclarableTemplateDecl(D);
1594 
1595  if (D->isFirstDecl())
1596  AddTemplateSpecializations(D);
1598 }
1599 
1601  VisitTypeDecl(D);
1602 
1603  Record.push_back(D->wasDeclaredWithTypename());
1604 
1605  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1607  Record.push_back(OwnsDefaultArg);
1608  if (OwnsDefaultArg)
1609  Record.AddTypeSourceInfo(D->getDefaultArgumentInfo());
1610 
1612 }
1613 
1615  // For an expanded parameter pack, record the number of expansion types here
1616  // so that it's easier for deserialization to allocate the right amount of
1617  // memory.
1618  if (D->isExpandedParameterPack())
1619  Record.push_back(D->getNumExpansionTypes());
1620 
1621  VisitDeclaratorDecl(D);
1622  // TemplateParmPosition.
1623  Record.push_back(D->getDepth());
1624  Record.push_back(D->getPosition());
1625 
1626  if (D->isExpandedParameterPack()) {
1627  for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1628  Record.AddTypeRef(D->getExpansionType(I));
1629  Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
1630  }
1631 
1633  } else {
1634  // Rest of NonTypeTemplateParmDecl.
1635  Record.push_back(D->isParameterPack());
1636  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1638  Record.push_back(OwnsDefaultArg);
1639  if (OwnsDefaultArg)
1640  Record.AddStmt(D->getDefaultArgument());
1642  }
1643 }
1644 
1646  // For an expanded parameter pack, record the number of expansion types here
1647  // so that it's easier for deserialization to allocate the right amount of
1648  // memory.
1649  if (D->isExpandedParameterPack())
1650  Record.push_back(D->getNumExpansionTemplateParameters());
1651 
1652  VisitTemplateDecl(D);
1653  // TemplateParmPosition.
1654  Record.push_back(D->getDepth());
1655  Record.push_back(D->getPosition());
1656 
1657  if (D->isExpandedParameterPack()) {
1658  for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1659  I != N; ++I)
1660  Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
1662  } else {
1663  // Rest of TemplateTemplateParmDecl.
1664  Record.push_back(D->isParameterPack());
1665  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1667  Record.push_back(OwnsDefaultArg);
1668  if (OwnsDefaultArg)
1669  Record.AddTemplateArgumentLoc(D->getDefaultArgument());
1671  }
1672 }
1673 
1675  VisitRedeclarableTemplateDecl(D);
1677 }
1678 
1680  VisitDecl(D);
1681  Record.AddStmt(D->getAssertExpr());
1682  Record.push_back(D->isFailed());
1683  Record.AddStmt(D->getMessage());
1684  Record.AddSourceLocation(D->getRParenLoc());
1686 }
1687 
1688 /// Emit the DeclContext part of a declaration context decl.
1690  Record.AddOffset(Writer.WriteDeclContextLexicalBlock(Context, DC));
1691  Record.AddOffset(Writer.WriteDeclContextVisibleBlock(Context, DC));
1692 }
1693 
1695  assert(IsLocalDecl(D) && "expected a local declaration");
1696 
1697  const Decl *Canon = D->getCanonicalDecl();
1698  if (IsLocalDecl(Canon))
1699  return Canon;
1700 
1701  const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
1702  if (CacheEntry)
1703  return CacheEntry;
1704 
1705  for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
1706  if (IsLocalDecl(Redecl))
1707  D = Redecl;
1708  return CacheEntry = D;
1709 }
1710 
1711 template <typename T>
1713  T *First = D->getFirstDecl();
1714  T *MostRecent = First->getMostRecentDecl();
1715  T *DAsT = static_cast<T *>(D);
1716  if (MostRecent != First) {
1717  assert(isRedeclarableDeclKind(DAsT->getKind()) &&
1718  "Not considered redeclarable?");
1719 
1720  Record.AddDeclRef(First);
1721 
1722  // Write out a list of local redeclarations of this declaration if it's the
1723  // first local declaration in the chain.
1724  const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
1725  if (DAsT == FirstLocal) {
1726  // Emit a list of all imported first declarations so that we can be sure
1727  // that all redeclarations visible to this module are before D in the
1728  // redecl chain.
1729  unsigned I = Record.size();
1730  Record.push_back(0);
1731  if (Writer.Chain)
1732  AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
1733  // This is the number of imported first declarations + 1.
1734  Record[I] = Record.size() - I;
1735 
1736  // Collect the set of local redeclarations of this declaration, from
1737  // newest to oldest.
1738  ASTWriter::RecordData LocalRedecls;
1739  ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
1740  for (const Decl *Prev = FirstLocal->getMostRecentDecl();
1741  Prev != FirstLocal; Prev = Prev->getPreviousDecl())
1742  if (!Prev->isFromASTFile())
1743  LocalRedeclWriter.AddDeclRef(Prev);
1744 
1745  // If we have any redecls, write them now as a separate record preceding
1746  // the declaration itself.
1747  if (LocalRedecls.empty())
1748  Record.push_back(0);
1749  else
1750  Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
1751  } else {
1752  Record.push_back(0);
1753  Record.AddDeclRef(FirstLocal);
1754  }
1755 
1756  // Make sure that we serialize both the previous and the most-recent
1757  // declarations, which (transitively) ensures that all declarations in the
1758  // chain get serialized.
1759  //
1760  // FIXME: This is not correct; when we reach an imported declaration we
1761  // won't emit its previous declaration.
1762  (void)Writer.GetDeclRef(D->getPreviousDecl());
1763  (void)Writer.GetDeclRef(MostRecent);
1764  } else {
1765  // We use the sentinel value 0 to indicate an only declaration.
1766  Record.push_back(0);
1767  }
1768 }
1769 
1771  Record.push_back(D->varlist_size());
1772  VisitDecl(D);
1773  for (auto *I : D->varlists())
1774  Record.AddStmt(I);
1776 }
1777 
1779  Record.push_back(D->varlist_size());
1780  Record.push_back(D->clauselist_size());
1781  VisitDecl(D);
1782  for (auto *I : D->varlists())
1783  Record.AddStmt(I);
1784  OMPClauseWriter ClauseWriter(Record);
1785  for (OMPClause *C : D->clauselists())
1786  ClauseWriter.writeClause(C);
1788 }
1789 
1791  Record.push_back(D->clauselist_size());
1792  VisitDecl(D);
1793  OMPClauseWriter ClauseWriter(Record);
1794  for (OMPClause *C : D->clauselists())
1795  ClauseWriter.writeClause(C);
1797 }
1798 
1800  VisitValueDecl(D);
1801  Record.AddSourceLocation(D->getBeginLoc());
1802  Record.AddStmt(D->getCombinerIn());
1803  Record.AddStmt(D->getCombinerOut());
1804  Record.AddStmt(D->getCombiner());
1805  Record.AddStmt(D->getInitOrig());
1806  Record.AddStmt(D->getInitPriv());
1807  Record.AddStmt(D->getInitializer());
1808  Record.push_back(D->getInitializerKind());
1809  Record.AddDeclRef(D->getPrevDeclInScope());
1811 }
1812 
1814  Record.push_back(D->clauselist_size());
1815  VisitValueDecl(D);
1816  Record.AddSourceLocation(D->getBeginLoc());
1817  Record.AddStmt(D->getMapperVarRef());
1818  Record.AddDeclarationName(D->getVarName());
1819  Record.AddDeclRef(D->getPrevDeclInScope());
1820  OMPClauseWriter ClauseWriter(Record);
1821  for (OMPClause *C : D->clauselists())
1822  ClauseWriter.writeClause(C);
1824 }
1825 
1827  VisitVarDecl(D);
1829 }
1830 
1831 //===----------------------------------------------------------------------===//
1832 // ASTWriter Implementation
1833 //===----------------------------------------------------------------------===//
1834 
1835 void ASTWriter::WriteDeclAbbrevs() {
1836  using namespace llvm;
1837 
1838  std::shared_ptr<BitCodeAbbrev> Abv;
1839 
1840  // Abbreviation for DECL_FIELD
1841  Abv = std::make_shared<BitCodeAbbrev>();
1842  Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
1843  // Decl
1844  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1845  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1846  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1847  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1848  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1849  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1850  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1851  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1852  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
1853  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1854  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1855  // NamedDecl
1856  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1857  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1858  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1859  // ValueDecl
1860  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1861  // DeclaratorDecl
1862  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1863  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1864  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
1865  // FieldDecl
1866  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
1867  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
1868  // Type Source Info
1869  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1870  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1871  DeclFieldAbbrev = Stream.EmitAbbrev(std::move(Abv));
1872 
1873  // Abbreviation for DECL_OBJC_IVAR
1874  Abv = std::make_shared<BitCodeAbbrev>();
1875  Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
1876  // Decl
1877  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1878  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1879  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1880  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1881  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1882  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1883  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1884  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1885  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
1886  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1887  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1888  // NamedDecl
1889  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1890  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1891  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1892  // ValueDecl
1893  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1894  // DeclaratorDecl
1895  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1896  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1897  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
1898  // FieldDecl
1899  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
1900  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
1901  // ObjC Ivar
1902  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
1903  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
1904  // Type Source Info
1905  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1906  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1907  DeclObjCIvarAbbrev = Stream.EmitAbbrev(std::move(Abv));
1908 
1909  // Abbreviation for DECL_ENUM
1910  Abv = std::make_shared<BitCodeAbbrev>();
1911  Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
1912  // Redeclarable
1913  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1914  // Decl
1915  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1916  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1917  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1918  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1919  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1920  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1921  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1922  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1923  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1924  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1925  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1926  // NamedDecl
1927  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1928  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1929  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1930  // TypeDecl
1931  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
1932  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
1933  // TagDecl
1934  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
1935  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
1936  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
1937  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
1938  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
1939  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
1940  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1941  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1942  Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
1943  // EnumDecl
1944  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
1945  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
1946  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
1947  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumPositiveBits
1948  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumNegativeBits
1949  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScoped
1950  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScopedUsingClassTag
1951  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isFixed
1952  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));// ODRHash
1953  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
1954  // DC
1955  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
1956  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
1957  DeclEnumAbbrev = Stream.EmitAbbrev(std::move(Abv));
1958 
1959  // Abbreviation for DECL_RECORD
1960  Abv = std::make_shared<BitCodeAbbrev>();
1961  Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
1962  // Redeclarable
1963  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1964  // Decl
1965  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1966  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1967  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1968  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1969  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1970  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1971  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1972  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1973  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1974  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1975  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1976  // NamedDecl
1977  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1978  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1979  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1980  // TypeDecl
1981  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
1982  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
1983  // TagDecl
1984  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
1985  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
1986  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
1987  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
1988  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
1989  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
1990  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1991  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1992  Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
1993  // RecordDecl
1994  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // FlexibleArrayMember
1995  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // AnonymousStructUnion
1996  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasObjectMember
1997  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasVolatileMember
1998 
1999  // isNonTrivialToPrimitiveDefaultInitialize
2000  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2001  // isNonTrivialToPrimitiveCopy
2002  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2003  // isNonTrivialToPrimitiveDestroy
2004  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2005  // hasNonTrivialToPrimitiveDefaultInitializeCUnion
2006  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2007  // hasNonTrivialToPrimitiveDestructCUnion
2008  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2009  // hasNonTrivialToPrimitiveCopyCUnion
2010  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2011  // isParamDestroyedInCallee
2012  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1));
2013  // getArgPassingRestrictions
2014  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2));
2015 
2016  // DC
2017  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
2018  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
2019  DeclRecordAbbrev = Stream.EmitAbbrev(std::move(Abv));
2020 
2021  // Abbreviation for DECL_PARM_VAR
2022  Abv = std::make_shared<BitCodeAbbrev>();
2023  Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
2024  // Redeclarable
2025  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2026  // Decl
2027  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2028  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2029  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2030  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2031  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2032  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2033  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2034  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2035  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2036  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2037  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2038  // NamedDecl
2039  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2040  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2041  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2042  // ValueDecl
2043  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2044  // DeclaratorDecl
2045  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2046  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2047  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2048  // VarDecl
2049  Abv->Add(BitCodeAbbrevOp(0)); // SClass
2050  Abv->Add(BitCodeAbbrevOp(0)); // TSCSpec
2051  Abv->Add(BitCodeAbbrevOp(0)); // InitStyle
2052  Abv->Add(BitCodeAbbrevOp(0)); // ARCPseudoStrong
2053  Abv->Add(BitCodeAbbrevOp(0)); // Linkage
2054  Abv->Add(BitCodeAbbrevOp(0)); // HasInit
2055  Abv->Add(BitCodeAbbrevOp(0)); // HasMemberSpecializationInfo
2056  // ParmVarDecl
2057  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsObjCMethodParameter
2058  Abv->Add(BitCodeAbbrevOp(0)); // ScopeDepth
2059  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
2060  Abv->Add(BitCodeAbbrevOp(0)); // ObjCDeclQualifier
2061  Abv->Add(BitCodeAbbrevOp(0)); // KNRPromoted
2062  Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedDefaultArg
2063  Abv->Add(BitCodeAbbrevOp(0)); // HasUninstantiatedDefaultArg
2064  // Type Source Info
2065  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2066  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2067  DeclParmVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2068 
2069  // Abbreviation for DECL_TYPEDEF
2070  Abv = std::make_shared<BitCodeAbbrev>();
2071  Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
2072  // Redeclarable
2073  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2074  // Decl
2075  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2076  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2077  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2078  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2079  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2080  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isUsed
2081  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isReferenced
2082  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2083  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // C++ AccessSpecifier
2084  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2085  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2086  // NamedDecl
2087  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2088  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2089  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2090  // TypeDecl
2091  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
2092  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
2093  // TypedefDecl
2094  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2095  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2096  DeclTypedefAbbrev = Stream.EmitAbbrev(std::move(Abv));
2097 
2098  // Abbreviation for DECL_VAR
2099  Abv = std::make_shared<BitCodeAbbrev>();
2100  Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
2101  // Redeclarable
2102  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
2103  // Decl
2104  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2105  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2106  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
2107  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2108  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
2109  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
2110  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
2111  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
2112  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
2113  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
2114  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2115  // NamedDecl
2116  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
2117  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
2118  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2119  // ValueDecl
2120  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2121  // DeclaratorDecl
2122  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
2123  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
2124  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2125  // VarDecl
2126  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // SClass
2127  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // TSCSpec
2128  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // InitStyle
2129  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
2130  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsThisDeclarationADemotedDefinition
2131  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isExceptionVariable
2132  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isNRVOVariable
2133  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCXXForRangeDecl
2134  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isObjCForDecl
2135  Abv->Add(BitCodeAbbrevOp(0)); // isInline
2136  Abv->Add(BitCodeAbbrevOp(0)); // isInlineSpecified
2137  Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr
2138  Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture
2139  Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope
2140  Abv->Add(BitCodeAbbrevOp(0)); // ImplicitParamKind
2141  Abv->Add(BitCodeAbbrevOp(0)); // EscapingByref
2142  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2143  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // IsInitICE (local)
2144  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum)
2145  // Type Source Info
2146  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2147  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
2148  DeclVarAbbrev = Stream.EmitAbbrev(std::move(Abv));
2149 
2150  // Abbreviation for DECL_CXX_METHOD
2151  Abv = std::make_shared<BitCodeAbbrev>();
2152  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CXX_METHOD));
2153  // RedeclarableDecl
2154  Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
2155  // Decl
2156  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
2157  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
2158  Abv->Add(BitCodeAbbrevOp(0)); // Invalid
2159  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
2160  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Implicit
2161  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Used
2162  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Referenced
2163  Abv->Add(BitCodeAbbrevOp(0)); // InObjCContainer
2164  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Access
2165  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ModulePrivate
2166  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
2167  // NamedDecl
2168  Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
2169  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
2170  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
2171  // ValueDecl
2172  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2173  // DeclaratorDecl
2174  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
2175  Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
2176  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TSIType
2177  // FunctionDecl
2178  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
2179  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // StorageClass
2180  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Inline
2181  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // InlineSpecified
2182  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // VirtualAsWritten
2183  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Pure
2184  Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedProto
2185  Abv->Add(BitCodeAbbrevOp(1)); // HasWrittenProto
2186  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Deleted
2187  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Trivial
2188  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // TrivialForCall
2189  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Defaulted
2190  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted
2191  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero
2192  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constexpr
2193  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // UsesSEHTry
2194  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody
2195  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // MultiVersion
2196  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // LateParsed
2197  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2198  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2199  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // ODRHash
2200  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // TemplateKind
2201  // This Array slurps the rest of the record. Fortunately we want to encode
2202  // (nearly) all the remaining (variable number of) fields in the same way.
2203  //
2204  // This is the function template information if any, then
2205  // NumParams and Params[] from FunctionDecl, and
2206  // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2207  //
2208  // Add an AbbrevOp for 'size then elements' and use it here.
2209  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2210  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2211  DeclCXXMethodAbbrev = Stream.EmitAbbrev(std::move(Abv));
2212 
2213  // Abbreviation for EXPR_DECL_REF
2214  Abv = std::make_shared<BitCodeAbbrev>();
2215  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2216  //Stmt
2217  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
2218  // Expr
2219  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2220  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2221  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2222  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2223  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2224  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2225  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2226  //DeclRefExpr
2227  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HasQualifier
2228  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //GetDeclFound
2229  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ExplicitTemplateArgs
2230  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HadMultipleCandidates
2231  Abv->Add(BitCodeAbbrevOp(0)); // RefersToEnclosingVariableOrCapture
2232  Abv->Add(BitCodeAbbrevOp(0)); // NonOdrUseReason
2233  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2234  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2235  DeclRefExprAbbrev = Stream.EmitAbbrev(std::move(Abv));
2236 
2237  // Abbreviation for EXPR_INTEGER_LITERAL
2238  Abv = std::make_shared<BitCodeAbbrev>();
2239  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2240  //Stmt
2241  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
2242  // Expr
2243  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2244  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2245  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2246  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2247  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2248  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2249  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2250  //Integer Literal
2251  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2252  Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2253  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2254  IntegerLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2255 
2256  // Abbreviation for EXPR_CHARACTER_LITERAL
2257  Abv = std::make_shared<BitCodeAbbrev>();
2258  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2259  //Stmt
2260  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
2261  // Expr
2262  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2263  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2264  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2265  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2266  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2267  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2268  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2269  //Character Literal
2270  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2271  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2272  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2273  CharacterLiteralAbbrev = Stream.EmitAbbrev(std::move(Abv));
2274 
2275  // Abbreviation for EXPR_IMPLICIT_CAST
2276  Abv = std::make_shared<BitCodeAbbrev>();
2277  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2278  // Stmt
2279  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsOMPStructuredBlock
2280  // Expr
2281  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2282  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2283  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2284  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2285  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2286  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2287  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2288  // CastExpr
2289  Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2290  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 6)); // CastKind
2291  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // PartOfExplicitCast
2292  // ImplicitCastExpr
2293  ExprImplicitCastAbbrev = Stream.EmitAbbrev(std::move(Abv));
2294 
2295  Abv = std::make_shared<BitCodeAbbrev>();
2296  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2297  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2298  DeclContextLexicalAbbrev = Stream.EmitAbbrev(std::move(Abv));
2299 
2300  Abv = std::make_shared<BitCodeAbbrev>();
2301  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2302  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2303  DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(std::move(Abv));
2304 }
2305 
2306 /// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2307 /// consumers of the AST.
2308 ///
2309 /// Such decls will always be deserialized from the AST file, so we would like
2310 /// this to be as restrictive as possible. Currently the predicate is driven by
2311 /// code generation requirements, if other clients have a different notion of
2312 /// what is "required" then we may have to consider an alternate scheme where
2313 /// clients can iterate over the top-level decls and get information on them,
2314 /// without necessary deserializing them. We could explicitly require such
2315 /// clients to use a separate API call to "realize" the decl. This should be
2316 /// relatively painless since they would presumably only do it for top-level
2317 /// decls.
2318 static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2319  bool WritingModule) {
2320  // An ObjCMethodDecl is never considered as "required" because its
2321  // implementation container always is.
2322 
2323  // File scoped assembly or obj-c or OMP declare target implementation must be
2324  // seen.
2325  if (isa<FileScopeAsmDecl>(D) || isa<ObjCImplDecl>(D))
2326  return true;
2327 
2328  if (WritingModule && isPartOfPerModuleInitializer(D)) {
2329  // These declarations are part of the module initializer, and are emitted
2330  // if and when the module is imported, rather than being emitted eagerly.
2331  return false;
2332  }
2333 
2334  return Context.DeclMustBeEmitted(D);
2335 }
2336 
2337 void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2338  PrettyDeclStackTraceEntry CrashInfo(Context, D, SourceLocation(),
2339  "serializing");
2340 
2341  // Determine the ID for this declaration.
2343  assert(!D->isFromASTFile() && "should not be emitting imported decl");
2344  serialization::DeclID &IDR = DeclIDs[D];
2345  if (IDR == 0)
2346  IDR = NextDeclID++;
2347 
2348  ID = IDR;
2349 
2350  assert(ID >= FirstDeclID && "invalid decl ID");
2351 
2352  RecordData Record;
2353  ASTDeclWriter W(*this, Context, Record);
2354 
2355  // Build a record for this declaration
2356  W.Visit(D);
2357 
2358  // Emit this declaration to the bitstream.
2359  uint64_t Offset = W.Emit(D);
2360 
2361  // Record the offset for this declaration
2362  SourceLocation Loc = D->getLocation();
2363  unsigned Index = ID - FirstDeclID;
2364  if (DeclOffsets.size() == Index)
2365  DeclOffsets.push_back(DeclOffset(Loc, Offset));
2366  else if (DeclOffsets.size() < Index) {
2367  // FIXME: Can/should this happen?
2368  DeclOffsets.resize(Index+1);
2369  DeclOffsets[Index].setLocation(Loc);
2370  DeclOffsets[Index].BitOffset = Offset;
2371  } else {
2372  llvm_unreachable("declarations should be emitted in ID order");
2373  }
2374 
2375  SourceManager &SM = Context.getSourceManager();
2376  if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2377  associateDeclWithFile(D, ID);
2378 
2379  // Note declarations that should be deserialized eagerly so that we can add
2380  // them to a record in the AST file later.
2381  if (isRequiredDecl(D, Context, WritingModule))
2382  EagerlyDeserializedDecls.push_back(ID);
2383 }
2384 
2386  // Switch case IDs are per function body.
2387  Writer->ClearSwitchCaseIDs();
2388 
2389  assert(FD->doesThisDeclarationHaveABody());
2390  bool ModulesCodegen = false;
2391  if (Writer->WritingModule && !FD->isDependentContext()) {
2393  if (Writer->WritingModule->Kind == Module::ModuleInterfaceUnit) {
2394  // When building a C++ Modules TS module interface unit, a strong
2395  // definition in the module interface is provided by the compilation of
2396  // that module interface unit, not by its users. (Inline functions are
2397  // still emitted in module users.)
2398  Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2399  ModulesCodegen = *Linkage == GVA_StrongExternal;
2400  }
2401  if (Writer->Context->getLangOpts().ModulesCodegen) {
2402  // Under -fmodules-codegen, codegen is performed for all non-internal,
2403  // non-always_inline functions.
2404  if (!FD->hasAttr<AlwaysInlineAttr>()) {
2405  if (!Linkage)
2406  Linkage = Writer->Context->GetGVALinkageForFunction(FD);
2407  ModulesCodegen = *Linkage != GVA_Internal;
2408  }
2409  }
2410  }
2411  Record->push_back(ModulesCodegen);
2412  if (ModulesCodegen)
2413  Writer->ModularCodegenDecls.push_back(Writer->GetDeclRef(FD));
2414  if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2415  Record->push_back(CD->getNumCtorInitializers());
2416  if (CD->getNumCtorInitializers())
2417  AddCXXCtorInitializers(
2418  llvm::makeArrayRef(CD->init_begin(), CD->init_end()));
2419  }
2420  AddStmt(FD->getBody());
2421 }
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Definition: Decl.cpp:2536
clauselist_range clauselists()
Definition: DeclOpenMP.h:270
SourceLocation getGetterNameLoc() const
Definition: DeclObjC.h:906
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1457
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1484
bool hasCapturedVLAType() const
Determine whether this member captures the variable length array type.
Definition: Decl.h:2780
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
Definition: DeclTemplate.h:778
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1918
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:3329
Represents a function declaration or definition.
Definition: Decl.h:1748
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:571
void VisitAccessSpecDecl(AccessSpecDecl *D)
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
Definition: DeclTemplate.h:775
OMPDeclareMapperDecl * getPrevDeclInScope()
Get reference to previous declare mapper construct in the same scope with the same name...
Definition: DeclOpenMP.cpp:218
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
Definition: Decl.h:1293
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:602
protocol_range protocols() const
Definition: DeclObjC.h:1365
void VisitStaticAssertDecl(StaticAssertDecl *D)
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:759
void VisitCXXMethodDecl(CXXMethodDecl *D)
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
Definition: ASTCommon.cpp:317
A (possibly-)qualified type.
Definition: Type.h:643
Static storage duration.
Definition: Specifiers.h:309
const char * getDeclKindName() const
Definition: DeclBase.cpp:122
unsigned param_size() const
Definition: DeclObjC.h:340
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2324
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3758
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:1529
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2826
bool isObjCMethodParameter() const
Definition: Decl.h:1607
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:3178
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1523
MemberSpecializationInfo * getMemberSpecializationInfo() const
Get the specialization info if this function template specialization is also a member specialization:...
Definition: DeclTemplate.h:642
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Definition: Dominators.h:30
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
void VisitExportDecl(ExportDecl *D)
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
Expr * getBitWidth() const
Definition: Decl.h:2696
This represents &#39;#pragma omp allocate ...&#39; directive.
Definition: DeclOpenMP.h:422
void VisitOMPRequiresDecl(OMPRequiresDecl *D)
An instance of this object exists for each enum constant that is defined.
Definition: Decl.h:2819
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:3051
Defines the SourceManager interface.
unsigned clauselist_size() const
Definition: DeclOpenMP.h:488
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1550
bool hasVolatileMember() const
Definition: Decl.h:3710
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:2378
const Type * getTypeForDecl() const
Definition: Decl.h:2931
bool isLocalSourceLocation(SourceLocation Loc) const
Returns true if Loc did not come from a PCH/Module.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
unsigned getNumCaptures() const
Returns the number of captured variables.
Definition: Decl.h:4038
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1691
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclBase.h:421
bool isNothrow() const
Definition: Decl.cpp:4624
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:4073
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1475
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:457
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2916
bool hasWrittenPrototype() const
Whether this function has a written prototype.
Definition: Decl.h:2086
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
Definition: DeclBase.h:960
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
Expr * getSetterCXXAssignment() const
Definition: DeclObjC.h:2856
void VisitTranslationUnitDecl(TranslationUnitDecl *D)
A record that stores the set of declarations that are lexically stored within a given DeclContext...
Definition: ASTBitCodes.h:1385
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:1339
ExplicitSpecKind getKind() const
Definition: DeclCXX.h:2009
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:4325
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context, ASTWriter::RecordDataImpl &Record)
Expr * getOperatorDeleteThisArg() const
Definition: DeclCXX.h:2865
bool usesSEHTry() const
Indicates the function uses __try.
Definition: Decl.h:2141
Declaration of a variable template.
void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D)
Represent a C++ namespace.
Definition: Decl.h:514
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1342
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction...
Definition: DeclObjC.h:2658
bool hasRedeclaration() const
True if redeclared in the same interface.
Definition: DeclObjC.h:271
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclBase.h:425
Store information needed for an explicit specifier.
Definition: DeclCXX.h:2001
void VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument&#39;s source information, if any.
An OMPRequiresDecl record.
Definition: ASTBitCodes.h:1526
unsigned getIdentifierNamespace() const
Definition: DeclBase.h:799
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2566
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:2014
bool hasInClassInitializer() const
Determine whether this member has a C++11 default member initializer.
Definition: Decl.h:2747
size_t param_size() const
Definition: Decl.h:2305
bool isOverriding() const
Whether this method overrides any other in the class hierarchy.
Definition: DeclObjC.h:449
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:809
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:3240
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
Definition: Decl.h:3202
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:1460
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1544
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1424
void VisitBlockDecl(BlockDecl *D)
void VisitImplicitParamDecl(ImplicitParamDecl *D)
unsigned getDepth() const
Get the nesting depth of the template parameter.
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:53
unsigned getODRHash()
Definition: Decl.cpp:4226
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:793
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1538
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:3562
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1412
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:574
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
bool hasInheritedDefaultArg() const
Definition: Decl.h:1690
Represents a variable template specialization, which refers to a variable template with a given set o...
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:138
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack...
Definition: ASTBitCodes.h:1513
void VisitIndirectFieldDecl(IndirectFieldDecl *D)
bool isInvalidDecl() const
Definition: DeclBase.h:553
void VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
unsigned getContextParamPosition() const
Definition: Decl.h:4182
protocol_range protocols() const
Definition: DeclObjC.h:2128
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1487
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:686
Represents a parameter to a function.
Definition: Decl.h:1564
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Definition: Linkage.h:23
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1318
long i
Definition: xmmintrin.h:1456
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:728
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2688
void VisitConceptDecl(ConceptDecl *D)
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition: Decl.h:1364
void VisitCXXDestructorDecl(CXXDestructorDecl *D)
Represents a struct/union/class.
Definition: Decl.h:3626
clauselist_range clauselists()
Definition: DeclOpenMP.h:390
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2988
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:84
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
Definition: Decl.h:3529
Represents a class template specialization, which refers to a class template with a given set of temp...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:123
bool doesNotEscape() const
Definition: Decl.h:4066
StringLiteral * getMessage()
Definition: DeclCXX.h:3900
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2695
Expr * getGetterCXXConstructor() const
Definition: DeclObjC.h:2848
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:738
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:3221
ConstexprSpecKind getConstexprKind() const
Definition: Decl.h:2114
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:2242
Represents a member of a struct/union/class.
Definition: Decl.h:2607
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
const llvm::APSInt & getInitVal() const
Definition: Decl.h:2840
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition: Decl.h:1617
StringRef getValue() const
Definition: Decl.h:197
bool isDefined() const
Definition: DeclObjC.h:439
InitKind getInitializerKind() const
Get initializer kind.
Definition: DeclOpenMP.h:173
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:924
NamedDecl * getFriendDecl() const
If this friend declaration doesn&#39;t name a type, return the inner declaration.
Definition: DeclFriend.h:138
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2803
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:3994
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:1409
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:3998
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1505
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:2289
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:512
Expr * getMapperVarRef()
Get the variable declared in the mapper.
Definition: DeclOpenMP.h:282
Represents a C++ using-declaration.
Definition: DeclCXX.h:3480
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:529
FunctionTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
bool hasNonTrivialToPrimitiveCopyCUnion() const
Definition: Decl.h:3765
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2697
ArrayRef< BindingDecl * > bindings() const
Definition: DeclCXX.h:4014
void VisitLabelDecl(LabelDecl *LD)
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:170
void VisitObjCProtocolDecl(ObjCProtocolDecl *D)
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
Definition: DeclObjC.h:2653
void append(InputIterator begin, InputIterator end)
Definition: ASTWriter.h:798
void VisitClassTemplateDecl(ClassTemplateDecl *D)
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
Definition: Decl.cpp:2808
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:968
TagKind getTagKind() const
Definition: Decl.h:3276
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:1451
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:1638
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:4684
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
void VisitUsingShadowDecl(UsingShadowDecl *D)
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1415
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:3443
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:936
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:2880
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1418
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:839
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Decl.h:2934
A DecompositionDecl record.
Definition: ASTBitCodes.h:1363
Represents a declaration of a type.
Definition: Decl.h:2907
SourceLocation RAngleLoc
The source location of the right angle bracket (&#39;>&#39;).
Definition: TemplateBase.h:617
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum...
Definition: Decl.h:3539
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
Definition: Decl.h:3607
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or nullptr if this template w...
Definition: DeclTemplate.h:983
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1386
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3545
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:1783
bool isPartOfPerModuleInitializer(const Decl *D)
Determine whether the given declaration will be included in the per-module initializer if it needs to...
Definition: ASTCommon.h:116
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
void VisitBindingDecl(BindingDecl *D)
TemplateParameterList * getTemplateParameterList(unsigned i) const
const Expr * getInitExpr() const
Definition: Decl.h:2838
SourceLocation getPropertyIvarDeclLoc() const
Definition: DeclObjC.h:2829
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
Definition: DeclFriend.h:131
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1463
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:3211
SourceLocation getExternLoc() const
Definition: DeclCXX.h:3002
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:2063
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
Definition: DeclBase.h:828
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
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:4834
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:932
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:4108
Represents an ObjC class declaration.
Definition: DeclObjC.h:1171
Represents a linkage specification.
Definition: DeclCXX.h:2954
QualType getReturnType() const
Definition: DeclObjC.h:322
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
A binding in a decomposition declaration.
Definition: DeclCXX.h:3923
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:3422
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:877
SourceLocation getAtStartLoc() const
Definition: DeclObjC.h:1114
ArgPassingKind getArgPassingRestrictions() const
Definition: Decl.h:3780
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
Definition: Decl.h:3699
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:4257
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:3905
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:2758
NodeId Parent
Definition: ASTDiff.cpp:191
void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
bool hasAttr() const
Definition: DeclBase.h:542
void VisitObjCContainerDecl(ObjCContainerDecl *D)
unsigned varlist_size() const
Definition: DeclOpenMP.h:486
RecordDecl * getMostRecentDecl()
Definition: Decl.h:3673
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition: Decl.h:3071
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:1394
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Definition: Type.cpp:1636
SourceLocation getTypenameLoc() const
Returns the source location of the &#39;typename&#39; keyword.
Definition: DeclCXX.h:3827
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:3505
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2637
A CXXDeductionGuideDecl record.
Definition: ASTBitCodes.h:1436
uint64_t Emit(Decl *D)
DeclarationName getVarName()
Get the name of the variable declared in the mapper.
Definition: DeclOpenMP.h:288
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclObjC.cpp:979
bool canAvoidCopyToHeap() const
Definition: Decl.h:4069
bool isInlineSpecified() const
Definition: Decl.h:1371
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:152
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1496
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:2999
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1472
static bool classofKind(Kind K)
Definition: DeclObjC.h:1998
This represents &#39;#pragma omp requires...&#39; directive.
Definition: DeclOpenMP.h:345
unsigned Offset
Definition: Format.cpp:1713
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1535
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:436
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
Definition: DeclBase.h:883
void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:2377
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:3368
unsigned getFunctionScopeDepth() const
Definition: Decl.h:1611
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition: Decl.h:3915
bool isMultiVersion() const
True if this function is considered a multiversioned function.
Definition: Decl.h:2252
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:3520
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1333
unsigned getChainingSize() const
Definition: Decl.h:2886
Selector getSetterName() const
Definition: DeclObjC.h:913
bool isDefaulted() const
Whether this function is defaulted per C++0x.
Definition: Decl.h:2048
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3556
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1345
TypeSourceInfo * getSuperClassTInfo() const
Definition: DeclObjC.h:1572
void VisitRecordDecl(RecordDecl *D)
Declaration of a template type parameter.
void VisitFileScopeAsmDecl(FileScopeAsmDecl *D)
TypeSourceInfo * getTypeSourceInfo() const
Definition: DeclObjC.h:826
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:620
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name...
Definition: DeclOpenMP.cpp:158
void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal)
Add to the record the first declaration from each module file that provides a declaration of D...
unsigned getNumParams() const
Definition: Decl.h:4153
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2830
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver&#39;s type...
Definition: DeclObjC.h:256
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:2220
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1442
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:1311
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:558
bool isCopyDeductionCandidate() const
Definition: DeclCXX.h:2101
Decl * getMostRecentDecl()
Retrieve the most recent declaration that declares the same entity as this declaration (which may be ...
Definition: DeclBase.h:975
void VisitClassTemplatePartialSpecializationDecl(ClassTemplatePartialSpecializationDecl *D)
void VisitTemplateDecl(TemplateDecl *D)
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
overridden_method_range overridden_methods() const
Definition: DeclCXX.cpp:2250
DeclContext * getDeclContext()
Definition: DeclBase.h:438
void VisitUsingDecl(UsingDecl *D)
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1469
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:2366
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
const Expr * getExpr() const
Definition: DeclCXX.h:2010
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3453
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:3607
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1445
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:1509
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:4075
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:1403
Declaration of an alias template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1779
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i&#39;th template candidate.
Definition: DeclTemplate.h:764
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
Definition: ASTWriter.h:909
void AddObjCTypeParamList(ObjCTypeParamList *typeParams)
Add an Objective-C type parameter list to the given record.
void AddStmt(Stmt *S)
Add the given statement or expression to the queue of statements to emit.
Definition: ASTWriter.h:839
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
bool isInstanceMethod() const
Definition: DeclObjC.h:421
clauselist_range clauselists()
Definition: DeclOpenMP.h:502
void VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization, retrieves the member specialization information.
Definition: DeclCXX.cpp:1643
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:1082
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1357
StringRef getName() const
Definition: Decl.h:196
Expr * getInitPriv()
Get Priv variable of the initializer.
Definition: DeclOpenMP.h:180
NamedDecl * getInstantiatedFromUsingDecl(NamedDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
Represents a C++ deduction guide declaration.
Definition: DeclCXX.h:2056
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2891
void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
Definition: Decl.h:2040
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: DeclObjC.h:2814
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1309
ImplicitParamDecl * getSelfDecl() const
Definition: DeclObjC.h:413
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1283
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
QualType getType() const
Definition: DeclObjC.h:828
const SourceManager & SM
Definition: Format.cpp:1572
void VisitTagDecl(TagDecl *D)
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1520
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1330
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:464
void VisitObjCCategoryDecl(ObjCCategoryDecl *D)
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:2205
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:815
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:215
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2620
void VisitMSPropertyDecl(MSPropertyDecl *D)
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1339
void VisitVarTemplateDecl(VarTemplateDecl *D)
AttrVec & getAttrs()
Definition: DeclBase.h:490
bool isNonTrivialToPrimitiveDestroy() const
Definition: Decl.h:3741
bool hasAttrs() const
Definition: DeclBase.h:484
void VisitTypeAliasDecl(TypeAliasDecl *D)
void VisitDeclContext(DeclContext *DC)
Emit the DeclContext part of a declaration context decl.
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2369
TypeSourceInfo * getReturnTypeSourceInfo() const
Definition: DeclObjC.h:336
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:796
bool hasNonTrivialToPrimitiveDefaultInitializeCUnion() const
Definition: Decl.h:3749
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:2097
unsigned protocol_size() const
Definition: DeclObjC.h:2167
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:3115
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:2244
Represents a C++ Modules TS module export declaration.
Definition: Decl.h:4278
SourceLocation getUsingLoc() const
Returns the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3731
bool isNonTrivialToPrimitiveDefaultInitialize() const
Functions to query basic properties of non-trivial C structs.
Definition: Decl.h:3725
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:683
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1421
Kind
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:203
NamedDecl * getInstantiatedFromUsingDecl() const
Get the using declaration from which this was instantiated.
Definition: DeclCXX.h:3662
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:533
Encodes a location in the source.
bool getSynthesize() const
Definition: DeclObjC.h:1990
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:2023
This represents &#39;#pragma omp declare reduction ...&#39; directive.
Definition: DeclOpenMP.h:102
A record that stores the set of declarations that are visible from a given DeclContext.
Definition: ASTBitCodes.h:1394
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:312
SourceLocation getSuperClassLoc() const
Definition: DeclObjC.h:2690
void VisitObjCImplDecl(ObjCImplDecl *D)
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3119
const VariableArrayType * getCapturedVLAType() const
Get the captured variable length array type.
Definition: Decl.h:2785
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:3097
SourceLocation getUsingLoc() const
Return the source location of the &#39;using&#39; keyword.
Definition: DeclCXX.h:3513
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2526
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:3088
ObjCList - This is a simple template class used to hold various lists of decls etc, which is heavily used by the ObjC front-end.
Definition: DeclObjC.h:82
Represents the declaration of a label.
Definition: Decl.h:468
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3699
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3741
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
Definition: Decl.h:2754
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:851
SourceLocation getRParenLoc() const
Definition: Decl.h:3898
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:2114
void VisitVarTemplatePartialSpecializationDecl(VarTemplatePartialSpecializationDecl *D)
void VisitUsingPackDecl(UsingPackDecl *D)
C-style initialization with assignment.
Definition: Decl.h:817
bool isConversionFromLambda() const
Definition: Decl.h:4058
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1481
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Definition: Redeclarable.h:222
Data that is common to all of the declarations of a given function template.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3089
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2279
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:50
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:3553
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
Definition: DeclTemplate.h:761
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:2629
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:728
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:702
bool isModed() const
Definition: Decl.h:2995
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:66
unsigned getODRHash()
Returns ODRHash of the function.
Definition: Decl.cpp:3860
bool hasUninstantiatedDefaultArg() const
Definition: Decl.h:1678
void AddSourceLocation(SourceLocation Loc)
Emit a source location.
Definition: ASTWriter.h:848
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:2696
An OMPDeclareMapperDecl record.
Definition: ASTBitCodes.h:1547
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:246
bool hasNonTrivialToPrimitiveDestructCUnion() const
Definition: Decl.h:3757
A NamespaceDecl record.
Definition: ASTBitCodes.h:1400
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
Definition: Decl.h:2053
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3874
bool hasImplicitReturnZero() const
Whether falling off this function implicitly returns null/zero.
Definition: Decl.h:2066
void VisitPragmaCommentDecl(PragmaCommentDecl *D)
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:3003
An OMPAllocateDcl record.
Definition: ASTBitCodes.h:1529
bool hasFlexibleArrayMember() const
Definition: Decl.h:3680
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:2043
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
Definition: Decl.cpp:98
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2416
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Definition: Decl.cpp:1085
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:4213
Expr * getInitOrig()
Get Orig variable of the initializer.
Definition: DeclOpenMP.h:177
protocol_range protocols() const
Definition: DeclObjC.h:2355
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1321
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: Decl.h:1621
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2949
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1448
void VisitFieldDecl(FieldDecl *D)
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2439
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2651
void writeClause(OMPClause *C)
Definition: ASTWriter.cpp:6603
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:2568
bool isLateTemplateParsed() const
Whether this templated function will be late parsed.
Definition: Decl.h:2027
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1271
ArrayRef< Capture > captures() const
Definition: Decl.h:4042
PropertyAttributeKind getPropertyAttributesAsWritten() const
Definition: DeclObjC.h:851
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:403
bool isVariadic() const
Definition: Decl.h:3990
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:593
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
Definition: Decl.cpp:2371
SourceLocation getAtLoc() const
Definition: DeclObjC.h:820
void VisitNamedDecl(NamedDecl *D)
Represents a field injected from an anonymous union/struct into the parent scope. ...
Definition: Decl.h:2858
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1466
QualType getUnderlyingType() const
Definition: Decl.h:3004
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:3212
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:3111
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1295
const Expr * getInit() const
Definition: Decl.h:1219
AccessSpecifier getAccess() const
Definition: DeclBase.h:473
A decomposition declaration.
Definition: DeclCXX.h:3980
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:3226
void VisitTypeDecl(TypeDecl *D)
unsigned getNumTemplateParameters() const
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3795
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
Definition: ASTBitCodes.h:1517
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:558
Kind getKind() const
Definition: DeclBase.h:432
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3831
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1427
bool isNonTrivialToPrimitiveCopy() const
Definition: Decl.h:3733
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:3359
SourceLocation LAngleLoc
The source location of the left angle bracket (&#39;<&#39;).
Definition: TemplateBase.h:614
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
bool isEscapingByref() const
Indicates the capture is a __block variable that is captured by a block that can potentially escape (...
Definition: Decl.cpp:2432
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition: Decl.h:1395
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:1081
SourceLocation getSetterNameLoc() const
Definition: DeclObjC.h:914
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2746
void VisitEnumDecl(EnumDecl *D)
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
Definition: ASTBitCodes.h:68
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2861
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:1541
void VisitNamespaceDecl(NamespaceDecl *D)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2551
void VisitVarDecl(VarDecl *D)
Expr * getUninstantiatedDefaultArg()
Definition: Decl.cpp:2696
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2149
bool isObjCForDecl() const
Determine whether this variable is a for-loop declaration for a for-in statement in Objective-C...
Definition: Decl.h:1349
ExplicitSpecifier getExplicitSpecifier()
Definition: DeclCXX.h:2086
size_t param_size() const
Definition: Decl.h:4017
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:1737
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:4155
bool isParamDestroyedInCallee() const
Definition: Decl.h:3788
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void VisitFunctionDecl(FunctionDecl *D)
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
unsigned clauselist_size() const
Definition: DeclOpenMP.h:267
bool hasTypename() const
Return true if the using declaration has &#39;typename&#39;.
Definition: DeclCXX.h:3535
SourceManager & getSourceManager()
Definition: ASTContext.h:665
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Definition: Decl.h:2391
bool capturesCXXThis() const
Definition: Decl.h:4047
ImplementationControl getImplementationControl() const
Definition: DeclObjC.h:481
static bool classofKind(Kind K)
Definition: DeclCXX.h:1994
void VisitDecl(Decl *D)
SourceRange getAtEndRange() const
Definition: DeclObjC.h:1121
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1657
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:2031
Represents a field declaration created by an @defs(...).
Definition: DeclObjC.h:2011
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2412
void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:3307
bool isMutable() const
Determines whether this field is mutable (C++ only).
Definition: Decl.h:2682
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Definition: Decl.h:3197
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:4297
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:1329
static void addExplicitSpecifier(ExplicitSpecifier ES, ASTRecordWriter &Record)
An object for streaming information to a record.
Definition: ASTWriter.h:748
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:3550
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1944
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:944
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
Definition: ASTCommon.cpp:412
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:664
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1336
void VisitEnumConstantDecl(EnumConstantDecl *D)
SourceLocation getFriendLoc() const
Retrieves the location of the &#39;friend&#39; keyword.
bool isFailed() const
Definition: DeclCXX.h:3903
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1327
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:636
ImplicitParamDecl * getCmdDecl() const
Definition: DeclObjC.h:415
void VisitClassScopeFunctionSpecializationDecl(ClassScopeFunctionSpecializationDecl *D)
bool isVariadic() const
Definition: DeclObjC.h:426
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:103
VarTemplateDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this template.
This represents &#39;#pragma omp declare mapper ...&#39; directive.
Definition: DeclOpenMP.h:217
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
Definition: ASTBitCodes.h:1287
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1300
unsigned clauselist_size() const
Definition: DeclOpenMP.h:387
varlist_range varlists()
Definition: DeclOpenMP.h:491
unsigned protocol_size() const
Definition: DeclObjC.h:2364
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Definition: Decl.h:3513
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Definition: Decl.h:2003
An ExportDecl record.
Definition: ASTBitCodes.h:1430
bool blockMissingReturnType() const
Definition: Decl.h:4050
Expr * getCombinerIn()
Get In variable of the combiner.
Definition: DeclOpenMP.h:155
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Definition: DeclCXX.h:3848
unsigned varlist_size() const
Definition: DeclOpenMP.h:74
size_t size() const
Definition: ASTWriter.h:802
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Definition: Redeclarable.h:225
void VisitFriendDecl(FriendDecl *D)
The top declaration context.
Definition: Decl.h: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:4001
NamedDecl * getMostRecentDecl()
Definition: Decl.h:445
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2817
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
bool hasObjectMember() const
Definition: Decl.h:3707
void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D)
Expr * getBinding() const
Get the expression to which this declaration is bound.
Definition: DeclCXX.h:3947
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:1162
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3399
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1478
ModuleFile * getOwningModuleFile(const Decl *D)
Retrieve the module file that owns the given declaration, or NULL if the declaration is not from a mo...
Definition: ASTReader.cpp:7679
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1490
void VisitImportDecl(ImportDecl *D)
varlist_range varlists()
Definition: DeclOpenMP.h:77
bool isStaticDataMember() const
Determines whether this is a static data member.
Definition: Decl.h: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:4051
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:3237
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:607
void VisitOMPAllocateDecl(OMPAllocateDecl *D)
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:921
bool isRedeclaration() const
True if this is a method redeclaration in the same interface.
Definition: DeclObjC.h:266
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:3148
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:1368
AccessControl getAccessControl() const
Definition: DeclObjC.h:1983
Declaration of a friend template.
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2418
bool isPropertyAccessor() const
Definition: DeclObjC.h:431
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:3666
Expr * getConstraintExpr() const
Selector getGetterName() const
Definition: DeclObjC.h:905
Represents C++ using-directive.
Definition: DeclCXX.h:3044
SourceLocation getLParenLoc() const
Definition: DeclObjC.h:823
SourceLocation getEndOfDefinitionLoc() const
Definition: DeclObjC.h:1877
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:704
NamedDecl * getFriendDecl() const
If this friend declaration names a templated function (or a member function of a templated type)...
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
Expr * getCombinerOut()
Get Out variable of the combiner.
Definition: DeclOpenMP.h:158
void VisitObjCMethodDecl(ObjCMethodDecl *D)
bool isFreeStanding() const
True if this tag is free standing, e.g. "struct foo;".
Definition: Decl.h:3237
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:676
This represents &#39;#pragma omp threadprivate ...&#39; directive.
Definition: DeclOpenMP.h:39
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2498
This class handles loading and caching of source files into memory.
void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D)
void VisitValueDecl(ValueDecl *D)
Declaration of a template function.
Source range/offset of a preprocessed entity.
Definition: ASTBitCodes.h:220
SourceLocation getLocation() const
Definition: DeclBase.h:429
const StringLiteral * getAsmString() const
Definition: Decl.h:3904
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:3267
Represents a pack of using declarations that a single using-declarator pack-expanded into...
Definition: DeclCXX.h:3630
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:366
void VisitObjCIvarDecl(ObjCIvarDecl *D)
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:162
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2728
This is a C++ Modules TS module interface unit.
Definition: Module.h:78