//===--- HeaderFooterLayout.h -----------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef SWIFT_BASIC_HEADER_FOOTER_LAYOUT_H #define SWIFT_BASIC_HEADER_FOOTER_LAYOUT_H #include namespace swift { template class size_without_trailing_padding { struct ExtraByte { char _size_without_trailing_padding_probe; }; struct Probe: T, ExtraByte {}; public: #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" enum { value = offsetof(Probe, _size_without_trailing_padding_probe) }; #pragma clang diagnostic pop }; namespace detail { template struct LayoutPadding { char padding[size]; }; template <> struct LayoutPadding<0> {}; template struct HeaderFooterLayoutPaddingSize { enum : ptrdiff_t { maxFooterOffset = TotalSize - (ptrdiff_t)size_without_trailing_padding