File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 20
20
#include < cassert>
21
21
#include < cstddef>
22
22
#include < type_traits>
23
+ #include " llvm/Support/PointerLikeTypeTraits.h"
23
24
24
25
namespace swift {
25
26
// / NullablePtr pointer wrapper - NullablePtr is used for APIs where a
@@ -81,4 +82,19 @@ class NullablePtr {
81
82
82
83
} // end namespace swift
83
84
85
+ namespace llvm {
86
+ template <typename T> struct PointerLikeTypeTraits ;
87
+ template <typename T> struct PointerLikeTypeTraits <swift::NullablePtr<T>> {
88
+ public:
89
+ static inline void *getAsVoidPointer (swift::NullablePtr<T> ptr) {
90
+ return static_cast <void *>(ptr.getPtrOrNull ());
91
+ }
92
+ static inline swift::NullablePtr<T> getFromVoidPointer (void *ptr) {
93
+ return swift::NullablePtr<T>(static_cast <T*>(ptr));
94
+ }
95
+ enum { NumLowBitsAvailable = PointerLikeTypeTraits<T *>::NumLowBitsAvailable };
96
+ };
97
+
98
+ }
99
+
84
100
#endif // SWIFT_BASIC_NULLABLEPTR_H
You can’t perform that action at this time.
0 commit comments