Skip to content

Commit 130e612

Browse files
authored
[clang][bytecode][NFC] Move Pointer::StorageKind above the union (#147942)
This is easier to read in debuggers and more common.
1 parent 7bbb65c commit 130e612

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

clang/lib/AST/ByteCode/Pointer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ Pointer::Pointer(Block *Pointee, uint64_t BaseAndOffset)
3030
: Pointer(Pointee, BaseAndOffset, BaseAndOffset) {}
3131

3232
Pointer::Pointer(const Pointer &P)
33-
: Offset(P.Offset), PointeeStorage(P.PointeeStorage),
34-
StorageKind(P.StorageKind) {
33+
: Offset(P.Offset), StorageKind(P.StorageKind),
34+
PointeeStorage(P.PointeeStorage) {
3535

3636
if (isBlockPointer() && PointeeStorage.BS.Pointee)
3737
PointeeStorage.BS.Pointee->addPointer(this);
@@ -48,8 +48,8 @@ Pointer::Pointer(Block *Pointee, unsigned Base, uint64_t Offset)
4848
}
4949

5050
Pointer::Pointer(Pointer &&P)
51-
: Offset(P.Offset), PointeeStorage(P.PointeeStorage),
52-
StorageKind(P.StorageKind) {
51+
: Offset(P.Offset), StorageKind(P.StorageKind),
52+
PointeeStorage(P.PointeeStorage) {
5353

5454
if (StorageKind == Storage::Block && PointeeStorage.BS.Pointee)
5555
PointeeStorage.BS.Pointee->replacePointer(&P, this);

clang/lib/AST/ByteCode/Pointer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -809,13 +809,13 @@ class Pointer {
809809
/// Next link in the pointer chain.
810810
Pointer *Next = nullptr;
811811

812+
Storage StorageKind = Storage::Int;
812813
union {
813814
BlockPointer BS;
814815
IntPointer Int;
815816
FunctionPointer Fn;
816817
TypeidPointer Typeid;
817818
} PointeeStorage;
818-
Storage StorageKind = Storage::Int;
819819
};
820820

821821
inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Pointer &P) {

0 commit comments

Comments
 (0)