198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//===--- Module.h - Module description --------------------------*- C++ -*-===//
298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//
398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//                     The LLVM Compiler Infrastructure
498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//
598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor// This file is distributed under the University of Illinois Open Source
698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor// License. See LICENSE.TXT for details.
798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//
898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//===----------------------------------------------------------------------===//
998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//
1098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//  This file defines the Module class, which describes a module that has
1198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//  been loaded from an AST file.
1298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//
1398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor//===----------------------------------------------------------------------===//
1498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
1598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor#ifndef LLVM_CLANG_SERIALIZATION_MODULE_H
1698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor#define LLVM_CLANG_SERIALIZATION_MODULE_H
1798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
1830a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "clang/Basic/SourceLocation.h"
1998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor#include "clang/Serialization/ASTBitCodes.h"
2098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor#include "clang/Serialization/ContinuousRangeMap.h"
2198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor#include "llvm/ADT/SetVector.h"
2298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor#include "llvm/Bitcode/BitstreamReader.h"
23651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines#include <memory>
2498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor#include <string>
2598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
266bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hinesnamespace llvm {
276bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hinestemplate <typename Info> class OnDiskChainedHashTable;
286bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hinestemplate <typename Info> class OnDiskIterableChainedHashTable;
296bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines}
306bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines
31ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikienamespace clang {
3298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
33d64c26f6676eef69d1713f353ca8a3c2fe963f17Argyrios Kyrtzidisclass FileEntry;
3498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregorclass DeclContext;
351a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregorclass Module;
36b1758c662524e18d65d260188fdcbbdee6a9316bBenjamin Kramer
3798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregornamespace serialization {
38ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
39b1758c662524e18d65d260188fdcbbdee6a9316bBenjamin Kramernamespace reader {
40b1758c662524e18d65d260188fdcbbdee6a9316bBenjamin Kramer  class ASTDeclContextNameLookupTrait;
41b1758c662524e18d65d260188fdcbbdee6a9316bBenjamin Kramer}
42b1758c662524e18d65d260188fdcbbdee6a9316bBenjamin Kramer
4398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor/// \brief Specifies the kind of module that has been loaded.
4498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregorenum ModuleKind {
4598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  MK_Module,   ///< File is a module proper.
4698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  MK_PCH,      ///< File is a PCH file treated as such.
4798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  MK_Preamble, ///< File is a PCH file treated as the preamble.
4898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  MK_MainFile  ///< File is a PCH file treated as the actual main file.
4998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor};
5098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
5198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor/// \brief Information about the contents of a DeclContext.
5298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregorstruct DeclContextInfo {
53ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie  DeclContextInfo()
5498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor    : NameLookupTableData(), LexicalDecls(), NumLexicalDecls() {}
55ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
566bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines  llvm::OnDiskIterableChainedHashTable<reader::ASTDeclContextNameLookupTrait>
57b1758c662524e18d65d260188fdcbbdee6a9316bBenjamin Kramer    *NameLookupTableData; // an ASTDeclContextNameLookupTable.
5898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const KindDeclIDPair *LexicalDecls;
5998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned NumLexicalDecls;
6098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor};
6198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
628504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis/// \brief The input file that has been loaded from this AST file, along with
638504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis/// bools indicating whether this was an overridden buffer or if it was
64651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines/// out-of-date or not-found.
658504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidisclass InputFile {
668504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  enum {
678504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis    Overridden = 1,
68651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    OutOfDate = 2,
69651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    NotFound = 3
708504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  };
718504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  llvm::PointerIntPair<const FileEntry *, 2, unsigned> Val;
728504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis
738504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidispublic:
748504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  InputFile() {}
758504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  InputFile(const FileEntry *File,
768504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis            bool isOverridden = false, bool isOutOfDate = false) {
778504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis    assert(!(isOverridden && isOutOfDate) &&
788504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis           "an overridden cannot be out-of-date");
798504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis    unsigned intVal = 0;
808504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis    if (isOverridden)
818504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis      intVal = Overridden;
828504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis    else if (isOutOfDate)
838504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis      intVal = OutOfDate;
848504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis    Val.setPointerAndInt(File, intVal);
858504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  }
868504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis
87651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  static InputFile getNotFound() {
88651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    InputFile File;
89651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    File.Val.setInt(NotFound);
90651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    return File;
91651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  }
92651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
938504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  const FileEntry *getFile() const { return Val.getPointer(); }
948504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  bool isOverridden() const { return Val.getInt() == Overridden; }
958504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  bool isOutOfDate() const { return Val.getInt() == OutOfDate; }
96651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  bool isNotFound() const { return Val.getInt() == NotFound; }
978504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis};
988504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis
9998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor/// \brief Information about a module that has been loaded by the ASTReader.
10098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor///
101ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie/// Each instance of the Module class corresponds to a single AST file, which
102ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie/// may be a precompiled header, precompiled preamble, a module, or an AST file
103ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie/// of some sort loaded as the main file, all of which are specific formulations
104ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie/// of the general notion of a "module". A module may depend on any number of
10598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor/// other modules.
1061a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregorclass ModuleFile {
107ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikiepublic:
108057df20b3107cef764052d271c89b8591b98b3ceDouglas Gregor  ModuleFile(ModuleKind Kind, unsigned Generation);
1091a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregor  ~ModuleFile();
110ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
11198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === General information ===
112ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
113cc71dbee441e97285e86bff48eecfbeab82de7ceDouglas Gregor  /// \brief The index of this module in the list of modules.
114cc71dbee441e97285e86bff48eecfbeab82de7ceDouglas Gregor  unsigned Index;
115cc71dbee441e97285e86bff48eecfbeab82de7ceDouglas Gregor
11698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The type of this module.
11798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ModuleKind Kind;
118ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
11998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The file name of the module file.
12098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  std::string FileName;
121ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
1226bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines  /// \brief The name of the module.
1236bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines  std::string ModuleName;
1246bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines
125651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  std::string getTimestampFilename() const {
126651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines    return FileName + ".timestamp";
127651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  }
128651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
12911407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// \brief The original source file name that was used to build the
13011407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// primary AST file, which may have been modified for
13111407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// relocatable-pch support.
13211407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  std::string OriginalSourceFileName;
13311407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor
13411407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// \brief The actual original source file name that was used to
13511407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// build this AST file.
13611407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  std::string ActualOriginalSourceFileName;
13711407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor
13811407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// \brief The file ID for the original source file that was used to
13911407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// build this AST file.
14011407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  FileID OriginalSourceFileID;
14111407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor
14211407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// \brief The directory that the PCH was originally created in. Used to
14311407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  /// allow resolving headers even after headers+PCH was moved to a new path.
14411407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor  std::string OriginalDir;
14511407b89c9d7ce8bc31869b0a7aae06add49e3dcDouglas Gregor
1466bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines  std::string ModuleMapPath;
1476bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89Stephen Hines
148caed060d38f404c3a7650dbd236c25ec356bc5a3Douglas Gregor  /// \brief Whether this precompiled header is a relocatable PCH file.
149caed060d38f404c3a7650dbd236c25ec356bc5a3Douglas Gregor  bool RelocatablePCH;
150caed060d38f404c3a7650dbd236c25ec356bc5a3Douglas Gregor
151d64c26f6676eef69d1713f353ca8a3c2fe963f17Argyrios Kyrtzidis  /// \brief The file entry for the module file.
152d64c26f6676eef69d1713f353ca8a3c2fe963f17Argyrios Kyrtzidis  const FileEntry *File;
153d64c26f6676eef69d1713f353ca8a3c2fe963f17Argyrios Kyrtzidis
15498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Whether this module has been directly imported by the
15598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// user.
15698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  bool DirectlyImported;
157ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
158057df20b3107cef764052d271c89b8591b98b3ceDouglas Gregor  /// \brief The generation of which this module file is a part.
159057df20b3107cef764052d271c89b8591b98b3ceDouglas Gregor  unsigned Generation;
160057df20b3107cef764052d271c89b8591b98b3ceDouglas Gregor
16198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The memory buffer that stores the data associated with
16298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// this AST file.
163651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  std::unique_ptr<llvm::MemoryBuffer> Buffer;
164ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
16598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The size of this file, in bits.
16698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  uint64_t SizeInBits;
167ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
16898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The global bit offset (or base) of this module
16998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  uint64_t GlobalBitOffset;
170ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
17198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The bitstream reader from which we'll read the AST file.
17298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  llvm::BitstreamReader StreamFile;
173ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
17498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The main bitstream cursor for the main block.
17598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  llvm::BitstreamCursor Stream;
176ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
1778b136d85487ec3cc017470d97479159d93a14f91Argyrios Kyrtzidis  /// \brief The source location where the module was explicitly or implicitly
1788b136d85487ec3cc017470d97479159d93a14f91Argyrios Kyrtzidis  /// imported in the local translation unit.
1798b136d85487ec3cc017470d97479159d93a14f91Argyrios Kyrtzidis  ///
1808b136d85487ec3cc017470d97479159d93a14f91Argyrios Kyrtzidis  /// If module A depends on and imports module B, both modules will have the
1818b136d85487ec3cc017470d97479159d93a14f91Argyrios Kyrtzidis  /// same DirectImportLoc, but different ImportLoc (B's ImportLoc will be a
1828b136d85487ec3cc017470d97479159d93a14f91Argyrios Kyrtzidis  /// source location inside module A).
183651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  ///
184651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  /// WARNING: This is largely useless. It doesn't tell you when a module was
185651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  /// made visible, just when the first submodule of that module was imported.
1868b136d85487ec3cc017470d97479159d93a14f91Argyrios Kyrtzidis  SourceLocation DirectImportLoc;
1878b136d85487ec3cc017470d97479159d93a14f91Argyrios Kyrtzidis
18898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The source location where this module was first imported.
18998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  SourceLocation ImportLoc;
190ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
19198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The first source location in this module.
19298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  SourceLocation FirstLoc;
193ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
194a930dc9b46572cb6e5bb54f3d724e8fe23a6b66eDouglas Gregor  // === Input Files ===
195a930dc9b46572cb6e5bb54f3d724e8fe23a6b66eDouglas Gregor  /// \brief The cursor to the start of the input-files block.
196a930dc9b46572cb6e5bb54f3d724e8fe23a6b66eDouglas Gregor  llvm::BitstreamCursor InputFilesCursor;
197a930dc9b46572cb6e5bb54f3d724e8fe23a6b66eDouglas Gregor
198a930dc9b46572cb6e5bb54f3d724e8fe23a6b66eDouglas Gregor  /// \brief Offsets for all of the input file entries in the AST file.
199a930dc9b46572cb6e5bb54f3d724e8fe23a6b66eDouglas Gregor  const uint32_t *InputFileOffsets;
200a930dc9b46572cb6e5bb54f3d724e8fe23a6b66eDouglas Gregor
2018504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  /// \brief The input files that have been loaded from this AST file.
2028504b7b8102a52b2a16231d459fb3cfab4784c38Argyrios Kyrtzidis  std::vector<InputFile> InputFilesLoaded;
203a930dc9b46572cb6e5bb54f3d724e8fe23a6b66eDouglas Gregor
204651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  /// \brief If non-zero, specifies the time when we last validated input
205651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  /// files.  Zero means we never validated them.
206651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  ///
207651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  /// The time is specified in seconds since the start of the Epoch.
208651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines  uint64_t InputFilesValidationTimestamp;
209651f13cea278ec967336033dd032faef0e9fc2ecStephen Hines
21098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Source Locations ===
211ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
21298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Cursor used to read source location entries.
21398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  llvm::BitstreamCursor SLocEntryCursor;
214ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
21598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The number of source location entries in this AST file.
21698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned LocalNumSLocEntries;
217ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
21898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The base ID in the source manager's view of this module.
21998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  int SLocEntryBaseID;
220ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
22198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The base offset in the source manager's view of this module.
22298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned SLocEntryBaseOffset;
223ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
22498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Offsets for all of the source location entries in the
22598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// AST file.
22698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const uint32_t *SLocEntryOffsets;
227ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
228f249bf3b9f8bd3af711ffe9de411fc435871a4f6Douglas Gregor  /// \brief SLocEntries that we're going to preload.
229f249bf3b9f8bd3af711ffe9de411fc435871a4f6Douglas Gregor  SmallVector<uint64_t, 4> PreloadSLocEntries;
230f249bf3b9f8bd3af711ffe9de411fc435871a4f6Douglas Gregor
23198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Remapping table for source locations in this module.
23298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ContinuousRangeMap<uint32_t, int, 2> SLocRemap;
233ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
23498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Identifiers ===
235ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
23698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The number of identifiers in this AST file.
23798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned LocalNumIdentifiers;
238ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
23998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Offsets into the identifier table data.
24098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ///
24198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// This array is indexed by the identifier ID (-1), and provides
24298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// the offset into IdentifierTableData where the string data is
24398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// stored.
24498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const uint32_t *IdentifierOffsets;
245ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
24698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Base identifier ID for identifiers local to this module.
24798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  serialization::IdentID BaseIdentifierID;
248ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
24998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Remapping table for identifier IDs in this module.
25098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ContinuousRangeMap<uint32_t, int, 2> IdentifierRemap;
251ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
25298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Actual data for the on-disk hash table of identifiers.
25398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ///
25498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// This pointer points into a memory buffer, where the on-disk hash
25598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// table for identifiers actually lives.
25698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const char *IdentifierTableData;
257ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
25898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief A pointer to an on-disk hash table of opaque type
25998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// IdentifierHashTable.
26098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  void *IdentifierLookupTable;
261ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
26298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Macros ===
263ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
26498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The cursor to the start of the preprocessor block, which stores
26598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// all of the macro definitions.
26698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  llvm::BitstreamCursor MacroCursor;
267ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
268a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  /// \brief The number of macros in this AST file.
269a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  unsigned LocalNumMacros;
270a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor
271a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  /// \brief Offsets of macros in the preprocessor block.
272a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  ///
273a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  /// This array is indexed by the macro ID (-1), and provides
274a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  /// the offset into the preprocessor block where macro definitions are
275a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  /// stored.
276a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  const uint32_t *MacroOffsets;
277a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor
278a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  /// \brief Base macro ID for macros local to this module.
279a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  serialization::MacroID BaseMacroID;
280a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor
281a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  /// \brief Remapping table for macro IDs in this module.
282a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor  ContinuousRangeMap<uint32_t, int, 2> MacroRemap;
283a8235d6c4093cd38dcf742909651f867de62e55bDouglas Gregor
28498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The offset of the start of the set of defined macros.
28598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  uint64_t MacroStartOffset;
286ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
28798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Detailed PreprocessingRecord ===
288ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
289ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie  /// \brief The cursor to the start of the (optional) detailed preprocessing
29098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// record block.
29198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  llvm::BitstreamCursor PreprocessorDetailCursor;
292ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
29398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The offset of the start of the preprocessor detail cursor.
29498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  uint64_t PreprocessorDetailStartOffset;
295ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
296ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie  /// \brief Base preprocessed entity ID for preprocessed entities local to
29798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// this module.
29898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  serialization::PreprocessedEntityID BasePreprocessedEntityID;
299ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
30098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Remapping table for preprocessed entity IDs in this module.
30198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ContinuousRangeMap<uint32_t, int, 2> PreprocessedEntityRemap;
302ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
3032dbaca748bc3eb6539f417bd8354c930bdf88fa4Argyrios Kyrtzidis  const PPEntityOffset *PreprocessedEntityOffsets;
304e24692b30adbe8144597678a0e3354912e99c747Argyrios Kyrtzidis  unsigned NumPreprocessedEntities;
305ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
30698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Header search information ===
307ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
30898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The number of local HeaderFileInfo structures.
30998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned LocalNumHeaderFileInfos;
310ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
311ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie  /// \brief Actual data for the on-disk hash table of header file
31298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// information.
31398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ///
31498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// This pointer points into a memory buffer, where the on-disk hash
31598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// table for header file information actually lives.
31698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const char *HeaderFileInfoTableData;
317ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
31898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The on-disk hash table that contains information about each of
31998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// the header files.
32098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  void *HeaderFileInfoTable;
321ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
32226ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor  // === Submodule information ===
32326ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor  /// \brief The number of submodules in this module.
32426ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor  unsigned LocalNumSubmodules;
32526ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor
32626ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor  /// \brief Base submodule ID for submodules local to this module.
32726ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor  serialization::SubmoduleID BaseSubmoduleID;
32826ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor
32926ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor  /// \brief Remapping table for submodule IDs in this module.
33026ced127b7d443fcf3472463c9f39c2376bd9d70Douglas Gregor  ContinuousRangeMap<uint32_t, int, 2> SubmoduleRemap;
331392ed2b717d86ebdd202cb9bb58d18d8b3b4cd87Douglas Gregor
33298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Selectors ===
333ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
33498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The number of selectors new to this file.
33598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ///
33698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// This is the number of entries in SelectorOffsets.
33798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned LocalNumSelectors;
338ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
33998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Offsets into the selector lookup table's data array
34098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// where each selector resides.
34198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const uint32_t *SelectorOffsets;
342ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
34398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Base selector ID for selectors local to this module.
34498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  serialization::SelectorID BaseSelectorID;
345ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
34698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Remapping table for selector IDs in this module.
34798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ContinuousRangeMap<uint32_t, int, 2> SelectorRemap;
348ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
34998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief A pointer to the character data that comprises the selector table
35098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ///
35198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// The SelectorOffsets table refers into this memory.
35298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const unsigned char *SelectorLookupTableData;
353ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
35498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief A pointer to an on-disk hash table of opaque type
35598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// ASTSelectorLookupTable.
35698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ///
35798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// This hash table provides the IDs of all selectors, and the associated
35898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// instance and factory methods.
35998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  void *SelectorLookupTable;
360ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
36198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Declarations ===
362ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
36398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block. It
36498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// has read all the abbreviations at the start of the block and is ready to
36598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// jump around with these in context.
36698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  llvm::BitstreamCursor DeclsCursor;
367ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
36898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The number of declarations in this AST file.
36998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned LocalNumDecls;
370ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
37198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Offset of each declaration within the bitstream, indexed
37298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// by the declaration ID (-1).
3739d31fa75bc05fe4cb903a7701550f22cfb73ea8bArgyrios Kyrtzidis  const DeclOffset *DeclOffsets;
374ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
37598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Base declaration ID for declarations local to this module.
37698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  serialization::DeclID BaseDeclID;
377ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
37898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Remapping table for declaration IDs in this module.
37998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ContinuousRangeMap<uint32_t, int, 2> DeclRemap;
380ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
381a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor  /// \brief Mapping from the module files that this module file depends on
382a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor  /// to the base declaration ID for that module as it is understood within this
383a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor  /// module.
384a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor  ///
385a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor  /// This is effectively a reverse global-to-local mapping for declaration
386a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor  /// IDs, so that we can interpret a true global ID (for this translation unit)
387a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor  /// as a local ID (for this module file).
388a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor  llvm::DenseMap<ModuleFile *, serialization::DeclID> GlobalToLocalDeclIDs;
389a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor
39098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The number of C++ base specifier sets in this AST file.
39198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned LocalNumCXXBaseSpecifiers;
392ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
39398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Offset of each C++ base specifier set within the bitstream,
39498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// indexed by the C++ base specifier set ID (-1).
39598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const uint32_t *CXXBaseSpecifiersOffsets;
396ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
39798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  typedef llvm::DenseMap<const DeclContext *, DeclContextInfo>
39898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  DeclContextInfosMap;
399ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
40098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Information about the lexical and visible declarations
40198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// for each DeclContext.
40298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  DeclContextInfosMap DeclContextInfos;
403e6b8d68a927368b06ac06cc9ac9e7f60aa966d5fArgyrios Kyrtzidis
40410f3df54486385e6497c9e5f229ff816e5a6c511Argyrios Kyrtzidis  /// \brief Array of file-level DeclIDs sorted by file.
40510f3df54486385e6497c9e5f229ff816e5a6c511Argyrios Kyrtzidis  const serialization::DeclID *FileSortedDecls;
4062093e0bc4e436b1b2791d5423fb3274dd37231b8Argyrios Kyrtzidis  unsigned NumFileSortedDecls;
407ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
4082171bf1caba4d4b9eeb6a91efac4300b41f38b07Douglas Gregor  /// \brief Array of redeclaration chain location information within this
4092171bf1caba4d4b9eeb6a91efac4300b41f38b07Douglas Gregor  /// module file, sorted by the first declaration ID.
4102171bf1caba4d4b9eeb6a91efac4300b41f38b07Douglas Gregor  const serialization::LocalRedeclarationsInfo *RedeclarationsMap;
411a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor
412cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  /// \brief The number of redeclaration info entries in RedeclarationsMap.
4132171bf1caba4d4b9eeb6a91efac4300b41f38b07Douglas Gregor  unsigned LocalNumRedeclarationsInMap;
4142171bf1caba4d4b9eeb6a91efac4300b41f38b07Douglas Gregor
4152171bf1caba4d4b9eeb6a91efac4300b41f38b07Douglas Gregor  /// \brief The redeclaration chains for declarations local to this
4162171bf1caba4d4b9eeb6a91efac4300b41f38b07Douglas Gregor  /// module file.
4172171bf1caba4d4b9eeb6a91efac4300b41f38b07Douglas Gregor  SmallVector<uint64_t, 1> RedeclarationChains;
418a1be278c4f3a234ff61f04018d26c6beecde1654Douglas Gregor
419cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  /// \brief Array of category list location information within this
420cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  /// module file, sorted by the definition ID.
421cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  const serialization::ObjCCategoriesInfo *ObjCCategoriesMap;
422cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor
423cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  /// \brief The number of redeclaration info entries in ObjCCategoriesMap.
424cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  unsigned LocalNumObjCCategoriesInMap;
425cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor
426cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  /// \brief The Objective-C category lists for categories known to this
427cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  /// module.
428cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor  SmallVector<uint64_t, 1> ObjCCategories;
429cff9f26ce0ed76d555cd33b3dca84dd5cdf376afDouglas Gregor
43098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Types ===
431ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
43298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief The number of types in this AST file.
43398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  unsigned LocalNumTypes;
434ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
43598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Offset of each type within the bitstream, indexed by the
43698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// type ID, or the representation of a Type*.
43798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  const uint32_t *TypeOffsets;
438ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
439ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie  /// \brief Base type ID for types local to this module as represented in
44098339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// the global type ID space.
44198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  serialization::TypeID BaseTypeIndex;
442ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
44398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Remapping table for type IDs in this module.
44498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  ContinuousRangeMap<uint32_t, int, 2> TypeRemap;
445ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
44698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  // === Miscellaneous ===
447ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
44898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Diagnostic IDs and their mappings that the user changed.
44998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  SmallVector<uint64_t, 8> PragmaDiagMappings;
450ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
45198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief List of modules which depend on this module
4521a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregor  llvm::SetVector<ModuleFile *> ImportedBy;
453ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
45498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief List of modules which this module depends on
4551a4761edca58c6b559de825b9abfb66f7f1ba94aDouglas Gregor  llvm::SetVector<ModuleFile *> Imports;
456ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
45798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Determine whether this module was directly imported at
45898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// any point during translation.
45998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  bool isDirectlyImported() const { return DirectlyImported; }
460ba243b59a1074e0962f6abfa3bb9aa984eac1245David Blaikie
46198339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  /// \brief Dump debugging output for this module.
46298339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor  void dump();
46398339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor};
46498339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
46598339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor} // end namespace serialization
46698339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
46798339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor} // end namespace clang
46898339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor
46998339b96a8089a6da715487e432c5abfca0ca0dfDouglas Gregor#endif
470