clang  3.9.0
ASTWriterDecl.cpp
Go to the documentation of this file.
1 //===--- ASTWriterDecl.cpp - Declaration Serialization --------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements serialization for Declarations.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "ASTCommon.h"
16 #include "clang/AST/DeclCXX.h"
18 #include "clang/AST/DeclTemplate.h"
19 #include "clang/AST/DeclVisitor.h"
20 #include "clang/AST/Expr.h"
23 #include "llvm/ADT/Twine.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;
37  ASTRecordWriter Record;
38 
40  unsigned AbbrevToUse;
41 
42  public:
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 VisitCXXMethodDecl(CXXMethodDecl *D);
91  void VisitCXXConstructorDecl(CXXConstructorDecl *D);
92  void VisitCXXDestructorDecl(CXXDestructorDecl *D);
93  void VisitCXXConversionDecl(CXXConversionDecl *D);
94  void VisitFieldDecl(FieldDecl *D);
95  void VisitMSPropertyDecl(MSPropertyDecl *D);
96  void VisitIndirectFieldDecl(IndirectFieldDecl *D);
97  void VisitVarDecl(VarDecl *D);
98  void VisitImplicitParamDecl(ImplicitParamDecl *D);
99  void VisitParmVarDecl(ParmVarDecl *D);
100  void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D);
101  void VisitTemplateDecl(TemplateDecl *D);
102  void VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D);
103  void VisitClassTemplateDecl(ClassTemplateDecl *D);
104  void VisitVarTemplateDecl(VarTemplateDecl *D);
105  void VisitFunctionTemplateDecl(FunctionTemplateDecl *D);
106  void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D);
107  void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D);
108  void VisitUsingDecl(UsingDecl *D);
109  void VisitUsingShadowDecl(UsingShadowDecl *D);
110  void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D);
111  void VisitLinkageSpecDecl(LinkageSpecDecl *D);
112  void VisitFileScopeAsmDecl(FileScopeAsmDecl *D);
113  void VisitImportDecl(ImportDecl *D);
114  void VisitAccessSpecDecl(AccessSpecDecl *D);
115  void VisitFriendDecl(FriendDecl *D);
116  void VisitFriendTemplateDecl(FriendTemplateDecl *D);
117  void VisitStaticAssertDecl(StaticAssertDecl *D);
118  void VisitBlockDecl(BlockDecl *D);
119  void VisitCapturedDecl(CapturedDecl *D);
120  void VisitEmptyDecl(EmptyDecl *D);
121 
122  void VisitDeclContext(DeclContext *DC);
123  template <typename T> void VisitRedeclarable(Redeclarable<T> *D);
124 
125 
126  // FIXME: Put in the same order is DeclNodes.td?
127  void VisitObjCMethodDecl(ObjCMethodDecl *D);
128  void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D);
129  void VisitObjCContainerDecl(ObjCContainerDecl *D);
130  void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D);
131  void VisitObjCIvarDecl(ObjCIvarDecl *D);
132  void VisitObjCProtocolDecl(ObjCProtocolDecl *D);
133  void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D);
134  void VisitObjCCategoryDecl(ObjCCategoryDecl *D);
135  void VisitObjCImplDecl(ObjCImplDecl *D);
136  void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D);
137  void VisitObjCImplementationDecl(ObjCImplementationDecl *D);
138  void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D);
139  void VisitObjCPropertyDecl(ObjCPropertyDecl *D);
140  void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D);
141  void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D);
142  void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D);
143  void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D);
144 
145  /// Add an Objective-C type parameter list to the given record.
147  // Empty type parameter list.
148  if (!typeParams) {
149  Record.push_back(0);
150  return;
151  }
152 
153  Record.push_back(typeParams->size());
154  for (auto typeParam : *typeParams) {
155  Record.AddDeclRef(typeParam);
156  }
157  Record.AddSourceLocation(typeParams->getLAngleLoc());
158  Record.AddSourceLocation(typeParams->getRAngleLoc());
159  }
160 
161  /// Add to the record the first declaration from each module file that
162  /// provides a declaration of D. The intent is to provide a sufficient
163  /// set such that reloading this set will load all current redeclarations.
164  void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal) {
165  llvm::MapVector<ModuleFile*, const Decl*> Firsts;
166  // FIXME: We can skip entries that we know are implied by others.
167  for (const Decl *R = D->getMostRecentDecl(); R; R = R->getPreviousDecl()) {
168  if (R->isFromASTFile())
169  Firsts[Writer.Chain->getOwningModuleFile(R)] = R;
170  else if (IncludeLocal)
171  Firsts[nullptr] = R;
172  }
173  for (const auto &F : Firsts)
174  Record.AddDeclRef(F.second);
175  }
176 
177  /// Get the specialization decl from an entry in the specialization list.
178  template <typename EntryType>
180  getSpecializationDecl(EntryType &T) {
182  }
183 
184  /// Get the list of partial specializations from a template's common ptr.
185  template<typename T>
186  decltype(T::PartialSpecializations) &getPartialSpecializations(T *Common) {
187  return Common->PartialSpecializations;
188  }
190  return None;
191  }
192 
193  template<typename DeclTy>
194  void AddTemplateSpecializations(DeclTy *D) {
195  auto *Common = D->getCommonPtr();
196 
197  // If we have any lazy specializations, and the external AST source is
198  // our chained AST reader, we can just write out the DeclIDs. Otherwise,
199  // we need to resolve them to actual declarations.
200  if (Writer.Chain != Writer.Context->getExternalSource() &&
201  Common->LazySpecializations) {
202  D->LoadLazySpecializations();
203  assert(!Common->LazySpecializations);
204  }
205 
206  ArrayRef<DeclID> LazySpecializations;
207  if (auto *LS = Common->LazySpecializations)
208  LazySpecializations = llvm::makeArrayRef(LS + 1, LS[0]);
209 
210  // Add a slot to the record for the number of specializations.
211  unsigned I = Record.size();
212  Record.push_back(0);
213 
214  // AddFirstDeclFromEachModule might trigger deserialization, invalidating
215  // *Specializations iterators.
217  for (auto &Entry : Common->Specializations)
218  Specs.push_back(getSpecializationDecl(Entry));
219  for (auto &Entry : getPartialSpecializations(Common))
220  Specs.push_back(getSpecializationDecl(Entry));
221 
222  for (auto *D : Specs) {
223  assert(D->isCanonicalDecl() && "non-canonical decl in set");
224  AddFirstDeclFromEachModule(D, /*IncludeLocal*/true);
225  }
226  Record.append(LazySpecializations.begin(), LazySpecializations.end());
227 
228  // Update the size entry we added earlier.
229  Record[I] = Record.size() - I - 1;
230  }
231 
232  /// Ensure that this template specialization is associated with the specified
233  /// template on reload.
234  void RegisterTemplateSpecialization(const Decl *Template,
235  const Decl *Specialization) {
236  Template = Template->getCanonicalDecl();
237 
238  // If the canonical template is local, we'll write out this specialization
239  // when we emit it.
240  // FIXME: We can do the same thing if there is any local declaration of
241  // the template, to avoid emitting an update record.
242  if (!Template->isFromASTFile())
243  return;
244 
245  // We only need to associate the first local declaration of the
246  // specialization. The other declarations will get pulled in by it.
247  if (Writer.getFirstLocalDecl(Specialization) != Specialization)
248  return;
249 
250  Writer.DeclUpdates[Template].push_back(ASTWriter::DeclUpdate(
251  UPD_CXX_ADDED_TEMPLATE_SPECIALIZATION, Specialization));
252  }
253  };
254 }
255 
258 
259  // Source locations require array (variable-length) abbreviations. The
260  // abbreviation infrastructure requires that arrays are encoded last, so
261  // we handle it here in the case of those classes derived from DeclaratorDecl
262  if (DeclaratorDecl *DD = dyn_cast<DeclaratorDecl>(D)) {
263  Record.AddTypeSourceInfo(DD->getTypeSourceInfo());
264  }
265 
266  // Handle FunctionDecl's body here and write it after all other Stmts/Exprs
267  // have been written. We want it last because we will not read it back when
268  // retrieving it from the AST, we'll just lazily set the offset.
269  if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
270  Record.push_back(FD->doesThisDeclarationHaveABody());
271  if (FD->doesThisDeclarationHaveABody())
272  Record.AddFunctionDefinition(FD);
273  }
274 
275  // If this declaration is also a DeclContext, write blocks for the
276  // declarations that lexically stored inside its context and those
277  // declarations that are visible from its context.
278  if (DeclContext *DC = dyn_cast<DeclContext>(D))
279  VisitDeclContext(DC);
280 }
281 
283  Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
284  if (D->getDeclContext() != D->getLexicalDeclContext())
285  Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
286  else
287  Record.push_back(0);
288  Record.push_back(D->isInvalidDecl());
289  Record.push_back(D->hasAttrs());
290  if (D->hasAttrs())
291  Record.AddAttributes(D->getAttrs());
292  Record.push_back(D->isImplicit());
293  Record.push_back(D->isUsed(false));
294  Record.push_back(D->isReferenced());
295  Record.push_back(D->isTopLevelDeclInObjCContainer());
296  Record.push_back(D->getAccess());
297  Record.push_back(D->isModulePrivate());
298  Record.push_back(Writer.inferSubmoduleIDFromLocation(D->getLocation()));
299 
300  // If this declaration injected a name into a context different from its
301  // lexical context, and that context is an imported namespace, we need to
302  // update its visible declarations to include this name.
303  //
304  // This happens when we instantiate a class with a friend declaration or a
305  // function with a local extern declaration, for instance.
306  //
307  // FIXME: Can we handle this in AddedVisibleDecl instead?
308  if (D->isOutOfLine()) {
309  auto *DC = D->getDeclContext();
310  while (auto *NS = dyn_cast<NamespaceDecl>(DC->getRedeclContext())) {
311  if (!NS->isFromASTFile())
312  break;
313  Writer.UpdatedDeclContexts.insert(NS->getPrimaryContext());
314  if (!NS->isInlineNamespace())
315  break;
316  DC = NS->getParent();
317  }
318  }
319 }
320 
322  StringRef Arg = D->getArg();
323  Record.push_back(Arg.size());
324  VisitDecl(D);
325  Record.AddSourceLocation(D->getLocStart());
326  Record.push_back(D->getCommentKind());
327  Record.AddString(Arg);
329 }
330 
333  StringRef Name = D->getName();
334  StringRef Value = D->getValue();
335  Record.push_back(Name.size() + 1 + Value.size());
336  VisitDecl(D);
337  Record.AddSourceLocation(D->getLocStart());
338  Record.AddString(Name);
339  Record.AddString(Value);
341 }
342 
344  llvm_unreachable("Translation units aren't directly serialized");
345 }
346 
348  VisitDecl(D);
349  Record.AddDeclarationName(D->getDeclName());
350  Record.push_back(needsAnonymousDeclarationNumber(D)
351  ? Writer.getAnonymousDeclarationNumber(D)
352  : 0);
353 }
354 
356  VisitNamedDecl(D);
357  Record.AddSourceLocation(D->getLocStart());
358  Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
359 }
360 
362  VisitRedeclarable(D);
363  VisitTypeDecl(D);
364  Record.AddTypeSourceInfo(D->getTypeSourceInfo());
365  Record.push_back(D->isModed());
366  if (D->isModed())
367  Record.AddTypeRef(D->getUnderlyingType());
368 }
369 
371  VisitTypedefNameDecl(D);
372  if (D->getDeclContext() == D->getLexicalDeclContext() &&
373  !D->hasAttrs() &&
374  !D->isImplicit() &&
375  D->getFirstDecl() == D->getMostRecentDecl() &&
376  !D->isInvalidDecl() &&
377  !D->isTopLevelDeclInObjCContainer() &&
378  !D->isModulePrivate() &&
381  AbbrevToUse = Writer.getDeclTypedefAbbrev();
382 
384 }
385 
387  VisitTypedefNameDecl(D);
388  Record.AddDeclRef(D->getDescribedAliasTemplate());
390 }
391 
393  VisitRedeclarable(D);
394  VisitTypeDecl(D);
395  Record.push_back(D->getIdentifierNamespace());
396  Record.push_back((unsigned)D->getTagKind()); // FIXME: stable encoding
397  if (!isa<CXXRecordDecl>(D))
398  Record.push_back(D->isCompleteDefinition());
399  Record.push_back(D->isEmbeddedInDeclarator());
400  Record.push_back(D->isFreeStanding());
401  Record.push_back(D->isCompleteDefinitionRequired());
402  Record.AddSourceRange(D->getBraceRange());
403 
404  if (D->hasExtInfo()) {
405  Record.push_back(1);
406  Record.AddQualifierInfo(*D->getExtInfo());
407  } else if (auto *TD = D->getTypedefNameForAnonDecl()) {
408  Record.push_back(2);
409  Record.AddDeclRef(TD);
410  Record.AddIdentifierRef(TD->getDeclName().getAsIdentifierInfo());
411  } else {
412  Record.push_back(0);
413  }
414 }
415 
417  VisitTagDecl(D);
418  Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
419  if (!D->getIntegerTypeSourceInfo())
420  Record.AddTypeRef(D->getIntegerType());
421  Record.AddTypeRef(D->getPromotionType());
422  Record.push_back(D->getNumPositiveBits());
423  Record.push_back(D->getNumNegativeBits());
424  Record.push_back(D->isScoped());
425  Record.push_back(D->isScopedUsingClassTag());
426  Record.push_back(D->isFixed());
427  if (MemberSpecializationInfo *MemberInfo = D->getMemberSpecializationInfo()) {
428  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
429  Record.push_back(MemberInfo->getTemplateSpecializationKind());
430  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
431  } else {
432  Record.AddDeclRef(nullptr);
433  }
434 
435  if (D->getDeclContext() == D->getLexicalDeclContext() &&
436  !D->hasAttrs() &&
437  !D->isImplicit() &&
438  !D->isUsed(false) &&
439  !D->hasExtInfo() &&
441  D->getFirstDecl() == D->getMostRecentDecl() &&
442  !D->isInvalidDecl() &&
443  !D->isReferenced() &&
444  !D->isTopLevelDeclInObjCContainer() &&
445  D->getAccess() == AS_none &&
446  !D->isModulePrivate() &&
447  !CXXRecordDecl::classofKind(D->getKind()) &&
448  !D->getIntegerTypeSourceInfo() &&
452  AbbrevToUse = Writer.getDeclEnumAbbrev();
453 
455 }
456 
458  VisitTagDecl(D);
459  Record.push_back(D->hasFlexibleArrayMember());
460  Record.push_back(D->isAnonymousStructOrUnion());
461  Record.push_back(D->hasObjectMember());
462  Record.push_back(D->hasVolatileMember());
463 
464  if (D->getDeclContext() == D->getLexicalDeclContext() &&
465  !D->hasAttrs() &&
466  !D->isImplicit() &&
467  !D->isUsed(false) &&
468  !D->hasExtInfo() &&
470  D->getFirstDecl() == D->getMostRecentDecl() &&
471  !D->isInvalidDecl() &&
472  !D->isReferenced() &&
473  !D->isTopLevelDeclInObjCContainer() &&
474  D->getAccess() == AS_none &&
475  !D->isModulePrivate() &&
476  !CXXRecordDecl::classofKind(D->getKind()) &&
479  AbbrevToUse = Writer.getDeclRecordAbbrev();
480 
482 }
483 
485  VisitNamedDecl(D);
486  Record.AddTypeRef(D->getType());
487 }
488 
490  VisitValueDecl(D);
491  Record.push_back(D->getInitExpr()? 1 : 0);
492  if (D->getInitExpr())
493  Record.AddStmt(D->getInitExpr());
494  Record.AddAPSInt(D->getInitVal());
495 
497 }
498 
500  VisitValueDecl(D);
501  Record.AddSourceLocation(D->getInnerLocStart());
502  Record.push_back(D->hasExtInfo());
503  if (D->hasExtInfo())
504  Record.AddQualifierInfo(*D->getExtInfo());
505 }
506 
508  VisitRedeclarable(D);
509  VisitDeclaratorDecl(D);
510  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
511  Record.push_back(D->getIdentifierNamespace());
512 
513  // FunctionDecl's body is handled last at ASTWriterDecl::Visit,
514  // after everything else is written.
515 
516  Record.push_back((int)D->SClass); // FIXME: stable encoding
517  Record.push_back(D->IsInline);
518  Record.push_back(D->IsInlineSpecified);
519  Record.push_back(D->IsVirtualAsWritten);
520  Record.push_back(D->IsPure);
521  Record.push_back(D->HasInheritedPrototype);
522  Record.push_back(D->HasWrittenPrototype);
523  Record.push_back(D->IsDeleted);
524  Record.push_back(D->IsTrivial);
525  Record.push_back(D->IsDefaulted);
526  Record.push_back(D->IsExplicitlyDefaulted);
527  Record.push_back(D->HasImplicitReturnZero);
528  Record.push_back(D->IsConstexpr);
529  Record.push_back(D->HasSkippedBody);
530  Record.push_back(D->IsLateTemplateParsed);
531  Record.push_back(D->getLinkageInternal());
532  Record.AddSourceLocation(D->getLocEnd());
533 
534  Record.push_back(D->getTemplatedKind());
535  switch (D->getTemplatedKind()) {
537  break;
539  Record.AddDeclRef(D->getDescribedFunctionTemplate());
540  break;
543  Record.AddDeclRef(MemberInfo->getInstantiatedFrom());
544  Record.push_back(MemberInfo->getTemplateSpecializationKind());
545  Record.AddSourceLocation(MemberInfo->getPointOfInstantiation());
546  break;
547  }
550  FTSInfo = D->getTemplateSpecializationInfo();
551 
552  RegisterTemplateSpecialization(FTSInfo->getTemplate(), D);
553 
554  Record.AddDeclRef(FTSInfo->getTemplate());
555  Record.push_back(FTSInfo->getTemplateSpecializationKind());
556 
557  // Template arguments.
558  Record.AddTemplateArgumentList(FTSInfo->TemplateArguments);
559 
560  // Template args as written.
561  Record.push_back(FTSInfo->TemplateArgumentsAsWritten != nullptr);
562  if (FTSInfo->TemplateArgumentsAsWritten) {
563  Record.push_back(FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs);
564  for (int i=0, e = FTSInfo->TemplateArgumentsAsWritten->NumTemplateArgs;
565  i!=e; ++i)
566  Record.AddTemplateArgumentLoc(
567  (*FTSInfo->TemplateArgumentsAsWritten)[i]);
568  Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->LAngleLoc);
569  Record.AddSourceLocation(FTSInfo->TemplateArgumentsAsWritten->RAngleLoc);
570  }
571 
572  Record.AddSourceLocation(FTSInfo->getPointOfInstantiation());
573 
574  if (D->isCanonicalDecl()) {
575  // Write the template that contains the specializations set. We will
576  // add a FunctionTemplateSpecializationInfo to it when reading.
577  Record.AddDeclRef(FTSInfo->getTemplate()->getCanonicalDecl());
578  }
579  break;
580  }
583  DFTSInfo = D->getDependentSpecializationInfo();
584 
585  // Templates.
586  Record.push_back(DFTSInfo->getNumTemplates());
587  for (int i=0, e = DFTSInfo->getNumTemplates(); i != e; ++i)
588  Record.AddDeclRef(DFTSInfo->getTemplate(i));
589 
590  // Templates args.
591  Record.push_back(DFTSInfo->getNumTemplateArgs());
592  for (int i=0, e = DFTSInfo->getNumTemplateArgs(); i != e; ++i)
593  Record.AddTemplateArgumentLoc(DFTSInfo->getTemplateArg(i));
594  Record.AddSourceLocation(DFTSInfo->getLAngleLoc());
595  Record.AddSourceLocation(DFTSInfo->getRAngleLoc());
596  break;
597  }
598  }
599 
600  Record.push_back(D->param_size());
601  for (auto P : D->parameters())
602  Record.AddDeclRef(P);
604 }
605 
607  VisitNamedDecl(D);
608  // FIXME: convert to LazyStmtPtr?
609  // Unlike C/C++, method bodies will never be in header files.
610  bool HasBodyStuff = D->getBody() != nullptr ||
611  D->getSelfDecl() != nullptr || D->getCmdDecl() != nullptr;
612  Record.push_back(HasBodyStuff);
613  if (HasBodyStuff) {
614  Record.AddStmt(D->getBody());
615  Record.AddDeclRef(D->getSelfDecl());
616  Record.AddDeclRef(D->getCmdDecl());
617  }
618  Record.push_back(D->isInstanceMethod());
619  Record.push_back(D->isVariadic());
620  Record.push_back(D->isPropertyAccessor());
621  Record.push_back(D->isDefined());
622  Record.push_back(D->IsOverriding);
623  Record.push_back(D->HasSkippedBody);
624 
625  Record.push_back(D->IsRedeclaration);
626  Record.push_back(D->HasRedeclaration);
627  if (D->HasRedeclaration) {
629  Record.AddDeclRef(Context.getObjCMethodRedeclaration(D));
630  }
631 
632  // FIXME: stable encoding for @required/@optional
633  Record.push_back(D->getImplementationControl());
634  // FIXME: stable encoding for in/out/inout/bycopy/byref/oneway/nullability
635  Record.push_back(D->getObjCDeclQualifier());
636  Record.push_back(D->hasRelatedResultType());
637  Record.AddTypeRef(D->getReturnType());
638  Record.AddTypeSourceInfo(D->getReturnTypeSourceInfo());
639  Record.AddSourceLocation(D->getLocEnd());
640  Record.push_back(D->param_size());
641  for (const auto *P : D->parameters())
642  Record.AddDeclRef(P);
643 
644  Record.push_back(D->SelLocsKind);
645  unsigned NumStoredSelLocs = D->getNumStoredSelLocs();
646  SourceLocation *SelLocs = D->getStoredSelLocs();
647  Record.push_back(NumStoredSelLocs);
648  for (unsigned i = 0; i != NumStoredSelLocs; ++i)
649  Record.AddSourceLocation(SelLocs[i]);
650 
652 }
653 
655  VisitTypedefNameDecl(D);
656  Record.push_back(D->Variance);
657  Record.push_back(D->Index);
658  Record.AddSourceLocation(D->VarianceLoc);
659  Record.AddSourceLocation(D->ColonLoc);
660 
662 }
663 
665  VisitNamedDecl(D);
666  Record.AddSourceLocation(D->getAtStartLoc());
667  Record.AddSourceRange(D->getAtEndRange());
668  // Abstract class (no need to define a stable serialization::DECL code).
669 }
670 
672  VisitRedeclarable(D);
673  VisitObjCContainerDecl(D);
674  Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
675  AddObjCTypeParamList(D->TypeParamList);
676 
677  Record.push_back(D->isThisDeclarationADefinition());
678  if (D->isThisDeclarationADefinition()) {
679  // Write the DefinitionData
680  ObjCInterfaceDecl::DefinitionData &Data = D->data();
681 
682  Record.AddTypeSourceInfo(D->getSuperClassTInfo());
683  Record.AddSourceLocation(D->getEndOfDefinitionLoc());
684  Record.push_back(Data.HasDesignatedInitializers);
685 
686  // Write out the protocols that are directly referenced by the @interface.
687  Record.push_back(Data.ReferencedProtocols.size());
688  for (const auto *P : D->protocols())
689  Record.AddDeclRef(P);
690  for (const auto &PL : D->protocol_locs())
691  Record.AddSourceLocation(PL);
692 
693  // Write out the protocols that are transitively referenced.
694  Record.push_back(Data.AllReferencedProtocols.size());
696  P = Data.AllReferencedProtocols.begin(),
697  PEnd = Data.AllReferencedProtocols.end();
698  P != PEnd; ++P)
699  Record.AddDeclRef(*P);
700 
701 
702  if (ObjCCategoryDecl *Cat = D->getCategoryListRaw()) {
703  // Ensure that we write out the set of categories for this class.
704  Writer.ObjCClassesWithCategories.insert(D);
705 
706  // Make sure that the categories get serialized.
707  for (; Cat; Cat = Cat->getNextClassCategoryRaw())
708  (void)Writer.GetDeclRef(Cat);
709  }
710  }
711 
713 }
714 
716  VisitFieldDecl(D);
717  // FIXME: stable encoding for @public/@private/@protected/@package
718  Record.push_back(D->getAccessControl());
719  Record.push_back(D->getSynthesize());
720 
721  if (D->getDeclContext() == D->getLexicalDeclContext() &&
722  !D->hasAttrs() &&
723  !D->isImplicit() &&
724  !D->isUsed(false) &&
725  !D->isInvalidDecl() &&
726  !D->isReferenced() &&
727  !D->isModulePrivate() &&
728  !D->getBitWidth() &&
729  !D->hasExtInfo() &&
730  D->getDeclName())
731  AbbrevToUse = Writer.getDeclObjCIvarAbbrev();
732 
734 }
735 
737  VisitRedeclarable(D);
738  VisitObjCContainerDecl(D);
739 
740  Record.push_back(D->isThisDeclarationADefinition());
741  if (D->isThisDeclarationADefinition()) {
742  Record.push_back(D->protocol_size());
743  for (const auto *I : D->protocols())
744  Record.AddDeclRef(I);
745  for (const auto &PL : D->protocol_locs())
746  Record.AddSourceLocation(PL);
747  }
748 
750 }
751 
753  VisitFieldDecl(D);
755 }
756 
758  VisitObjCContainerDecl(D);
759  Record.AddSourceLocation(D->getCategoryNameLoc());
760  Record.AddSourceLocation(D->getIvarLBraceLoc());
761  Record.AddSourceLocation(D->getIvarRBraceLoc());
762  Record.AddDeclRef(D->getClassInterface());
763  AddObjCTypeParamList(D->TypeParamList);
764  Record.push_back(D->protocol_size());
765  for (const auto *I : D->protocols())
766  Record.AddDeclRef(I);
767  for (const auto &PL : D->protocol_locs())
768  Record.AddSourceLocation(PL);
770 }
771 
773  VisitNamedDecl(D);
774  Record.AddDeclRef(D->getClassInterface());
776 }
777 
779  VisitNamedDecl(D);
780  Record.AddSourceLocation(D->getAtLoc());
781  Record.AddSourceLocation(D->getLParenLoc());
782  Record.AddTypeRef(D->getType());
783  Record.AddTypeSourceInfo(D->getTypeSourceInfo());
784  // FIXME: stable encoding
785  Record.push_back((unsigned)D->getPropertyAttributes());
786  Record.push_back((unsigned)D->getPropertyAttributesAsWritten());
787  // FIXME: stable encoding
788  Record.push_back((unsigned)D->getPropertyImplementation());
789  Record.AddDeclarationName(D->getGetterName());
790  Record.AddDeclarationName(D->getSetterName());
791  Record.AddDeclRef(D->getGetterMethodDecl());
792  Record.AddDeclRef(D->getSetterMethodDecl());
793  Record.AddDeclRef(D->getPropertyIvarDecl());
795 }
796 
798  VisitObjCContainerDecl(D);
799  Record.AddDeclRef(D->getClassInterface());
800  // Abstract class (no need to define a stable serialization::DECL code).
801 }
802 
804  VisitObjCImplDecl(D);
805  Record.AddIdentifierRef(D->getIdentifier());
806  Record.AddSourceLocation(D->getCategoryNameLoc());
808 }
809 
811  VisitObjCImplDecl(D);
812  Record.AddDeclRef(D->getSuperClass());
813  Record.AddSourceLocation(D->getSuperClassLoc());
814  Record.AddSourceLocation(D->getIvarLBraceLoc());
815  Record.AddSourceLocation(D->getIvarRBraceLoc());
816  Record.push_back(D->hasNonZeroConstructors());
817  Record.push_back(D->hasDestructors());
818  Record.push_back(D->NumIvarInitializers);
819  if (D->NumIvarInitializers)
820  Record.AddCXXCtorInitializers(
821  llvm::makeArrayRef(D->init_begin(), D->init_end()));
823 }
824 
826  VisitDecl(D);
827  Record.AddSourceLocation(D->getLocStart());
828  Record.AddDeclRef(D->getPropertyDecl());
829  Record.AddDeclRef(D->getPropertyIvarDecl());
830  Record.AddSourceLocation(D->getPropertyIvarDeclLoc());
831  Record.AddStmt(D->getGetterCXXConstructor());
832  Record.AddStmt(D->getSetterCXXAssignment());
834 }
835 
837  VisitDeclaratorDecl(D);
838  Record.push_back(D->isMutable());
839  if (D->InitStorage.getInt() == FieldDecl::ISK_BitWidthOrNothing &&
840  D->InitStorage.getPointer() == nullptr) {
841  Record.push_back(0);
842  } else if (D->InitStorage.getInt() == FieldDecl::ISK_CapturedVLAType) {
843  Record.push_back(D->InitStorage.getInt() + 1);
844  Record.AddTypeRef(
845  QualType(static_cast<Type *>(D->InitStorage.getPointer()), 0));
846  } else {
847  Record.push_back(D->InitStorage.getInt() + 1);
848  Record.AddStmt(static_cast<Expr *>(D->InitStorage.getPointer()));
849  }
850  if (!D->getDeclName())
851  Record.AddDeclRef(Context.getInstantiatedFromUnnamedFieldDecl(D));
852 
853  if (D->getDeclContext() == D->getLexicalDeclContext() &&
854  !D->hasAttrs() &&
855  !D->isImplicit() &&
856  !D->isUsed(false) &&
857  !D->isInvalidDecl() &&
858  !D->isReferenced() &&
859  !D->isTopLevelDeclInObjCContainer() &&
860  !D->isModulePrivate() &&
861  !D->getBitWidth() &&
862  !D->hasInClassInitializer() &&
863  !D->hasExtInfo() &&
864  !ObjCIvarDecl::classofKind(D->getKind()) &&
865  !ObjCAtDefsFieldDecl::classofKind(D->getKind()) &&
866  D->getDeclName())
867  AbbrevToUse = Writer.getDeclFieldAbbrev();
868 
870 }
871 
873  VisitDeclaratorDecl(D);
874  Record.AddIdentifierRef(D->getGetterId());
875  Record.AddIdentifierRef(D->getSetterId());
877 }
878 
880  VisitValueDecl(D);
881  Record.push_back(D->getChainingSize());
882 
883  for (const auto *P : D->chain())
884  Record.AddDeclRef(P);
886 }
887 
889  VisitRedeclarable(D);
890  VisitDeclaratorDecl(D);
891  Record.push_back(D->getStorageClass());
892  Record.push_back(D->getTSCSpec());
893  Record.push_back(D->getInitStyle());
894  if (!isa<ParmVarDecl>(D)) {
895  Record.push_back(D->isExceptionVariable());
896  Record.push_back(D->isNRVOVariable());
897  Record.push_back(D->isCXXForRangeDecl());
898  Record.push_back(D->isARCPseudoStrong());
899  Record.push_back(D->isInline());
900  Record.push_back(D->isInlineSpecified());
901  Record.push_back(D->isConstexpr());
902  Record.push_back(D->isInitCapture());
903  Record.push_back(D->isPreviousDeclInSameBlockScope());
904  }
905  Record.push_back(D->getLinkageInternal());
906 
907  if (D->getInit()) {
908  Record.push_back(!D->isInitKnownICE() ? 1 : (D->isInitICE() ? 3 : 2));
909  Record.AddStmt(D->getInit());
910  } else {
911  Record.push_back(0);
912  }
913 
914  enum {
915  VarNotTemplate = 0, VarTemplate, StaticDataMemberSpecialization
916  };
917  if (VarTemplateDecl *TemplD = D->getDescribedVarTemplate()) {
918  Record.push_back(VarTemplate);
919  Record.AddDeclRef(TemplD);
920  } else if (MemberSpecializationInfo *SpecInfo
922  Record.push_back(StaticDataMemberSpecialization);
923  Record.AddDeclRef(SpecInfo->getInstantiatedFrom());
924  Record.push_back(SpecInfo->getTemplateSpecializationKind());
925  Record.AddSourceLocation(SpecInfo->getPointOfInstantiation());
926  } else {
927  Record.push_back(VarNotTemplate);
928  }
929 
930  if (D->getDeclContext() == D->getLexicalDeclContext() &&
931  !D->hasAttrs() &&
932  !D->isImplicit() &&
933  !D->isUsed(false) &&
934  !D->isInvalidDecl() &&
935  !D->isReferenced() &&
936  !D->isTopLevelDeclInObjCContainer() &&
937  D->getAccess() == AS_none &&
938  !D->isModulePrivate() &&
941  !D->hasExtInfo() &&
942  D->getFirstDecl() == D->getMostRecentDecl() &&
943  D->getInitStyle() == VarDecl::CInit &&
944  D->getInit() == nullptr &&
945  !isa<ParmVarDecl>(D) &&
946  !isa<VarTemplateSpecializationDecl>(D) &&
947  !D->isInline() &&
948  !D->isConstexpr() &&
949  !D->isInitCapture() &&
952  AbbrevToUse = Writer.getDeclVarAbbrev();
953 
955 }
956 
958  VisitVarDecl(D);
960 }
961 
963  VisitVarDecl(D);
964  Record.push_back(D->isObjCMethodParameter());
965  Record.push_back(D->getFunctionScopeDepth());
966  Record.push_back(D->getFunctionScopeIndex());
967  Record.push_back(D->getObjCDeclQualifier()); // FIXME: stable encoding
968  Record.push_back(D->isKNRPromoted());
969  Record.push_back(D->hasInheritedDefaultArg());
970  Record.push_back(D->hasUninstantiatedDefaultArg());
972  Record.AddStmt(D->getUninstantiatedDefaultArg());
974 
975  assert(!D->isARCPseudoStrong()); // can be true of ImplicitParamDecl
976 
977  // If the assumptions about the DECL_PARM_VAR abbrev are true, use it. Here
978  // we dynamically check for the properties that we optimize for, but don't
979  // know are true of all PARM_VAR_DECLs.
980  if (D->getDeclContext() == D->getLexicalDeclContext() &&
981  !D->hasAttrs() &&
982  !D->hasExtInfo() &&
983  !D->isImplicit() &&
984  !D->isUsed(false) &&
985  !D->isInvalidDecl() &&
986  !D->isReferenced() &&
987  D->getAccess() == AS_none &&
988  !D->isModulePrivate() &&
989  D->getStorageClass() == 0 &&
990  D->getInitStyle() == VarDecl::CInit && // Can params have anything else?
991  D->getFunctionScopeDepth() == 0 &&
992  D->getObjCDeclQualifier() == 0 &&
993  !D->isKNRPromoted() &&
994  !D->hasInheritedDefaultArg() &&
995  D->getInit() == nullptr &&
996  !D->hasUninstantiatedDefaultArg()) // No default expr.
997  AbbrevToUse = Writer.getDeclParmVarAbbrev();
998 
999  // Check things we know are true of *every* PARM_VAR_DECL, which is more than
1000  // just us assuming it.
1001  assert(!D->getTSCSpec() && "PARM_VAR_DECL can't use TLS");
1002  assert(D->getAccess() == AS_none && "PARM_VAR_DECL can't be public/private");
1003  assert(!D->isExceptionVariable() && "PARM_VAR_DECL can't be exception var");
1004  assert(D->getPreviousDecl() == nullptr && "PARM_VAR_DECL can't be redecl");
1005  assert(!D->isStaticDataMember() &&
1006  "PARM_VAR_DECL can't be static data member");
1007 }
1008 
1010  VisitDecl(D);
1011  Record.AddStmt(D->getAsmString());
1012  Record.AddSourceLocation(D->getRParenLoc());
1014 }
1015 
1017  VisitDecl(D);
1019 }
1020 
1022  VisitDecl(D);
1023  Record.AddStmt(D->getBody());
1024  Record.AddTypeSourceInfo(D->getSignatureAsWritten());
1025  Record.push_back(D->param_size());
1026  for (ParmVarDecl *P : D->parameters())
1027  Record.AddDeclRef(P);
1028  Record.push_back(D->isVariadic());
1029  Record.push_back(D->blockMissingReturnType());
1030  Record.push_back(D->isConversionFromLambda());
1031  Record.push_back(D->capturesCXXThis());
1032  Record.push_back(D->getNumCaptures());
1033  for (const auto &capture : D->captures()) {
1034  Record.AddDeclRef(capture.getVariable());
1035 
1036  unsigned flags = 0;
1037  if (capture.isByRef()) flags |= 1;
1038  if (capture.isNested()) flags |= 2;
1039  if (capture.hasCopyExpr()) flags |= 4;
1040  Record.push_back(flags);
1041 
1042  if (capture.hasCopyExpr()) Record.AddStmt(capture.getCopyExpr());
1043  }
1044 
1046 }
1047 
1049  Record.push_back(CD->getNumParams());
1050  VisitDecl(CD);
1051  Record.push_back(CD->getContextParamPosition());
1052  Record.push_back(CD->isNothrow() ? 1 : 0);
1053  // Body is stored by VisitCapturedStmt.
1054  for (unsigned I = 0; I < CD->getNumParams(); ++I)
1055  Record.AddDeclRef(CD->getParam(I));
1057 }
1058 
1060  VisitDecl(D);
1061  Record.push_back(D->getLanguage());
1062  Record.AddSourceLocation(D->getExternLoc());
1063  Record.AddSourceLocation(D->getRBraceLoc());
1065 }
1066 
1068  VisitNamedDecl(D);
1069  Record.AddSourceLocation(D->getLocStart());
1071 }
1072 
1073 
1075  VisitRedeclarable(D);
1076  VisitNamedDecl(D);
1077  Record.push_back(D->isInline());
1078  Record.AddSourceLocation(D->getLocStart());
1079  Record.AddSourceLocation(D->getRBraceLoc());
1080 
1081  if (D->isOriginalNamespace())
1082  Record.AddDeclRef(D->getAnonymousNamespace());
1084 
1085  if (Writer.hasChain() && D->isAnonymousNamespace() &&
1086  D == D->getMostRecentDecl()) {
1087  // This is a most recent reopening of the anonymous namespace. If its parent
1088  // is in a previous PCH (or is the TU), mark that parent for update, because
1089  // the original namespace always points to the latest re-opening of its
1090  // anonymous namespace.
1091  Decl *Parent = cast<Decl>(
1093  if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
1094  Writer.DeclUpdates[Parent].push_back(
1095  ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
1096  }
1097  }
1098 }
1099 
1101  VisitRedeclarable(D);
1102  VisitNamedDecl(D);
1103  Record.AddSourceLocation(D->getNamespaceLoc());
1104  Record.AddSourceLocation(D->getTargetNameLoc());
1105  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1106  Record.AddDeclRef(D->getNamespace());
1108 }
1109 
1111  VisitNamedDecl(D);
1112  Record.AddSourceLocation(D->getUsingLoc());
1113  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1114  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1115  Record.AddDeclRef(D->FirstUsingShadow.getPointer());
1116  Record.push_back(D->hasTypename());
1117  Record.AddDeclRef(Context.getInstantiatedFromUsingDecl(D));
1119 }
1120 
1122  VisitRedeclarable(D);
1123  VisitNamedDecl(D);
1124  Record.AddDeclRef(D->getTargetDecl());
1125  Record.AddDeclRef(D->UsingOrNextShadow);
1126  Record.AddDeclRef(Context.getInstantiatedFromUsingShadowDecl(D));
1128 }
1129 
1132  VisitUsingShadowDecl(D);
1133  Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
1134  Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
1135  Record.push_back(D->IsVirtual);
1137 }
1138 
1140  VisitNamedDecl(D);
1141  Record.AddSourceLocation(D->getUsingLoc());
1142  Record.AddSourceLocation(D->getNamespaceKeyLocation());
1143  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1144  Record.AddDeclRef(D->getNominatedNamespace());
1145  Record.AddDeclRef(dyn_cast<Decl>(D->getCommonAncestor()));
1147 }
1148 
1150  VisitValueDecl(D);
1151  Record.AddSourceLocation(D->getUsingLoc());
1152  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1153  Record.AddDeclarationNameLoc(D->DNLoc, D->getDeclName());
1155 }
1156 
1159  VisitTypeDecl(D);
1160  Record.AddSourceLocation(D->getTypenameLoc());
1161  Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
1163 }
1164 
1166  VisitRecordDecl(D);
1167 
1168  enum {
1169  CXXRecNotTemplate = 0, CXXRecTemplate, CXXRecMemberSpecialization
1170  };
1171  if (ClassTemplateDecl *TemplD = D->getDescribedClassTemplate()) {
1172  Record.push_back(CXXRecTemplate);
1173  Record.AddDeclRef(TemplD);
1174  } else if (MemberSpecializationInfo *MSInfo
1175  = D->getMemberSpecializationInfo()) {
1176  Record.push_back(CXXRecMemberSpecialization);
1177  Record.AddDeclRef(MSInfo->getInstantiatedFrom());
1178  Record.push_back(MSInfo->getTemplateSpecializationKind());
1179  Record.AddSourceLocation(MSInfo->getPointOfInstantiation());
1180  } else {
1181  Record.push_back(CXXRecNotTemplate);
1182  }
1183 
1184  Record.push_back(D->isThisDeclarationADefinition());
1186  Record.AddCXXDefinitionData(D);
1187 
1188  // Store (what we currently believe to be) the key function to avoid
1189  // deserializing every method so we can compute it.
1190  if (D->IsCompleteDefinition)
1191  Record.AddDeclRef(Context.getCurrentKeyFunction(D));
1192 
1194 }
1195 
1197  VisitFunctionDecl(D);
1198  if (D->isCanonicalDecl()) {
1199  Record.push_back(D->size_overridden_methods());
1202  I != E; ++I)
1203  Record.AddDeclRef(*I);
1204  } else {
1205  // We only need to record overridden methods once for the canonical decl.
1206  Record.push_back(0);
1207  }
1208 
1209  if (D->getDeclContext() == D->getLexicalDeclContext() &&
1210  D->getFirstDecl() == D->getMostRecentDecl() &&
1211  !D->isInvalidDecl() &&
1212  !D->hasAttrs() &&
1213  !D->isTopLevelDeclInObjCContainer() &&
1215  !D->hasExtInfo() &&
1216  !D->hasInheritedPrototype() &&
1217  D->hasWrittenPrototype())
1218  AbbrevToUse = Writer.getDeclCXXMethodAbbrev();
1219 
1221 }
1222 
1224  if (auto Inherited = D->getInheritedConstructor()) {
1225  Record.AddDeclRef(Inherited.getShadowDecl());
1226  Record.AddDeclRef(Inherited.getConstructor());
1228  } else {
1230  }
1231 
1232  VisitCXXMethodDecl(D);
1233 
1234  Record.push_back(D->IsExplicitSpecified);
1235 
1236  Code = D->isInheritingConstructor()
1239 }
1240 
1242  VisitCXXMethodDecl(D);
1243 
1244  Record.AddDeclRef(D->getOperatorDelete());
1245 
1247 }
1248 
1250  VisitCXXMethodDecl(D);
1251  Record.push_back(D->IsExplicitSpecified);
1253 }
1254 
1256  VisitDecl(D);
1257  Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
1258  ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
1259  Record.push_back(!IdentifierLocs.empty());
1260  if (IdentifierLocs.empty()) {
1261  Record.AddSourceLocation(D->getLocEnd());
1262  Record.push_back(1);
1263  } else {
1264  for (unsigned I = 0, N = IdentifierLocs.size(); I != N; ++I)
1265  Record.AddSourceLocation(IdentifierLocs[I]);
1266  Record.push_back(IdentifierLocs.size());
1267  }
1268  // Note: the number of source locations must always be the last element in
1269  // the record.
1271 }
1272 
1274  VisitDecl(D);
1275  Record.AddSourceLocation(D->getColonLoc());
1277 }
1278 
1280  // Record the number of friend type template parameter lists here
1281  // so as to simplify memory allocation during deserialization.
1282  Record.push_back(D->NumTPLists);
1283  VisitDecl(D);
1284  bool hasFriendDecl = D->Friend.is<NamedDecl*>();
1285  Record.push_back(hasFriendDecl);
1286  if (hasFriendDecl)
1287  Record.AddDeclRef(D->getFriendDecl());
1288  else
1289  Record.AddTypeSourceInfo(D->getFriendType());
1290  for (unsigned i = 0; i < D->NumTPLists; ++i)
1291  Record.AddTemplateParameterList(D->getFriendTypeTemplateParameterList(i));
1292  Record.AddDeclRef(D->getNextFriend());
1293  Record.push_back(D->UnsupportedFriend);
1294  Record.AddSourceLocation(D->FriendLoc);
1296 }
1297 
1299  VisitDecl(D);
1300  Record.push_back(D->getNumTemplateParameters());
1301  for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
1302  Record.AddTemplateParameterList(D->getTemplateParameterList(i));
1303  Record.push_back(D->getFriendDecl() != nullptr);
1304  if (D->getFriendDecl())
1305  Record.AddDeclRef(D->getFriendDecl());
1306  else
1307  Record.AddTypeSourceInfo(D->getFriendType());
1308  Record.AddSourceLocation(D->getFriendLoc());
1310 }
1311 
1313  VisitNamedDecl(D);
1314 
1315  Record.AddDeclRef(D->getTemplatedDecl());
1316  Record.AddTemplateParameterList(D->getTemplateParameters());
1317 }
1318 
1320  VisitRedeclarable(D);
1321 
1322  // Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
1323  // getCommonPtr() can be used while this is still initializing.
1324  if (D->isFirstDecl()) {
1325  // This declaration owns the 'common' pointer, so serialize that data now.
1326  Record.AddDeclRef(D->getInstantiatedFromMemberTemplate());
1328  Record.push_back(D->isMemberSpecialization());
1329  }
1330 
1331  VisitTemplateDecl(D);
1332  Record.push_back(D->getIdentifierNamespace());
1333 }
1334 
1336  VisitRedeclarableTemplateDecl(D);
1337 
1338  if (D->isFirstDecl())
1339  AddTemplateSpecializations(D);
1341 }
1342 
1345  RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
1346 
1347  VisitCXXRecordDecl(D);
1348 
1349  llvm::PointerUnion<ClassTemplateDecl *,
1352  if (Decl *InstFromD = InstFrom.dyn_cast<ClassTemplateDecl *>()) {
1353  Record.AddDeclRef(InstFromD);
1354  } else {
1355  Record.AddDeclRef(InstFrom.get<ClassTemplatePartialSpecializationDecl *>());
1356  Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1357  }
1358 
1359  Record.AddTemplateArgumentList(&D->getTemplateArgs());
1360  Record.AddSourceLocation(D->getPointOfInstantiation());
1361  Record.push_back(D->getSpecializationKind());
1362  Record.push_back(D->isCanonicalDecl());
1363 
1364  if (D->isCanonicalDecl()) {
1365  // When reading, we'll add it to the folding set of the following template.
1366  Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1367  }
1368 
1369  // Explicit info.
1370  Record.AddTypeSourceInfo(D->getTypeAsWritten());
1371  if (D->getTypeAsWritten()) {
1372  Record.AddSourceLocation(D->getExternLoc());
1373  Record.AddSourceLocation(D->getTemplateKeywordLoc());
1374  }
1375 
1377 }
1378 
1381  VisitClassTemplateSpecializationDecl(D);
1382 
1383  Record.AddTemplateParameterList(D->getTemplateParameters());
1384  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1385 
1386  // These are read/set from/to the first declaration.
1387  if (D->getPreviousDecl() == nullptr) {
1388  Record.AddDeclRef(D->getInstantiatedFromMember());
1389  Record.push_back(D->isMemberSpecialization());
1390  }
1391 
1393 }
1394 
1396  VisitRedeclarableTemplateDecl(D);
1397 
1398  if (D->isFirstDecl())
1399  AddTemplateSpecializations(D);
1401 }
1402 
1405  RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
1406 
1407  VisitVarDecl(D);
1408 
1409  llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
1410  InstFrom = D->getSpecializedTemplateOrPartial();
1411  if (Decl *InstFromD = InstFrom.dyn_cast<VarTemplateDecl *>()) {
1412  Record.AddDeclRef(InstFromD);
1413  } else {
1414  Record.AddDeclRef(InstFrom.get<VarTemplatePartialSpecializationDecl *>());
1415  Record.AddTemplateArgumentList(&D->getTemplateInstantiationArgs());
1416  }
1417 
1418  // Explicit info.
1419  Record.AddTypeSourceInfo(D->getTypeAsWritten());
1420  if (D->getTypeAsWritten()) {
1421  Record.AddSourceLocation(D->getExternLoc());
1422  Record.AddSourceLocation(D->getTemplateKeywordLoc());
1423  }
1424 
1425  Record.AddTemplateArgumentList(&D->getTemplateArgs());
1426  Record.AddSourceLocation(D->getPointOfInstantiation());
1427  Record.push_back(D->getSpecializationKind());
1428  Record.push_back(D->isCanonicalDecl());
1429 
1430  if (D->isCanonicalDecl()) {
1431  // When reading, we'll add it to the folding set of the following template.
1432  Record.AddDeclRef(D->getSpecializedTemplate()->getCanonicalDecl());
1433  }
1434 
1436 }
1437 
1440  VisitVarTemplateSpecializationDecl(D);
1441 
1442  Record.AddTemplateParameterList(D->getTemplateParameters());
1443  Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
1444 
1445  // These are read/set from/to the first declaration.
1446  if (D->getPreviousDecl() == nullptr) {
1447  Record.AddDeclRef(D->getInstantiatedFromMember());
1448  Record.push_back(D->isMemberSpecialization());
1449  }
1450 
1452 }
1453 
1456  VisitDecl(D);
1457  Record.AddDeclRef(D->getSpecialization());
1459 }
1460 
1461 
1463  VisitRedeclarableTemplateDecl(D);
1464 
1465  if (D->isFirstDecl())
1466  AddTemplateSpecializations(D);
1468 }
1469 
1471  VisitTypeDecl(D);
1472 
1473  Record.push_back(D->wasDeclaredWithTypename());
1474 
1475  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1477  Record.push_back(OwnsDefaultArg);
1478  if (OwnsDefaultArg)
1479  Record.AddTypeSourceInfo(D->getDefaultArgumentInfo());
1480 
1482 }
1483 
1485  // For an expanded parameter pack, record the number of expansion types here
1486  // so that it's easier for deserialization to allocate the right amount of
1487  // memory.
1488  if (D->isExpandedParameterPack())
1489  Record.push_back(D->getNumExpansionTypes());
1490 
1491  VisitDeclaratorDecl(D);
1492  // TemplateParmPosition.
1493  Record.push_back(D->getDepth());
1494  Record.push_back(D->getPosition());
1495 
1496  if (D->isExpandedParameterPack()) {
1497  for (unsigned I = 0, N = D->getNumExpansionTypes(); I != N; ++I) {
1498  Record.AddTypeRef(D->getExpansionType(I));
1499  Record.AddTypeSourceInfo(D->getExpansionTypeSourceInfo(I));
1500  }
1501 
1503  } else {
1504  // Rest of NonTypeTemplateParmDecl.
1505  Record.push_back(D->isParameterPack());
1506  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1508  Record.push_back(OwnsDefaultArg);
1509  if (OwnsDefaultArg)
1510  Record.AddStmt(D->getDefaultArgument());
1512  }
1513 }
1514 
1516  // For an expanded parameter pack, record the number of expansion types here
1517  // so that it's easier for deserialization to allocate the right amount of
1518  // memory.
1519  if (D->isExpandedParameterPack())
1520  Record.push_back(D->getNumExpansionTemplateParameters());
1521 
1522  VisitTemplateDecl(D);
1523  // TemplateParmPosition.
1524  Record.push_back(D->getDepth());
1525  Record.push_back(D->getPosition());
1526 
1527  if (D->isExpandedParameterPack()) {
1528  for (unsigned I = 0, N = D->getNumExpansionTemplateParameters();
1529  I != N; ++I)
1530  Record.AddTemplateParameterList(D->getExpansionTemplateParameters(I));
1532  } else {
1533  // Rest of TemplateTemplateParmDecl.
1534  Record.push_back(D->isParameterPack());
1535  bool OwnsDefaultArg = D->hasDefaultArgument() &&
1537  Record.push_back(OwnsDefaultArg);
1538  if (OwnsDefaultArg)
1539  Record.AddTemplateArgumentLoc(D->getDefaultArgument());
1541  }
1542 }
1543 
1545  VisitRedeclarableTemplateDecl(D);
1547 }
1548 
1550  VisitDecl(D);
1551  Record.AddStmt(D->getAssertExpr());
1552  Record.push_back(D->isFailed());
1553  Record.AddStmt(D->getMessage());
1554  Record.AddSourceLocation(D->getRParenLoc());
1556 }
1557 
1558 /// \brief Emit the DeclContext part of a declaration context decl.
1560  Record.AddOffset(Writer.WriteDeclContextLexicalBlock(Context, DC));
1561  Record.AddOffset(Writer.WriteDeclContextVisibleBlock(Context, DC));
1562 }
1563 
1565  assert(IsLocalDecl(D) && "expected a local declaration");
1566 
1567  const Decl *Canon = D->getCanonicalDecl();
1568  if (IsLocalDecl(Canon))
1569  return Canon;
1570 
1571  const Decl *&CacheEntry = FirstLocalDeclCache[Canon];
1572  if (CacheEntry)
1573  return CacheEntry;
1574 
1575  for (const Decl *Redecl = D; Redecl; Redecl = Redecl->getPreviousDecl())
1576  if (IsLocalDecl(Redecl))
1577  D = Redecl;
1578  return CacheEntry = D;
1579 }
1580 
1581 template <typename T>
1583  T *First = D->getFirstDecl();
1584  T *MostRecent = First->getMostRecentDecl();
1585  T *DAsT = static_cast<T *>(D);
1586  if (MostRecent != First) {
1587  assert(isRedeclarableDeclKind(DAsT->getKind()) &&
1588  "Not considered redeclarable?");
1589 
1590  Record.AddDeclRef(First);
1591 
1592  // Write out a list of local redeclarations of this declaration if it's the
1593  // first local declaration in the chain.
1594  const Decl *FirstLocal = Writer.getFirstLocalDecl(DAsT);
1595  if (DAsT == FirstLocal) {
1596  // Emit a list of all imported first declarations so that we can be sure
1597  // that all redeclarations visible to this module are before D in the
1598  // redecl chain.
1599  unsigned I = Record.size();
1600  Record.push_back(0);
1601  if (Writer.Chain)
1602  AddFirstDeclFromEachModule(DAsT, /*IncludeLocal*/false);
1603  // This is the number of imported first declarations + 1.
1604  Record[I] = Record.size() - I;
1605 
1606  // Collect the set of local redeclarations of this declaration, from
1607  // newest to oldest.
1608  ASTWriter::RecordData LocalRedecls;
1609  ASTRecordWriter LocalRedeclWriter(Record, LocalRedecls);
1610  for (const Decl *Prev = FirstLocal->getMostRecentDecl();
1611  Prev != FirstLocal; Prev = Prev->getPreviousDecl())
1612  if (!Prev->isFromASTFile())
1613  LocalRedeclWriter.AddDeclRef(Prev);
1614 
1615  // If we have any redecls, write them now as a separate record preceding
1616  // the declaration itself.
1617  if (LocalRedecls.empty())
1618  Record.push_back(0);
1619  else
1620  Record.AddOffset(LocalRedeclWriter.Emit(LOCAL_REDECLARATIONS));
1621  } else {
1622  Record.push_back(0);
1623  Record.AddDeclRef(FirstLocal);
1624  }
1625 
1626  // Make sure that we serialize both the previous and the most-recent
1627  // declarations, which (transitively) ensures that all declarations in the
1628  // chain get serialized.
1629  //
1630  // FIXME: This is not correct; when we reach an imported declaration we
1631  // won't emit its previous declaration.
1632  (void)Writer.GetDeclRef(D->getPreviousDecl());
1633  (void)Writer.GetDeclRef(MostRecent);
1634  } else {
1635  // We use the sentinel value 0 to indicate an only declaration.
1636  Record.push_back(0);
1637  }
1638 }
1639 
1641  Record.push_back(D->varlist_size());
1642  VisitDecl(D);
1643  for (auto *I : D->varlists())
1644  Record.AddStmt(I);
1646 }
1647 
1649  VisitValueDecl(D);
1650  Record.AddSourceLocation(D->getLocStart());
1651  Record.AddStmt(D->getCombiner());
1652  Record.AddStmt(D->getInitializer());
1653  Record.AddDeclRef(D->getPrevDeclInScope());
1655 }
1656 
1658  VisitVarDecl(D);
1660 }
1661 
1662 //===----------------------------------------------------------------------===//
1663 // ASTWriter Implementation
1664 //===----------------------------------------------------------------------===//
1665 
1666 void ASTWriter::WriteDeclAbbrevs() {
1667  using namespace llvm;
1668 
1669  BitCodeAbbrev *Abv;
1670 
1671  // Abbreviation for DECL_FIELD
1672  Abv = new BitCodeAbbrev();
1673  Abv->Add(BitCodeAbbrevOp(serialization::DECL_FIELD));
1674  // Decl
1675  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1676  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1677  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1678  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1679  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1680  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1681  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1682  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1683  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
1684  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1685  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1686  // NamedDecl
1687  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1688  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1689  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1690  // ValueDecl
1691  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1692  // DeclaratorDecl
1693  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1694  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1695  // FieldDecl
1696  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
1697  Abv->Add(BitCodeAbbrevOp(0)); //getBitWidth
1698  // Type Source Info
1699  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1700  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1701  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1702  DeclFieldAbbrev = Stream.EmitAbbrev(Abv);
1703 
1704  // Abbreviation for DECL_OBJC_IVAR
1705  Abv = new BitCodeAbbrev();
1706  Abv->Add(BitCodeAbbrevOp(serialization::DECL_OBJC_IVAR));
1707  // Decl
1708  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1709  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1710  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1711  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1712  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1713  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1714  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1715  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1716  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // AccessSpecifier
1717  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1718  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1719  // NamedDecl
1720  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1721  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1722  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1723  // ValueDecl
1724  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1725  // DeclaratorDecl
1726  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1727  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1728  // FieldDecl
1729  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isMutable
1730  Abv->Add(BitCodeAbbrevOp(0)); //getBitWidth
1731  // ObjC Ivar
1732  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getAccessControl
1733  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getSynthesize
1734  // Type Source Info
1735  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1736  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1737  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1738  DeclObjCIvarAbbrev = Stream.EmitAbbrev(Abv);
1739 
1740  // Abbreviation for DECL_ENUM
1741  Abv = new BitCodeAbbrev();
1742  Abv->Add(BitCodeAbbrevOp(serialization::DECL_ENUM));
1743  // Redeclarable
1744  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1745  // Decl
1746  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1747  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1748  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1749  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1750  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1751  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1752  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1753  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1754  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1755  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1756  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1757  // NamedDecl
1758  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1759  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1760  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1761  // TypeDecl
1762  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
1763  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
1764  // TagDecl
1765  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
1766  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
1767  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
1768  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
1769  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
1770  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
1771  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1772  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1773  Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
1774  // EnumDecl
1775  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // AddTypeRef
1776  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IntegerType
1777  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getPromotionType
1778  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumPositiveBits
1779  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getNumNegativeBits
1780  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScoped
1781  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isScopedUsingClassTag
1782  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isFixed
1783  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InstantiatedMembEnum
1784  // DC
1785  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
1786  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
1787  DeclEnumAbbrev = Stream.EmitAbbrev(Abv);
1788 
1789  // Abbreviation for DECL_RECORD
1790  Abv = new BitCodeAbbrev();
1791  Abv->Add(BitCodeAbbrevOp(serialization::DECL_RECORD));
1792  // Redeclarable
1793  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1794  // Decl
1795  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1796  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1797  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1798  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1799  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1800  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1801  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1802  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1803  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1804  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1805  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1806  // NamedDecl
1807  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1808  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1809  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1810  // TypeDecl
1811  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
1812  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
1813  // TagDecl
1814  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // IdentifierNamespace
1815  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getTagKind
1816  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCompleteDefinition
1817  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // EmbeddedInDeclarator
1818  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsFreeStanding
1819  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsCompleteDefinitionRequired
1820  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1821  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SourceLocation
1822  Abv->Add(BitCodeAbbrevOp(0)); // ExtInfoKind
1823  // RecordDecl
1824  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // FlexibleArrayMember
1825  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // AnonymousStructUnion
1826  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasObjectMember
1827  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // hasVolatileMember
1828  // DC
1829  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LexicalOffset
1830  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // VisibleOffset
1831  DeclRecordAbbrev = Stream.EmitAbbrev(Abv);
1832 
1833  // Abbreviation for DECL_PARM_VAR
1834  Abv = new BitCodeAbbrev();
1835  Abv->Add(BitCodeAbbrevOp(serialization::DECL_PARM_VAR));
1836  // Redeclarable
1837  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1838  // Decl
1839  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1840  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1841  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1842  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1843  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1844  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1845  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1846  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1847  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1848  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1849  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1850  // NamedDecl
1851  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1852  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1853  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1854  // ValueDecl
1855  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1856  // DeclaratorDecl
1857  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1858  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1859  // VarDecl
1860  Abv->Add(BitCodeAbbrevOp(0)); // StorageClass
1861  Abv->Add(BitCodeAbbrevOp(0)); // getTSCSpec
1862  Abv->Add(BitCodeAbbrevOp(0)); // hasCXXDirectInitializer
1863  Abv->Add(BitCodeAbbrevOp(0)); // Linkage
1864  Abv->Add(BitCodeAbbrevOp(0)); // HasInit
1865  Abv->Add(BitCodeAbbrevOp(0)); // HasMemberSpecializationInfo
1866  // ParmVarDecl
1867  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsObjCMethodParameter
1868  Abv->Add(BitCodeAbbrevOp(0)); // ScopeDepth
1869  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // ScopeIndex
1870  Abv->Add(BitCodeAbbrevOp(0)); // ObjCDeclQualifier
1871  Abv->Add(BitCodeAbbrevOp(0)); // KNRPromoted
1872  Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedDefaultArg
1873  Abv->Add(BitCodeAbbrevOp(0)); // HasUninstantiatedDefaultArg
1874  // Type Source Info
1875  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1876  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1877  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1878  DeclParmVarAbbrev = Stream.EmitAbbrev(Abv);
1879 
1880  // Abbreviation for DECL_TYPEDEF
1881  Abv = new BitCodeAbbrev();
1882  Abv->Add(BitCodeAbbrevOp(serialization::DECL_TYPEDEF));
1883  // Redeclarable
1884  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1885  // Decl
1886  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1887  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1888  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1889  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1890  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1891  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isUsed
1892  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isReferenced
1893  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1894  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // C++ AccessSpecifier
1895  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1896  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1897  // NamedDecl
1898  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1899  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1900  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1901  // TypeDecl
1902  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Source Location
1903  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type Ref
1904  // TypedefDecl
1905  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1906  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1907  DeclTypedefAbbrev = Stream.EmitAbbrev(Abv);
1908 
1909  // Abbreviation for DECL_VAR
1910  Abv = new BitCodeAbbrev();
1911  Abv->Add(BitCodeAbbrevOp(serialization::DECL_VAR));
1912  // Redeclarable
1913  Abv->Add(BitCodeAbbrevOp(0)); // No redeclaration
1914  // Decl
1915  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1916  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1917  Abv->Add(BitCodeAbbrevOp(0)); // isInvalidDecl
1918  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1919  Abv->Add(BitCodeAbbrevOp(0)); // isImplicit
1920  Abv->Add(BitCodeAbbrevOp(0)); // isUsed
1921  Abv->Add(BitCodeAbbrevOp(0)); // isReferenced
1922  Abv->Add(BitCodeAbbrevOp(0)); // TopLevelDeclInObjCContainer
1923  Abv->Add(BitCodeAbbrevOp(AS_none)); // C++ AccessSpecifier
1924  Abv->Add(BitCodeAbbrevOp(0)); // ModulePrivate
1925  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1926  // NamedDecl
1927  Abv->Add(BitCodeAbbrevOp(0)); // NameKind = Identifier
1928  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Name
1929  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1930  // ValueDecl
1931  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1932  // DeclaratorDecl
1933  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerStartLoc
1934  Abv->Add(BitCodeAbbrevOp(0)); // hasExtInfo
1935  // VarDecl
1936  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // StorageClass
1937  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // getTSCSpec
1938  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // CXXDirectInitializer
1939  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isExceptionVariable
1940  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isNRVOVariable
1941  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isCXXForRangeDecl
1942  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
1943  Abv->Add(BitCodeAbbrevOp(0)); // isInline
1944  Abv->Add(BitCodeAbbrevOp(0)); // isInlineSpecified
1945  Abv->Add(BitCodeAbbrevOp(0)); // isConstexpr
1946  Abv->Add(BitCodeAbbrevOp(0)); // isInitCapture
1947  Abv->Add(BitCodeAbbrevOp(0)); // isPrevDeclInSameScope
1948  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
1949  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // HasInit
1950  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // HasMemberSpecInfo
1951  // Type Source Info
1952  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
1953  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
1954  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc
1955  DeclVarAbbrev = Stream.EmitAbbrev(Abv);
1956 
1957  // Abbreviation for DECL_CXX_METHOD
1958  Abv = new BitCodeAbbrev();
1959  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CXX_METHOD));
1960  // RedeclarableDecl
1961  Abv->Add(BitCodeAbbrevOp(0)); // CanonicalDecl
1962  // Decl
1963  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclContext
1964  Abv->Add(BitCodeAbbrevOp(0)); // LexicalDeclContext
1965  Abv->Add(BitCodeAbbrevOp(0)); // Invalid
1966  Abv->Add(BitCodeAbbrevOp(0)); // HasAttrs
1967  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Implicit
1968  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Used
1969  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Referenced
1970  Abv->Add(BitCodeAbbrevOp(0)); // InObjCContainer
1971  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // Access
1972  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ModulePrivate
1973  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // SubmoduleID
1974  // NamedDecl
1975  Abv->Add(BitCodeAbbrevOp(DeclarationName::Identifier)); // NameKind
1976  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Identifier
1977  Abv->Add(BitCodeAbbrevOp(0)); // AnonDeclNumber
1978  // ValueDecl
1979  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
1980  // DeclaratorDecl
1981  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // InnerLocStart
1982  Abv->Add(BitCodeAbbrevOp(0)); // HasExtInfo
1983  // FunctionDecl
1984  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 11)); // IDNS
1985  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // StorageClass
1986  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Inline
1987  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // InlineSpecified
1988  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // VirtualAsWritten
1989  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Pure
1990  Abv->Add(BitCodeAbbrevOp(0)); // HasInheritedProto
1991  Abv->Add(BitCodeAbbrevOp(1)); // HasWrittenProto
1992  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Deleted
1993  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Trivial
1994  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Defaulted
1995  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ExplicitlyDefaulted
1996  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // ImplicitReturnZero
1997  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Constexpr
1998  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // SkippedBody
1999  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // LateParsed
2000  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
2001  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // LocEnd
2002  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // TemplateKind
2003  // This Array slurps the rest of the record. Fortunately we want to encode
2004  // (nearly) all the remaining (variable number of) fields in the same way.
2005  //
2006  // This is the function template information if any, then
2007  // NumParams and Params[] from FunctionDecl, and
2008  // NumOverriddenMethods, OverriddenMethods[] from CXXMethodDecl.
2009  //
2010  // Add an AbbrevOp for 'size then elements' and use it here.
2011  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
2012  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
2013  DeclCXXMethodAbbrev = Stream.EmitAbbrev(Abv);
2014 
2015  // Abbreviation for EXPR_DECL_REF
2016  Abv = new BitCodeAbbrev();
2017  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_DECL_REF));
2018  //Stmt
2019  //Expr
2020  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2021  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2022  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2023  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2024  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2025  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2026  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2027  //DeclRefExpr
2028  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HasQualifier
2029  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //GetDeclFound
2030  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ExplicitTemplateArgs
2031  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //HadMultipleCandidates
2032  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
2033  1)); // RefersToEnclosingVariableOrCapture
2034  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // DeclRef
2035  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2036  DeclRefExprAbbrev = Stream.EmitAbbrev(Abv);
2037 
2038  // Abbreviation for EXPR_INTEGER_LITERAL
2039  Abv = new BitCodeAbbrev();
2040  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_INTEGER_LITERAL));
2041  //Stmt
2042  //Expr
2043  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2044  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2045  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2046  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2047  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2048  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2049  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2050  //Integer Literal
2051  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2052  Abv->Add(BitCodeAbbrevOp(32)); // Bit Width
2053  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Value
2054  IntegerLiteralAbbrev = Stream.EmitAbbrev(Abv);
2055 
2056  // Abbreviation for EXPR_CHARACTER_LITERAL
2057  Abv = new BitCodeAbbrev();
2058  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_CHARACTER_LITERAL));
2059  //Stmt
2060  //Expr
2061  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2062  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2063  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2064  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2065  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2066  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2067  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2068  //Character Literal
2069  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // getValue
2070  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Location
2071  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // getKind
2072  CharacterLiteralAbbrev = Stream.EmitAbbrev(Abv);
2073 
2074  // Abbreviation for EXPR_IMPLICIT_CAST
2075  Abv = new BitCodeAbbrev();
2076  Abv->Add(BitCodeAbbrevOp(serialization::EXPR_IMPLICIT_CAST));
2077  // Stmt
2078  // Expr
2079  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Type
2080  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //TypeDependent
2081  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //ValueDependent
2082  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //InstantiationDependent
2083  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); //UnexpandedParamPack
2084  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetValueKind
2085  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); //GetObjectKind
2086  // CastExpr
2087  Abv->Add(BitCodeAbbrevOp(0)); // PathSize
2088  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 6)); // CastKind
2089  // ImplicitCastExpr
2090  ExprImplicitCastAbbrev = Stream.EmitAbbrev(Abv);
2091 
2092  Abv = new BitCodeAbbrev();
2093  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_LEXICAL));
2094  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2095  DeclContextLexicalAbbrev = Stream.EmitAbbrev(Abv);
2096 
2097  Abv = new BitCodeAbbrev();
2098  Abv->Add(BitCodeAbbrevOp(serialization::DECL_CONTEXT_VISIBLE));
2099  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
2100  DeclContextVisibleLookupAbbrev = Stream.EmitAbbrev(Abv);
2101 }
2102 
2103 /// isRequiredDecl - Check if this is a "required" Decl, which must be seen by
2104 /// consumers of the AST.
2105 ///
2106 /// Such decls will always be deserialized from the AST file, so we would like
2107 /// this to be as restrictive as possible. Currently the predicate is driven by
2108 /// code generation requirements, if other clients have a different notion of
2109 /// what is "required" then we may have to consider an alternate scheme where
2110 /// clients can iterate over the top-level decls and get information on them,
2111 /// without necessary deserializing them. We could explicitly require such
2112 /// clients to use a separate API call to "realize" the decl. This should be
2113 /// relatively painless since they would presumably only do it for top-level
2114 /// decls.
2115 static bool isRequiredDecl(const Decl *D, ASTContext &Context,
2116  bool WritingModule) {
2117  // An ObjCMethodDecl is never considered as "required" because its
2118  // implementation container always is.
2119 
2120  // File scoped assembly or obj-c or OMP declare target implementation must be
2121  // seen.
2122  if (isa<FileScopeAsmDecl>(D) || isa<ObjCImplDecl>(D) ||
2123  D->hasAttr<OMPDeclareTargetDeclAttr>())
2124  return true;
2125 
2126  // ImportDecl is used by codegen to determine the set of imported modules to
2127  // search for inputs for automatic linking; include it if it has a semantic
2128  // effect.
2129  if (isa<ImportDecl>(D) && !WritingModule)
2130  return true;
2131 
2132  return Context.DeclMustBeEmitted(D);
2133 }
2134 
2135 void ASTWriter::WriteDecl(ASTContext &Context, Decl *D) {
2136  // Determine the ID for this declaration.
2138  assert(!D->isFromASTFile() && "should not be emitting imported decl");
2139  serialization::DeclID &IDR = DeclIDs[D];
2140  if (IDR == 0)
2141  IDR = NextDeclID++;
2142 
2143  ID = IDR;
2144 
2145  assert(ID >= FirstDeclID && "invalid decl ID");
2146 
2147  RecordData Record;
2148  ASTDeclWriter W(*this, Context, Record);
2149 
2150  // Build a record for this declaration
2151  W.Visit(D);
2152 
2153  // Emit this declaration to the bitstream.
2154  uint64_t Offset = W.Emit(D);
2155 
2156  // Record the offset for this declaration
2157  SourceLocation Loc = D->getLocation();
2158  unsigned Index = ID - FirstDeclID;
2159  if (DeclOffsets.size() == Index)
2160  DeclOffsets.push_back(DeclOffset(Loc, Offset));
2161  else if (DeclOffsets.size() < Index) {
2162  // FIXME: Can/should this happen?
2163  DeclOffsets.resize(Index+1);
2164  DeclOffsets[Index].setLocation(Loc);
2165  DeclOffsets[Index].BitOffset = Offset;
2166  } else {
2167  llvm_unreachable("declarations should be emitted in ID order");
2168  }
2169 
2170  SourceManager &SM = Context.getSourceManager();
2171  if (Loc.isValid() && SM.isLocalSourceLocation(Loc))
2172  associateDeclWithFile(D, ID);
2173 
2174  // Note declarations that should be deserialized eagerly so that we can add
2175  // them to a record in the AST file later.
2176  if (isRequiredDecl(D, Context, WritingModule))
2177  EagerlyDeserializedDecls.push_back(ID);
2178 }
2179 
2181  // Switch case IDs are per function body.
2182  Writer->ClearSwitchCaseIDs();
2183 
2184  assert(FD->doesThisDeclarationHaveABody());
2185  if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
2186  Record->push_back(CD->getNumCtorInitializers());
2187  if (CD->getNumCtorInitializers())
2188  AddCXXCtorInitializers(
2189  llvm::makeArrayRef(CD->init_begin(), CD->init_end()));
2190  }
2191  AddStmt(FD->getBody());
2192 }
A FriendTemplateDecl record.
Definition: ASTBitCodes.h:1117
A NonTypeTemplateParmDecl record.
Definition: ASTBitCodes.h:1135
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this function template specialization.
Definition: DeclTemplate.h:473
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
Definition: DeclFriend.h:113
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1561
void VisitAccessSpecDecl(AccessSpecDecl *D)
protocol_range protocols() const
Definition: DeclObjC.h:2025
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
void VisitStaticAssertDecl(StaticAssertDecl *D)
void VisitCXXMethodDecl(CXXMethodDecl *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:1288
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
Definition: ASTCommon.cpp:237
A (possibly-)qualified type.
Definition: Type.h:598
ArrayRef< Capture > captures() const
Definition: Decl.h:3581
ImplementationControl getImplementationControl() const
Definition: DeclObjC.h:463
unsigned getNumTemplates() const
Returns the number of function templates that this might be a specialization of.
Definition: DeclTemplate.h:595
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:2214
bool isVariadic() const
Definition: Decl.h:3532
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
void VisitRedeclarable(Redeclarable< T > *D)
void VisitEmptyDecl(EmptyDecl *D)
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)
An OMPThreadPrivateDecl record.
Definition: ASTBitCodes.h:1160
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:870
CXXMethodDecl * getSpecialization() const
bool isMemberSpecialization()
Determines whether this class template partial specialization template was a specialization of a memb...
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
Definition: Decl.h:3199
bool isDefined() const
Definition: DeclObjC.h:424
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:2207
const Expr * getInitExpr() const
Definition: Decl.h:2498
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Definition: DeclObjC.h:1435
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
Definition: Decl.h:2481
void VisitCXXRecordDecl(CXXRecordDecl *D)
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
Definition: Decl.h:2681
Defines the SourceManager interface.
An OMPDeclareReductionDecl record.
Definition: ASTBitCodes.h:1172
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
Definition: Decl.h:1430
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
QualType getUnderlyingType() const
Definition: Decl.h:2649
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:3053
An ImplicitCastExpr record.
Definition: ASTBitCodes.h:1267
A VarTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1129
Defines the C++ template declaration subclasses.
StringRef P
bool hasFlexibleArrayMember() const
Definition: Decl.h:3305
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
Definition: Decl.h:3230
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
void VisitTranslationUnitDecl(TranslationUnitDecl *D)
A record that stores the set of declarations that are lexically stored within a given DeclContext...
Definition: ASTBitCodes.h:1070
Represents an empty-declaration.
Definition: Decl.h:3788
ASTDeclWriter(ASTWriter &Writer, ASTContext &Context, ASTWriter::RecordDataImpl &Record)
uint32_t DeclID
An ID number that refers to a declaration in an AST file.
Definition: ASTBitCodes.h:63
Declaration of a variable template.
const Expr * getInit() const
Definition: Decl.h:1139
void VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D)
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:471
A ObjCPropertyDecl record.
Definition: ASTBitCodes.h:1043
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: Decl.h:1434
FieldDecl * getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field)
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
Definition: Decl.h:3153
protocol_range protocols() const
Definition: DeclObjC.h:2245
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2187
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
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:754
FunctionTemplateDecl * getTemplate(unsigned I) const
Returns the i'th template candidate.
Definition: DeclTemplate.h:598
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate members of the class templa...
Represents a #pragma comment line.
Definition: Decl.h:109
A ClassTemplateDecl record.
Definition: ASTBitCodes.h:1119
A PragmaDetectMismatchDecl record.
Definition: ASTBitCodes.h:1170
An UnresolvedUsingTypenameDecl record.
Definition: ASTBitCodes.h:1096
void VisitBlockDecl(BlockDecl *D)
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
void VisitImplicitParamDecl(ImplicitParamDecl *D)
const Type * getTypeForDecl() const
Definition: DeclObjC.h:1819
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:40
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:768
Expr * getSetterCXXAssignment() const
Definition: DeclObjC.h:2750
Declaration of a redeclarable template.
Definition: DeclTemplate.h:629
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
bool capturesCXXThis() const
Definition: Decl.h:3586
bool isInlineSpecified() const
Definition: Decl.h:1261
An OMPCapturedExprDecl record.
Definition: ASTBitCodes.h:1166
void AddFunctionDefinition(const FunctionDecl *FD)
Add a definition for the given function to the queue of statements to emit.
SourceLocation getRParenLoc() const
Definition: DeclCXX.h:3355
A UsingShadowDecl record.
Definition: ASTBitCodes.h:1088
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2299
TypeSourceInfo * getSuperClassTInfo() const
Definition: DeclObjC.h:1478
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:113
A TemplateTemplateParmDecl record that stores an expanded template template parameter pack...
Definition: ASTBitCodes.h:1153
void VisitIndirectFieldDecl(IndirectFieldDecl *D)
void VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
VarTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member variable template partial specialization from which this particular variable temp...
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
Definition: Decl.cpp:3241
unsigned param_size() const
Definition: DeclObjC.h:348
unsigned size() const
Determine the number of type parameters in this list.
Definition: DeclObjC.h:648
A TemplateTemplateParmDecl record.
Definition: ASTBitCodes.h:1137
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1377
A ObjCInterfaceDecl record.
Definition: ASTBitCodes.h:1027
Provides information about a dependent function-template specialization declaration.
Definition: DeclTemplate.h:564
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names the category interface associated with this implementat...
Definition: DeclObjC.h:2412
QualType getType() const
Definition: DeclObjC.h:781
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
Definition: DeclCXX.h:2889
TypeSourceInfo * getTypeSourceInfo() const
Definition: DeclObjC.h:779
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:107
void VisitCXXDestructorDecl(CXXDestructorDecl *D)
A CXXConstructorDecl record for an inherited constructor.
Definition: ASTBitCodes.h:1106
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3253
void VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
bool hasUninstantiatedDefaultArg() const
Definition: Decl.h:1492
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:27
Represents a class template specialization, which refers to a class template with a given set of temp...
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3193
method_iterator end_overridden_methods() const
Definition: DeclCXX.cpp:1655
StringLiteral * getMessage()
Definition: DeclCXX.h:3350
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4549
CXXRecordDecl * getPreviousDecl()
Definition: DeclCXX.h:661
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:92
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
Definition: DeclCXX.h:2789
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2256
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2293
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
Definition: Decl.h:2871
ImplicitParamDecl * getCmdDecl() const
Definition: DeclObjC.h:408
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
StringRef getArg() const
Definition: Decl.h:134
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
bool isAnonymousNamespace() const
Returns true if this is an anonymous namespace declaration.
Definition: Decl.h:521
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
TagKind getTagKind() const
Definition: Decl.h:2930
bool isPreviousDeclInSameBlockScope() const
Whether this local extern variable declaration's previous declaration was declared in the same block ...
Definition: Decl.h:1295
TypeSourceInfo * getFriendType() const
If this friend declaration names a templated type (or a dependent member type of a templated type)...
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:2684
Stmt * getBody() const override
Definition: Decl.h:3536
void VisitParmVarDecl(ParmVarDecl *D)
const TemplateArgumentList & getTemplateInstantiationArgs() const
Retrieve the set of template arguments that should be used to instantiate the initializer of the vari...
Represents an access specifier followed by colon ':'.
Definition: DeclCXX.h:103
Declaration of a function specialization at template class scope.
unsigned getNumCaptures() const
getNumCaptures - Returns the number of captured variables.
Definition: Decl.h:3577
bool isThisDeclarationADefinition() const
isThisDeclarationADefinition() - Return true if this declaration is a completion definition of the ty...
Definition: Decl.h:2865
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2293
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:947
A IndirectFieldDecl record.
Definition: ASTBitCodes.h:1147
llvm::PointerUnion< VarTemplateDecl *, VarTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the variable template or variable template partial specialization which was specialized by t...
Provides information about a function template specialization, which is a FunctionDecl that has been ...
Definition: DeclTemplate.h:399
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
Represents a C++ using-declaration.
Definition: DeclCXX.h:3039
ImplicitParamDecl * getParam(unsigned i) const
Definition: Decl.h:3666
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Definition: DeclTemplate.h:432
FunctionTemplateDecl * getCanonicalDecl() override
Definition: DeclTemplate.h:914
void VisitLabelDecl(LabelDecl *LD)
Expr * getInitializer()
Get initializer expression (if specified) of the declare reduction construct.
Definition: DeclOpenMP.h:143
bool isInheritingConstructor() const
Determine whether this is an implicit constructor synthesized to model a call to a constructor inheri...
Definition: DeclCXX.h:2380
void VisitObjCProtocolDecl(ObjCProtocolDecl *D)
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
void VisitClassTemplateDecl(ClassTemplateDecl *D)
IdentifierInfo * getSetterId() const
Definition: DeclCXX.h:3415
ObjCContainerDecl - Represents a container for method declarations.
Definition: DeclObjC.h:901
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:2043
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:526
void VisitTypedefDecl(TypedefDecl *D)
An AccessSpecDecl record.
Definition: ASTBitCodes.h:1112
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2297
void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D)
SourceLocation getRBraceLoc() const
Definition: Decl.h:569
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
uint32_t Offset
Definition: CacheTokens.cpp:44
void VisitUsingShadowDecl(UsingShadowDecl *D)
A ConstructorUsingShadowDecl record.
Definition: ASTBitCodes.h:1090
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
A UsingDirecitveDecl record.
Definition: ASTBitCodes.h:1092
TypeDecl - Represents a declaration of a type.
Definition: Decl.h:2569
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
Definition: Decl.cpp:2200
Expr * getGetterCXXConstructor() const
Definition: DeclObjC.h:2743
SourceLocation RAngleLoc
The source location of the right angle bracket ('>').
Definition: TemplateBase.h:585
unsigned getNumTemplateParameters() const
Selector getSetterName() const
Definition: DeclObjC.h:857
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
A ClassTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1121
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:1968
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:3068
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
This represents the body of a CapturedStmt, and serves as its DeclContext.
Definition: Decl.h:3625
Represents an ObjC class declaration.
Definition: DeclObjC.h:1091
SourceLocation getLocEnd() const LLVM_READONLY
Definition: DeclObjC.cpp:907
Represents a linkage specification.
Definition: DeclCXX.h:2523
detail::InMemoryDirectory::const_iterator I
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:792
size_t param_size() const
Definition: Decl.h:3558
QualType getType() const
Definition: Decl.h:599
SourceLocation getIvarLBraceLoc() const
Definition: DeclObjC.h:2594
SourceLocation getAtStartLoc() const
Definition: DeclObjC.h:1036
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
Definition: DeclCXX.h:3069
TypeSourceInfo * getExpansionTypeSourceInfo(unsigned I) const
Retrieve a particular expansion type source info within an expanded parameter pack.
SourceLocation getAtLoc() const
Definition: DeclObjC.h:773
void VisitPragmaDetectMismatchDecl(PragmaDetectMismatchDecl *D)
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion: ...
Definition: Decl.h:1451
unsigned getNumParams() const
Definition: Decl.h:3664
SourceRange getAtEndRange() const
Definition: DeclObjC.h:1040
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2655
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
void VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
Definition: Decl.cpp:3183
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:2109
void VisitObjCContainerDecl(ObjCContainerDecl *D)
SourceLocation getLocStart() const LLVM_READONLY
Definition: DeclObjC.h:2709
RecordDecl * getMostRecentDecl()
Definition: Decl.h:3298
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
Definition: Decl.h:2701
llvm::PointerUnion< ClassTemplateDecl *, ClassTemplatePartialSpecializationDecl * > getSpecializedTemplateOrPartial() const
Retrieve the class template or class template partial specialization which was specialized by this...
bool isConversionFromLambda() const
Definition: Decl.h:3590
SourceLocation getLocStart() const LLVM_READONLY
Definition: Decl.h:2593
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:2780
Represents a ValueDecl that came out of a declarator.
Definition: Decl.h:646
unsigned getChainingSize() const
Definition: Decl.h:2546
uint64_t Emit(Decl *D)
void VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
ASTContext * Context
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: DeclObjC.h:269
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:2285
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Expr * getCombiner()
Get combiner expression of the declare reduction construct.
Definition: DeclOpenMP.h:136
A StaticAssertDecl record.
Definition: ASTBitCodes.h:1141
SourceLocation getSuperClassLoc() const
Definition: DeclObjC.h:2589
A VarTemplateSpecializationDecl record.
Definition: ASTBitCodes.h:1127
const CXXMethodDecl *const * method_iterator
Definition: DeclCXX.h:1828
static bool classofKind(Kind K)
Definition: DeclObjC.h:1903
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
An ObjCTypeParamDecl record.
Definition: ASTBitCodes.h:1164
InheritedConstructor getInheritedConstructor() const
Get the constructor that this inheriting constructor is based on.
Definition: DeclCXX.h:2383
bool hasDestructors() const
Do any of the ivars of this class (not counting its base classes) require non-trivial destruction...
Definition: DeclObjC.h:2557
bool hasDefaultArgument() const
Determine whether this template parameter has a default argument.
void VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
Definition: Decl.cpp:2276
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:4269
const Type * getTypeForDecl() const
Definition: Decl.h:2590
ObjCCategoryDecl * getCategoryListRaw() const
Retrieve the raw pointer to the start of the category/extension list.
Definition: DeclObjC.h:1686
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition: DeclCXX.h:2927
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
Definition: Decl.h:3456
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:590
A ObjCCategoryImplDecl record.
Definition: ASTBitCodes.h:1037
bool isModed() const
Definition: Decl.h:2642
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
A ObjCPropertyImplDecl record.
Definition: ASTBitCodes.h:1045
void VisitRecordDecl(RecordDecl *D)
Declaration of a template type parameter.
void VisitFileScopeAsmDecl(FileScopeAsmDecl *D)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
NamedDecl * getFriendDecl() const
If this friend declaration names a templated function (or a member function of a templated type)...
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2721
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition: TemplateBase.h:588
OMPDeclareReductionDecl * getPrevDeclInScope()
Get reference to previous declare reduction construct in the same scope with the same name...
Definition: DeclOpenMP.cpp:76
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
Expr * getBitWidth() const
Definition: Decl.h:2375
ArrayRef< NamedDecl * > chain() const
Definition: Decl.h:2540
void AddFirstDeclFromEachModule(const Decl *D, bool IncludeLocal)
Add to the record the first declaration from each module file that provides a declaration of D...
Represents a C++ destructor within a class.
Definition: DeclCXX.h:2414
A CXXConstructorDecl record.
Definition: ASTBitCodes.h:1104
void VisitClassTemplatePartialSpecializationDecl(ClassTemplatePartialSpecializationDecl *D)
void VisitTemplateDecl(TemplateDecl *D)
bool isFirstDecl() const
True if this is the first declaration in its redeclaration chain.
Definition: Redeclarable.h:163
void VisitUsingDecl(UsingDecl *D)
UsingShadowDecl * getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst)
bool isFailed() const
Definition: DeclCXX.h:3353
A VarTemplateDecl record.
Definition: ASTBitCodes.h:1125
ImplicitParamDecl * getSelfDecl() const
Definition: DeclObjC.h:406
unsigned getContextParamPosition() const
Definition: Decl.h:3693
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
EnumDecl * getMostRecentDecl()
Definition: Decl.h:3075
bool isObjCMethodParameter() const
Definition: Decl.h:1420
A CXXDestructorDecl record.
Definition: ASTBitCodes.h:1108
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
void VisitCXXConstructorDecl(CXXConstructorDecl *D)
A NonTypeTemplateParmDecl record that stores an expanded non-type template parameter pack...
Definition: ASTBitCodes.h:1150
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
Definition: DeclTemplate.h:748
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3188
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type...
Definition: DeclObjC.h:276
SourceLocation getRParenLoc() const
Definition: Decl.h:3438
bool isInstanceMethod() const
Definition: DeclObjC.h:414
bool isExceptionVariable() const
Determine whether this variable is the exception variable in a C++ catch statememt or an Objective-C ...
Definition: Decl.h:1209
A NamespaceAliasDecl record.
Definition: ASTBitCodes.h:1084
Declaration of an alias template.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1214
void AddDeclRef(const Decl *D)
Emit a reference to a declaration.
Definition: ASTWriter.h:851
void AddObjCTypeParamList(ObjCTypeParamList *typeParams)
Add an Objective-C type parameter list to the given record.
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:3543
void VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
NamedDecl * getInstantiatedFromUsingDecl(UsingDecl *Inst)
If the given using decl Inst is an instantiation of a (possibly unresolved) using decl from a templat...
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:258
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
protocol_loc_range protocol_locs() const
Definition: DeclObjC.h:1305
An ImplicitParamDecl record.
Definition: ASTBitCodes.h:1053
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
Definition: Decl.h:2718
const TemplateArgumentLoc & getDefaultArgument() const
Retrieve the default argument, if any.
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Definition: Decl.cpp:1030
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2461
void VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
An EnumConstantDecl record.
Definition: ASTBitCodes.h:1021
bool hasInheritedPrototype() const
Whether this function inherited its prototype from a previous declaration.
Definition: Decl.h:1879
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
Definition: DeclTemplate.h:442
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
const SourceManager & SM
Definition: Format.cpp:1184
void VisitTagDecl(TagDecl *D)
An ImportDecl recording a module import.
Definition: ASTBitCodes.h:1158
A ObjCCategoryDecl record.
Definition: ASTBitCodes.h:1035
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
TypedefNameDecl * getTypedefNameForAnonDecl() const
Definition: Decl.h:2961
void VisitObjCCategoryDecl(ObjCCategoryDecl *D)
CXXMethodDecl * getMostRecentDecl()
Definition: DeclCXX.h:1811
TypeSourceInfo * getReturnTypeSourceInfo() const
Definition: DeclObjC.h:344
static DeclType * getDecl(EntryType *D)
Definition: DeclTemplate.h:647
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:156
init_iterator init_begin()
init_begin() - Retrieve an iterator to the first initializer.
Definition: DeclObjC.h:2522
unsigned getNumExpansionTypes() const
Retrieves the number of expansion types in an expanded parameter pack.
void VisitMSPropertyDecl(MSPropertyDecl *D)
A ObjCCompatibleAliasDecl record.
Definition: ASTBitCodes.h:1041
void VisitVarTemplateDecl(VarTemplateDecl *D)
void VisitTypeAliasDecl(TypeAliasDecl *D)
void VisitDeclContext(DeclContext *DC)
Emit the DeclContext part of a declaration context decl.
bool isEmbeddedInDeclarator() const
Definition: Decl.h:2886
ArrayRef< ParmVarDecl * > parameters() const
Definition: DeclObjC.h:371
Stmt * getBody(const FunctionDecl *&Definition) const
getBody - Retrieve the body (definition) of the function.
Definition: Decl.cpp:2491
bool doesThisDeclarationHaveABody() const
doesThisDeclarationHaveABody - Returns whether this specific declaration of the function has a body -...
Definition: Decl.h:1821
StringRef getValue() const
Definition: Decl.h:167
const Decl * getFirstLocalDecl(const Decl *D)
Find the first local declaration of a given local redeclarable decl.
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
Definition: DeclTemplate.h:519
An UnresolvedUsingValueDecl record.
Definition: ASTBitCodes.h:1094
SourceLocation getExternLoc() const
Definition: DeclCXX.h:2575
IdentifierInfo * getGetterId() const
Definition: DeclCXX.h:3413
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:144
TypeSourceInfo * getDefaultArgumentInfo() const
Retrieves the default argument's source information, if any.
const ASTTemplateArgumentListInfo * TemplateArgumentsAsWritten
The template arguments as written in the sources, if provided.
Definition: DeclTemplate.h:435
Encodes a location in the source.
unsigned protocol_size() const
Definition: DeclObjC.h:2252
This represents '#pragma omp declare reduction ...' directive.
Definition: DeclOpenMP.h:102
A record that stores the set of declarations that are visible from a given DeclContext.
Definition: ASTBitCodes.h:1078
method_iterator begin_overridden_methods() const
Definition: DeclCXX.cpp:1650
const ObjCMethodDecl * getObjCMethodRedeclaration(const ObjCMethodDecl *MD) const
Get the duplicate declaration of a ObjCMethod in the same interface, or null if none exists...
Pseudo declaration for capturing expressions.
Definition: DeclOpenMP.h:171
void VisitObjCImplDecl(ObjCImplDecl *D)
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2642
QualType getExpansionType(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
SourceLocation getLocStart() const LLVM_READONLY
Definition: Decl.h:568
SourceRange getBraceRange() const
Definition: Decl.h:2846
bool isValid() const
Return true if this is a valid SourceLocation object.
const std::string ID
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2727
unsigned size_overridden_methods() const
Definition: DeclCXX.cpp:1660
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
Definition: DeclCXX.h:2808
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:58
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:424
bool isVariadic() const
Definition: DeclObjC.h:416
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3185
RedeclarableTemplateDecl::SpecEntryTraits< EntryType >::DeclType * getSpecializationDecl(EntryType &T)
Get the specialization decl from an entry in the specialization list.
RedeclarableTemplateDecl * getInstantiatedFromMemberTemplate() const
Retrieve the member template from which this template was instantiated, or NULL if this template was ...
Definition: DeclTemplate.h:795
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition: DeclObjC.cpp:784
bool getSynthesize() const
Definition: DeclObjC.h:1895
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1736
void VisitVarTemplatePartialSpecializationDecl(VarTemplatePartialSpecializationDecl *D)
bool blockMissingReturnType() const
Definition: Decl.h:3587
C-style initialization with assignment.
Definition: Decl.h:778
ArrayRef< ParmVarDecl * > parameters() const
Definition: Decl.h:1989
bool isMemberSpecialization()
Determines whether this variable template partial specialization was a specialization of a member par...
Expr * getDefaultArgument() const
Retrieve the default argument, if any.
A TemplateTypeParmDecl record.
Definition: ASTBitCodes.h:1133
Data that is common to all of the declarations of a given function template.
Definition: DeclTemplate.h:844
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:2171
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:3772
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2325
bool isPropertyAccessor() const
Definition: DeclObjC.h:421
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
Definition: DeclCXX.h:3211
bool hasVolatileMember() const
Definition: Decl.h:3328
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
void VisitCapturedDecl(CapturedDecl *D)
init_iterator init_end()
init_end() - Retrieve an iterator past the last initializer.
Definition: DeclObjC.h:2530
ThreadStorageClassSpecifier getTSCSpec() const
Definition: Decl.h:956
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:699
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:67
QualType getReturnType() const
Definition: DeclObjC.h:330
A NamespaceDecl record.
Definition: ASTBitCodes.h:1082
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3327
bool hasObjectMember() const
Definition: Decl.h:3325
void VisitPragmaCommentDecl(PragmaCommentDecl *D)
SourceLocation getCategoryNameLoc() const
Definition: DeclObjC.h:2419
const TemplateArgumentLoc & getTemplateArg(unsigned I) const
Returns the nth template argument.
Definition: DeclTemplate.h:612
unsigned varlist_size() const
Definition: DeclOpenMP.h:74
SourceLocation getLParenLoc() const
Definition: DeclObjC.h:776
bool isLocalSourceLocation(SourceLocation Loc) const
Returns true if Loc did not come from a PCH/Module.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:3728
SourceLocation getUsingLoc() const
Return the location of the using keyword.
Definition: DeclCXX.h:2680
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
Definition: DeclCXX.cpp:1302
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
A ObjCProtocolDecl record.
Definition: ASTBitCodes.h:1029
bool isInitCapture() const
Whether this variable is the implicit variable for a lambda init-capture.
Definition: Decl.h:1285
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2609
bool isAnonymousStructOrUnion() const
isAnonymousStructOrUnion - Whether this is an anonymous struct or union.
Definition: Decl.h:3320
A CXXConversionDecl record.
Definition: ASTBitCodes.h:1110
void VisitFieldDecl(FieldDecl *D)
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
Definition: DeclCXX.h:122
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Definition: DeclCXX.cpp:2063
void AddTemplateSpecializations(DeclTy *D)
bool hasTypename() const
Return true if the using declaration has 'typename'.
Definition: DeclCXX.h:3091
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
Definition: Decl.cpp:3030
void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D)
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1135
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:330
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:877
QualType getPromotionType() const
getPromotionType - Return the integer type that enumerators should promote to.
Definition: Decl.h:3129
PragmaMSCommentKind getCommentKind() const
Definition: Decl.h:132
void VisitNamedDecl(NamedDecl *D)
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
Definition: Decl.h:2521
bool isFreeStanding() const
Definition: Decl.h:2893
A ClassTemplatePartialSpecializationDecl record.
Definition: ASTBitCodes.h:1123
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
Definition: DeclCXX.h:2676
DeclCode
Record codes for each kind of declaration.
Definition: ASTBitCodes.h:1011
const llvm::APSInt & getInitVal() const
Definition: Decl.h:2500
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
void VisitTypeDecl(TypeDecl *D)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:522
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2564
bool hasWrittenPrototype() const
Definition: Decl.h:1875
SourceLocation getPropertyIvarDeclLoc() const
Definition: DeclObjC.h:2724
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3268
A ClassScopeFunctionSpecializationDecl record a class scope function specialization.
Definition: ASTBitCodes.h:1156
Represents the declaration of an Objective-C type parameter.
Definition: DeclObjC.h:532
Selector getGetterName() const
Definition: DeclObjC.h:854
A LinkageSpecDecl record.
Definition: ASTBitCodes.h:1098
decltype(T::PartialSpecializations)& getPartialSpecializations(T *Common)
Get the list of partial specializations from a template's common ptr.
size_t param_size() const
Definition: Decl.h:2004
EnumDecl - Represents an enum.
Definition: Decl.h:3013
SourceLocation LAngleLoc
The source location of the left angle bracket ('<').
Definition: TemplateBase.h:582
unsigned getFunctionScopeDepth() const
Definition: Decl.h:1424
detail::InMemoryDirectory::const_iterator E
SourceLocation getEndOfDefinitionLoc() const
Definition: DeclObjC.h:1779
void VisitDeclaratorDecl(DeclaratorDecl *D)
bool defaultArgumentWasInherited() const
Determines whether the default argument was inherited from a previous declaration of this template...
void VisitEnumDecl(EnumDecl *D)
unsigned getDepth() const
Get the nesting depth of the template parameter.
bool isCompleteDefinitionRequired() const
Return true if this complete decl is required to be complete for some existing use.
Definition: Decl.h:2877
StringRef getName() const
Definition: Decl.h:166
bool hasInheritedDefaultArg() const
Definition: Decl.h:1505
A PragmaCommentDecl record.
Definition: ASTBitCodes.h:1168
void VisitNamespaceDecl(NamespaceDecl *D)
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2461
ObjCMethodDecl * getGetterMethodDecl() const
Definition: DeclObjC.h:860
bool hasNonZeroConstructors() const
Do any of the ivars of this class (not counting its base classes) require construction other than zer...
Definition: DeclObjC.h:2552
void VisitVarDecl(VarDecl *D)
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
Definition: Decl.h:3180
Expr * getUninstantiatedDefaultArg()
Definition: Decl.cpp:2408
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Definition: DeclFriend.h:120
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
Definition: DeclTemplate.h:540
ObjCMethodDecl * getSetterMethodDecl() const
Definition: DeclObjC.h:863
ClassTemplatePartialSpecializationDecl * getInstantiatedFromMember() const
Retrieve the member class template partial specialization from which this particular class template p...
bool isNothrow() const
Definition: Decl.cpp:4077
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
Definition: Decl.h:3137
ClassTemplateDecl * getCanonicalDecl() override
unsigned getNumTemplateArgs() const
Returns the number of explicit template arguments that were given.
Definition: DeclTemplate.h:609
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
Definition: DeclBase.cpp:1534
SourceLocation getRBraceLoc() const
Definition: DeclCXX.h:2576
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3076
bool isNRVOVariable() const
Determine whether this local variable can be used with the named return value optimization (NRVO)...
Definition: Decl.h:1227
bool isOriginalNamespace() const
Return true if this declaration is an original (first) declaration of the namespace.
Definition: DeclCXX.cpp:2109
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1198
unsigned protocol_size() const
Definition: DeclObjC.h:2058
protocol_range protocols() const
Definition: DeclObjC.h:1278
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void VisitFunctionDecl(FunctionDecl *D)
bool isStaticDataMember() const
Determines whether this is a static data member.
Definition: Decl.h:1058
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
Definition: DeclCXX.h:3295
SourceManager & getSourceManager()
Definition: ASTContext.h:561
bool isCXXForRangeDecl() const
Determine whether this variable is the for-range-declaration in a C++0x for-range statement...
Definition: Decl.h:1237
static bool classofKind(Kind K)
Definition: DeclCXX.h:1721
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
void VisitDecl(Decl *D)
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2712
AccessControl getAccessControl() const
Definition: DeclObjC.h:1888
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:1935
Represents a field declaration created by an @defs(...).
Definition: DeclObjC.h:1916
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:358
bool isARCPseudoStrong() const
Determine whether this variable is an ARC pseudo-__strong variable.
Definition: Decl.h:1249
void VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum...
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 NULL if there isn't one...
Represents a C++ struct/union/class.
Definition: DeclCXX.h:263
TypeSourceInfo * getSignatureAsWritten() const
Definition: Decl.h:3540
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Definition: DeclTemplate.h:445
An object for streaming information to a record.
Definition: ASTWriter.h:693
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3299
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
ObjCIvarDecl - Represents an ObjC instance variable.
Definition: DeclObjC.h:1849
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
Definition: ASTCommon.cpp:323
Provides information a specialization of a member of a class template, which may be a member function...
Definition: DeclTemplate.h:500
A ObjCImplementationDecl record.
Definition: ASTBitCodes.h:1039
void VisitEnumConstantDecl(EnumConstantDecl *D)
bool isInline() const
Whether this variable is (C++1z) inline.
Definition: Decl.h:1258
A ObjCAtDefsFieldDecl record.
Definition: ASTBitCodes.h:1033
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:610
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
Definition: Decl.h:1276
void VisitClassScopeFunctionSpecializationDecl(ClassScopeFunctionSpecializationDecl *D)
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:353
bool isExpandedParameterPack() const
Whether this parameter is a non-type template parameter pack that has a known list of different types...
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:84
VarTemplateDecl * getCanonicalDecl() override
const unsigned int LOCAL_REDECLARATIONS
Record code for a list of local redeclarations of a declaration.
Definition: ASTBitCodes.h:1003
A TypeAliasDecl record.
Definition: ASTBitCodes.h:1015
const FunctionDecl * getOperatorDelete() const
Definition: DeclCXX.h:2439
TemplateParameterList * getTemplateParameterList(unsigned i) const
PropertyAttributeKind getPropertyAttributesAsWritten() const
Definition: DeclObjC.h:802
SourceLocation getIvarRBraceLoc() const
Definition: DeclObjC.h:2596
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
Definition: Redeclarable.h:166
void VisitFriendDecl(FriendDecl *D)
TranslationUnitDecl - The top declaration context.
Definition: Decl.h:80
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Definition: DeclCXX.h:2654
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)
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
Definition: Decl.h:548
NamedDecl * getMostRecentDecl()
Definition: Decl.h:401
void VisitConstructorUsingShadowDecl(ConstructorUsingShadowDecl *D)
DeclContext * getPrimaryContext()
getPrimaryContext - There may be many different declarations of the same entity (including forward de...
Definition: DeclBase.cpp:991
A FunctionTemplateDecl record.
Definition: ASTBitCodes.h:1131
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Definition: DeclCXX.h:3221
SourceLocation getInnerLocStart() const
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
Definition: Decl.h:685
A TypeAliasTemplateDecl record.
Definition: ASTBitCodes.h:1139
void VisitImportDecl(ImportDecl *D)
varlist_range varlists()
Definition: DeclOpenMP.h:77
An instance of this class represents the declaration of a property member.
Definition: DeclCXX.h:3394
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213
Represents a C++ namespace alias.
Definition: DeclCXX.h:2718
bool DeclMustBeEmitted(const Decl *D)
Determines if the decl can be CodeGen'ed or deserialized from PCH lazily, only when used; this is onl...
void VisitFriendTemplateDecl(FriendTemplateDecl *D)
Declaration of a friend template.
Represents C++ using-directive.
Definition: DeclCXX.h:2615
Represents a #pragma detect_mismatch line.
Definition: Decl.h:143
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:2644
void VisitObjCMethodDecl(ObjCMethodDecl *D)
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:39
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2380
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:838
Source range/offset of a preprocessed entity.
Definition: ASTBitCodes.h:187
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:2835
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Definition: DeclCXX.h:2805
void VisitObjCIvarDecl(ObjCIvarDecl *D)
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2626
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
Definition: Decl.h:2358
bool hasInClassInitializer() const
hasInClassInitializer - Determine whether this member has a C++11 in-class initializer.
Definition: Decl.h:2408
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2587
const StringLiteral * getAsmString() const
Definition: Decl.h:3444