diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Serialization/ASTBitCodes.h | 6 | ||||
-rw-r--r-- | include/clang/Serialization/ASTReader.h | 9 | ||||
-rw-r--r-- | include/clang/Serialization/ASTWriter.h | 5 | ||||
-rw-r--r-- | include/clang/Serialization/Module.h | 12 |
4 files changed, 29 insertions, 3 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h index 988cac20b3..1cf118638c 100644 --- a/include/clang/Serialization/ASTBitCodes.h +++ b/include/clang/Serialization/ASTBitCodes.h @@ -257,7 +257,11 @@ namespace clang { ORIGINAL_FILE = 5, /// \brief The directory that the PCH was originally created in. - ORIGINAL_PCH_DIR = 6 + ORIGINAL_PCH_DIR = 6, + + /// \brief Offsets into the input-files block where input files + /// reside. + INPUT_FILE_OFFSETS = 7 }; /// \brief Record types that occur within the input-files block diff --git a/include/clang/Serialization/ASTReader.h b/include/clang/Serialization/ASTReader.h index 03ec200035..6be01d47e7 100644 --- a/include/clang/Serialization/ASTReader.h +++ b/include/clang/Serialization/ASTReader.h @@ -860,18 +860,23 @@ private: /// \brief Reads a statement from the specified cursor. Stmt *ReadStmtFromStream(ModuleFile &F); + typedef llvm::PointerIntPair<const FileEntry *, 1, bool> InputFile; + + /// \brief Retrieve the file entry and 'overridden' bit for an input + /// file in the given module file. + InputFile getInputFile(ModuleFile &F, unsigned ID); + /// \brief Get a FileEntry out of stored-in-PCH filename, making sure we take /// into account all the necessary relocations. const FileEntry *getFileEntry(StringRef filename); - void MaybeAddSystemRootToFilename(ModuleFile &M, std::string &Filename); + StringRef MaybeAddSystemRootToFilename(ModuleFile &M, std::string &Filename); ASTReadResult ReadASTCore(StringRef FileName, ModuleKind Type, ModuleFile *ImportedBy, llvm::SmallVectorImpl<ModuleFile *> &Loaded); ASTReadResult ReadControlBlock(ModuleFile &F, llvm::SmallVectorImpl<ModuleFile *> &Loaded); - ASTReadResult ReadInputFilesBlock(ModuleFile &F); ASTReadResult ReadASTBlock(ModuleFile &F); bool CheckPredefinesBuffers(); bool ParseLineTable(ModuleFile &F, SmallVectorImpl<uint64_t> &Record); diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index 37cf1b3c36..be8e78e7b3 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -45,6 +45,7 @@ class ASTContext; class NestedNameSpecifier; class CXXBaseSpecifier; class CXXCtorInitializer; +class FileEntry; class FPOptions; class HeaderSearch; class IdentifierResolver; @@ -121,6 +122,10 @@ private: /// \brief Indicates that the AST contained compiler errors. bool ASTHasCompilerErrors; + /// \brief Mapping from input file entries to the index into the + /// offset table where information about that input file is stored. + llvm::DenseMap<const FileEntry *, uint32_t> InputFileIDs; + /// \brief Stores a declaration or a type to be written to the AST file. class DeclOrType { public: diff --git a/include/clang/Serialization/Module.h b/include/clang/Serialization/Module.h index a1a47d8b04..2915cfc01c 100644 --- a/include/clang/Serialization/Module.h +++ b/include/clang/Serialization/Module.h @@ -128,6 +128,18 @@ public: /// \brief The first source location in this module. SourceLocation FirstLoc; + // === Input Files === + /// \brief The cursor to the start of the input-files block. + llvm::BitstreamCursor InputFilesCursor; + + /// \brief Offsets for all of the input file entries in the AST file. + const uint32_t *InputFileOffsets; + + /// \brief The input files that have been loaded from this AST file, along + /// with a bool indicating whether this was an overridden buffer. + std::vector<llvm::PointerIntPair<const FileEntry *, 1, bool> > + InputFilesLoaded; + // === Source Locations === /// \brief Cursor used to read source location entries. |