[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.)
This commit is contained in:
Jordan Rose
2018-09-25 09:30:36 -07:00
parent 449e5ecd74
commit b20e8e9cfa

View File

@@ -955,8 +955,9 @@ public:
std::unique_ptr<ModuleFile::SerializedDeclCommentTable>
ModuleFile::readDeclCommentTable(ArrayRef<uint64_t> fields,
StringRef blobData) {
uint32_t tableOffset;
index_block::DeclListLayout::readRecord(fields, tableOffset);
if (fields.empty() || blobData.empty())
return nullptr;
uint32_t tableOffset = static_cast<uint32_t>(fields.front());
auto base = reinterpret_cast<const uint8_t *>(blobData.data());
return std::unique_ptr<SerializedDeclCommentTable>(