[cfe-commits] r44591 - in /cfe/trunk: Basic/SourceManager.cpp include/clang/Basic/SourceManager.h
Ted Kremenek
kremenek at apple.com
Tue Dec 4 16:19:52 PST 2007
Author: kremenek
Date: Tue Dec 4 18:19:51 2007
New Revision: 44591
URL: http://llvm.org/viewvc/llvm-project?rev=44591&view=rev
Log:
Renamed SourceManager::Read to SourceManager::CreateAndRegister.
Now sourcemanager deserializer automatically self-registers itself with
the deserializer.
Modified:
cfe/trunk/Basic/SourceManager.cpp
cfe/trunk/include/clang/Basic/SourceManager.h
Modified: cfe/trunk/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Basic/SourceManager.cpp?rev=44591&r1=44590&r2=44591&view=diff
==============================================================================
--- cfe/trunk/Basic/SourceManager.cpp (original)
+++ cfe/trunk/Basic/SourceManager.cpp Tue Dec 4 18:19:51 2007
@@ -490,6 +490,9 @@
}
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 @@
// 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
Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=44591&r1=44590&r2=44591&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Tue Dec 4 18:19:51 2007
@@ -366,7 +366,8 @@
void Emit(llvm::Serializer& S) const;
/// Read - Reconstitute a SourceManager from Bitcode.
- void Read(llvm::Deserializer& S, FileManager &FMgr);
+ static SourceManager* CreateAndRegister(llvm::Deserializer& S,
+ FileManager &FMgr);
private:
friend class SrcMgr::ContentCache; // Used for deserialization.
More information about the cfe-commits
mailing list