mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 16:15:43 +00:00
make sure to calculate alignment of following modifiers properly
This commit is contained in:
parent
48d672edbe
commit
226c589bb8
@ -241,3 +241,13 @@ const IEvaluation* DeclarationModifierComputations::GetDynamicArraySizeEvaluatio
|
|||||||
|
|
||||||
return dynamic_cast<ArrayDeclarationModifier*>(declarationModifier)->m_dynamic_size_evaluation.get();
|
return dynamic_cast<ArrayDeclarationModifier*>(declarationModifier)->m_dynamic_size_evaluation.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DeclarationModifierComputations::GetAlignment() const
|
||||||
|
{
|
||||||
|
const auto following = GetFollowingDeclarationModifiers();
|
||||||
|
|
||||||
|
return std::any_of(following.begin(), following.end(), [](const DeclarationModifier* modifier)
|
||||||
|
{
|
||||||
|
return modifier->GetType() == DeclarationModifierType::POINTER;
|
||||||
|
}) ? m_information->m_member->GetAlignment() : m_information->m_member->m_type_declaration->m_type->GetAlignment();
|
||||||
|
}
|
||||||
|
@ -31,4 +31,5 @@ public:
|
|||||||
_NODISCARD const IEvaluation* GetPointerArrayCountEvaluation() const;
|
_NODISCARD const IEvaluation* GetPointerArrayCountEvaluation() const;
|
||||||
_NODISCARD bool IsDynamicArray() const;
|
_NODISCARD bool IsDynamicArray() const;
|
||||||
_NODISCARD const IEvaluation* GetDynamicArraySizeEvaluation() const;
|
_NODISCARD const IEvaluation* GetDynamicArraySizeEvaluation() const;
|
||||||
|
_NODISCARD int GetAlignment() const;
|
||||||
};
|
};
|
||||||
|
@ -898,7 +898,7 @@ class ZoneLoadTemplate::Internal final : BaseTemplate
|
|||||||
const auto typeDecl = MakeTypeDecl(member->m_member->m_type_declaration.get());
|
const auto typeDecl = MakeTypeDecl(member->m_member->m_type_declaration.get());
|
||||||
const auto followingReferences = MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers());
|
const auto followingReferences = MakeFollowingReferences(modifier.GetFollowingDeclarationModifiers());
|
||||||
LINE(MakeMemberAccess(info, member, modifier)<<" = m_stream->Alloc<"<<typeDecl<<followingReferences<<">(alignof("<<typeDecl<<followingReferences
|
LINE(MakeMemberAccess(info, member, modifier)<<" = m_stream->Alloc<"<<typeDecl<<followingReferences<<">(alignof("<<typeDecl<<followingReferences
|
||||||
<<")); // " << member->m_member->m_type_declaration->GetAlignment())
|
<<")); // " << modifier.GetAlignment())
|
||||||
|
|
||||||
if (computations.IsInTempBlock())
|
if (computations.IsInTempBlock())
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user