diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-12-18 22:12:19 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-12-18 22:12:19 +0000 |
commit | 82dfaf7c0ccbbde43f701b12367dbf22265dcb4e (patch) | |
tree | 2d06a8965dc90ada4ecd99742254c54c675d7ab9 /Basic/SourceManager.cpp | |
parent | dca29279d724a5a84343d27644e7ba172570079f (diff) |
When serializing SourceManager, we now serialize out absolute paths
to serialized source files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45183 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic/SourceManager.cpp')
-rw-r--r-- | Basic/SourceManager.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Basic/SourceManager.cpp b/Basic/SourceManager.cpp index 22a7cf511f..d7039b3651 100644 --- a/Basic/SourceManager.cpp +++ b/Basic/SourceManager.cpp @@ -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(); |