[PATCH] D155013: [compiler-rt][xray] Fix alignment of XRayFileHeader
Leandro Lupori via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 12 10:44:30 PDT 2023
luporl updated this revision to Diff 539632.
luporl added a comment.
Migrate away from C++23 deprecated `std::aligned_storage`
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155013/new/
https://reviews.llvm.org/D155013
Files:
compiler-rt/lib/xray/xray_fdr_logging.cpp
Index: compiler-rt/lib/xray/xray_fdr_logging.cpp
===================================================================
--- compiler-rt/lib/xray/xray_fdr_logging.cpp
+++ compiler-rt/lib/xray/xray_fdr_logging.cpp
@@ -15,6 +15,7 @@
//===----------------------------------------------------------------------===//
#include "xray_fdr_logging.h"
#include <cassert>
+#include <cstddef>
#include <errno.h>
#include <limits>
#include <memory>
@@ -140,7 +141,7 @@
}
static XRayFileHeader &fdrCommonHeaderInfo() {
- static std::aligned_storage<sizeof(XRayFileHeader)>::type HStorage;
+ alignas(XRayFileHeader) static std::byte HStorage[sizeof(XRayFileHeader)];
static pthread_once_t OnceInit = PTHREAD_ONCE_INIT;
static bool TSCSupported = true;
static uint64_t CycleFrequency = NanosecondsPerSecond;
@@ -204,7 +205,8 @@
// initialized the first time this function is called. We'll update one part
// of this information with some relevant data (in particular the number of
// buffers to expect).
- static std::aligned_storage<sizeof(XRayFileHeader)>::type HeaderStorage;
+ alignas(
+ XRayFileHeader) static std::byte HeaderStorage[sizeof(XRayFileHeader)];
static pthread_once_t HeaderOnce = PTHREAD_ONCE_INIT;
pthread_once(
&HeaderOnce, +[] {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155013.539632.patch
Type: text/x-patch
Size: 1281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230712/21e99684/attachment.bin>
More information about the llvm-commits
mailing list