summaryrefslogtreecommitdiffstats
path: root/clang/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
commite63414238836fd7e354fcfa404357e7a72fce119 (patch)
tree1f9356d1c9a073154fda7c4a5b0278524bc7faf2 /clang/Basic/SourceManager.cpp
parent57f4c00241b4ed3f5c6917896ad197d07bc5b9ee (diff)
downloadbcm5719-llvm-e63414238836fd7e354fcfa404357e7a72fce119.tar.gz
bcm5719-llvm-e63414238836fd7e354fcfa404357e7a72fce119.zip
Renamed SourceManager::Read to SourceManager::CreateAndRegister.
Now sourcemanager deserializer automatically self-registers itself with the deserializer. llvm-svn: 44591
Diffstat (limited to 'clang/Basic/SourceManager.cpp')
-rw-r--r--clang/Basic/SourceManager.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/clang/Basic/SourceManager.cpp b/clang/Basic/SourceManager.cpp
index 3d32eb81880..2cb2b5ba154 100644
--- a/clang/Basic/SourceManager.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud