[llvm] [BinaryFormat] Add "SFrame" structures and constants (PR #147264)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 09:46:59 PDT 2025


================
@@ -0,0 +1,98 @@
+//===- SFrameTest.cpp -----------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/BinaryFormat/SFrame.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+using namespace llvm::sframe;
+
+namespace {
+// Test structure sizes and triviality.
+static_assert(std::is_trivial_v<sframe_preamble>);
+static_assert(sizeof(sframe_preamble) == 4);
----------------
dwblaikie wrote:

Seems as easy/probably better to use the stuff in Endian.h to provide an endian correct view type over the underlying thing? The iterator can return a static_cast pointer to struct with the endian types as members -  and readers can read/write the underlying memory without the need to copy/bitfiddle any parts that aren't needed?

https://github.com/llvm/llvm-project/pull/147264


More information about the llvm-commits mailing list