diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-12-05 00:14:18 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-12-05 00:14:18 +0000 |
commit | 099b4747042352f69184481a48508b599a8d3f73 (patch) | |
tree | a2ce08c367f753865764e7226febce8cd1b80a22 /include/clang/Basic/SourceManager.h | |
parent | 3cadd0348e0ee7a5dc3ba5b31be731072fb7ea1c (diff) |
Implemented initial serialization support for SourceManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44590 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/SourceManager.h')
-rw-r--r-- | include/clang/Basic/SourceManager.h | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/include/clang/Basic/SourceManager.h b/include/clang/Basic/SourceManager.h index e019f0ecf4..bcce27bb89 100644 --- a/include/clang/Basic/SourceManager.h +++ b/include/clang/Basic/SourceManager.h @@ -28,6 +28,7 @@ class MemoryBuffer; namespace clang { class SourceManager; +class FileManager; class FileEntry; class IdentifierTokenInfo; @@ -72,13 +73,13 @@ namespace SrcMgr { } /// Emit - Emit this ContentCache to Bitcode. - void Emit(llvm::Serializer& S, bool StoreBufferName, - bool StoreBufferContents) const; + void Emit(llvm::Serializer& S) const; + + /// ReadToSourceManager - Reconstitute a ContentCache from Bitcode + // and store it in the specified SourceManager. + static void ReadToSourceManager(llvm::Deserializer& D, SourceManager& SMgr, + FileManager* FMgr, std::vector<char>& Buf); - /// Read - Reconstitute a ContentCache from Bitcode. - void Read(llvm::Deserializer& D, std::vector<char>* BufferNameBuf, - bool ReadBufferContents); - private: // Disable assignments. ContentCache& operator=(const ContentCache& RHS); @@ -130,6 +131,12 @@ namespace SrcMgr { SourceLocation getIncludeLoc() const { return IncludeLoc; } unsigned getChunkNo() const { return ChunkNo; } const ContentCache* getContentCache() const { return Content; } + + /// Emit - Emit this FileIDInfo to Bitcode. + void Emit(llvm::Serializer& S) const; + + /// ReadVal - Reconstitute a FileIDInfo from Bitcode. + static FileIDInfo ReadVal(llvm::Deserializer& S); }; /// MacroIDInfo - Macro SourceLocations refer to these records by their ID. @@ -153,6 +160,12 @@ namespace SrcMgr { X.PhysicalLoc = PL; return X; } + + /// Emit - Emit this MacroIDInfo to Bitcode. + void Emit(llvm::Serializer& S) const; + + /// ReadVal - Reconstitute a MacroIDInfo from Bitcode. + static MacroIDInfo ReadVal(llvm::Deserializer& S); }; } // end SrcMgr namespace. } // end clang namespace @@ -349,7 +362,15 @@ public: /// void PrintStats() const; + /// Emit - Emit this SourceManager to Bitcode. + void Emit(llvm::Serializer& S) const; + + /// Read - Reconstitute a SourceManager from Bitcode. + void Read(llvm::Deserializer& S, FileManager &FMgr); + private: + friend class SrcMgr::ContentCache; // Used for deserialization. + /// createFileID - Create a new fileID for the specified ContentCache and /// include position. This works regardless of whether the ContentCache /// corresponds to a file or some other input source. |