Skip to content

Commit b20e8e9

Browse files
committed
[Serialization] Avoid using BCRecordLayout for decoding swiftdocs
BCRecordLayout currently assumes that the layout described in source always matches the layout in the bitstream being read. Since we want swiftdocs to be a forward-compatible format, avoid using it for deserialization. (In the future, we may want to augment BCRecordLayout to handle records with more fields than expected. For now, though, this is a sufficient change.)
1 parent 449e5ec commit b20e8e9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/Serialization/ModuleFile.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,8 +955,9 @@ class ModuleFile::DeclCommentTableInfo {
955955
std::unique_ptr<ModuleFile::SerializedDeclCommentTable>
956956
ModuleFile::readDeclCommentTable(ArrayRef<uint64_t> fields,
957957
StringRef blobData) {
958-
uint32_t tableOffset;
959-
index_block::DeclListLayout::readRecord(fields, tableOffset);
958+
if (fields.empty() || blobData.empty())
959+
return nullptr;
960+
uint32_t tableOffset = static_cast<uint32_t>(fields.front());
960961
auto base = reinterpret_cast<const uint8_t *>(blobData.data());
961962

962963
return std::unique_ptr<SerializedDeclCommentTable>(

0 commit comments

Comments
 (0)