[llvm] [llvm] Replace deprecated aligned_storage with aligned byte array (PR #94169)
Marc Auberer via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 2 12:54:28 PDT 2024
https://github.com/marcauberer updated https://github.com/llvm/llvm-project/pull/94169
>From 0cb76e8abd2dfad0fbe46af59eb4513b847e2d48 Mon Sep 17 00:00:00 2001
From: Marc Auberer <marc.auberer at chillibits.com>
Date: Sun, 2 Jun 2024 21:18:55 +0200
Subject: [PATCH 1/3] Replace deprecated aligned_storage with aligned byte
array
---
llvm/include/llvm/ADT/FunctionExtras.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/include/llvm/ADT/FunctionExtras.h b/llvm/include/llvm/ADT/FunctionExtras.h
index c0bc30c7450fe..49e0e8ab0db40 100644
--- a/llvm/include/llvm/ADT/FunctionExtras.h
+++ b/llvm/include/llvm/ADT/FunctionExtras.h
@@ -161,8 +161,7 @@ template <typename ReturnT, typename... ParamTs> class UniqueFunctionBase {
// provide three pointers worth of storage here.
// This is mutable as an inlined `const unique_function<void() const>` may
// still modify its own mutable members.
- mutable std::aligned_storage_t<InlineStorageSize, alignof(void *)>
- InlineStorage;
+ alignas(void *) mutable std::byte InlineStorage[InlineStorageSize];
} StorageUnion;
// A compressed pointer to either our dispatching callback or our table of
>From edee0957ffd4fa1829e9ef2e4dd0231c0540f792 Mon Sep 17 00:00:00 2001
From: Marc Auberer <marc.auberer at chillibits.com>
Date: Sun, 2 Jun 2024 21:47:11 +0200
Subject: [PATCH 2/3] Also replace occurrences in PrettyStackTrace
---
llvm/lib/Support/PrettyStackTrace.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Support/PrettyStackTrace.cpp b/llvm/lib/Support/PrettyStackTrace.cpp
index f9f1b8a419b82..7c6d84d3697db 100644
--- a/llvm/lib/Support/PrettyStackTrace.cpp
+++ b/llvm/lib/Support/PrettyStackTrace.cpp
@@ -143,10 +143,8 @@ static void setCrashLogMessage(const char *msg) {
#ifdef __APPLE__
using CrashHandlerString = SmallString<2048>;
-using CrashHandlerStringStorage =
- std::aligned_storage<sizeof(CrashHandlerString),
- alignof(CrashHandlerString)>::type;
-static CrashHandlerStringStorage crashHandlerStringStorage;
+using CrashHandlerStringStorage = std::byte[sizeof(CrashHandlerString)];
+alignas(CrashHandlerString) static CrashHandlerStringStorage crashHandlerStringStorage;
#endif
/// This callback is run if a fatal signal is delivered to the process, it
>From 70336ebab79ddabe92c4c35a961bf2a186fa0879 Mon Sep 17 00:00:00 2001
From: Marc Auberer <marc.auberer at chillibits.com>
Date: Sun, 2 Jun 2024 21:54:16 +0200
Subject: [PATCH 3/3] Format
---
llvm/lib/Support/PrettyStackTrace.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/Support/PrettyStackTrace.cpp b/llvm/lib/Support/PrettyStackTrace.cpp
index 7c6d84d3697db..9b09384e95bfe 100644
--- a/llvm/lib/Support/PrettyStackTrace.cpp
+++ b/llvm/lib/Support/PrettyStackTrace.cpp
@@ -144,7 +144,8 @@ static void setCrashLogMessage(const char *msg) {
#ifdef __APPLE__
using CrashHandlerString = SmallString<2048>;
using CrashHandlerStringStorage = std::byte[sizeof(CrashHandlerString)];
-alignas(CrashHandlerString) static CrashHandlerStringStorage crashHandlerStringStorage;
+alignas(CrashHandlerString) static CrashHandlerStringStorage
+ crashHandlerStringStorage;
#endif
/// This callback is run if a fatal signal is delivered to the process, it
More information about the llvm-commits
mailing list