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