summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PCHWriter.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-04-15 18:05:10 +0000
committerDouglas Gregor <dgregor@apple.com>2009-04-15 18:05:10 +0000
commit832432799366407a1919bde001dac753d9e29c70 (patch)
tree83dcbbb0bb5e02f190d3edd6f9549b018dfb6dca /clang/lib/Frontend/PCHWriter.cpp
parent37608532c4361569a7342e1a2c0bae044952b806 (diff)
downloadbcm5719-llvm-832432799366407a1919bde001dac753d9e29c70.tar.gz
bcm5719-llvm-832432799366407a1919bde001dac753d9e29c70.zip
For source location entries that describe instantiations, encode the
token length in the PCH file rather than trying (and failing) to reconstruct it be getting the spelling token's length. llvm-svn: 69191
Diffstat (limited to 'clang/lib/Frontend/PCHWriter.cpp')
-rw-r--r--clang/lib/Frontend/PCHWriter.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHWriter.cpp b/clang/lib/Frontend/PCHWriter.cpp
index 6c3056a1bb7..0b5a2a65d15 100644
--- a/clang/lib/Frontend/PCHWriter.cpp
+++ b/clang/lib/Frontend/PCHWriter.cpp
@@ -736,6 +736,7 @@ static unsigned CreateSLocInstantiationAbbrev(llvm::BitstreamWriter &S) {
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // Spelling location
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // Start location
Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); // End location
+ Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // Token length
return S.EmitAbbrev(Abbrev);
}
@@ -818,6 +819,13 @@ void PCHWriter::WriteSourceManagerBlock(SourceManager &SourceMgr) {
Record.push_back(Inst.getInstantiationLocStart().getRawEncoding());
Record.push_back(Inst.getInstantiationLocEnd().getRawEncoding());
+ // Compute the token length for this macro expansion.
+ unsigned NextOffset = SourceMgr.getNextOffset();
+ SourceManager::sloc_entry_iterator NextSLoc = SLoc;
+ if (++NextSLoc != SLocEnd)
+ NextOffset = NextSLoc->getOffset();
+ Record.push_back(NextOffset - SLoc->getOffset() - 1);
+
if (SLocInstantiationAbbrv == -1)
SLocInstantiationAbbrv = CreateSLocInstantiationAbbrev(S);
S.EmitRecordWithAbbrev(SLocInstantiationAbbrv, Record);
OpenPOWER on IntegriCloud