Skip to content

Commit 8e67edd

Browse files
Update symboldatabase.cpp
1 parent 1516cd2 commit 8e67edd

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

‎lib/symboldatabase.cpp‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8701,12 +8701,7 @@ static Result accumulateStructMembers(const Scope* scope, F f, ValueType::Accura
87018701
const MathLib::bigint dim = std::accumulate(var.dimensions().cbegin(), var.dimensions().cend(), MathLib::bigint(1), [](MathLib::bigint i1, const Dimension& dim) {
87028702
return i1 * dim.num;
87038703
});
8704-
if (var.nameToken()->scope() != scope && var.nameToken()->scope()->definedType) { // anonymous union
8705-
const auto ret = anonScopes.insert(var.nameToken()->scope());
8706-
if (ret.second)
8707-
total = f(total, *vt, dim, bits);
8708-
}
8709-
else if (vt->container && vt->container->startPattern == "std :: array <") {
8704+
if (vt->container && vt->container->startPattern == "std :: array <") {
87108705
const ValueType vtElement = ValueType::parseDecl(vt->containerTypeToken, settings);
87118706
total = f(total, vtElement, dim, bits);
87128707
}
@@ -8840,7 +8835,8 @@ size_t ValueType::getSizeOf( const Settings& settings, Accuracy accuracy, SizeOf
88408835
currentBitfieldAlloc = 0;
88418836
currentBitCount = 0;
88428837
}
8843-
return typeScope->type == ScopeType::eUnion ? std::max(total, n) : total + padding + n;
8838+
const bool isUnion = typeScope->type == ScopeType::eUnion || (vt2.typeScope && vt2.typeScope->nestedIn->type == ScopeType::eUnion && vt2.typeScope->nestedIn->className.empty());
8839+
return isUnion ? std::max(total, n) : total + padding + n;
88448840
};
88458841
Result result = accumulateStructMembers(typeScope, accHelper, accuracy, settings);
88468842
size_t total = result.total;

0 commit comments

Comments
 (0)