aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/PCHWriter.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2010-07-22 17:01:13 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2010-07-22 17:01:13 +0000
commit0fa7d0b15ea2a224bfe43ac745d411f915da87dd (patch)
tree0349170c561edec5800ab425f75d9d8b37e29ba8 /lib/Frontend/PCHWriter.cpp
parent554e6aa2da082575514607c3639c246c04b3232a (diff)
Allow loading declcontext information from any file in the chain. Properly write source locations to dependent files. WIP
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109119 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PCHWriter.cpp')
-rw-r--r--lib/Frontend/PCHWriter.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Frontend/PCHWriter.cpp b/lib/Frontend/PCHWriter.cpp
index d8ce4e3b6e..b97aecbd8c 100644
--- a/lib/Frontend/PCHWriter.cpp
+++ b/lib/Frontend/PCHWriter.cpp
@@ -1099,8 +1099,10 @@ void PCHWriter::WriteSourceManagerBlock(SourceManager &SourceMgr,
// entry, which is always the same dummy entry.
std::vector<uint32_t> SLocEntryOffsets;
RecordData PreloadSLocs;
- SLocEntryOffsets.reserve(SourceMgr.sloc_entry_size() - 1);
- for (unsigned I = 1, N = SourceMgr.sloc_entry_size(); I != N; ++I) {
+ unsigned BaseSLocID = Chain ? Chain->getTotalNumSLocs() : 0;
+ SLocEntryOffsets.reserve(SourceMgr.sloc_entry_size() - 1 - BaseSLocID);
+ for (unsigned I = BaseSLocID + 1, N = SourceMgr.sloc_entry_size();
+ I != N; ++I) {
// Get this source location entry.
const SrcMgr::SLocEntry *SLoc = &SourceMgr.getSLocEntry(I);
@@ -1157,7 +1159,7 @@ void PCHWriter::WriteSourceManagerBlock(SourceManager &SourceMgr,
// FIXME: For now, preload all file source locations, so that
// we get the appropriate File entries in the reader. This is
// a temporary measure.
- PreloadSLocs.push_back(SLocEntryOffsets.size());
+ PreloadSLocs.push_back(BaseSLocID + SLocEntryOffsets.size());
} else {
// The source location entry is a buffer. The blob associated
// with this entry contains the contents of the buffer.
@@ -1177,7 +1179,7 @@ void PCHWriter::WriteSourceManagerBlock(SourceManager &SourceMgr,
Buffer->getBufferSize() + 1));
if (strcmp(Name, "<built-in>") == 0)
- PreloadSLocs.push_back(SLocEntryOffsets.size());
+ PreloadSLocs.push_back(BaseSLocID + SLocEntryOffsets.size());
}
} else {
// The source location entry is an instantiation.