diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Serialization/GlobalModuleIndex.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Serialization/GlobalModuleIndex.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/llvm/tools/clang/lib/Serialization/GlobalModuleIndex.cpp b/contrib/llvm/tools/clang/lib/Serialization/GlobalModuleIndex.cpp index 1b52b44..2c7da3e 100644 --- a/contrib/llvm/tools/clang/lib/Serialization/GlobalModuleIndex.cpp +++ b/contrib/llvm/tools/clang/lib/Serialization/GlobalModuleIndex.cpp @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "ASTReaderInternals.h" +#include "clang/Frontend/PCHContainerOperations.h" #include "clang/Basic/FileManager.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Serialization/ASTBitCodes.h" @@ -384,6 +385,7 @@ namespace { /// \brief Builder that generates the global module index file. class GlobalModuleIndexBuilder { FileManager &FileMgr; + const PCHContainerOperations &PCHContainerOps; /// \brief Mapping from files to module file information. typedef llvm::MapVector<const FileEntry *, ModuleFileInfo> ModuleFilesMap; @@ -416,7 +418,9 @@ namespace { } public: - explicit GlobalModuleIndexBuilder(FileManager &FileMgr) : FileMgr(FileMgr){} + explicit GlobalModuleIndexBuilder( + FileManager &FileMgr, const PCHContainerOperations &PCHContainerOps) + : FileMgr(FileMgr), PCHContainerOps(PCHContainerOps) {} /// \brief Load the contents of the given module file into the builder. /// @@ -501,8 +505,7 @@ bool GlobalModuleIndexBuilder::loadModuleFile(const FileEntry *File) { // Initialize the input stream llvm::BitstreamReader InStreamFile; - InStreamFile.init((const unsigned char *)(*Buffer)->getBufferStart(), - (const unsigned char *)(*Buffer)->getBufferEnd()); + PCHContainerOps.ExtractPCH((*Buffer)->getMemBufferRef(), InStreamFile); llvm::BitstreamCursor InStream(InStreamFile); // Sniff for the signature. @@ -764,7 +767,9 @@ void GlobalModuleIndexBuilder::writeIndex(llvm::BitstreamWriter &Stream) { } GlobalModuleIndex::ErrorCode -GlobalModuleIndex::writeIndex(FileManager &FileMgr, StringRef Path) { +GlobalModuleIndex::writeIndex(FileManager &FileMgr, + const PCHContainerOperations &PCHContainerOps, + StringRef Path) { llvm::SmallString<128> IndexPath; IndexPath += Path; llvm::sys::path::append(IndexPath, IndexFileName); @@ -787,8 +792,8 @@ GlobalModuleIndex::writeIndex(FileManager &FileMgr, StringRef Path) { } // The module index builder. - GlobalModuleIndexBuilder Builder(FileMgr); - + GlobalModuleIndexBuilder Builder(FileMgr, PCHContainerOps); + // Load each of the module files. std::error_code EC; for (llvm::sys::fs::directory_iterator D(Path, EC), DEnd; |