@@ -18,32 +18,34 @@ using namespace clang;
18
18
using namespace clang ::interp;
19
19
20
20
template <typename T>
21
- static void ctorTy (Block *, char *Ptr, bool , bool , bool , const Descriptor *) {
21
+ static void ctorTy (Block *, std::byte *Ptr, bool , bool , bool ,
22
+ const Descriptor *) {
22
23
new (Ptr) T ();
23
24
}
24
25
25
26
template <typename T>
26
- static void dtorTy (Block *, char *Ptr, const Descriptor *) {
27
+ static void dtorTy (Block *, std::byte *Ptr, const Descriptor *) {
27
28
reinterpret_cast <T *>(Ptr)->~T ();
28
29
}
29
30
30
31
template <typename T>
31
- static void moveTy (Block *, const char *Src, char *Dst, const Descriptor *) {
32
+ static void moveTy (Block *, const std::byte *Src, std::byte *Dst,
33
+ const Descriptor *) {
32
34
const auto *SrcPtr = reinterpret_cast <const T *>(Src);
33
35
auto *DstPtr = reinterpret_cast <T *>(Dst);
34
36
new (DstPtr) T (std::move (*SrcPtr));
35
37
}
36
38
37
39
template <typename T>
38
- static void ctorArrayTy (Block *, char *Ptr, bool , bool , bool ,
40
+ static void ctorArrayTy (Block *, std::byte *Ptr, bool , bool , bool ,
39
41
const Descriptor *D) {
40
42
for (unsigned I = 0 , NE = D->getNumElems (); I < NE; ++I) {
41
43
new (&reinterpret_cast <T *>(Ptr)[I]) T ();
42
44
}
43
45
}
44
46
45
47
template <typename T>
46
- static void dtorArrayTy (Block *, char *Ptr, const Descriptor *D) {
48
+ static void dtorArrayTy (Block *, std::byte *Ptr, const Descriptor *D) {
47
49
InitMap *IM = *reinterpret_cast <InitMap **>(Ptr);
48
50
if (IM != (InitMap *)-1 )
49
51
free (IM);
@@ -55,7 +57,7 @@ static void dtorArrayTy(Block *, char *Ptr, const Descriptor *D) {
55
57
}
56
58
57
59
template <typename T>
58
- static void moveArrayTy (Block *, const char *Src, char *Dst,
60
+ static void moveArrayTy (Block *, const std::byte *Src, std::byte *Dst,
59
61
const Descriptor *D) {
60
62
for (unsigned I = 0 , NE = D->getNumElems (); I < NE; ++I) {
61
63
const auto *SrcPtr = &reinterpret_cast <const T *>(Src)[I];
@@ -64,8 +66,8 @@ static void moveArrayTy(Block *, const char *Src, char *Dst,
64
66
}
65
67
}
66
68
67
- static void ctorArrayDesc (Block *B, char *Ptr, bool IsConst, bool IsMutable ,
68
- bool IsActive, const Descriptor *D) {
69
+ static void ctorArrayDesc (Block *B, std::byte *Ptr, bool IsConst,
70
+ bool IsMutable, bool IsActive, const Descriptor *D) {
69
71
const unsigned NumElems = D->getNumElems ();
70
72
const unsigned ElemSize =
71
73
D->ElemDesc ->getAllocSize () + sizeof (InlineDescriptor);
@@ -74,7 +76,7 @@ static void ctorArrayDesc(Block *B, char *Ptr, bool IsConst, bool IsMutable,
74
76
for (unsigned I = 0 ; I < NumElems; ++I, ElemOffset += ElemSize) {
75
77
auto *ElemPtr = Ptr + ElemOffset;
76
78
auto *Desc = reinterpret_cast <InlineDescriptor *>(ElemPtr);
77
- auto *ElemLoc = reinterpret_cast <char *>(Desc + 1 );
79
+ auto *ElemLoc = reinterpret_cast <std::byte *>(Desc + 1 );
78
80
auto *SD = D->ElemDesc ;
79
81
80
82
Desc->Offset = ElemOffset + sizeof (InlineDescriptor);
@@ -90,7 +92,7 @@ static void ctorArrayDesc(Block *B, char *Ptr, bool IsConst, bool IsMutable,
90
92
}
91
93
}
92
94
93
- static void dtorArrayDesc (Block *B, char *Ptr, const Descriptor *D) {
95
+ static void dtorArrayDesc (Block *B, std::byte *Ptr, const Descriptor *D) {
94
96
const unsigned NumElems = D->getNumElems ();
95
97
const unsigned ElemSize =
96
98
D->ElemDesc ->getAllocSize () + sizeof (InlineDescriptor);
@@ -99,13 +101,13 @@ static void dtorArrayDesc(Block *B, char *Ptr, const Descriptor *D) {
99
101
for (unsigned I = 0 ; I < NumElems; ++I, ElemOffset += ElemSize) {
100
102
auto *ElemPtr = Ptr + ElemOffset;
101
103
auto *Desc = reinterpret_cast <InlineDescriptor *>(ElemPtr);
102
- auto *ElemLoc = reinterpret_cast <char *>(Desc + 1 );
104
+ auto *ElemLoc = reinterpret_cast <std::byte *>(Desc + 1 );
103
105
if (auto Fn = D->ElemDesc ->DtorFn )
104
106
Fn (B, ElemLoc, D->ElemDesc );
105
107
}
106
108
}
107
109
108
- static void moveArrayDesc (Block *B, const char *Src, char *Dst,
110
+ static void moveArrayDesc (Block *B, const std::byte *Src, std::byte *Dst,
109
111
const Descriptor *D) {
110
112
const unsigned NumElems = D->getNumElems ();
111
113
const unsigned ElemSize =
@@ -117,17 +119,17 @@ static void moveArrayDesc(Block *B, const char *Src, char *Dst,
117
119
auto *DstPtr = Dst + ElemOffset;
118
120
119
121
const auto *SrcDesc = reinterpret_cast <const InlineDescriptor *>(SrcPtr);
120
- const auto *SrcElemLoc = reinterpret_cast <const char *>(SrcDesc + 1 );
122
+ const auto *SrcElemLoc = reinterpret_cast <const std::byte *>(SrcDesc + 1 );
121
123
auto *DstDesc = reinterpret_cast <InlineDescriptor *>(DstPtr);
122
- auto *DstElemLoc = reinterpret_cast <char *>(DstDesc + 1 );
124
+ auto *DstElemLoc = reinterpret_cast <std::byte *>(DstDesc + 1 );
123
125
124
126
*DstDesc = *SrcDesc;
125
127
if (auto Fn = D->ElemDesc ->MoveFn )
126
128
Fn (B, SrcElemLoc, DstElemLoc, D->ElemDesc );
127
129
}
128
130
}
129
131
130
- static void ctorRecord (Block *B, char *Ptr, bool IsConst, bool IsMutable,
132
+ static void ctorRecord (Block *B, std::byte *Ptr, bool IsConst, bool IsMutable,
131
133
bool IsActive, const Descriptor *D) {
132
134
const bool IsUnion = D->ElemRecord ->isUnion ();
133
135
auto CtorSub = [=](unsigned SubOff, Descriptor *F, bool IsBase) {
@@ -151,7 +153,7 @@ static void ctorRecord(Block *B, char *Ptr, bool IsConst, bool IsMutable,
151
153
CtorSub (V.Offset , V.Desc , /* isBase=*/ true );
152
154
}
153
155
154
- static void dtorRecord (Block *B, char *Ptr, const Descriptor *D) {
156
+ static void dtorRecord (Block *B, std::byte *Ptr, const Descriptor *D) {
155
157
auto DtorSub = [=](unsigned SubOff, Descriptor *F) {
156
158
if (auto Fn = F->DtorFn )
157
159
Fn (B, Ptr + SubOff, F);
@@ -164,7 +166,7 @@ static void dtorRecord(Block *B, char *Ptr, const Descriptor *D) {
164
166
DtorSub (F.Offset , F.Desc );
165
167
}
166
168
167
- static void moveRecord (Block *B, const char *Src, char *Dst,
169
+ static void moveRecord (Block *B, const std::byte *Src, std::byte *Dst,
168
170
const Descriptor *D) {
169
171
for (const auto &F : D->ElemRecord ->fields ()) {
170
172
auto FieldOff = F.Offset ;
0 commit comments