When serializing SourceManager, we now serialize out absolute paths

to serialized source files.

llvm-svn: 45183
This commit is contained in:
Ted Kremenek 2007-12-18 22:12:19 +00:00
parent 14020706d8
commit 8c8947fb92
1 changed files with 13 additions and 1 deletions

View File

@ -415,7 +415,19 @@ void ContentCache::Emit(llvm::Serializer& S) const {
S.FlushRecord();
S.EmitPtr(this);
if (Entry) S.EmitCStr(Buffer->getBufferIdentifier());
if (Entry) {
llvm::sys::Path Fname(Buffer->getBufferIdentifier());
if (Fname.isAbsolute())
S.EmitCStr(Fname.c_str());
else {
// Create an absolute path.
// FIXME: This will potentially contain ".." and "." in the path.
llvm::sys::Path path = llvm::sys::Path::GetCurrentDirectory();
path.appendComponent(Fname.c_str());
S.EmitCStr(path.c_str());
}
}
else {
const char* p = Buffer->getBufferStart();
const char* e = Buffer->getBufferEnd();