File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -146,19 +146,21 @@ class PointerIntEnum {
146
146
return ;
147
147
}
148
148
149
- Storage = uintptr_t (Kind) | (uintptr_t ( NewIndex) << IndexShiftOffset);
149
+ Storage = uintptr_t (Kind) | (NewIndex << IndexShiftOffset);
150
150
}
151
151
152
152
// / Initialize this PointerIntEnum with the kind \p Kind and the Pointer \p
153
153
// / Ptr.
154
154
PointerIntEnum (EnumTy Kind, PointerTy Ptr) {
155
+ void *VoidPtr = PtrTraits::getAsVoidPointer (Ptr);
156
+
155
157
// Make sure the pointer is at least aligned to NumPointerKindBits.
156
- assert ((uintptr_t (Ptr ) & ((1 << NumPointerKindBits) - 1 )) == 0 );
158
+ assert ((uintptr_t (VoidPtr ) & ((1 << NumPointerKindBits) - 1 )) == 0 );
157
159
// Make sure that Kind is a PointerKind.
158
160
assert (unsigned (Kind) >= unsigned (EnumTy::FirstPointerKind));
159
161
assert (unsigned (Kind) <= unsigned (EnumTy::LastPointerKind));
160
162
161
- Storage = uintptr_t (Ptr ) | uintptr_t (Kind);
163
+ Storage = uintptr_t (VoidPtr ) | uintptr_t (Kind);
162
164
}
163
165
164
166
PointerIntEnum (PointerIntEnum &&P) = default ;
@@ -213,7 +215,7 @@ class PointerIntEnum {
213
215
assert (isValid ());
214
216
assert (unsigned (*getKind ()) <= unsigned (EnumTy::LastPointerKind));
215
217
uintptr_t Value = Storage & ~(uintptr_t (EnumTy::FirstIndexKind));
216
- return reinterpret_cast <PointerTy>( Value);
218
+ return PtrTraits::getFromVoidPointer (( void *)( Value) );
217
219
}
218
220
219
221
// / Return the raw storage of the type. Used for testing purposes.
You can’t perform that action at this time.
0 commit comments