[Lldb-commits] [PATCH] D136584: [LLDB] Check that RegisterInfo and ContextInfo are trivial
David Spickett via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 24 01:56:44 PDT 2022
DavidSpickett created this revision.
Herald added a project: All.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
RegisterInfo is often initialised with a memcpy, and ContextInfo
does not run destructors for anything within it.
This was discussed in https://reviews.llvm.org/D134041.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D136584
Files:
lldb/include/lldb/Core/EmulateInstruction.h
lldb/include/lldb/lldb-private-types.h
Index: lldb/include/lldb/lldb-private-types.h
===================================================================
--- lldb/include/lldb/lldb-private-types.h
+++ lldb/include/lldb/lldb-private-types.h
@@ -15,6 +15,8 @@
#include "llvm/ADT/ArrayRef.h"
+#include <type_traits>
+
namespace llvm {
namespace sys {
class DynamicLibrary;
@@ -70,6 +72,8 @@
byte_size);
}
};
+static_assert(std::is_trivial<RegisterInfo>::value,
+ "RegisterInfo must be trivial.");
/// Registers are grouped into register sets
struct RegisterSet {
Index: lldb/include/lldb/Core/EmulateInstruction.h
===================================================================
--- lldb/include/lldb/Core/EmulateInstruction.h
+++ lldb/include/lldb/Core/EmulateInstruction.h
@@ -189,7 +189,7 @@
public:
enum InfoType GetInfoType() const { return info_type; }
- union {
+ union ContextInfo {
struct RegisterPlusOffset {
RegisterInfo reg; // base register
int64_t signed_offset; // signed offset added to base register
@@ -241,6 +241,8 @@
uint32_t isa;
} info;
+ static_assert(std::is_trivial<ContextInfo>::value,
+ "ContextInfo must be trivial.");
Context() = default;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136584.470084.patch
Type: text/x-patch
Size: 1289 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221024/77af8ef1/attachment.bin>
More information about the lldb-commits
mailing list