From 02cd1a77189cfb78e7b606f92d14059d62d8e6ec Mon Sep 17 00:00:00 2001 From: Fabian Schiebel Date: Mon, 21 Oct 2024 19:41:30 +0200 Subject: [PATCH] Add alignment comment --- .../DataFlow/IfdsIde/Solver/GenericSolverResults.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h b/include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h index e14162c0b..280d9571f 100644 --- a/include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h +++ b/include/phasar/DataFlow/IfdsIde/Solver/GenericSolverResults.h @@ -55,8 +55,15 @@ template class GenericSolverResults final { static_assert(std::is_trivially_copyable_v, "SolverResults should only be a *view* into the results of " "an IFDS/IDE solver."); - static_assert(alignof(type) <= alignof(void *)); - static_assert(sizeof(type) <= sizeof(Buffer)); + + /// NOTE: We reinterpret the bytes of the `Buffer` as `type`, so it better + /// be properly aligned + static_assert( + alignof(type) <= alignof(void *), + "The solver-results type is improperly aligned for the inline buffer"); + static_assert( + sizeof(type) <= sizeof(Buffer), + "The inline buffer is to small to hold this type of solver-result"); static_assert(std::is_trivially_copyable_v);