aboutsummaryrefslogtreecommitdiff
path: root/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2007-12-05 00:19:51 +0000
committerTed Kremenek <kremenek@apple.com>2007-12-05 00:19:51 +0000
commit1f94100e53a7d45cea706c09ac0f35cf723a8d83 (patch)
tree310a4e275204e2463ac31b248b609a90a358a2b1 /Basic/SourceManager.cpp
parent099b4747042352f69184481a48508b599a8d3f73 (diff)
Renamed SourceManager::Read to SourceManager::CreateAndRegister.
Now sourcemanager deserializer automatically self-registers itself with the deserializer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44591 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/SourceManager.cpp')
-rw-r--r--Basic/SourceManager.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/Basic/SourceManager.cpp b/Basic/SourceManager.cpp
index 3d32eb8188..2cb2b5ba15 100644
--- a/Basic/SourceManager.cpp
+++ b/Basic/SourceManager.cpp
@@ -490,6 +490,9 @@ MacroIDInfo MacroIDInfo::ReadVal(llvm::Deserializer& D) {
}
void SourceManager::Emit(llvm::Serializer& S) const {
+ S.EnterBlock();
+ S.EmitPtr(this);
+
// Emit: FileInfos. Just emit the file name.
S.EnterBlock();
@@ -513,32 +516,40 @@ void SourceManager::Emit(llvm::Serializer& S) const {
// Emit: MacroIDs
S.EmitInt(MacroIDs.size());
std::for_each(MacroIDs.begin(), MacroIDs.end(), S.MakeEmitter<MacroIDInfo>());
+
+ S.ExitBlock();
}
-void SourceManager::Read(llvm::Deserializer& D, FileManager& FMgr) {
+SourceManager*
+SourceManager::CreateAndRegister(llvm::Deserializer& D, FileManager& FMgr){
+ SourceManager *M = new SourceManager();
+ D.RegisterPtr(M);
+
std::vector<char> Buf;
{ // Read: FileInfos.
llvm::Deserializer::Location BLoc = D.getCurrentBlockLocation();
while (!D.FinishedBlock(BLoc))
- ContentCache::ReadToSourceManager(D,*this,&FMgr,Buf);
+ ContentCache::ReadToSourceManager(D,*M,&FMgr,Buf);
}
{ // Read: MemBufferInfos.
llvm::Deserializer::Location BLoc = D.getCurrentBlockLocation();
while (!D.FinishedBlock(BLoc))
- ContentCache::ReadToSourceManager(D,*this,NULL,Buf);
+ ContentCache::ReadToSourceManager(D,*M,NULL,Buf);
}
// Read: FileIDs.
unsigned Size = D.ReadInt();
- FileIDs.reserve(Size);
+ M->FileIDs.reserve(Size);
for (; Size > 0 ; --Size)
- FileIDs.push_back(FileIDInfo::ReadVal(D));
+ M->FileIDs.push_back(FileIDInfo::ReadVal(D));
// Read: MacroIDs.
Size = D.ReadInt();
- MacroIDs.reserve(Size);
+ M->MacroIDs.reserve(Size);
for (; Size > 0 ; --Size)
- MacroIDs.push_back(MacroIDInfo::ReadVal(D));
+ M->MacroIDs.push_back(MacroIDInfo::ReadVal(D));
+
+ return M;
} \ No newline at end of file