Deleted Added
sdiff udiff text old ( 243830 ) new ( 249423 )
full compact
1//===--- Module.h - Module description --------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the Module class, which describes a module that has
11// been loaded from an AST file.
12//
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_CLANG_SERIALIZATION_MODULE_H
16#define LLVM_CLANG_SERIALIZATION_MODULE_H
17
18#include "clang/Basic/SourceLocation.h"
19#include "clang/Serialization/ASTBitCodes.h"
20#include "clang/Serialization/ContinuousRangeMap.h"
21#include "llvm/ADT/OwningPtr.h"
22#include "llvm/ADT/SetVector.h"
23#include "llvm/Bitcode/BitstreamReader.h"
24#include <string>
25
26namespace clang {
27
28class FileEntry;

--- 21 unchanged lines hidden (view full) ---

50 : NameLookupTableData(), LexicalDecls(), NumLexicalDecls() {}
51
52 OnDiskChainedHashTable<reader::ASTDeclContextNameLookupTrait>
53 *NameLookupTableData; // an ASTDeclContextNameLookupTable.
54 const KindDeclIDPair *LexicalDecls;
55 unsigned NumLexicalDecls;
56};
57
58/// \brief The input file that has been loaded from this AST file, along with
59/// bools indicating whether this was an overridden buffer or if it was
60/// out-of-date.
61class InputFile {
62 enum {
63 Overridden = 1,
64 OutOfDate = 2
65 };
66 llvm::PointerIntPair<const FileEntry *, 2, unsigned> Val;
67
68public:
69 InputFile() {}
70 InputFile(const FileEntry *File,
71 bool isOverridden = false, bool isOutOfDate = false) {
72 assert(!(isOverridden && isOutOfDate) &&
73 "an overridden cannot be out-of-date");
74 unsigned intVal = 0;
75 if (isOverridden)
76 intVal = Overridden;
77 else if (isOutOfDate)
78 intVal = OutOfDate;
79 Val.setPointerAndInt(File, intVal);
80 }
81
82 const FileEntry *getFile() const { return Val.getPointer(); }
83 bool isOverridden() const { return Val.getInt() == Overridden; }
84 bool isOutOfDate() const { return Val.getInt() == OutOfDate; }
85};
86
87/// \brief Information about a module that has been loaded by the ASTReader.
88///
89/// Each instance of the Module class corresponds to a single AST file, which
90/// may be a precompiled header, precompiled preamble, a module, or an AST file
91/// of some sort loaded as the main file, all of which are specific formulations
92/// of the general notion of a "module". A module may depend on any number of
93/// other modules.
94class ModuleFile {
95public:
96 ModuleFile(ModuleKind Kind, unsigned Generation);
97 ~ModuleFile();
98
99 // === General information ===
100
101 /// \brief The index of this module in the list of modules.
102 unsigned Index;
103
104 /// \brief The type of this module.
105 ModuleKind Kind;
106
107 /// \brief The file name of the module file.
108 std::string FileName;
109
110 /// \brief The original source file name that was used to build the
111 /// primary AST file, which may have been modified for

--- 36 unchanged lines hidden (view full) ---

148 uint64_t GlobalBitOffset;
149
150 /// \brief The bitstream reader from which we'll read the AST file.
151 llvm::BitstreamReader StreamFile;
152
153 /// \brief The main bitstream cursor for the main block.
154 llvm::BitstreamCursor Stream;
155
156 /// \brief The source location where the module was explicitly or implicitly
157 /// imported in the local translation unit.
158 ///
159 /// If module A depends on and imports module B, both modules will have the
160 /// same DirectImportLoc, but different ImportLoc (B's ImportLoc will be a
161 /// source location inside module A).
162 SourceLocation DirectImportLoc;
163
164 /// \brief The source location where this module was first imported.
165 SourceLocation ImportLoc;
166
167 /// \brief The first source location in this module.
168 SourceLocation FirstLoc;
169
170 // === Input Files ===
171 /// \brief The cursor to the start of the input-files block.
172 llvm::BitstreamCursor InputFilesCursor;
173
174 /// \brief Offsets for all of the input file entries in the AST file.
175 const uint32_t *InputFileOffsets;
176
177 /// \brief The input files that have been loaded from this AST file.
178 std::vector<InputFile> InputFilesLoaded;
179
180 // === Source Locations ===
181
182 /// \brief Cursor used to read source location entries.
183 llvm::BitstreamCursor SLocEntryCursor;
184
185 /// \brief The number of source location entries in this AST file.
186 unsigned LocalNumSLocEntries;

--- 97 unchanged lines hidden (view full) ---

284 /// This pointer points into a memory buffer, where the on-disk hash
285 /// table for header file information actually lives.
286 const char *HeaderFileInfoTableData;
287
288 /// \brief The on-disk hash table that contains information about each of
289 /// the header files.
290 void *HeaderFileInfoTable;
291
292 // === Submodule information ===
293 /// \brief The number of submodules in this module.
294 unsigned LocalNumSubmodules;
295
296 /// \brief Base submodule ID for submodules local to this module.
297 serialization::SubmoduleID BaseSubmoduleID;
298
299 /// \brief Remapping table for submodule IDs in this module.

--- 140 unchanged lines hidden ---