Fix multiple definition error caused by forward declarations

This commit is contained in:
Martchus 2018-11-08 00:38:39 +01:00
parent 712eb4fb28
commit ef27d71f43
3 changed files with 11 additions and 1 deletions

View File

@ -10,7 +10,7 @@ set(META_APP_CATEGORIES "Utility;")
set(META_GUI_OPTIONAL false)
set(META_VERSION_MAJOR 0)
set(META_VERSION_MINOR 0)
set(META_VERSION_PATCH 6)
set(META_VERSION_PATCH 7)
set(META_APP_VERSION ${META_VERSION_MAJOR}.${META_VERSION_MINOR}.${META_VERSION_PATCH})
set(META_CXX_STANDARD 17)

View File

@ -67,6 +67,11 @@ void SerializationCodeGenerator::addDeclaration(clang::Decl *decl)
SerializationCodeGenerator::IsRelevant SerializationCodeGenerator::isQualifiedNameIfRelevant(
clang::CXXRecordDecl *record, const std::string &qualifiedName) const
{
// skip all classes which are only forward-declared
if (!record->isCompleteDefinition()) {
return IsRelevant::No;
}
// consider all classes for which a specialization of the "AdaptedJsonSerializable" struct is available
for (const auto &adaptionRecord : m_adaptionRecords) {
// skip all adaption records which are only included

View File

@ -37,6 +37,11 @@ private:
string privateString = "not going to be serialized";
};
// forward declarations shouldn't cause the generator to emit the code multiple times
struct TestStruct;
struct TestStruct;
struct TestStruct;
class JsonGeneratorTests;
/*!