Clang Project

clang_source_code/include/clang/Serialization/ASTWriter.h
1//===- ASTWriter.h - AST File Writer ----------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9//  This file defines the ASTWriter class, which writes an AST file
10//  containing a serialized representation of a translation unit.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SERIALIZATION_ASTWRITER_H
15#define LLVM_CLANG_SERIALIZATION_ASTWRITER_H
16
17#include "clang/AST/ASTMutationListener.h"
18#include "clang/AST/Decl.h"
19#include "clang/AST/DeclarationName.h"
20#include "clang/AST/NestedNameSpecifier.h"
21#include "clang/AST/OpenMPClause.h"
22#include "clang/AST/TemplateBase.h"
23#include "clang/AST/TemplateName.h"
24#include "clang/AST/Type.h"
25#include "clang/AST/TypeLoc.h"
26#include "clang/Basic/LLVM.h"
27#include "clang/Basic/SourceLocation.h"
28#include "clang/Sema/SemaConsumer.h"
29#include "clang/Serialization/ASTBitCodes.h"
30#include "clang/Serialization/ASTDeserializationListener.h"
31#include "clang/Serialization/PCHContainerOperations.h"
32#include "llvm/ADT/ArrayRef.h"
33#include "llvm/ADT/DenseMap.h"
34#include "llvm/ADT/DenseSet.h"
35#include "llvm/ADT/MapVector.h"
36#include "llvm/ADT/SetVector.h"
37#include "llvm/ADT/SmallVector.h"
38#include "llvm/ADT/StringRef.h"
39#include "llvm/Bitcode/BitstreamWriter.h"
40#include <cassert>
41#include <cstddef>
42#include <cstdint>
43#include <ctime>
44#include <memory>
45#include <queue>
46#include <string>
47#include <utility>
48#include <vector>
49
50namespace llvm {
51
52class APFloat;
53class APInt;
54class APSInt;
55
56// namespace llvm
57
58namespace clang {
59
60class ASTContext;
61class ASTReader;
62class ASTUnresolvedSet;
63class Attr;
64class CXXBaseSpecifier;
65class CXXCtorInitializer;
66class CXXRecordDecl;
67class CXXTemporary;
68class FileEntry;
69class FPOptions;
70class FunctionDecl;
71class HeaderSearch;
72class HeaderSearchOptions;
73class IdentifierResolver;
74class LangOptions;
75class MacroDefinitionRecord;
76class MacroInfo;
77class Module;
78class InMemoryModuleCache;
79class ModuleFileExtension;
80class ModuleFileExtensionWriter;
81class NamedDecl;
82class NestedNameSpecifier;
83class ObjCInterfaceDecl;
84class PreprocessingRecord;
85class Preprocessor;
86struct QualifierInfo;
87class RecordDecl;
88class Sema;
89class SourceManager;
90class Stmt;
91struct StoredDeclsList;
92class SwitchCase;
93class TemplateParameterList;
94class Token;
95class TypeSourceInfo;
96
97/// Writes an AST file containing the contents of a translation unit.
98///
99/// The ASTWriter class produces a bitstream containing the serialized
100/// representation of a given abstract syntax tree and its supporting
101/// data structures. This bitstream can be de-serialized via an
102/// instance of the ASTReader class.
103class ASTWriter : public ASTDeserializationListener,
104                  public ASTMutationListener {
105public:
106  friend class ASTDeclWriter;
107  friend class ASTRecordWriter;
108  friend class ASTStmtWriter;
109  friend class ASTTypeWriter;
110
111  using RecordData = SmallVector<uint64_t64>;
112  using RecordDataImpl = SmallVectorImpl<uint64_t>;
113  using RecordDataRef = ArrayRef<uint64_t>;
114
115private:
116  /// Map that provides the ID numbers of each type within the
117  /// output stream, plus those deserialized from a chained PCH.
118  ///
119  /// The ID numbers of types are consecutive (in order of discovery)
120  /// and start at 1. 0 is reserved for NULL. When types are actually
121  /// stored in the stream, the ID number is shifted by 2 bits to
122  /// allow for the const/volatile qualifiers.
123  ///
124  /// Keys in the map never have const/volatile qualifiers.
125  using TypeIdxMap = llvm::DenseMap<QualType, serialization::TypeIdx,
126                                    serialization::UnsafeQualTypeDenseMapInfo>;
127
128  /// The bitstream writer used to emit this precompiled header.
129  llvm::BitstreamWriter &Stream;
130
131  /// The buffer associated with the bitstream.
132  const SmallVectorImpl<char> &Buffer;
133
134  /// The PCM manager which manages memory buffers for pcm files.
135  InMemoryModuleCache &ModuleCache;
136
137  /// The ASTContext we're writing.
138  ASTContext *Context = nullptr;
139
140  /// The preprocessor we're writing.
141  Preprocessor *PP = nullptr;
142
143  /// The reader of existing AST files, if we're chaining.
144  ASTReader *Chain = nullptr;
145
146  /// The module we're currently writing, if any.
147  Module *WritingModule = nullptr;
148
149  /// The base directory for any relative paths we emit.
150  std::string BaseDirectory;
151
152  /// Indicates whether timestamps should be written to the produced
153  /// module file. This is the case for files implicitly written to the
154  /// module cache, where we need the timestamps to determine if the module
155  /// file is up to date, but not otherwise.
156  bool IncludeTimestamps;
157
158  /// Indicates when the AST writing is actively performing
159  /// serialization, rather than just queueing updates.
160  bool WritingAST = false;
161
162  /// Indicates that we are done serializing the collection of decls
163  /// and types to emit.
164  bool DoneWritingDeclsAndTypes = false;
165
166  /// Indicates that the AST contained compiler errors.
167  bool ASTHasCompilerErrors = false;
168
169  /// Mapping from input file entries to the index into the
170  /// offset table where information about that input file is stored.
171  llvm::DenseMap<const FileEntry *, uint32_t> InputFileIDs;
172
173  /// Stores a declaration or a type to be written to the AST file.
174  class DeclOrType {
175  public:
176    DeclOrType(Decl *D) : Stored(D), IsType(false) {}
177    DeclOrType(QualType T) : Stored(T.getAsOpaquePtr()), IsType(true) {}
178
179    bool isType() const { return IsType; }
180    bool isDecl() const { return !IsType; }
181
182    QualType getType() const {
183       (0) . __assert_fail ("isType() && \"Not a type!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Serialization/ASTWriter.h", 183, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isType() && "Not a type!");
184      return QualType::getFromOpaquePtr(Stored);
185    }
186
187    Decl *getDecl() const {
188       (0) . __assert_fail ("isDecl() && \"Not a decl!\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Serialization/ASTWriter.h", 188, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(isDecl() && "Not a decl!");
189      return static_cast<Decl *>(Stored);
190    }
191
192  private:
193    void *Stored;
194    bool IsType;
195  };
196
197  /// The declarations and types to emit.
198  std::queue<DeclOrTypeDeclTypesToEmit;
199
200  /// The first ID number we can use for our own declarations.
201  serialization::DeclID FirstDeclID = serialization::NUM_PREDEF_DECL_IDS;
202
203  /// The decl ID that will be assigned to the next new decl.
204  serialization::DeclID NextDeclID = FirstDeclID;
205
206  /// Map that provides the ID numbers of each declaration within
207  /// the output stream, as well as those deserialized from a chained PCH.
208  ///
209  /// The ID numbers of declarations are consecutive (in order of
210  /// discovery) and start at 2. 1 is reserved for the translation
211  /// unit, while 0 is reserved for NULL.
212  llvm::DenseMap<const Decl *, serialization::DeclID> DeclIDs;
213
214  /// Offset of each declaration in the bitstream, indexed by
215  /// the declaration's ID.
216  std::vector<serialization::DeclOffsetDeclOffsets;
217
218  /// Sorted (by file offset) vector of pairs of file offset/DeclID.
219  using LocDeclIDsTy =
220      SmallVector<std::pair<unsignedserialization::DeclID>, 64>;
221  struct DeclIDInFileInfo {
222    LocDeclIDsTy DeclIDs;
223
224    /// Set when the DeclIDs vectors from all files are joined, this
225    /// indicates the index that this particular vector has in the global one.
226    unsigned FirstDeclIndex;
227  };
228  using FileDeclIDsTy = llvm::DenseMap<FileID, DeclIDInFileInfo *>;
229
230  /// Map from file SLocEntries to info about the file-level declarations
231  /// that it contains.
232  FileDeclIDsTy FileDeclIDs;
233
234  void associateDeclWithFile(const Decl *Dserialization::DeclID);
235
236  /// The first ID number we can use for our own types.
237  serialization::TypeID FirstTypeID = serialization::NUM_PREDEF_TYPE_IDS;
238
239  /// The type ID that will be assigned to the next new type.
240  serialization::TypeID NextTypeID = FirstTypeID;
241
242  /// Map that provides the ID numbers of each type within the
243  /// output stream, plus those deserialized from a chained PCH.
244  ///
245  /// The ID numbers of types are consecutive (in order of discovery)
246  /// and start at 1. 0 is reserved for NULL. When types are actually
247  /// stored in the stream, the ID number is shifted by 2 bits to
248  /// allow for the const/volatile qualifiers.
249  ///
250  /// Keys in the map never have const/volatile qualifiers.
251  TypeIdxMap TypeIdxs;
252
253  /// Offset of each type in the bitstream, indexed by
254  /// the type's ID.
255  std::vector<uint32_tTypeOffsets;
256
257  /// The first ID number we can use for our own identifiers.
258  serialization::IdentID FirstIdentID = serialization::NUM_PREDEF_IDENT_IDS;
259
260  /// The identifier ID that will be assigned to the next new identifier.
261  serialization::IdentID NextIdentID = FirstIdentID;
262
263  /// Map that provides the ID numbers of each identifier in
264  /// the output stream.
265  ///
266  /// The ID numbers for identifiers are consecutive (in order of
267  /// discovery), starting at 1. An ID of zero refers to a NULL
268  /// IdentifierInfo.
269  llvm::MapVector<const IdentifierInfo *, serialization::IdentID> IdentifierIDs;
270
271  /// The first ID number we can use for our own macros.
272  serialization::MacroID FirstMacroID = serialization::NUM_PREDEF_MACRO_IDS;
273
274  /// The identifier ID that will be assigned to the next new identifier.
275  serialization::MacroID NextMacroID = FirstMacroID;
276
277  /// Map that provides the ID numbers of each macro.
278  llvm::DenseMap<MacroInfo *, serialization::MacroID> MacroIDs;
279
280  struct MacroInfoToEmitData {
281    const IdentifierInfo *Name;
282    MacroInfo *MI;
283    serialization::MacroID ID;
284  };
285
286  /// The macro infos to emit.
287  std::vector<MacroInfoToEmitDataMacroInfosToEmit;
288
289  llvm::DenseMap<const IdentifierInfo *, uint64_t> IdentMacroDirectivesOffsetMap;
290
291  /// @name FlushStmt Caches
292  /// @{
293
294  /// Set of parent Stmts for the currently serializing sub-stmt.
295  llvm::DenseSet<Stmt *> ParentStmts;
296
297  /// Offsets of sub-stmts already serialized. The offset points
298  /// just after the stmt record.
299  llvm::DenseMap<Stmt *, uint64_t> SubStmtEntries;
300
301  /// @}
302
303  /// Offsets of each of the identifier IDs into the identifier
304  /// table.
305  std::vector<uint32_tIdentifierOffsets;
306
307  /// The first ID number we can use for our own submodules.
308  serialization::SubmoduleID FirstSubmoduleID =
309      serialization::NUM_PREDEF_SUBMODULE_IDS;
310
311  /// The submodule ID that will be assigned to the next new submodule.
312  serialization::SubmoduleID NextSubmoduleID = FirstSubmoduleID;
313
314  /// The first ID number we can use for our own selectors.
315  serialization::SelectorID FirstSelectorID =
316      serialization::NUM_PREDEF_SELECTOR_IDS;
317
318  /// The selector ID that will be assigned to the next new selector.
319  serialization::SelectorID NextSelectorID = FirstSelectorID;
320
321  /// Map that provides the ID numbers of each Selector.
322  llvm::MapVector<Selector, serialization::SelectorID> SelectorIDs;
323
324  /// Offset of each selector within the method pool/selector
325  /// table, indexed by the Selector ID (-1).
326  std::vector<uint32_tSelectorOffsets;
327
328  /// Mapping from macro definitions (as they occur in the preprocessing
329  /// record) to the macro IDs.
330  llvm::DenseMap<const MacroDefinitionRecord *,
331                 serialization::PreprocessedEntityID> MacroDefinitions;
332
333  /// Cache of indices of anonymous declarations within their lexical
334  /// contexts.
335  llvm::DenseMap<const Decl *, unsignedAnonymousDeclarationNumbers;
336
337  /// An update to a Decl.
338  class DeclUpdate {
339    /// A DeclUpdateKind.
340    unsigned Kind;
341    union {
342      const Decl *Dcl;
343      void *Type;
344      unsigned Loc;
345      unsigned Val;
346      Module *Mod;
347      const Attr *Attribute;
348    };
349
350  public:
351    DeclUpdate(unsigned Kind) : Kind(Kind), Dcl(nullptr) {}
352    DeclUpdate(unsigned Kindconst Decl *Dcl) : Kind(Kind), Dcl(Dcl) {}
353    DeclUpdate(unsigned KindQualType Type)
354        : Kind(Kind), Type(Type.getAsOpaquePtr()) {}
355    DeclUpdate(unsigned KindSourceLocation Loc)
356        : Kind(Kind), Loc(Loc.getRawEncoding()) {}
357    DeclUpdate(unsigned Kindunsigned Val) : Kind(Kind), Val(Val) {}
358    DeclUpdate(unsigned KindModule *M) : Kind(Kind), Mod(M) {}
359    DeclUpdate(unsigned Kindconst Attr *Attribute)
360          : Kind(Kind), Attribute(Attribute) {}
361
362    unsigned getKind() const { return Kind; }
363    const Decl *getDecl() const { return Dcl; }
364    QualType getType() const { return QualType::getFromOpaquePtr(Type); }
365
366    SourceLocation getLoc() const {
367      return SourceLocation::getFromRawEncoding(Loc);
368    }
369
370    unsigned getNumber() const { return Val; }
371    Module *getModule() const { return Mod; }
372    const Attr *getAttr() const { return Attribute; }
373  };
374
375  using UpdateRecord = SmallVector<DeclUpdate1>;
376  using DeclUpdateMap = llvm::MapVector<const Decl *, UpdateRecord>;
377
378  /// Mapping from declarations that came from a chained PCH to the
379  /// record containing modifications to them.
380  DeclUpdateMap DeclUpdates;
381
382  using FirstLatestDeclMap = llvm::DenseMap<Decl *, Decl *>;
383
384  /// Map of first declarations from a chained PCH that point to the
385  /// most recent declarations in another PCH.
386  FirstLatestDeclMap FirstLatestDecls;
387
388  /// Declarations encountered that might be external
389  /// definitions.
390  ///
391  /// We keep track of external definitions and other 'interesting' declarations
392  /// as we are emitting declarations to the AST file. The AST file contains a
393  /// separate record for these declarations, which are provided to the AST
394  /// consumer by the AST reader. This is behavior is required to properly cope with,
395  /// e.g., tentative variable definitions that occur within
396  /// headers. The declarations themselves are stored as declaration
397  /// IDs, since they will be written out to an EAGERLY_DESERIALIZED_DECLS
398  /// record.
399  SmallVector<uint64_t16EagerlyDeserializedDecls;
400  SmallVector<uint64_t16ModularCodegenDecls;
401
402  /// DeclContexts that have received extensions since their serialized
403  /// form.
404  ///
405  /// For namespaces, when we're chaining and encountering a namespace, we check
406  /// if its primary namespace comes from the chain. If it does, we add the
407  /// primary to this set, so that we can write out lexical content updates for
408  /// it.
409  llvm::SmallSetVector<const DeclContext *, 16UpdatedDeclContexts;
410
411  /// Keeps track of declarations that we must emit, even though we're
412  /// not guaranteed to be able to find them by walking the AST starting at the
413  /// translation unit.
414  SmallVector<const Decl *, 16DeclsToEmitEvenIfUnreferenced;
415
416  /// The set of Objective-C class that have categories we
417  /// should serialize.
418  llvm::SetVector<ObjCInterfaceDecl *> ObjCClassesWithCategories;
419
420  /// The set of declarations that may have redeclaration chains that
421  /// need to be serialized.
422  llvm::SmallVector<const Decl *, 16Redeclarations;
423
424  /// A cache of the first local declaration for "interesting"
425  /// redeclaration chains.
426  llvm::DenseMap<const Decl *, const Decl *> FirstLocalDeclCache;
427
428  /// Mapping from SwitchCase statements to IDs.
429  llvm::DenseMap<SwitchCase *, unsignedSwitchCaseIDs;
430
431  /// The number of statements written to the AST file.
432  unsigned NumStatements = 0;
433
434  /// The number of macros written to the AST file.
435  unsigned NumMacros = 0;
436
437  /// The number of lexical declcontexts written to the AST
438  /// file.
439  unsigned NumLexicalDeclContexts = 0;
440
441  /// The number of visible declcontexts written to the AST
442  /// file.
443  unsigned NumVisibleDeclContexts = 0;
444
445  /// A mapping from each known submodule to its ID number, which will
446  /// be a positive integer.
447  llvm::DenseMap<Module *, unsignedSubmoduleIDs;
448
449  /// A list of the module file extension writers.
450  std::vector<std::unique_ptr<ModuleFileExtensionWriter>>
451    ModuleFileExtensionWriters;
452
453  /// Retrieve or create a submodule ID for this module.
454  unsigned getSubmoduleID(Module *Mod);
455
456  /// Write the given subexpression to the bitstream.
457  void WriteSubStmt(Stmt *S);
458
459  void WriteBlockInfoBlock();
460  void WriteControlBlock(Preprocessor &PPASTContext &Context,
461                         StringRef isysrootconst std::string &OutputFile);
462
463  /// Write out the signature and diagnostic options, and return the signature.
464  ASTFileSignature writeUnhashedControlBlock(Preprocessor &PP,
465                                             ASTContext &Context);
466
467  /// Calculate hash of the pcm content.
468  static ASTFileSignature createSignature(StringRef Bytes);
469
470  void WriteInputFiles(SourceManager &SourceMgrHeaderSearchOptions &HSOpts,
471                       bool Modules);
472  void WriteSourceManagerBlock(SourceManager &SourceMgr,
473                               const Preprocessor &PP);
474  void WritePreprocessor(const Preprocessor &PPbool IsModule);
475  void WriteHeaderSearch(const HeaderSearch &HS);
476  void WritePreprocessorDetail(PreprocessingRecord &PPRec);
477  void WriteSubmodules(Module *WritingModule);
478
479  void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
480                                     bool isModule);
481
482  unsigned TypeExtQualAbbrev = 0;
483  unsigned TypeFunctionProtoAbbrev = 0;
484  void WriteTypeAbbrevs();
485  void WriteType(QualType T);
486
487  bool isLookupResultExternal(StoredDeclsList &ResultDeclContext *DC);
488  bool isLookupResultEntirelyExternal(StoredDeclsList &ResultDeclContext *DC);
489
490  void GenerateNameLookupTable(const DeclContext *DC,
491                               llvm::SmallVectorImpl<char> &LookupTable);
492  uint64_t WriteDeclContextLexicalBlock(ASTContext &ContextDeclContext *DC);
493  uint64_t WriteDeclContextVisibleBlock(ASTContext &ContextDeclContext *DC);
494  void WriteTypeDeclOffsets();
495  void WriteFileDeclIDsMap();
496  void WriteComments();
497  void WriteSelectors(Sema &SemaRef);
498  void WriteReferencedSelectorsPool(Sema &SemaRef);
499  void WriteIdentifierTable(Preprocessor &PPIdentifierResolver &IdResolver,
500                            bool IsModule);
501  void WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord);
502  void WriteDeclContextVisibleUpdate(const DeclContext *DC);
503  void WriteFPPragmaOptions(const FPOptions &Opts);
504  void WriteOpenCLExtensions(Sema &SemaRef);
505  void WriteOpenCLExtensionTypes(Sema &SemaRef);
506  void WriteOpenCLExtensionDecls(Sema &SemaRef);
507  void WriteCUDAPragmas(Sema &SemaRef);
508  void WriteObjCCategories();
509  void WriteLateParsedTemplates(Sema &SemaRef);
510  void WriteOptimizePragmaOptions(Sema &SemaRef);
511  void WriteMSStructPragmaOptions(Sema &SemaRef);
512  void WriteMSPointersToMembersPragmaOptions(Sema &SemaRef);
513  void WritePackPragmaOptions(Sema &SemaRef);
514  void WriteModuleFileExtension(Sema &SemaRef,
515                                ModuleFileExtensionWriter &Writer);
516
517  unsigned DeclParmVarAbbrev = 0;
518  unsigned DeclContextLexicalAbbrev = 0;
519  unsigned DeclContextVisibleLookupAbbrev = 0;
520  unsigned UpdateVisibleAbbrev = 0;
521  unsigned DeclRecordAbbrev = 0;
522  unsigned DeclTypedefAbbrev = 0;
523  unsigned DeclVarAbbrev = 0;
524  unsigned DeclFieldAbbrev = 0;
525  unsigned DeclEnumAbbrev = 0;
526  unsigned DeclObjCIvarAbbrev = 0;
527  unsigned DeclCXXMethodAbbrev = 0;
528
529  unsigned DeclRefExprAbbrev = 0;
530  unsigned CharacterLiteralAbbrev = 0;
531  unsigned IntegerLiteralAbbrev = 0;
532  unsigned ExprImplicitCastAbbrev = 0;
533
534  void WriteDeclAbbrevs();
535  void WriteDecl(ASTContext &ContextDecl *D);
536
537  ASTFileSignature WriteASTCore(Sema &SemaRefStringRef isysroot,
538                                const std::string &OutputFile,
539                                Module *WritingModule);
540
541public:
542  /// Create a new precompiled header writer that outputs to
543  /// the given bitstream.
544  ASTWriter(llvm::BitstreamWriter &StreamSmallVectorImpl<char> &Buffer,
545            InMemoryModuleCache &ModuleCache,
546            ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
547            bool IncludeTimestamps = true);
548  ~ASTWriter() override;
549
550  const LangOptions &getLangOpts() const;
551
552  /// Get a timestamp for output into the AST file. The actual timestamp
553  /// of the specified file may be ignored if we have been instructed to not
554  /// include timestamps in the output file.
555  time_t getTimestampForOutput(const FileEntry *Econst;
556
557  /// Write a precompiled header for the given semantic analysis.
558  ///
559  /// \param SemaRef a reference to the semantic analysis object that processed
560  /// the AST to be written into the precompiled header.
561  ///
562  /// \param WritingModule The module that we are writing. If null, we are
563  /// writing a precompiled header.
564  ///
565  /// \param isysroot if non-empty, write a relocatable file whose headers
566  /// are relative to the given system root. If we're writing a module, its
567  /// build directory will be used in preference to this if both are available.
568  ///
569  /// \return the module signature, which eventually will be a hash of
570  /// the module but currently is merely a random 32-bit number.
571  ASTFileSignature WriteAST(Sema &SemaRefconst std::string &OutputFile,
572                            Module *WritingModuleStringRef isysroot,
573                            bool hasErrors = false,
574                            bool ShouldCacheASTInMemory = false);
575
576  /// Emit a token.
577  void AddToken(const Token &TokRecordDataImpl &Record);
578
579  /// Emit a source location.
580  void AddSourceLocation(SourceLocation LocRecordDataImpl &Record);
581
582  /// Emit a source range.
583  void AddSourceRange(SourceRange RangeRecordDataImpl &Record);
584
585  /// Emit a reference to an identifier.
586  void AddIdentifierRef(const IdentifierInfo *IIRecordDataImpl &Record);
587
588  /// Get the unique number used to refer to the given selector.
589  serialization::SelectorID getSelectorRef(Selector Sel);
590
591  /// Get the unique number used to refer to the given identifier.
592  serialization::IdentID getIdentifierRef(const IdentifierInfo *II);
593
594  /// Get the unique number used to refer to the given macro.
595  serialization::MacroID getMacroRef(MacroInfo *MIconst IdentifierInfo *Name);
596
597  /// Determine the ID of an already-emitted macro.
598  serialization::MacroID getMacroID(MacroInfo *MI);
599
600  uint64_t getMacroDirectivesOffset(const IdentifierInfo *Name);
601
602  /// Emit a reference to a type.
603  void AddTypeRef(QualType TRecordDataImpl &Record);
604
605  /// Force a type to be emitted and get its ID.
606  serialization::TypeID GetOrCreateTypeID(QualType T);
607
608  /// Determine the type ID of an already-emitted type.
609  serialization::TypeID getTypeID(QualType Tconst;
610
611  /// Find the first local declaration of a given local redeclarable
612  /// decl.
613  const Decl *getFirstLocalDecl(const Decl *D);
614
615  /// Is this a local declaration (that is, one that will be written to
616  /// our AST file)? This is the case for declarations that are neither imported
617  /// from another AST file nor predefined.
618  bool IsLocalDecl(const Decl *D) {
619    if (D->isFromASTFile())
620      return false;
621    auto I = DeclIDs.find(D);
622    return (I == DeclIDs.end() ||
623            I->second >= serialization::NUM_PREDEF_DECL_IDS);
624  };
625
626  /// Emit a reference to a declaration.
627  void AddDeclRef(const Decl *DRecordDataImpl &Record);
628
629  /// Force a declaration to be emitted and get its ID.
630  serialization::DeclID GetDeclRef(const Decl *D);
631
632  /// Determine the declaration ID of an already-emitted
633  /// declaration.
634  serialization::DeclID getDeclID(const Decl *D);
635
636  unsigned getAnonymousDeclarationNumber(const NamedDecl *D);
637
638  /// Add a string to the given record.
639  void AddString(StringRef StrRecordDataImpl &Record);
640
641  /// Convert a path from this build process into one that is appropriate
642  /// for emission in the module file.
643  bool PreparePathForOutput(SmallVectorImpl<char> &Path);
644
645  /// Add a path to the given record.
646  void AddPath(StringRef PathRecordDataImpl &Record);
647
648  /// Emit the current record with the given path as a blob.
649  void EmitRecordWithPath(unsigned AbbrevRecordDataRef Record,
650                          StringRef Path);
651
652  /// Add a version tuple to the given record
653  void AddVersionTuple(const VersionTuple &VersionRecordDataImpl &Record);
654
655  /// Retrieve or create a submodule ID for this module, or return 0 if
656  /// the submodule is neither local (a submodle of the currently-written module)
657  /// nor from an imported module.
658  unsigned getLocalOrImportedSubmoduleID(Module *Mod);
659
660  /// Note that the identifier II occurs at the given offset
661  /// within the identifier table.
662  void SetIdentifierOffset(const IdentifierInfo *IIuint32_t Offset);
663
664  /// Note that the selector Sel occurs at the given offset
665  /// within the method pool/selector table.
666  void SetSelectorOffset(Selector Seluint32_t Offset);
667
668  /// Record an ID for the given switch-case statement.
669  unsigned RecordSwitchCaseID(SwitchCase *S);
670
671  /// Retrieve the ID for the given switch-case statement.
672  unsigned getSwitchCaseID(SwitchCase *S);
673
674  void ClearSwitchCaseIDs();
675
676  unsigned getTypeExtQualAbbrev() const {
677    return TypeExtQualAbbrev;
678  }
679
680  unsigned getTypeFunctionProtoAbbrev() const {
681    return TypeFunctionProtoAbbrev;
682  }
683
684  unsigned getDeclParmVarAbbrev() const { return DeclParmVarAbbrev; }
685  unsigned getDeclRecordAbbrev() const { return DeclRecordAbbrev; }
686  unsigned getDeclTypedefAbbrev() const { return DeclTypedefAbbrev; }
687  unsigned getDeclVarAbbrev() const { return DeclVarAbbrev; }
688  unsigned getDeclFieldAbbrev() const { return DeclFieldAbbrev; }
689  unsigned getDeclEnumAbbrev() const { return DeclEnumAbbrev; }
690  unsigned getDeclObjCIvarAbbrev() const { return DeclObjCIvarAbbrev; }
691  unsigned getDeclCXXMethodAbbrev() const { return DeclCXXMethodAbbrev; }
692
693  unsigned getDeclRefExprAbbrev() const { return DeclRefExprAbbrev; }
694  unsigned getCharacterLiteralAbbrev() const { return CharacterLiteralAbbrev; }
695  unsigned getIntegerLiteralAbbrev() const { return IntegerLiteralAbbrev; }
696  unsigned getExprImplicitCastAbbrev() const { return ExprImplicitCastAbbrev; }
697
698  bool hasChain() const { return Chain; }
699  ASTReader *getChain() const { return Chain; }
700
701private:
702  // ASTDeserializationListener implementation
703  void ReaderInitialized(ASTReader *Reader) override;
704  void IdentifierRead(serialization::IdentID IDIdentifierInfo *II) override;
705  void MacroRead(serialization::MacroID IDMacroInfo *MI) override;
706  void TypeRead(serialization::TypeIdx IdxQualType T) override;
707  void SelectorRead(serialization::SelectorID IDSelector Sel) override;
708  void MacroDefinitionRead(serialization::PreprocessedEntityID ID,
709                           MacroDefinitionRecord *MD) override;
710  void ModuleRead(serialization::SubmoduleID IDModule *Mod) override;
711
712  // ASTMutationListener implementation.
713  void CompletedTagDefinition(const TagDecl *D) override;
714  void AddedVisibleDecl(const DeclContext *DCconst Decl *D) override;
715  void AddedCXXImplicitMember(const CXXRecordDecl *RDconst Decl *D) override;
716  void AddedCXXTemplateSpecialization(
717      const ClassTemplateDecl *TD,
718      const ClassTemplateSpecializationDecl *D) override;
719  void AddedCXXTemplateSpecialization(
720      const VarTemplateDecl *TD,
721      const VarTemplateSpecializationDecl *D) override;
722  void AddedCXXTemplateSpecialization(const FunctionTemplateDecl *TD,
723                                      const FunctionDecl *D) override;
724  void ResolvedExceptionSpec(const FunctionDecl *FD) override;
725  void DeducedReturnType(const FunctionDecl *FDQualType ReturnType) override;
726  void ResolvedOperatorDelete(const CXXDestructorDecl *DD,
727                              const FunctionDecl *Delete,
728                              Expr *ThisArg) override;
729  void CompletedImplicitDefinition(const FunctionDecl *D) override;
730  void InstantiationRequested(const ValueDecl *D) override;
731  void VariableDefinitionInstantiated(const VarDecl *D) override;
732  void FunctionDefinitionInstantiated(const FunctionDecl *D) override;
733  void DefaultArgumentInstantiated(const ParmVarDecl *D) override;
734  void DefaultMemberInitializerInstantiated(const FieldDecl *D) override;
735  void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
736                                    const ObjCInterfaceDecl *IFD) override;
737  void DeclarationMarkedUsed(const Decl *D) override;
738  void DeclarationMarkedOpenMPThreadPrivate(const Decl *D) override;
739  void DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
740                                            const Attr *Attr) override;
741  void DeclarationMarkedOpenMPAllocate(const Decl *Dconst Attr *A) override;
742  void RedefinedHiddenDefinition(const NamedDecl *DModule *M) override;
743  void AddedAttributeToRecord(const Attr *Attr,
744                              const RecordDecl *Record) override;
745};
746
747/// An object for streaming information to a record.
748class ASTRecordWriter {
749  ASTWriter *Writer;
750  ASTWriter::RecordDataImpl *Record;
751
752  /// Statements that we've encountered while serializing a
753  /// declaration or type.
754  SmallVector<Stmt *, 16StmtsToEmit;
755
756  /// Indices of record elements that describe offsets within the
757  /// bitcode. These will be converted to offsets relative to the current
758  /// record when emitted.
759  SmallVector<unsigned8OffsetIndices;
760
761  /// Flush all of the statements and expressions that have
762  /// been added to the queue via AddStmt().
763  void FlushStmts();
764  void FlushSubStmts();
765
766  void PrepareToEmit(uint64_t MyOffset) {
767    // Convert offsets into relative form.
768    for (unsigned I : OffsetIndices) {
769      auto &StoredOffset = (*Record)[I];
770       (0) . __assert_fail ("StoredOffset < MyOffset && \"invalid offset\"", "/home/seafit/code_projects/clang_source/clang/include/clang/Serialization/ASTWriter.h", 770, __PRETTY_FUNCTION__))" file_link="../../../../include/assert.h.html#88" macro="true">assert(StoredOffset < MyOffset && "invalid offset");
771      if (StoredOffset)
772        StoredOffset = MyOffset - StoredOffset;
773    }
774    OffsetIndices.clear();
775  }
776
777public:
778  /// Construct a ASTRecordWriter that uses the default encoding scheme.
779  ASTRecordWriter(ASTWriter &WriterASTWriter::RecordDataImpl &Record)
780      : Writer(&Writer), Record(&Record) {}
781
782  /// Construct a ASTRecordWriter that uses the same encoding scheme as another
783  /// ASTRecordWriter.
784  ASTRecordWriter(ASTRecordWriter &ParentASTWriter::RecordDataImpl &Record)
785      : Writer(Parent.Writer), Record(&Record) {}
786
787  /// Copying an ASTRecordWriter is almost certainly a bug.
788  ASTRecordWriter(const ASTRecordWriter &) = delete;
789  ASTRecordWriter &operator=(const ASTRecordWriter &) = delete;
790
791  /// Extract the underlying record storage.
792  ASTWriter::RecordDataImpl &getRecordData() const { return *Record; }
793
794  /// Minimal vector-like interface.
795  /// @{
796  void push_back(uint64_t N) { Record->push_back(N); }
797  template<typename InputIterator>
798  void append(InputIterator begin, InputIterator end) {
799    Record->append(begin, end);
800  }
801  bool empty() const { return Record->empty(); }
802  size_t size() const { return Record->size(); }
803  uint64_t &operator[](size_t N) { return (*Record)[N]; }
804  /// @}
805
806  /// Emit the record to the stream, followed by its substatements, and
807  /// return its offset.
808  // FIXME: Allow record producers to suggest Abbrevs.
809  uint64_t Emit(unsigned Codeunsigned Abbrev = 0) {
810    uint64_t Offset = Writer->Stream.GetCurrentBitNo();
811    PrepareToEmit(Offset);
812    Writer->Stream.EmitRecord(Code, *RecordAbbrev);
813    FlushStmts();
814    return Offset;
815  }
816
817  /// Emit the record to the stream, preceded by its substatements.
818  uint64_t EmitStmt(unsigned Codeunsigned Abbrev = 0) {
819    FlushSubStmts();
820    PrepareToEmit(Writer->Stream.GetCurrentBitNo());
821    Writer->Stream.EmitRecord(Code, *RecordAbbrev);
822    return Writer->Stream.GetCurrentBitNo();
823  }
824
825  /// Add a bit offset into the record. This will be converted into an
826  /// offset relative to the current record when emitted.
827  void AddOffset(uint64_t BitOffset) {
828    OffsetIndices.push_back(Record->size());
829    Record->push_back(BitOffset);
830  }
831
832  /// Add the given statement or expression to the queue of
833  /// statements to emit.
834  ///
835  /// This routine should be used when emitting types and declarations
836  /// that have expressions as part of their formulation. Once the
837  /// type or declaration has been written, Emit() will write
838  /// the corresponding statements just after the record.
839  void AddStmt(Stmt *S) {
840    StmtsToEmit.push_back(S);
841  }
842
843  /// Add a definition for the given function to the queue of statements
844  /// to emit.
845  void AddFunctionDefinition(const FunctionDecl *FD);
846
847  /// Emit a source location.
848  void AddSourceLocation(SourceLocation Loc) {
849    return Writer->AddSourceLocation(Loc*Record);
850  }
851
852  /// Emit a source range.
853  void AddSourceRange(SourceRange Range) {
854    return Writer->AddSourceRange(Range*Record);
855  }
856
857  /// Emit an integral value.
858  void AddAPInt(const llvm::APInt &Value);
859
860  /// Emit a signed integral value.
861  void AddAPSInt(const llvm::APSInt &Value);
862
863  /// Emit a floating-point value.
864  void AddAPFloat(const llvm::APFloat &Value);
865
866  /// Emit a reference to an identifier.
867  void AddIdentifierRef(const IdentifierInfo *II) {
868    return Writer->AddIdentifierRef(II*Record);
869  }
870
871  /// Emit a Selector (which is a smart pointer reference).
872  void AddSelectorRef(Selector S);
873
874  /// Emit a CXXTemporary.
875  void AddCXXTemporary(const CXXTemporary *Temp);
876
877  /// Emit a C++ base specifier.
878  void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base);
879
880  /// Emit a set of C++ base specifiers.
881  void AddCXXBaseSpecifiers(ArrayRef<CXXBaseSpecifierBases);
882
883  /// Emit a reference to a type.
884  void AddTypeRef(QualType T) {
885    return Writer->AddTypeRef(T*Record);
886  }
887
888  /// Emits a reference to a declarator info.
889  void AddTypeSourceInfo(TypeSourceInfo *TInfo);
890
891  /// Emits source location information for a type. Does not emit the type.
892  void AddTypeLoc(TypeLoc TL);
893
894  /// Emits a template argument location info.
895  void AddTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind,
896                                  const TemplateArgumentLocInfo &Arg);
897
898  /// Emits a template argument location.
899  void AddTemplateArgumentLoc(const TemplateArgumentLoc &Arg);
900
901  /// Emits an AST template argument list info.
902  void AddASTTemplateArgumentListInfo(
903      const ASTTemplateArgumentListInfo *ASTTemplArgList);
904
905  /// Emit a reference to a declaration.
906  void AddDeclRef(const Decl *D) {
907    return Writer->AddDeclRef(D*Record);
908  }
909
910  /// Emit a declaration name.
911  void AddDeclarationName(DeclarationName Name);
912
913  void AddDeclarationNameLoc(const DeclarationNameLoc &DNLoc,
914                             DeclarationName Name);
915  void AddDeclarationNameInfo(const DeclarationNameInfo &NameInfo);
916
917  void AddQualifierInfo(const QualifierInfo &Info);
918
919  /// Emit a nested name specifier.
920  void AddNestedNameSpecifier(NestedNameSpecifier *NNS);
921
922  /// Emit a nested name specifier with source-location information.
923  void AddNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS);
924
925  /// Emit a template name.
926  void AddTemplateName(TemplateName Name);
927
928  /// Emit a template argument.
929  void AddTemplateArgument(const TemplateArgument &Arg);
930
931  /// Emit a template parameter list.
932  void AddTemplateParameterList(const TemplateParameterList *TemplateParams);
933
934  /// Emit a template argument list.
935  void AddTemplateArgumentList(const TemplateArgumentList *TemplateArgs);
936
937  /// Emit a UnresolvedSet structure.
938  void AddUnresolvedSet(const ASTUnresolvedSet &Set);
939
940  /// Emit a CXXCtorInitializer array.
941  void AddCXXCtorInitializers(ArrayRef<CXXCtorInitializer *> CtorInits);
942
943  void AddCXXDefinitionData(const CXXRecordDecl *D);
944
945  /// Emit a string.
946  void AddString(StringRef Str) {
947    return Writer->AddString(Str, *Record);
948  }
949
950  /// Emit a path.
951  void AddPath(StringRef Path) {
952    return Writer->AddPath(Path, *Record);
953  }
954
955  /// Emit a version tuple.
956  void AddVersionTuple(const VersionTuple &Version) {
957    return Writer->AddVersionTuple(Version*Record);
958  }
959
960  // Emit an attribute.
961  void AddAttr(const Attr *A);
962
963  /// Emit a list of attributes.
964  void AddAttributes(ArrayRef<const Attr*> Attrs);
965};
966
967/// AST and semantic-analysis consumer that generates a
968/// precompiled header from the parsed source code.
969class PCHGenerator : public SemaConsumer {
970  const Preprocessor &PP;
971  std::string OutputFile;
972  std::string isysroot;
973  Sema *SemaPtr;
974  std::shared_ptr<PCHBufferBuffer;
975  llvm::BitstreamWriter Stream;
976  ASTWriter Writer;
977  bool AllowASTWithErrors;
978  bool ShouldCacheASTInMemory;
979
980protected:
981  ASTWriter &getWriter() { return Writer; }
982  const ASTWriter &getWriter() const { return Writer; }
983  SmallVectorImpl<char> &getPCH() const { return Buffer->Data; }
984
985public:
986  PCHGenerator(const Preprocessor &PPInMemoryModuleCache &ModuleCache,
987               StringRef OutputFileStringRef isysroot,
988               std::shared_ptr<PCHBufferBuffer,
989               ArrayRef<std::shared_ptr<ModuleFileExtension>> Extensions,
990               bool AllowASTWithErrors = falsebool IncludeTimestamps = true,
991               bool ShouldCacheASTInMemory = false);
992  ~PCHGenerator() override;
993
994  void InitializeSema(Sema &S) override { SemaPtr = &S; }
995  void HandleTranslationUnit(ASTContext &Ctx) override;
996  ASTMutationListener *GetASTMutationListener() override;
997  ASTDeserializationListener *GetASTDeserializationListener() override;
998  bool hasEmittedPCH() const { return Buffer->IsComplete; }
999};
1000
1001class OMPClauseWriter : public OMPClauseVisitor<OMPClauseWriter> {
1002  ASTRecordWriter &Record;
1003
1004public:
1005  OMPClauseWriter(ASTRecordWriter &Record) : Record(Record) {}
1006#define OPENMP_CLAUSE(Name, Class) void Visit##Class(Class *S);
1007#include "clang/Basic/OpenMPKinds.def"
1008  void writeClause(OMPClause *C);
1009  void VisitOMPClauseWithPreInit(OMPClauseWithPreInit *C);
1010  void VisitOMPClauseWithPostUpdate(OMPClauseWithPostUpdate *C);
1011};
1012
1013// namespace clang
1014
1015#endif // LLVM_CLANG_SERIALIZATION_ASTWRITER_H
1016
clang::ASTWriter::Stream
clang::ASTWriter::Buffer
clang::ASTWriter::ModuleCache
clang::ASTWriter::Context
clang::ASTWriter::PP
clang::ASTWriter::Chain
clang::ASTWriter::WritingModule
clang::ASTWriter::BaseDirectory
clang::ASTWriter::IncludeTimestamps
clang::ASTWriter::WritingAST
clang::ASTWriter::DoneWritingDeclsAndTypes
clang::ASTWriter::ASTHasCompilerErrors
clang::ASTWriter::InputFileIDs
clang::ASTWriter::DeclOrType
clang::ASTWriter::DeclOrType::isType
clang::ASTWriter::DeclOrType::isDecl
clang::ASTWriter::DeclOrType::getType
clang::ASTWriter::DeclOrType::getDecl
clang::ASTWriter::DeclOrType::Stored
clang::ASTWriter::DeclOrType::IsType
clang::ASTWriter::DeclTypesToEmit
clang::ASTWriter::FirstDeclID
clang::ASTWriter::NextDeclID
clang::ASTWriter::DeclIDs
clang::ASTWriter::DeclOffsets
clang::ASTWriter::DeclIDInFileInfo
clang::ASTWriter::DeclIDInFileInfo::DeclIDs
clang::ASTWriter::DeclIDInFileInfo::FirstDeclIndex
clang::ASTWriter::FileDeclIDs
clang::ASTWriter::associateDeclWithFile
clang::ASTWriter::FirstTypeID
clang::ASTWriter::NextTypeID
clang::ASTWriter::TypeIdxs
clang::ASTWriter::TypeOffsets
clang::ASTWriter::FirstIdentID
clang::ASTWriter::NextIdentID
clang::ASTWriter::IdentifierIDs
clang::ASTWriter::FirstMacroID
clang::ASTWriter::NextMacroID
clang::ASTWriter::MacroIDs
clang::ASTWriter::MacroInfoToEmitData
clang::ASTWriter::MacroInfoToEmitData::Name
clang::ASTWriter::MacroInfoToEmitData::MI
clang::ASTWriter::MacroInfoToEmitData::ID
clang::ASTWriter::MacroInfosToEmit
clang::ASTWriter::IdentMacroDirectivesOffsetMap
clang::ASTWriter::ParentStmts
clang::ASTWriter::SubStmtEntries
clang::ASTWriter::IdentifierOffsets
clang::ASTWriter::FirstSubmoduleID
clang::ASTWriter::NextSubmoduleID
clang::ASTWriter::FirstSelectorID
clang::ASTWriter::NextSelectorID
clang::ASTWriter::SelectorIDs
clang::ASTWriter::SelectorOffsets
clang::ASTWriter::MacroDefinitions
clang::ASTWriter::AnonymousDeclarationNumbers
clang::ASTWriter::DeclUpdate
clang::ASTWriter::DeclUpdate::Kind
clang::ASTWriter::DeclUpdate::(anonymous union)::Dcl
clang::ASTWriter::DeclUpdate::(anonymous union)::Type
clang::ASTWriter::DeclUpdate::(anonymous union)::Loc
clang::ASTWriter::DeclUpdate::(anonymous union)::Val
clang::ASTWriter::DeclUpdate::(anonymous union)::Mod
clang::ASTWriter::DeclUpdate::(anonymous union)::Attribute
clang::ASTWriter::DeclUpdate::getKind
clang::ASTWriter::DeclUpdate::getDecl
clang::ASTWriter::DeclUpdate::getType
clang::ASTWriter::DeclUpdate::getLoc
clang::ASTWriter::DeclUpdate::getNumber
clang::ASTWriter::DeclUpdate::getModule
clang::ASTWriter::DeclUpdate::getAttr
clang::ASTWriter::DeclUpdates
clang::ASTWriter::FirstLatestDecls
clang::ASTWriter::EagerlyDeserializedDecls
clang::ASTWriter::ModularCodegenDecls
clang::ASTWriter::UpdatedDeclContexts
clang::ASTWriter::DeclsToEmitEvenIfUnreferenced
clang::ASTWriter::ObjCClassesWithCategories
clang::ASTWriter::Redeclarations
clang::ASTWriter::FirstLocalDeclCache
clang::ASTWriter::SwitchCaseIDs
clang::ASTWriter::NumStatements
clang::ASTWriter::NumMacros
clang::ASTWriter::NumLexicalDeclContexts
clang::ASTWriter::NumVisibleDeclContexts
clang::ASTWriter::SubmoduleIDs
clang::ASTWriter::ModuleFileExtensionWriters
clang::ASTWriter::getSubmoduleID
clang::ASTWriter::WriteSubStmt
clang::ASTWriter::WriteBlockInfoBlock
clang::ASTWriter::WriteControlBlock
clang::ASTWriter::writeUnhashedControlBlock
clang::ASTWriter::createSignature
clang::ASTWriter::WriteInputFiles
clang::ASTWriter::WriteSourceManagerBlock
clang::ASTWriter::WritePreprocessor
clang::ASTWriter::WriteHeaderSearch
clang::ASTWriter::WritePreprocessorDetail
clang::ASTWriter::WriteSubmodules
clang::ASTWriter::WritePragmaDiagnosticMappings
clang::ASTWriter::TypeExtQualAbbrev
clang::ASTWriter::TypeFunctionProtoAbbrev
clang::ASTWriter::WriteTypeAbbrevs
clang::ASTWriter::WriteType
clang::ASTWriter::isLookupResultExternal
clang::ASTWriter::isLookupResultEntirelyExternal
clang::ASTWriter::GenerateNameLookupTable
clang::ASTWriter::WriteDeclContextLexicalBlock
clang::ASTWriter::WriteDeclContextVisibleBlock
clang::ASTWriter::WriteTypeDeclOffsets
clang::ASTWriter::WriteFileDeclIDsMap
clang::ASTWriter::WriteComments
clang::ASTWriter::WriteSelectors
clang::ASTWriter::WriteReferencedSelectorsPool
clang::ASTWriter::WriteIdentifierTable
clang::ASTWriter::WriteDeclUpdatesBlocks
clang::ASTWriter::WriteDeclContextVisibleUpdate
clang::ASTWriter::WriteFPPragmaOptions
clang::ASTWriter::WriteOpenCLExtensions
clang::ASTWriter::WriteOpenCLExtensionTypes
clang::ASTWriter::WriteOpenCLExtensionDecls
clang::ASTWriter::WriteCUDAPragmas
clang::ASTWriter::WriteObjCCategories
clang::ASTWriter::WriteLateParsedTemplates
clang::ASTWriter::WriteOptimizePragmaOptions
clang::ASTWriter::WriteMSStructPragmaOptions
clang::ASTWriter::WriteMSPointersToMembersPragmaOptions
clang::ASTWriter::WritePackPragmaOptions
clang::ASTWriter::WriteModuleFileExtension
clang::ASTWriter::DeclParmVarAbbrev
clang::ASTWriter::DeclContextLexicalAbbrev
clang::ASTWriter::DeclContextVisibleLookupAbbrev
clang::ASTWriter::UpdateVisibleAbbrev
clang::ASTWriter::DeclRecordAbbrev
clang::ASTWriter::DeclTypedefAbbrev
clang::ASTWriter::DeclVarAbbrev
clang::ASTWriter::DeclFieldAbbrev
clang::ASTWriter::DeclEnumAbbrev
clang::ASTWriter::DeclObjCIvarAbbrev
clang::ASTWriter::DeclCXXMethodAbbrev
clang::ASTWriter::DeclRefExprAbbrev
clang::ASTWriter::CharacterLiteralAbbrev
clang::ASTWriter::IntegerLiteralAbbrev
clang::ASTWriter::ExprImplicitCastAbbrev
clang::ASTWriter::WriteDeclAbbrevs
clang::ASTWriter::WriteDecl
clang::ASTWriter::WriteASTCore
clang::ASTWriter::getLangOpts
clang::ASTWriter::getTimestampForOutput
clang::ASTWriter::WriteAST
clang::ASTWriter::AddToken
clang::ASTWriter::AddSourceLocation
clang::ASTWriter::AddSourceRange
clang::ASTWriter::AddIdentifierRef
clang::ASTWriter::getSelectorRef
clang::ASTWriter::getIdentifierRef
clang::ASTWriter::getMacroRef
clang::ASTWriter::getMacroID
clang::ASTWriter::getMacroDirectivesOffset
clang::ASTWriter::AddTypeRef
clang::ASTWriter::GetOrCreateTypeID
clang::ASTWriter::getTypeID
clang::ASTWriter::getFirstLocalDecl
clang::ASTWriter::IsLocalDecl
clang::ASTWriter::AddDeclRef
clang::ASTWriter::GetDeclRef
clang::ASTWriter::getDeclID
clang::ASTWriter::getAnonymousDeclarationNumber
clang::ASTWriter::AddString
clang::ASTWriter::PreparePathForOutput
clang::ASTWriter::AddPath
clang::ASTWriter::EmitRecordWithPath
clang::ASTWriter::AddVersionTuple
clang::ASTWriter::getLocalOrImportedSubmoduleID
clang::ASTWriter::SetIdentifierOffset
clang::ASTWriter::SetSelectorOffset
clang::ASTWriter::RecordSwitchCaseID
clang::ASTWriter::getSwitchCaseID
clang::ASTWriter::ClearSwitchCaseIDs
clang::ASTWriter::getTypeExtQualAbbrev
clang::ASTWriter::getTypeFunctionProtoAbbrev
clang::ASTWriter::getDeclParmVarAbbrev
clang::ASTWriter::getDeclRecordAbbrev
clang::ASTWriter::getDeclTypedefAbbrev
clang::ASTWriter::getDeclVarAbbrev
clang::ASTWriter::getDeclFieldAbbrev
clang::ASTWriter::getDeclEnumAbbrev
clang::ASTWriter::getDeclObjCIvarAbbrev
clang::ASTWriter::getDeclCXXMethodAbbrev
clang::ASTWriter::getDeclRefExprAbbrev
clang::ASTWriter::getCharacterLiteralAbbrev
clang::ASTWriter::getIntegerLiteralAbbrev
clang::ASTWriter::getExprImplicitCastAbbrev
clang::ASTWriter::hasChain
clang::ASTWriter::getChain
clang::ASTWriter::ReaderInitialized
clang::ASTWriter::IdentifierRead
clang::ASTWriter::MacroRead
clang::ASTWriter::TypeRead
clang::ASTWriter::SelectorRead
clang::ASTWriter::MacroDefinitionRead
clang::ASTWriter::ModuleRead
clang::ASTWriter::CompletedTagDefinition
clang::ASTWriter::AddedVisibleDecl
clang::ASTWriter::AddedCXXImplicitMember
clang::ASTWriter::AddedCXXTemplateSpecialization
clang::ASTWriter::AddedCXXTemplateSpecialization
clang::ASTWriter::AddedCXXTemplateSpecialization
clang::ASTWriter::ResolvedExceptionSpec
clang::ASTWriter::DeducedReturnType
clang::ASTWriter::ResolvedOperatorDelete
clang::ASTWriter::CompletedImplicitDefinition
clang::ASTWriter::InstantiationRequested
clang::ASTWriter::VariableDefinitionInstantiated
clang::ASTWriter::FunctionDefinitionInstantiated
clang::ASTWriter::DefaultArgumentInstantiated
clang::ASTWriter::DefaultMemberInitializerInstantiated
clang::ASTWriter::AddedObjCCategoryToInterface
clang::ASTWriter::DeclarationMarkedUsed
clang::ASTWriter::DeclarationMarkedOpenMPThreadPrivate
clang::ASTWriter::DeclarationMarkedOpenMPDeclareTarget
clang::ASTWriter::DeclarationMarkedOpenMPAllocate
clang::ASTWriter::RedefinedHiddenDefinition
clang::ASTWriter::AddedAttributeToRecord
clang::ASTRecordWriter::Writer
clang::ASTRecordWriter::Record
clang::ASTRecordWriter::StmtsToEmit
clang::ASTRecordWriter::OffsetIndices
clang::ASTRecordWriter::FlushStmts
clang::ASTRecordWriter::FlushSubStmts
clang::ASTRecordWriter::PrepareToEmit
clang::ASTRecordWriter::getRecordData
clang::ASTRecordWriter::push_back
clang::ASTRecordWriter::append
clang::ASTRecordWriter::empty
clang::ASTRecordWriter::size
clang::ASTRecordWriter::Emit
clang::ASTRecordWriter::EmitStmt
clang::ASTRecordWriter::AddOffset
clang::ASTRecordWriter::AddStmt
clang::ASTRecordWriter::AddFunctionDefinition
clang::ASTRecordWriter::AddSourceLocation
clang::ASTRecordWriter::AddSourceRange
clang::ASTRecordWriter::AddAPInt
clang::ASTRecordWriter::AddAPSInt
clang::ASTRecordWriter::AddAPFloat
clang::ASTRecordWriter::AddIdentifierRef
clang::ASTRecordWriter::AddSelectorRef
clang::ASTRecordWriter::AddCXXTemporary
clang::ASTRecordWriter::AddCXXBaseSpecifier
clang::ASTRecordWriter::AddCXXBaseSpecifiers
clang::ASTRecordWriter::AddTypeRef
clang::ASTRecordWriter::AddTypeSourceInfo
clang::ASTRecordWriter::AddTypeLoc
clang::ASTRecordWriter::AddTemplateArgumentLocInfo
clang::ASTRecordWriter::AddTemplateArgumentLoc
clang::ASTRecordWriter::AddASTTemplateArgumentListInfo
clang::ASTRecordWriter::AddDeclRef
clang::ASTRecordWriter::AddDeclarationName
clang::ASTRecordWriter::AddDeclarationNameLoc
clang::ASTRecordWriter::AddDeclarationNameInfo
clang::ASTRecordWriter::AddQualifierInfo
clang::ASTRecordWriter::AddNestedNameSpecifier
clang::ASTRecordWriter::AddNestedNameSpecifierLoc
clang::ASTRecordWriter::AddTemplateName
clang::ASTRecordWriter::AddTemplateArgument
clang::ASTRecordWriter::AddTemplateParameterList
clang::ASTRecordWriter::AddTemplateArgumentList
clang::ASTRecordWriter::AddUnresolvedSet
clang::ASTRecordWriter::AddCXXCtorInitializers
clang::ASTRecordWriter::AddCXXDefinitionData
clang::ASTRecordWriter::AddString
clang::ASTRecordWriter::AddPath
clang::ASTRecordWriter::AddVersionTuple
clang::ASTRecordWriter::AddAttr
clang::ASTRecordWriter::AddAttributes
clang::PCHGenerator::PP
clang::PCHGenerator::OutputFile
clang::PCHGenerator::isysroot
clang::PCHGenerator::SemaPtr
clang::PCHGenerator::Buffer
clang::PCHGenerator::Stream
clang::PCHGenerator::Writer
clang::PCHGenerator::AllowASTWithErrors
clang::PCHGenerator::ShouldCacheASTInMemory
clang::PCHGenerator::getWriter
clang::PCHGenerator::getWriter
clang::PCHGenerator::getPCH
clang::PCHGenerator::InitializeSema
clang::PCHGenerator::HandleTranslationUnit
clang::PCHGenerator::GetASTMutationListener
clang::PCHGenerator::GetASTDeserializationListener
clang::PCHGenerator::hasEmittedPCH
clang::OMPClauseWriter::Record
clang::OMPClauseWriter::writeClause
clang::OMPClauseWriter::VisitOMPClauseWithPreInit
clang::OMPClauseWriter::VisitOMPClauseWithPostUpdate