diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-10-16 22:46:09 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-10-16 22:46:09 +0000 |
commit | 8655e88603611ca52c648ed21b476274be2ffb8d (patch) | |
tree | fa6f295d33489adca0c56985a316279d85794bb2 /clang/lib/Frontend/PCHWriter.cpp | |
parent | 1f1a097f660c1dbbd02c4bdbde4f9815cef91794 (diff) | |
download | bcm5719-llvm-8655e88603611ca52c648ed21b476274be2ffb8d.tar.gz bcm5719-llvm-8655e88603611ca52c648ed21b476274be2ffb8d.zip |
While writing source-location entries to a PCH file, go through an
interface that can load those source-location entries on demand (from
another PCH file).
llvm-svn: 84287
Diffstat (limited to 'clang/lib/Frontend/PCHWriter.cpp')
-rw-r--r-- | clang/lib/Frontend/PCHWriter.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp index 74bd9677abd..91c47a32b81 100644 --- a/clang/lib/Frontend/PCHWriter.cpp +++ b/clang/lib/Frontend/PCHWriter.cpp @@ -928,10 +928,10 @@ void PCHWriter::WriteSourceManagerBlock(SourceManager &SourceMgr, std::vector<uint32_t> SLocEntryOffsets; RecordData PreloadSLocs; SLocEntryOffsets.reserve(SourceMgr.sloc_entry_size() - 1); - for (SourceManager::sloc_entry_iterator - SLoc = SourceMgr.sloc_entry_begin() + 1, - SLocEnd = SourceMgr.sloc_entry_end(); - SLoc != SLocEnd; ++SLoc) { + for (unsigned I = 1, N = SourceMgr.sloc_entry_size(); I != N; ++I) { + // Get this source location entry. + const SrcMgr::SLocEntry *SLoc = &SourceMgr.getSLocEntry(I); + // Record the offset of this source-location entry. SLocEntryOffsets.push_back(Stream.GetCurrentBitNo()); @@ -1006,9 +1006,8 @@ void PCHWriter::WriteSourceManagerBlock(SourceManager &SourceMgr, // Compute the token length for this macro expansion. unsigned NextOffset = SourceMgr.getNextOffset(); - SourceManager::sloc_entry_iterator NextSLoc = SLoc; - if (++NextSLoc != SLocEnd) - NextOffset = NextSLoc->getOffset(); + if (I + 1 != N) + NextOffset = SourceMgr.getSLocEntry(I + 1).getOffset(); Record.push_back(NextOffset - SLoc->getOffset() - 1); Stream.EmitRecordWithAbbrev(SLocInstantiationAbbrv, Record); } |