void Error(const char *Msg);
};
+namespace serialization {
+
+/// \brief Specifies the kind of module that has been loaded.
+enum ModuleKind {
+ MK_Module, ///< File is a module proper.
+ MK_PCH, ///< File is a PCH file treated as such.
+ MK_Preamble, ///< File is a PCH file treated as the preamble.
+ MK_MainFile ///< File is a PCH file treated as the actual main file.
+};
+
+/// \brief Information about a module that has been loaded by the ASTReader.
+///
+/// Each instance of the Module class corresponds to a single AST file, which
+/// may be a precompiled header, precompiled preamble, or an AST file of some
+/// sort loaded as the main file, all of which are specific formulations of
+/// the general notion of a "module". A module may depend on another module
+/// (FIXME: or a set of other modules).
+class Module {
+public:
+ Module(ModuleKind Kind);
+ ~Module();
+
+ // === General information ===
+
+ /// \brief The type of this module.
+ ModuleKind Kind;
+
+ /// \brief The file name of the module file.
+ std::string FileName;
+
+ /// \brief The memory buffer that stores the data associated with
+ /// this AST file.
+ llvm::OwningPtr<llvm::MemoryBuffer> Buffer;
+
+ /// \brief The size of this file, in bits.
+ uint64_t SizeInBits;
+
+ /// \brief The global bit offset (or base) of this module
+ uint64_t GlobalBitOffset;
+
+ /// \brief The bitstream reader from which we'll read the AST file.
+ llvm::BitstreamReader StreamFile;
+
+ /// \brief The main bitstream cursor for the main block.
+ llvm::BitstreamCursor Stream;
+
+ /// \brief The source location where this module was first imported.
+ SourceLocation ImportLoc;
+
+ /// \brief The first source location in this module.
+ SourceLocation FirstLoc;
+
+ // === Source Locations ===
+
+ /// \brief Cursor used to read source location entries.
+ llvm::BitstreamCursor SLocEntryCursor;
+
+ /// \brief The number of source location entries in this AST file.
+ unsigned LocalNumSLocEntries;
+
+ /// \brief The base ID in the source manager's view of this module.
+ int SLocEntryBaseID;
+
+ /// \brief The base offset in the source manager's view of this module.
+ unsigned SLocEntryBaseOffset;
+
+ /// \brief Offsets for all of the source location entries in the
+ /// AST file.
+ const uint32_t *SLocEntryOffsets;
+
+ /// \brief The number of source location file entries in this AST file.
+ unsigned LocalNumSLocFileEntries;
+
+ /// \brief Offsets for all of the source location file entries in the
+ /// AST file.
+ const uint32_t *SLocFileOffsets;
+
+ /// \brief Remapping table for source locations in this module.
+ ContinuousRangeMap<uint32_t, int, 2> SLocRemap;
+
+ // === Identifiers ===
+
+ /// \brief The number of identifiers in this AST file.
+ unsigned LocalNumIdentifiers;
+
+ /// \brief Offsets into the identifier table data.
+ ///
+ /// This array is indexed by the identifier ID (-1), and provides
+ /// the offset into IdentifierTableData where the string data is
+ /// stored.
+ const uint32_t *IdentifierOffsets;
+
+ /// \brief Actual data for the on-disk hash table of identifiers.
+ ///
+ /// This pointer points into a memory buffer, where the on-disk hash
+ /// table for identifiers actually lives.
+ const char *IdentifierTableData;
+
+ /// \brief A pointer to an on-disk hash table of opaque type
+ /// IdentifierHashTable.
+ void *IdentifierLookupTable;
+
+ // === Macros ===
+
+ /// \brief The cursor to the start of the preprocessor block, which stores
+ /// all of the macro definitions.
+ llvm::BitstreamCursor MacroCursor;
+
+ /// \brief The offset of the start of the set of defined macros.
+ uint64_t MacroStartOffset;
+
+ // === Detailed PreprocessingRecord ===
+
+ /// \brief The cursor to the start of the (optional) detailed preprocessing
+ /// record block.
+ llvm::BitstreamCursor PreprocessorDetailCursor;
+
+ /// \brief The offset of the start of the preprocessor detail cursor.
+ uint64_t PreprocessorDetailStartOffset;
+
+ /// \brief The number of macro definitions in this file.
+ unsigned LocalNumMacroDefinitions;
+
+ /// \brief Offsets of all of the macro definitions in the preprocessing
+ /// record in the AST file.
+ const uint32_t *MacroDefinitionOffsets;
+
+ // === Header search information ===
+
+ /// \brief The number of local HeaderFileInfo structures.
+ unsigned LocalNumHeaderFileInfos;
+
+ /// \brief Actual data for the on-disk hash table of header file
+ /// information.
+ ///
+ /// This pointer points into a memory buffer, where the on-disk hash
+ /// table for header file information actually lives.
+ const char *HeaderFileInfoTableData;
+
+ /// \brief The on-disk hash table that contains information about each of
+ /// the header files.
+ void *HeaderFileInfoTable;
+
+ // === Selectors ===
+
+ /// \brief The number of selectors new to this file.
+ ///
+ /// This is the number of entries in SelectorOffsets.
+ unsigned LocalNumSelectors;
+
+ /// \brief Offsets into the selector lookup table's data array
+ /// where each selector resides.
+ const uint32_t *SelectorOffsets;
+
+ /// \brief A pointer to the character data that comprises the selector table
+ ///
+ /// The SelectorOffsets table refers into this memory.
+ const unsigned char *SelectorLookupTableData;
+
+ /// \brief A pointer to an on-disk hash table of opaque type
+ /// ASTSelectorLookupTable.
+ ///
+ /// This hash table provides the IDs of all selectors, and the associated
+ /// instance and factory methods.
+ void *SelectorLookupTable;
+
+ /// \brief Method selectors used in a @selector expression. Used for
+ /// implementation of -Wselector.
+ SmallVector<uint64_t, 64> ReferencedSelectorsData;
+
+ // === Declarations ===
+
+ /// DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block. It
+ /// has read all the abbreviations at the start of the block and is ready to
+ /// jump around with these in context.
+ llvm::BitstreamCursor DeclsCursor;
+
+ /// \brief The number of declarations in this AST file.
+ unsigned LocalNumDecls;
+
+ /// \brief Offset of each declaration within the bitstream, indexed
+ /// by the declaration ID (-1).
+ const uint32_t *DeclOffsets;
+
+ /// \brief A snapshot of the pending instantiations in the chain.
+ ///
+ /// This record tracks the instantiations that Sema has to perform at the
+ /// end of the TU. It consists of a pair of values for every pending
+ /// instantiation where the first value is the ID of the decl and the second
+ /// is the instantiation location.
+ SmallVector<uint64_t, 64> PendingInstantiations;
+
+ /// \brief The number of C++ base specifier sets in this AST file.
+ unsigned LocalNumCXXBaseSpecifiers;
+
+ /// \brief Offset of each C++ base specifier set within the bitstream,
+ /// indexed by the C++ base specifier set ID (-1).
+ const uint32_t *CXXBaseSpecifiersOffsets;
+
+ // === Types ===
+
+ /// \brief The number of types in this AST file.
+ unsigned LocalNumTypes;
+
+ /// \brief Offset of each type within the bitstream, indexed by the
+ /// type ID, or the representation of a Type*.
+ const uint32_t *TypeOffsets;
+
+ // === Miscellaneous ===
+
+ /// \brief Diagnostic IDs and their mappings that the user changed.
+ SmallVector<uint64_t, 8> PragmaDiagMappings;
+
+ /// \brief The AST stat cache installed for this file, if any.
+ ///
+ /// The dynamic type of this stat cache is always ASTStatCache
+ void *StatCache;
+
+ /// \brief The number of preallocated preprocessing entities in the
+ /// preprocessing record.
+ unsigned NumPreallocatedPreprocessingEntities;
+
+ /// \brief The next module in source order.
+ Module *NextInSource;
+
+ /// \brief All the modules that loaded this one. Can contain NULL for
+ /// directly loaded modules.
+ SmallVector<Module *, 1> Loaders;
+};
+
+} // end namespace serialization
+
/// \brief Reads an AST files chain containing the contents of a translation
/// unit.
///
public:
enum ASTReadResult { Success, Failure, IgnorePCH };
/// \brief Types of AST files.
- enum ASTFileType {
- Module, ///< File is a module proper.
- PCH, ///< File is a PCH file treated as such.
- Preamble, ///< File is a PCH file treated as the preamble.
- MainFile ///< File is a PCH file treated as the actual main file.
- };
friend class PCHValidator;
friend class ASTDeclReader;
friend class ASTStmtReader;
friend class TypeLocReader;
friend class ASTWriter;
friend class ASTUnit; // ASTUnit needs to remap source locations.
+
+ typedef serialization::Module Module;
+ typedef serialization::ModuleKind ModuleKind;
+
private:
/// \brief The receiver of some callbacks invoked by ASTReader.
llvm::OwningPtr<ASTReaderListener> Listener;
/// \brief AST buffers for chained PCHs created and stored in memory.
/// First (not depending on another) PCH in chain is in front.
std::vector<llvm::MemoryBuffer *> ASTBuffers;
-
-public:
- /// \brief Information that is needed for every module.
- struct PerFileData {
- PerFileData(ASTFileType Ty);
- ~PerFileData();
-
- // === General information ===
-
- /// \brief The type of this AST file.
- ASTFileType Type;
-
- /// \brief The file name of the AST file.
- std::string FileName;
-
- /// \brief The memory buffer that stores the data associated with
- /// this AST file.
- llvm::OwningPtr<llvm::MemoryBuffer> Buffer;
-
- /// \brief The size of this file, in bits.
- uint64_t SizeInBits;
-
- /// \brief The global bit offset (or base) of this module
- uint64_t GlobalBitOffset;
-
- /// \brief The bitstream reader from which we'll read the AST file.
- llvm::BitstreamReader StreamFile;
-
- /// \brief The main bitstream cursor for the main block.
- llvm::BitstreamCursor Stream;
-
- /// \brief The source location where this module was first imported.
- SourceLocation ImportLoc;
-
- /// \brief The first source location in this module.
- SourceLocation FirstLoc;
-
- // === Source Locations ===
-
- /// \brief Cursor used to read source location entries.
- llvm::BitstreamCursor SLocEntryCursor;
-
- /// \brief The number of source location entries in this AST file.
- unsigned LocalNumSLocEntries;
-
- /// \brief The base ID in the source manager's view of this module.
- int SLocEntryBaseID;
-
- /// \brief The base offset in the source manager's view of this module.
- unsigned SLocEntryBaseOffset;
-
- /// \brief Offsets for all of the source location entries in the
- /// AST file.
- const uint32_t *SLocEntryOffsets;
-
- /// \brief The number of source location file entries in this AST file.
- unsigned LocalNumSLocFileEntries;
-
- /// \brief Offsets for all of the source location file entries in the
- /// AST file.
- const uint32_t *SLocFileOffsets;
-
- /// \brief Remapping table for source locations in this module.
- ContinuousRangeMap<uint32_t, int, 2> SLocRemap;
-
- // === Identifiers ===
-
- /// \brief The number of identifiers in this AST file.
- unsigned LocalNumIdentifiers;
-
- /// \brief Offsets into the identifier table data.
- ///
- /// This array is indexed by the identifier ID (-1), and provides
- /// the offset into IdentifierTableData where the string data is
- /// stored.
- const uint32_t *IdentifierOffsets;
-
- /// \brief Actual data for the on-disk hash table of identifiers.
- ///
- /// This pointer points into a memory buffer, where the on-disk hash
- /// table for identifiers actually lives.
- const char *IdentifierTableData;
-
- /// \brief A pointer to an on-disk hash table of opaque type
- /// IdentifierHashTable.
- void *IdentifierLookupTable;
-
- // === Macros ===
-
- /// \brief The cursor to the start of the preprocessor block, which stores
- /// all of the macro definitions.
- llvm::BitstreamCursor MacroCursor;
-
- /// \brief The offset of the start of the set of defined macros.
- uint64_t MacroStartOffset;
-
- // === Detailed PreprocessingRecord ===
-
- /// \brief The cursor to the start of the (optional) detailed preprocessing
- /// record block.
- llvm::BitstreamCursor PreprocessorDetailCursor;
-
- /// \brief The offset of the start of the preprocessor detail cursor.
- uint64_t PreprocessorDetailStartOffset;
-
- /// \brief The number of macro definitions in this file.
- unsigned LocalNumMacroDefinitions;
-
- /// \brief Offsets of all of the macro definitions in the preprocessing
- /// record in the AST file.
- const uint32_t *MacroDefinitionOffsets;
-
- // === Header search information ===
-
- /// \brief The number of local HeaderFileInfo structures.
- unsigned LocalNumHeaderFileInfos;
-
- /// \brief Actual data for the on-disk hash table of header file
- /// information.
- ///
- /// This pointer points into a memory buffer, where the on-disk hash
- /// table for header file information actually lives.
- const char *HeaderFileInfoTableData;
-
- /// \brief The on-disk hash table that contains information about each of
- /// the header files.
- void *HeaderFileInfoTable;
-
- // === Selectors ===
-
- /// \brief The number of selectors new to this file.
- ///
- /// This is the number of entries in SelectorOffsets.
- unsigned LocalNumSelectors;
-
- /// \brief Offsets into the selector lookup table's data array
- /// where each selector resides.
- const uint32_t *SelectorOffsets;
-
- /// \brief A pointer to the character data that comprises the selector table
- ///
- /// The SelectorOffsets table refers into this memory.
- const unsigned char *SelectorLookupTableData;
-
- /// \brief A pointer to an on-disk hash table of opaque type
- /// ASTSelectorLookupTable.
- ///
- /// This hash table provides the IDs of all selectors, and the associated
- /// instance and factory methods.
- void *SelectorLookupTable;
-
- /// \brief Method selectors used in a @selector expression. Used for
- /// implementation of -Wselector.
- SmallVector<uint64_t, 64> ReferencedSelectorsData;
-
- // === Declarations ===
-
- /// DeclsCursor - This is a cursor to the start of the DECLS_BLOCK block. It
- /// has read all the abbreviations at the start of the block and is ready to
- /// jump around with these in context.
- llvm::BitstreamCursor DeclsCursor;
-
- /// \brief The number of declarations in this AST file.
- unsigned LocalNumDecls;
-
- /// \brief Offset of each declaration within the bitstream, indexed
- /// by the declaration ID (-1).
- const uint32_t *DeclOffsets;
-
- /// \brief A snapshot of the pending instantiations in the chain.
- ///
- /// This record tracks the instantiations that Sema has to perform at the
- /// end of the TU. It consists of a pair of values for every pending
- /// instantiation where the first value is the ID of the decl and the second
- /// is the instantiation location.
- SmallVector<uint64_t, 64> PendingInstantiations;
-
- /// \brief The number of C++ base specifier sets in this AST file.
- unsigned LocalNumCXXBaseSpecifiers;
-
- /// \brief Offset of each C++ base specifier set within the bitstream,
- /// indexed by the C++ base specifier set ID (-1).
- const uint32_t *CXXBaseSpecifiersOffsets;
-
- // === Types ===
-
- /// \brief The number of types in this AST file.
- unsigned LocalNumTypes;
-
- /// \brief Offset of each type within the bitstream, indexed by the
- /// type ID, or the representation of a Type*.
- const uint32_t *TypeOffsets;
-
- // === Miscellaneous ===
-
- /// \brief Diagnostic IDs and their mappings that the user changed.
- SmallVector<uint64_t, 8> PragmaDiagMappings;
-
- /// \brief The AST stat cache installed for this file, if any.
- ///
- /// The dynamic type of this stat cache is always ASTStatCache
- void *StatCache;
-
- /// \brief The number of preallocated preprocessing entities in the
- /// preprocessing record.
- unsigned NumPreallocatedPreprocessingEntities;
-
- /// \brief The next module in source order.
- PerFileData *NextInSource;
-
- /// \brief All the modules that loaded this one. Can contain NULL for
- /// directly loaded modules.
- SmallVector<PerFileData *, 1> Loaders;
- };
-private:
/// \brief All loaded modules, indexed by name.
- llvm::StringMap<PerFileData*> Modules;
+ llvm::StringMap<Module*> Modules;
/// \brief The first module in source order.
- PerFileData *FirstInSource;
+ Module *FirstInSource;
/// \brief The chain of AST files. The first entry is the one named by the
/// user, the last one is the one that doesn't depend on anything further.
/// That is, the entry I was created with -include-pch I+1.
- SmallVector<PerFileData*, 2> Chain;
+ SmallVector<Module*, 2> Chain;
/// \brief A map of global bit offsets to the module that stores entities
/// at those bit offsets.
- ContinuousRangeMap<uint64_t, PerFileData*, 4> GlobalBitOffsetsMap;
+ ContinuousRangeMap<uint64_t, Module*, 4> GlobalBitOffsetsMap;
/// \brief SLocEntries that we're going to preload.
SmallVector<int, 64> PreloadSLocEntries;
/// \brief A map of negated SLocEntryIDs to the modules containing them.
- ContinuousRangeMap<unsigned, PerFileData*, 64> GlobalSLocEntryMap;
+ ContinuousRangeMap<unsigned, Module*, 64> GlobalSLocEntryMap;
/// \brief Types that have already been loaded from the chain.
///
std::vector<QualType> TypesLoaded;
typedef ContinuousRangeMap<serialization::TypeID,
- std::pair<PerFileData *, int32_t>, 4>
+ std::pair<Module *, int32_t>, 4>
GlobalTypeMapType;
/// \brief Mapping from global type IDs to the module in which the
std::vector<Decl *> DeclsLoaded;
typedef ContinuousRangeMap<serialization::DeclID,
- std::pair<PerFileData *, int32_t>, 4>
+ std::pair<Module *, int32_t>, 4>
GlobalDeclMapType;
/// \brief Mapping from global declaration IDs to the module in which the
/// global declaration ID to produce a local ID.
GlobalDeclMapType GlobalDeclMap;
- typedef std::pair<PerFileData *, uint64_t> FileOffset;
+ typedef std::pair<Module *, uint64_t> FileOffset;
typedef SmallVector<FileOffset, 2> FileOffsetsTy;
typedef llvm::DenseMap<serialization::DeclID, FileOffsetsTy>
DeclUpdateOffsetsMap;
DeclUpdateOffsetsMap DeclUpdateOffsets;
typedef llvm::DenseMap<serialization::DeclID,
- std::pair<PerFileData *, uint64_t> >
+ std::pair<Module *, uint64_t> >
DeclReplacementMap;
/// \brief Declarations that have been replaced in a later file in the chain.
DeclReplacementMap ReplacedDecls;
/// \brief Information about the contents of a DeclContext.
struct DeclContextInfo {
- PerFileData *F;
+ Module *F;
void *NameLookupTableData; // a ASTDeclContextNameLookupTable.
const serialization::KindDeclIDPair *LexicalDecls;
unsigned NumLexicalDecls;
std::vector<IdentifierInfo *> IdentifiersLoaded;
typedef ContinuousRangeMap<serialization::IdentID,
- std::pair<PerFileData *, int32_t>, 4>
+ std::pair<Module *, int32_t>, 4>
GlobalIdentifierMapType;
/// \brief Mapping from global identifer IDs to the module in which the
SmallVector<Selector, 16> SelectorsLoaded;
typedef ContinuousRangeMap<serialization::SelectorID,
- std::pair<PerFileData *, int32_t>, 4>
+ std::pair<Module *, int32_t>, 4>
GlobalSelectorMapType;
/// \brief Mapping from global selector IDs to the module in which the
SmallVector<MacroDefinition *, 16> MacroDefinitionsLoaded;
typedef ContinuousRangeMap<serialization::MacroID,
- std::pair<PerFileData *, int32_t>, 4>
+ std::pair<Module *, int32_t>, 4>
GlobalMacroDefinitionMapType;
/// \brief Mapping from global macro definition IDs to the module in which the
/// record resides.
llvm::DenseMap<IdentifierInfo *, uint64_t> UnreadMacroRecordOffsets;
- typedef ContinuousRangeMap<unsigned, std::pair<PerFileData *, int>, 4>
+ typedef ContinuousRangeMap<unsigned, std::pair<Module *, int>, 4>
GlobalPreprocessedEntityMapType;
/// \brief Mapping from global preprocessing entity IDs to the module in
GlobalPreprocessedEntityMapType GlobalPreprocessedEntityMap;
typedef ContinuousRangeMap<serialization::CXXBaseSpecifiersID,
- std::pair<PerFileData *, int32_t>, 4>
+ std::pair<Module *, int32_t>, 4>
GlobalCXXBaseSpecifiersMapType;
/// \brief Mapping from global CXX base specifier IDs to the module in which the
std::string SuggestedPredefines;
/// \brief Reads a statement from the specified cursor.
- Stmt *ReadStmtFromStream(PerFileData &F);
+ Stmt *ReadStmtFromStream(Module &F);
/// \brief Get a FileEntry out of stored-in-PCH filename, making sure we take
/// into account all the necessary relocations.
void MaybeAddSystemRootToFilename(std::string &Filename);
- ASTReadResult ReadASTCore(StringRef FileName, ASTFileType Type);
- ASTReadResult ReadASTBlock(PerFileData &F);
+ ASTReadResult ReadASTCore(StringRef FileName, ModuleKind Type);
+ ASTReadResult ReadASTBlock(Module &F);
bool CheckPredefinesBuffers();
- bool ParseLineTable(PerFileData &F, SmallVectorImpl<uint64_t> &Record);
- ASTReadResult ReadSourceManagerBlock(PerFileData &F);
+ bool ParseLineTable(Module &F, SmallVectorImpl<uint64_t> &Record);
+ ASTReadResult ReadSourceManagerBlock(Module &F);
ASTReadResult ReadSLocEntryRecord(int ID);
llvm::BitstreamCursor &SLocCursorForID(int ID);
- SourceLocation getImportLocation(PerFileData *F);
+ SourceLocation getImportLocation(Module *F);
bool ParseLanguageOptions(const SmallVectorImpl<uint64_t> &Record);
struct RecordLocation {
- RecordLocation(PerFileData *M, uint64_t O)
+ RecordLocation(Module *M, uint64_t O)
: F(M), Offset(O) {}
- PerFileData *F;
+ Module *F;
uint64_t Offset;
};
/// \brief Load the precompiled header designated by the given file
/// name.
- ASTReadResult ReadAST(const std::string &FileName, ASTFileType Type);
+ ASTReadResult ReadAST(const std::string &FileName, ModuleKind Type);
/// \brief Checks that no file that is stored in PCH is out-of-sync with
/// the actual file in the file system.
/// \brief Reads a TemplateArgumentLocInfo appropriate for the
/// given TemplateArgument kind.
TemplateArgumentLocInfo
- GetTemplateArgumentLocInfo(PerFileData &F, TemplateArgument::ArgKind Kind,
+ GetTemplateArgumentLocInfo(Module &F, TemplateArgument::ArgKind Kind,
const RecordData &Record, unsigned &Idx);
/// \brief Reads a TemplateArgumentLoc.
TemplateArgumentLoc
- ReadTemplateArgumentLoc(PerFileData &F,
+ ReadTemplateArgumentLoc(Module &F,
const RecordData &Record, unsigned &Idx);
/// \brief Reads a declarator info from the given record.
- TypeSourceInfo *GetTypeSourceInfo(PerFileData &F,
+ TypeSourceInfo *GetTypeSourceInfo(Module &F,
const RecordData &Record, unsigned &Idx);
/// \brief Resolve and return the translation unit declaration.
QualType GetType(serialization::TypeID ID);
/// \brief Resolve a local type ID within a given AST file into a type.
- QualType getLocalType(PerFileData &F, unsigned LocalID);
+ QualType getLocalType(Module &F, unsigned LocalID);
/// \brief Map a local type ID within a given AST file into a global type ID.
- serialization::TypeID getGlobalTypeID(PerFileData &F, unsigned LocalID) const;
+ serialization::TypeID getGlobalTypeID(Module &F, unsigned LocalID) const;
/// \brief Read a type from the current position in the given record, which
/// was read from the given AST file.
- QualType readType(PerFileData &F, const RecordData &Record, unsigned &Idx) {
+ QualType readType(Module &F, const RecordData &Record, unsigned &Idx) {
if (Idx >= Record.size())
return QualType();
/// \brief Map from a local declaration ID within a given module to a
/// global declaration ID.
- serialization::DeclID getGlobalDeclID(PerFileData &F, unsigned LocalID) const;
+ serialization::DeclID getGlobalDeclID(Module &F, unsigned LocalID) const;
/// \brief Resolve a declaration ID into a declaration, potentially
/// building a new declaration.
virtual Decl *GetExternalDecl(uint32_t ID);
/// \brief Reads a declaration with the given local ID in the give module.
- Decl *GetLocalDecl(PerFileData &F, uint32_t LocalID) {
+ Decl *GetLocalDecl(Module &F, uint32_t LocalID) {
return GetDecl(getGlobalDeclID(F, LocalID));
}
///
/// \returns The requested declaration, casted to the given return type.
template<typename T>
- T *GetLocalDeclAs(PerFileData &F, uint32_t LocalID) {
+ T *GetLocalDeclAs(Module &F, uint32_t LocalID) {
return cast_or_null<T>(GetLocalDecl(F, LocalID));
}
/// given module.
///
/// \returns The declaration ID read from the record, adjusted to a global ID.
- serialization::DeclID ReadDeclID(PerFileData &F, const RecordData &Record,
+ serialization::DeclID ReadDeclID(Module &F, const RecordData &Record,
unsigned &Idx);
/// \brief Reads a declaration from the given position in a record in the
/// given module.
- Decl *ReadDecl(PerFileData &F, const RecordData &R, unsigned &I) {
+ Decl *ReadDecl(Module &F, const RecordData &R, unsigned &I) {
return GetDecl(ReadDeclID(F, R, I));
}
/// \returns The declaration read from this location, casted to the given
/// result type.
template<typename T>
- T *ReadDeclAs(PerFileData &F, const RecordData &R, unsigned &I) {
+ T *ReadDeclAs(Module &F, const RecordData &R, unsigned &I) {
return cast_or_null<T>(GetDecl(ReadDeclID(F, R, I)));
}
}
/// \brief Read a declaration name.
- DeclarationName ReadDeclarationName(PerFileData &F,
+ DeclarationName ReadDeclarationName(Module &F,
const RecordData &Record, unsigned &Idx);
- void ReadDeclarationNameLoc(PerFileData &F,
+ void ReadDeclarationNameLoc(Module &F,
DeclarationNameLoc &DNLoc, DeclarationName Name,
const RecordData &Record, unsigned &Idx);
- void ReadDeclarationNameInfo(PerFileData &F, DeclarationNameInfo &NameInfo,
+ void ReadDeclarationNameInfo(Module &F, DeclarationNameInfo &NameInfo,
const RecordData &Record, unsigned &Idx);
- void ReadQualifierInfo(PerFileData &F, QualifierInfo &Info,
+ void ReadQualifierInfo(Module &F, QualifierInfo &Info,
const RecordData &Record, unsigned &Idx);
- NestedNameSpecifier *ReadNestedNameSpecifier(PerFileData &F,
+ NestedNameSpecifier *ReadNestedNameSpecifier(Module &F,
const RecordData &Record,
unsigned &Idx);
- NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(PerFileData &F,
+ NestedNameSpecifierLoc ReadNestedNameSpecifierLoc(Module &F,
const RecordData &Record,
unsigned &Idx);
/// \brief Read a template name.
- TemplateName ReadTemplateName(PerFileData &F, const RecordData &Record,
+ TemplateName ReadTemplateName(Module &F, const RecordData &Record,
unsigned &Idx);
/// \brief Read a template argument.
- TemplateArgument ReadTemplateArgument(PerFileData &F,
+ TemplateArgument ReadTemplateArgument(Module &F,
const RecordData &Record,unsigned &Idx);
/// \brief Read a template parameter list.
- TemplateParameterList *ReadTemplateParameterList(PerFileData &F,
+ TemplateParameterList *ReadTemplateParameterList(Module &F,
const RecordData &Record,
unsigned &Idx);
/// \brief Read a template argument array.
void
ReadTemplateArgumentList(SmallVector<TemplateArgument, 8> &TemplArgs,
- PerFileData &F, const RecordData &Record,
+ Module &F, const RecordData &Record,
unsigned &Idx);
/// \brief Read a UnresolvedSet structure.
- void ReadUnresolvedSet(PerFileData &F, UnresolvedSetImpl &Set,
+ void ReadUnresolvedSet(Module &F, UnresolvedSetImpl &Set,
const RecordData &Record, unsigned &Idx);
/// \brief Read a C++ base specifier.
- CXXBaseSpecifier ReadCXXBaseSpecifier(PerFileData &F,
+ CXXBaseSpecifier ReadCXXBaseSpecifier(Module &F,
const RecordData &Record,unsigned &Idx);
/// \brief Read a CXXCtorInitializer array.
std::pair<CXXCtorInitializer **, unsigned>
- ReadCXXCtorInitializers(PerFileData &F, const RecordData &Record,
+ ReadCXXCtorInitializers(Module &F, const RecordData &Record,
unsigned &Idx);
/// \brief Read a source location from raw form.
- SourceLocation ReadSourceLocation(PerFileData &Module, unsigned Raw) {
+ SourceLocation ReadSourceLocation(Module &Module, unsigned Raw) {
unsigned Flag = Raw & (1U << 31);
unsigned Offset = Raw & ~(1U << 31);
assert(Module.SLocRemap.find(Offset) != Module.SLocRemap.end() &&
}
/// \brief Read a source location.
- SourceLocation ReadSourceLocation(PerFileData &Module,
+ SourceLocation ReadSourceLocation(Module &Module,
const RecordData &Record, unsigned& Idx) {
return ReadSourceLocation(Module, Record[Idx++]);
}
/// \brief Read a source range.
- SourceRange ReadSourceRange(PerFileData &F,
+ SourceRange ReadSourceRange(Module &F,
const RecordData &Record, unsigned& Idx);
/// \brief Read an integral value
/// \brief Read a version tuple.
VersionTuple ReadVersionTuple(const RecordData &Record, unsigned &Idx);
- CXXTemporary *ReadCXXTemporary(PerFileData &F, const RecordData &Record,
+ CXXTemporary *ReadCXXTemporary(Module &F, const RecordData &Record,
unsigned &Idx);
/// \brief Reads attributes from the current stream position.
- void ReadAttributes(PerFileData &F, AttrVec &Attrs,
+ void ReadAttributes(Module &F, AttrVec &Attrs,
const RecordData &Record, unsigned &Idx);
/// \brief Reads a statement.
- Stmt *ReadStmt(PerFileData &F);
+ Stmt *ReadStmt(Module &F);
/// \brief Reads an expression.
- Expr *ReadExpr(PerFileData &F);
+ Expr *ReadExpr(Module &F);
/// \brief Reads a sub-statement operand during statement reading.
Stmt *ReadSubStmt() {
Expr *ReadSubExpr();
/// \brief Reads the macro record located at the given offset.
- PreprocessedEntity *ReadMacroRecord(PerFileData &F, uint64_t Offset);
+ PreprocessedEntity *ReadMacroRecord(Module &F, uint64_t Offset);
/// \brief Reads the preprocessed entity located at the current stream
/// position.
- PreprocessedEntity *LoadPreprocessedEntity(PerFileData &F);
+ PreprocessedEntity *LoadPreprocessedEntity(Module &F);
/// \brief Note that the identifier is a macro whose record will be loaded
/// from the given AST file at the given (file-local) offset.
- void SetIdentifierIsMacro(IdentifierInfo *II, PerFileData &F,
+ void SetIdentifierIsMacro(IdentifierInfo *II, Module &F,
uint64_t Offset);
/// \brief Read the set of macros defined by this external macro source.
namespace {
class ASTSelectorLookupTrait {
ASTReader &Reader;
- ASTReader::PerFileData &F;
+ Module &F;
public:
struct data_type {
typedef Selector external_key_type;
typedef external_key_type internal_key_type;
- ASTSelectorLookupTrait(ASTReader &Reader, ASTReader::PerFileData &F)
+ ASTSelectorLookupTrait(ASTReader &Reader, Module &F)
: Reader(Reader), F(F) { }
static bool EqualKey(const internal_key_type& a,
namespace clang {
class ASTIdentifierLookupTrait {
ASTReader &Reader;
- ASTReader::PerFileData &F;
+ Module &F;
// If we know the IdentifierInfo in advance, it is here and we will
// not build a new one. Used when deserializing information about an
typedef external_key_type internal_key_type;
- ASTIdentifierLookupTrait(ASTReader &Reader, ASTReader::PerFileData &F,
+ ASTIdentifierLookupTrait(ASTReader &Reader, Module &F,
IdentifierInfo *II = 0)
: Reader(Reader), F(F), KnownII(II) { }
namespace {
class ASTDeclContextNameLookupTrait {
ASTReader &Reader;
- ASTReader::PerFileData &F;
+ Module &F;
public:
/// \brief Pair of begin/end iterators for DeclIDs.
typedef DeclNameKey internal_key_type;
explicit ASTDeclContextNameLookupTrait(ASTReader &Reader,
- ASTReader::PerFileData &F)
+ Module &F)
: Reader(Reader), F(F) { }
static bool EqualKey(const internal_key_type& a,
/// \brief Read the line table in the source manager block.
/// \returns true if there was an error.
-bool ASTReader::ParseLineTable(PerFileData &F,
+bool ASTReader::ParseLineTable(Module &F,
llvm::SmallVectorImpl<uint64_t> &Record) {
unsigned Idx = 0;
LineTableInfo &LineTable = SourceMgr.getLineTable();
/// \brief Read a source manager block
-ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(PerFileData &F) {
+ASTReader::ASTReadResult ASTReader::ReadSourceManagerBlock(Module &F) {
using namespace SrcMgr;
llvm::BitstreamCursor &SLocEntryCursor = F.SLocEntryCursor;
return Failure;
}
- PerFileData *F = GlobalSLocEntryMap.find(-ID)->second;
+ Module *F = GlobalSLocEntryMap.find(-ID)->second;
F->SLocEntryCursor.JumpToBit(F->SLocEntryOffsets[ID - F->SLocEntryBaseID]);
llvm::BitstreamCursor &SLocEntryCursor = F->SLocEntryCursor;
unsigned BaseOffset = F->SLocEntryBaseOffset;
}
SourceLocation IncludeLoc = ReadSourceLocation(*F, Record[1]);
- if (IncludeLoc.isInvalid() && F->Type != MainFile) {
+ if (IncludeLoc.isInvalid() && F->Kind != MK_MainFile) {
// This is the module's main file.
IncludeLoc = getImportLocation(F);
}
}
/// \brief Find the location where the module F is imported.
-SourceLocation ASTReader::getImportLocation(PerFileData *F) {
+SourceLocation ASTReader::getImportLocation(Module *F) {
if (F->ImportLoc.isValid())
return F->ImportLoc;
// Otherwise we have a PCH. It's considered to be "imported" at the first
}
}
-PreprocessedEntity *ASTReader::ReadMacroRecord(PerFileData &F, uint64_t Offset) {
+PreprocessedEntity *ASTReader::ReadMacroRecord(Module &F, uint64_t Offset) {
assert(PP && "Forgot to set Preprocessor ?");
llvm::BitstreamCursor &Stream = F.MacroCursor;
return 0;
}
-PreprocessedEntity *ASTReader::LoadPreprocessedEntity(PerFileData &F) {
+PreprocessedEntity *ASTReader::LoadPreprocessedEntity(Module &F) {
assert(PP && "Forgot to set Preprocessor ?");
unsigned Code = F.PreprocessorDetailCursor.ReadCode();
switch (Code) {
typedef OnDiskChainedHashTable<HeaderFileInfoTrait>
HeaderFileInfoLookupTable;
-void ASTReader::SetIdentifierIsMacro(IdentifierInfo *II, PerFileData &F,
+void ASTReader::SetIdentifierIsMacro(IdentifierInfo *II, Module &F,
uint64_t Offset) {
// Note that this identifier has a macro definition.
II->setHasMacroDefinition(true);
void ASTReader::ReadDefinedMacros() {
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
- PerFileData &F = *Chain[N - I - 1];
+ Module &F = *Chain[N - I - 1];
llvm::BitstreamCursor &MacroCursor = F.MacroCursor;
// If there was no preprocessor block, skip this file.
GlobalMacroDefinitionMapType::iterator I =GlobalMacroDefinitionMap.find(ID);
assert(I != GlobalMacroDefinitionMap.end() &&
"Corrupted global macro definition map");
- PerFileData &F = *I->second.first;
+ Module &F = *I->second.first;
unsigned Index = ID - 1 + I->second.second;
SavedStreamPosition SavedPosition(F.PreprocessorDetailCursor);
F.PreprocessorDetailCursor.JumpToBit(F.MacroDefinitionOffsets[Index]);
}
ASTReader::ASTReadResult
-ASTReader::ReadASTBlock(PerFileData &F) {
+ASTReader::ReadASTBlock(Module &F) {
llvm::BitstreamCursor &Stream = F.Stream;
if (Stream.EnterSubBlock(AST_BLOCK_ID)) {
}
// Load the chained file, which is always a PCH file.
- switch(ReadASTCore(llvm::StringRef(BlobStart, BlobLen), PCH)) {
+ // FIXME: This could end up being a module.
+ switch(ReadASTCore(llvm::StringRef(BlobStart, BlobLen), MK_PCH)) {
case Failure: return Failure;
// If we have to ignore the dependency, we'll have to ignore this too.
case IgnorePCH: return IgnorePCH;
uint32_t Offset = io::ReadUnalignedLE32(Data);
uint16_t Len = io::ReadUnalignedLE16(Data);
llvm::StringRef Name = llvm::StringRef((const char*)Data, Len);
- PerFileData *OM = Modules.lookup(Name);
+ Module *OM = Modules.lookup(Name);
if (!OM) {
Error("SourceLocation remap refers to unknown module");
return Failure;
ASTReader::ASTReadResult ASTReader::validateFileEntries() {
for (unsigned CI = 0, CN = Chain.size(); CI != CN; ++CI) {
- PerFileData *F = Chain[CI];
+ Module *F = Chain[CI];
llvm::BitstreamCursor &SLocEntryCursor = F->SLocEntryCursor;
for (unsigned i = 0, e = F->LocalNumSLocFileEntries; i != e; ++i) {
}
ASTReader::ASTReadResult ASTReader::ReadAST(const std::string &FileName,
- ASTFileType Type) {
+ ModuleKind Type) {
switch(ReadASTCore(FileName, Type)) {
case Failure: return Failure;
case IgnorePCH: return IgnorePCH;
// If this AST file is a precompiled preamble, then set the main file ID of
// the source manager to the file source file from which the preamble was
// built. This is the only valid way to use a precompiled preamble.
- if (Type == Preamble) {
+ if (Type == MK_Preamble) {
if (OriginalFileID.isInvalid()) {
SourceLocation Loc
= SourceMgr.getLocation(FileMgr.getFile(getOriginalSourceFile()), 1, 1);
}
ASTReader::ASTReadResult ASTReader::ReadASTCore(llvm::StringRef FileName,
- ASTFileType Type) {
- PerFileData *Prev = Chain.empty() ? 0 : Chain.back();
- Chain.push_back(new PerFileData(Type));
- PerFileData &F = *Chain.back();
+ ModuleKind Type) {
+ Module *Prev = Chain.empty() ? 0 : Chain.back();
+ Chain.push_back(new Module(Type));
+ Module &F = *Chain.back();
if (Prev)
Prev->NextInSource = &F;
else
}
}
- // Once read, set the PerFileData bit base offset and update the size in
+ // Once read, set the Module bit base offset and update the size in
// bits of all files we've seen.
F.GlobalBitOffset = TotalModulesSizeInBits;
TotalModulesSizeInBits += F.SizeInBits;
void ASTReader::ReadPreprocessedEntities() {
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
- PerFileData &F = *Chain[I];
+ Module &F = *Chain[I];
if (!F.PreprocessorDetailCursor.getBitStreamReader())
continue;
HeaderFileInfo ASTReader::GetHeaderFileInfo(const FileEntry *FE) {
HeaderFileInfoTrait Trait(FE->getName());
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
- PerFileData &F = *Chain[I];
+ Module &F = *Chain[I];
HeaderFileInfoLookupTable *Table
= static_cast<HeaderFileInfoLookupTable *>(F.HeaderFileInfoTable);
if (!Table)
void ASTReader::ReadPragmaDiagnosticMappings(Diagnostic &Diag) {
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
- PerFileData &F = *Chain[I];
+ Module &F = *Chain[I];
unsigned Idx = 0;
while (Idx < F.PragmaDiagMappings.size()) {
SourceLocation Loc = ReadSourceLocation(F, F.PragmaDiagMappings[Idx++]);
class clang::TypeLocReader : public TypeLocVisitor<TypeLocReader> {
ASTReader &Reader;
- ASTReader::PerFileData &F;
+ Module &F;
llvm::BitstreamCursor &DeclsCursor;
const ASTReader::RecordData &Record;
unsigned &Idx;
}
public:
- TypeLocReader(ASTReader &Reader, ASTReader::PerFileData &F,
+ TypeLocReader(ASTReader &Reader, Module &F,
const ASTReader::RecordData &Record, unsigned &Idx)
: Reader(Reader), F(F), DeclsCursor(F.DeclsCursor), Record(Record), Idx(Idx)
{ }
TL.setStarLoc(ReadSourceLocation(Record, Idx));
}
-TypeSourceInfo *ASTReader::GetTypeSourceInfo(PerFileData &F,
+TypeSourceInfo *ASTReader::GetTypeSourceInfo(Module &F,
const RecordData &Record,
unsigned &Idx) {
QualType InfoTy = readType(F, Record, Idx);
return TypesLoaded[Index].withFastQualifiers(FastQuals);
}
-QualType ASTReader::getLocalType(PerFileData &F, unsigned LocalID) {
+QualType ASTReader::getLocalType(Module &F, unsigned LocalID) {
return GetType(getGlobalTypeID(F, LocalID));
}
serialization::TypeID
-ASTReader::getGlobalTypeID(PerFileData &F, unsigned LocalID) const {
+ASTReader::getGlobalTypeID(Module &F, unsigned LocalID) const {
// FIXME: Map from local type ID to global type ID.
return LocalID;
}
}
TemplateArgumentLocInfo
-ASTReader::GetTemplateArgumentLocInfo(PerFileData &F,
+ASTReader::GetTemplateArgumentLocInfo(Module &F,
TemplateArgument::ArgKind Kind,
const RecordData &Record,
unsigned &Index) {
}
TemplateArgumentLoc
-ASTReader::ReadTemplateArgumentLoc(PerFileData &F,
+ASTReader::ReadTemplateArgumentLoc(Module &F,
const RecordData &Record, unsigned &Index) {
TemplateArgument Arg = ReadTemplateArgument(F, Record, Index);
}
serialization::DeclID
-ASTReader::getGlobalDeclID(PerFileData &F, unsigned LocalID) const {
+ASTReader::getGlobalDeclID(Module &F, unsigned LocalID) const {
// FIXME: Perform local -> global remapping for declarations.
return LocalID;
}
return DeclsLoaded[Index];
}
-serialization::DeclID ASTReader::ReadDeclID(PerFileData &F,
+serialization::DeclID ASTReader::ReadDeclID(Module &F,
const RecordData &Record,
unsigned &Idx) {
if (Idx >= Record.size()) {
std::fprintf(stderr, "\n");
}
-template<typename Key, typename PerFileData, unsigned InitialCapacity>
+template<typename Key, typename Module, unsigned InitialCapacity>
static void
dumpModuleIDMap(llvm::StringRef Name,
- const ContinuousRangeMap<Key, PerFileData *,
+ const ContinuousRangeMap<Key, Module *,
InitialCapacity> &Map) {
if (Map.begin() == Map.end())
return;
- typedef ContinuousRangeMap<Key, PerFileData *, InitialCapacity> MapType;
+ typedef ContinuousRangeMap<Key, Module *, InitialCapacity> MapType;
llvm::errs() << Name << ":\n";
for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
I != IEnd; ++I) {
}
}
-template<typename Key, typename PerFileData, typename Adjustment,
+template<typename Key, typename Module, typename Adjustment,
unsigned InitialCapacity>
static void
dumpModuleIDOffsetMap(llvm::StringRef Name,
const ContinuousRangeMap<Key,
- std::pair<PerFileData *,
+ std::pair<Module *,
Adjustment>,
InitialCapacity> &Map) {
if (Map.begin() == Map.end())
return;
- typedef ContinuousRangeMap<Key, std::pair<PerFileData *, Adjustment>,
+ typedef ContinuousRangeMap<Key, std::pair<Module *, Adjustment>,
InitialCapacity> MapType;
llvm::errs() << Name << ":\n";
for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
SemaObj->StdBadAlloc = SemaDeclRefs[1];
}
- for (PerFileData *F = FirstInSource; F; F = F->NextInSource) {
+ for (Module *F = FirstInSource; F; F = F->NextInSource) {
// If there are @selector references added them to its pool. This is for
// implementation of -Wselector.
// The special data sets below always come from the most recent PCH,
// which is at the front of the chain.
- PerFileData &F = *Chain.front();
+ Module &F = *Chain.front();
// If there were any pending implicit instantiations, deserialize them
// and add them to Sema's queue of such instantiations.
ASTReader::ReadMethodPool(Selector Sel) {
// Find this selector in a hash table. We want to find the most recent entry.
for (unsigned I = 0, N = Chain.size(); I != N; ++I) {
- PerFileData &F = *Chain[I];
+ Module &F = *Chain[I];
if (!F.SelectorLookupTable)
continue;
// Load this selector from the selector table.
GlobalSelectorMapType::iterator I = GlobalSelectorMap.find(ID);
assert(I != GlobalSelectorMap.end() && "Corrupted global selector map");
- PerFileData &F = *I->second.first;
+ Module &F = *I->second.first;
ASTSelectorLookupTrait Trait(*this, F);
unsigned Idx = ID - 1 + I->second.second;
SelectorsLoaded[ID - 1] =
}
DeclarationName
-ASTReader::ReadDeclarationName(PerFileData &F,
+ASTReader::ReadDeclarationName(Module &F,
const RecordData &Record, unsigned &Idx) {
DeclarationName::NameKind Kind = (DeclarationName::NameKind)Record[Idx++];
switch (Kind) {
return DeclarationName();
}
-void ASTReader::ReadDeclarationNameLoc(PerFileData &F,
+void ASTReader::ReadDeclarationNameLoc(Module &F,
DeclarationNameLoc &DNLoc,
DeclarationName Name,
const RecordData &Record, unsigned &Idx) {
}
}
-void ASTReader::ReadDeclarationNameInfo(PerFileData &F,
+void ASTReader::ReadDeclarationNameInfo(Module &F,
DeclarationNameInfo &NameInfo,
const RecordData &Record, unsigned &Idx) {
NameInfo.setName(ReadDeclarationName(F, Record, Idx));
NameInfo.setInfo(DNLoc);
}
-void ASTReader::ReadQualifierInfo(PerFileData &F, QualifierInfo &Info,
+void ASTReader::ReadQualifierInfo(Module &F, QualifierInfo &Info,
const RecordData &Record, unsigned &Idx) {
Info.QualifierLoc = ReadNestedNameSpecifierLoc(F, Record, Idx);
unsigned NumTPLists = Record[Idx++];
}
TemplateName
-ASTReader::ReadTemplateName(PerFileData &F, const RecordData &Record,
+ASTReader::ReadTemplateName(Module &F, const RecordData &Record,
unsigned &Idx) {
TemplateName::NameKind Kind = (TemplateName::NameKind)Record[Idx++];
switch (Kind) {
}
TemplateArgument
-ASTReader::ReadTemplateArgument(PerFileData &F,
+ASTReader::ReadTemplateArgument(Module &F,
const RecordData &Record, unsigned &Idx) {
TemplateArgument::ArgKind Kind = (TemplateArgument::ArgKind)Record[Idx++];
switch (Kind) {
}
TemplateParameterList *
-ASTReader::ReadTemplateParameterList(PerFileData &F,
+ASTReader::ReadTemplateParameterList(Module &F,
const RecordData &Record, unsigned &Idx) {
SourceLocation TemplateLoc = ReadSourceLocation(F, Record, Idx);
SourceLocation LAngleLoc = ReadSourceLocation(F, Record, Idx);
void
ASTReader::
ReadTemplateArgumentList(llvm::SmallVector<TemplateArgument, 8> &TemplArgs,
- PerFileData &F, const RecordData &Record,
+ Module &F, const RecordData &Record,
unsigned &Idx) {
unsigned NumTemplateArgs = Record[Idx++];
TemplArgs.reserve(NumTemplateArgs);
}
/// \brief Read a UnresolvedSet structure.
-void ASTReader::ReadUnresolvedSet(PerFileData &F, UnresolvedSetImpl &Set,
+void ASTReader::ReadUnresolvedSet(Module &F, UnresolvedSetImpl &Set,
const RecordData &Record, unsigned &Idx) {
unsigned NumDecls = Record[Idx++];
while (NumDecls--) {
}
CXXBaseSpecifier
-ASTReader::ReadCXXBaseSpecifier(PerFileData &F,
+ASTReader::ReadCXXBaseSpecifier(Module &F,
const RecordData &Record, unsigned &Idx) {
bool isVirtual = static_cast<bool>(Record[Idx++]);
bool isBaseOfClass = static_cast<bool>(Record[Idx++]);
}
std::pair<CXXCtorInitializer **, unsigned>
-ASTReader::ReadCXXCtorInitializers(PerFileData &F, const RecordData &Record,
+ASTReader::ReadCXXCtorInitializers(Module &F, const RecordData &Record,
unsigned &Idx) {
CXXCtorInitializer **CtorInitializers = 0;
unsigned NumInitializers = Record[Idx++];
}
NestedNameSpecifier *
-ASTReader::ReadNestedNameSpecifier(PerFileData &F,
+ASTReader::ReadNestedNameSpecifier(Module &F,
const RecordData &Record, unsigned &Idx) {
unsigned N = Record[Idx++];
NestedNameSpecifier *NNS = 0, *Prev = 0;
}
NestedNameSpecifierLoc
-ASTReader::ReadNestedNameSpecifierLoc(PerFileData &F, const RecordData &Record,
+ASTReader::ReadNestedNameSpecifierLoc(Module &F, const RecordData &Record,
unsigned &Idx) {
unsigned N = Record[Idx++];
NestedNameSpecifierLocBuilder Builder;
}
SourceRange
-ASTReader::ReadSourceRange(PerFileData &F, const RecordData &Record,
+ASTReader::ReadSourceRange(Module &F, const RecordData &Record,
unsigned &Idx) {
SourceLocation beg = ReadSourceLocation(F, Record, Idx);
SourceLocation end = ReadSourceLocation(F, Record, Idx);
return VersionTuple(Major, Minor - 1, Subminor - 1);
}
-CXXTemporary *ASTReader::ReadCXXTemporary(PerFileData &F,
+CXXTemporary *ASTReader::ReadCXXTemporary(Module &F,
const RecordData &Record,
unsigned &Idx) {
CXXDestructorDecl *Decl = ReadDeclAs<CXXDestructorDecl>(F, Record, Idx);
}
}
-ASTReader::PerFileData::PerFileData(ASTFileType Ty)
- : Type(Ty), SizeInBits(0), LocalNumSLocEntries(0), SLocEntryBaseID(0),
+Module::Module(ModuleKind Kind)
+ : Kind(Kind), SizeInBits(0), LocalNumSLocEntries(0), SLocEntryBaseID(0),
SLocEntryBaseOffset(0), SLocEntryOffsets(0),
SLocFileOffsets(0), LocalNumIdentifiers(0),
IdentifierOffsets(0), IdentifierTableData(0),
NumPreallocatedPreprocessingEntities(0), NextInSource(0)
{}
-ASTReader::PerFileData::~PerFileData() {
+Module::~Module() {
delete static_cast<ASTIdentifierLookupTable *>(IdentifierLookupTable);
delete static_cast<HeaderFileInfoLookupTable *>(HeaderFileInfoTable);
delete static_cast<ASTSelectorLookupTable *>(SelectorLookupTable);