[clang] 130e612 - [clang][bytecode][NFC] Move Pointer::StorageKind above the union (#147942)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 10 06:05:32 PDT 2025
Author: Timm Baeder
Date: 2025-07-10T15:05:28+02:00
New Revision: 130e6121f5bb1a54c591133d050aa1311ce16d7f
URL: https://github.com/llvm/llvm-project/commit/130e6121f5bb1a54c591133d050aa1311ce16d7f
DIFF: https://github.com/llvm/llvm-project/commit/130e6121f5bb1a54c591133d050aa1311ce16d7f.diff
LOG: [clang][bytecode][NFC] Move Pointer::StorageKind above the union (#147942)
This is easier to read in debuggers and more common.
Added:
Modified:
clang/lib/AST/ByteCode/Pointer.cpp
clang/lib/AST/ByteCode/Pointer.h
Removed:
################################################################################
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 6769e51a8ad00..159b4238a6a04 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -30,8 +30,8 @@ Pointer::Pointer(Block *Pointee, uint64_t BaseAndOffset)
: Pointer(Pointee, BaseAndOffset, BaseAndOffset) {}
Pointer::Pointer(const Pointer &P)
- : Offset(P.Offset), PointeeStorage(P.PointeeStorage),
- StorageKind(P.StorageKind) {
+ : Offset(P.Offset), StorageKind(P.StorageKind),
+ PointeeStorage(P.PointeeStorage) {
if (isBlockPointer() && PointeeStorage.BS.Pointee)
PointeeStorage.BS.Pointee->addPointer(this);
@@ -48,8 +48,8 @@ Pointer::Pointer(Block *Pointee, unsigned Base, uint64_t Offset)
}
Pointer::Pointer(Pointer &&P)
- : Offset(P.Offset), PointeeStorage(P.PointeeStorage),
- StorageKind(P.StorageKind) {
+ : Offset(P.Offset), StorageKind(P.StorageKind),
+ PointeeStorage(P.PointeeStorage) {
if (StorageKind == Storage::Block && PointeeStorage.BS.Pointee)
PointeeStorage.BS.Pointee->replacePointer(&P, this);
diff --git a/clang/lib/AST/ByteCode/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h
index d525f84fd6605..e6a64e6658f06 100644
--- a/clang/lib/AST/ByteCode/Pointer.h
+++ b/clang/lib/AST/ByteCode/Pointer.h
@@ -809,13 +809,13 @@ class Pointer {
/// Next link in the pointer chain.
Pointer *Next = nullptr;
+ Storage StorageKind = Storage::Int;
union {
BlockPointer BS;
IntPointer Int;
FunctionPointer Fn;
TypeidPointer Typeid;
} PointeeStorage;
- Storage StorageKind = Storage::Int;
};
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Pointer &P) {
More information about the cfe-commits
mailing list