Module.h (243830) | Module.h (249423) |
---|---|
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 | 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" |
|
18#include "clang/Serialization/ASTBitCodes.h" 19#include "clang/Serialization/ContinuousRangeMap.h" | 19#include "clang/Serialization/ASTBitCodes.h" 20#include "clang/Serialization/ContinuousRangeMap.h" |
20#include "clang/Basic/SourceLocation.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 | 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 |
|
58/// \brief Information about a module that has been loaded by the ASTReader. 59/// 60/// Each instance of the Module class corresponds to a single AST file, which 61/// may be a precompiled header, precompiled preamble, a module, or an AST file 62/// of some sort loaded as the main file, all of which are specific formulations 63/// of the general notion of a "module". A module may depend on any number of 64/// other modules. 65class ModuleFile { 66public: 67 ModuleFile(ModuleKind Kind, unsigned Generation); 68 ~ModuleFile(); 69 70 // === General information === 71 | 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 |
|
72 /// \brief The type of this module. 73 ModuleKind Kind; 74 75 /// \brief The file name of the module file. 76 std::string FileName; 77 78 /// \brief The original source file name that was used to build the 79 /// primary AST file, which may have been modified for --- 36 unchanged lines hidden (view full) --- 116 uint64_t GlobalBitOffset; 117 118 /// \brief The bitstream reader from which we'll read the AST file. 119 llvm::BitstreamReader StreamFile; 120 121 /// \brief The main bitstream cursor for the main block. 122 llvm::BitstreamCursor Stream; 123 | 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 |
|
124 /// \brief The source location where this module was first imported. | 164 /// \brief The source location where this module was first imported. |
125 /// FIXME: This is not properly initialized yet. | |
126 SourceLocation ImportLoc; 127 128 /// \brief The first source location in this module. 129 SourceLocation FirstLoc; 130 131 // === Input Files === 132 /// \brief The cursor to the start of the input-files block. 133 llvm::BitstreamCursor InputFilesCursor; 134 135 /// \brief Offsets for all of the input file entries in the AST file. 136 const uint32_t *InputFileOffsets; 137 | 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 |
138 /// \brief The input files that have been loaded from this AST file, along 139 /// with a bool indicating whether this was an overridden buffer. 140 std::vector<llvm::PointerIntPair<const FileEntry *, 1, bool> > 141 InputFilesLoaded; | 177 /// \brief The input files that have been loaded from this AST file. 178 std::vector<InputFile> InputFilesLoaded; |
142 143 // === Source Locations === 144 145 /// \brief Cursor used to read source location entries. 146 llvm::BitstreamCursor SLocEntryCursor; 147 148 /// \brief The number of source location entries in this AST file. 149 unsigned LocalNumSLocEntries; --- 97 unchanged lines hidden (view full) --- 247 /// This pointer points into a memory buffer, where the on-disk hash 248 /// table for header file information actually lives. 249 const char *HeaderFileInfoTableData; 250 251 /// \brief The on-disk hash table that contains information about each of 252 /// the header files. 253 void *HeaderFileInfoTable; 254 | 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 |
255 /// \brief Actual data for the list of framework names used in the header 256 /// search information. 257 const char *HeaderFileFrameworkStrings; 258 | |
259 // === Submodule information === 260 /// \brief The number of submodules in this module. 261 unsigned LocalNumSubmodules; 262 263 /// \brief Base submodule ID for submodules local to this module. 264 serialization::SubmoduleID BaseSubmoduleID; 265 266 /// \brief Remapping table for submodule IDs in this module. --- 140 unchanged lines hidden --- | 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 --- |