From 60d761f7ede5cb12e065780d8dea9b3da3f4f592 Mon Sep 17 00:00:00 2001 From: Martchus Date: Sun, 15 May 2022 21:00:02 +0200 Subject: [PATCH] Pass version down to base classes in binary deserializer So the behavior is consistent with readng members and with serialization. It should be fine because if the base class is versioned it won't make a difference but if it is versioned the version from the derived class can be utilized. --- generator/binaryserializationcodegenerator.cpp | 2 +- lib/binary/reflector.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/generator/binaryserializationcodegenerator.cpp b/generator/binaryserializationcodegenerator.cpp index 83bce11..859dbfe 100644 --- a/generator/binaryserializationcodegenerator.cpp +++ b/generator/binaryserializationcodegenerator.cpp @@ -319,7 +319,7 @@ void BinarySerializationCodeGenerator::generate(std::ostream &os) const } os << " // read base classes\n"; for (const RelevantClass *baseClass : relevantBases) { - os << " deserializer.read(static_cast<::" << baseClass->qualifiedName << " &>(customObject));\n"; + os << " deserializer.read(static_cast<::" << baseClass->qualifiedName << " &>(customObject), version);\n"; } os << " // read members\n"; for (clang::Decl *const decl : relevantClass.record->decls()) { diff --git a/lib/binary/reflector.h b/lib/binary/reflector.h index c789542..28a7002 100644 --- a/lib/binary/reflector.h +++ b/lib/binary/reflector.h @@ -57,7 +57,7 @@ class BinarySerializer; /// \brief Reads \a customType via \a deserializer. /// \remarks /// - If \tp Type is versioned, the version is determined from the data. Otherwise \a version is assumed. -/// - The specified \a version shall be passed to nested invocations. +/// - The determined or specified \a version shall be passed to nested invocations. /// \returns Returns the determined/assumed version. template > * = nullptr> BinaryVersion readCustomType(BinaryDeserializer &deserializer, Type &customType, BinaryVersion version = 0);