[modules] Store the location of the lexical update record in a decl update as
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 14 Apr 2016 00:50:18 +0000 (00:50 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 14 Apr 2016 00:50:18 +0000 (00:50 +0000)
an offset from the current record rather than as an absolute bit number. This
gives a minor .pcm file size reduction.

llvm-svn: 266269

clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp

index 03d1b11..d81d73d 100644 (file)
@@ -3767,7 +3767,7 @@ void ASTDeclReader::UpdateDecl(Decl *D, ModuleFile &ModuleFile,
       ReadCXXRecordDefinition(RD, /*Update*/true);
 
       // Visible update is handled separately.
-      uint64_t LexicalOffset = Record[Idx++];
+      uint64_t LexicalOffset = ReadLocalOffset(Record, Idx);
       if (!HadRealDefinition && LexicalOffset) {
         Reader.ReadLexicalDeclContextStorage(ModuleFile, ModuleFile.DeclsCursor,
                                              LexicalOffset, RD);
index 2fec5c2..5b5ecb1 100644 (file)
@@ -4661,8 +4661,7 @@ void ASTWriter::WriteDeclUpdatesBlocks(RecordDataImpl &OffsetsRecord) {
         auto *RD = cast<CXXRecordDecl>(D);
         UpdatedDeclContexts.insert(RD->getPrimaryContext());
         Record.AddCXXDefinitionData(RD);
-        // FIXME: Use AddOffset here.
-        Record.push_back(WriteDeclContextLexicalBlock(
+        Record.AddOffset(WriteDeclContextLexicalBlock(
             *Context, const_cast<CXXRecordDecl *>(RD)));
 
         // This state is sometimes updated by template instantiation, when we